From 8b09d8ac74680c780f35539dabf439af1d4efff5 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Wed, 3 Jul 2024 18:00:08 +0200 Subject: [PATCH 1/9] feat: 1.6.x --- README.md | 2 +- docs/account.md | 4 +- .../account/create-anonymous-session.md | 2 +- .../account/create-email-password-session.md | 2 +- docs/examples/account/create-email-token.md | 2 +- docs/examples/account/create-j-w-t.md | 2 +- .../account/create-magic-u-r-l-token.md | 2 +- .../account/create-mfa-authenticator.md | 2 +- docs/examples/account/create-mfa-challenge.md | 2 +- .../account/create-mfa-recovery-codes.md | 2 +- docs/examples/account/create-o-auth2token.md | 2 +- docs/examples/account/create-phone-token.md | 2 +- .../account/create-phone-verification.md | 2 +- docs/examples/account/create-recovery.md | 2 +- docs/examples/account/create-session.md | 2 +- docs/examples/account/create-verification.md | 2 +- docs/examples/account/create.md | 2 +- docs/examples/account/delete-identity.md | 2 +- .../account/delete-mfa-authenticator.md | 2 +- docs/examples/account/delete-session.md | 2 +- docs/examples/account/delete-sessions.md | 2 +- .../account/get-mfa-recovery-codes.md | 2 +- docs/examples/account/get-prefs.md | 2 +- docs/examples/account/get-session.md | 2 +- docs/examples/account/get.md | 2 +- docs/examples/account/list-identities.md | 2 +- docs/examples/account/list-logs.md | 2 +- docs/examples/account/list-mfa-factors.md | 2 +- docs/examples/account/list-sessions.md | 2 +- docs/examples/account/update-email.md | 2 +- docs/examples/account/update-m-f-a.md | 2 +- .../account/update-magic-u-r-l-session.md | 2 +- .../account/update-mfa-authenticator.md | 2 +- docs/examples/account/update-mfa-challenge.md | 2 +- .../account/update-mfa-recovery-codes.md | 2 +- docs/examples/account/update-name.md | 2 +- docs/examples/account/update-password.md | 2 +- docs/examples/account/update-phone-session.md | 2 +- .../account/update-phone-verification.md | 2 +- docs/examples/account/update-phone.md | 2 +- docs/examples/account/update-prefs.md | 2 +- docs/examples/account/update-recovery.md | 2 +- docs/examples/account/update-session.md | 2 +- docs/examples/account/update-status.md | 2 +- docs/examples/account/update-verification.md | 2 +- docs/examples/avatars/get-browser.md | 2 +- docs/examples/avatars/get-credit-card.md | 2 +- docs/examples/avatars/get-favicon.md | 2 +- docs/examples/avatars/get-flag.md | 2 +- docs/examples/avatars/get-image.md | 2 +- docs/examples/avatars/get-initials.md | 2 +- docs/examples/avatars/get-q-r.md | 2 +- .../databases/create-boolean-attribute.md | 4 +- docs/examples/databases/create-collection.md | 4 +- .../databases/create-datetime-attribute.md | 4 +- docs/examples/databases/create-document.md | 2 +- .../databases/create-email-attribute.md | 4 +- .../databases/create-enum-attribute.md | 4 +- .../databases/create-float-attribute.md | 4 +- docs/examples/databases/create-index.md | 4 +- .../databases/create-integer-attribute.md | 4 +- .../examples/databases/create-ip-attribute.md | 4 +- .../create-relationship-attribute.md | 4 +- .../databases/create-string-attribute.md | 4 +- .../databases/create-url-attribute.md | 4 +- docs/examples/databases/create.md | 4 +- docs/examples/databases/delete-attribute.md | 4 +- docs/examples/databases/delete-collection.md | 4 +- docs/examples/databases/delete-document.md | 2 +- docs/examples/databases/delete-index.md | 4 +- docs/examples/databases/delete.md | 4 +- docs/examples/databases/get-attribute.md | 4 +- docs/examples/databases/get-collection.md | 4 +- docs/examples/databases/get-document.md | 2 +- docs/examples/databases/get-index.md | 4 +- docs/examples/databases/get.md | 4 +- docs/examples/databases/list-attributes.md | 4 +- docs/examples/databases/list-collections.md | 4 +- docs/examples/databases/list-documents.md | 2 +- docs/examples/databases/list-indexes.md | 4 +- docs/examples/databases/list.md | 4 +- .../databases/update-boolean-attribute.md | 4 +- docs/examples/databases/update-collection.md | 4 +- .../databases/update-datetime-attribute.md | 4 +- docs/examples/databases/update-document.md | 2 +- .../databases/update-email-attribute.md | 4 +- .../databases/update-enum-attribute.md | 4 +- .../databases/update-float-attribute.md | 4 +- .../databases/update-integer-attribute.md | 4 +- .../examples/databases/update-ip-attribute.md | 4 +- .../update-relationship-attribute.md | 4 +- .../databases/update-string-attribute.md | 4 +- .../databases/update-url-attribute.md | 4 +- docs/examples/databases/update.md | 4 +- docs/examples/functions/create-build.md | 6 +- docs/examples/functions/create-deployment.md | 4 +- docs/examples/functions/create-execution.md | 5 +- docs/examples/functions/create-variable.md | 4 +- docs/examples/functions/create.md | 5 +- docs/examples/functions/delete-deployment.md | 4 +- docs/examples/functions/delete-execution.md | 16 ++++ docs/examples/functions/delete-variable.md | 4 +- docs/examples/functions/delete.md | 4 +- .../examples/functions/download-deployment.md | 4 +- docs/examples/functions/get-deployment.md | 4 +- docs/examples/functions/get-execution.md | 2 +- docs/examples/functions/get-variable.md | 4 +- docs/examples/functions/get.md | 4 +- docs/examples/functions/list-deployments.md | 4 +- docs/examples/functions/list-executions.md | 2 +- docs/examples/functions/list-runtimes.md | 4 +- docs/examples/functions/list-variables.md | 4 +- docs/examples/functions/list.md | 4 +- .../functions/update-deployment-build.md | 16 ++++ docs/examples/functions/update-deployment.md | 4 +- docs/examples/functions/update-variable.md | 4 +- docs/examples/functions/update.md | 5 +- docs/examples/graphql/mutation.md | 4 +- docs/examples/graphql/query.md | 4 +- docs/examples/health/get-antivirus.md | 4 +- docs/examples/health/get-cache.md | 4 +- docs/examples/health/get-certificate.md | 4 +- docs/examples/health/get-d-b.md | 4 +- docs/examples/health/get-failed-jobs.md | 4 +- docs/examples/health/get-pub-sub.md | 4 +- docs/examples/health/get-queue-builds.md | 4 +- .../examples/health/get-queue-certificates.md | 4 +- docs/examples/health/get-queue-databases.md | 4 +- docs/examples/health/get-queue-deletes.md | 4 +- docs/examples/health/get-queue-functions.md | 4 +- docs/examples/health/get-queue-logs.md | 4 +- docs/examples/health/get-queue-mails.md | 4 +- docs/examples/health/get-queue-messaging.md | 4 +- docs/examples/health/get-queue-migrations.md | 4 +- docs/examples/health/get-queue-usage-dump.md | 4 +- docs/examples/health/get-queue-usage.md | 4 +- docs/examples/health/get-queue-webhooks.md | 4 +- docs/examples/health/get-queue.md | 4 +- docs/examples/health/get-storage-local.md | 4 +- docs/examples/health/get-storage.md | 4 +- docs/examples/health/get-time.md | 4 +- docs/examples/health/get.md | 4 +- docs/examples/locale/get.md | 2 +- docs/examples/locale/list-codes.md | 2 +- docs/examples/locale/list-continents.md | 2 +- docs/examples/locale/list-countries-e-u.md | 2 +- docs/examples/locale/list-countries-phones.md | 2 +- docs/examples/locale/list-countries.md | 2 +- docs/examples/locale/list-currencies.md | 2 +- docs/examples/locale/list-languages.md | 2 +- .../messaging/create-apns-provider.md | 4 +- docs/examples/messaging/create-email.md | 4 +- .../examples/messaging/create-fcm-provider.md | 4 +- .../messaging/create-mailgun-provider.md | 4 +- .../messaging/create-msg91provider.md | 4 +- docs/examples/messaging/create-push.md | 4 +- .../messaging/create-sendgrid-provider.md | 4 +- docs/examples/messaging/create-sms.md | 4 +- .../messaging/create-smtp-provider.md | 4 +- docs/examples/messaging/create-subscriber.md | 4 +- .../messaging/create-telesign-provider.md | 4 +- .../messaging/create-textmagic-provider.md | 4 +- docs/examples/messaging/create-topic.md | 4 +- .../messaging/create-twilio-provider.md | 4 +- .../messaging/create-vonage-provider.md | 4 +- docs/examples/messaging/delete-provider.md | 4 +- docs/examples/messaging/delete-subscriber.md | 4 +- docs/examples/messaging/delete-topic.md | 4 +- docs/examples/messaging/delete.md | 4 +- docs/examples/messaging/get-message.md | 4 +- docs/examples/messaging/get-provider.md | 4 +- docs/examples/messaging/get-subscriber.md | 4 +- docs/examples/messaging/get-topic.md | 4 +- docs/examples/messaging/list-message-logs.md | 4 +- docs/examples/messaging/list-messages.md | 4 +- docs/examples/messaging/list-provider-logs.md | 4 +- docs/examples/messaging/list-providers.md | 4 +- .../messaging/list-subscriber-logs.md | 4 +- docs/examples/messaging/list-subscribers.md | 4 +- docs/examples/messaging/list-targets.md | 4 +- docs/examples/messaging/list-topic-logs.md | 4 +- docs/examples/messaging/list-topics.md | 4 +- .../messaging/update-apns-provider.md | 4 +- docs/examples/messaging/update-email.md | 4 +- .../examples/messaging/update-fcm-provider.md | 4 +- .../messaging/update-mailgun-provider.md | 4 +- .../messaging/update-msg91provider.md | 4 +- docs/examples/messaging/update-push.md | 4 +- .../messaging/update-sendgrid-provider.md | 4 +- docs/examples/messaging/update-sms.md | 4 +- .../messaging/update-smtp-provider.md | 4 +- .../messaging/update-telesign-provider.md | 4 +- .../messaging/update-textmagic-provider.md | 4 +- docs/examples/messaging/update-topic.md | 4 +- .../messaging/update-twilio-provider.md | 4 +- .../messaging/update-vonage-provider.md | 4 +- docs/examples/storage/create-bucket.md | 4 +- docs/examples/storage/create-file.md | 2 +- docs/examples/storage/delete-bucket.md | 4 +- docs/examples/storage/delete-file.md | 2 +- docs/examples/storage/get-bucket.md | 4 +- docs/examples/storage/get-file-download.md | 2 +- docs/examples/storage/get-file-preview.md | 2 +- docs/examples/storage/get-file-view.md | 2 +- docs/examples/storage/get-file.md | 2 +- docs/examples/storage/list-buckets.md | 4 +- docs/examples/storage/list-files.md | 2 +- docs/examples/storage/update-bucket.md | 4 +- docs/examples/storage/update-file.md | 2 +- docs/examples/teams/create-membership.md | 2 +- docs/examples/teams/create.md | 2 +- docs/examples/teams/delete-membership.md | 2 +- docs/examples/teams/delete.md | 2 +- docs/examples/teams/get-membership.md | 2 +- docs/examples/teams/get-prefs.md | 2 +- docs/examples/teams/get.md | 2 +- docs/examples/teams/list-memberships.md | 2 +- docs/examples/teams/list.md | 2 +- .../teams/update-membership-status.md | 2 +- docs/examples/teams/update-membership.md | 2 +- docs/examples/teams/update-name.md | 2 +- docs/examples/teams/update-prefs.md | 2 +- docs/examples/users/create-argon2user.md | 4 +- docs/examples/users/create-bcrypt-user.md | 4 +- docs/examples/users/create-j-w-t.md | 17 ++++ docs/examples/users/create-m-d5user.md | 4 +- .../users/create-mfa-recovery-codes.md | 4 +- docs/examples/users/create-p-h-pass-user.md | 4 +- docs/examples/users/create-s-h-a-user.md | 4 +- .../users/create-scrypt-modified-user.md | 4 +- docs/examples/users/create-scrypt-user.md | 4 +- docs/examples/users/create-session.md | 4 +- docs/examples/users/create-target.md | 4 +- docs/examples/users/create-token.md | 4 +- docs/examples/users/create.md | 4 +- docs/examples/users/delete-identity.md | 4 +- .../users/delete-mfa-authenticator.md | 4 +- docs/examples/users/delete-session.md | 4 +- docs/examples/users/delete-sessions.md | 4 +- docs/examples/users/delete-target.md | 4 +- docs/examples/users/delete.md | 4 +- docs/examples/users/get-mfa-recovery-codes.md | 4 +- docs/examples/users/get-prefs.md | 4 +- docs/examples/users/get-target.md | 4 +- docs/examples/users/get.md | 4 +- docs/examples/users/list-identities.md | 4 +- docs/examples/users/list-logs.md | 4 +- docs/examples/users/list-memberships.md | 4 +- docs/examples/users/list-mfa-factors.md | 4 +- docs/examples/users/list-sessions.md | 4 +- docs/examples/users/list-targets.md | 4 +- docs/examples/users/list.md | 4 +- .../users/update-email-verification.md | 4 +- docs/examples/users/update-email.md | 4 +- docs/examples/users/update-labels.md | 4 +- .../users/update-mfa-recovery-codes.md | 4 +- docs/examples/users/update-mfa.md | 4 +- docs/examples/users/update-name.md | 4 +- docs/examples/users/update-password.md | 4 +- .../users/update-phone-verification.md | 4 +- docs/examples/users/update-phone.md | 4 +- docs/examples/users/update-prefs.md | 4 +- docs/examples/users/update-status.md | 4 +- docs/examples/users/update-target.md | 4 +- docs/functions.md | 40 +++++++- docs/storage.md | 6 +- docs/teams.md | 2 +- docs/users.md | 16 ++++ src/Appwrite/Client.php | 4 +- src/Appwrite/Enums/Name.php | 10 +- src/Appwrite/Enums/Runtime.php | 32 ++----- src/Appwrite/Services/Account.php | 4 +- src/Appwrite/Services/Functions.php | 94 ++++++++++++++++--- src/Appwrite/Services/Users.php | 38 ++++++++ tests/Appwrite/Services/FunctionsTest.php | 50 +++++++++- tests/Appwrite/Services/UsersTest.php | 17 ++++ 276 files changed, 746 insertions(+), 491 deletions(-) create mode 100644 docs/examples/functions/delete-execution.md create mode 100644 docs/examples/functions/update-deployment-build.md create mode 100644 docs/examples/users/create-j-w-t.md diff --git a/README.md b/README.md index c8d7a42..34df70f 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) -**This SDK is compatible with Appwrite server version 1.5.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-php/releases).** +**This SDK is compatible with Appwrite server version 1.6.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-php/releases).** Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the PHP SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) diff --git a/docs/account.md b/docs/account.md index 3a74c26..6f5694e 100644 --- a/docs/account.md +++ b/docs/account.md @@ -73,7 +73,7 @@ DELETE https://cloud.appwrite.io/v1/account/identities/{identityId} ## Create JWT ```http request -POST https://cloud.appwrite.io/v1/account/jwt +POST https://cloud.appwrite.io/v1/account/jwts ``` ** Use this endpoint to create a JSON Web Token. You can use the resulting JWT to authenticate on behalf of the current user when working with the Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes from its creation and will be invalid if the user will logout in that time frame. ** @@ -126,7 +126,7 @@ POST https://cloud.appwrite.io/v1/account/mfa/authenticators/{type} PUT https://cloud.appwrite.io/v1/account/mfa/authenticators/{type} ``` -** Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method. add ** +** Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method. ** ### Parameters diff --git a/docs/examples/account/create-anonymous-session.md b/docs/examples/account/create-anonymous-session.md index 950bb4a..c43c60e 100644 --- a/docs/examples/account/create-anonymous-session.md +++ b/docs/examples/account/create-anonymous-session.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2'); // Your project ID + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID $account = new Account($client); diff --git a/docs/examples/account/create-email-password-session.md b/docs/examples/account/create-email-password-session.md index 3fd96f3..faefc33 100644 --- a/docs/examples/account/create-email-password-session.md +++ b/docs/examples/account/create-email-password-session.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2'); // Your project ID + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID $account = new Account($client); diff --git a/docs/examples/account/create-email-token.md b/docs/examples/account/create-email-token.md index 1477366..68dd7f4 100644 --- a/docs/examples/account/create-email-token.md +++ b/docs/examples/account/create-email-token.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2'); // Your project ID + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID $account = new Account($client); diff --git a/docs/examples/account/create-j-w-t.md b/docs/examples/account/create-j-w-t.md index d59316f..33479c4 100644 --- a/docs/examples/account/create-j-w-t.md +++ b/docs/examples/account/create-j-w-t.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2'); // Your project ID + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID $account = new Account($client); diff --git a/docs/examples/account/create-magic-u-r-l-token.md b/docs/examples/account/create-magic-u-r-l-token.md index e744157..f75991c 100644 --- a/docs/examples/account/create-magic-u-r-l-token.md +++ b/docs/examples/account/create-magic-u-r-l-token.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2'); // Your project ID + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID $account = new Account($client); diff --git a/docs/examples/account/create-mfa-authenticator.md b/docs/examples/account/create-mfa-authenticator.md index 1b3d176..95fca46 100644 --- a/docs/examples/account/create-mfa-authenticator.md +++ b/docs/examples/account/create-mfa-authenticator.md @@ -6,7 +6,7 @@ use Appwrite\Enums\AuthenticatorType; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/create-mfa-challenge.md b/docs/examples/account/create-mfa-challenge.md index 5cef510..34bd063 100644 --- a/docs/examples/account/create-mfa-challenge.md +++ b/docs/examples/account/create-mfa-challenge.md @@ -6,7 +6,7 @@ use Appwrite\Enums\AuthenticationFactor; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2'); // Your project ID + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID $account = new Account($client); diff --git a/docs/examples/account/create-mfa-recovery-codes.md b/docs/examples/account/create-mfa-recovery-codes.md index 8adf247..c474967 100644 --- a/docs/examples/account/create-mfa-recovery-codes.md +++ b/docs/examples/account/create-mfa-recovery-codes.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/create-o-auth2token.md b/docs/examples/account/create-o-auth2token.md index dc97ef6..0411d6f 100644 --- a/docs/examples/account/create-o-auth2token.md +++ b/docs/examples/account/create-o-auth2token.md @@ -6,7 +6,7 @@ use Appwrite\Enums\OAuthProvider; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2'); // Your project ID + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID $account = new Account($client); diff --git a/docs/examples/account/create-phone-token.md b/docs/examples/account/create-phone-token.md index 43ff008..e5724d3 100644 --- a/docs/examples/account/create-phone-token.md +++ b/docs/examples/account/create-phone-token.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2'); // Your project ID + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID $account = new Account($client); diff --git a/docs/examples/account/create-phone-verification.md b/docs/examples/account/create-phone-verification.md index c4b52f3..e681607 100644 --- a/docs/examples/account/create-phone-verification.md +++ b/docs/examples/account/create-phone-verification.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/create-recovery.md b/docs/examples/account/create-recovery.md index b35c58f..86cc2d9 100644 --- a/docs/examples/account/create-recovery.md +++ b/docs/examples/account/create-recovery.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/create-session.md b/docs/examples/account/create-session.md index 71fa75c..e714d11 100644 --- a/docs/examples/account/create-session.md +++ b/docs/examples/account/create-session.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2'); // Your project ID + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID $account = new Account($client); diff --git a/docs/examples/account/create-verification.md b/docs/examples/account/create-verification.md index b1ca321..9541956 100644 --- a/docs/examples/account/create-verification.md +++ b/docs/examples/account/create-verification.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/create.md b/docs/examples/account/create.md index c07c2d7..b4bc9df 100644 --- a/docs/examples/account/create.md +++ b/docs/examples/account/create.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2'); // Your project ID + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID $account = new Account($client); diff --git a/docs/examples/account/delete-identity.md b/docs/examples/account/delete-identity.md index 06a6a38..dc7f751 100644 --- a/docs/examples/account/delete-identity.md +++ b/docs/examples/account/delete-identity.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/delete-mfa-authenticator.md b/docs/examples/account/delete-mfa-authenticator.md index 78a304f..5420c15 100644 --- a/docs/examples/account/delete-mfa-authenticator.md +++ b/docs/examples/account/delete-mfa-authenticator.md @@ -6,7 +6,7 @@ use Appwrite\Enums\AuthenticatorType; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/delete-session.md b/docs/examples/account/delete-session.md index 9b06705..e52d95e 100644 --- a/docs/examples/account/delete-session.md +++ b/docs/examples/account/delete-session.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/delete-sessions.md b/docs/examples/account/delete-sessions.md index 7f927fa..a493317 100644 --- a/docs/examples/account/delete-sessions.md +++ b/docs/examples/account/delete-sessions.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/get-mfa-recovery-codes.md b/docs/examples/account/get-mfa-recovery-codes.md index 795559b..f640e9e 100644 --- a/docs/examples/account/get-mfa-recovery-codes.md +++ b/docs/examples/account/get-mfa-recovery-codes.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/get-prefs.md b/docs/examples/account/get-prefs.md index 57990c1..f6489fc 100644 --- a/docs/examples/account/get-prefs.md +++ b/docs/examples/account/get-prefs.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/get-session.md b/docs/examples/account/get-session.md index 5236002..17bf7f7 100644 --- a/docs/examples/account/get-session.md +++ b/docs/examples/account/get-session.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/get.md b/docs/examples/account/get.md index 4b6d8e2..8a36274 100644 --- a/docs/examples/account/get.md +++ b/docs/examples/account/get.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/list-identities.md b/docs/examples/account/list-identities.md index da36bbd..78c6dd3 100644 --- a/docs/examples/account/list-identities.md +++ b/docs/examples/account/list-identities.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/list-logs.md b/docs/examples/account/list-logs.md index a83c39a..0dcdb3b 100644 --- a/docs/examples/account/list-logs.md +++ b/docs/examples/account/list-logs.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/list-mfa-factors.md b/docs/examples/account/list-mfa-factors.md index 448f18d..e029574 100644 --- a/docs/examples/account/list-mfa-factors.md +++ b/docs/examples/account/list-mfa-factors.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/list-sessions.md b/docs/examples/account/list-sessions.md index bae339f..28f2823 100644 --- a/docs/examples/account/list-sessions.md +++ b/docs/examples/account/list-sessions.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/update-email.md b/docs/examples/account/update-email.md index efe3d99..60cb7cc 100644 --- a/docs/examples/account/update-email.md +++ b/docs/examples/account/update-email.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/update-m-f-a.md b/docs/examples/account/update-m-f-a.md index 5247ec4..1869f7e 100644 --- a/docs/examples/account/update-m-f-a.md +++ b/docs/examples/account/update-m-f-a.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/update-magic-u-r-l-session.md b/docs/examples/account/update-magic-u-r-l-session.md index 1fa3422..d5e1a9f 100644 --- a/docs/examples/account/update-magic-u-r-l-session.md +++ b/docs/examples/account/update-magic-u-r-l-session.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2'); // Your project ID + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID $account = new Account($client); diff --git a/docs/examples/account/update-mfa-authenticator.md b/docs/examples/account/update-mfa-authenticator.md index e97fff5..f998c23 100644 --- a/docs/examples/account/update-mfa-authenticator.md +++ b/docs/examples/account/update-mfa-authenticator.md @@ -6,7 +6,7 @@ use Appwrite\Enums\AuthenticatorType; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/update-mfa-challenge.md b/docs/examples/account/update-mfa-challenge.md index d0f278c..62124c5 100644 --- a/docs/examples/account/update-mfa-challenge.md +++ b/docs/examples/account/update-mfa-challenge.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/update-mfa-recovery-codes.md b/docs/examples/account/update-mfa-recovery-codes.md index 7b6809f..7babcac 100644 --- a/docs/examples/account/update-mfa-recovery-codes.md +++ b/docs/examples/account/update-mfa-recovery-codes.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/update-name.md b/docs/examples/account/update-name.md index ea6353f..4e0f1cb 100644 --- a/docs/examples/account/update-name.md +++ b/docs/examples/account/update-name.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/update-password.md b/docs/examples/account/update-password.md index dc873db..e438d2b 100644 --- a/docs/examples/account/update-password.md +++ b/docs/examples/account/update-password.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/update-phone-session.md b/docs/examples/account/update-phone-session.md index 9681b35..2951815 100644 --- a/docs/examples/account/update-phone-session.md +++ b/docs/examples/account/update-phone-session.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2'); // Your project ID + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID $account = new Account($client); diff --git a/docs/examples/account/update-phone-verification.md b/docs/examples/account/update-phone-verification.md index 9c3d3b7..6b95838 100644 --- a/docs/examples/account/update-phone-verification.md +++ b/docs/examples/account/update-phone-verification.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/update-phone.md b/docs/examples/account/update-phone.md index cbaf93a..85cff81 100644 --- a/docs/examples/account/update-phone.md +++ b/docs/examples/account/update-phone.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/update-prefs.md b/docs/examples/account/update-prefs.md index f057471..c47859b 100644 --- a/docs/examples/account/update-prefs.md +++ b/docs/examples/account/update-prefs.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/update-recovery.md b/docs/examples/account/update-recovery.md index 5b7f88b..5400fb5 100644 --- a/docs/examples/account/update-recovery.md +++ b/docs/examples/account/update-recovery.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/update-session.md b/docs/examples/account/update-session.md index d0220da..1a4611c 100644 --- a/docs/examples/account/update-session.md +++ b/docs/examples/account/update-session.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/update-status.md b/docs/examples/account/update-status.md index e5d51ec..8511b2f 100644 --- a/docs/examples/account/update-status.md +++ b/docs/examples/account/update-status.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/update-verification.md b/docs/examples/account/update-verification.md index b7cd6f9..253693e 100644 --- a/docs/examples/account/update-verification.md +++ b/docs/examples/account/update-verification.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/avatars/get-browser.md b/docs/examples/avatars/get-browser.md index 02bc411..47a6c85 100644 --- a/docs/examples/avatars/get-browser.md +++ b/docs/examples/avatars/get-browser.md @@ -6,7 +6,7 @@ use Appwrite\Enums\Browser; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $avatars = new Avatars($client); diff --git a/docs/examples/avatars/get-credit-card.md b/docs/examples/avatars/get-credit-card.md index be93427..c1b6b15 100644 --- a/docs/examples/avatars/get-credit-card.md +++ b/docs/examples/avatars/get-credit-card.md @@ -6,7 +6,7 @@ use Appwrite\Enums\CreditCard; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $avatars = new Avatars($client); diff --git a/docs/examples/avatars/get-favicon.md b/docs/examples/avatars/get-favicon.md index ff48929..50bb5c4 100644 --- a/docs/examples/avatars/get-favicon.md +++ b/docs/examples/avatars/get-favicon.md @@ -5,7 +5,7 @@ use Appwrite\Services\Avatars; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $avatars = new Avatars($client); diff --git a/docs/examples/avatars/get-flag.md b/docs/examples/avatars/get-flag.md index b2cd79a..c163dea 100644 --- a/docs/examples/avatars/get-flag.md +++ b/docs/examples/avatars/get-flag.md @@ -6,7 +6,7 @@ use Appwrite\Enums\Flag; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $avatars = new Avatars($client); diff --git a/docs/examples/avatars/get-image.md b/docs/examples/avatars/get-image.md index f069e7f..31d2bbf 100644 --- a/docs/examples/avatars/get-image.md +++ b/docs/examples/avatars/get-image.md @@ -5,7 +5,7 @@ use Appwrite\Services\Avatars; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $avatars = new Avatars($client); diff --git a/docs/examples/avatars/get-initials.md b/docs/examples/avatars/get-initials.md index 448e1a6..6a94e05 100644 --- a/docs/examples/avatars/get-initials.md +++ b/docs/examples/avatars/get-initials.md @@ -5,7 +5,7 @@ use Appwrite\Services\Avatars; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $avatars = new Avatars($client); diff --git a/docs/examples/avatars/get-q-r.md b/docs/examples/avatars/get-q-r.md index 8d19ddd..48f0008 100644 --- a/docs/examples/avatars/get-q-r.md +++ b/docs/examples/avatars/get-q-r.md @@ -5,7 +5,7 @@ use Appwrite\Services\Avatars; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $avatars = new Avatars($client); diff --git a/docs/examples/databases/create-boolean-attribute.md b/docs/examples/databases/create-boolean-attribute.md index 9344cff..27eba02 100644 --- a/docs/examples/databases/create-boolean-attribute.md +++ b/docs/examples/databases/create-boolean-attribute.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/create-collection.md b/docs/examples/databases/create-collection.md index f5c5cb3..72d36d2 100644 --- a/docs/examples/databases/create-collection.md +++ b/docs/examples/databases/create-collection.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/create-datetime-attribute.md b/docs/examples/databases/create-datetime-attribute.md index 3169914..a959381 100644 --- a/docs/examples/databases/create-datetime-attribute.md +++ b/docs/examples/databases/create-datetime-attribute.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/create-document.md b/docs/examples/databases/create-document.md index 83ffc07..612b114 100644 --- a/docs/examples/databases/create-document.md +++ b/docs/examples/databases/create-document.md @@ -5,7 +5,7 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $databases = new Databases($client); diff --git a/docs/examples/databases/create-email-attribute.md b/docs/examples/databases/create-email-attribute.md index c88a039..a72a42f 100644 --- a/docs/examples/databases/create-email-attribute.md +++ b/docs/examples/databases/create-email-attribute.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/create-enum-attribute.md b/docs/examples/databases/create-enum-attribute.md index e12bb36..2d6e3fb 100644 --- a/docs/examples/databases/create-enum-attribute.md +++ b/docs/examples/databases/create-enum-attribute.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/create-float-attribute.md b/docs/examples/databases/create-float-attribute.md index c685c6a..83f42ea 100644 --- a/docs/examples/databases/create-float-attribute.md +++ b/docs/examples/databases/create-float-attribute.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/create-index.md b/docs/examples/databases/create-index.md index b658234..e795271 100644 --- a/docs/examples/databases/create-index.md +++ b/docs/examples/databases/create-index.md @@ -6,8 +6,8 @@ use Appwrite\Enums\IndexType; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/create-integer-attribute.md b/docs/examples/databases/create-integer-attribute.md index ef63e05..5abc89c 100644 --- a/docs/examples/databases/create-integer-attribute.md +++ b/docs/examples/databases/create-integer-attribute.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/create-ip-attribute.md b/docs/examples/databases/create-ip-attribute.md index a3d9de9..04c70f9 100644 --- a/docs/examples/databases/create-ip-attribute.md +++ b/docs/examples/databases/create-ip-attribute.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/create-relationship-attribute.md b/docs/examples/databases/create-relationship-attribute.md index 1d262cf..2e0ba64 100644 --- a/docs/examples/databases/create-relationship-attribute.md +++ b/docs/examples/databases/create-relationship-attribute.md @@ -6,8 +6,8 @@ use Appwrite\Enums\RelationshipType; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/create-string-attribute.md b/docs/examples/databases/create-string-attribute.md index 2a88397..450c9bc 100644 --- a/docs/examples/databases/create-string-attribute.md +++ b/docs/examples/databases/create-string-attribute.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/create-url-attribute.md b/docs/examples/databases/create-url-attribute.md index 299ff70..e7a40b7 100644 --- a/docs/examples/databases/create-url-attribute.md +++ b/docs/examples/databases/create-url-attribute.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/create.md b/docs/examples/databases/create.md index 10f46ff..da4a650 100644 --- a/docs/examples/databases/create.md +++ b/docs/examples/databases/create.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/delete-attribute.md b/docs/examples/databases/delete-attribute.md index 097e7f0..e60d39f 100644 --- a/docs/examples/databases/delete-attribute.md +++ b/docs/examples/databases/delete-attribute.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/delete-collection.md b/docs/examples/databases/delete-collection.md index 5c3606b..ce821e7 100644 --- a/docs/examples/databases/delete-collection.md +++ b/docs/examples/databases/delete-collection.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/delete-document.md b/docs/examples/databases/delete-document.md index 892dc03..536cdcd 100644 --- a/docs/examples/databases/delete-document.md +++ b/docs/examples/databases/delete-document.md @@ -5,7 +5,7 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $databases = new Databases($client); diff --git a/docs/examples/databases/delete-index.md b/docs/examples/databases/delete-index.md index f0ba6e7..cb9ddf9 100644 --- a/docs/examples/databases/delete-index.md +++ b/docs/examples/databases/delete-index.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/delete.md b/docs/examples/databases/delete.md index 999fe3a..5b1a322 100644 --- a/docs/examples/databases/delete.md +++ b/docs/examples/databases/delete.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/get-attribute.md b/docs/examples/databases/get-attribute.md index 87f684e..671f9ac 100644 --- a/docs/examples/databases/get-attribute.md +++ b/docs/examples/databases/get-attribute.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/get-collection.md b/docs/examples/databases/get-collection.md index cf9fa77..23df77b 100644 --- a/docs/examples/databases/get-collection.md +++ b/docs/examples/databases/get-collection.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/get-document.md b/docs/examples/databases/get-document.md index 25bc79a..bee705f 100644 --- a/docs/examples/databases/get-document.md +++ b/docs/examples/databases/get-document.md @@ -5,7 +5,7 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $databases = new Databases($client); diff --git a/docs/examples/databases/get-index.md b/docs/examples/databases/get-index.md index be8fab3..b5878dd 100644 --- a/docs/examples/databases/get-index.md +++ b/docs/examples/databases/get-index.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/get.md b/docs/examples/databases/get.md index d30acdc..4838b0b 100644 --- a/docs/examples/databases/get.md +++ b/docs/examples/databases/get.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/list-attributes.md b/docs/examples/databases/list-attributes.md index 2e087d0..6b1834f 100644 --- a/docs/examples/databases/list-attributes.md +++ b/docs/examples/databases/list-attributes.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/list-collections.md b/docs/examples/databases/list-collections.md index 0f43e4d..045aece 100644 --- a/docs/examples/databases/list-collections.md +++ b/docs/examples/databases/list-collections.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/list-documents.md b/docs/examples/databases/list-documents.md index bead79b..c865f32 100644 --- a/docs/examples/databases/list-documents.md +++ b/docs/examples/databases/list-documents.md @@ -5,7 +5,7 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $databases = new Databases($client); diff --git a/docs/examples/databases/list-indexes.md b/docs/examples/databases/list-indexes.md index 2ba17a4..fee8e8f 100644 --- a/docs/examples/databases/list-indexes.md +++ b/docs/examples/databases/list-indexes.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/list.md b/docs/examples/databases/list.md index d2bfe71..ea89f25 100644 --- a/docs/examples/databases/list.md +++ b/docs/examples/databases/list.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/update-boolean-attribute.md b/docs/examples/databases/update-boolean-attribute.md index a070a83..a599d60 100644 --- a/docs/examples/databases/update-boolean-attribute.md +++ b/docs/examples/databases/update-boolean-attribute.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/update-collection.md b/docs/examples/databases/update-collection.md index c923217..70b052d 100644 --- a/docs/examples/databases/update-collection.md +++ b/docs/examples/databases/update-collection.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/update-datetime-attribute.md b/docs/examples/databases/update-datetime-attribute.md index e4e89ad..f0e92cf 100644 --- a/docs/examples/databases/update-datetime-attribute.md +++ b/docs/examples/databases/update-datetime-attribute.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/update-document.md b/docs/examples/databases/update-document.md index 837653f..5af2f55 100644 --- a/docs/examples/databases/update-document.md +++ b/docs/examples/databases/update-document.md @@ -5,7 +5,7 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $databases = new Databases($client); diff --git a/docs/examples/databases/update-email-attribute.md b/docs/examples/databases/update-email-attribute.md index 518a255..8398758 100644 --- a/docs/examples/databases/update-email-attribute.md +++ b/docs/examples/databases/update-email-attribute.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/update-enum-attribute.md b/docs/examples/databases/update-enum-attribute.md index 55368c6..0bd7db5 100644 --- a/docs/examples/databases/update-enum-attribute.md +++ b/docs/examples/databases/update-enum-attribute.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/update-float-attribute.md b/docs/examples/databases/update-float-attribute.md index a7ec238..32c3ba4 100644 --- a/docs/examples/databases/update-float-attribute.md +++ b/docs/examples/databases/update-float-attribute.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/update-integer-attribute.md b/docs/examples/databases/update-integer-attribute.md index 4567a3c..2233cc0 100644 --- a/docs/examples/databases/update-integer-attribute.md +++ b/docs/examples/databases/update-integer-attribute.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/update-ip-attribute.md b/docs/examples/databases/update-ip-attribute.md index 8e7c87b..a953ae1 100644 --- a/docs/examples/databases/update-ip-attribute.md +++ b/docs/examples/databases/update-ip-attribute.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/update-relationship-attribute.md b/docs/examples/databases/update-relationship-attribute.md index 756de78..e4e16df 100644 --- a/docs/examples/databases/update-relationship-attribute.md +++ b/docs/examples/databases/update-relationship-attribute.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/update-string-attribute.md b/docs/examples/databases/update-string-attribute.md index 819aee4..b1a7ae4 100644 --- a/docs/examples/databases/update-string-attribute.md +++ b/docs/examples/databases/update-string-attribute.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/update-url-attribute.md b/docs/examples/databases/update-url-attribute.md index d7f9c89..383d721 100644 --- a/docs/examples/databases/update-url-attribute.md +++ b/docs/examples/databases/update-url-attribute.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/update.md b/docs/examples/databases/update.md index 484875a..68cb214 100644 --- a/docs/examples/databases/update.md +++ b/docs/examples/databases/update.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/functions/create-build.md b/docs/examples/functions/create-build.md index 6d60cb8..43c781f 100644 --- a/docs/examples/functions/create-build.md +++ b/docs/examples/functions/create-build.md @@ -5,13 +5,13 @@ use Appwrite\Services\Functions; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $functions = new Functions($client); $result = $functions->createBuild( functionId: '', deploymentId: '', - buildId: '' + buildId: '' // optional ); \ No newline at end of file diff --git a/docs/examples/functions/create-deployment.md b/docs/examples/functions/create-deployment.md index 370ca1d..c35b886 100644 --- a/docs/examples/functions/create-deployment.md +++ b/docs/examples/functions/create-deployment.md @@ -6,8 +6,8 @@ use Appwrite\Services\Functions; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $functions = new Functions($client); diff --git a/docs/examples/functions/create-execution.md b/docs/examples/functions/create-execution.md index 59493d4..ff531d5 100644 --- a/docs/examples/functions/create-execution.md +++ b/docs/examples/functions/create-execution.md @@ -5,7 +5,7 @@ use Appwrite\Services\Functions; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $functions = new Functions($client); @@ -16,5 +16,6 @@ $result = $functions->createExecution( async: false, // optional path: '', // optional method: ExecutionMethod::GET(), // optional - headers: [] // optional + headers: [], // optional + scheduledAt: '' // optional ); \ No newline at end of file diff --git a/docs/examples/functions/create-variable.md b/docs/examples/functions/create-variable.md index f1d35c3..441aa9d 100644 --- a/docs/examples/functions/create-variable.md +++ b/docs/examples/functions/create-variable.md @@ -5,8 +5,8 @@ use Appwrite\Services\Functions; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $functions = new Functions($client); diff --git a/docs/examples/functions/create.md b/docs/examples/functions/create.md index 0c282ba..f6dc183 100644 --- a/docs/examples/functions/create.md +++ b/docs/examples/functions/create.md @@ -6,8 +6,8 @@ use Appwrite\Enums\; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $functions = new Functions($client); @@ -23,6 +23,7 @@ $result = $functions->create( logging: false, // optional entrypoint: '', // optional commands: '', // optional + scopes: [], // optional installationId: '', // optional providerRepositoryId: '', // optional providerBranch: '', // optional diff --git a/docs/examples/functions/delete-deployment.md b/docs/examples/functions/delete-deployment.md index 6a609cd..3f00e9d 100644 --- a/docs/examples/functions/delete-deployment.md +++ b/docs/examples/functions/delete-deployment.md @@ -5,8 +5,8 @@ use Appwrite\Services\Functions; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $functions = new Functions($client); diff --git a/docs/examples/functions/delete-execution.md b/docs/examples/functions/delete-execution.md new file mode 100644 index 0000000..3733583 --- /dev/null +++ b/docs/examples/functions/delete-execution.md @@ -0,0 +1,16 @@ +setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$functions = new Functions($client); + +$result = $functions->deleteExecution( + functionId: '', + executionId: '' +); \ No newline at end of file diff --git a/docs/examples/functions/delete-variable.md b/docs/examples/functions/delete-variable.md index d25df57..5046e1f 100644 --- a/docs/examples/functions/delete-variable.md +++ b/docs/examples/functions/delete-variable.md @@ -5,8 +5,8 @@ use Appwrite\Services\Functions; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $functions = new Functions($client); diff --git a/docs/examples/functions/delete.md b/docs/examples/functions/delete.md index 08b5cc4..3d4da02 100644 --- a/docs/examples/functions/delete.md +++ b/docs/examples/functions/delete.md @@ -5,8 +5,8 @@ use Appwrite\Services\Functions; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $functions = new Functions($client); diff --git a/docs/examples/functions/download-deployment.md b/docs/examples/functions/download-deployment.md index 9f3b3da..2841d86 100644 --- a/docs/examples/functions/download-deployment.md +++ b/docs/examples/functions/download-deployment.md @@ -5,8 +5,8 @@ use Appwrite\Services\Functions; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $functions = new Functions($client); diff --git a/docs/examples/functions/get-deployment.md b/docs/examples/functions/get-deployment.md index 12e37f3..d5758dd 100644 --- a/docs/examples/functions/get-deployment.md +++ b/docs/examples/functions/get-deployment.md @@ -5,8 +5,8 @@ use Appwrite\Services\Functions; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $functions = new Functions($client); diff --git a/docs/examples/functions/get-execution.md b/docs/examples/functions/get-execution.md index 47270d6..d0c7ec4 100644 --- a/docs/examples/functions/get-execution.md +++ b/docs/examples/functions/get-execution.md @@ -5,7 +5,7 @@ use Appwrite\Services\Functions; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $functions = new Functions($client); diff --git a/docs/examples/functions/get-variable.md b/docs/examples/functions/get-variable.md index 3635372..2bd901b 100644 --- a/docs/examples/functions/get-variable.md +++ b/docs/examples/functions/get-variable.md @@ -5,8 +5,8 @@ use Appwrite\Services\Functions; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $functions = new Functions($client); diff --git a/docs/examples/functions/get.md b/docs/examples/functions/get.md index 00993f7..b2c6d7b 100644 --- a/docs/examples/functions/get.md +++ b/docs/examples/functions/get.md @@ -5,8 +5,8 @@ use Appwrite\Services\Functions; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $functions = new Functions($client); diff --git a/docs/examples/functions/list-deployments.md b/docs/examples/functions/list-deployments.md index 7f64808..d8bad27 100644 --- a/docs/examples/functions/list-deployments.md +++ b/docs/examples/functions/list-deployments.md @@ -5,8 +5,8 @@ use Appwrite\Services\Functions; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $functions = new Functions($client); diff --git a/docs/examples/functions/list-executions.md b/docs/examples/functions/list-executions.md index b446868..fda330a 100644 --- a/docs/examples/functions/list-executions.md +++ b/docs/examples/functions/list-executions.md @@ -5,7 +5,7 @@ use Appwrite\Services\Functions; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $functions = new Functions($client); diff --git a/docs/examples/functions/list-runtimes.md b/docs/examples/functions/list-runtimes.md index 75be157..18d3c05 100644 --- a/docs/examples/functions/list-runtimes.md +++ b/docs/examples/functions/list-runtimes.md @@ -5,8 +5,8 @@ use Appwrite\Services\Functions; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $functions = new Functions($client); diff --git a/docs/examples/functions/list-variables.md b/docs/examples/functions/list-variables.md index 681102b..137a4da 100644 --- a/docs/examples/functions/list-variables.md +++ b/docs/examples/functions/list-variables.md @@ -5,8 +5,8 @@ use Appwrite\Services\Functions; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $functions = new Functions($client); diff --git a/docs/examples/functions/list.md b/docs/examples/functions/list.md index b59494b..7b4d362 100644 --- a/docs/examples/functions/list.md +++ b/docs/examples/functions/list.md @@ -5,8 +5,8 @@ use Appwrite\Services\Functions; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $functions = new Functions($client); diff --git a/docs/examples/functions/update-deployment-build.md b/docs/examples/functions/update-deployment-build.md new file mode 100644 index 0000000..653914e --- /dev/null +++ b/docs/examples/functions/update-deployment-build.md @@ -0,0 +1,16 @@ +setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$functions = new Functions($client); + +$result = $functions->updateDeploymentBuild( + functionId: '', + deploymentId: '' +); \ No newline at end of file diff --git a/docs/examples/functions/update-deployment.md b/docs/examples/functions/update-deployment.md index 4405767..095b253 100644 --- a/docs/examples/functions/update-deployment.md +++ b/docs/examples/functions/update-deployment.md @@ -5,8 +5,8 @@ use Appwrite\Services\Functions; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $functions = new Functions($client); diff --git a/docs/examples/functions/update-variable.md b/docs/examples/functions/update-variable.md index cdce618..77a28f1 100644 --- a/docs/examples/functions/update-variable.md +++ b/docs/examples/functions/update-variable.md @@ -5,8 +5,8 @@ use Appwrite\Services\Functions; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $functions = new Functions($client); diff --git a/docs/examples/functions/update.md b/docs/examples/functions/update.md index e55108f..db0d50a 100644 --- a/docs/examples/functions/update.md +++ b/docs/examples/functions/update.md @@ -5,8 +5,8 @@ use Appwrite\Services\Functions; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $functions = new Functions($client); @@ -22,6 +22,7 @@ $result = $functions->update( logging: false, // optional entrypoint: '', // optional commands: '', // optional + scopes: [], // optional installationId: '', // optional providerRepositoryId: '', // optional providerBranch: '', // optional diff --git a/docs/examples/graphql/mutation.md b/docs/examples/graphql/mutation.md index 1be4802..e074e0c 100644 --- a/docs/examples/graphql/mutation.md +++ b/docs/examples/graphql/mutation.md @@ -5,8 +5,8 @@ use Appwrite\Services\Graphql; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $graphql = new Graphql($client); diff --git a/docs/examples/graphql/query.md b/docs/examples/graphql/query.md index 5467fe1..b871063 100644 --- a/docs/examples/graphql/query.md +++ b/docs/examples/graphql/query.md @@ -5,8 +5,8 @@ use Appwrite\Services\Graphql; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $graphql = new Graphql($client); diff --git a/docs/examples/health/get-antivirus.md b/docs/examples/health/get-antivirus.md index 7f4fcb8..64e83e0 100644 --- a/docs/examples/health/get-antivirus.md +++ b/docs/examples/health/get-antivirus.md @@ -5,8 +5,8 @@ use Appwrite\Services\Health; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $health = new Health($client); diff --git a/docs/examples/health/get-cache.md b/docs/examples/health/get-cache.md index 4fe6e69..6096207 100644 --- a/docs/examples/health/get-cache.md +++ b/docs/examples/health/get-cache.md @@ -5,8 +5,8 @@ use Appwrite\Services\Health; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $health = new Health($client); diff --git a/docs/examples/health/get-certificate.md b/docs/examples/health/get-certificate.md index 1f4d55e..d5d325e 100644 --- a/docs/examples/health/get-certificate.md +++ b/docs/examples/health/get-certificate.md @@ -5,8 +5,8 @@ use Appwrite\Services\Health; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $health = new Health($client); diff --git a/docs/examples/health/get-d-b.md b/docs/examples/health/get-d-b.md index ca1349b..434fcad 100644 --- a/docs/examples/health/get-d-b.md +++ b/docs/examples/health/get-d-b.md @@ -5,8 +5,8 @@ use Appwrite\Services\Health; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $health = new Health($client); diff --git a/docs/examples/health/get-failed-jobs.md b/docs/examples/health/get-failed-jobs.md index 94a8d74..1470587 100644 --- a/docs/examples/health/get-failed-jobs.md +++ b/docs/examples/health/get-failed-jobs.md @@ -6,8 +6,8 @@ use Appwrite\Enums\; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $health = new Health($client); diff --git a/docs/examples/health/get-pub-sub.md b/docs/examples/health/get-pub-sub.md index 63cd764..d2d3a5d 100644 --- a/docs/examples/health/get-pub-sub.md +++ b/docs/examples/health/get-pub-sub.md @@ -5,8 +5,8 @@ use Appwrite\Services\Health; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $health = new Health($client); diff --git a/docs/examples/health/get-queue-builds.md b/docs/examples/health/get-queue-builds.md index 56d342b..2911465 100644 --- a/docs/examples/health/get-queue-builds.md +++ b/docs/examples/health/get-queue-builds.md @@ -5,8 +5,8 @@ use Appwrite\Services\Health; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $health = new Health($client); diff --git a/docs/examples/health/get-queue-certificates.md b/docs/examples/health/get-queue-certificates.md index 10c1308..9323b41 100644 --- a/docs/examples/health/get-queue-certificates.md +++ b/docs/examples/health/get-queue-certificates.md @@ -5,8 +5,8 @@ use Appwrite\Services\Health; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $health = new Health($client); diff --git a/docs/examples/health/get-queue-databases.md b/docs/examples/health/get-queue-databases.md index c51e123..54a9814 100644 --- a/docs/examples/health/get-queue-databases.md +++ b/docs/examples/health/get-queue-databases.md @@ -5,8 +5,8 @@ use Appwrite\Services\Health; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $health = new Health($client); diff --git a/docs/examples/health/get-queue-deletes.md b/docs/examples/health/get-queue-deletes.md index 70dcaca..aee4deb 100644 --- a/docs/examples/health/get-queue-deletes.md +++ b/docs/examples/health/get-queue-deletes.md @@ -5,8 +5,8 @@ use Appwrite\Services\Health; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $health = new Health($client); diff --git a/docs/examples/health/get-queue-functions.md b/docs/examples/health/get-queue-functions.md index 46cde88..f675b75 100644 --- a/docs/examples/health/get-queue-functions.md +++ b/docs/examples/health/get-queue-functions.md @@ -5,8 +5,8 @@ use Appwrite\Services\Health; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $health = new Health($client); diff --git a/docs/examples/health/get-queue-logs.md b/docs/examples/health/get-queue-logs.md index c982068..05c463b 100644 --- a/docs/examples/health/get-queue-logs.md +++ b/docs/examples/health/get-queue-logs.md @@ -5,8 +5,8 @@ use Appwrite\Services\Health; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $health = new Health($client); diff --git a/docs/examples/health/get-queue-mails.md b/docs/examples/health/get-queue-mails.md index ad415fc..74d4959 100644 --- a/docs/examples/health/get-queue-mails.md +++ b/docs/examples/health/get-queue-mails.md @@ -5,8 +5,8 @@ use Appwrite\Services\Health; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $health = new Health($client); diff --git a/docs/examples/health/get-queue-messaging.md b/docs/examples/health/get-queue-messaging.md index a722d2f..3fd96c6 100644 --- a/docs/examples/health/get-queue-messaging.md +++ b/docs/examples/health/get-queue-messaging.md @@ -5,8 +5,8 @@ use Appwrite\Services\Health; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $health = new Health($client); diff --git a/docs/examples/health/get-queue-migrations.md b/docs/examples/health/get-queue-migrations.md index 2e2826d..9f1a8be 100644 --- a/docs/examples/health/get-queue-migrations.md +++ b/docs/examples/health/get-queue-migrations.md @@ -5,8 +5,8 @@ use Appwrite\Services\Health; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $health = new Health($client); diff --git a/docs/examples/health/get-queue-usage-dump.md b/docs/examples/health/get-queue-usage-dump.md index 050cbeb..b856b73 100644 --- a/docs/examples/health/get-queue-usage-dump.md +++ b/docs/examples/health/get-queue-usage-dump.md @@ -5,8 +5,8 @@ use Appwrite\Services\Health; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $health = new Health($client); diff --git a/docs/examples/health/get-queue-usage.md b/docs/examples/health/get-queue-usage.md index d9a3fb9..9b5baeb 100644 --- a/docs/examples/health/get-queue-usage.md +++ b/docs/examples/health/get-queue-usage.md @@ -5,8 +5,8 @@ use Appwrite\Services\Health; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $health = new Health($client); diff --git a/docs/examples/health/get-queue-webhooks.md b/docs/examples/health/get-queue-webhooks.md index e1d6e6f..e42b65b 100644 --- a/docs/examples/health/get-queue-webhooks.md +++ b/docs/examples/health/get-queue-webhooks.md @@ -5,8 +5,8 @@ use Appwrite\Services\Health; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $health = new Health($client); diff --git a/docs/examples/health/get-queue.md b/docs/examples/health/get-queue.md index a8b1393..81b2218 100644 --- a/docs/examples/health/get-queue.md +++ b/docs/examples/health/get-queue.md @@ -5,8 +5,8 @@ use Appwrite\Services\Health; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $health = new Health($client); diff --git a/docs/examples/health/get-storage-local.md b/docs/examples/health/get-storage-local.md index 43bef96..75999ce 100644 --- a/docs/examples/health/get-storage-local.md +++ b/docs/examples/health/get-storage-local.md @@ -5,8 +5,8 @@ use Appwrite\Services\Health; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $health = new Health($client); diff --git a/docs/examples/health/get-storage.md b/docs/examples/health/get-storage.md index d5d817a..a3b56b9 100644 --- a/docs/examples/health/get-storage.md +++ b/docs/examples/health/get-storage.md @@ -5,8 +5,8 @@ use Appwrite\Services\Health; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $health = new Health($client); diff --git a/docs/examples/health/get-time.md b/docs/examples/health/get-time.md index d31e757..5deb238 100644 --- a/docs/examples/health/get-time.md +++ b/docs/examples/health/get-time.md @@ -5,8 +5,8 @@ use Appwrite\Services\Health; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $health = new Health($client); diff --git a/docs/examples/health/get.md b/docs/examples/health/get.md index 6e8216c..5001c48 100644 --- a/docs/examples/health/get.md +++ b/docs/examples/health/get.md @@ -5,8 +5,8 @@ use Appwrite\Services\Health; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $health = new Health($client); diff --git a/docs/examples/locale/get.md b/docs/examples/locale/get.md index beecee9..b9f48b4 100644 --- a/docs/examples/locale/get.md +++ b/docs/examples/locale/get.md @@ -5,7 +5,7 @@ use Appwrite\Services\Locale; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $locale = new Locale($client); diff --git a/docs/examples/locale/list-codes.md b/docs/examples/locale/list-codes.md index 699326f..b35683c 100644 --- a/docs/examples/locale/list-codes.md +++ b/docs/examples/locale/list-codes.md @@ -5,7 +5,7 @@ use Appwrite\Services\Locale; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $locale = new Locale($client); diff --git a/docs/examples/locale/list-continents.md b/docs/examples/locale/list-continents.md index 038f099..1076f99 100644 --- a/docs/examples/locale/list-continents.md +++ b/docs/examples/locale/list-continents.md @@ -5,7 +5,7 @@ use Appwrite\Services\Locale; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $locale = new Locale($client); diff --git a/docs/examples/locale/list-countries-e-u.md b/docs/examples/locale/list-countries-e-u.md index 1b895e5..93a4cad 100644 --- a/docs/examples/locale/list-countries-e-u.md +++ b/docs/examples/locale/list-countries-e-u.md @@ -5,7 +5,7 @@ use Appwrite\Services\Locale; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $locale = new Locale($client); diff --git a/docs/examples/locale/list-countries-phones.md b/docs/examples/locale/list-countries-phones.md index 503ff39..1d99f67 100644 --- a/docs/examples/locale/list-countries-phones.md +++ b/docs/examples/locale/list-countries-phones.md @@ -5,7 +5,7 @@ use Appwrite\Services\Locale; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $locale = new Locale($client); diff --git a/docs/examples/locale/list-countries.md b/docs/examples/locale/list-countries.md index 3e092d7..665dd09 100644 --- a/docs/examples/locale/list-countries.md +++ b/docs/examples/locale/list-countries.md @@ -5,7 +5,7 @@ use Appwrite\Services\Locale; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $locale = new Locale($client); diff --git a/docs/examples/locale/list-currencies.md b/docs/examples/locale/list-currencies.md index 81157c9..5cd91de 100644 --- a/docs/examples/locale/list-currencies.md +++ b/docs/examples/locale/list-currencies.md @@ -5,7 +5,7 @@ use Appwrite\Services\Locale; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $locale = new Locale($client); diff --git a/docs/examples/locale/list-languages.md b/docs/examples/locale/list-languages.md index 31de740..c615a3d 100644 --- a/docs/examples/locale/list-languages.md +++ b/docs/examples/locale/list-languages.md @@ -5,7 +5,7 @@ use Appwrite\Services\Locale; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $locale = new Locale($client); diff --git a/docs/examples/messaging/create-apns-provider.md b/docs/examples/messaging/create-apns-provider.md index 4814078..ebe69e9 100644 --- a/docs/examples/messaging/create-apns-provider.md +++ b/docs/examples/messaging/create-apns-provider.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/create-email.md b/docs/examples/messaging/create-email.md index 8327f74..b24e4f2 100644 --- a/docs/examples/messaging/create-email.md +++ b/docs/examples/messaging/create-email.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/create-fcm-provider.md b/docs/examples/messaging/create-fcm-provider.md index 4bb7123..b0cfec4 100644 --- a/docs/examples/messaging/create-fcm-provider.md +++ b/docs/examples/messaging/create-fcm-provider.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/create-mailgun-provider.md b/docs/examples/messaging/create-mailgun-provider.md index 8ffa70c..bd3bcf8 100644 --- a/docs/examples/messaging/create-mailgun-provider.md +++ b/docs/examples/messaging/create-mailgun-provider.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/create-msg91provider.md b/docs/examples/messaging/create-msg91provider.md index 5efd866..da37716 100644 --- a/docs/examples/messaging/create-msg91provider.md +++ b/docs/examples/messaging/create-msg91provider.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/create-push.md b/docs/examples/messaging/create-push.md index 7b7eb8e..7273f03 100644 --- a/docs/examples/messaging/create-push.md +++ b/docs/examples/messaging/create-push.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/create-sendgrid-provider.md b/docs/examples/messaging/create-sendgrid-provider.md index fbaa819..42764a9 100644 --- a/docs/examples/messaging/create-sendgrid-provider.md +++ b/docs/examples/messaging/create-sendgrid-provider.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/create-sms.md b/docs/examples/messaging/create-sms.md index ae28808..36fce84 100644 --- a/docs/examples/messaging/create-sms.md +++ b/docs/examples/messaging/create-sms.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/create-smtp-provider.md b/docs/examples/messaging/create-smtp-provider.md index 4c6d384..ff8cfe0 100644 --- a/docs/examples/messaging/create-smtp-provider.md +++ b/docs/examples/messaging/create-smtp-provider.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/create-subscriber.md b/docs/examples/messaging/create-subscriber.md index 36a2a76..bfba263 100644 --- a/docs/examples/messaging/create-subscriber.md +++ b/docs/examples/messaging/create-subscriber.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...'); // Your secret JSON Web Token + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setJWT('<YOUR_JWT>'); // Your secret JSON Web Token $messaging = new Messaging($client); diff --git a/docs/examples/messaging/create-telesign-provider.md b/docs/examples/messaging/create-telesign-provider.md index d84c93f..ec3ede7 100644 --- a/docs/examples/messaging/create-telesign-provider.md +++ b/docs/examples/messaging/create-telesign-provider.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/create-textmagic-provider.md b/docs/examples/messaging/create-textmagic-provider.md index c1d0337..5dc00f8 100644 --- a/docs/examples/messaging/create-textmagic-provider.md +++ b/docs/examples/messaging/create-textmagic-provider.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/create-topic.md b/docs/examples/messaging/create-topic.md index bf21494..dd0daf1 100644 --- a/docs/examples/messaging/create-topic.md +++ b/docs/examples/messaging/create-topic.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/create-twilio-provider.md b/docs/examples/messaging/create-twilio-provider.md index 915cc94..70a1d38 100644 --- a/docs/examples/messaging/create-twilio-provider.md +++ b/docs/examples/messaging/create-twilio-provider.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/create-vonage-provider.md b/docs/examples/messaging/create-vonage-provider.md index bd1e665..d6a4e11 100644 --- a/docs/examples/messaging/create-vonage-provider.md +++ b/docs/examples/messaging/create-vonage-provider.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/delete-provider.md b/docs/examples/messaging/delete-provider.md index b52e5f0..4f267fe 100644 --- a/docs/examples/messaging/delete-provider.md +++ b/docs/examples/messaging/delete-provider.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/delete-subscriber.md b/docs/examples/messaging/delete-subscriber.md index 1736d00..2f91487 100644 --- a/docs/examples/messaging/delete-subscriber.md +++ b/docs/examples/messaging/delete-subscriber.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...'); // Your secret JSON Web Token + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setJWT('<YOUR_JWT>'); // Your secret JSON Web Token $messaging = new Messaging($client); diff --git a/docs/examples/messaging/delete-topic.md b/docs/examples/messaging/delete-topic.md index 25ed35e..79dca2c 100644 --- a/docs/examples/messaging/delete-topic.md +++ b/docs/examples/messaging/delete-topic.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/delete.md b/docs/examples/messaging/delete.md index 5c05eed..b0676ec 100644 --- a/docs/examples/messaging/delete.md +++ b/docs/examples/messaging/delete.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/get-message.md b/docs/examples/messaging/get-message.md index 47b6afd..9ec7a0e 100644 --- a/docs/examples/messaging/get-message.md +++ b/docs/examples/messaging/get-message.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/get-provider.md b/docs/examples/messaging/get-provider.md index 1576107..378fc6d 100644 --- a/docs/examples/messaging/get-provider.md +++ b/docs/examples/messaging/get-provider.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/get-subscriber.md b/docs/examples/messaging/get-subscriber.md index 3fa4c0a..a10974a 100644 --- a/docs/examples/messaging/get-subscriber.md +++ b/docs/examples/messaging/get-subscriber.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/get-topic.md b/docs/examples/messaging/get-topic.md index f732fcb..cb42254 100644 --- a/docs/examples/messaging/get-topic.md +++ b/docs/examples/messaging/get-topic.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/list-message-logs.md b/docs/examples/messaging/list-message-logs.md index 58c026e..d66d546 100644 --- a/docs/examples/messaging/list-message-logs.md +++ b/docs/examples/messaging/list-message-logs.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/list-messages.md b/docs/examples/messaging/list-messages.md index 681863b..c0f54a6 100644 --- a/docs/examples/messaging/list-messages.md +++ b/docs/examples/messaging/list-messages.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/list-provider-logs.md b/docs/examples/messaging/list-provider-logs.md index 3809e67..865daf9 100644 --- a/docs/examples/messaging/list-provider-logs.md +++ b/docs/examples/messaging/list-provider-logs.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/list-providers.md b/docs/examples/messaging/list-providers.md index 99c8cc1..fd30837 100644 --- a/docs/examples/messaging/list-providers.md +++ b/docs/examples/messaging/list-providers.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/list-subscriber-logs.md b/docs/examples/messaging/list-subscriber-logs.md index 4583790..b69c057 100644 --- a/docs/examples/messaging/list-subscriber-logs.md +++ b/docs/examples/messaging/list-subscriber-logs.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/list-subscribers.md b/docs/examples/messaging/list-subscribers.md index 36054d2..2fd2747 100644 --- a/docs/examples/messaging/list-subscribers.md +++ b/docs/examples/messaging/list-subscribers.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/list-targets.md b/docs/examples/messaging/list-targets.md index b12aa44..3abb9ef 100644 --- a/docs/examples/messaging/list-targets.md +++ b/docs/examples/messaging/list-targets.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/list-topic-logs.md b/docs/examples/messaging/list-topic-logs.md index 49bcc04..0d23c82 100644 --- a/docs/examples/messaging/list-topic-logs.md +++ b/docs/examples/messaging/list-topic-logs.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/list-topics.md b/docs/examples/messaging/list-topics.md index 565504a..008767e 100644 --- a/docs/examples/messaging/list-topics.md +++ b/docs/examples/messaging/list-topics.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/update-apns-provider.md b/docs/examples/messaging/update-apns-provider.md index 5de36f2..a368ce5 100644 --- a/docs/examples/messaging/update-apns-provider.md +++ b/docs/examples/messaging/update-apns-provider.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/update-email.md b/docs/examples/messaging/update-email.md index 2acafaf..537ca82 100644 --- a/docs/examples/messaging/update-email.md +++ b/docs/examples/messaging/update-email.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/update-fcm-provider.md b/docs/examples/messaging/update-fcm-provider.md index 2cadd87..d8b2a0e 100644 --- a/docs/examples/messaging/update-fcm-provider.md +++ b/docs/examples/messaging/update-fcm-provider.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/update-mailgun-provider.md b/docs/examples/messaging/update-mailgun-provider.md index 7f36655..d838adb 100644 --- a/docs/examples/messaging/update-mailgun-provider.md +++ b/docs/examples/messaging/update-mailgun-provider.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/update-msg91provider.md b/docs/examples/messaging/update-msg91provider.md index 9ca9782..eb68102 100644 --- a/docs/examples/messaging/update-msg91provider.md +++ b/docs/examples/messaging/update-msg91provider.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/update-push.md b/docs/examples/messaging/update-push.md index 204c63d..b332ec1 100644 --- a/docs/examples/messaging/update-push.md +++ b/docs/examples/messaging/update-push.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/update-sendgrid-provider.md b/docs/examples/messaging/update-sendgrid-provider.md index 61253a4..7909fef 100644 --- a/docs/examples/messaging/update-sendgrid-provider.md +++ b/docs/examples/messaging/update-sendgrid-provider.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/update-sms.md b/docs/examples/messaging/update-sms.md index 9f4b241..a4b4c23 100644 --- a/docs/examples/messaging/update-sms.md +++ b/docs/examples/messaging/update-sms.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/update-smtp-provider.md b/docs/examples/messaging/update-smtp-provider.md index e4b0ad8..997914f 100644 --- a/docs/examples/messaging/update-smtp-provider.md +++ b/docs/examples/messaging/update-smtp-provider.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/update-telesign-provider.md b/docs/examples/messaging/update-telesign-provider.md index b77a45c..981df0c 100644 --- a/docs/examples/messaging/update-telesign-provider.md +++ b/docs/examples/messaging/update-telesign-provider.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/update-textmagic-provider.md b/docs/examples/messaging/update-textmagic-provider.md index e3e3f2b..b7f9bab 100644 --- a/docs/examples/messaging/update-textmagic-provider.md +++ b/docs/examples/messaging/update-textmagic-provider.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/update-topic.md b/docs/examples/messaging/update-topic.md index 50671b1..e705c1b 100644 --- a/docs/examples/messaging/update-topic.md +++ b/docs/examples/messaging/update-topic.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/update-twilio-provider.md b/docs/examples/messaging/update-twilio-provider.md index 60eef45..05c2072 100644 --- a/docs/examples/messaging/update-twilio-provider.md +++ b/docs/examples/messaging/update-twilio-provider.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/update-vonage-provider.md b/docs/examples/messaging/update-vonage-provider.md index 4a3ee5a..3c421af 100644 --- a/docs/examples/messaging/update-vonage-provider.md +++ b/docs/examples/messaging/update-vonage-provider.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/storage/create-bucket.md b/docs/examples/storage/create-bucket.md index 0582e18..ca369fb 100644 --- a/docs/examples/storage/create-bucket.md +++ b/docs/examples/storage/create-bucket.md @@ -5,8 +5,8 @@ use Appwrite\Services\Storage; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $storage = new Storage($client); diff --git a/docs/examples/storage/create-file.md b/docs/examples/storage/create-file.md index e73af54..20a25e7 100644 --- a/docs/examples/storage/create-file.md +++ b/docs/examples/storage/create-file.md @@ -6,7 +6,7 @@ use Appwrite\Services\Storage; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $storage = new Storage($client); diff --git a/docs/examples/storage/delete-bucket.md b/docs/examples/storage/delete-bucket.md index 6d5278d..a9207f4 100644 --- a/docs/examples/storage/delete-bucket.md +++ b/docs/examples/storage/delete-bucket.md @@ -5,8 +5,8 @@ use Appwrite\Services\Storage; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $storage = new Storage($client); diff --git a/docs/examples/storage/delete-file.md b/docs/examples/storage/delete-file.md index eff096d..47f9938 100644 --- a/docs/examples/storage/delete-file.md +++ b/docs/examples/storage/delete-file.md @@ -5,7 +5,7 @@ use Appwrite\Services\Storage; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $storage = new Storage($client); diff --git a/docs/examples/storage/get-bucket.md b/docs/examples/storage/get-bucket.md index a7a8c1d..5faf6a6 100644 --- a/docs/examples/storage/get-bucket.md +++ b/docs/examples/storage/get-bucket.md @@ -5,8 +5,8 @@ use Appwrite\Services\Storage; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $storage = new Storage($client); diff --git a/docs/examples/storage/get-file-download.md b/docs/examples/storage/get-file-download.md index 1d49695..48ee5ad 100644 --- a/docs/examples/storage/get-file-download.md +++ b/docs/examples/storage/get-file-download.md @@ -5,7 +5,7 @@ use Appwrite\Services\Storage; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $storage = new Storage($client); diff --git a/docs/examples/storage/get-file-preview.md b/docs/examples/storage/get-file-preview.md index 519ee53..4f37f38 100644 --- a/docs/examples/storage/get-file-preview.md +++ b/docs/examples/storage/get-file-preview.md @@ -5,7 +5,7 @@ use Appwrite\Services\Storage; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $storage = new Storage($client); diff --git a/docs/examples/storage/get-file-view.md b/docs/examples/storage/get-file-view.md index 9e37230..5637fa8 100644 --- a/docs/examples/storage/get-file-view.md +++ b/docs/examples/storage/get-file-view.md @@ -5,7 +5,7 @@ use Appwrite\Services\Storage; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $storage = new Storage($client); diff --git a/docs/examples/storage/get-file.md b/docs/examples/storage/get-file.md index 894c8bb..41fdc91 100644 --- a/docs/examples/storage/get-file.md +++ b/docs/examples/storage/get-file.md @@ -5,7 +5,7 @@ use Appwrite\Services\Storage; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $storage = new Storage($client); diff --git a/docs/examples/storage/list-buckets.md b/docs/examples/storage/list-buckets.md index 06f4e2a..7a988c2 100644 --- a/docs/examples/storage/list-buckets.md +++ b/docs/examples/storage/list-buckets.md @@ -5,8 +5,8 @@ use Appwrite\Services\Storage; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $storage = new Storage($client); diff --git a/docs/examples/storage/list-files.md b/docs/examples/storage/list-files.md index 824ae30..038b2cd 100644 --- a/docs/examples/storage/list-files.md +++ b/docs/examples/storage/list-files.md @@ -5,7 +5,7 @@ use Appwrite\Services\Storage; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $storage = new Storage($client); diff --git a/docs/examples/storage/update-bucket.md b/docs/examples/storage/update-bucket.md index 451ff80..96bf127 100644 --- a/docs/examples/storage/update-bucket.md +++ b/docs/examples/storage/update-bucket.md @@ -5,8 +5,8 @@ use Appwrite\Services\Storage; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $storage = new Storage($client); diff --git a/docs/examples/storage/update-file.md b/docs/examples/storage/update-file.md index 531a843..0ddc6d5 100644 --- a/docs/examples/storage/update-file.md +++ b/docs/examples/storage/update-file.md @@ -5,7 +5,7 @@ use Appwrite\Services\Storage; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $storage = new Storage($client); diff --git a/docs/examples/teams/create-membership.md b/docs/examples/teams/create-membership.md index ef9bf44..061b906 100644 --- a/docs/examples/teams/create-membership.md +++ b/docs/examples/teams/create-membership.md @@ -5,7 +5,7 @@ use Appwrite\Services\Teams; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $teams = new Teams($client); diff --git a/docs/examples/teams/create.md b/docs/examples/teams/create.md index de01cbc..5475bdf 100644 --- a/docs/examples/teams/create.md +++ b/docs/examples/teams/create.md @@ -5,7 +5,7 @@ use Appwrite\Services\Teams; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $teams = new Teams($client); diff --git a/docs/examples/teams/delete-membership.md b/docs/examples/teams/delete-membership.md index b68b692..15ced89 100644 --- a/docs/examples/teams/delete-membership.md +++ b/docs/examples/teams/delete-membership.md @@ -5,7 +5,7 @@ use Appwrite\Services\Teams; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $teams = new Teams($client); diff --git a/docs/examples/teams/delete.md b/docs/examples/teams/delete.md index 45f2100..98224f7 100644 --- a/docs/examples/teams/delete.md +++ b/docs/examples/teams/delete.md @@ -5,7 +5,7 @@ use Appwrite\Services\Teams; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $teams = new Teams($client); diff --git a/docs/examples/teams/get-membership.md b/docs/examples/teams/get-membership.md index f075372..f27ee3a 100644 --- a/docs/examples/teams/get-membership.md +++ b/docs/examples/teams/get-membership.md @@ -5,7 +5,7 @@ use Appwrite\Services\Teams; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $teams = new Teams($client); diff --git a/docs/examples/teams/get-prefs.md b/docs/examples/teams/get-prefs.md index 738a6c7..932777a 100644 --- a/docs/examples/teams/get-prefs.md +++ b/docs/examples/teams/get-prefs.md @@ -5,7 +5,7 @@ use Appwrite\Services\Teams; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $teams = new Teams($client); diff --git a/docs/examples/teams/get.md b/docs/examples/teams/get.md index f68c415..21320ee 100644 --- a/docs/examples/teams/get.md +++ b/docs/examples/teams/get.md @@ -5,7 +5,7 @@ use Appwrite\Services\Teams; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $teams = new Teams($client); diff --git a/docs/examples/teams/list-memberships.md b/docs/examples/teams/list-memberships.md index 27d5d00..440553c 100644 --- a/docs/examples/teams/list-memberships.md +++ b/docs/examples/teams/list-memberships.md @@ -5,7 +5,7 @@ use Appwrite\Services\Teams; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $teams = new Teams($client); diff --git a/docs/examples/teams/list.md b/docs/examples/teams/list.md index 90cdcfd..761b6c2 100644 --- a/docs/examples/teams/list.md +++ b/docs/examples/teams/list.md @@ -5,7 +5,7 @@ use Appwrite\Services\Teams; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $teams = new Teams($client); diff --git a/docs/examples/teams/update-membership-status.md b/docs/examples/teams/update-membership-status.md index 4a802a5..3c79245 100644 --- a/docs/examples/teams/update-membership-status.md +++ b/docs/examples/teams/update-membership-status.md @@ -5,7 +5,7 @@ use Appwrite\Services\Teams; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $teams = new Teams($client); diff --git a/docs/examples/teams/update-membership.md b/docs/examples/teams/update-membership.md index 308f7f1..438f354 100644 --- a/docs/examples/teams/update-membership.md +++ b/docs/examples/teams/update-membership.md @@ -5,7 +5,7 @@ use Appwrite\Services\Teams; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $teams = new Teams($client); diff --git a/docs/examples/teams/update-name.md b/docs/examples/teams/update-name.md index 088d32e..cd1f38f 100644 --- a/docs/examples/teams/update-name.md +++ b/docs/examples/teams/update-name.md @@ -5,7 +5,7 @@ use Appwrite\Services\Teams; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $teams = new Teams($client); diff --git a/docs/examples/teams/update-prefs.md b/docs/examples/teams/update-prefs.md index c2a9aad..0dadd2c 100644 --- a/docs/examples/teams/update-prefs.md +++ b/docs/examples/teams/update-prefs.md @@ -5,7 +5,7 @@ use Appwrite\Services\Teams; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $teams = new Teams($client); diff --git a/docs/examples/users/create-argon2user.md b/docs/examples/users/create-argon2user.md index db01dda..7bee3bc 100644 --- a/docs/examples/users/create-argon2user.md +++ b/docs/examples/users/create-argon2user.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/create-bcrypt-user.md b/docs/examples/users/create-bcrypt-user.md index 0a061f9..631e4cc 100644 --- a/docs/examples/users/create-bcrypt-user.md +++ b/docs/examples/users/create-bcrypt-user.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/create-j-w-t.md b/docs/examples/users/create-j-w-t.md new file mode 100644 index 0000000..2f0bc37 --- /dev/null +++ b/docs/examples/users/create-j-w-t.md @@ -0,0 +1,17 @@ +setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->createJWT( + userId: '', + sessionId: '', // optional + duration: 0 // optional +); \ No newline at end of file diff --git a/docs/examples/users/create-m-d5user.md b/docs/examples/users/create-m-d5user.md index 400b6bd..0605f6f 100644 --- a/docs/examples/users/create-m-d5user.md +++ b/docs/examples/users/create-m-d5user.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/create-mfa-recovery-codes.md b/docs/examples/users/create-mfa-recovery-codes.md index e8b3b60..f499b22 100644 --- a/docs/examples/users/create-mfa-recovery-codes.md +++ b/docs/examples/users/create-mfa-recovery-codes.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/create-p-h-pass-user.md b/docs/examples/users/create-p-h-pass-user.md index e0d7342..f6dc863 100644 --- a/docs/examples/users/create-p-h-pass-user.md +++ b/docs/examples/users/create-p-h-pass-user.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/create-s-h-a-user.md b/docs/examples/users/create-s-h-a-user.md index 9cb35ee..777096d 100644 --- a/docs/examples/users/create-s-h-a-user.md +++ b/docs/examples/users/create-s-h-a-user.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/create-scrypt-modified-user.md b/docs/examples/users/create-scrypt-modified-user.md index 325745d..4f8423f 100644 --- a/docs/examples/users/create-scrypt-modified-user.md +++ b/docs/examples/users/create-scrypt-modified-user.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/create-scrypt-user.md b/docs/examples/users/create-scrypt-user.md index 0828acc..2ccc5d7 100644 --- a/docs/examples/users/create-scrypt-user.md +++ b/docs/examples/users/create-scrypt-user.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/create-session.md b/docs/examples/users/create-session.md index c4f9052..97d8c8a 100644 --- a/docs/examples/users/create-session.md +++ b/docs/examples/users/create-session.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/create-target.md b/docs/examples/users/create-target.md index 2820472..03104bc 100644 --- a/docs/examples/users/create-target.md +++ b/docs/examples/users/create-target.md @@ -6,8 +6,8 @@ use Appwrite\Enums\MessagingProviderType; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/create-token.md b/docs/examples/users/create-token.md index 83f05e1..b08faac 100644 --- a/docs/examples/users/create-token.md +++ b/docs/examples/users/create-token.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/create.md b/docs/examples/users/create.md index 7cf4b6f..a50e10e 100644 --- a/docs/examples/users/create.md +++ b/docs/examples/users/create.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/delete-identity.md b/docs/examples/users/delete-identity.md index 81751a1..138b89f 100644 --- a/docs/examples/users/delete-identity.md +++ b/docs/examples/users/delete-identity.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/delete-mfa-authenticator.md b/docs/examples/users/delete-mfa-authenticator.md index aa7405e..d25c2b7 100644 --- a/docs/examples/users/delete-mfa-authenticator.md +++ b/docs/examples/users/delete-mfa-authenticator.md @@ -6,8 +6,8 @@ use Appwrite\Enums\AuthenticatorType; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/delete-session.md b/docs/examples/users/delete-session.md index 3ef58aa..bf673b2 100644 --- a/docs/examples/users/delete-session.md +++ b/docs/examples/users/delete-session.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/delete-sessions.md b/docs/examples/users/delete-sessions.md index e89b65f..f2a3f21 100644 --- a/docs/examples/users/delete-sessions.md +++ b/docs/examples/users/delete-sessions.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/delete-target.md b/docs/examples/users/delete-target.md index 444c496..20e676a 100644 --- a/docs/examples/users/delete-target.md +++ b/docs/examples/users/delete-target.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/delete.md b/docs/examples/users/delete.md index b715e84..225708c 100644 --- a/docs/examples/users/delete.md +++ b/docs/examples/users/delete.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/get-mfa-recovery-codes.md b/docs/examples/users/get-mfa-recovery-codes.md index a852fa5..055ef04 100644 --- a/docs/examples/users/get-mfa-recovery-codes.md +++ b/docs/examples/users/get-mfa-recovery-codes.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/get-prefs.md b/docs/examples/users/get-prefs.md index 79f778a..392dc14 100644 --- a/docs/examples/users/get-prefs.md +++ b/docs/examples/users/get-prefs.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/get-target.md b/docs/examples/users/get-target.md index 489e1e2..7ca05d3 100644 --- a/docs/examples/users/get-target.md +++ b/docs/examples/users/get-target.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/get.md b/docs/examples/users/get.md index 5428d73..1cc351a 100644 --- a/docs/examples/users/get.md +++ b/docs/examples/users/get.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/list-identities.md b/docs/examples/users/list-identities.md index 0fde8a3..040e309 100644 --- a/docs/examples/users/list-identities.md +++ b/docs/examples/users/list-identities.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/list-logs.md b/docs/examples/users/list-logs.md index 863bab5..e717bdf 100644 --- a/docs/examples/users/list-logs.md +++ b/docs/examples/users/list-logs.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/list-memberships.md b/docs/examples/users/list-memberships.md index 616f014..da760e0 100644 --- a/docs/examples/users/list-memberships.md +++ b/docs/examples/users/list-memberships.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/list-mfa-factors.md b/docs/examples/users/list-mfa-factors.md index 3058966..16964c5 100644 --- a/docs/examples/users/list-mfa-factors.md +++ b/docs/examples/users/list-mfa-factors.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/list-sessions.md b/docs/examples/users/list-sessions.md index 3b0c490..0bfa242 100644 --- a/docs/examples/users/list-sessions.md +++ b/docs/examples/users/list-sessions.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/list-targets.md b/docs/examples/users/list-targets.md index c441a1c..c4815be 100644 --- a/docs/examples/users/list-targets.md +++ b/docs/examples/users/list-targets.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/list.md b/docs/examples/users/list.md index 63616e5..678e97f 100644 --- a/docs/examples/users/list.md +++ b/docs/examples/users/list.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/update-email-verification.md b/docs/examples/users/update-email-verification.md index 74ef340..d2d6584 100644 --- a/docs/examples/users/update-email-verification.md +++ b/docs/examples/users/update-email-verification.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/update-email.md b/docs/examples/users/update-email.md index fb8e231..a73100c 100644 --- a/docs/examples/users/update-email.md +++ b/docs/examples/users/update-email.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/update-labels.md b/docs/examples/users/update-labels.md index 87e1b66..9651830 100644 --- a/docs/examples/users/update-labels.md +++ b/docs/examples/users/update-labels.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/update-mfa-recovery-codes.md b/docs/examples/users/update-mfa-recovery-codes.md index aec96fa..d09ccd7 100644 --- a/docs/examples/users/update-mfa-recovery-codes.md +++ b/docs/examples/users/update-mfa-recovery-codes.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/update-mfa.md b/docs/examples/users/update-mfa.md index 83a3e37..5ab48c5 100644 --- a/docs/examples/users/update-mfa.md +++ b/docs/examples/users/update-mfa.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/update-name.md b/docs/examples/users/update-name.md index 33ca175..96e8afc 100644 --- a/docs/examples/users/update-name.md +++ b/docs/examples/users/update-name.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/update-password.md b/docs/examples/users/update-password.md index a6226eb..ffcb817 100644 --- a/docs/examples/users/update-password.md +++ b/docs/examples/users/update-password.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/update-phone-verification.md b/docs/examples/users/update-phone-verification.md index 8d26d64..8054531 100644 --- a/docs/examples/users/update-phone-verification.md +++ b/docs/examples/users/update-phone-verification.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/update-phone.md b/docs/examples/users/update-phone.md index eb5f55e..5828633 100644 --- a/docs/examples/users/update-phone.md +++ b/docs/examples/users/update-phone.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/update-prefs.md b/docs/examples/users/update-prefs.md index b96ff17..6d0ecad 100644 --- a/docs/examples/users/update-prefs.md +++ b/docs/examples/users/update-prefs.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/update-status.md b/docs/examples/users/update-status.md index ef74801..7ffbfc2 100644 --- a/docs/examples/users/update-status.md +++ b/docs/examples/users/update-status.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/update-target.md b/docs/examples/users/update-target.md index 4d40c83..5c476db 100644 --- a/docs/examples/users/update-target.md +++ b/docs/examples/users/update-target.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/functions.md b/docs/functions.md index f742744..a7615bf 100644 --- a/docs/functions.md +++ b/docs/functions.md @@ -38,6 +38,7 @@ POST https://cloud.appwrite.io/v1/functions | logging | boolean | Whether executions will be logged. When set to false, executions will not be logged, but will reduce resource used by your Appwrite project. | 1 | | entrypoint | string | Entrypoint File. This path is relative to the "providerRootDirectory". | | | commands | string | Build Commands. | | +| scopes | array | List of scopes allowed for API key auto-generated for every execution. Maximum of 100 scopes are allowed. | [] | | installationId | string | Appwrite Installation ID for VCS (Version Control System) deployment. | | | providerRepositoryId | string | Repository ID of the repo linked to the function. | | | providerBranch | string | Production branch for the repo linked to the function. | | @@ -93,6 +94,7 @@ PUT https://cloud.appwrite.io/v1/functions/{functionId} | logging | boolean | Whether executions will be logged. When set to false, executions will not be logged, but will reduce resource used by your Appwrite project. | 1 | | entrypoint | string | Entrypoint File. This path is relative to the "providerRootDirectory". | | | commands | string | Build Commands. | | +| scopes | array | List of scopes allowed for API Key auto-generated for every execution. Maximum of 100 scopes are allowed. | [] | | installationId | string | Appwrite Installation ID for VCS (Version Controle System) deployment. | | | providerRepositoryId | string | Repository ID of the repo linked to the function | | | providerBranch | string | Production branch for the repo linked to the function | | @@ -196,13 +198,25 @@ DELETE https://cloud.appwrite.io/v1/functions/{functionId}/deployments/{deployme | functionId | string | **Required** Function ID. | | | deploymentId | string | **Required** Deployment ID. | | -## Create build +## Rebuild deployment ```http request -POST https://cloud.appwrite.io/v1/functions/{functionId}/deployments/{deploymentId}/builds/{buildId} +POST https://cloud.appwrite.io/v1/functions/{functionId}/deployments/{deploymentId}/build ``` -** Create a new build for an Appwrite Function deployment. This endpoint can be used to retry a failed build. ** +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| functionId | string | **Required** Function ID. | | +| deploymentId | string | **Required** Deployment ID. | | +| buildId | string | Build unique ID. | | + +## Cancel deployment + +```http request +PATCH https://cloud.appwrite.io/v1/functions/{functionId}/deployments/{deploymentId}/build +``` ### Parameters @@ -210,7 +224,6 @@ POST https://cloud.appwrite.io/v1/functions/{functionId}/deployments/{deployment | --- | --- | --- | --- | | functionId | string | **Required** Function ID. | | | deploymentId | string | **Required** Deployment ID. | | -| buildId | string | **Required** Build unique ID. | | ## Download Deployment @@ -240,7 +253,7 @@ GET https://cloud.appwrite.io/v1/functions/{functionId}/executions | Field Name | Type | Description | Default | | --- | --- | --- | --- | | functionId | string | **Required** Function 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: trigger, status, responseStatusCode, duration | [] | +| 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: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId | [] | | search | string | Search term to filter your list results. Max length: 256 chars. | | ## Create execution @@ -261,6 +274,7 @@ POST https://cloud.appwrite.io/v1/functions/{functionId}/executions | path | string | HTTP path of execution. Path can include query params. Default value is / | / | | method | string | HTTP method of execution. Default value is GET. | POST | | headers | object | HTTP headers of execution. Defaults to empty. | {} | +| scheduledAt | string | Scheduled execution time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. | | ## Get execution @@ -277,6 +291,22 @@ GET https://cloud.appwrite.io/v1/functions/{functionId}/executions/{executionId} | functionId | string | **Required** Function ID. | | | executionId | string | **Required** Execution ID. | | +## Delete execution + +```http request +DELETE https://cloud.appwrite.io/v1/functions/{functionId}/executions/{executionId} +``` + +** Delete a function execution by its unique ID. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| functionId | string | **Required** Function ID. | | +| executionId | string | **Required** Execution ID. | | + ## List variables ```http request diff --git a/docs/storage.md b/docs/storage.md index 5e8d7c9..2f07dbd 100644 --- a/docs/storage.md +++ b/docs/storage.md @@ -32,7 +32,7 @@ POST https://cloud.appwrite.io/v1/storage/buckets | permissions | array | An array of permission strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). | | | fileSecurity | boolean | Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions). | | | enabled | boolean | Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled. | 1 | -| maximumFileSize | integer | Maximum file size allowed in bytes. Maximum allowed value is 30MB. | 30000000 | +| maximumFileSize | integer | Maximum file size allowed in bytes. Maximum allowed value is 30MB. | [] | | allowedFileExtensions | array | Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long. | [] | | compression | string | Compression algorithm choosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled | none | | encryption | boolean | Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled | 1 | @@ -69,7 +69,7 @@ PUT https://cloud.appwrite.io/v1/storage/buckets/{bucketId} | permissions | array | An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). | | | fileSecurity | boolean | Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions). | | | enabled | boolean | Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled. | 1 | -| maximumFileSize | integer | Maximum file size allowed in bytes. Maximum allowed value is 30MB. | | +| maximumFileSize | integer | Maximum file size allowed in bytes. Maximum allowed value is 30MB. | [] | | allowedFileExtensions | array | Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long. | [] | | compression | string | Compression algorithm choosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled | none | | encryption | boolean | Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled | 1 | @@ -126,7 +126,7 @@ If you're creating a new file using one of the Appwrite SDKs, all the chunk | --- | --- | --- | --- | | bucketId | string | **Required** Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). | | | fileId | string | File 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. | | -| file | file | Binary file. Appwrite SDKs provide helpers to handle file input. [Learn about file input](https://appwrite.io/docs/storage#file-input). | | +| file | file | Binary file. Appwrite SDKs provide helpers to handle file input. [Learn about file input](https://appwrite.io/docs/products/storage/upload-download#input-file). | | | permissions | array | An array of permission strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). | | ## Get file diff --git a/docs/teams.md b/docs/teams.md index 1a7dfec..0804aee 100644 --- a/docs/teams.md +++ b/docs/teams.md @@ -114,7 +114,7 @@ Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatShee | userId | string | ID of the user to be added to a team. | | | phone | string | Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. | | | 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 32 characters long. | | -| url | string | URL to redirect the user back to your app from the invitation email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. | | +| 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. | | ## Get team membership diff --git a/docs/users.md b/docs/users.md index 7b9d959..180eb96 100644 --- a/docs/users.md +++ b/docs/users.md @@ -233,6 +233,22 @@ PATCH https://cloud.appwrite.io/v1/users/{userId}/email | userId | string | **Required** User ID. | | | email | string | User email. | | +## Create user JWT + +```http request +POST https://cloud.appwrite.io/v1/users/{userId}/jwts +``` + +** Use this endpoint to create a JSON Web Token for user by its unique ID. You can use the resulting JWT to authenticate on behalf of the user. The JWT secret will become invalid if the session it uses gets deleted. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User ID. | | +| sessionId | string | Session ID. Use the string 'recent' to use the most recent session. Defaults to the most recent session. | recent | +| duration | integer | Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds. | 900 | + ## Update user labels ```http request diff --git a/src/Appwrite/Client.php b/src/Appwrite/Client.php index f88c044..d7d8a37 100644 --- a/src/Appwrite/Client.php +++ b/src/Appwrite/Client.php @@ -37,11 +37,11 @@ class Client */ protected $headers = [ 'content-type' => '', - 'user-agent' => 'AppwritePHPSDK/11.1.0 ()', + 'user-agent' => 'AppwritePHPSDK/11.0.2 ()', 'x-sdk-name'=> 'PHP', 'x-sdk-platform'=> 'server', 'x-sdk-language'=> 'php', - 'x-sdk-version'=> '11.1.0', + 'x-sdk-version'=> '11.0.2', ]; /** diff --git a/src/Appwrite/Enums/Name.php b/src/Appwrite/Enums/Name.php index 2ffc402..49fad38 100644 --- a/src/Appwrite/Enums/Name.php +++ b/src/Appwrite/Enums/Name.php @@ -13,7 +13,7 @@ class Name implements JsonSerializable private static Name $V1FUNCTIONS; private static Name $V1USAGE; private static Name $V1USAGEDUMP; - private static Name $WEBHOOKSV1; + private static Name $V1WEBHOOKS; private static Name $V1CERTIFICATES; private static Name $V1BUILDS; private static Name $V1MESSAGING; @@ -85,12 +85,12 @@ public static function V1USAGEDUMP(): Name } return self::$V1USAGEDUMP; } - public static function WEBHOOKSV1(): Name + public static function V1WEBHOOKS(): Name { - if (!isset(self::$WEBHOOKSV1)) { - self::$WEBHOOKSV1 = new Name('webhooksv1'); + if (!isset(self::$V1WEBHOOKS)) { + self::$V1WEBHOOKS = new Name('v1-webhooks'); } - return self::$WEBHOOKSV1; + return self::$V1WEBHOOKS; } public static function V1CERTIFICATES(): Name { diff --git a/src/Appwrite/Enums/Runtime.php b/src/Appwrite/Enums/Runtime.php index 2017538..05cb177 100644 --- a/src/Appwrite/Enums/Runtime.php +++ b/src/Appwrite/Enums/Runtime.php @@ -26,9 +26,6 @@ class Runtime implements JsonSerializable private static Runtime $PYTHON311; private static Runtime $PYTHON312; private static Runtime $PYTHONML311; - private static Runtime $DENO121; - private static Runtime $DENO124; - private static Runtime $DENO135; private static Runtime $DENO140; private static Runtime $DART215; private static Runtime $DART216; @@ -54,6 +51,7 @@ class Runtime implements JsonSerializable private static Runtime $CPP17; private static Runtime $CPP20; private static Runtime $BUN10; + private static Runtime $GO122; private string $value; @@ -212,27 +210,6 @@ public static function PYTHONML311(): Runtime } return self::$PYTHONML311; } - public static function DENO121(): Runtime - { - if (!isset(self::$DENO121)) { - self::$DENO121 = new Runtime('deno-1.21'); - } - return self::$DENO121; - } - public static function DENO124(): Runtime - { - if (!isset(self::$DENO124)) { - self::$DENO124 = new Runtime('deno-1.24'); - } - return self::$DENO124; - } - public static function DENO135(): Runtime - { - if (!isset(self::$DENO135)) { - self::$DENO135 = new Runtime('deno-1.35'); - } - return self::$DENO135; - } public static function DENO140(): Runtime { if (!isset(self::$DENO140)) { @@ -408,4 +385,11 @@ public static function BUN10(): Runtime } return self::$BUN10; } + public static function GO122(): Runtime + { + if (!isset(self::$GO122)) { + self::$GO122 = new Runtime('go-1.22'); + } + return self::$GO122; + } } \ No newline at end of file diff --git a/src/Appwrite/Services/Account.php b/src/Appwrite/Services/Account.php index 7a4f586..4fc1df2 100644 --- a/src/Appwrite/Services/Account.php +++ b/src/Appwrite/Services/Account.php @@ -212,7 +212,7 @@ public function deleteIdentity(string $identityId): string */ public function createJWT(): array { - $apiPath = str_replace([], [], '/account/jwt'); + $apiPath = str_replace([], [], '/account/jwts'); $apiParams = []; return $this->client->call( @@ -321,7 +321,7 @@ public function createMfaAuthenticator(AuthenticatorType $type): array * * Verify an authenticator app after adding it using the [add * authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) - * method. add + * method. * * @param AuthenticatorType $type * @param string $otp diff --git a/src/Appwrite/Services/Functions.php b/src/Appwrite/Services/Functions.php index d9bb024..15c5334 100644 --- a/src/Appwrite/Services/Functions.php +++ b/src/Appwrite/Services/Functions.php @@ -68,6 +68,7 @@ public function list(array $queries = null, string $search = null): array * @param bool $logging * @param string $entrypoint * @param string $commands + * @param array $scopes * @param string $installationId * @param string $providerRepositoryId * @param string $providerBranch @@ -81,7 +82,7 @@ public function list(array $queries = null, string $search = null): array * @return array */ - public function create(string $functionId, string $name, Runtime $runtime, array $execute = null, array $events = null, string $schedule = null, int $timeout = null, bool $enabled = null, bool $logging = null, string $entrypoint = null, string $commands = null, string $installationId = null, string $providerRepositoryId = null, string $providerBranch = null, bool $providerSilentMode = null, string $providerRootDirectory = null, string $templateRepository = null, string $templateOwner = null, string $templateRootDirectory = null, string $templateBranch = null): array + public function create(string $functionId, string $name, Runtime $runtime, array $execute = null, array $events = null, string $schedule = null, int $timeout = null, bool $enabled = null, bool $logging = null, string $entrypoint = null, string $commands = null, array $scopes = null, string $installationId = null, string $providerRepositoryId = null, string $providerBranch = null, bool $providerSilentMode = null, string $providerRootDirectory = null, string $templateRepository = null, string $templateOwner = null, string $templateRootDirectory = null, string $templateBranch = null): array { $apiPath = str_replace([], [], '/functions'); @@ -128,6 +129,9 @@ public function create(string $functionId, string $name, Runtime $runtime, array if (!is_null($commands)) { $apiParams['commands'] = $commands; } + if (!is_null($scopes)) { + $apiParams['scopes'] = $scopes; + } if (!is_null($installationId)) { $apiParams['installationId'] = $installationId; } @@ -233,6 +237,7 @@ public function get(string $functionId): array * @param bool $logging * @param string $entrypoint * @param string $commands + * @param array $scopes * @param string $installationId * @param string $providerRepositoryId * @param string $providerBranch @@ -242,7 +247,7 @@ public function get(string $functionId): array * @return array */ - public function update(string $functionId, string $name, Runtime $runtime = null, array $execute = null, array $events = null, string $schedule = null, int $timeout = null, bool $enabled = null, bool $logging = null, string $entrypoint = null, string $commands = null, string $installationId = null, string $providerRepositoryId = null, string $providerBranch = null, bool $providerSilentMode = null, string $providerRootDirectory = null): array + public function update(string $functionId, string $name, Runtime $runtime = null, array $execute = null, array $events = null, string $schedule = null, int $timeout = null, bool $enabled = null, bool $logging = null, string $entrypoint = null, string $commands = null, array $scopes = null, string $installationId = null, string $providerRepositoryId = null, string $providerBranch = null, bool $providerSilentMode = null, string $providerRootDirectory = null): array { $apiPath = str_replace(['{functionId}'], [$functionId], '/functions/{functionId}'); @@ -283,6 +288,9 @@ public function update(string $functionId, string $name, Runtime $runtime = null if (!is_null($commands)) { $apiParams['commands'] = $commands; } + if (!is_null($scopes)) { + $apiParams['scopes'] = $scopes; + } if (!is_null($installationId)) { $apiParams['installationId'] = $installationId; } @@ -595,10 +603,7 @@ public function deleteDeployment(string $functionId, string $deploymentId): stri } /** - * Create build - * - * Create a new build for an Appwrite Function deployment. This endpoint can - * be used to retry a failed build. + * Rebuild deployment * * @param string $functionId * @param string $deploymentId @@ -607,9 +612,9 @@ public function deleteDeployment(string $functionId, string $deploymentId): stri * @return string */ - public function createBuild(string $functionId, string $deploymentId, string $buildId): string + public function createBuild(string $functionId, string $deploymentId, string $buildId = null): string { - $apiPath = str_replace(['{functionId}', '{deploymentId}', '{buildId}'], [$functionId, $deploymentId, $buildId], '/functions/{functionId}/deployments/{deploymentId}/builds/{buildId}'); + $apiPath = str_replace(['{functionId}', '{deploymentId}'], [$functionId, $deploymentId], '/functions/{functionId}/deployments/{deploymentId}/build'); $apiParams = []; if (!isset($functionId)) { @@ -618,8 +623,8 @@ public function createBuild(string $functionId, string $deploymentId, string $bu if (!isset($deploymentId)) { throw new AppwriteException('Missing required parameter: "deploymentId"'); } - if (!isset($buildId)) { - throw new AppwriteException('Missing required parameter: "buildId"'); + if (!is_null($buildId)) { + $apiParams['buildId'] = $buildId; } return $this->client->call( Client::METHOD_POST, @@ -631,6 +636,36 @@ public function createBuild(string $functionId, string $deploymentId, string $bu ); } + /** + * Cancel deployment + * + * @param string $functionId + * @param string $deploymentId + * @throws AppwriteException + * @return array + + */ + public function updateDeploymentBuild(string $functionId, string $deploymentId): array + { + $apiPath = str_replace(['{functionId}', '{deploymentId}'], [$functionId, $deploymentId], '/functions/{functionId}/deployments/{deploymentId}/build'); + + $apiParams = []; + if (!isset($functionId)) { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + if (!isset($deploymentId)) { + throw new AppwriteException('Missing required parameter: "deploymentId"'); + } + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + [ + 'content-type' => 'application/json', + ], + $apiParams + ); + } + /** * Download Deployment * @@ -715,11 +750,12 @@ public function listExecutions(string $functionId, array $queries = null, string * @param string $xpath * @param ExecutionMethod $method * @param array $headers + * @param string $scheduledAt * @throws AppwriteException * @return array */ - public function createExecution(string $functionId, string $body = null, bool $async = null, string $xpath = null, ExecutionMethod $method = null, array $headers = null): array + public function createExecution(string $functionId, string $body = null, bool $async = null, string $xpath = null, ExecutionMethod $method = null, array $headers = null, string $scheduledAt = null): array { $apiPath = str_replace(['{functionId}'], [$functionId], '/functions/{functionId}/executions'); @@ -742,6 +778,9 @@ public function createExecution(string $functionId, string $body = null, bool $a if (!is_null($headers)) { $apiParams['headers'] = $headers; } + if (!is_null($scheduledAt)) { + $apiParams['scheduledAt'] = $scheduledAt; + } return $this->client->call( Client::METHOD_POST, $apiPath, @@ -784,6 +823,39 @@ public function getExecution(string $functionId, string $executionId): array ); } + /** + * Delete execution + * + * Delete a function execution by its unique ID. + * + * + * @param string $functionId + * @param string $executionId + * @throws AppwriteException + * @return string + + */ + public function deleteExecution(string $functionId, string $executionId): string + { + $apiPath = str_replace(['{functionId}', '{executionId}'], [$functionId, $executionId], '/functions/{functionId}/executions/{executionId}'); + + $apiParams = []; + if (!isset($functionId)) { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + if (!isset($executionId)) { + throw new AppwriteException('Missing required parameter: "executionId"'); + } + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + [ + 'content-type' => 'application/json', + ], + $apiParams + ); + } + /** * List variables * diff --git a/src/Appwrite/Services/Users.php b/src/Appwrite/Services/Users.php index fc7e732..0019db5 100644 --- a/src/Appwrite/Services/Users.php +++ b/src/Appwrite/Services/Users.php @@ -678,6 +678,44 @@ public function updateEmail(string $userId, string $email): array ); } + /** + * Create user JWT + * + * Use this endpoint to create a JSON Web Token for user by its unique ID. You + * can use the resulting JWT to authenticate on behalf of the user. The JWT + * secret will become invalid if the session it uses gets deleted. + * + * @param string $userId + * @param string $sessionId + * @param int $duration + * @throws AppwriteException + * @return array + + */ + public function createJWT(string $userId, string $sessionId = null, int $duration = null): array + { + $apiPath = str_replace(['{userId}'], [$userId], '/users/{userId}/jwts'); + + $apiParams = []; + if (!isset($userId)) { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (!is_null($sessionId)) { + $apiParams['sessionId'] = $sessionId; + } + if (!is_null($duration)) { + $apiParams['duration'] = $duration; + } + return $this->client->call( + Client::METHOD_POST, + $apiPath, + [ + 'content-type' => 'application/json', + ], + $apiParams + ); + } + /** * Update user labels * diff --git a/tests/Appwrite/Services/FunctionsTest.php b/tests/Appwrite/Services/FunctionsTest.php index 797b546..eeb7fc2 100644 --- a/tests/Appwrite/Services/FunctionsTest.php +++ b/tests/Appwrite/Services/FunctionsTest.php @@ -46,6 +46,7 @@ public function testMethodCreate(): void { "logging" => true, "runtime" => "python-3.8", "deployment" => "5e5ea5c16897e", + "scopes" => array(), "vars" => array(), "events" => array(), "schedule" => "5 4 * * *", @@ -103,6 +104,7 @@ public function testMethodGet(): void { "logging" => true, "runtime" => "python-3.8", "deployment" => "5e5ea5c16897e", + "scopes" => array(), "vars" => array(), "events" => array(), "schedule" => "5 4 * * *", @@ -141,6 +143,7 @@ public function testMethodUpdate(): void { "logging" => true, "runtime" => "python-3.8", "deployment" => "5e5ea5c16897e", + "scopes" => array(), "vars" => array(), "events" => array(), "schedule" => "5 4 * * *", @@ -295,6 +298,7 @@ public function testMethodUpdateDeployment(): void { "logging" => true, "runtime" => "python-3.8", "deployment" => "5e5ea5c16897e", + "scopes" => array(), "vars" => array(), "events" => array(), "schedule" => "5 4 * * *", @@ -349,8 +353,33 @@ public function testMethodCreateBuild(): void { $response = $this->functions->createBuild( "", - "", - "" + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateDeploymentBuild(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "deploymentId" => "5e5ea5c16897e", + "status" => "ready", + "stdout" => "", + "stderr" => "", + "startTime" => "2020-10-15T06:38:00.000+00:00", + "endTime" => "2020-10-15T06:38:00.000+00:00", + "duration" => 0, + "size" => 128,); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->functions->updateDeploymentBuild( + "", + "" ); $this->assertSame($data, $response); @@ -456,6 +485,23 @@ public function testMethodGetExecution(): void { $this->assertSame($data, $response); } + public function testMethodDeleteExecution(): void { + + $data = ''; + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->functions->deleteExecution( + "", + "" + ); + + $this->assertSame($data, $response); + } + public function testMethodListVariables(): void { $data = array( diff --git a/tests/Appwrite/Services/UsersTest.php b/tests/Appwrite/Services/UsersTest.php index 39f0699..4cb0911 100644 --- a/tests/Appwrite/Services/UsersTest.php +++ b/tests/Appwrite/Services/UsersTest.php @@ -425,6 +425,23 @@ public function testMethodUpdateEmail(): void { $this->assertSame($data, $response); } + public function testMethodCreateJWT(): void { + + $data = array( + "jwt" => "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->users->createJWT( + "" + ); + + $this->assertSame($data, $response); + } + public function testMethodUpdateLabels(): void { $data = array( From b012adcf4bdc66a51c73b0bf4cbe79229efb26a0 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 17 Aug 2024 08:49:45 +0000 Subject: [PATCH 2/9] chore: release rc --- README.md | 2 +- composer.json | 2 +- docs/account.md | 7 +- docs/avatars.md | 6 +- .../account/create-anonymous-session.md | 12 - .../account/create-email-password-session.md | 15 - docs/examples/account/create-email-token.md | 16 - docs/examples/account/create-j-w-t.md | 12 - .../account/create-magic-u-r-l-token.md | 17 - .../account/create-mfa-authenticator.md | 16 - docs/examples/account/create-mfa-challenge.md | 15 - .../account/create-mfa-recovery-codes.md | 13 - docs/examples/account/create-o-auth2token.md | 18 - docs/examples/account/create-phone-token.md | 15 - .../account/create-phone-verification.md | 13 - docs/examples/account/create-recovery.md | 16 - docs/examples/account/create-session.md | 15 - docs/examples/account/create-verification.md | 15 - docs/examples/account/create.md | 17 - docs/examples/account/delete-identity.md | 15 - .../account/delete-mfa-authenticator.md | 17 - docs/examples/account/delete-session.md | 15 - docs/examples/account/delete-sessions.md | 13 - .../account/get-mfa-recovery-codes.md | 13 - docs/examples/account/get-prefs.md | 13 - docs/examples/account/get-session.md | 15 - docs/examples/account/get.md | 13 - docs/examples/account/list-identities.md | 15 - docs/examples/account/list-logs.md | 15 - docs/examples/account/list-mfa-factors.md | 13 - docs/examples/account/list-sessions.md | 13 - docs/examples/account/update-email.md | 16 - docs/examples/account/update-m-f-a.md | 15 - .../account/update-magic-u-r-l-session.md | 15 - .../account/update-mfa-authenticator.md | 17 - docs/examples/account/update-mfa-challenge.md | 16 - .../account/update-mfa-recovery-codes.md | 13 - docs/examples/account/update-name.md | 15 - docs/examples/account/update-password.md | 16 - docs/examples/account/update-phone-session.md | 15 - .../account/update-phone-verification.md | 16 - docs/examples/account/update-phone.md | 16 - docs/examples/account/update-prefs.md | 15 - docs/examples/account/update-recovery.md | 17 - docs/examples/account/update-session.md | 15 - docs/examples/account/update-status.md | 13 - docs/examples/account/update-verification.md | 16 - docs/examples/avatars/get-browser.md | 19 - docs/examples/avatars/get-credit-card.md | 19 - docs/examples/avatars/get-favicon.md | 15 - docs/examples/avatars/get-flag.md | 19 - docs/examples/avatars/get-image.md | 17 - docs/examples/avatars/get-initials.md | 18 - docs/examples/avatars/get-q-r.md | 18 - .../databases/create-boolean-attribute.md | 20 - docs/examples/databases/create-collection.md | 20 - .../databases/create-datetime-attribute.md | 20 - docs/examples/databases/create-document.md | 19 - .../databases/create-email-attribute.md | 20 - .../databases/create-enum-attribute.md | 21 - .../databases/create-float-attribute.md | 22 - docs/examples/databases/create-index.md | 21 - .../databases/create-integer-attribute.md | 22 - .../examples/databases/create-ip-attribute.md | 20 - .../create-relationship-attribute.md | 23 - .../databases/create-string-attribute.md | 22 - .../databases/create-url-attribute.md | 20 - docs/examples/databases/create.md | 17 - docs/examples/databases/delete-attribute.md | 17 - docs/examples/databases/delete-collection.md | 16 - docs/examples/databases/delete-document.md | 17 - docs/examples/databases/delete-index.md | 17 - docs/examples/databases/delete.md | 15 - docs/examples/databases/get-attribute.md | 17 - docs/examples/databases/get-collection.md | 16 - docs/examples/databases/get-document.md | 18 - docs/examples/databases/get-index.md | 17 - docs/examples/databases/get.md | 15 - docs/examples/databases/list-attributes.md | 17 - docs/examples/databases/list-collections.md | 17 - docs/examples/databases/list-documents.md | 17 - docs/examples/databases/list-indexes.md | 17 - docs/examples/databases/list.md | 16 - .../databases/update-boolean-attribute.md | 19 - docs/examples/databases/update-collection.md | 20 - .../databases/update-datetime-attribute.md | 19 - docs/examples/databases/update-document.md | 19 - .../databases/update-email-attribute.md | 19 - .../databases/update-enum-attribute.md | 20 - .../databases/update-float-attribute.md | 21 - .../databases/update-integer-attribute.md | 21 - .../examples/databases/update-ip-attribute.md | 19 - .../update-relationship-attribute.md | 18 - .../databases/update-string-attribute.md | 19 - .../databases/update-url-attribute.md | 19 - docs/examples/databases/update.md | 17 - docs/examples/functions/create-build.md | 17 - docs/examples/functions/create-deployment.md | 20 - docs/examples/functions/create-execution.md | 21 - docs/examples/functions/create-variable.md | 17 - docs/examples/functions/create.md | 36 - docs/examples/functions/delete-deployment.md | 16 - docs/examples/functions/delete-execution.md | 16 - docs/examples/functions/delete-variable.md | 16 - docs/examples/functions/delete.md | 15 - .../examples/functions/download-deployment.md | 16 - docs/examples/functions/get-deployment.md | 16 - docs/examples/functions/get-execution.md | 16 - docs/examples/functions/get-variable.md | 16 - docs/examples/functions/get.md | 15 - docs/examples/functions/list-deployments.md | 17 - docs/examples/functions/list-executions.md | 17 - docs/examples/functions/list-runtimes.md | 13 - docs/examples/functions/list-variables.md | 15 - docs/examples/functions/list.md | 16 - .../functions/update-deployment-build.md | 16 - docs/examples/functions/update-deployment.md | 16 - docs/examples/functions/update-variable.md | 18 - docs/examples/functions/update.md | 31 - docs/examples/graphql/mutation.md | 15 - docs/examples/graphql/query.md | 15 - docs/examples/health/get-antivirus.md | 13 - docs/examples/health/get-cache.md | 13 - docs/examples/health/get-certificate.md | 15 - docs/examples/health/get-d-b.md | 13 - docs/examples/health/get-failed-jobs.md | 17 - docs/examples/health/get-pub-sub.md | 13 - docs/examples/health/get-queue-builds.md | 15 - .../examples/health/get-queue-certificates.md | 15 - docs/examples/health/get-queue-databases.md | 16 - docs/examples/health/get-queue-deletes.md | 15 - docs/examples/health/get-queue-functions.md | 15 - docs/examples/health/get-queue-logs.md | 15 - docs/examples/health/get-queue-mails.md | 15 - docs/examples/health/get-queue-messaging.md | 15 - docs/examples/health/get-queue-migrations.md | 15 - docs/examples/health/get-queue-usage-dump.md | 15 - docs/examples/health/get-queue-usage.md | 15 - docs/examples/health/get-queue-webhooks.md | 15 - docs/examples/health/get-queue.md | 13 - docs/examples/health/get-storage-local.md | 13 - docs/examples/health/get-storage.md | 13 - docs/examples/health/get-time.md | 13 - docs/examples/health/get.md | 13 - docs/examples/locale/get.md | 13 - docs/examples/locale/list-codes.md | 13 - docs/examples/locale/list-continents.md | 13 - docs/examples/locale/list-countries-e-u.md | 13 - docs/examples/locale/list-countries-phones.md | 13 - docs/examples/locale/list-countries.md | 13 - docs/examples/locale/list-currencies.md | 13 - docs/examples/locale/list-languages.md | 13 - .../messaging/create-apns-provider.md | 22 - docs/examples/messaging/create-email.md | 26 - .../examples/messaging/create-fcm-provider.md | 18 - .../messaging/create-mailgun-provider.md | 24 - .../messaging/create-msg91provider.md | 20 - docs/examples/messaging/create-push.md | 30 - .../messaging/create-sendgrid-provider.md | 22 - docs/examples/messaging/create-sms.md | 21 - .../messaging/create-smtp-provider.md | 28 - docs/examples/messaging/create-subscriber.md | 17 - .../messaging/create-telesign-provider.md | 20 - .../messaging/create-textmagic-provider.md | 20 - docs/examples/messaging/create-topic.md | 17 - .../messaging/create-twilio-provider.md | 20 - .../messaging/create-vonage-provider.md | 20 - docs/examples/messaging/delete-provider.md | 15 - docs/examples/messaging/delete-subscriber.md | 16 - docs/examples/messaging/delete-topic.md | 15 - docs/examples/messaging/delete.md | 15 - docs/examples/messaging/get-message.md | 15 - docs/examples/messaging/get-provider.md | 15 - docs/examples/messaging/get-subscriber.md | 16 - docs/examples/messaging/get-topic.md | 15 - docs/examples/messaging/list-message-logs.md | 16 - docs/examples/messaging/list-messages.md | 16 - docs/examples/messaging/list-provider-logs.md | 16 - docs/examples/messaging/list-providers.md | 16 - .../messaging/list-subscriber-logs.md | 16 - docs/examples/messaging/list-subscribers.md | 17 - docs/examples/messaging/list-targets.md | 16 - docs/examples/messaging/list-topic-logs.md | 16 - docs/examples/messaging/list-topics.md | 16 - .../messaging/update-apns-provider.md | 22 - docs/examples/messaging/update-email.md | 26 - .../examples/messaging/update-fcm-provider.md | 18 - .../messaging/update-mailgun-provider.md | 24 - .../messaging/update-msg91provider.md | 20 - docs/examples/messaging/update-push.md | 30 - .../messaging/update-sendgrid-provider.md | 22 - docs/examples/messaging/update-sms.md | 21 - .../messaging/update-smtp-provider.md | 28 - .../messaging/update-telesign-provider.md | 20 - .../messaging/update-textmagic-provider.md | 20 - docs/examples/messaging/update-topic.md | 17 - .../messaging/update-twilio-provider.md | 20 - .../messaging/update-vonage-provider.md | 20 - docs/examples/storage/create-bucket.md | 24 - docs/examples/storage/create-file.md | 19 - docs/examples/storage/delete-bucket.md | 15 - docs/examples/storage/delete-file.md | 16 - docs/examples/storage/get-bucket.md | 15 - docs/examples/storage/get-file-download.md | 16 - docs/examples/storage/get-file-preview.md | 27 - docs/examples/storage/get-file-view.md | 16 - docs/examples/storage/get-file.md | 16 - docs/examples/storage/list-buckets.md | 16 - docs/examples/storage/list-files.md | 17 - docs/examples/storage/update-bucket.md | 24 - docs/examples/storage/update-file.md | 18 - docs/examples/teams/create-membership.md | 21 - docs/examples/teams/create.md | 17 - docs/examples/teams/delete-membership.md | 16 - docs/examples/teams/delete.md | 15 - docs/examples/teams/get-membership.md | 16 - docs/examples/teams/get-prefs.md | 15 - docs/examples/teams/get.md | 15 - docs/examples/teams/list-memberships.md | 17 - docs/examples/teams/list.md | 16 - .../teams/update-membership-status.md | 18 - docs/examples/teams/update-membership.md | 17 - docs/examples/teams/update-name.md | 16 - docs/examples/teams/update-prefs.md | 16 - docs/examples/users/create-argon2user.md | 18 - docs/examples/users/create-bcrypt-user.md | 18 - docs/examples/users/create-j-w-t.md | 17 - docs/examples/users/create-m-d5user.md | 18 - .../users/create-mfa-recovery-codes.md | 15 - docs/examples/users/create-p-h-pass-user.md | 18 - docs/examples/users/create-s-h-a-user.md | 19 - .../users/create-scrypt-modified-user.md | 21 - docs/examples/users/create-scrypt-user.md | 23 - docs/examples/users/create-session.md | 15 - docs/examples/users/create-target.md | 21 - docs/examples/users/create-token.md | 17 - docs/examples/users/create.md | 19 - docs/examples/users/delete-identity.md | 15 - .../users/delete-mfa-authenticator.md | 17 - docs/examples/users/delete-session.md | 16 - docs/examples/users/delete-sessions.md | 15 - docs/examples/users/delete-target.md | 16 - docs/examples/users/delete.md | 15 - docs/examples/users/get-mfa-recovery-codes.md | 15 - docs/examples/users/get-prefs.md | 15 - docs/examples/users/get-target.md | 16 - docs/examples/users/get.md | 15 - docs/examples/users/list-identities.md | 16 - docs/examples/users/list-logs.md | 16 - docs/examples/users/list-memberships.md | 15 - docs/examples/users/list-mfa-factors.md | 15 - docs/examples/users/list-sessions.md | 15 - docs/examples/users/list-targets.md | 16 - docs/examples/users/list.md | 16 - .../users/update-email-verification.md | 16 - docs/examples/users/update-email.md | 16 - docs/examples/users/update-labels.md | 16 - .../users/update-mfa-recovery-codes.md | 15 - docs/examples/users/update-mfa.md | 16 - docs/examples/users/update-name.md | 16 - docs/examples/users/update-password.md | 16 - .../users/update-phone-verification.md | 16 - docs/examples/users/update-phone.md | 16 - docs/examples/users/update-prefs.md | 16 - docs/examples/users/update-status.md | 16 - docs/examples/users/update-target.md | 19 - docs/functions.md | 386 --- docs/graphql.md | 30 - docs/health.md | 273 -- docs/locale.md | 68 - docs/messaging.md | 864 ------- docs/storage.md | 234 -- docs/teams.md | 215 -- docs/users.md | 660 ----- src/Appwrite/AppwriteException.php | 46 - src/Appwrite/Client.php | 310 --- src/Appwrite/Enums/AuthenticationFactor.php | 59 - src/Appwrite/Enums/AuthenticatorType.php | 35 - src/Appwrite/Enums/Browser.php | 139 - src/Appwrite/Enums/Compression.php | 51 - src/Appwrite/Enums/CreditCard.php | 155 -- src/Appwrite/Enums/ExecutionMethod.php | 75 - src/Appwrite/Enums/Flag.php | 1587 ------------ src/Appwrite/Enums/ImageFormat.php | 67 - src/Appwrite/Enums/ImageGravity.php | 99 - src/Appwrite/Enums/IndexType.php | 51 - src/Appwrite/Enums/MessagingProviderType.php | 51 - src/Appwrite/Enums/Name.php | 123 - src/Appwrite/Enums/OAuthProvider.php | 339 --- src/Appwrite/Enums/PasswordHash.php | 115 - src/Appwrite/Enums/RelationMutate.php | 51 - src/Appwrite/Enums/RelationshipType.php | 59 - src/Appwrite/Enums/Runtime.php | 395 --- src/Appwrite/Enums/SmtpEncryption.php | 51 - src/Appwrite/ID.php | 22 - src/Appwrite/InputFile.php | 51 - src/Appwrite/Permission.php | 27 - src/Appwrite/Query.php | 297 --- src/Appwrite/Role.php | 111 - src/Appwrite/Service.php | 19 - src/Appwrite/Services/Account.php | 1567 ------------ src/Appwrite/Services/Avatars.php | 346 --- src/Appwrite/Services/Databases.php | 2001 --------------- src/Appwrite/Services/Functions.php | 1036 -------- src/Appwrite/Services/Graphql.php | 80 - src/Appwrite/Services/Health.php | 655 ----- src/Appwrite/Services/Locale.php | 221 -- src/Appwrite/Services/Messaging.php | 2253 ----------------- src/Appwrite/Services/Storage.php | 672 ----- src/Appwrite/Services/Teams.php | 525 ---- src/Appwrite/Services/Users.php | 1640 ------------ tests/Appwrite/IDTest.php | 15 - tests/Appwrite/PermissionTest.php | 27 - tests/Appwrite/QueryTest.php | 149 -- tests/Appwrite/RoleTest.php | 47 - tests/Appwrite/Services/AccountTest.php | 1149 --------- tests/Appwrite/Services/AvatarsTest.php | 130 - tests/Appwrite/Services/DatabasesTest.php | 1006 -------- tests/Appwrite/Services/FunctionsTest.php | 614 ----- tests/Appwrite/Services/GraphqlTest.php | 51 - tests/Appwrite/Services/HealthTest.php | 410 --- tests/Appwrite/Services/LocaleTest.php | 160 -- tests/Appwrite/Services/MessagingTest.php | 1071 -------- tests/Appwrite/Services/StorageTest.php | 309 --- tests/Appwrite/Services/TeamsTest.php | 311 --- tests/Appwrite/Services/UsersTest.php | 1109 -------- 326 files changed, 9 insertions(+), 29156 deletions(-) delete mode 100644 docs/examples/account/create-anonymous-session.md delete mode 100644 docs/examples/account/create-email-password-session.md delete mode 100644 docs/examples/account/create-email-token.md delete mode 100644 docs/examples/account/create-j-w-t.md delete mode 100644 docs/examples/account/create-magic-u-r-l-token.md delete mode 100644 docs/examples/account/create-mfa-authenticator.md delete mode 100644 docs/examples/account/create-mfa-challenge.md delete mode 100644 docs/examples/account/create-mfa-recovery-codes.md delete mode 100644 docs/examples/account/create-o-auth2token.md delete mode 100644 docs/examples/account/create-phone-token.md delete mode 100644 docs/examples/account/create-phone-verification.md delete mode 100644 docs/examples/account/create-recovery.md delete mode 100644 docs/examples/account/create-session.md delete mode 100644 docs/examples/account/create-verification.md delete mode 100644 docs/examples/account/create.md delete mode 100644 docs/examples/account/delete-identity.md delete mode 100644 docs/examples/account/delete-mfa-authenticator.md delete mode 100644 docs/examples/account/delete-session.md delete mode 100644 docs/examples/account/delete-sessions.md delete mode 100644 docs/examples/account/get-mfa-recovery-codes.md delete mode 100644 docs/examples/account/get-prefs.md delete mode 100644 docs/examples/account/get-session.md delete mode 100644 docs/examples/account/get.md delete mode 100644 docs/examples/account/list-identities.md delete mode 100644 docs/examples/account/list-logs.md delete mode 100644 docs/examples/account/list-mfa-factors.md delete mode 100644 docs/examples/account/list-sessions.md delete mode 100644 docs/examples/account/update-email.md delete mode 100644 docs/examples/account/update-m-f-a.md delete mode 100644 docs/examples/account/update-magic-u-r-l-session.md delete mode 100644 docs/examples/account/update-mfa-authenticator.md delete mode 100644 docs/examples/account/update-mfa-challenge.md delete mode 100644 docs/examples/account/update-mfa-recovery-codes.md delete mode 100644 docs/examples/account/update-name.md delete mode 100644 docs/examples/account/update-password.md delete mode 100644 docs/examples/account/update-phone-session.md delete mode 100644 docs/examples/account/update-phone-verification.md delete mode 100644 docs/examples/account/update-phone.md delete mode 100644 docs/examples/account/update-prefs.md delete mode 100644 docs/examples/account/update-recovery.md delete mode 100644 docs/examples/account/update-session.md delete mode 100644 docs/examples/account/update-status.md delete mode 100644 docs/examples/account/update-verification.md delete mode 100644 docs/examples/avatars/get-browser.md delete mode 100644 docs/examples/avatars/get-credit-card.md delete mode 100644 docs/examples/avatars/get-favicon.md delete mode 100644 docs/examples/avatars/get-flag.md delete mode 100644 docs/examples/avatars/get-image.md delete mode 100644 docs/examples/avatars/get-initials.md delete mode 100644 docs/examples/avatars/get-q-r.md delete mode 100644 docs/examples/databases/create-boolean-attribute.md delete mode 100644 docs/examples/databases/create-collection.md delete mode 100644 docs/examples/databases/create-datetime-attribute.md delete mode 100644 docs/examples/databases/create-document.md delete mode 100644 docs/examples/databases/create-email-attribute.md delete mode 100644 docs/examples/databases/create-enum-attribute.md delete mode 100644 docs/examples/databases/create-float-attribute.md delete mode 100644 docs/examples/databases/create-index.md delete mode 100644 docs/examples/databases/create-integer-attribute.md delete mode 100644 docs/examples/databases/create-ip-attribute.md delete mode 100644 docs/examples/databases/create-relationship-attribute.md delete mode 100644 docs/examples/databases/create-string-attribute.md delete mode 100644 docs/examples/databases/create-url-attribute.md delete mode 100644 docs/examples/databases/create.md delete mode 100644 docs/examples/databases/delete-attribute.md delete mode 100644 docs/examples/databases/delete-collection.md delete mode 100644 docs/examples/databases/delete-document.md delete mode 100644 docs/examples/databases/delete-index.md delete mode 100644 docs/examples/databases/delete.md delete mode 100644 docs/examples/databases/get-attribute.md delete mode 100644 docs/examples/databases/get-collection.md delete mode 100644 docs/examples/databases/get-document.md delete mode 100644 docs/examples/databases/get-index.md delete mode 100644 docs/examples/databases/get.md delete mode 100644 docs/examples/databases/list-attributes.md delete mode 100644 docs/examples/databases/list-collections.md delete mode 100644 docs/examples/databases/list-documents.md delete mode 100644 docs/examples/databases/list-indexes.md delete mode 100644 docs/examples/databases/list.md delete mode 100644 docs/examples/databases/update-boolean-attribute.md delete mode 100644 docs/examples/databases/update-collection.md delete mode 100644 docs/examples/databases/update-datetime-attribute.md delete mode 100644 docs/examples/databases/update-document.md delete mode 100644 docs/examples/databases/update-email-attribute.md delete mode 100644 docs/examples/databases/update-enum-attribute.md delete mode 100644 docs/examples/databases/update-float-attribute.md delete mode 100644 docs/examples/databases/update-integer-attribute.md delete mode 100644 docs/examples/databases/update-ip-attribute.md delete mode 100644 docs/examples/databases/update-relationship-attribute.md delete mode 100644 docs/examples/databases/update-string-attribute.md delete mode 100644 docs/examples/databases/update-url-attribute.md delete mode 100644 docs/examples/databases/update.md delete mode 100644 docs/examples/functions/create-build.md delete mode 100644 docs/examples/functions/create-deployment.md delete mode 100644 docs/examples/functions/create-execution.md delete mode 100644 docs/examples/functions/create-variable.md delete mode 100644 docs/examples/functions/create.md delete mode 100644 docs/examples/functions/delete-deployment.md delete mode 100644 docs/examples/functions/delete-execution.md delete mode 100644 docs/examples/functions/delete-variable.md delete mode 100644 docs/examples/functions/delete.md delete mode 100644 docs/examples/functions/download-deployment.md delete mode 100644 docs/examples/functions/get-deployment.md delete mode 100644 docs/examples/functions/get-execution.md delete mode 100644 docs/examples/functions/get-variable.md delete mode 100644 docs/examples/functions/get.md delete mode 100644 docs/examples/functions/list-deployments.md delete mode 100644 docs/examples/functions/list-executions.md delete mode 100644 docs/examples/functions/list-runtimes.md delete mode 100644 docs/examples/functions/list-variables.md delete mode 100644 docs/examples/functions/list.md delete mode 100644 docs/examples/functions/update-deployment-build.md delete mode 100644 docs/examples/functions/update-deployment.md delete mode 100644 docs/examples/functions/update-variable.md delete mode 100644 docs/examples/functions/update.md delete mode 100644 docs/examples/graphql/mutation.md delete mode 100644 docs/examples/graphql/query.md delete mode 100644 docs/examples/health/get-antivirus.md delete mode 100644 docs/examples/health/get-cache.md delete mode 100644 docs/examples/health/get-certificate.md delete mode 100644 docs/examples/health/get-d-b.md delete mode 100644 docs/examples/health/get-failed-jobs.md delete mode 100644 docs/examples/health/get-pub-sub.md delete mode 100644 docs/examples/health/get-queue-builds.md delete mode 100644 docs/examples/health/get-queue-certificates.md delete mode 100644 docs/examples/health/get-queue-databases.md delete mode 100644 docs/examples/health/get-queue-deletes.md delete mode 100644 docs/examples/health/get-queue-functions.md delete mode 100644 docs/examples/health/get-queue-logs.md delete mode 100644 docs/examples/health/get-queue-mails.md delete mode 100644 docs/examples/health/get-queue-messaging.md delete mode 100644 docs/examples/health/get-queue-migrations.md delete mode 100644 docs/examples/health/get-queue-usage-dump.md delete mode 100644 docs/examples/health/get-queue-usage.md delete mode 100644 docs/examples/health/get-queue-webhooks.md delete mode 100644 docs/examples/health/get-queue.md delete mode 100644 docs/examples/health/get-storage-local.md delete mode 100644 docs/examples/health/get-storage.md delete mode 100644 docs/examples/health/get-time.md delete mode 100644 docs/examples/health/get.md delete mode 100644 docs/examples/locale/get.md delete mode 100644 docs/examples/locale/list-codes.md delete mode 100644 docs/examples/locale/list-continents.md delete mode 100644 docs/examples/locale/list-countries-e-u.md delete mode 100644 docs/examples/locale/list-countries-phones.md delete mode 100644 docs/examples/locale/list-countries.md delete mode 100644 docs/examples/locale/list-currencies.md delete mode 100644 docs/examples/locale/list-languages.md delete mode 100644 docs/examples/messaging/create-apns-provider.md delete mode 100644 docs/examples/messaging/create-email.md delete mode 100644 docs/examples/messaging/create-fcm-provider.md delete mode 100644 docs/examples/messaging/create-mailgun-provider.md delete mode 100644 docs/examples/messaging/create-msg91provider.md delete mode 100644 docs/examples/messaging/create-push.md delete mode 100644 docs/examples/messaging/create-sendgrid-provider.md delete mode 100644 docs/examples/messaging/create-sms.md delete mode 100644 docs/examples/messaging/create-smtp-provider.md delete mode 100644 docs/examples/messaging/create-subscriber.md delete mode 100644 docs/examples/messaging/create-telesign-provider.md delete mode 100644 docs/examples/messaging/create-textmagic-provider.md delete mode 100644 docs/examples/messaging/create-topic.md delete mode 100644 docs/examples/messaging/create-twilio-provider.md delete mode 100644 docs/examples/messaging/create-vonage-provider.md delete mode 100644 docs/examples/messaging/delete-provider.md delete mode 100644 docs/examples/messaging/delete-subscriber.md delete mode 100644 docs/examples/messaging/delete-topic.md delete mode 100644 docs/examples/messaging/delete.md delete mode 100644 docs/examples/messaging/get-message.md delete mode 100644 docs/examples/messaging/get-provider.md delete mode 100644 docs/examples/messaging/get-subscriber.md delete mode 100644 docs/examples/messaging/get-topic.md delete mode 100644 docs/examples/messaging/list-message-logs.md delete mode 100644 docs/examples/messaging/list-messages.md delete mode 100644 docs/examples/messaging/list-provider-logs.md delete mode 100644 docs/examples/messaging/list-providers.md delete mode 100644 docs/examples/messaging/list-subscriber-logs.md delete mode 100644 docs/examples/messaging/list-subscribers.md delete mode 100644 docs/examples/messaging/list-targets.md delete mode 100644 docs/examples/messaging/list-topic-logs.md delete mode 100644 docs/examples/messaging/list-topics.md delete mode 100644 docs/examples/messaging/update-apns-provider.md delete mode 100644 docs/examples/messaging/update-email.md delete mode 100644 docs/examples/messaging/update-fcm-provider.md delete mode 100644 docs/examples/messaging/update-mailgun-provider.md delete mode 100644 docs/examples/messaging/update-msg91provider.md delete mode 100644 docs/examples/messaging/update-push.md delete mode 100644 docs/examples/messaging/update-sendgrid-provider.md delete mode 100644 docs/examples/messaging/update-sms.md delete mode 100644 docs/examples/messaging/update-smtp-provider.md delete mode 100644 docs/examples/messaging/update-telesign-provider.md delete mode 100644 docs/examples/messaging/update-textmagic-provider.md delete mode 100644 docs/examples/messaging/update-topic.md delete mode 100644 docs/examples/messaging/update-twilio-provider.md delete mode 100644 docs/examples/messaging/update-vonage-provider.md delete mode 100644 docs/examples/storage/create-bucket.md delete mode 100644 docs/examples/storage/create-file.md delete mode 100644 docs/examples/storage/delete-bucket.md delete mode 100644 docs/examples/storage/delete-file.md delete mode 100644 docs/examples/storage/get-bucket.md delete mode 100644 docs/examples/storage/get-file-download.md delete mode 100644 docs/examples/storage/get-file-preview.md delete mode 100644 docs/examples/storage/get-file-view.md delete mode 100644 docs/examples/storage/get-file.md delete mode 100644 docs/examples/storage/list-buckets.md delete mode 100644 docs/examples/storage/list-files.md delete mode 100644 docs/examples/storage/update-bucket.md delete mode 100644 docs/examples/storage/update-file.md delete mode 100644 docs/examples/teams/create-membership.md delete mode 100644 docs/examples/teams/create.md delete mode 100644 docs/examples/teams/delete-membership.md delete mode 100644 docs/examples/teams/delete.md delete mode 100644 docs/examples/teams/get-membership.md delete mode 100644 docs/examples/teams/get-prefs.md delete mode 100644 docs/examples/teams/get.md delete mode 100644 docs/examples/teams/list-memberships.md delete mode 100644 docs/examples/teams/list.md delete mode 100644 docs/examples/teams/update-membership-status.md delete mode 100644 docs/examples/teams/update-membership.md delete mode 100644 docs/examples/teams/update-name.md delete mode 100644 docs/examples/teams/update-prefs.md delete mode 100644 docs/examples/users/create-argon2user.md delete mode 100644 docs/examples/users/create-bcrypt-user.md delete mode 100644 docs/examples/users/create-j-w-t.md delete mode 100644 docs/examples/users/create-m-d5user.md delete mode 100644 docs/examples/users/create-mfa-recovery-codes.md delete mode 100644 docs/examples/users/create-p-h-pass-user.md delete mode 100644 docs/examples/users/create-s-h-a-user.md delete mode 100644 docs/examples/users/create-scrypt-modified-user.md delete mode 100644 docs/examples/users/create-scrypt-user.md delete mode 100644 docs/examples/users/create-session.md delete mode 100644 docs/examples/users/create-target.md delete mode 100644 docs/examples/users/create-token.md delete mode 100644 docs/examples/users/create.md delete mode 100644 docs/examples/users/delete-identity.md delete mode 100644 docs/examples/users/delete-mfa-authenticator.md delete mode 100644 docs/examples/users/delete-session.md delete mode 100644 docs/examples/users/delete-sessions.md delete mode 100644 docs/examples/users/delete-target.md delete mode 100644 docs/examples/users/delete.md delete mode 100644 docs/examples/users/get-mfa-recovery-codes.md delete mode 100644 docs/examples/users/get-prefs.md delete mode 100644 docs/examples/users/get-target.md delete mode 100644 docs/examples/users/get.md delete mode 100644 docs/examples/users/list-identities.md delete mode 100644 docs/examples/users/list-logs.md delete mode 100644 docs/examples/users/list-memberships.md delete mode 100644 docs/examples/users/list-mfa-factors.md delete mode 100644 docs/examples/users/list-sessions.md delete mode 100644 docs/examples/users/list-targets.md delete mode 100644 docs/examples/users/list.md delete mode 100644 docs/examples/users/update-email-verification.md delete mode 100644 docs/examples/users/update-email.md delete mode 100644 docs/examples/users/update-labels.md delete mode 100644 docs/examples/users/update-mfa-recovery-codes.md delete mode 100644 docs/examples/users/update-mfa.md delete mode 100644 docs/examples/users/update-name.md delete mode 100644 docs/examples/users/update-password.md delete mode 100644 docs/examples/users/update-phone-verification.md delete mode 100644 docs/examples/users/update-phone.md delete mode 100644 docs/examples/users/update-prefs.md delete mode 100644 docs/examples/users/update-status.md delete mode 100644 docs/examples/users/update-target.md delete mode 100644 docs/functions.md delete mode 100644 docs/graphql.md delete mode 100644 docs/health.md delete mode 100644 docs/locale.md delete mode 100644 docs/messaging.md delete mode 100644 docs/storage.md delete mode 100644 docs/teams.md delete mode 100644 docs/users.md delete mode 100644 src/Appwrite/AppwriteException.php delete mode 100644 src/Appwrite/Client.php delete mode 100644 src/Appwrite/Enums/AuthenticationFactor.php delete mode 100644 src/Appwrite/Enums/AuthenticatorType.php delete mode 100644 src/Appwrite/Enums/Browser.php delete mode 100644 src/Appwrite/Enums/Compression.php delete mode 100644 src/Appwrite/Enums/CreditCard.php delete mode 100644 src/Appwrite/Enums/ExecutionMethod.php delete mode 100644 src/Appwrite/Enums/Flag.php delete mode 100644 src/Appwrite/Enums/ImageFormat.php delete mode 100644 src/Appwrite/Enums/ImageGravity.php delete mode 100644 src/Appwrite/Enums/IndexType.php delete mode 100644 src/Appwrite/Enums/MessagingProviderType.php delete mode 100644 src/Appwrite/Enums/Name.php delete mode 100644 src/Appwrite/Enums/OAuthProvider.php delete mode 100644 src/Appwrite/Enums/PasswordHash.php delete mode 100644 src/Appwrite/Enums/RelationMutate.php delete mode 100644 src/Appwrite/Enums/RelationshipType.php delete mode 100644 src/Appwrite/Enums/Runtime.php delete mode 100644 src/Appwrite/Enums/SmtpEncryption.php delete mode 100644 src/Appwrite/ID.php delete mode 100644 src/Appwrite/InputFile.php delete mode 100644 src/Appwrite/Permission.php delete mode 100644 src/Appwrite/Query.php delete mode 100644 src/Appwrite/Role.php delete mode 100644 src/Appwrite/Service.php delete mode 100644 src/Appwrite/Services/Account.php delete mode 100644 src/Appwrite/Services/Avatars.php delete mode 100644 src/Appwrite/Services/Databases.php delete mode 100644 src/Appwrite/Services/Functions.php delete mode 100644 src/Appwrite/Services/Graphql.php delete mode 100644 src/Appwrite/Services/Health.php delete mode 100644 src/Appwrite/Services/Locale.php delete mode 100644 src/Appwrite/Services/Messaging.php delete mode 100644 src/Appwrite/Services/Storage.php delete mode 100644 src/Appwrite/Services/Teams.php delete mode 100644 src/Appwrite/Services/Users.php delete mode 100644 tests/Appwrite/IDTest.php delete mode 100644 tests/Appwrite/PermissionTest.php delete mode 100644 tests/Appwrite/QueryTest.php delete mode 100644 tests/Appwrite/RoleTest.php delete mode 100644 tests/Appwrite/Services/AccountTest.php delete mode 100644 tests/Appwrite/Services/AvatarsTest.php delete mode 100644 tests/Appwrite/Services/DatabasesTest.php delete mode 100644 tests/Appwrite/Services/FunctionsTest.php delete mode 100644 tests/Appwrite/Services/GraphqlTest.php delete mode 100644 tests/Appwrite/Services/HealthTest.php delete mode 100644 tests/Appwrite/Services/LocaleTest.php delete mode 100644 tests/Appwrite/Services/MessagingTest.php delete mode 100644 tests/Appwrite/Services/StorageTest.php delete mode 100644 tests/Appwrite/Services/TeamsTest.php delete mode 100644 tests/Appwrite/Services/UsersTest.php diff --git a/README.md b/README.md index 34df70f..57ef550 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Appwrite PHP SDK ![License](https://img.shields.io/github/license/appwrite/sdk-for-php.svg?style=flat-square&v=1) -![Version](https://img.shields.io/badge/api%20version-1.5.7-blue.svg?style=flat-square&v=1) +![Version](https://img.shields.io/badge/api%20version-1.6.0-blue.svg?style=flat-square&v=1) [![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator) [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) diff --git a/composer.json b/composer.json index 6dea965..f10aacc 100644 --- a/composer.json +++ b/composer.json @@ -5,7 +5,7 @@ "license": "BSD-3-Clause", "support": { "url": "https://appwrite.io/support", - "email": "team@appwrite.io" + "email": "team@localhost.test" }, "autoload": { "psr-4": { diff --git a/docs/account.md b/docs/account.md index 6f5694e..d23e642 100644 --- a/docs/account.md +++ b/docs/account.md @@ -106,7 +106,7 @@ PATCH https://cloud.appwrite.io/v1/account/mfa | --- | --- | --- | --- | | mfa | boolean | Enable or disable MFA. | | -## Add Authenticator +## Create Authenticator ```http request POST https://cloud.appwrite.io/v1/account/mfa/authenticators/{type} @@ -148,9 +148,8 @@ DELETE https://cloud.appwrite.io/v1/account/mfa/authenticators/{type} | Field Name | Type | Description | Default | | --- | --- | --- | --- | | type | string | **Required** Type of authenticator. | | -| otp | string | Valid verification token. | | -## Create 2FA Challenge +## Create MFA Challenge ```http request POST https://cloud.appwrite.io/v1/account/mfa/challenge @@ -562,7 +561,7 @@ POST https://cloud.appwrite.io/v1/account/verification/phone ** 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 using the [accountUpdatePhone](https://appwrite.io/docs/references/cloud/client-web/account#updatePhone) endpoint. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updatePhoneVerification). The verification code sent to the user's phone number is valid for 15 minutes. ** -## Create phone verification (confirmation) +## Update phone verification (confirmation) ```http request PUT https://cloud.appwrite.io/v1/account/verification/phone diff --git a/docs/avatars.md b/docs/avatars.md index 6279e82..53a7a1b 100644 --- a/docs/avatars.md +++ b/docs/avatars.md @@ -46,7 +46,8 @@ GET https://cloud.appwrite.io/v1/avatars/favicon ``` ** Use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL. - ** + +This endpoint does not follow HTTP redirects. ** ### Parameters @@ -83,7 +84,8 @@ GET https://cloud.appwrite.io/v1/avatars/image ** Use this endpoint to fetch a remote image URL and crop it to any image size you want. This endpoint is very useful if you need to crop and display remote images in your app or in case you want to make sure a 3rd party image is properly served using a TLS protocol. When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 400x400px. - ** + +This endpoint does not follow HTTP redirects. ** ### Parameters diff --git a/docs/examples/account/create-anonymous-session.md b/docs/examples/account/create-anonymous-session.md deleted file mode 100644 index c43c60e..0000000 --- a/docs/examples/account/create-anonymous-session.md +++ /dev/null @@ -1,12 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>'); // Your project ID - -$account = new Account($client); - -$result = $account->createAnonymousSession(); diff --git a/docs/examples/account/create-email-password-session.md b/docs/examples/account/create-email-password-session.md deleted file mode 100644 index faefc33..0000000 --- a/docs/examples/account/create-email-password-session.md +++ /dev/null @@ -1,15 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>'); // Your project ID - -$account = new Account($client); - -$result = $account->createEmailPasswordSession( - email: 'email@example.com', - password: 'password' -); \ No newline at end of file diff --git a/docs/examples/account/create-email-token.md b/docs/examples/account/create-email-token.md deleted file mode 100644 index 68dd7f4..0000000 --- a/docs/examples/account/create-email-token.md +++ /dev/null @@ -1,16 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>'); // Your project ID - -$account = new Account($client); - -$result = $account->createEmailToken( - userId: '', - email: 'email@example.com', - phrase: false // optional -); \ No newline at end of file diff --git a/docs/examples/account/create-j-w-t.md b/docs/examples/account/create-j-w-t.md deleted file mode 100644 index 33479c4..0000000 --- a/docs/examples/account/create-j-w-t.md +++ /dev/null @@ -1,12 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>'); // Your project ID - -$account = new Account($client); - -$result = $account->createJWT(); diff --git a/docs/examples/account/create-magic-u-r-l-token.md b/docs/examples/account/create-magic-u-r-l-token.md deleted file mode 100644 index f75991c..0000000 --- a/docs/examples/account/create-magic-u-r-l-token.md +++ /dev/null @@ -1,17 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>'); // Your project ID - -$account = new Account($client); - -$result = $account->createMagicURLToken( - userId: '', - email: 'email@example.com', - url: 'https://example.com', // optional - phrase: false // optional -); \ No newline at end of file diff --git a/docs/examples/account/create-mfa-authenticator.md b/docs/examples/account/create-mfa-authenticator.md deleted file mode 100644 index 95fca46..0000000 --- a/docs/examples/account/create-mfa-authenticator.md +++ /dev/null @@ -1,16 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$account = new Account($client); - -$result = $account->createMfaAuthenticator( - type: AuthenticatorType::TOTP() -); \ No newline at end of file diff --git a/docs/examples/account/create-mfa-challenge.md b/docs/examples/account/create-mfa-challenge.md deleted file mode 100644 index 34bd063..0000000 --- a/docs/examples/account/create-mfa-challenge.md +++ /dev/null @@ -1,15 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>'); // Your project ID - -$account = new Account($client); - -$result = $account->createMfaChallenge( - factor: AuthenticationFactor::EMAIL() -); \ No newline at end of file diff --git a/docs/examples/account/create-mfa-recovery-codes.md b/docs/examples/account/create-mfa-recovery-codes.md deleted file mode 100644 index c474967..0000000 --- a/docs/examples/account/create-mfa-recovery-codes.md +++ /dev/null @@ -1,13 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$account = new Account($client); - -$result = $account->createMfaRecoveryCodes(); diff --git a/docs/examples/account/create-o-auth2token.md b/docs/examples/account/create-o-auth2token.md deleted file mode 100644 index 0411d6f..0000000 --- a/docs/examples/account/create-o-auth2token.md +++ /dev/null @@ -1,18 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>'); // Your project ID - -$account = new Account($client); - -$result = $account->createOAuth2Token( - provider: OAuthProvider::AMAZON(), - success: 'https://example.com', // optional - failure: 'https://example.com', // optional - scopes: [] // optional -); \ No newline at end of file diff --git a/docs/examples/account/create-phone-token.md b/docs/examples/account/create-phone-token.md deleted file mode 100644 index e5724d3..0000000 --- a/docs/examples/account/create-phone-token.md +++ /dev/null @@ -1,15 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>'); // Your project ID - -$account = new Account($client); - -$result = $account->createPhoneToken( - userId: '', - phone: '+12065550100' -); \ No newline at end of file diff --git a/docs/examples/account/create-phone-verification.md b/docs/examples/account/create-phone-verification.md deleted file mode 100644 index e681607..0000000 --- a/docs/examples/account/create-phone-verification.md +++ /dev/null @@ -1,13 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$account = new Account($client); - -$result = $account->createPhoneVerification(); diff --git a/docs/examples/account/create-recovery.md b/docs/examples/account/create-recovery.md deleted file mode 100644 index 86cc2d9..0000000 --- a/docs/examples/account/create-recovery.md +++ /dev/null @@ -1,16 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$account = new Account($client); - -$result = $account->createRecovery( - email: 'email@example.com', - url: 'https://example.com' -); \ No newline at end of file diff --git a/docs/examples/account/create-session.md b/docs/examples/account/create-session.md deleted file mode 100644 index e714d11..0000000 --- a/docs/examples/account/create-session.md +++ /dev/null @@ -1,15 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>'); // Your project ID - -$account = new Account($client); - -$result = $account->createSession( - userId: '', - secret: '' -); \ No newline at end of file diff --git a/docs/examples/account/create-verification.md b/docs/examples/account/create-verification.md deleted file mode 100644 index 9541956..0000000 --- a/docs/examples/account/create-verification.md +++ /dev/null @@ -1,15 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$account = new Account($client); - -$result = $account->createVerification( - url: 'https://example.com' -); \ No newline at end of file diff --git a/docs/examples/account/create.md b/docs/examples/account/create.md deleted file mode 100644 index b4bc9df..0000000 --- a/docs/examples/account/create.md +++ /dev/null @@ -1,17 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>'); // Your project ID - -$account = new Account($client); - -$result = $account->create( - userId: '', - email: 'email@example.com', - password: '', - name: '' // optional -); \ No newline at end of file diff --git a/docs/examples/account/delete-identity.md b/docs/examples/account/delete-identity.md deleted file mode 100644 index dc7f751..0000000 --- a/docs/examples/account/delete-identity.md +++ /dev/null @@ -1,15 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$account = new Account($client); - -$result = $account->deleteIdentity( - identityId: '' -); \ No newline at end of file diff --git a/docs/examples/account/delete-mfa-authenticator.md b/docs/examples/account/delete-mfa-authenticator.md deleted file mode 100644 index 5420c15..0000000 --- a/docs/examples/account/delete-mfa-authenticator.md +++ /dev/null @@ -1,17 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$account = new Account($client); - -$result = $account->deleteMfaAuthenticator( - type: AuthenticatorType::TOTP(), - otp: '' -); \ No newline at end of file diff --git a/docs/examples/account/delete-session.md b/docs/examples/account/delete-session.md deleted file mode 100644 index e52d95e..0000000 --- a/docs/examples/account/delete-session.md +++ /dev/null @@ -1,15 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$account = new Account($client); - -$result = $account->deleteSession( - sessionId: '' -); \ No newline at end of file diff --git a/docs/examples/account/delete-sessions.md b/docs/examples/account/delete-sessions.md deleted file mode 100644 index a493317..0000000 --- a/docs/examples/account/delete-sessions.md +++ /dev/null @@ -1,13 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$account = new Account($client); - -$result = $account->deleteSessions(); diff --git a/docs/examples/account/get-mfa-recovery-codes.md b/docs/examples/account/get-mfa-recovery-codes.md deleted file mode 100644 index f640e9e..0000000 --- a/docs/examples/account/get-mfa-recovery-codes.md +++ /dev/null @@ -1,13 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$account = new Account($client); - -$result = $account->getMfaRecoveryCodes(); diff --git a/docs/examples/account/get-prefs.md b/docs/examples/account/get-prefs.md deleted file mode 100644 index f6489fc..0000000 --- a/docs/examples/account/get-prefs.md +++ /dev/null @@ -1,13 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$account = new Account($client); - -$result = $account->getPrefs(); diff --git a/docs/examples/account/get-session.md b/docs/examples/account/get-session.md deleted file mode 100644 index 17bf7f7..0000000 --- a/docs/examples/account/get-session.md +++ /dev/null @@ -1,15 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$account = new Account($client); - -$result = $account->getSession( - sessionId: '' -); \ No newline at end of file diff --git a/docs/examples/account/get.md b/docs/examples/account/get.md deleted file mode 100644 index 8a36274..0000000 --- a/docs/examples/account/get.md +++ /dev/null @@ -1,13 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$account = new Account($client); - -$result = $account->get(); diff --git a/docs/examples/account/list-identities.md b/docs/examples/account/list-identities.md deleted file mode 100644 index 78c6dd3..0000000 --- a/docs/examples/account/list-identities.md +++ /dev/null @@ -1,15 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$account = new Account($client); - -$result = $account->listIdentities( - queries: [] // optional -); \ No newline at end of file diff --git a/docs/examples/account/list-logs.md b/docs/examples/account/list-logs.md deleted file mode 100644 index 0dcdb3b..0000000 --- a/docs/examples/account/list-logs.md +++ /dev/null @@ -1,15 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$account = new Account($client); - -$result = $account->listLogs( - queries: [] // optional -); \ No newline at end of file diff --git a/docs/examples/account/list-mfa-factors.md b/docs/examples/account/list-mfa-factors.md deleted file mode 100644 index e029574..0000000 --- a/docs/examples/account/list-mfa-factors.md +++ /dev/null @@ -1,13 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$account = new Account($client); - -$result = $account->listMfaFactors(); diff --git a/docs/examples/account/list-sessions.md b/docs/examples/account/list-sessions.md deleted file mode 100644 index 28f2823..0000000 --- a/docs/examples/account/list-sessions.md +++ /dev/null @@ -1,13 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$account = new Account($client); - -$result = $account->listSessions(); diff --git a/docs/examples/account/update-email.md b/docs/examples/account/update-email.md deleted file mode 100644 index 60cb7cc..0000000 --- a/docs/examples/account/update-email.md +++ /dev/null @@ -1,16 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$account = new Account($client); - -$result = $account->updateEmail( - email: 'email@example.com', - password: 'password' -); \ No newline at end of file diff --git a/docs/examples/account/update-m-f-a.md b/docs/examples/account/update-m-f-a.md deleted file mode 100644 index 1869f7e..0000000 --- a/docs/examples/account/update-m-f-a.md +++ /dev/null @@ -1,15 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$account = new Account($client); - -$result = $account->updateMFA( - mfa: false -); \ No newline at end of file diff --git a/docs/examples/account/update-magic-u-r-l-session.md b/docs/examples/account/update-magic-u-r-l-session.md deleted file mode 100644 index d5e1a9f..0000000 --- a/docs/examples/account/update-magic-u-r-l-session.md +++ /dev/null @@ -1,15 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>'); // Your project ID - -$account = new Account($client); - -$result = $account->updateMagicURLSession( - userId: '', - secret: '' -); \ No newline at end of file diff --git a/docs/examples/account/update-mfa-authenticator.md b/docs/examples/account/update-mfa-authenticator.md deleted file mode 100644 index f998c23..0000000 --- a/docs/examples/account/update-mfa-authenticator.md +++ /dev/null @@ -1,17 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$account = new Account($client); - -$result = $account->updateMfaAuthenticator( - type: AuthenticatorType::TOTP(), - otp: '' -); \ No newline at end of file diff --git a/docs/examples/account/update-mfa-challenge.md b/docs/examples/account/update-mfa-challenge.md deleted file mode 100644 index 62124c5..0000000 --- a/docs/examples/account/update-mfa-challenge.md +++ /dev/null @@ -1,16 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$account = new Account($client); - -$result = $account->updateMfaChallenge( - challengeId: '', - otp: '' -); \ No newline at end of file diff --git a/docs/examples/account/update-mfa-recovery-codes.md b/docs/examples/account/update-mfa-recovery-codes.md deleted file mode 100644 index 7babcac..0000000 --- a/docs/examples/account/update-mfa-recovery-codes.md +++ /dev/null @@ -1,13 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$account = new Account($client); - -$result = $account->updateMfaRecoveryCodes(); diff --git a/docs/examples/account/update-name.md b/docs/examples/account/update-name.md deleted file mode 100644 index 4e0f1cb..0000000 --- a/docs/examples/account/update-name.md +++ /dev/null @@ -1,15 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$account = new Account($client); - -$result = $account->updateName( - name: '' -); \ No newline at end of file diff --git a/docs/examples/account/update-password.md b/docs/examples/account/update-password.md deleted file mode 100644 index e438d2b..0000000 --- a/docs/examples/account/update-password.md +++ /dev/null @@ -1,16 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$account = new Account($client); - -$result = $account->updatePassword( - password: '', - oldPassword: 'password' // optional -); \ No newline at end of file diff --git a/docs/examples/account/update-phone-session.md b/docs/examples/account/update-phone-session.md deleted file mode 100644 index 2951815..0000000 --- a/docs/examples/account/update-phone-session.md +++ /dev/null @@ -1,15 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>'); // Your project ID - -$account = new Account($client); - -$result = $account->updatePhoneSession( - userId: '', - secret: '' -); \ No newline at end of file diff --git a/docs/examples/account/update-phone-verification.md b/docs/examples/account/update-phone-verification.md deleted file mode 100644 index 6b95838..0000000 --- a/docs/examples/account/update-phone-verification.md +++ /dev/null @@ -1,16 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$account = new Account($client); - -$result = $account->updatePhoneVerification( - userId: '', - secret: '' -); \ No newline at end of file diff --git a/docs/examples/account/update-phone.md b/docs/examples/account/update-phone.md deleted file mode 100644 index 85cff81..0000000 --- a/docs/examples/account/update-phone.md +++ /dev/null @@ -1,16 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$account = new Account($client); - -$result = $account->updatePhone( - phone: '+12065550100', - password: 'password' -); \ No newline at end of file diff --git a/docs/examples/account/update-prefs.md b/docs/examples/account/update-prefs.md deleted file mode 100644 index c47859b..0000000 --- a/docs/examples/account/update-prefs.md +++ /dev/null @@ -1,15 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$account = new Account($client); - -$result = $account->updatePrefs( - prefs: [] -); \ No newline at end of file diff --git a/docs/examples/account/update-recovery.md b/docs/examples/account/update-recovery.md deleted file mode 100644 index 5400fb5..0000000 --- a/docs/examples/account/update-recovery.md +++ /dev/null @@ -1,17 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$account = new Account($client); - -$result = $account->updateRecovery( - userId: '', - secret: '', - password: '' -); \ No newline at end of file diff --git a/docs/examples/account/update-session.md b/docs/examples/account/update-session.md deleted file mode 100644 index 1a4611c..0000000 --- a/docs/examples/account/update-session.md +++ /dev/null @@ -1,15 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$account = new Account($client); - -$result = $account->updateSession( - sessionId: '' -); \ No newline at end of file diff --git a/docs/examples/account/update-status.md b/docs/examples/account/update-status.md deleted file mode 100644 index 8511b2f..0000000 --- a/docs/examples/account/update-status.md +++ /dev/null @@ -1,13 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$account = new Account($client); - -$result = $account->updateStatus(); diff --git a/docs/examples/account/update-verification.md b/docs/examples/account/update-verification.md deleted file mode 100644 index 253693e..0000000 --- a/docs/examples/account/update-verification.md +++ /dev/null @@ -1,16 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$account = new Account($client); - -$result = $account->updateVerification( - userId: '', - secret: '' -); \ No newline at end of file diff --git a/docs/examples/avatars/get-browser.md b/docs/examples/avatars/get-browser.md deleted file mode 100644 index 47a6c85..0000000 --- a/docs/examples/avatars/get-browser.md +++ /dev/null @@ -1,19 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$avatars = new Avatars($client); - -$result = $avatars->getBrowser( - code: Browser::AVANTBROWSER(), - width: 0, // optional - height: 0, // optional - quality: 0 // optional -); \ No newline at end of file diff --git a/docs/examples/avatars/get-credit-card.md b/docs/examples/avatars/get-credit-card.md deleted file mode 100644 index c1b6b15..0000000 --- a/docs/examples/avatars/get-credit-card.md +++ /dev/null @@ -1,19 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$avatars = new Avatars($client); - -$result = $avatars->getCreditCard( - code: CreditCard::AMERICANEXPRESS(), - width: 0, // optional - height: 0, // optional - quality: 0 // optional -); \ No newline at end of file diff --git a/docs/examples/avatars/get-favicon.md b/docs/examples/avatars/get-favicon.md deleted file mode 100644 index 50bb5c4..0000000 --- a/docs/examples/avatars/get-favicon.md +++ /dev/null @@ -1,15 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$avatars = new Avatars($client); - -$result = $avatars->getFavicon( - url: 'https://example.com' -); \ No newline at end of file diff --git a/docs/examples/avatars/get-flag.md b/docs/examples/avatars/get-flag.md deleted file mode 100644 index c163dea..0000000 --- a/docs/examples/avatars/get-flag.md +++ /dev/null @@ -1,19 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$avatars = new Avatars($client); - -$result = $avatars->getFlag( - code: Flag::AFGHANISTAN(), - width: 0, // optional - height: 0, // optional - quality: 0 // optional -); \ No newline at end of file diff --git a/docs/examples/avatars/get-image.md b/docs/examples/avatars/get-image.md deleted file mode 100644 index 31d2bbf..0000000 --- a/docs/examples/avatars/get-image.md +++ /dev/null @@ -1,17 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$avatars = new Avatars($client); - -$result = $avatars->getImage( - url: 'https://example.com', - width: 0, // optional - height: 0 // optional -); \ No newline at end of file diff --git a/docs/examples/avatars/get-initials.md b/docs/examples/avatars/get-initials.md deleted file mode 100644 index 6a94e05..0000000 --- a/docs/examples/avatars/get-initials.md +++ /dev/null @@ -1,18 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$avatars = new Avatars($client); - -$result = $avatars->getInitials( - name: '', // optional - width: 0, // optional - height: 0, // optional - background: '' // optional -); \ No newline at end of file diff --git a/docs/examples/avatars/get-q-r.md b/docs/examples/avatars/get-q-r.md deleted file mode 100644 index 48f0008..0000000 --- a/docs/examples/avatars/get-q-r.md +++ /dev/null @@ -1,18 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$avatars = new Avatars($client); - -$result = $avatars->getQR( - text: '', - size: 1, // optional - margin: 0, // optional - download: false // optional -); \ No newline at end of file diff --git a/docs/examples/databases/create-boolean-attribute.md b/docs/examples/databases/create-boolean-attribute.md deleted file mode 100644 index 27eba02..0000000 --- a/docs/examples/databases/create-boolean-attribute.md +++ /dev/null @@ -1,20 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$databases = new Databases($client); - -$result = $databases->createBooleanAttribute( - databaseId: '', - collectionId: '', - key: '', - required: false, - default: false, // optional - array: false // optional -); \ No newline at end of file diff --git a/docs/examples/databases/create-collection.md b/docs/examples/databases/create-collection.md deleted file mode 100644 index 72d36d2..0000000 --- a/docs/examples/databases/create-collection.md +++ /dev/null @@ -1,20 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$databases = new Databases($client); - -$result = $databases->createCollection( - databaseId: '', - collectionId: '', - name: '', - permissions: ["read("any")"], // optional - documentSecurity: false, // optional - enabled: false // optional -); \ No newline at end of file diff --git a/docs/examples/databases/create-datetime-attribute.md b/docs/examples/databases/create-datetime-attribute.md deleted file mode 100644 index a959381..0000000 --- a/docs/examples/databases/create-datetime-attribute.md +++ /dev/null @@ -1,20 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$databases = new Databases($client); - -$result = $databases->createDatetimeAttribute( - databaseId: '', - collectionId: '', - key: '', - required: false, - default: '', // optional - array: false // optional -); \ No newline at end of file diff --git a/docs/examples/databases/create-document.md b/docs/examples/databases/create-document.md deleted file mode 100644 index 612b114..0000000 --- a/docs/examples/databases/create-document.md +++ /dev/null @@ -1,19 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$databases = new Databases($client); - -$result = $databases->createDocument( - databaseId: '', - collectionId: '', - documentId: '', - data: [], - permissions: ["read("any")"] // optional -); \ No newline at end of file diff --git a/docs/examples/databases/create-email-attribute.md b/docs/examples/databases/create-email-attribute.md deleted file mode 100644 index a72a42f..0000000 --- a/docs/examples/databases/create-email-attribute.md +++ /dev/null @@ -1,20 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$databases = new Databases($client); - -$result = $databases->createEmailAttribute( - databaseId: '', - collectionId: '', - key: '', - required: false, - default: 'email@example.com', // optional - array: false // optional -); \ No newline at end of file diff --git a/docs/examples/databases/create-enum-attribute.md b/docs/examples/databases/create-enum-attribute.md deleted file mode 100644 index 2d6e3fb..0000000 --- a/docs/examples/databases/create-enum-attribute.md +++ /dev/null @@ -1,21 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$databases = new Databases($client); - -$result = $databases->createEnumAttribute( - databaseId: '', - collectionId: '', - key: '', - elements: [], - required: false, - default: '', // optional - array: false // optional -); \ No newline at end of file diff --git a/docs/examples/databases/create-float-attribute.md b/docs/examples/databases/create-float-attribute.md deleted file mode 100644 index 83f42ea..0000000 --- a/docs/examples/databases/create-float-attribute.md +++ /dev/null @@ -1,22 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$databases = new Databases($client); - -$result = $databases->createFloatAttribute( - databaseId: '', - collectionId: '', - key: '', - required: false, - min: null, // optional - max: null, // optional - default: null, // optional - array: false // optional -); \ No newline at end of file diff --git a/docs/examples/databases/create-index.md b/docs/examples/databases/create-index.md deleted file mode 100644 index e795271..0000000 --- a/docs/examples/databases/create-index.md +++ /dev/null @@ -1,21 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$databases = new Databases($client); - -$result = $databases->createIndex( - databaseId: '', - collectionId: '', - key: '', - type: IndexType::KEY(), - attributes: [], - orders: [] // optional -); \ No newline at end of file diff --git a/docs/examples/databases/create-integer-attribute.md b/docs/examples/databases/create-integer-attribute.md deleted file mode 100644 index 5abc89c..0000000 --- a/docs/examples/databases/create-integer-attribute.md +++ /dev/null @@ -1,22 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$databases = new Databases($client); - -$result = $databases->createIntegerAttribute( - databaseId: '', - collectionId: '', - key: '', - required: false, - min: null, // optional - max: null, // optional - default: null, // optional - array: false // optional -); \ No newline at end of file diff --git a/docs/examples/databases/create-ip-attribute.md b/docs/examples/databases/create-ip-attribute.md deleted file mode 100644 index 04c70f9..0000000 --- a/docs/examples/databases/create-ip-attribute.md +++ /dev/null @@ -1,20 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$databases = new Databases($client); - -$result = $databases->createIpAttribute( - databaseId: '', - collectionId: '', - key: '', - required: false, - default: '', // optional - array: false // optional -); \ No newline at end of file diff --git a/docs/examples/databases/create-relationship-attribute.md b/docs/examples/databases/create-relationship-attribute.md deleted file mode 100644 index 2e0ba64..0000000 --- a/docs/examples/databases/create-relationship-attribute.md +++ /dev/null @@ -1,23 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$databases = new Databases($client); - -$result = $databases->createRelationshipAttribute( - databaseId: '', - collectionId: '', - relatedCollectionId: '', - type: RelationshipType::ONETOONE(), - twoWay: false, // optional - key: '', // optional - twoWayKey: '', // optional - onDelete: RelationMutate::CASCADE() // optional -); \ No newline at end of file diff --git a/docs/examples/databases/create-string-attribute.md b/docs/examples/databases/create-string-attribute.md deleted file mode 100644 index 450c9bc..0000000 --- a/docs/examples/databases/create-string-attribute.md +++ /dev/null @@ -1,22 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$databases = new Databases($client); - -$result = $databases->createStringAttribute( - databaseId: '', - collectionId: '', - key: '', - size: 1, - required: false, - default: '', // optional - array: false, // optional - encrypt: false // optional -); \ No newline at end of file diff --git a/docs/examples/databases/create-url-attribute.md b/docs/examples/databases/create-url-attribute.md deleted file mode 100644 index e7a40b7..0000000 --- a/docs/examples/databases/create-url-attribute.md +++ /dev/null @@ -1,20 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$databases = new Databases($client); - -$result = $databases->createUrlAttribute( - databaseId: '', - collectionId: '', - key: '', - required: false, - default: 'https://example.com', // optional - array: false // optional -); \ No newline at end of file diff --git a/docs/examples/databases/create.md b/docs/examples/databases/create.md deleted file mode 100644 index da4a650..0000000 --- a/docs/examples/databases/create.md +++ /dev/null @@ -1,17 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$databases = new Databases($client); - -$result = $databases->create( - databaseId: '', - name: '', - enabled: false // optional -); \ No newline at end of file diff --git a/docs/examples/databases/delete-attribute.md b/docs/examples/databases/delete-attribute.md deleted file mode 100644 index e60d39f..0000000 --- a/docs/examples/databases/delete-attribute.md +++ /dev/null @@ -1,17 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$databases = new Databases($client); - -$result = $databases->deleteAttribute( - databaseId: '', - collectionId: '', - key: '' -); \ No newline at end of file diff --git a/docs/examples/databases/delete-collection.md b/docs/examples/databases/delete-collection.md deleted file mode 100644 index ce821e7..0000000 --- a/docs/examples/databases/delete-collection.md +++ /dev/null @@ -1,16 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$databases = new Databases($client); - -$result = $databases->deleteCollection( - databaseId: '', - collectionId: '' -); \ No newline at end of file diff --git a/docs/examples/databases/delete-document.md b/docs/examples/databases/delete-document.md deleted file mode 100644 index 536cdcd..0000000 --- a/docs/examples/databases/delete-document.md +++ /dev/null @@ -1,17 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$databases = new Databases($client); - -$result = $databases->deleteDocument( - databaseId: '', - collectionId: '', - documentId: '' -); \ No newline at end of file diff --git a/docs/examples/databases/delete-index.md b/docs/examples/databases/delete-index.md deleted file mode 100644 index cb9ddf9..0000000 --- a/docs/examples/databases/delete-index.md +++ /dev/null @@ -1,17 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$databases = new Databases($client); - -$result = $databases->deleteIndex( - databaseId: '', - collectionId: '', - key: '' -); \ No newline at end of file diff --git a/docs/examples/databases/delete.md b/docs/examples/databases/delete.md deleted file mode 100644 index 5b1a322..0000000 --- a/docs/examples/databases/delete.md +++ /dev/null @@ -1,15 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$databases = new Databases($client); - -$result = $databases->delete( - databaseId: '' -); \ No newline at end of file diff --git a/docs/examples/databases/get-attribute.md b/docs/examples/databases/get-attribute.md deleted file mode 100644 index 671f9ac..0000000 --- a/docs/examples/databases/get-attribute.md +++ /dev/null @@ -1,17 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$databases = new Databases($client); - -$result = $databases->getAttribute( - databaseId: '', - collectionId: '', - key: '' -); \ No newline at end of file diff --git a/docs/examples/databases/get-collection.md b/docs/examples/databases/get-collection.md deleted file mode 100644 index 23df77b..0000000 --- a/docs/examples/databases/get-collection.md +++ /dev/null @@ -1,16 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$databases = new Databases($client); - -$result = $databases->getCollection( - databaseId: '', - collectionId: '' -); \ No newline at end of file diff --git a/docs/examples/databases/get-document.md b/docs/examples/databases/get-document.md deleted file mode 100644 index bee705f..0000000 --- a/docs/examples/databases/get-document.md +++ /dev/null @@ -1,18 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$databases = new Databases($client); - -$result = $databases->getDocument( - databaseId: '', - collectionId: '', - documentId: '', - queries: [] // optional -); \ No newline at end of file diff --git a/docs/examples/databases/get-index.md b/docs/examples/databases/get-index.md deleted file mode 100644 index b5878dd..0000000 --- a/docs/examples/databases/get-index.md +++ /dev/null @@ -1,17 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$databases = new Databases($client); - -$result = $databases->getIndex( - databaseId: '', - collectionId: '', - key: '' -); \ No newline at end of file diff --git a/docs/examples/databases/get.md b/docs/examples/databases/get.md deleted file mode 100644 index 4838b0b..0000000 --- a/docs/examples/databases/get.md +++ /dev/null @@ -1,15 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$databases = new Databases($client); - -$result = $databases->get( - databaseId: '' -); \ No newline at end of file diff --git a/docs/examples/databases/list-attributes.md b/docs/examples/databases/list-attributes.md deleted file mode 100644 index 6b1834f..0000000 --- a/docs/examples/databases/list-attributes.md +++ /dev/null @@ -1,17 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$databases = new Databases($client); - -$result = $databases->listAttributes( - databaseId: '', - collectionId: '', - queries: [] // optional -); \ No newline at end of file diff --git a/docs/examples/databases/list-collections.md b/docs/examples/databases/list-collections.md deleted file mode 100644 index 045aece..0000000 --- a/docs/examples/databases/list-collections.md +++ /dev/null @@ -1,17 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$databases = new Databases($client); - -$result = $databases->listCollections( - databaseId: '', - queries: [], // optional - search: '' // optional -); \ No newline at end of file diff --git a/docs/examples/databases/list-documents.md b/docs/examples/databases/list-documents.md deleted file mode 100644 index c865f32..0000000 --- a/docs/examples/databases/list-documents.md +++ /dev/null @@ -1,17 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$databases = new Databases($client); - -$result = $databases->listDocuments( - databaseId: '', - collectionId: '', - queries: [] // optional -); \ No newline at end of file diff --git a/docs/examples/databases/list-indexes.md b/docs/examples/databases/list-indexes.md deleted file mode 100644 index fee8e8f..0000000 --- a/docs/examples/databases/list-indexes.md +++ /dev/null @@ -1,17 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$databases = new Databases($client); - -$result = $databases->listIndexes( - databaseId: '', - collectionId: '', - queries: [] // optional -); \ No newline at end of file diff --git a/docs/examples/databases/list.md b/docs/examples/databases/list.md deleted file mode 100644 index ea89f25..0000000 --- a/docs/examples/databases/list.md +++ /dev/null @@ -1,16 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$databases = new Databases($client); - -$result = $databases->list( - queries: [], // optional - search: '' // optional -); \ No newline at end of file diff --git a/docs/examples/databases/update-boolean-attribute.md b/docs/examples/databases/update-boolean-attribute.md deleted file mode 100644 index a599d60..0000000 --- a/docs/examples/databases/update-boolean-attribute.md +++ /dev/null @@ -1,19 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$databases = new Databases($client); - -$result = $databases->updateBooleanAttribute( - databaseId: '', - collectionId: '', - key: '', - required: false, - default: false -); \ No newline at end of file diff --git a/docs/examples/databases/update-collection.md b/docs/examples/databases/update-collection.md deleted file mode 100644 index 70b052d..0000000 --- a/docs/examples/databases/update-collection.md +++ /dev/null @@ -1,20 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$databases = new Databases($client); - -$result = $databases->updateCollection( - databaseId: '', - collectionId: '', - name: '', - permissions: ["read("any")"], // optional - documentSecurity: false, // optional - enabled: false // optional -); \ No newline at end of file diff --git a/docs/examples/databases/update-datetime-attribute.md b/docs/examples/databases/update-datetime-attribute.md deleted file mode 100644 index f0e92cf..0000000 --- a/docs/examples/databases/update-datetime-attribute.md +++ /dev/null @@ -1,19 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$databases = new Databases($client); - -$result = $databases->updateDatetimeAttribute( - databaseId: '', - collectionId: '', - key: '', - required: false, - default: '' -); \ No newline at end of file diff --git a/docs/examples/databases/update-document.md b/docs/examples/databases/update-document.md deleted file mode 100644 index 5af2f55..0000000 --- a/docs/examples/databases/update-document.md +++ /dev/null @@ -1,19 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$databases = new Databases($client); - -$result = $databases->updateDocument( - databaseId: '', - collectionId: '', - documentId: '', - data: [], // optional - permissions: ["read("any")"] // optional -); \ No newline at end of file diff --git a/docs/examples/databases/update-email-attribute.md b/docs/examples/databases/update-email-attribute.md deleted file mode 100644 index 8398758..0000000 --- a/docs/examples/databases/update-email-attribute.md +++ /dev/null @@ -1,19 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$databases = new Databases($client); - -$result = $databases->updateEmailAttribute( - databaseId: '', - collectionId: '', - key: '', - required: false, - default: 'email@example.com' -); \ No newline at end of file diff --git a/docs/examples/databases/update-enum-attribute.md b/docs/examples/databases/update-enum-attribute.md deleted file mode 100644 index 0bd7db5..0000000 --- a/docs/examples/databases/update-enum-attribute.md +++ /dev/null @@ -1,20 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$databases = new Databases($client); - -$result = $databases->updateEnumAttribute( - databaseId: '', - collectionId: '', - key: '', - elements: [], - required: false, - default: '' -); \ No newline at end of file diff --git a/docs/examples/databases/update-float-attribute.md b/docs/examples/databases/update-float-attribute.md deleted file mode 100644 index 32c3ba4..0000000 --- a/docs/examples/databases/update-float-attribute.md +++ /dev/null @@ -1,21 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$databases = new Databases($client); - -$result = $databases->updateFloatAttribute( - databaseId: '', - collectionId: '', - key: '', - required: false, - min: null, - max: null, - default: null -); \ No newline at end of file diff --git a/docs/examples/databases/update-integer-attribute.md b/docs/examples/databases/update-integer-attribute.md deleted file mode 100644 index 2233cc0..0000000 --- a/docs/examples/databases/update-integer-attribute.md +++ /dev/null @@ -1,21 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$databases = new Databases($client); - -$result = $databases->updateIntegerAttribute( - databaseId: '', - collectionId: '', - key: '', - required: false, - min: null, - max: null, - default: null -); \ No newline at end of file diff --git a/docs/examples/databases/update-ip-attribute.md b/docs/examples/databases/update-ip-attribute.md deleted file mode 100644 index a953ae1..0000000 --- a/docs/examples/databases/update-ip-attribute.md +++ /dev/null @@ -1,19 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$databases = new Databases($client); - -$result = $databases->updateIpAttribute( - databaseId: '', - collectionId: '', - key: '', - required: false, - default: '' -); \ No newline at end of file diff --git a/docs/examples/databases/update-relationship-attribute.md b/docs/examples/databases/update-relationship-attribute.md deleted file mode 100644 index e4e16df..0000000 --- a/docs/examples/databases/update-relationship-attribute.md +++ /dev/null @@ -1,18 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$databases = new Databases($client); - -$result = $databases->updateRelationshipAttribute( - databaseId: '', - collectionId: '', - key: '', - onDelete: RelationMutate::CASCADE() // optional -); \ No newline at end of file diff --git a/docs/examples/databases/update-string-attribute.md b/docs/examples/databases/update-string-attribute.md deleted file mode 100644 index b1a7ae4..0000000 --- a/docs/examples/databases/update-string-attribute.md +++ /dev/null @@ -1,19 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$databases = new Databases($client); - -$result = $databases->updateStringAttribute( - databaseId: '', - collectionId: '', - key: '', - required: false, - default: '' -); \ No newline at end of file diff --git a/docs/examples/databases/update-url-attribute.md b/docs/examples/databases/update-url-attribute.md deleted file mode 100644 index 383d721..0000000 --- a/docs/examples/databases/update-url-attribute.md +++ /dev/null @@ -1,19 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$databases = new Databases($client); - -$result = $databases->updateUrlAttribute( - databaseId: '', - collectionId: '', - key: '', - required: false, - default: 'https://example.com' -); \ No newline at end of file diff --git a/docs/examples/databases/update.md b/docs/examples/databases/update.md deleted file mode 100644 index 68cb214..0000000 --- a/docs/examples/databases/update.md +++ /dev/null @@ -1,17 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$databases = new Databases($client); - -$result = $databases->update( - databaseId: '', - name: '', - enabled: false // optional -); \ No newline at end of file diff --git a/docs/examples/functions/create-build.md b/docs/examples/functions/create-build.md deleted file mode 100644 index 43c781f..0000000 --- a/docs/examples/functions/create-build.md +++ /dev/null @@ -1,17 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$functions = new Functions($client); - -$result = $functions->createBuild( - functionId: '', - deploymentId: '', - buildId: '' // optional -); \ No newline at end of file diff --git a/docs/examples/functions/create-deployment.md b/docs/examples/functions/create-deployment.md deleted file mode 100644 index c35b886..0000000 --- a/docs/examples/functions/create-deployment.md +++ /dev/null @@ -1,20 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$functions = new Functions($client); - -$result = $functions->createDeployment( - functionId: '', - code: InputFile::withPath('file.png'), - activate: false, - entrypoint: '', // optional - commands: '' // optional -); \ No newline at end of file diff --git a/docs/examples/functions/create-execution.md b/docs/examples/functions/create-execution.md deleted file mode 100644 index ff531d5..0000000 --- a/docs/examples/functions/create-execution.md +++ /dev/null @@ -1,21 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$functions = new Functions($client); - -$result = $functions->createExecution( - functionId: '', - body: '', // optional - async: false, // optional - path: '', // optional - method: ExecutionMethod::GET(), // optional - headers: [], // optional - scheduledAt: '' // optional -); \ No newline at end of file diff --git a/docs/examples/functions/create-variable.md b/docs/examples/functions/create-variable.md deleted file mode 100644 index 441aa9d..0000000 --- a/docs/examples/functions/create-variable.md +++ /dev/null @@ -1,17 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$functions = new Functions($client); - -$result = $functions->createVariable( - functionId: '', - key: '', - value: '' -); \ No newline at end of file diff --git a/docs/examples/functions/create.md b/docs/examples/functions/create.md deleted file mode 100644 index f6dc183..0000000 --- a/docs/examples/functions/create.md +++ /dev/null @@ -1,36 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$functions = new Functions($client); - -$result = $functions->create( - functionId: '', - name: '', - runtime: ::NODE145(), - execute: ["any"], // optional - events: [], // optional - schedule: '', // optional - timeout: 1, // optional - enabled: false, // optional - logging: false, // optional - entrypoint: '', // optional - commands: '', // optional - scopes: [], // optional - installationId: '', // optional - providerRepositoryId: '', // optional - providerBranch: '', // optional - providerSilentMode: false, // optional - providerRootDirectory: '', // optional - templateRepository: '', // optional - templateOwner: '', // optional - templateRootDirectory: '', // optional - templateBranch: '' // optional -); \ No newline at end of file diff --git a/docs/examples/functions/delete-deployment.md b/docs/examples/functions/delete-deployment.md deleted file mode 100644 index 3f00e9d..0000000 --- a/docs/examples/functions/delete-deployment.md +++ /dev/null @@ -1,16 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$functions = new Functions($client); - -$result = $functions->deleteDeployment( - functionId: '', - deploymentId: '' -); \ No newline at end of file diff --git a/docs/examples/functions/delete-execution.md b/docs/examples/functions/delete-execution.md deleted file mode 100644 index 3733583..0000000 --- a/docs/examples/functions/delete-execution.md +++ /dev/null @@ -1,16 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$functions = new Functions($client); - -$result = $functions->deleteExecution( - functionId: '', - executionId: '' -); \ No newline at end of file diff --git a/docs/examples/functions/delete-variable.md b/docs/examples/functions/delete-variable.md deleted file mode 100644 index 5046e1f..0000000 --- a/docs/examples/functions/delete-variable.md +++ /dev/null @@ -1,16 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$functions = new Functions($client); - -$result = $functions->deleteVariable( - functionId: '', - variableId: '' -); \ No newline at end of file diff --git a/docs/examples/functions/delete.md b/docs/examples/functions/delete.md deleted file mode 100644 index 3d4da02..0000000 --- a/docs/examples/functions/delete.md +++ /dev/null @@ -1,15 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$functions = new Functions($client); - -$result = $functions->delete( - functionId: '' -); \ No newline at end of file diff --git a/docs/examples/functions/download-deployment.md b/docs/examples/functions/download-deployment.md deleted file mode 100644 index 2841d86..0000000 --- a/docs/examples/functions/download-deployment.md +++ /dev/null @@ -1,16 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$functions = new Functions($client); - -$result = $functions->downloadDeployment( - functionId: '', - deploymentId: '' -); \ No newline at end of file diff --git a/docs/examples/functions/get-deployment.md b/docs/examples/functions/get-deployment.md deleted file mode 100644 index d5758dd..0000000 --- a/docs/examples/functions/get-deployment.md +++ /dev/null @@ -1,16 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$functions = new Functions($client); - -$result = $functions->getDeployment( - functionId: '', - deploymentId: '' -); \ No newline at end of file diff --git a/docs/examples/functions/get-execution.md b/docs/examples/functions/get-execution.md deleted file mode 100644 index d0c7ec4..0000000 --- a/docs/examples/functions/get-execution.md +++ /dev/null @@ -1,16 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$functions = new Functions($client); - -$result = $functions->getExecution( - functionId: '', - executionId: '' -); \ No newline at end of file diff --git a/docs/examples/functions/get-variable.md b/docs/examples/functions/get-variable.md deleted file mode 100644 index 2bd901b..0000000 --- a/docs/examples/functions/get-variable.md +++ /dev/null @@ -1,16 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$functions = new Functions($client); - -$result = $functions->getVariable( - functionId: '', - variableId: '' -); \ No newline at end of file diff --git a/docs/examples/functions/get.md b/docs/examples/functions/get.md deleted file mode 100644 index b2c6d7b..0000000 --- a/docs/examples/functions/get.md +++ /dev/null @@ -1,15 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$functions = new Functions($client); - -$result = $functions->get( - functionId: '' -); \ No newline at end of file diff --git a/docs/examples/functions/list-deployments.md b/docs/examples/functions/list-deployments.md deleted file mode 100644 index d8bad27..0000000 --- a/docs/examples/functions/list-deployments.md +++ /dev/null @@ -1,17 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$functions = new Functions($client); - -$result = $functions->listDeployments( - functionId: '', - queries: [], // optional - search: '' // optional -); \ No newline at end of file diff --git a/docs/examples/functions/list-executions.md b/docs/examples/functions/list-executions.md deleted file mode 100644 index fda330a..0000000 --- a/docs/examples/functions/list-executions.md +++ /dev/null @@ -1,17 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$functions = new Functions($client); - -$result = $functions->listExecutions( - functionId: '', - queries: [], // optional - search: '' // optional -); \ No newline at end of file diff --git a/docs/examples/functions/list-runtimes.md b/docs/examples/functions/list-runtimes.md deleted file mode 100644 index 18d3c05..0000000 --- a/docs/examples/functions/list-runtimes.md +++ /dev/null @@ -1,13 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$functions = new Functions($client); - -$result = $functions->listRuntimes(); diff --git a/docs/examples/functions/list-variables.md b/docs/examples/functions/list-variables.md deleted file mode 100644 index 137a4da..0000000 --- a/docs/examples/functions/list-variables.md +++ /dev/null @@ -1,15 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$functions = new Functions($client); - -$result = $functions->listVariables( - functionId: '' -); \ No newline at end of file diff --git a/docs/examples/functions/list.md b/docs/examples/functions/list.md deleted file mode 100644 index 7b4d362..0000000 --- a/docs/examples/functions/list.md +++ /dev/null @@ -1,16 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$functions = new Functions($client); - -$result = $functions->list( - queries: [], // optional - search: '' // optional -); \ No newline at end of file diff --git a/docs/examples/functions/update-deployment-build.md b/docs/examples/functions/update-deployment-build.md deleted file mode 100644 index 653914e..0000000 --- a/docs/examples/functions/update-deployment-build.md +++ /dev/null @@ -1,16 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$functions = new Functions($client); - -$result = $functions->updateDeploymentBuild( - functionId: '', - deploymentId: '' -); \ No newline at end of file diff --git a/docs/examples/functions/update-deployment.md b/docs/examples/functions/update-deployment.md deleted file mode 100644 index 095b253..0000000 --- a/docs/examples/functions/update-deployment.md +++ /dev/null @@ -1,16 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$functions = new Functions($client); - -$result = $functions->updateDeployment( - functionId: '', - deploymentId: '' -); \ No newline at end of file diff --git a/docs/examples/functions/update-variable.md b/docs/examples/functions/update-variable.md deleted file mode 100644 index 77a28f1..0000000 --- a/docs/examples/functions/update-variable.md +++ /dev/null @@ -1,18 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$functions = new Functions($client); - -$result = $functions->updateVariable( - functionId: '', - variableId: '', - key: '', - value: '' // optional -); \ No newline at end of file diff --git a/docs/examples/functions/update.md b/docs/examples/functions/update.md deleted file mode 100644 index db0d50a..0000000 --- a/docs/examples/functions/update.md +++ /dev/null @@ -1,31 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$functions = new Functions($client); - -$result = $functions->update( - functionId: '', - name: '', - runtime: ::NODE145(), // optional - execute: ["any"], // optional - events: [], // optional - schedule: '', // optional - timeout: 1, // optional - enabled: false, // optional - logging: false, // optional - entrypoint: '', // optional - commands: '', // optional - scopes: [], // optional - installationId: '', // optional - providerRepositoryId: '', // optional - providerBranch: '', // optional - providerSilentMode: false, // optional - providerRootDirectory: '' // optional -); \ No newline at end of file diff --git a/docs/examples/graphql/mutation.md b/docs/examples/graphql/mutation.md deleted file mode 100644 index e074e0c..0000000 --- a/docs/examples/graphql/mutation.md +++ /dev/null @@ -1,15 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$graphql = new Graphql($client); - -$result = $graphql->mutation( - query: [] -); \ No newline at end of file diff --git a/docs/examples/graphql/query.md b/docs/examples/graphql/query.md deleted file mode 100644 index b871063..0000000 --- a/docs/examples/graphql/query.md +++ /dev/null @@ -1,15 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$graphql = new Graphql($client); - -$result = $graphql->query( - query: [] -); \ No newline at end of file diff --git a/docs/examples/health/get-antivirus.md b/docs/examples/health/get-antivirus.md deleted file mode 100644 index 64e83e0..0000000 --- a/docs/examples/health/get-antivirus.md +++ /dev/null @@ -1,13 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$health = new Health($client); - -$result = $health->getAntivirus(); diff --git a/docs/examples/health/get-cache.md b/docs/examples/health/get-cache.md deleted file mode 100644 index 6096207..0000000 --- a/docs/examples/health/get-cache.md +++ /dev/null @@ -1,13 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$health = new Health($client); - -$result = $health->getCache(); diff --git a/docs/examples/health/get-certificate.md b/docs/examples/health/get-certificate.md deleted file mode 100644 index d5d325e..0000000 --- a/docs/examples/health/get-certificate.md +++ /dev/null @@ -1,15 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$health = new Health($client); - -$result = $health->getCertificate( - domain: '' // optional -); \ No newline at end of file diff --git a/docs/examples/health/get-d-b.md b/docs/examples/health/get-d-b.md deleted file mode 100644 index 434fcad..0000000 --- a/docs/examples/health/get-d-b.md +++ /dev/null @@ -1,13 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$health = new Health($client); - -$result = $health->getDB(); diff --git a/docs/examples/health/get-failed-jobs.md b/docs/examples/health/get-failed-jobs.md deleted file mode 100644 index 1470587..0000000 --- a/docs/examples/health/get-failed-jobs.md +++ /dev/null @@ -1,17 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$health = new Health($client); - -$result = $health->getFailedJobs( - name: ::V1DATABASE(), - threshold: null // optional -); \ No newline at end of file diff --git a/docs/examples/health/get-pub-sub.md b/docs/examples/health/get-pub-sub.md deleted file mode 100644 index d2d3a5d..0000000 --- a/docs/examples/health/get-pub-sub.md +++ /dev/null @@ -1,13 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$health = new Health($client); - -$result = $health->getPubSub(); diff --git a/docs/examples/health/get-queue-builds.md b/docs/examples/health/get-queue-builds.md deleted file mode 100644 index 2911465..0000000 --- a/docs/examples/health/get-queue-builds.md +++ /dev/null @@ -1,15 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$health = new Health($client); - -$result = $health->getQueueBuilds( - threshold: null // optional -); \ No newline at end of file diff --git a/docs/examples/health/get-queue-certificates.md b/docs/examples/health/get-queue-certificates.md deleted file mode 100644 index 9323b41..0000000 --- a/docs/examples/health/get-queue-certificates.md +++ /dev/null @@ -1,15 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$health = new Health($client); - -$result = $health->getQueueCertificates( - threshold: null // optional -); \ No newline at end of file diff --git a/docs/examples/health/get-queue-databases.md b/docs/examples/health/get-queue-databases.md deleted file mode 100644 index 54a9814..0000000 --- a/docs/examples/health/get-queue-databases.md +++ /dev/null @@ -1,16 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$health = new Health($client); - -$result = $health->getQueueDatabases( - name: '', // optional - threshold: null // optional -); \ No newline at end of file diff --git a/docs/examples/health/get-queue-deletes.md b/docs/examples/health/get-queue-deletes.md deleted file mode 100644 index aee4deb..0000000 --- a/docs/examples/health/get-queue-deletes.md +++ /dev/null @@ -1,15 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$health = new Health($client); - -$result = $health->getQueueDeletes( - threshold: null // optional -); \ No newline at end of file diff --git a/docs/examples/health/get-queue-functions.md b/docs/examples/health/get-queue-functions.md deleted file mode 100644 index f675b75..0000000 --- a/docs/examples/health/get-queue-functions.md +++ /dev/null @@ -1,15 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$health = new Health($client); - -$result = $health->getQueueFunctions( - threshold: null // optional -); \ No newline at end of file diff --git a/docs/examples/health/get-queue-logs.md b/docs/examples/health/get-queue-logs.md deleted file mode 100644 index 05c463b..0000000 --- a/docs/examples/health/get-queue-logs.md +++ /dev/null @@ -1,15 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$health = new Health($client); - -$result = $health->getQueueLogs( - threshold: null // optional -); \ No newline at end of file diff --git a/docs/examples/health/get-queue-mails.md b/docs/examples/health/get-queue-mails.md deleted file mode 100644 index 74d4959..0000000 --- a/docs/examples/health/get-queue-mails.md +++ /dev/null @@ -1,15 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$health = new Health($client); - -$result = $health->getQueueMails( - threshold: null // optional -); \ No newline at end of file diff --git a/docs/examples/health/get-queue-messaging.md b/docs/examples/health/get-queue-messaging.md deleted file mode 100644 index 3fd96c6..0000000 --- a/docs/examples/health/get-queue-messaging.md +++ /dev/null @@ -1,15 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$health = new Health($client); - -$result = $health->getQueueMessaging( - threshold: null // optional -); \ No newline at end of file diff --git a/docs/examples/health/get-queue-migrations.md b/docs/examples/health/get-queue-migrations.md deleted file mode 100644 index 9f1a8be..0000000 --- a/docs/examples/health/get-queue-migrations.md +++ /dev/null @@ -1,15 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$health = new Health($client); - -$result = $health->getQueueMigrations( - threshold: null // optional -); \ No newline at end of file diff --git a/docs/examples/health/get-queue-usage-dump.md b/docs/examples/health/get-queue-usage-dump.md deleted file mode 100644 index b856b73..0000000 --- a/docs/examples/health/get-queue-usage-dump.md +++ /dev/null @@ -1,15 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$health = new Health($client); - -$result = $health->getQueueUsageDump( - threshold: null // optional -); \ No newline at end of file diff --git a/docs/examples/health/get-queue-usage.md b/docs/examples/health/get-queue-usage.md deleted file mode 100644 index 9b5baeb..0000000 --- a/docs/examples/health/get-queue-usage.md +++ /dev/null @@ -1,15 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$health = new Health($client); - -$result = $health->getQueueUsage( - threshold: null // optional -); \ No newline at end of file diff --git a/docs/examples/health/get-queue-webhooks.md b/docs/examples/health/get-queue-webhooks.md deleted file mode 100644 index e42b65b..0000000 --- a/docs/examples/health/get-queue-webhooks.md +++ /dev/null @@ -1,15 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$health = new Health($client); - -$result = $health->getQueueWebhooks( - threshold: null // optional -); \ No newline at end of file diff --git a/docs/examples/health/get-queue.md b/docs/examples/health/get-queue.md deleted file mode 100644 index 81b2218..0000000 --- a/docs/examples/health/get-queue.md +++ /dev/null @@ -1,13 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$health = new Health($client); - -$result = $health->getQueue(); diff --git a/docs/examples/health/get-storage-local.md b/docs/examples/health/get-storage-local.md deleted file mode 100644 index 75999ce..0000000 --- a/docs/examples/health/get-storage-local.md +++ /dev/null @@ -1,13 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$health = new Health($client); - -$result = $health->getStorageLocal(); diff --git a/docs/examples/health/get-storage.md b/docs/examples/health/get-storage.md deleted file mode 100644 index a3b56b9..0000000 --- a/docs/examples/health/get-storage.md +++ /dev/null @@ -1,13 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$health = new Health($client); - -$result = $health->getStorage(); diff --git a/docs/examples/health/get-time.md b/docs/examples/health/get-time.md deleted file mode 100644 index 5deb238..0000000 --- a/docs/examples/health/get-time.md +++ /dev/null @@ -1,13 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$health = new Health($client); - -$result = $health->getTime(); diff --git a/docs/examples/health/get.md b/docs/examples/health/get.md deleted file mode 100644 index 5001c48..0000000 --- a/docs/examples/health/get.md +++ /dev/null @@ -1,13 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$health = new Health($client); - -$result = $health->get(); diff --git a/docs/examples/locale/get.md b/docs/examples/locale/get.md deleted file mode 100644 index b9f48b4..0000000 --- a/docs/examples/locale/get.md +++ /dev/null @@ -1,13 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$locale = new Locale($client); - -$result = $locale->get(); diff --git a/docs/examples/locale/list-codes.md b/docs/examples/locale/list-codes.md deleted file mode 100644 index b35683c..0000000 --- a/docs/examples/locale/list-codes.md +++ /dev/null @@ -1,13 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$locale = new Locale($client); - -$result = $locale->listCodes(); diff --git a/docs/examples/locale/list-continents.md b/docs/examples/locale/list-continents.md deleted file mode 100644 index 1076f99..0000000 --- a/docs/examples/locale/list-continents.md +++ /dev/null @@ -1,13 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$locale = new Locale($client); - -$result = $locale->listContinents(); diff --git a/docs/examples/locale/list-countries-e-u.md b/docs/examples/locale/list-countries-e-u.md deleted file mode 100644 index 93a4cad..0000000 --- a/docs/examples/locale/list-countries-e-u.md +++ /dev/null @@ -1,13 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$locale = new Locale($client); - -$result = $locale->listCountriesEU(); diff --git a/docs/examples/locale/list-countries-phones.md b/docs/examples/locale/list-countries-phones.md deleted file mode 100644 index 1d99f67..0000000 --- a/docs/examples/locale/list-countries-phones.md +++ /dev/null @@ -1,13 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$locale = new Locale($client); - -$result = $locale->listCountriesPhones(); diff --git a/docs/examples/locale/list-countries.md b/docs/examples/locale/list-countries.md deleted file mode 100644 index 665dd09..0000000 --- a/docs/examples/locale/list-countries.md +++ /dev/null @@ -1,13 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$locale = new Locale($client); - -$result = $locale->listCountries(); diff --git a/docs/examples/locale/list-currencies.md b/docs/examples/locale/list-currencies.md deleted file mode 100644 index 5cd91de..0000000 --- a/docs/examples/locale/list-currencies.md +++ /dev/null @@ -1,13 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$locale = new Locale($client); - -$result = $locale->listCurrencies(); diff --git a/docs/examples/locale/list-languages.md b/docs/examples/locale/list-languages.md deleted file mode 100644 index c615a3d..0000000 --- a/docs/examples/locale/list-languages.md +++ /dev/null @@ -1,13 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$locale = new Locale($client); - -$result = $locale->listLanguages(); diff --git a/docs/examples/messaging/create-apns-provider.md b/docs/examples/messaging/create-apns-provider.md deleted file mode 100644 index ebe69e9..0000000 --- a/docs/examples/messaging/create-apns-provider.md +++ /dev/null @@ -1,22 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->createApnsProvider( - providerId: '', - name: '', - authKey: '', // optional - authKeyId: '', // optional - teamId: '', // optional - bundleId: '', // optional - sandbox: false, // optional - enabled: false // optional -); \ No newline at end of file diff --git a/docs/examples/messaging/create-email.md b/docs/examples/messaging/create-email.md deleted file mode 100644 index b24e4f2..0000000 --- a/docs/examples/messaging/create-email.md +++ /dev/null @@ -1,26 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->createEmail( - messageId: '', - subject: '', - content: '', - topics: [], // optional - users: [], // optional - targets: [], // optional - cc: [], // optional - bcc: [], // optional - attachments: [], // optional - draft: false, // optional - html: false, // optional - scheduledAt: '' // optional -); \ No newline at end of file diff --git a/docs/examples/messaging/create-fcm-provider.md b/docs/examples/messaging/create-fcm-provider.md deleted file mode 100644 index b0cfec4..0000000 --- a/docs/examples/messaging/create-fcm-provider.md +++ /dev/null @@ -1,18 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->createFcmProvider( - providerId: '', - name: '', - serviceAccountJSON: [], // optional - enabled: false // optional -); \ No newline at end of file diff --git a/docs/examples/messaging/create-mailgun-provider.md b/docs/examples/messaging/create-mailgun-provider.md deleted file mode 100644 index bd3bcf8..0000000 --- a/docs/examples/messaging/create-mailgun-provider.md +++ /dev/null @@ -1,24 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->createMailgunProvider( - providerId: '', - name: '', - apiKey: '', // optional - domain: '', // optional - isEuRegion: false, // optional - fromName: '', // optional - fromEmail: 'email@example.com', // optional - replyToName: '', // optional - replyToEmail: 'email@example.com', // optional - enabled: false // optional -); \ No newline at end of file diff --git a/docs/examples/messaging/create-msg91provider.md b/docs/examples/messaging/create-msg91provider.md deleted file mode 100644 index da37716..0000000 --- a/docs/examples/messaging/create-msg91provider.md +++ /dev/null @@ -1,20 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->createMsg91Provider( - providerId: '', - name: '', - templateId: '', // optional - senderId: '', // optional - authKey: '', // optional - enabled: false // optional -); \ No newline at end of file diff --git a/docs/examples/messaging/create-push.md b/docs/examples/messaging/create-push.md deleted file mode 100644 index 7273f03..0000000 --- a/docs/examples/messaging/create-push.md +++ /dev/null @@ -1,30 +0,0 @@ -setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->createPush( - messageId: '', - title: '', - body: '<BODY>', - topics: [], // optional - users: [], // optional - targets: [], // optional - data: [], // optional - action: '<ACTION>', // optional - image: '[ID1:ID2]', // optional - icon: '<ICON>', // optional - sound: '<SOUND>', // optional - color: '<COLOR>', // optional - tag: '<TAG>', // optional - badge: '<BADGE>', // optional - draft: false, // optional - scheduledAt: '' // optional -); \ No newline at end of file diff --git a/docs/examples/messaging/create-sendgrid-provider.md b/docs/examples/messaging/create-sendgrid-provider.md deleted file mode 100644 index 42764a9..0000000 --- a/docs/examples/messaging/create-sendgrid-provider.md +++ /dev/null @@ -1,22 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Messaging; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->createSendgridProvider( - providerId: '<PROVIDER_ID>', - name: '<NAME>', - apiKey: '<API_KEY>', // optional - fromName: '<FROM_NAME>', // optional - fromEmail: 'email@example.com', // optional - replyToName: '<REPLY_TO_NAME>', // optional - replyToEmail: 'email@example.com', // optional - enabled: false // optional -); \ No newline at end of file diff --git a/docs/examples/messaging/create-sms.md b/docs/examples/messaging/create-sms.md deleted file mode 100644 index 36fce84..0000000 --- a/docs/examples/messaging/create-sms.md +++ /dev/null @@ -1,21 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Messaging; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->createSms( - messageId: '<MESSAGE_ID>', - content: '<CONTENT>', - topics: [], // optional - users: [], // optional - targets: [], // optional - draft: false, // optional - scheduledAt: '' // optional -); \ No newline at end of file diff --git a/docs/examples/messaging/create-smtp-provider.md b/docs/examples/messaging/create-smtp-provider.md deleted file mode 100644 index ff8cfe0..0000000 --- a/docs/examples/messaging/create-smtp-provider.md +++ /dev/null @@ -1,28 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Messaging; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->createSmtpProvider( - providerId: '<PROVIDER_ID>', - name: '<NAME>', - host: '<HOST>', - port: 1, // optional - username: '<USERNAME>', // optional - password: '<PASSWORD>', // optional - encryption: SmtpEncryption::NONE(), // optional - autoTLS: false, // optional - mailer: '<MAILER>', // optional - fromName: '<FROM_NAME>', // optional - fromEmail: 'email@example.com', // optional - replyToName: '<REPLY_TO_NAME>', // optional - replyToEmail: 'email@example.com', // optional - enabled: false // optional -); \ No newline at end of file diff --git a/docs/examples/messaging/create-subscriber.md b/docs/examples/messaging/create-subscriber.md deleted file mode 100644 index bfba263..0000000 --- a/docs/examples/messaging/create-subscriber.md +++ /dev/null @@ -1,17 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Messaging; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setJWT('<YOUR_JWT>'); // Your secret JSON Web Token - -$messaging = new Messaging($client); - -$result = $messaging->createSubscriber( - topicId: '<TOPIC_ID>', - subscriberId: '<SUBSCRIBER_ID>', - targetId: '<TARGET_ID>' -); \ No newline at end of file diff --git a/docs/examples/messaging/create-telesign-provider.md b/docs/examples/messaging/create-telesign-provider.md deleted file mode 100644 index ec3ede7..0000000 --- a/docs/examples/messaging/create-telesign-provider.md +++ /dev/null @@ -1,20 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Messaging; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->createTelesignProvider( - providerId: '<PROVIDER_ID>', - name: '<NAME>', - from: '+12065550100', // optional - customerId: '<CUSTOMER_ID>', // optional - apiKey: '<API_KEY>', // optional - enabled: false // optional -); \ No newline at end of file diff --git a/docs/examples/messaging/create-textmagic-provider.md b/docs/examples/messaging/create-textmagic-provider.md deleted file mode 100644 index 5dc00f8..0000000 --- a/docs/examples/messaging/create-textmagic-provider.md +++ /dev/null @@ -1,20 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Messaging; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->createTextmagicProvider( - providerId: '<PROVIDER_ID>', - name: '<NAME>', - from: '+12065550100', // optional - username: '<USERNAME>', // optional - apiKey: '<API_KEY>', // optional - enabled: false // optional -); \ No newline at end of file diff --git a/docs/examples/messaging/create-topic.md b/docs/examples/messaging/create-topic.md deleted file mode 100644 index dd0daf1..0000000 --- a/docs/examples/messaging/create-topic.md +++ /dev/null @@ -1,17 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Messaging; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->createTopic( - topicId: '<TOPIC_ID>', - name: '<NAME>', - subscribe: ["any"] // optional -); \ No newline at end of file diff --git a/docs/examples/messaging/create-twilio-provider.md b/docs/examples/messaging/create-twilio-provider.md deleted file mode 100644 index 70a1d38..0000000 --- a/docs/examples/messaging/create-twilio-provider.md +++ /dev/null @@ -1,20 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Messaging; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->createTwilioProvider( - providerId: '<PROVIDER_ID>', - name: '<NAME>', - from: '+12065550100', // optional - accountSid: '<ACCOUNT_SID>', // optional - authToken: '<AUTH_TOKEN>', // optional - enabled: false // optional -); \ No newline at end of file diff --git a/docs/examples/messaging/create-vonage-provider.md b/docs/examples/messaging/create-vonage-provider.md deleted file mode 100644 index d6a4e11..0000000 --- a/docs/examples/messaging/create-vonage-provider.md +++ /dev/null @@ -1,20 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Messaging; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->createVonageProvider( - providerId: '<PROVIDER_ID>', - name: '<NAME>', - from: '+12065550100', // optional - apiKey: '<API_KEY>', // optional - apiSecret: '<API_SECRET>', // optional - enabled: false // optional -); \ No newline at end of file diff --git a/docs/examples/messaging/delete-provider.md b/docs/examples/messaging/delete-provider.md deleted file mode 100644 index 4f267fe..0000000 --- a/docs/examples/messaging/delete-provider.md +++ /dev/null @@ -1,15 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Messaging; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->deleteProvider( - providerId: '<PROVIDER_ID>' -); \ No newline at end of file diff --git a/docs/examples/messaging/delete-subscriber.md b/docs/examples/messaging/delete-subscriber.md deleted file mode 100644 index 2f91487..0000000 --- a/docs/examples/messaging/delete-subscriber.md +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Messaging; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setJWT('<YOUR_JWT>'); // Your secret JSON Web Token - -$messaging = new Messaging($client); - -$result = $messaging->deleteSubscriber( - topicId: '<TOPIC_ID>', - subscriberId: '<SUBSCRIBER_ID>' -); \ No newline at end of file diff --git a/docs/examples/messaging/delete-topic.md b/docs/examples/messaging/delete-topic.md deleted file mode 100644 index 79dca2c..0000000 --- a/docs/examples/messaging/delete-topic.md +++ /dev/null @@ -1,15 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Messaging; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->deleteTopic( - topicId: '<TOPIC_ID>' -); \ No newline at end of file diff --git a/docs/examples/messaging/delete.md b/docs/examples/messaging/delete.md deleted file mode 100644 index b0676ec..0000000 --- a/docs/examples/messaging/delete.md +++ /dev/null @@ -1,15 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Messaging; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->delete( - messageId: '<MESSAGE_ID>' -); \ No newline at end of file diff --git a/docs/examples/messaging/get-message.md b/docs/examples/messaging/get-message.md deleted file mode 100644 index 9ec7a0e..0000000 --- a/docs/examples/messaging/get-message.md +++ /dev/null @@ -1,15 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Messaging; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->getMessage( - messageId: '<MESSAGE_ID>' -); \ No newline at end of file diff --git a/docs/examples/messaging/get-provider.md b/docs/examples/messaging/get-provider.md deleted file mode 100644 index 378fc6d..0000000 --- a/docs/examples/messaging/get-provider.md +++ /dev/null @@ -1,15 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Messaging; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->getProvider( - providerId: '<PROVIDER_ID>' -); \ No newline at end of file diff --git a/docs/examples/messaging/get-subscriber.md b/docs/examples/messaging/get-subscriber.md deleted file mode 100644 index a10974a..0000000 --- a/docs/examples/messaging/get-subscriber.md +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Messaging; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->getSubscriber( - topicId: '<TOPIC_ID>', - subscriberId: '<SUBSCRIBER_ID>' -); \ No newline at end of file diff --git a/docs/examples/messaging/get-topic.md b/docs/examples/messaging/get-topic.md deleted file mode 100644 index cb42254..0000000 --- a/docs/examples/messaging/get-topic.md +++ /dev/null @@ -1,15 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Messaging; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->getTopic( - topicId: '<TOPIC_ID>' -); \ No newline at end of file diff --git a/docs/examples/messaging/list-message-logs.md b/docs/examples/messaging/list-message-logs.md deleted file mode 100644 index d66d546..0000000 --- a/docs/examples/messaging/list-message-logs.md +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Messaging; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->listMessageLogs( - messageId: '<MESSAGE_ID>', - queries: [] // optional -); \ No newline at end of file diff --git a/docs/examples/messaging/list-messages.md b/docs/examples/messaging/list-messages.md deleted file mode 100644 index c0f54a6..0000000 --- a/docs/examples/messaging/list-messages.md +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Messaging; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->listMessages( - queries: [], // optional - search: '<SEARCH>' // optional -); \ No newline at end of file diff --git a/docs/examples/messaging/list-provider-logs.md b/docs/examples/messaging/list-provider-logs.md deleted file mode 100644 index 865daf9..0000000 --- a/docs/examples/messaging/list-provider-logs.md +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Messaging; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->listProviderLogs( - providerId: '<PROVIDER_ID>', - queries: [] // optional -); \ No newline at end of file diff --git a/docs/examples/messaging/list-providers.md b/docs/examples/messaging/list-providers.md deleted file mode 100644 index fd30837..0000000 --- a/docs/examples/messaging/list-providers.md +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Messaging; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->listProviders( - queries: [], // optional - search: '<SEARCH>' // optional -); \ No newline at end of file diff --git a/docs/examples/messaging/list-subscriber-logs.md b/docs/examples/messaging/list-subscriber-logs.md deleted file mode 100644 index b69c057..0000000 --- a/docs/examples/messaging/list-subscriber-logs.md +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Messaging; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->listSubscriberLogs( - subscriberId: '<SUBSCRIBER_ID>', - queries: [] // optional -); \ No newline at end of file diff --git a/docs/examples/messaging/list-subscribers.md b/docs/examples/messaging/list-subscribers.md deleted file mode 100644 index 2fd2747..0000000 --- a/docs/examples/messaging/list-subscribers.md +++ /dev/null @@ -1,17 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Messaging; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->listSubscribers( - topicId: '<TOPIC_ID>', - queries: [], // optional - search: '<SEARCH>' // optional -); \ No newline at end of file diff --git a/docs/examples/messaging/list-targets.md b/docs/examples/messaging/list-targets.md deleted file mode 100644 index 3abb9ef..0000000 --- a/docs/examples/messaging/list-targets.md +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Messaging; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->listTargets( - messageId: '<MESSAGE_ID>', - queries: [] // optional -); \ No newline at end of file diff --git a/docs/examples/messaging/list-topic-logs.md b/docs/examples/messaging/list-topic-logs.md deleted file mode 100644 index 0d23c82..0000000 --- a/docs/examples/messaging/list-topic-logs.md +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Messaging; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->listTopicLogs( - topicId: '<TOPIC_ID>', - queries: [] // optional -); \ No newline at end of file diff --git a/docs/examples/messaging/list-topics.md b/docs/examples/messaging/list-topics.md deleted file mode 100644 index 008767e..0000000 --- a/docs/examples/messaging/list-topics.md +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Messaging; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->listTopics( - queries: [], // optional - search: '<SEARCH>' // optional -); \ No newline at end of file diff --git a/docs/examples/messaging/update-apns-provider.md b/docs/examples/messaging/update-apns-provider.md deleted file mode 100644 index a368ce5..0000000 --- a/docs/examples/messaging/update-apns-provider.md +++ /dev/null @@ -1,22 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Messaging; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->updateApnsProvider( - providerId: '<PROVIDER_ID>', - name: '<NAME>', // optional - enabled: false, // optional - authKey: '<AUTH_KEY>', // optional - authKeyId: '<AUTH_KEY_ID>', // optional - teamId: '<TEAM_ID>', // optional - bundleId: '<BUNDLE_ID>', // optional - sandbox: false // optional -); \ No newline at end of file diff --git a/docs/examples/messaging/update-email.md b/docs/examples/messaging/update-email.md deleted file mode 100644 index 537ca82..0000000 --- a/docs/examples/messaging/update-email.md +++ /dev/null @@ -1,26 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Messaging; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->updateEmail( - messageId: '<MESSAGE_ID>', - topics: [], // optional - users: [], // optional - targets: [], // optional - subject: '<SUBJECT>', // optional - content: '<CONTENT>', // optional - draft: false, // optional - html: false, // optional - cc: [], // optional - bcc: [], // optional - scheduledAt: '', // optional - attachments: [] // optional -); \ No newline at end of file diff --git a/docs/examples/messaging/update-fcm-provider.md b/docs/examples/messaging/update-fcm-provider.md deleted file mode 100644 index d8b2a0e..0000000 --- a/docs/examples/messaging/update-fcm-provider.md +++ /dev/null @@ -1,18 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Messaging; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->updateFcmProvider( - providerId: '<PROVIDER_ID>', - name: '<NAME>', // optional - enabled: false, // optional - serviceAccountJSON: [] // optional -); \ No newline at end of file diff --git a/docs/examples/messaging/update-mailgun-provider.md b/docs/examples/messaging/update-mailgun-provider.md deleted file mode 100644 index d838adb..0000000 --- a/docs/examples/messaging/update-mailgun-provider.md +++ /dev/null @@ -1,24 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Messaging; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->updateMailgunProvider( - providerId: '<PROVIDER_ID>', - name: '<NAME>', // optional - apiKey: '<API_KEY>', // optional - domain: '<DOMAIN>', // optional - isEuRegion: false, // optional - enabled: false, // optional - fromName: '<FROM_NAME>', // optional - fromEmail: 'email@example.com', // optional - replyToName: '<REPLY_TO_NAME>', // optional - replyToEmail: '<REPLY_TO_EMAIL>' // optional -); \ No newline at end of file diff --git a/docs/examples/messaging/update-msg91provider.md b/docs/examples/messaging/update-msg91provider.md deleted file mode 100644 index eb68102..0000000 --- a/docs/examples/messaging/update-msg91provider.md +++ /dev/null @@ -1,20 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Messaging; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->updateMsg91Provider( - providerId: '<PROVIDER_ID>', - name: '<NAME>', // optional - enabled: false, // optional - templateId: '<TEMPLATE_ID>', // optional - senderId: '<SENDER_ID>', // optional - authKey: '<AUTH_KEY>' // optional -); \ No newline at end of file diff --git a/docs/examples/messaging/update-push.md b/docs/examples/messaging/update-push.md deleted file mode 100644 index b332ec1..0000000 --- a/docs/examples/messaging/update-push.md +++ /dev/null @@ -1,30 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Messaging; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->updatePush( - messageId: '<MESSAGE_ID>', - topics: [], // optional - users: [], // optional - targets: [], // optional - title: '<TITLE>', // optional - body: '<BODY>', // optional - data: [], // optional - action: '<ACTION>', // optional - image: '[ID1:ID2]', // optional - icon: '<ICON>', // optional - sound: '<SOUND>', // optional - color: '<COLOR>', // optional - tag: '<TAG>', // optional - badge: null, // optional - draft: false, // optional - scheduledAt: '' // optional -); \ No newline at end of file diff --git a/docs/examples/messaging/update-sendgrid-provider.md b/docs/examples/messaging/update-sendgrid-provider.md deleted file mode 100644 index 7909fef..0000000 --- a/docs/examples/messaging/update-sendgrid-provider.md +++ /dev/null @@ -1,22 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Messaging; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->updateSendgridProvider( - providerId: '<PROVIDER_ID>', - name: '<NAME>', // optional - enabled: false, // optional - apiKey: '<API_KEY>', // optional - fromName: '<FROM_NAME>', // optional - fromEmail: 'email@example.com', // optional - replyToName: '<REPLY_TO_NAME>', // optional - replyToEmail: '<REPLY_TO_EMAIL>' // optional -); \ No newline at end of file diff --git a/docs/examples/messaging/update-sms.md b/docs/examples/messaging/update-sms.md deleted file mode 100644 index a4b4c23..0000000 --- a/docs/examples/messaging/update-sms.md +++ /dev/null @@ -1,21 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Messaging; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->updateSms( - messageId: '<MESSAGE_ID>', - topics: [], // optional - users: [], // optional - targets: [], // optional - content: '<CONTENT>', // optional - draft: false, // optional - scheduledAt: '' // optional -); \ No newline at end of file diff --git a/docs/examples/messaging/update-smtp-provider.md b/docs/examples/messaging/update-smtp-provider.md deleted file mode 100644 index 997914f..0000000 --- a/docs/examples/messaging/update-smtp-provider.md +++ /dev/null @@ -1,28 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Messaging; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->updateSmtpProvider( - providerId: '<PROVIDER_ID>', - name: '<NAME>', // optional - host: '<HOST>', // optional - port: 1, // optional - username: '<USERNAME>', // optional - password: '<PASSWORD>', // optional - encryption: SmtpEncryption::NONE(), // optional - autoTLS: false, // optional - mailer: '<MAILER>', // optional - fromName: '<FROM_NAME>', // optional - fromEmail: 'email@example.com', // optional - replyToName: '<REPLY_TO_NAME>', // optional - replyToEmail: '<REPLY_TO_EMAIL>', // optional - enabled: false // optional -); \ No newline at end of file diff --git a/docs/examples/messaging/update-telesign-provider.md b/docs/examples/messaging/update-telesign-provider.md deleted file mode 100644 index 981df0c..0000000 --- a/docs/examples/messaging/update-telesign-provider.md +++ /dev/null @@ -1,20 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Messaging; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->updateTelesignProvider( - providerId: '<PROVIDER_ID>', - name: '<NAME>', // optional - enabled: false, // optional - customerId: '<CUSTOMER_ID>', // optional - apiKey: '<API_KEY>', // optional - from: '<FROM>' // optional -); \ No newline at end of file diff --git a/docs/examples/messaging/update-textmagic-provider.md b/docs/examples/messaging/update-textmagic-provider.md deleted file mode 100644 index b7f9bab..0000000 --- a/docs/examples/messaging/update-textmagic-provider.md +++ /dev/null @@ -1,20 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Messaging; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->updateTextmagicProvider( - providerId: '<PROVIDER_ID>', - name: '<NAME>', // optional - enabled: false, // optional - username: '<USERNAME>', // optional - apiKey: '<API_KEY>', // optional - from: '<FROM>' // optional -); \ No newline at end of file diff --git a/docs/examples/messaging/update-topic.md b/docs/examples/messaging/update-topic.md deleted file mode 100644 index e705c1b..0000000 --- a/docs/examples/messaging/update-topic.md +++ /dev/null @@ -1,17 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Messaging; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->updateTopic( - topicId: '<TOPIC_ID>', - name: '<NAME>', // optional - subscribe: ["any"] // optional -); \ No newline at end of file diff --git a/docs/examples/messaging/update-twilio-provider.md b/docs/examples/messaging/update-twilio-provider.md deleted file mode 100644 index 05c2072..0000000 --- a/docs/examples/messaging/update-twilio-provider.md +++ /dev/null @@ -1,20 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Messaging; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->updateTwilioProvider( - providerId: '<PROVIDER_ID>', - name: '<NAME>', // optional - enabled: false, // optional - accountSid: '<ACCOUNT_SID>', // optional - authToken: '<AUTH_TOKEN>', // optional - from: '<FROM>' // optional -); \ No newline at end of file diff --git a/docs/examples/messaging/update-vonage-provider.md b/docs/examples/messaging/update-vonage-provider.md deleted file mode 100644 index 3c421af..0000000 --- a/docs/examples/messaging/update-vonage-provider.md +++ /dev/null @@ -1,20 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Messaging; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->updateVonageProvider( - providerId: '<PROVIDER_ID>', - name: '<NAME>', // optional - enabled: false, // optional - apiKey: '<API_KEY>', // optional - apiSecret: '<API_SECRET>', // optional - from: '<FROM>' // optional -); \ No newline at end of file diff --git a/docs/examples/storage/create-bucket.md b/docs/examples/storage/create-bucket.md deleted file mode 100644 index ca369fb..0000000 --- a/docs/examples/storage/create-bucket.md +++ /dev/null @@ -1,24 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Storage; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$storage = new Storage($client); - -$result = $storage->createBucket( - bucketId: '<BUCKET_ID>', - name: '<NAME>', - permissions: ["read("any")"], // optional - fileSecurity: false, // optional - enabled: false, // optional - maximumFileSize: 1, // optional - allowedFileExtensions: [], // optional - compression: ::NONE(), // optional - encryption: false, // optional - antivirus: false // optional -); \ No newline at end of file diff --git a/docs/examples/storage/create-file.md b/docs/examples/storage/create-file.md deleted file mode 100644 index 20a25e7..0000000 --- a/docs/examples/storage/create-file.md +++ /dev/null @@ -1,19 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\InputFile; -use Appwrite\Services\Storage; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$storage = new Storage($client); - -$result = $storage->createFile( - bucketId: '<BUCKET_ID>', - fileId: '<FILE_ID>', - file: InputFile::withPath('file.png'), - permissions: ["read("any")"] // optional -); \ No newline at end of file diff --git a/docs/examples/storage/delete-bucket.md b/docs/examples/storage/delete-bucket.md deleted file mode 100644 index a9207f4..0000000 --- a/docs/examples/storage/delete-bucket.md +++ /dev/null @@ -1,15 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Storage; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$storage = new Storage($client); - -$result = $storage->deleteBucket( - bucketId: '<BUCKET_ID>' -); \ No newline at end of file diff --git a/docs/examples/storage/delete-file.md b/docs/examples/storage/delete-file.md deleted file mode 100644 index 47f9938..0000000 --- a/docs/examples/storage/delete-file.md +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Storage; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$storage = new Storage($client); - -$result = $storage->deleteFile( - bucketId: '<BUCKET_ID>', - fileId: '<FILE_ID>' -); \ No newline at end of file diff --git a/docs/examples/storage/get-bucket.md b/docs/examples/storage/get-bucket.md deleted file mode 100644 index 5faf6a6..0000000 --- a/docs/examples/storage/get-bucket.md +++ /dev/null @@ -1,15 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Storage; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$storage = new Storage($client); - -$result = $storage->getBucket( - bucketId: '<BUCKET_ID>' -); \ No newline at end of file diff --git a/docs/examples/storage/get-file-download.md b/docs/examples/storage/get-file-download.md deleted file mode 100644 index 48ee5ad..0000000 --- a/docs/examples/storage/get-file-download.md +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Storage; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$storage = new Storage($client); - -$result = $storage->getFileDownload( - bucketId: '<BUCKET_ID>', - fileId: '<FILE_ID>' -); \ No newline at end of file diff --git a/docs/examples/storage/get-file-preview.md b/docs/examples/storage/get-file-preview.md deleted file mode 100644 index 4f37f38..0000000 --- a/docs/examples/storage/get-file-preview.md +++ /dev/null @@ -1,27 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Storage; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$storage = new Storage($client); - -$result = $storage->getFilePreview( - bucketId: '<BUCKET_ID>', - fileId: '<FILE_ID>', - width: 0, // optional - height: 0, // optional - gravity: ImageGravity::CENTER(), // optional - quality: 0, // optional - borderWidth: 0, // optional - borderColor: '', // optional - borderRadius: 0, // optional - opacity: 0, // optional - rotation: -360, // optional - background: '', // optional - output: ImageFormat::JPG() // optional -); \ No newline at end of file diff --git a/docs/examples/storage/get-file-view.md b/docs/examples/storage/get-file-view.md deleted file mode 100644 index 5637fa8..0000000 --- a/docs/examples/storage/get-file-view.md +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Storage; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$storage = new Storage($client); - -$result = $storage->getFileView( - bucketId: '<BUCKET_ID>', - fileId: '<FILE_ID>' -); \ No newline at end of file diff --git a/docs/examples/storage/get-file.md b/docs/examples/storage/get-file.md deleted file mode 100644 index 41fdc91..0000000 --- a/docs/examples/storage/get-file.md +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Storage; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$storage = new Storage($client); - -$result = $storage->getFile( - bucketId: '<BUCKET_ID>', - fileId: '<FILE_ID>' -); \ No newline at end of file diff --git a/docs/examples/storage/list-buckets.md b/docs/examples/storage/list-buckets.md deleted file mode 100644 index 7a988c2..0000000 --- a/docs/examples/storage/list-buckets.md +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Storage; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$storage = new Storage($client); - -$result = $storage->listBuckets( - queries: [], // optional - search: '<SEARCH>' // optional -); \ No newline at end of file diff --git a/docs/examples/storage/list-files.md b/docs/examples/storage/list-files.md deleted file mode 100644 index 038b2cd..0000000 --- a/docs/examples/storage/list-files.md +++ /dev/null @@ -1,17 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Storage; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$storage = new Storage($client); - -$result = $storage->listFiles( - bucketId: '<BUCKET_ID>', - queries: [], // optional - search: '<SEARCH>' // optional -); \ No newline at end of file diff --git a/docs/examples/storage/update-bucket.md b/docs/examples/storage/update-bucket.md deleted file mode 100644 index 96bf127..0000000 --- a/docs/examples/storage/update-bucket.md +++ /dev/null @@ -1,24 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Storage; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$storage = new Storage($client); - -$result = $storage->updateBucket( - bucketId: '<BUCKET_ID>', - name: '<NAME>', - permissions: ["read("any")"], // optional - fileSecurity: false, // optional - enabled: false, // optional - maximumFileSize: 1, // optional - allowedFileExtensions: [], // optional - compression: ::NONE(), // optional - encryption: false, // optional - antivirus: false // optional -); \ No newline at end of file diff --git a/docs/examples/storage/update-file.md b/docs/examples/storage/update-file.md deleted file mode 100644 index 0ddc6d5..0000000 --- a/docs/examples/storage/update-file.md +++ /dev/null @@ -1,18 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Storage; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$storage = new Storage($client); - -$result = $storage->updateFile( - bucketId: '<BUCKET_ID>', - fileId: '<FILE_ID>', - name: '<NAME>', // optional - permissions: ["read("any")"] // optional -); \ No newline at end of file diff --git a/docs/examples/teams/create-membership.md b/docs/examples/teams/create-membership.md deleted file mode 100644 index 061b906..0000000 --- a/docs/examples/teams/create-membership.md +++ /dev/null @@ -1,21 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Teams; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$teams = new Teams($client); - -$result = $teams->createMembership( - teamId: '<TEAM_ID>', - roles: [], - email: 'email@example.com', // optional - userId: '<USER_ID>', // optional - phone: '+12065550100', // optional - url: 'https://example.com', // optional - name: '<NAME>' // optional -); \ No newline at end of file diff --git a/docs/examples/teams/create.md b/docs/examples/teams/create.md deleted file mode 100644 index 5475bdf..0000000 --- a/docs/examples/teams/create.md +++ /dev/null @@ -1,17 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Teams; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$teams = new Teams($client); - -$result = $teams->create( - teamId: '<TEAM_ID>', - name: '<NAME>', - roles: [] // optional -); \ No newline at end of file diff --git a/docs/examples/teams/delete-membership.md b/docs/examples/teams/delete-membership.md deleted file mode 100644 index 15ced89..0000000 --- a/docs/examples/teams/delete-membership.md +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Teams; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$teams = new Teams($client); - -$result = $teams->deleteMembership( - teamId: '<TEAM_ID>', - membershipId: '<MEMBERSHIP_ID>' -); \ No newline at end of file diff --git a/docs/examples/teams/delete.md b/docs/examples/teams/delete.md deleted file mode 100644 index 98224f7..0000000 --- a/docs/examples/teams/delete.md +++ /dev/null @@ -1,15 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Teams; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$teams = new Teams($client); - -$result = $teams->delete( - teamId: '<TEAM_ID>' -); \ No newline at end of file diff --git a/docs/examples/teams/get-membership.md b/docs/examples/teams/get-membership.md deleted file mode 100644 index f27ee3a..0000000 --- a/docs/examples/teams/get-membership.md +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Teams; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$teams = new Teams($client); - -$result = $teams->getMembership( - teamId: '<TEAM_ID>', - membershipId: '<MEMBERSHIP_ID>' -); \ No newline at end of file diff --git a/docs/examples/teams/get-prefs.md b/docs/examples/teams/get-prefs.md deleted file mode 100644 index 932777a..0000000 --- a/docs/examples/teams/get-prefs.md +++ /dev/null @@ -1,15 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Teams; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$teams = new Teams($client); - -$result = $teams->getPrefs( - teamId: '<TEAM_ID>' -); \ No newline at end of file diff --git a/docs/examples/teams/get.md b/docs/examples/teams/get.md deleted file mode 100644 index 21320ee..0000000 --- a/docs/examples/teams/get.md +++ /dev/null @@ -1,15 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Teams; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$teams = new Teams($client); - -$result = $teams->get( - teamId: '<TEAM_ID>' -); \ No newline at end of file diff --git a/docs/examples/teams/list-memberships.md b/docs/examples/teams/list-memberships.md deleted file mode 100644 index 440553c..0000000 --- a/docs/examples/teams/list-memberships.md +++ /dev/null @@ -1,17 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Teams; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$teams = new Teams($client); - -$result = $teams->listMemberships( - teamId: '<TEAM_ID>', - queries: [], // optional - search: '<SEARCH>' // optional -); \ No newline at end of file diff --git a/docs/examples/teams/list.md b/docs/examples/teams/list.md deleted file mode 100644 index 761b6c2..0000000 --- a/docs/examples/teams/list.md +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Teams; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$teams = new Teams($client); - -$result = $teams->list( - queries: [], // optional - search: '<SEARCH>' // optional -); \ No newline at end of file diff --git a/docs/examples/teams/update-membership-status.md b/docs/examples/teams/update-membership-status.md deleted file mode 100644 index 3c79245..0000000 --- a/docs/examples/teams/update-membership-status.md +++ /dev/null @@ -1,18 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Teams; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$teams = new Teams($client); - -$result = $teams->updateMembershipStatus( - teamId: '<TEAM_ID>', - membershipId: '<MEMBERSHIP_ID>', - userId: '<USER_ID>', - secret: '<SECRET>' -); \ No newline at end of file diff --git a/docs/examples/teams/update-membership.md b/docs/examples/teams/update-membership.md deleted file mode 100644 index 438f354..0000000 --- a/docs/examples/teams/update-membership.md +++ /dev/null @@ -1,17 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Teams; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$teams = new Teams($client); - -$result = $teams->updateMembership( - teamId: '<TEAM_ID>', - membershipId: '<MEMBERSHIP_ID>', - roles: [] -); \ No newline at end of file diff --git a/docs/examples/teams/update-name.md b/docs/examples/teams/update-name.md deleted file mode 100644 index cd1f38f..0000000 --- a/docs/examples/teams/update-name.md +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Teams; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$teams = new Teams($client); - -$result = $teams->updateName( - teamId: '<TEAM_ID>', - name: '<NAME>' -); \ No newline at end of file diff --git a/docs/examples/teams/update-prefs.md b/docs/examples/teams/update-prefs.md deleted file mode 100644 index 0dadd2c..0000000 --- a/docs/examples/teams/update-prefs.md +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Teams; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with - -$teams = new Teams($client); - -$result = $teams->updatePrefs( - teamId: '<TEAM_ID>', - prefs: [] -); \ No newline at end of file diff --git a/docs/examples/users/create-argon2user.md b/docs/examples/users/create-argon2user.md deleted file mode 100644 index 7bee3bc..0000000 --- a/docs/examples/users/create-argon2user.md +++ /dev/null @@ -1,18 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Users; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$users = new Users($client); - -$result = $users->createArgon2User( - userId: '<USER_ID>', - email: 'email@example.com', - password: 'password', - name: '<NAME>' // optional -); \ No newline at end of file diff --git a/docs/examples/users/create-bcrypt-user.md b/docs/examples/users/create-bcrypt-user.md deleted file mode 100644 index 631e4cc..0000000 --- a/docs/examples/users/create-bcrypt-user.md +++ /dev/null @@ -1,18 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Users; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$users = new Users($client); - -$result = $users->createBcryptUser( - userId: '<USER_ID>', - email: 'email@example.com', - password: 'password', - name: '<NAME>' // optional -); \ No newline at end of file diff --git a/docs/examples/users/create-j-w-t.md b/docs/examples/users/create-j-w-t.md deleted file mode 100644 index 2f0bc37..0000000 --- a/docs/examples/users/create-j-w-t.md +++ /dev/null @@ -1,17 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Users; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$users = new Users($client); - -$result = $users->createJWT( - userId: '<USER_ID>', - sessionId: '<SESSION_ID>', // optional - duration: 0 // optional -); \ No newline at end of file diff --git a/docs/examples/users/create-m-d5user.md b/docs/examples/users/create-m-d5user.md deleted file mode 100644 index 0605f6f..0000000 --- a/docs/examples/users/create-m-d5user.md +++ /dev/null @@ -1,18 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Users; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$users = new Users($client); - -$result = $users->createMD5User( - userId: '<USER_ID>', - email: 'email@example.com', - password: 'password', - name: '<NAME>' // optional -); \ No newline at end of file diff --git a/docs/examples/users/create-mfa-recovery-codes.md b/docs/examples/users/create-mfa-recovery-codes.md deleted file mode 100644 index f499b22..0000000 --- a/docs/examples/users/create-mfa-recovery-codes.md +++ /dev/null @@ -1,15 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Users; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$users = new Users($client); - -$result = $users->createMfaRecoveryCodes( - userId: '<USER_ID>' -); \ No newline at end of file diff --git a/docs/examples/users/create-p-h-pass-user.md b/docs/examples/users/create-p-h-pass-user.md deleted file mode 100644 index f6dc863..0000000 --- a/docs/examples/users/create-p-h-pass-user.md +++ /dev/null @@ -1,18 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Users; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$users = new Users($client); - -$result = $users->createPHPassUser( - userId: '<USER_ID>', - email: 'email@example.com', - password: 'password', - name: '<NAME>' // optional -); \ No newline at end of file diff --git a/docs/examples/users/create-s-h-a-user.md b/docs/examples/users/create-s-h-a-user.md deleted file mode 100644 index 777096d..0000000 --- a/docs/examples/users/create-s-h-a-user.md +++ /dev/null @@ -1,19 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Users; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$users = new Users($client); - -$result = $users->createSHAUser( - userId: '<USER_ID>', - email: 'email@example.com', - password: 'password', - passwordVersion: PasswordHash::SHA1(), // optional - name: '<NAME>' // optional -); \ No newline at end of file diff --git a/docs/examples/users/create-scrypt-modified-user.md b/docs/examples/users/create-scrypt-modified-user.md deleted file mode 100644 index 4f8423f..0000000 --- a/docs/examples/users/create-scrypt-modified-user.md +++ /dev/null @@ -1,21 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Users; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$users = new Users($client); - -$result = $users->createScryptModifiedUser( - userId: '<USER_ID>', - email: 'email@example.com', - password: 'password', - passwordSalt: '<PASSWORD_SALT>', - passwordSaltSeparator: '<PASSWORD_SALT_SEPARATOR>', - passwordSignerKey: '<PASSWORD_SIGNER_KEY>', - name: '<NAME>' // optional -); \ No newline at end of file diff --git a/docs/examples/users/create-scrypt-user.md b/docs/examples/users/create-scrypt-user.md deleted file mode 100644 index 2ccc5d7..0000000 --- a/docs/examples/users/create-scrypt-user.md +++ /dev/null @@ -1,23 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Users; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$users = new Users($client); - -$result = $users->createScryptUser( - userId: '<USER_ID>', - email: 'email@example.com', - password: 'password', - passwordSalt: '<PASSWORD_SALT>', - passwordCpu: null, - passwordMemory: null, - passwordParallel: null, - passwordLength: null, - name: '<NAME>' // optional -); \ No newline at end of file diff --git a/docs/examples/users/create-session.md b/docs/examples/users/create-session.md deleted file mode 100644 index 97d8c8a..0000000 --- a/docs/examples/users/create-session.md +++ /dev/null @@ -1,15 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Users; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$users = new Users($client); - -$result = $users->createSession( - userId: '<USER_ID>' -); \ No newline at end of file diff --git a/docs/examples/users/create-target.md b/docs/examples/users/create-target.md deleted file mode 100644 index 03104bc..0000000 --- a/docs/examples/users/create-target.md +++ /dev/null @@ -1,21 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Users; -use Appwrite\Enums\MessagingProviderType; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$users = new Users($client); - -$result = $users->createTarget( - userId: '<USER_ID>', - targetId: '<TARGET_ID>', - providerType: MessagingProviderType::EMAIL(), - identifier: '<IDENTIFIER>', - providerId: '<PROVIDER_ID>', // optional - name: '<NAME>' // optional -); \ No newline at end of file diff --git a/docs/examples/users/create-token.md b/docs/examples/users/create-token.md deleted file mode 100644 index b08faac..0000000 --- a/docs/examples/users/create-token.md +++ /dev/null @@ -1,17 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Users; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$users = new Users($client); - -$result = $users->createToken( - userId: '<USER_ID>', - length: 4, // optional - expire: 60 // optional -); \ No newline at end of file diff --git a/docs/examples/users/create.md b/docs/examples/users/create.md deleted file mode 100644 index a50e10e..0000000 --- a/docs/examples/users/create.md +++ /dev/null @@ -1,19 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Users; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$users = new Users($client); - -$result = $users->create( - userId: '<USER_ID>', - email: 'email@example.com', // optional - phone: '+12065550100', // optional - password: '', // optional - name: '<NAME>' // optional -); \ No newline at end of file diff --git a/docs/examples/users/delete-identity.md b/docs/examples/users/delete-identity.md deleted file mode 100644 index 138b89f..0000000 --- a/docs/examples/users/delete-identity.md +++ /dev/null @@ -1,15 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Users; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$users = new Users($client); - -$result = $users->deleteIdentity( - identityId: '<IDENTITY_ID>' -); \ No newline at end of file diff --git a/docs/examples/users/delete-mfa-authenticator.md b/docs/examples/users/delete-mfa-authenticator.md deleted file mode 100644 index d25c2b7..0000000 --- a/docs/examples/users/delete-mfa-authenticator.md +++ /dev/null @@ -1,17 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Users; -use Appwrite\Enums\AuthenticatorType; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$users = new Users($client); - -$result = $users->deleteMfaAuthenticator( - userId: '<USER_ID>', - type: AuthenticatorType::TOTP() -); \ No newline at end of file diff --git a/docs/examples/users/delete-session.md b/docs/examples/users/delete-session.md deleted file mode 100644 index bf673b2..0000000 --- a/docs/examples/users/delete-session.md +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Users; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$users = new Users($client); - -$result = $users->deleteSession( - userId: '<USER_ID>', - sessionId: '<SESSION_ID>' -); \ No newline at end of file diff --git a/docs/examples/users/delete-sessions.md b/docs/examples/users/delete-sessions.md deleted file mode 100644 index f2a3f21..0000000 --- a/docs/examples/users/delete-sessions.md +++ /dev/null @@ -1,15 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Users; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$users = new Users($client); - -$result = $users->deleteSessions( - userId: '<USER_ID>' -); \ No newline at end of file diff --git a/docs/examples/users/delete-target.md b/docs/examples/users/delete-target.md deleted file mode 100644 index 20e676a..0000000 --- a/docs/examples/users/delete-target.md +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Users; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$users = new Users($client); - -$result = $users->deleteTarget( - userId: '<USER_ID>', - targetId: '<TARGET_ID>' -); \ No newline at end of file diff --git a/docs/examples/users/delete.md b/docs/examples/users/delete.md deleted file mode 100644 index 225708c..0000000 --- a/docs/examples/users/delete.md +++ /dev/null @@ -1,15 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Users; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$users = new Users($client); - -$result = $users->delete( - userId: '<USER_ID>' -); \ No newline at end of file diff --git a/docs/examples/users/get-mfa-recovery-codes.md b/docs/examples/users/get-mfa-recovery-codes.md deleted file mode 100644 index 055ef04..0000000 --- a/docs/examples/users/get-mfa-recovery-codes.md +++ /dev/null @@ -1,15 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Users; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$users = new Users($client); - -$result = $users->getMfaRecoveryCodes( - userId: '<USER_ID>' -); \ No newline at end of file diff --git a/docs/examples/users/get-prefs.md b/docs/examples/users/get-prefs.md deleted file mode 100644 index 392dc14..0000000 --- a/docs/examples/users/get-prefs.md +++ /dev/null @@ -1,15 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Users; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$users = new Users($client); - -$result = $users->getPrefs( - userId: '<USER_ID>' -); \ No newline at end of file diff --git a/docs/examples/users/get-target.md b/docs/examples/users/get-target.md deleted file mode 100644 index 7ca05d3..0000000 --- a/docs/examples/users/get-target.md +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Users; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$users = new Users($client); - -$result = $users->getTarget( - userId: '<USER_ID>', - targetId: '<TARGET_ID>' -); \ No newline at end of file diff --git a/docs/examples/users/get.md b/docs/examples/users/get.md deleted file mode 100644 index 1cc351a..0000000 --- a/docs/examples/users/get.md +++ /dev/null @@ -1,15 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Users; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$users = new Users($client); - -$result = $users->get( - userId: '<USER_ID>' -); \ No newline at end of file diff --git a/docs/examples/users/list-identities.md b/docs/examples/users/list-identities.md deleted file mode 100644 index 040e309..0000000 --- a/docs/examples/users/list-identities.md +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Users; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$users = new Users($client); - -$result = $users->listIdentities( - queries: [], // optional - search: '<SEARCH>' // optional -); \ No newline at end of file diff --git a/docs/examples/users/list-logs.md b/docs/examples/users/list-logs.md deleted file mode 100644 index e717bdf..0000000 --- a/docs/examples/users/list-logs.md +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Users; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$users = new Users($client); - -$result = $users->listLogs( - userId: '<USER_ID>', - queries: [] // optional -); \ No newline at end of file diff --git a/docs/examples/users/list-memberships.md b/docs/examples/users/list-memberships.md deleted file mode 100644 index da760e0..0000000 --- a/docs/examples/users/list-memberships.md +++ /dev/null @@ -1,15 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Users; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$users = new Users($client); - -$result = $users->listMemberships( - userId: '<USER_ID>' -); \ No newline at end of file diff --git a/docs/examples/users/list-mfa-factors.md b/docs/examples/users/list-mfa-factors.md deleted file mode 100644 index 16964c5..0000000 --- a/docs/examples/users/list-mfa-factors.md +++ /dev/null @@ -1,15 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Users; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$users = new Users($client); - -$result = $users->listMfaFactors( - userId: '<USER_ID>' -); \ No newline at end of file diff --git a/docs/examples/users/list-sessions.md b/docs/examples/users/list-sessions.md deleted file mode 100644 index 0bfa242..0000000 --- a/docs/examples/users/list-sessions.md +++ /dev/null @@ -1,15 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Users; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$users = new Users($client); - -$result = $users->listSessions( - userId: '<USER_ID>' -); \ No newline at end of file diff --git a/docs/examples/users/list-targets.md b/docs/examples/users/list-targets.md deleted file mode 100644 index c4815be..0000000 --- a/docs/examples/users/list-targets.md +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Users; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$users = new Users($client); - -$result = $users->listTargets( - userId: '<USER_ID>', - queries: [] // optional -); \ No newline at end of file diff --git a/docs/examples/users/list.md b/docs/examples/users/list.md deleted file mode 100644 index 678e97f..0000000 --- a/docs/examples/users/list.md +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Users; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$users = new Users($client); - -$result = $users->list( - queries: [], // optional - search: '<SEARCH>' // optional -); \ No newline at end of file diff --git a/docs/examples/users/update-email-verification.md b/docs/examples/users/update-email-verification.md deleted file mode 100644 index d2d6584..0000000 --- a/docs/examples/users/update-email-verification.md +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Users; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$users = new Users($client); - -$result = $users->updateEmailVerification( - userId: '<USER_ID>', - emailVerification: false -); \ No newline at end of file diff --git a/docs/examples/users/update-email.md b/docs/examples/users/update-email.md deleted file mode 100644 index a73100c..0000000 --- a/docs/examples/users/update-email.md +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Users; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$users = new Users($client); - -$result = $users->updateEmail( - userId: '<USER_ID>', - email: 'email@example.com' -); \ No newline at end of file diff --git a/docs/examples/users/update-labels.md b/docs/examples/users/update-labels.md deleted file mode 100644 index 9651830..0000000 --- a/docs/examples/users/update-labels.md +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Users; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$users = new Users($client); - -$result = $users->updateLabels( - userId: '<USER_ID>', - labels: [] -); \ No newline at end of file diff --git a/docs/examples/users/update-mfa-recovery-codes.md b/docs/examples/users/update-mfa-recovery-codes.md deleted file mode 100644 index d09ccd7..0000000 --- a/docs/examples/users/update-mfa-recovery-codes.md +++ /dev/null @@ -1,15 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Users; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$users = new Users($client); - -$result = $users->updateMfaRecoveryCodes( - userId: '<USER_ID>' -); \ No newline at end of file diff --git a/docs/examples/users/update-mfa.md b/docs/examples/users/update-mfa.md deleted file mode 100644 index 5ab48c5..0000000 --- a/docs/examples/users/update-mfa.md +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Users; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$users = new Users($client); - -$result = $users->updateMfa( - userId: '<USER_ID>', - mfa: false -); \ No newline at end of file diff --git a/docs/examples/users/update-name.md b/docs/examples/users/update-name.md deleted file mode 100644 index 96e8afc..0000000 --- a/docs/examples/users/update-name.md +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Users; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$users = new Users($client); - -$result = $users->updateName( - userId: '<USER_ID>', - name: '<NAME>' -); \ No newline at end of file diff --git a/docs/examples/users/update-password.md b/docs/examples/users/update-password.md deleted file mode 100644 index ffcb817..0000000 --- a/docs/examples/users/update-password.md +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Users; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$users = new Users($client); - -$result = $users->updatePassword( - userId: '<USER_ID>', - password: '' -); \ No newline at end of file diff --git a/docs/examples/users/update-phone-verification.md b/docs/examples/users/update-phone-verification.md deleted file mode 100644 index 8054531..0000000 --- a/docs/examples/users/update-phone-verification.md +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Users; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$users = new Users($client); - -$result = $users->updatePhoneVerification( - userId: '<USER_ID>', - phoneVerification: false -); \ No newline at end of file diff --git a/docs/examples/users/update-phone.md b/docs/examples/users/update-phone.md deleted file mode 100644 index 5828633..0000000 --- a/docs/examples/users/update-phone.md +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Users; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$users = new Users($client); - -$result = $users->updatePhone( - userId: '<USER_ID>', - number: '+12065550100' -); \ No newline at end of file diff --git a/docs/examples/users/update-prefs.md b/docs/examples/users/update-prefs.md deleted file mode 100644 index 6d0ecad..0000000 --- a/docs/examples/users/update-prefs.md +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Users; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$users = new Users($client); - -$result = $users->updatePrefs( - userId: '<USER_ID>', - prefs: [] -); \ No newline at end of file diff --git a/docs/examples/users/update-status.md b/docs/examples/users/update-status.md deleted file mode 100644 index 7ffbfc2..0000000 --- a/docs/examples/users/update-status.md +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Users; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$users = new Users($client); - -$result = $users->updateStatus( - userId: '<USER_ID>', - status: false -); \ No newline at end of file diff --git a/docs/examples/users/update-target.md b/docs/examples/users/update-target.md deleted file mode 100644 index 5c476db..0000000 --- a/docs/examples/users/update-target.md +++ /dev/null @@ -1,19 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Users; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key - -$users = new Users($client); - -$result = $users->updateTarget( - userId: '<USER_ID>', - targetId: '<TARGET_ID>', - identifier: '<IDENTIFIER>', // optional - providerId: '<PROVIDER_ID>', // optional - name: '<NAME>' // optional -); \ No newline at end of file diff --git a/docs/functions.md b/docs/functions.md deleted file mode 100644 index a7615bf..0000000 --- a/docs/functions.md +++ /dev/null @@ -1,386 +0,0 @@ -# Functions Service - -## List functions - -```http request -GET https://cloud.appwrite.io/v1/functions -``` - -** Get a list of all the project's functions. 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, enabled, runtime, deployment, schedule, scheduleNext, schedulePrevious, timeout, entrypoint, commands, installationId | [] | -| search | string | Search term to filter your list results. Max length: 256 chars. | | - -## Create function - -```http request -POST https://cloud.appwrite.io/v1/functions -``` - -** Create a new function. You can pass a list of [permissions](https://appwrite.io/docs/permissions) to allow different project users or team with access to execute the function using the client API. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| functionId | string | Function 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 | Function name. Max length: 128 chars. | | -| runtime | string | Execution runtime. | | -| execute | array | An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. | [] | -| events | array | Events list. Maximum of 100 events are allowed. | [] | -| schedule | string | Schedule CRON syntax. | | -| timeout | integer | Function maximum execution time in seconds. | 15 | -| enabled | boolean | Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled. | 1 | -| logging | boolean | Whether executions will be logged. When set to false, executions will not be logged, but will reduce resource used by your Appwrite project. | 1 | -| entrypoint | string | Entrypoint File. This path is relative to the "providerRootDirectory". | | -| commands | string | Build Commands. | | -| scopes | array | List of scopes allowed for API key auto-generated for every execution. Maximum of 100 scopes are allowed. | [] | -| installationId | string | Appwrite Installation ID for VCS (Version Control System) deployment. | | -| providerRepositoryId | string | Repository ID of the repo linked to the function. | | -| providerBranch | string | Production branch for the repo linked to the function. | | -| providerSilentMode | boolean | Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests. | | -| providerRootDirectory | string | Path to function code in the linked repo. | | -| templateRepository | string | Repository name of the template. | | -| templateOwner | string | The name of the owner of the template. | | -| templateRootDirectory | string | Path to function code in the template repo. | | -| templateBranch | string | Production branch for the repo linked to the function template. | | - -## List runtimes - -```http request -GET https://cloud.appwrite.io/v1/functions/runtimes -``` - -** Get a list of all runtimes that are currently active on your instance. ** - -## Get function - -```http request -GET https://cloud.appwrite.io/v1/functions/{functionId} -``` - -** Get a function by its unique ID. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| functionId | string | **Required** Function ID. | | - -## Update function - -```http request -PUT https://cloud.appwrite.io/v1/functions/{functionId} -``` - -** Update function by its unique ID. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| functionId | string | **Required** Function ID. | | -| name | string | Function name. Max length: 128 chars. | | -| runtime | string | Execution runtime. | | -| execute | array | An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. | [] | -| events | array | Events list. Maximum of 100 events are allowed. | [] | -| schedule | string | Schedule CRON syntax. | | -| timeout | integer | Maximum execution time in seconds. | 15 | -| enabled | boolean | Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled. | 1 | -| logging | boolean | Whether executions will be logged. When set to false, executions will not be logged, but will reduce resource used by your Appwrite project. | 1 | -| entrypoint | string | Entrypoint File. This path is relative to the "providerRootDirectory". | | -| commands | string | Build Commands. | | -| scopes | array | List of scopes allowed for API Key auto-generated for every execution. Maximum of 100 scopes are allowed. | [] | -| installationId | string | Appwrite Installation ID for VCS (Version Controle System) deployment. | | -| providerRepositoryId | string | Repository ID of the repo linked to the function | | -| providerBranch | string | Production branch for the repo linked to the function | | -| providerSilentMode | boolean | Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests. | | -| providerRootDirectory | string | Path to function code in the linked repo. | | - -## Delete function - -```http request -DELETE https://cloud.appwrite.io/v1/functions/{functionId} -``` - -** Delete a function by its unique ID. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| functionId | string | **Required** Function ID. | | - -## List deployments - -```http request -GET https://cloud.appwrite.io/v1/functions/{functionId}/deployments -``` - -** Get a list of all the project's code deployments. You can use the query params to filter your results. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| functionId | string | **Required** Function 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: size, buildId, activate, entrypoint, commands | [] | -| search | string | Search term to filter your list results. Max length: 256 chars. | | - -## Create deployment - -```http request -POST https://cloud.appwrite.io/v1/functions/{functionId}/deployments -``` - -** Create a new function code deployment. Use this endpoint to upload a new version of your code function. To execute your newly uploaded code, you'll need to update the function's deployment to use your new deployment UID. - -This endpoint accepts a tar.gz file compressed with your code. Make sure to include any dependencies your code has within the compressed file. You can learn more about code packaging in the [Appwrite Cloud Functions tutorial](https://appwrite.io/docs/functions). - -Use the "command" param to set the entrypoint used to execute your code. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| functionId | string | **Required** Function ID. | | -| entrypoint | string | Entrypoint File. | | -| commands | string | Build Commands. | | -| code | file | Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory. | | -| activate | boolean | Automatically activate the deployment when it is finished building. | | - -## Get deployment - -```http request -GET https://cloud.appwrite.io/v1/functions/{functionId}/deployments/{deploymentId} -``` - -** Get a code deployment by its unique ID. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| functionId | string | **Required** Function ID. | | -| deploymentId | string | **Required** Deployment ID. | | - -## Update function deployment - -```http request -PATCH https://cloud.appwrite.io/v1/functions/{functionId}/deployments/{deploymentId} -``` - -** Update the function code deployment ID using the unique function ID. Use this endpoint to switch the code deployment that should be executed by the execution endpoint. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| functionId | string | **Required** Function ID. | | -| deploymentId | string | **Required** Deployment ID. | | - -## Delete deployment - -```http request -DELETE https://cloud.appwrite.io/v1/functions/{functionId}/deployments/{deploymentId} -``` - -** Delete a code deployment by its unique ID. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| functionId | string | **Required** Function ID. | | -| deploymentId | string | **Required** Deployment ID. | | - -## Rebuild deployment - -```http request -POST https://cloud.appwrite.io/v1/functions/{functionId}/deployments/{deploymentId}/build -``` - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| functionId | string | **Required** Function ID. | | -| deploymentId | string | **Required** Deployment ID. | | -| buildId | string | Build unique ID. | | - -## Cancel deployment - -```http request -PATCH https://cloud.appwrite.io/v1/functions/{functionId}/deployments/{deploymentId}/build -``` - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| functionId | string | **Required** Function ID. | | -| deploymentId | string | **Required** Deployment ID. | | - -## Download Deployment - -```http request -GET https://cloud.appwrite.io/v1/functions/{functionId}/deployments/{deploymentId}/download -``` - -** Get a Deployment's contents by its unique ID. This endpoint supports range requests for partial or streaming file download. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| functionId | string | **Required** Function ID. | | -| deploymentId | string | **Required** Deployment ID. | | - -## List executions - -```http request -GET https://cloud.appwrite.io/v1/functions/{functionId}/executions -``` - -** Get a list of all the current user function execution logs. You can use the query params to filter your results. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| functionId | string | **Required** Function 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: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId | [] | -| search | string | Search term to filter your list results. Max length: 256 chars. | | - -## Create execution - -```http request -POST https://cloud.appwrite.io/v1/functions/{functionId}/executions -``` - -** Trigger a function execution. The returned object will return you the current execution status. You can ping the `Get Execution` endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| functionId | string | **Required** Function ID. | | -| body | string | HTTP body of execution. Default value is empty string. | | -| async | boolean | Execute code in the background. Default value is false. | | -| path | string | HTTP path of execution. Path can include query params. Default value is / | / | -| method | string | HTTP method of execution. Default value is GET. | POST | -| headers | object | HTTP headers of execution. Defaults to empty. | {} | -| scheduledAt | string | Scheduled execution time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. | | - -## Get execution - -```http request -GET https://cloud.appwrite.io/v1/functions/{functionId}/executions/{executionId} -``` - -** Get a function execution log by its unique ID. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| functionId | string | **Required** Function ID. | | -| executionId | string | **Required** Execution ID. | | - -## Delete execution - -```http request -DELETE https://cloud.appwrite.io/v1/functions/{functionId}/executions/{executionId} -``` - -** Delete a function execution by its unique ID. - ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| functionId | string | **Required** Function ID. | | -| executionId | string | **Required** Execution ID. | | - -## List variables - -```http request -GET https://cloud.appwrite.io/v1/functions/{functionId}/variables -``` - -** Get a list of all variables of a specific function. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| functionId | string | **Required** Function unique ID. | | - -## Create variable - -```http request -POST https://cloud.appwrite.io/v1/functions/{functionId}/variables -``` - -** Create a new function environment variable. These variables can be accessed in the function at runtime as environment variables. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| functionId | string | **Required** Function unique ID. | | -| key | string | Variable key. Max length: 255 chars. | | -| value | string | Variable value. Max length: 8192 chars. | | - -## Get variable - -```http request -GET https://cloud.appwrite.io/v1/functions/{functionId}/variables/{variableId} -``` - -** Get a variable by its unique ID. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| functionId | string | **Required** Function unique ID. | | -| variableId | string | **Required** Variable unique ID. | | - -## Update variable - -```http request -PUT https://cloud.appwrite.io/v1/functions/{functionId}/variables/{variableId} -``` - -** Update variable by its unique ID. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| functionId | string | **Required** Function unique ID. | | -| variableId | string | **Required** Variable unique ID. | | -| key | string | Variable key. Max length: 255 chars. | | -| value | string | Variable value. Max length: 8192 chars. | | - -## Delete variable - -```http request -DELETE https://cloud.appwrite.io/v1/functions/{functionId}/variables/{variableId} -``` - -** Delete a variable by its unique ID. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| functionId | string | **Required** Function unique ID. | | -| variableId | string | **Required** Variable unique ID. | | - diff --git a/docs/graphql.md b/docs/graphql.md deleted file mode 100644 index e012b47..0000000 --- a/docs/graphql.md +++ /dev/null @@ -1,30 +0,0 @@ -# Graphql Service - -## GraphQL endpoint - -```http request -POST https://cloud.appwrite.io/v1/graphql -``` - -** Execute a GraphQL mutation. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| query | object | The query or queries to execute. | {} | - -## GraphQL endpoint - -```http request -POST https://cloud.appwrite.io/v1/graphql/mutation -``` - -** Execute a GraphQL mutation. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| query | object | The query or queries to execute. | {} | - diff --git a/docs/health.md b/docs/health.md deleted file mode 100644 index 083119e..0000000 --- a/docs/health.md +++ /dev/null @@ -1,273 +0,0 @@ -# Health Service - -## Get HTTP - -```http request -GET https://cloud.appwrite.io/v1/health -``` - -** Check the Appwrite HTTP server is up and responsive. ** - -## Get antivirus - -```http request -GET https://cloud.appwrite.io/v1/health/anti-virus -``` - -** Check the Appwrite Antivirus server is up and connection is successful. ** - -## Get cache - -```http request -GET https://cloud.appwrite.io/v1/health/cache -``` - -** Check the Appwrite in-memory cache servers are up and connection is successful. ** - -## Get the SSL certificate for a domain - -```http request -GET https://cloud.appwrite.io/v1/health/certificate -``` - -** Get the SSL certificate for a domain ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| domain | string | string | | - -## Get DB - -```http request -GET https://cloud.appwrite.io/v1/health/db -``` - -** Check the Appwrite database servers are up and connection is successful. ** - -## Get pubsub - -```http request -GET https://cloud.appwrite.io/v1/health/pubsub -``` - -** Check the Appwrite pub-sub servers are up and connection is successful. ** - -## Get queue - -```http request -GET https://cloud.appwrite.io/v1/health/queue -``` - -** Check the Appwrite queue messaging servers are up and connection is successful. ** - -## Get builds queue - -```http request -GET https://cloud.appwrite.io/v1/health/queue/builds -``` - -** Get the number of builds that are waiting to be processed in the Appwrite internal queue server. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 5000 | - -## Get certificates queue - -```http request -GET https://cloud.appwrite.io/v1/health/queue/certificates -``` - -** Get the number of certificates that are waiting to be issued against [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue server. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 5000 | - -## Get databases queue - -```http request -GET https://cloud.appwrite.io/v1/health/queue/databases -``` - -** Get the number of database changes that are waiting to be processed in the Appwrite internal queue server. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| name | string | Queue name for which to check the queue size | database_db_main | -| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 5000 | - -## Get deletes queue - -```http request -GET https://cloud.appwrite.io/v1/health/queue/deletes -``` - -** Get the number of background destructive changes that are waiting to be processed in the Appwrite internal queue server. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 5000 | - -## Get number of failed queue jobs - -```http request -GET https://cloud.appwrite.io/v1/health/queue/failed/{name} -``` - -** Returns the amount of failed jobs in a given queue. - ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| name | string | **Required** The name of the queue | | -| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 5000 | - -## Get functions queue - -```http request -GET https://cloud.appwrite.io/v1/health/queue/functions -``` - -** Get the number of function executions that are waiting to be processed in the Appwrite internal queue server. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 5000 | - -## Get logs queue - -```http request -GET https://cloud.appwrite.io/v1/health/queue/logs -``` - -** Get the number of logs that are waiting to be processed in the Appwrite internal queue server. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 5000 | - -## Get mails queue - -```http request -GET https://cloud.appwrite.io/v1/health/queue/mails -``` - -** Get the number of mails that are waiting to be processed in the Appwrite internal queue server. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 5000 | - -## Get messaging queue - -```http request -GET https://cloud.appwrite.io/v1/health/queue/messaging -``` - -** Get the number of messages that are waiting to be processed in the Appwrite internal queue server. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 5000 | - -## Get migrations queue - -```http request -GET https://cloud.appwrite.io/v1/health/queue/migrations -``` - -** Get the number of migrations that are waiting to be processed in the Appwrite internal queue server. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 5000 | - -## Get usage queue - -```http request -GET https://cloud.appwrite.io/v1/health/queue/usage -``` - -** Get the number of metrics that are waiting to be processed in the Appwrite internal queue server. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 5000 | - -## Get usage dump queue - -```http request -GET https://cloud.appwrite.io/v1/health/queue/usage-dump -``` - -** Get the number of projects containing metrics that are waiting to be processed in the Appwrite internal queue server. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 5000 | - -## Get webhooks queue - -```http request -GET https://cloud.appwrite.io/v1/health/queue/webhooks -``` - -** Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 5000 | - -## Get storage - -```http request -GET https://cloud.appwrite.io/v1/health/storage -``` - -** Check the Appwrite storage device is up and connection is successful. ** - -## Get local storage - -```http request -GET https://cloud.appwrite.io/v1/health/storage/local -``` - -** Check the Appwrite local storage device is up and connection is successful. ** - -## Get time - -```http request -GET https://cloud.appwrite.io/v1/health/time -``` - -** Check the Appwrite server time is synced with Google remote NTP server. We use this technology to smoothly handle leap seconds with no disruptive events. The [Network Time Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is used by hundreds of millions of computers and devices to synchronize their clocks over the Internet. If your computer sets its own clock, it likely uses NTP. ** - diff --git a/docs/locale.md b/docs/locale.md deleted file mode 100644 index 6678bf2..0000000 --- a/docs/locale.md +++ /dev/null @@ -1,68 +0,0 @@ -# Locale Service - -## Get user locale - -```http request -GET https://cloud.appwrite.io/v1/locale -``` - -** Get the current user location based on IP. Returns an object with user country code, country name, continent name, continent code, ip address and suggested currency. You can use the locale header to get the data in a supported language. - -([IP Geolocation by DB-IP](https://db-ip.com)) ** - -## List Locale Codes - -```http request -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). ** - -## List continents - -```http request -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. ** - -## List countries - -```http request -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. ** - -## List EU countries - -```http request -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. ** - -## List countries phone codes - -```http request -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. ** - -## List currencies - -```http request -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. ** - -## List languages - -```http request -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. ** - diff --git a/docs/messaging.md b/docs/messaging.md deleted file mode 100644 index f4fc48f..0000000 --- a/docs/messaging.md +++ /dev/null @@ -1,864 +0,0 @@ -# Messaging Service - -## List messages - -```http request -GET https://cloud.appwrite.io/v1/messaging/messages -``` - -** Get a list of all messages from the current Appwrite project. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| queries | array | Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: scheduledAt, deliveredAt, deliveredTotal, status, description, providerType | [] | -| search | string | Search term to filter your list results. Max length: 256 chars. | | - -## Create email - -```http request -POST https://cloud.appwrite.io/v1/messaging/messages/email -``` - -** Create a new email message. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| messageId | string | Message 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. | | -| subject | string | Email Subject. | | -| content | string | Email Content. | | -| topics | array | List of Topic IDs. | [] | -| users | array | List of User IDs. | [] | -| targets | array | List of Targets IDs. | [] | -| cc | array | Array of target IDs to be added as CC. | [] | -| bcc | array | Array of target IDs to be added as BCC. | [] | -| attachments | array | Array of compound ID strings of bucket IDs and file IDs to be attached to the email. They should be formatted as <BUCKET_ID>:<FILE_ID>. | [] | -| 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. | | - -## Update email - -```http request -PATCH https://cloud.appwrite.io/v1/messaging/messages/email/{messageId} -``` - -** Update an email message by its unique ID. - ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| messageId | string | **Required** Message ID. | | -| topics | array | List of Topic IDs. | | -| users | array | List of User IDs. | | -| targets | array | List of Targets IDs. | | -| subject | string | Email Subject. | | -| content | string | Email Content. | | -| draft | boolean | Is message a draft | | -| html | boolean | Is content of type HTML | | -| cc | array | Array of target IDs to be added as CC. | | -| 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 <BUCKET_ID>:<FILE_ID>. | | - -## Create push notification - -```http request -POST https://cloud.appwrite.io/v1/messaging/messages/push -``` - -** Create a new push notification. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| messageId | string | Message 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. | | -| title | string | Title for push notification. | | -| body | string | Body for push notification. | | -| topics | array | List of Topic IDs. | [] | -| users | array | List of User IDs. | [] | -| targets | array | List of Targets IDs. | [] | -| data | object | Additional Data for push notification. | {} | -| action | string | Action for push notification. | | -| image | string | Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage. It should be formatted as <BUCKET_ID>:<FILE_ID>. | | -| icon | string | Icon for push notification. Available only for Android and Web Platform. | | -| sound | string | Sound for push notification. Available only for Android and IOS Platform. | | -| color | string | Color for push notification. Available only for Android Platform. | | -| tag | string | Tag for push notification. Available only for Android Platform. | | -| badge | string | Badge for push notification. Available only for IOS Platform. | | -| draft | boolean | Is message a draft | | -| 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. | | - -## Update push notification - -```http request -PATCH https://cloud.appwrite.io/v1/messaging/messages/push/{messageId} -``` - -** Update a push notification by its unique ID. - ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| messageId | string | **Required** Message ID. | | -| topics | array | List of Topic IDs. | | -| users | array | List of User IDs. | | -| targets | array | List of Targets IDs. | | -| title | string | Title for push notification. | | -| body | string | Body for push notification. | | -| data | object | Additional Data for push notification. | {} | -| action | string | Action for push notification. | | -| image | string | Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage. It should be formatted as <BUCKET_ID>:<FILE_ID>. | | -| icon | string | Icon for push notification. Available only for Android and Web platforms. | | -| sound | string | Sound for push notification. Available only for Android and iOS platforms. | | -| color | string | Color for push notification. Available only for Android platforms. | | -| tag | string | Tag for push notification. Available only for Android platforms. | | -| badge | integer | Badge for push notification. Available only for iOS platforms. | | -| draft | boolean | Is message a draft | | -| 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. | | - -## Create SMS - -```http request -POST https://cloud.appwrite.io/v1/messaging/messages/sms -``` - -** Create a new SMS message. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| messageId | string | Message 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. | | -| content | string | SMS Content. | | -| topics | array | List of Topic IDs. | [] | -| users | array | List of User IDs. | [] | -| targets | array | List of Targets IDs. | [] | -| draft | boolean | Is message a draft | | -| 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. | | - -## Update SMS - -```http request -PATCH https://cloud.appwrite.io/v1/messaging/messages/sms/{messageId} -``` - -** Update an email message by its unique ID. - ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| messageId | string | **Required** Message ID. | | -| topics | array | List of Topic IDs. | | -| users | array | List of User IDs. | | -| targets | array | List of Targets IDs. | | -| content | string | Email Content. | | -| draft | boolean | Is message a draft | | -| 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. | | - -## Get message - -```http request -GET https://cloud.appwrite.io/v1/messaging/messages/{messageId} -``` - -** Get a message by its unique ID. - ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| messageId | string | **Required** Message ID. | | - -## Delete message - -```http request -DELETE https://cloud.appwrite.io/v1/messaging/messages/{messageId} -``` - -** Delete a message. If the message is not a draft or scheduled, but has been sent, this will not recall the message. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| messageId | string | **Required** Message ID. | | - -## List message logs - -```http request -GET https://cloud.appwrite.io/v1/messaging/messages/{messageId}/logs -``` - -** Get the message activity logs listed by its unique ID. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| messageId | string | **Required** Message 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). Only supported methods are limit and offset | [] | - -## List message targets - -```http request -GET https://cloud.appwrite.io/v1/messaging/messages/{messageId}/targets -``` - -** Get a list of the targets associated with a message. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| messageId | string | **Required** Message 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: userId, providerId, identifier, providerType | [] | - -## List providers - -```http request -GET https://cloud.appwrite.io/v1/messaging/providers -``` - -** Get a list of all providers from the current Appwrite project. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| queries | array | Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, provider, type, enabled | [] | -| search | string | Search term to filter your list results. Max length: 256 chars. | | - -## Create APNS provider - -```http request -POST https://cloud.appwrite.io/v1/messaging/providers/apns -``` - -** Create a new Apple Push Notification service 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. | | -| authKey | string | APNS authentication key. | | -| authKeyId | string | APNS authentication key ID. | | -| teamId | string | APNS team ID. | | -| bundleId | string | APNS bundle ID. | | -| sandbox | boolean | Use APNS sandbox environment. | | -| enabled | boolean | Set as enabled. | | - -## Update APNS provider - -```http request -PATCH https://cloud.appwrite.io/v1/messaging/providers/apns/{providerId} -``` - -** Update a Apple Push Notification service 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. | | -| authKey | string | APNS authentication key. | | -| authKeyId | string | APNS authentication key ID. | | -| teamId | string | APNS team ID. | | -| bundleId | string | APNS bundle ID. | | -| sandbox | boolean | Use APNS sandbox environment. | | - -## Create FCM provider - -```http request -POST https://cloud.appwrite.io/v1/messaging/providers/fcm -``` - -** Create a new Firebase Cloud Messaging 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. | | -| serviceAccountJSON | object | FCM service account JSON. | {} | -| enabled | boolean | Set as enabled. | | - -## Update FCM provider - -```http request -PATCH https://cloud.appwrite.io/v1/messaging/providers/fcm/{providerId} -``` - -** Update a Firebase Cloud Messaging 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. | | -| serviceAccountJSON | object | FCM service account JSON. | {} | - -## Create Mailgun provider - -```http request -POST https://cloud.appwrite.io/v1/messaging/providers/mailgun -``` - -** Create a new Mailgun 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. | | -| apiKey | string | Mailgun API Key. | | -| domain | string | Mailgun Domain. | | -| isEuRegion | boolean | Set as EU region. | | -| fromName | string | Sender Name. | | -| fromEmail | string | Sender email address. | | -| replyToName | string | Name set in the reply to field for the mail. Default value is sender name. Reply to name must have reply to email as well. | | -| replyToEmail | string | Email set in the reply to field for the mail. Default value is sender email. Reply to email must have reply to name as well. | | -| enabled | boolean | Set as enabled. | | - -## Update Mailgun provider - -```http request -PATCH https://cloud.appwrite.io/v1/messaging/providers/mailgun/{providerId} -``` - -** Update a Mailgun provider by its unique ID. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| providerId | string | **Required** Provider ID. | | -| name | string | Provider name. | | -| apiKey | string | Mailgun API Key. | | -| domain | string | Mailgun Domain. | | -| isEuRegion | boolean | Set as EU region. | | -| enabled | boolean | Set as enabled. | | -| fromName | string | Sender Name. | | -| fromEmail | string | Sender email address. | | -| replyToName | string | Name set in the reply to field for the mail. Default value is sender name. | | -| replyToEmail | string | Email set in the reply to field for the mail. Default value is sender email. | | - -## Create Msg91 provider - -```http request -POST https://cloud.appwrite.io/v1/messaging/providers/msg91 -``` - -** Create a new MSG91 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. | | -| templateId | string | Msg91 template ID | | -| senderId | string | Msg91 sender ID. | | -| authKey | string | Msg91 auth key. | | -| enabled | boolean | Set as enabled. | | - -## Update Msg91 provider - -```http request -PATCH https://cloud.appwrite.io/v1/messaging/providers/msg91/{providerId} -``` - -** Update a MSG91 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. | | -| templateId | string | Msg91 template ID. | | -| senderId | string | Msg91 sender ID. | | -| authKey | string | Msg91 auth key. | | - -## Create Sendgrid provider - -```http request -POST https://cloud.appwrite.io/v1/messaging/providers/sendgrid -``` - -** Create a new Sendgrid 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. | | -| apiKey | string | Sendgrid API key. | | -| fromName | string | Sender Name. | | -| fromEmail | string | Sender email address. | | -| replyToName | string | Name set in the reply to field for the mail. Default value is sender name. | | -| replyToEmail | string | Email set in the reply to field for the mail. Default value is sender email. | | -| enabled | boolean | Set as enabled. | | - -## Update Sendgrid provider - -```http request -PATCH https://cloud.appwrite.io/v1/messaging/providers/sendgrid/{providerId} -``` - -** Update a Sendgrid 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. | | -| apiKey | string | Sendgrid API key. | | -| fromName | string | Sender Name. | | -| fromEmail | string | Sender email address. | | -| replyToName | string | Name set in the Reply To field for the mail. Default value is Sender Name. | | -| replyToEmail | string | Email set in the Reply To field for the mail. Default value is Sender Email. | | - -## Create SMTP provider - -```http request -POST https://cloud.appwrite.io/v1/messaging/providers/smtp -``` - -** Create a new SMTP 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. | | -| host | string | SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order. | | -| port | integer | The default SMTP server port. | 587 | -| username | string | Authentication username. | | -| password | string | Authentication password. | | -| encryption | string | Encryption type. Can be omitted, 'ssl', or 'tls' | | -| autoTLS | boolean | Enable SMTP AutoTLS feature. | 1 | -| mailer | string | The value to use for the X-Mailer header. | | -| fromName | string | Sender Name. | | -| fromEmail | string | Sender email address. | | -| replyToName | string | Name set in the reply to field for the mail. Default value is sender name. | | -| replyToEmail | string | Email set in the reply to field for the mail. Default value is sender email. | | -| enabled | boolean | Set as enabled. | | - -## Update SMTP provider - -```http request -PATCH https://cloud.appwrite.io/v1/messaging/providers/smtp/{providerId} -``` - -** Update a SMTP provider by its unique ID. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| providerId | string | **Required** Provider ID. | | -| name | string | Provider name. | | -| host | string | SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order. | | -| port | integer | SMTP port. | | -| username | string | Authentication username. | | -| password | string | Authentication password. | | -| encryption | string | Encryption type. Can be 'ssl' or 'tls' | | -| autoTLS | boolean | Enable SMTP AutoTLS feature. | | -| mailer | string | The value to use for the X-Mailer header. | | -| fromName | string | Sender Name. | | -| fromEmail | string | Sender email address. | | -| replyToName | string | Name set in the Reply To field for the mail. Default value is Sender Name. | | -| replyToEmail | string | Email set in the Reply To field for the mail. Default value is Sender Email. | | -| enabled | boolean | Set as enabled. | | - -## Create Telesign provider - -```http request -POST https://cloud.appwrite.io/v1/messaging/providers/telesign -``` - -** Create a new Telesign 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. | | -| from | string | Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. | | -| customerId | string | Telesign customer ID. | | -| apiKey | string | Telesign API key. | | -| enabled | boolean | Set as enabled. | | - -## Update Telesign provider - -```http request -PATCH https://cloud.appwrite.io/v1/messaging/providers/telesign/{providerId} -``` - -** Update a Telesign 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. | | -| customerId | string | Telesign customer ID. | | -| apiKey | string | Telesign API key. | | -| from | string | Sender number. | | - -## Create Textmagic provider - -```http request -POST https://cloud.appwrite.io/v1/messaging/providers/textmagic -``` - -** Create a new Textmagic 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. | | -| from | string | Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. | | -| username | string | Textmagic username. | | -| apiKey | string | Textmagic apiKey. | | -| enabled | boolean | Set as enabled. | | - -## Update Textmagic provider - -```http request -PATCH https://cloud.appwrite.io/v1/messaging/providers/textmagic/{providerId} -``` - -** Update a Textmagic 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. | | -| username | string | Textmagic username. | | -| apiKey | string | Textmagic apiKey. | | -| from | string | Sender number. | | - -## Create Twilio provider - -```http request -POST https://cloud.appwrite.io/v1/messaging/providers/twilio -``` - -** Create a new Twilio 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. | | -| from | string | Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. | | -| accountSid | string | Twilio account secret ID. | | -| authToken | string | Twilio authentication token. | | -| enabled | boolean | Set as enabled. | | - -## Update Twilio provider - -```http request -PATCH https://cloud.appwrite.io/v1/messaging/providers/twilio/{providerId} -``` - -** Update a Twilio 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. | | -| accountSid | string | Twilio account secret ID. | | -| authToken | string | Twilio authentication token. | | -| from | string | Sender number. | | - -## Create Vonage provider - -```http request -POST https://cloud.appwrite.io/v1/messaging/providers/vonage -``` - -** Create a new Vonage 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. | | -| from | string | Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. | | -| apiKey | string | Vonage API key. | | -| apiSecret | string | Vonage API secret. | | -| enabled | boolean | Set as enabled. | | - -## Update Vonage provider - -```http request -PATCH https://cloud.appwrite.io/v1/messaging/providers/vonage/{providerId} -``` - -** Update a Vonage 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. | | -| apiKey | string | Vonage API key. | | -| apiSecret | string | Vonage API secret. | | -| from | string | Sender number. | | - -## Get provider - -```http request -GET https://cloud.appwrite.io/v1/messaging/providers/{providerId} -``` - -** Get a provider by its unique ID. - ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| providerId | string | **Required** Provider ID. | | - -## Delete provider - -```http request -DELETE https://cloud.appwrite.io/v1/messaging/providers/{providerId} -``` - -** Delete a provider by its unique ID. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| providerId | string | **Required** Provider ID. | | - -## List provider logs - -```http request -GET https://cloud.appwrite.io/v1/messaging/providers/{providerId}/logs -``` - -** Get the provider activity logs listed by its unique ID. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| providerId | string | **Required** Provider 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). Only supported methods are limit and offset | [] | - -## List subscriber logs - -```http request -GET https://cloud.appwrite.io/v1/messaging/subscribers/{subscriberId}/logs -``` - -** Get the subscriber activity logs listed by its unique ID. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| subscriberId | string | **Required** Subscriber 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). Only supported methods are limit and offset | [] | - -## List topics - -```http request -GET https://cloud.appwrite.io/v1/messaging/topics -``` - -** Get a list of all topics from the current Appwrite project. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| queries | array | Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, description, emailTotal, smsTotal, pushTotal | [] | -| search | string | Search term to filter your list results. Max length: 256 chars. | | - -## Create topic - -```http request -POST https://cloud.appwrite.io/v1/messaging/topics -``` - -** Create a new topic. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| 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"] | - -## Get topic - -```http request -GET https://cloud.appwrite.io/v1/messaging/topics/{topicId} -``` - -** Get a topic by its unique ID. - ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| topicId | string | **Required** Topic ID. | | - -## Update topic - -```http request -PATCH https://cloud.appwrite.io/v1/messaging/topics/{topicId} -``` - -** Update a topic by its unique ID. - ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| 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. | | - -## Delete topic - -```http request -DELETE https://cloud.appwrite.io/v1/messaging/topics/{topicId} -``` - -** Delete a topic by its unique ID. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| topicId | string | **Required** Topic ID. | | - -## List topic logs - -```http request -GET https://cloud.appwrite.io/v1/messaging/topics/{topicId}/logs -``` - -** Get the topic activity logs listed by its unique ID. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| topicId | string | **Required** Topic 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). Only supported methods are limit and offset | [] | - -## List subscribers - -```http request -GET https://cloud.appwrite.io/v1/messaging/topics/{topicId}/subscribers -``` - -** Get a list of all subscribers from the current Appwrite project. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| topicId | string | **Required** Topic ID. The topic ID subscribed to. | | -| 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, provider, type, enabled | [] | -| search | string | Search term to filter your list results. Max length: 256 chars. | | - -## Create subscriber - -```http request -POST https://cloud.appwrite.io/v1/messaging/topics/{topicId}/subscribers -``` - -** Create a new subscriber. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| topicId | string | **Required** Topic ID. The topic ID to subscribe to. | | -| subscriberId | string | Subscriber ID. Choose a custom Subscriber ID or a new Subscriber ID. | | -| targetId | string | Target ID. The target ID to link to the specified Topic ID. | | - -## Get subscriber - -```http request -GET https://cloud.appwrite.io/v1/messaging/topics/{topicId}/subscribers/{subscriberId} -``` - -** Get a subscriber by its unique ID. - ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| topicId | string | **Required** Topic ID. The topic ID subscribed to. | | -| subscriberId | string | **Required** Subscriber ID. | | - -## Delete subscriber - -```http request -DELETE https://cloud.appwrite.io/v1/messaging/topics/{topicId}/subscribers/{subscriberId} -``` - -** Delete a subscriber by its unique ID. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| topicId | string | **Required** Topic ID. The topic ID subscribed to. | | -| subscriberId | string | **Required** Subscriber ID. | | - diff --git a/docs/storage.md b/docs/storage.md deleted file mode 100644 index 2f07dbd..0000000 --- a/docs/storage.md +++ /dev/null @@ -1,234 +0,0 @@ -# Storage Service - -## List buckets - -```http request -GET https://cloud.appwrite.io/v1/storage/buckets -``` - -** Get a list of all the storage buckets. 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: enabled, name, fileSecurity, maximumFileSize, encryption, antivirus | [] | -| search | string | Search term to filter your list results. Max length: 256 chars. | | - -## Create bucket - -```http request -POST https://cloud.appwrite.io/v1/storage/buckets -``` - -** Create a new storage bucket. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| bucketId | string | Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. | | -| name | string | Bucket name | | -| permissions | array | An array of permission strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). | | -| fileSecurity | boolean | Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions). | | -| enabled | boolean | Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled. | 1 | -| maximumFileSize | integer | Maximum file size allowed in bytes. Maximum allowed value is 30MB. | [] | -| allowedFileExtensions | array | Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long. | [] | -| compression | string | Compression algorithm choosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled | none | -| encryption | boolean | Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled | 1 | -| antivirus | boolean | Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled | 1 | - -## Get bucket - -```http request -GET https://cloud.appwrite.io/v1/storage/buckets/{bucketId} -``` - -** Get a storage bucket by its unique ID. This endpoint response returns a JSON object with the storage bucket metadata. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| bucketId | string | **Required** Bucket unique ID. | | - -## Update bucket - -```http request -PUT https://cloud.appwrite.io/v1/storage/buckets/{bucketId} -``` - -** Update a storage bucket by its unique ID. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| bucketId | string | **Required** Bucket unique ID. | | -| name | string | Bucket name | | -| permissions | array | An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). | | -| fileSecurity | boolean | Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions). | | -| enabled | boolean | Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled. | 1 | -| maximumFileSize | integer | Maximum file size allowed in bytes. Maximum allowed value is 30MB. | [] | -| allowedFileExtensions | array | Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long. | [] | -| compression | string | Compression algorithm choosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled | none | -| encryption | boolean | Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled | 1 | -| antivirus | boolean | Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled | 1 | - -## Delete bucket - -```http request -DELETE https://cloud.appwrite.io/v1/storage/buckets/{bucketId} -``` - -** Delete a storage bucket by its unique ID. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| bucketId | string | **Required** Bucket unique ID. | | - -## List files - -```http request -GET https://cloud.appwrite.io/v1/storage/buckets/{bucketId}/files -``` - -** Get a list of all the user files. You can use the query params to filter your results. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| bucketId | string | **Required** Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). | | -| 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, signature, mimeType, sizeOriginal, chunksTotal, chunksUploaded | [] | -| search | string | Search term to filter your list results. Max length: 256 chars. | | - -## Create file - -```http request -POST https://cloud.appwrite.io/v1/storage/buckets/{bucketId}/files -``` - -** Create a new file. Before using this route, you should create a new bucket resource using either a [server integration](https://appwrite.io/docs/server/storage#storageCreateBucket) API or directly from your Appwrite console. - -Larger files should be uploaded using multiple requests with the [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) header to send a partial request with a maximum supported chunk of `5MB`. The `content-range` header values should always be in bytes. - -When the first request is sent, the server will return the **File** object, and the subsequent part request must include the file's **id** in `x-appwrite-id` header to allow the server to know that the partial upload is for the existing file and not for a new one. - -If you're creating a new file using one of the Appwrite SDKs, all the chunking logic will be managed by the SDK internally. - ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| bucketId | string | **Required** Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). | | -| fileId | string | File 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. | | -| file | file | Binary file. Appwrite SDKs provide helpers to handle file input. [Learn about file input](https://appwrite.io/docs/products/storage/upload-download#input-file). | | -| permissions | array | An array of permission strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). | | - -## Get file - -```http request -GET https://cloud.appwrite.io/v1/storage/buckets/{bucketId}/files/{fileId} -``` - -** Get a file by its unique ID. This endpoint response returns a JSON object with the file metadata. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| bucketId | string | **Required** Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). | | -| fileId | string | **Required** File ID. | | - -## Update file - -```http request -PUT https://cloud.appwrite.io/v1/storage/buckets/{bucketId}/files/{fileId} -``` - -** Update a file by its unique ID. Only users with write permissions have access to update this resource. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| bucketId | string | **Required** Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). | | -| fileId | string | **Required** File unique ID. | | -| name | string | Name of the file | | -| permissions | array | An array of permission string. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). | | - -## Delete File - -```http request -DELETE https://cloud.appwrite.io/v1/storage/buckets/{bucketId}/files/{fileId} -``` - -** Delete a file by its unique ID. Only users with write permissions have access to delete this resource. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| bucketId | string | **Required** Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). | | -| fileId | string | **Required** File ID. | | - -## Get file for download - -```http request -GET https://cloud.appwrite.io/v1/storage/buckets/{bucketId}/files/{fileId}/download -``` - -** Get a file content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| bucketId | string | **Required** Storage bucket ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). | | -| fileId | string | **Required** File ID. | | - -## Get file preview - -```http request -GET https://cloud.appwrite.io/v1/storage/buckets/{bucketId}/files/{fileId}/preview -``` - -** Get a file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets, will return the file icon image. You can also pass query string arguments for cutting and resizing your preview image. Preview is supported only for image files smaller than 10MB. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| bucketId | string | **Required** Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). | | -| fileId | string | **Required** File ID | | -| width | integer | Resize preview image width, Pass an integer between 0 to 4000. | 0 | -| height | integer | Resize preview image height, Pass an integer between 0 to 4000. | 0 | -| gravity | string | Image crop gravity. Can be one of center,top-left,top,top-right,left,right,bottom-left,bottom,bottom-right | center | -| quality | integer | Preview image quality. Pass an integer between 0 to 100. Defaults to 100. | 100 | -| borderWidth | integer | Preview image border in pixels. Pass an integer between 0 to 100. Defaults to 0. | 0 | -| borderColor | string | Preview image border color. Use a valid HEX color, no # is needed for prefix. | | -| borderRadius | integer | Preview image border radius in pixels. Pass an integer between 0 to 4000. | 0 | -| opacity | number | Preview image opacity. Only works with images having an alpha channel (like png). Pass a number between 0 to 1. | 1 | -| rotation | integer | Preview image rotation in degrees. Pass an integer between -360 and 360. | 0 | -| background | string | Preview image background color. Only works with transparent images (png). Use a valid HEX color, no # is needed for prefix. | | -| output | string | Output format type (jpeg, jpg, png, gif and webp). | | - -## Get file for view - -```http request -GET https://cloud.appwrite.io/v1/storage/buckets/{bucketId}/files/{fileId}/view -``` - -** Get a file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| bucketId | string | **Required** Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). | | -| fileId | string | **Required** File ID. | | - diff --git a/docs/teams.md b/docs/teams.md deleted file mode 100644 index 0804aee..0000000 --- a/docs/teams.md +++ /dev/null @@ -1,215 +0,0 @@ -# Teams Service - -## List teams - -```http request -GET https://cloud.appwrite.io/v1/teams -``` - -** Get a list of all the teams in which the current user is a member. You can use the parameters 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, total, billingPlan | [] | -| search | string | Search term to filter your list results. Max length: 256 chars. | | - -## Create team - -```http request -POST https://cloud.appwrite.io/v1/teams -``` - -** Create a new team. The user who creates the team will automatically be assigned as the owner of the team. Only the users with the owner role can invite new members, add new owners and delete or update the team. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| teamId | string | Team 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 | Team name. Max length: 128 chars. | | -| roles | array | Array of strings. Use this param to set the roles in the team for the user who created it. The default role is **owner**. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long. | ["owner"] | - -## Get team - -```http request -GET https://cloud.appwrite.io/v1/teams/{teamId} -``` - -** Get a team by its ID. All team members have read access for this resource. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| teamId | string | **Required** Team ID. | | - -## Update name - -```http request -PUT https://cloud.appwrite.io/v1/teams/{teamId} -``` - -** Update the team's name by its unique ID. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| teamId | string | **Required** Team ID. | | -| name | string | New team name. Max length: 128 chars. | | - -## Delete team - -```http request -DELETE https://cloud.appwrite.io/v1/teams/{teamId} -``` - -** Delete a team using its ID. Only team members with the owner role can delete the team. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| teamId | string | **Required** Team ID. | | - -## List team memberships - -```http request -GET https://cloud.appwrite.io/v1/teams/{teamId}/memberships -``` - -** Use this endpoint to list a team's members using the team's ID. All team members have read access to this endpoint. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| teamId | string | **Required** Team 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: userId, teamId, invited, joined, confirm | [] | -| search | string | Search term to filter your list results. Max length: 256 chars. | | - -## Create team membership - -```http request -POST https://cloud.appwrite.io/v1/teams/{teamId}/memberships -``` - -** Invite a new member to join your team. Provide an ID for existing users, or invite unregistered users using an email or phone number. If initiated from a Client SDK, Appwrite will send an email or sms with a link to join the team to the invited user, and an account will be created for them if one doesn't exist. If initiated from a Server SDK, the new member will be added automatically to the team. - -You only need to provide one of a user ID, email, or phone number. Appwrite will prioritize accepting the user ID > email > phone number if you provide more than one of these parameters. - -Use the `url` parameter to redirect the user from the invitation email to your app. After the user is redirected, use the [Update Team Membership Status](https://appwrite.io/docs/references/cloud/client-web/teams#updateMembershipStatus) endpoint to allow the user to accept the invitation to the team. - -Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) Appwrite will accept the only redirect URLs under the domains you have added as a platform on the Appwrite Console. - ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| teamId | string | **Required** Team ID. | | -| email | string | Email of the new team member. | | -| userId | string | ID of the user to be added to a team. | | -| phone | string | Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. | | -| 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 32 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. | | - -## Get team membership - -```http request -GET https://cloud.appwrite.io/v1/teams/{teamId}/memberships/{membershipId} -``` - -** Get a team member by the membership unique id. All team members have read access for this resource. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| teamId | string | **Required** Team ID. | | -| membershipId | string | **Required** Membership ID. | | - -## Update membership - -```http request -PATCH https://cloud.appwrite.io/v1/teams/{teamId}/memberships/{membershipId} -``` - -** Modify the roles of a team member. Only team members with the owner role have access to this endpoint. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). - ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| teamId | string | **Required** Team ID. | | -| membershipId | string | **Required** Membership ID. | | -| roles | array | An array of strings. Use this param to set the user's 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 32 characters long. | | - -## Delete team membership - -```http request -DELETE https://cloud.appwrite.io/v1/teams/{teamId}/memberships/{membershipId} -``` - -** This endpoint allows a user to leave a team or for a team owner to delete the membership of any other team member. You can also use this endpoint to delete a user membership even if it is not accepted. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| teamId | string | **Required** Team ID. | | -| membershipId | string | **Required** Membership ID. | | - -## Update team membership status - -```http request -PATCH https://cloud.appwrite.io/v1/teams/{teamId}/memberships/{membershipId}/status -``` - -** Use this endpoint to allow a user to accept an invitation to join a team after being redirected back to your app from the invitation email received by the user. - -If the request is successful, a session for the user is automatically created. - ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| teamId | string | **Required** Team ID. | | -| membershipId | string | **Required** Membership ID. | | -| userId | string | User ID. | | -| secret | string | Secret key. | | - -## Get team preferences - -```http request -GET https://cloud.appwrite.io/v1/teams/{teamId}/prefs -``` - -** Get the team's shared preferences by its unique ID. If a preference doesn't need to be shared by all team members, prefer storing them in [user preferences](https://appwrite.io/docs/references/cloud/client-web/account#getPrefs). ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| teamId | string | **Required** Team ID. | | - -## Update preferences - -```http request -PUT https://cloud.appwrite.io/v1/teams/{teamId}/prefs -``` - -** Update the team's preferences by its unique ID. The object you pass is stored as is and replaces any previous value. The maximum allowed prefs size is 64kB and throws an error if exceeded. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| teamId | string | **Required** Team ID. | | -| prefs | object | Prefs key-value JSON object. | {} | - diff --git a/docs/users.md b/docs/users.md deleted file mode 100644 index 180eb96..0000000 --- a/docs/users.md +++ /dev/null @@ -1,660 +0,0 @@ -# Users Service - -## List users - -```http request -GET https://cloud.appwrite.io/v1/users -``` - -** Get a list of all the project's users. 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, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels | [] | -| search | string | Search term to filter your list results. Max length: 256 chars. | | - -## Create user - -```http request -POST https://cloud.appwrite.io/v1/users -``` - -** Create a new user. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| userId | string | User 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. | | -| email | string | User email. | | -| phone | string | Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. | | -| password | string | Plain text user password. Must be at least 8 chars. | | -| name | string | User name. Max length: 128 chars. | | - -## Create user with Argon2 password - -```http request -POST https://cloud.appwrite.io/v1/users/argon2 -``` - -** Create a new user. Password provided must be hashed with the [Argon2](https://en.wikipedia.org/wiki/Argon2) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| userId | string | User 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. | | -| email | string | User email. | | -| password | string | User password hashed using Argon2. | | -| name | string | User name. Max length: 128 chars. | | - -## Create user with bcrypt password - -```http request -POST https://cloud.appwrite.io/v1/users/bcrypt -``` - -** Create a new user. Password provided must be hashed with the [Bcrypt](https://en.wikipedia.org/wiki/Bcrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| userId | string | User 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. | | -| email | string | User email. | | -| password | string | User password hashed using Bcrypt. | | -| name | string | User name. Max length: 128 chars. | | - -## List Identities - -```http request -GET https://cloud.appwrite.io/v1/users/identities -``` - -** Get identities for all users. ** - -### 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: userId, provider, providerUid, providerEmail, providerAccessTokenExpiry | [] | -| search | string | Search term to filter your list results. Max length: 256 chars. | | - -## Delete identity - -```http request -DELETE https://cloud.appwrite.io/v1/users/identities/{identityId} -``` - -** Delete an identity by its unique ID. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| identityId | string | **Required** Identity ID. | | - -## Create user with MD5 password - -```http request -POST https://cloud.appwrite.io/v1/users/md5 -``` - -** Create a new user. Password provided must be hashed with the [MD5](https://en.wikipedia.org/wiki/MD5) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| userId | string | User 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. | | -| email | string | User email. | | -| password | string | User password hashed using MD5. | | -| name | string | User name. Max length: 128 chars. | | - -## Create user with PHPass password - -```http request -POST https://cloud.appwrite.io/v1/users/phpass -``` - -** Create a new user. Password provided must be hashed with the [PHPass](https://www.openwall.com/phpass/) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| userId | string | User ID. Choose a custom ID or pass the string `ID.unique()`to auto generate it. 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. | | -| email | string | User email. | | -| password | string | User password hashed using PHPass. | | -| name | string | User name. Max length: 128 chars. | | - -## Create user with Scrypt password - -```http request -POST https://cloud.appwrite.io/v1/users/scrypt -``` - -** Create a new user. Password provided must be hashed with the [Scrypt](https://github.com/Tarsnap/scrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| userId | string | User 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. | | -| email | string | User email. | | -| password | string | User password hashed using Scrypt. | | -| passwordSalt | string | Optional salt used to hash password. | | -| passwordCpu | integer | Optional CPU cost used to hash password. | | -| passwordMemory | integer | Optional memory cost used to hash password. | | -| passwordParallel | integer | Optional parallelization cost used to hash password. | | -| passwordLength | integer | Optional hash length used to hash password. | | -| name | string | User name. Max length: 128 chars. | | - -## Create user with Scrypt modified password - -```http request -POST https://cloud.appwrite.io/v1/users/scrypt-modified -``` - -** Create a new user. Password provided must be hashed with the [Scrypt Modified](https://gist.github.com/Meldiron/eecf84a0225eccb5a378d45bb27462cc) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| userId | string | User 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. | | -| email | string | User email. | | -| password | string | User password hashed using Scrypt Modified. | | -| passwordSalt | string | Salt used to hash password. | | -| passwordSaltSeparator | string | Salt separator used to hash password. | | -| passwordSignerKey | string | Signer key used to hash password. | | -| name | string | User name. Max length: 128 chars. | | - -## Create user with SHA password - -```http request -POST https://cloud.appwrite.io/v1/users/sha -``` - -** Create a new user. Password provided must be hashed with the [SHA](https://en.wikipedia.org/wiki/Secure_Hash_Algorithm) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| userId | string | User 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. | | -| email | string | User email. | | -| password | string | User password hashed using SHA. | | -| passwordVersion | string | Optional SHA version used to hash password. Allowed values are: 'sha1', 'sha224', 'sha256', 'sha384', 'sha512/224', 'sha512/256', 'sha512', 'sha3-224', 'sha3-256', 'sha3-384', 'sha3-512' | | -| name | string | User name. Max length: 128 chars. | | - -## Get user - -```http request -GET https://cloud.appwrite.io/v1/users/{userId} -``` - -** Get a user by its unique ID. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| userId | string | **Required** User ID. | | - -## Delete user - -```http request -DELETE https://cloud.appwrite.io/v1/users/{userId} -``` - -** Delete a user by its unique ID, thereby releasing it's ID. Since ID is released and can be reused, all user-related resources like documents or storage files should be deleted before user deletion. If you want to keep ID reserved, use the [updateStatus](https://appwrite.io/docs/server/users#usersUpdateStatus) endpoint instead. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| userId | string | **Required** User ID. | | - -## Update email - -```http request -PATCH https://cloud.appwrite.io/v1/users/{userId}/email -``` - -** Update the user email by its unique ID. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| userId | string | **Required** User ID. | | -| email | string | User email. | | - -## Create user JWT - -```http request -POST https://cloud.appwrite.io/v1/users/{userId}/jwts -``` - -** Use this endpoint to create a JSON Web Token for user by its unique ID. You can use the resulting JWT to authenticate on behalf of the user. The JWT secret will become invalid if the session it uses gets deleted. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| userId | string | **Required** User ID. | | -| sessionId | string | Session ID. Use the string 'recent' to use the most recent session. Defaults to the most recent session. | recent | -| duration | integer | Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds. | 900 | - -## Update user labels - -```http request -PUT https://cloud.appwrite.io/v1/users/{userId}/labels -``` - -** Update the user labels by its unique ID. - -Labels can be used to grant access to resources. While teams are a way for user's to share access to a resource, labels can be defined by the developer to grant access without an invitation. See the [Permissions docs](https://appwrite.io/docs/permissions) for more info. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| userId | string | **Required** User ID. | | -| labels | array | Array of user labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long. | | - -## List user logs - -```http request -GET https://cloud.appwrite.io/v1/users/{userId}/logs -``` - -** Get the user activity logs list by its unique ID. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| userId | string | **Required** User 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). Only supported methods are limit and offset | [] | - -## List user memberships - -```http request -GET https://cloud.appwrite.io/v1/users/{userId}/memberships -``` - -** Get the user membership list by its unique ID. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| userId | string | **Required** User ID. | | - -## Update MFA - -```http request -PATCH https://cloud.appwrite.io/v1/users/{userId}/mfa -``` - -** Enable or disable MFA on a user account. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| userId | string | **Required** User ID. | | -| mfa | boolean | Enable or disable MFA. | | - -## Delete Authenticator - -```http request -DELETE https://cloud.appwrite.io/v1/users/{userId}/mfa/authenticators/{type} -``` - -** Delete an authenticator app. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| userId | string | **Required** User ID. | | -| type | string | **Required** Type of authenticator. | | - -## List Factors - -```http request -GET https://cloud.appwrite.io/v1/users/{userId}/mfa/factors -``` - -** List the factors available on the account to be used as a MFA challange. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| userId | string | **Required** User ID. | | - -## Get MFA Recovery Codes - -```http request -GET https://cloud.appwrite.io/v1/users/{userId}/mfa/recovery-codes -``` - -** Get recovery codes that can be used as backup for MFA flow by User ID. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| userId | string | **Required** User ID. | | - -## Regenerate MFA Recovery Codes - -```http request -PUT https://cloud.appwrite.io/v1/users/{userId}/mfa/recovery-codes -``` - -** Regenerate recovery codes that can be used as backup for MFA flow by User ID. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| userId | string | **Required** User ID. | | - -## Create MFA Recovery Codes - -```http request -PATCH https://cloud.appwrite.io/v1/users/{userId}/mfa/recovery-codes -``` - -** Generate recovery codes used as backup for MFA flow for User ID. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method by client SDK. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| userId | string | **Required** User ID. | | - -## Update name - -```http request -PATCH https://cloud.appwrite.io/v1/users/{userId}/name -``` - -** Update the user name by its unique ID. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| userId | string | **Required** User ID. | | -| name | string | User name. Max length: 128 chars. | | - -## Update password - -```http request -PATCH https://cloud.appwrite.io/v1/users/{userId}/password -``` - -** Update the user password by its unique ID. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| userId | string | **Required** User ID. | | -| password | string | New user password. Must be at least 8 chars. | | - -## Update phone - -```http request -PATCH https://cloud.appwrite.io/v1/users/{userId}/phone -``` - -** Update the user phone by its unique ID. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| userId | string | **Required** User ID. | | -| number | string | User phone number. | | - -## Get user preferences - -```http request -GET https://cloud.appwrite.io/v1/users/{userId}/prefs -``` - -** Get the user preferences by its unique ID. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| userId | string | **Required** User ID. | | - -## Update user preferences - -```http request -PATCH https://cloud.appwrite.io/v1/users/{userId}/prefs -``` - -** Update the user preferences by its unique ID. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| userId | string | **Required** User ID. | | -| prefs | object | Prefs key-value JSON object. | {} | - -## List user sessions - -```http request -GET https://cloud.appwrite.io/v1/users/{userId}/sessions -``` - -** Get the user sessions list by its unique ID. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| userId | string | **Required** User ID. | | - -## Create session - -```http request -POST https://cloud.appwrite.io/v1/users/{userId}/sessions -``` - -** Creates a session for a user. Returns an immediately usable session object. - -If you want to generate a token for a custom authentication flow, use the [POST /users/{userId}/tokens](https://appwrite.io/docs/server/users#createToken) endpoint. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| userId | string | **Required** User 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. | | - -## Delete user sessions - -```http request -DELETE https://cloud.appwrite.io/v1/users/{userId}/sessions -``` - -** Delete all user's sessions by using the user's unique ID. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| userId | string | **Required** User ID. | | - -## Delete user session - -```http request -DELETE https://cloud.appwrite.io/v1/users/{userId}/sessions/{sessionId} -``` - -** Delete a user sessions by its unique ID. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| userId | string | **Required** User ID. | | -| sessionId | string | **Required** Session ID. | | - -## Update user status - -```http request -PATCH https://cloud.appwrite.io/v1/users/{userId}/status -``` - -** Update the user status by its unique ID. Use this endpoint as an alternative to deleting a user if you want to keep user's ID reserved. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| userId | string | **Required** User ID. | | -| status | boolean | User Status. To activate the user pass `true` and to block the user pass `false`. | | - -## List User Targets - -```http request -GET https://cloud.appwrite.io/v1/users/{userId}/targets -``` - -** List the messaging targets that are associated with a user. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| userId | string | **Required** User 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: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels | [] | - -## Create User Target - -```http request -POST https://cloud.appwrite.io/v1/users/{userId}/targets -``` - -** Create a messaging target. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| userId | string | **Required** User ID. | | -| targetId | string | Target 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. | | -| providerType | string | The target provider type. Can be one of the following: `email`, `sms` or `push`. | | -| identifier | string | The target identifier (token, email, phone etc.) | | -| providerId | string | Provider ID. Message will be sent to this target from the specified provider ID. If no provider ID is set the first setup provider will be used. | | -| name | string | Target name. Max length: 128 chars. For example: My Awesome App Galaxy S23. | | - -## Get User Target - -```http request -GET https://cloud.appwrite.io/v1/users/{userId}/targets/{targetId} -``` - -** Get a user's push notification target by ID. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| userId | string | **Required** User ID. | | -| targetId | string | **Required** Target ID. | | - -## Update User target - -```http request -PATCH https://cloud.appwrite.io/v1/users/{userId}/targets/{targetId} -``` - -** Update a messaging target. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| userId | string | **Required** User ID. | | -| targetId | string | **Required** Target ID. | | -| identifier | string | The target identifier (token, email, phone etc.) | | -| providerId | string | Provider ID. Message will be sent to this target from the specified provider ID. If no provider ID is set the first setup provider will be used. | | -| name | string | Target name. Max length: 128 chars. For example: My Awesome App Galaxy S23. | | - -## Delete user target - -```http request -DELETE https://cloud.appwrite.io/v1/users/{userId}/targets/{targetId} -``` - -** Delete a messaging target. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| userId | string | **Required** User ID. | | -| targetId | string | **Required** Target ID. | | - -## Create token - -```http request -POST https://cloud.appwrite.io/v1/users/{userId}/tokens -``` - -** Returns a token with a secret key for creating a session. Use the user ID and secret and submit a request to the [PUT /account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. - ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| userId | string | **Required** User ID. | | -| length | integer | Token length in characters. The default length is 6 characters | 6 | -| expire | integer | Token expiration period in seconds. The default expiration is 15 minutes. | 900 | - -## Update email verification - -```http request -PATCH https://cloud.appwrite.io/v1/users/{userId}/verification -``` - -** Update the user email verification status by its unique ID. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| userId | string | **Required** User ID. | | -| emailVerification | boolean | User email verification status. | | - -## Update phone verification - -```http request -PATCH https://cloud.appwrite.io/v1/users/{userId}/verification/phone -``` - -** Update the user phone verification status by its unique ID. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| userId | string | **Required** User ID. | | -| phoneVerification | boolean | User phone verification status. | | - diff --git a/src/Appwrite/AppwriteException.php b/src/Appwrite/AppwriteException.php deleted file mode 100644 index 5b722d5..0000000 --- a/src/Appwrite/AppwriteException.php +++ /dev/null @@ -1,46 +0,0 @@ -<?php - -namespace Appwrite; - -use Exception; - -class AppwriteException extends Exception { - - /** - * @var mixed - */ - private $response; - - /** - * @var string - */ - private $type; - - /** - * @param String $message - * @param int $code - * @param mixed $response - */ - public function __construct($message = null, $code = 0, $type = null, $response = null) - { - parent::__construct($message, $code); - $this->response = $response; - $this->type = $type; - } - - /** - * @return string - */ - public function getType() - { - return $this->type; - } - - /** - * @return mixed - */ - final public function getResponse() - { - return $this->response; - } -} \ No newline at end of file diff --git a/src/Appwrite/Client.php b/src/Appwrite/Client.php deleted file mode 100644 index d7d8a37..0000000 --- a/src/Appwrite/Client.php +++ /dev/null @@ -1,310 +0,0 @@ -<?php - -namespace Appwrite; - -class Client -{ - const METHOD_GET = 'GET'; - const METHOD_POST = 'POST'; - const METHOD_PUT = 'PUT'; - const METHOD_PATCH = 'PATCH'; - const METHOD_DELETE = 'DELETE'; - const METHOD_HEAD = 'HEAD'; - const METHOD_OPTIONS = 'OPTIONS'; - const METHOD_CONNECT = 'CONNECT'; - const METHOD_TRACE = 'TRACE'; - - const CHUNK_SIZE = 5*1024*1024; - - /** - * Is Self Signed Certificates Allowed? - * - * @var bool - */ - protected $selfSigned = false; - - /** - * Service host name - * - * @var string - */ - protected $endpoint = 'https://cloud.appwrite.io/v1'; - - /** - * Global Headers - * - * @var array - */ - protected $headers = [ - 'content-type' => '', - 'user-agent' => 'AppwritePHPSDK/11.0.2 ()', - 'x-sdk-name'=> 'PHP', - 'x-sdk-platform'=> 'server', - 'x-sdk-language'=> 'php', - 'x-sdk-version'=> '11.0.2', - ]; - - /** - * SDK constructor. - */ - public function __construct() - { - $this->headers['X-Appwrite-Response-Format'] = '1.5.0'; - - } - - /** - * Set Project - * - * Your project ID - * - * @param string $value - * - * @return Client - */ - public function setProject($value) - { - $this->addHeader('X-Appwrite-Project', $value); - - return $this; - } - - /** - * Set Key - * - * Your secret API key - * - * @param string $value - * - * @return Client - */ - public function setKey($value) - { - $this->addHeader('X-Appwrite-Key', $value); - - return $this; - } - - /** - * Set JWT - * - * Your secret JSON Web Token - * - * @param string $value - * - * @return Client - */ - public function setJWT($value) - { - $this->addHeader('X-Appwrite-JWT', $value); - - return $this; - } - - /** - * Set Locale - * - * @param string $value - * - * @return Client - */ - public function setLocale($value) - { - $this->addHeader('X-Appwrite-Locale', $value); - - return $this; - } - - /** - * Set Session - * - * The user session to authenticate with - * - * @param string $value - * - * @return Client - */ - public function setSession($value) - { - $this->addHeader('X-Appwrite-Session', $value); - - return $this; - } - - /** - * Set ForwardedUserAgent - * - * The user agent string of the client that made the request - * - * @param string $value - * - * @return Client - */ - public function setForwardedUserAgent($value) - { - $this->addHeader('X-Forwarded-User-Agent', $value); - - return $this; - } - - - /*** - * @param bool $status - * @return $this - */ - public function setSelfSigned($status = true) - { - $this->selfSigned = $status; - - return $this; - } - - /*** - * @param $endpoint - * @return $this - */ - public function setEndpoint($endpoint) - { - $this->endpoint = $endpoint; - - return $this; - } - - /** - * @param $key - * @param $value - */ - public function addHeader($key, $value) - { - $this->headers[strtolower($key)] = $value; - - return $this; - } - - /** - * Call - * - * Make an API call - * - * @param string $method - * @param string $path - * @param array $params - * @param array $headers - * @return array|string - * @throws AppwriteException - */ - public function call($method, $path = '', $headers = array(), array $params = array(), ?string $responseType = null) - { - $headers = array_merge($this->headers, $headers); - $ch = curl_init($this->endpoint . $path . (($method == self::METHOD_GET && !empty($params)) ? '?' . http_build_query($params) : '')); - $responseHeaders = []; - - switch ($headers['content-type']) { - case 'application/json': - $query = json_encode($params); - break; - - case 'multipart/form-data': - $query = $this->flatten($params); - break; - - default: - $query = http_build_query($params); - break; - } - - foreach ($headers as $i => $header) { - $headers[] = $i . ':' . $header; - unset($headers[$i]); - } - - curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($ch, CURLOPT_USERAGENT, php_uname('s') . '-' . php_uname('r') . ':php-' . phpversion()); - curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, $responseType !== 'location'); - curl_setopt($ch, CURLOPT_HEADERFUNCTION, function($curl, $header) use (&$responseHeaders) { - $len = strlen($header); - $header = explode(':', strtolower($header), 2); - - if (count($header) < 2) { // ignore invalid headers - return $len; - } - - $responseHeaders[strtolower(trim($header[0]))] = trim($header[1]); - - return $len; - }); - - if($method != self::METHOD_GET) { - curl_setopt($ch, CURLOPT_POSTFIELDS, $query); - } - - // Allow self signed certificates - if($this->selfSigned) { - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); - } - - $responseBody = curl_exec($ch); - $contentType = $responseHeaders['content-type'] ?? ''; - $responseStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE); - - $warnings = $responseHeaders['x-appwrite-warning'] ?? ''; - if ($warnings) { - foreach(explode(';', $warnings) as $warning) { - echo 'Warning: ' . $warning . PHP_EOL; - } - } - - switch(substr($contentType, 0, strpos($contentType, ';'))) { - case 'application/json': - $responseBody = json_decode($responseBody, true); - break; - } - - if (curl_errno($ch)) { - throw new AppwriteException(curl_error($ch), $responseStatus, $responseBody); - } - - curl_close($ch); - - if($responseStatus >= 400) { - if(is_array($responseBody)) { - throw new AppwriteException($responseBody['message'], $responseStatus, $responseBody['type'] ?? '', $responseBody); - } else { - throw new AppwriteException($responseBody, $responseStatus); - } - } - - if ($responseType === 'location') { - return $responseHeaders['location']; - } - - return $responseBody; - } - - /** - * Flatten params array to PHP multiple format - * - * @param array $data - * @param string $prefix - * @return array - */ - protected function flatten(array $data, $prefix = '') { - $output = []; - - foreach($data as $key => $value) { - $finalKey = $prefix ? "{$prefix}[{$key}]" : $key; - - if (is_array($value)) { - $output += $this->flatten($value, $finalKey); // @todo: handle name collision here if needed - } - else { - $output[$finalKey] = $value; - } - } - - return $output; - } -} diff --git a/src/Appwrite/Enums/AuthenticationFactor.php b/src/Appwrite/Enums/AuthenticationFactor.php deleted file mode 100644 index 5258c8c..0000000 --- a/src/Appwrite/Enums/AuthenticationFactor.php +++ /dev/null @@ -1,59 +0,0 @@ -<?php - -namespace Appwrite\Enums; - -use JsonSerializable; - -class AuthenticationFactor implements JsonSerializable -{ - private static AuthenticationFactor $EMAIL; - private static AuthenticationFactor $PHONE; - private static AuthenticationFactor $TOTP; - private static AuthenticationFactor $RECOVERYCODE; - - private string $value; - - private function __construct(string $value) - { - $this->value = $value; - } - - public function __toString(): string - { - return $this->value; - } - - public function jsonSerialize(): string - { - return $this->value; - } - - public static function EMAIL(): AuthenticationFactor - { - if (!isset(self::$EMAIL)) { - self::$EMAIL = new AuthenticationFactor('email'); - } - return self::$EMAIL; - } - public static function PHONE(): AuthenticationFactor - { - if (!isset(self::$PHONE)) { - self::$PHONE = new AuthenticationFactor('phone'); - } - return self::$PHONE; - } - public static function TOTP(): AuthenticationFactor - { - if (!isset(self::$TOTP)) { - self::$TOTP = new AuthenticationFactor('totp'); - } - return self::$TOTP; - } - public static function RECOVERYCODE(): AuthenticationFactor - { - if (!isset(self::$RECOVERYCODE)) { - self::$RECOVERYCODE = new AuthenticationFactor('recoverycode'); - } - return self::$RECOVERYCODE; - } -} \ No newline at end of file diff --git a/src/Appwrite/Enums/AuthenticatorType.php b/src/Appwrite/Enums/AuthenticatorType.php deleted file mode 100644 index 9e8634a..0000000 --- a/src/Appwrite/Enums/AuthenticatorType.php +++ /dev/null @@ -1,35 +0,0 @@ -<?php - -namespace Appwrite\Enums; - -use JsonSerializable; - -class AuthenticatorType implements JsonSerializable -{ - private static AuthenticatorType $TOTP; - - private string $value; - - private function __construct(string $value) - { - $this->value = $value; - } - - public function __toString(): string - { - return $this->value; - } - - public function jsonSerialize(): string - { - return $this->value; - } - - public static function TOTP(): AuthenticatorType - { - if (!isset(self::$TOTP)) { - self::$TOTP = new AuthenticatorType('totp'); - } - return self::$TOTP; - } -} \ No newline at end of file diff --git a/src/Appwrite/Enums/Browser.php b/src/Appwrite/Enums/Browser.php deleted file mode 100644 index fc560f2..0000000 --- a/src/Appwrite/Enums/Browser.php +++ /dev/null @@ -1,139 +0,0 @@ -<?php - -namespace Appwrite\Enums; - -use JsonSerializable; - -class Browser implements JsonSerializable -{ - private static Browser $AVANTBROWSER; - private static Browser $ANDROIDWEBVIEWBETA; - private static Browser $GOOGLECHROME; - private static Browser $GOOGLECHROMEIOS; - private static Browser $GOOGLECHROMEMOBILE; - private static Browser $CHROMIUM; - private static Browser $MOZILLAFIREFOX; - private static Browser $SAFARI; - private static Browser $MOBILESAFARI; - private static Browser $MICROSOFTEDGE; - private static Browser $MICROSOFTEDGEIOS; - private static Browser $OPERAMINI; - private static Browser $OPERA; - private static Browser $OPERANEXT; - - private string $value; - - private function __construct(string $value) - { - $this->value = $value; - } - - public function __toString(): string - { - return $this->value; - } - - public function jsonSerialize(): string - { - return $this->value; - } - - public static function AVANTBROWSER(): Browser - { - if (!isset(self::$AVANTBROWSER)) { - self::$AVANTBROWSER = new Browser('aa'); - } - return self::$AVANTBROWSER; - } - public static function ANDROIDWEBVIEWBETA(): Browser - { - if (!isset(self::$ANDROIDWEBVIEWBETA)) { - self::$ANDROIDWEBVIEWBETA = new Browser('an'); - } - return self::$ANDROIDWEBVIEWBETA; - } - public static function GOOGLECHROME(): Browser - { - if (!isset(self::$GOOGLECHROME)) { - self::$GOOGLECHROME = new Browser('ch'); - } - return self::$GOOGLECHROME; - } - public static function GOOGLECHROMEIOS(): Browser - { - if (!isset(self::$GOOGLECHROMEIOS)) { - self::$GOOGLECHROMEIOS = new Browser('ci'); - } - return self::$GOOGLECHROMEIOS; - } - public static function GOOGLECHROMEMOBILE(): Browser - { - if (!isset(self::$GOOGLECHROMEMOBILE)) { - self::$GOOGLECHROMEMOBILE = new Browser('cm'); - } - return self::$GOOGLECHROMEMOBILE; - } - public static function CHROMIUM(): Browser - { - if (!isset(self::$CHROMIUM)) { - self::$CHROMIUM = new Browser('cr'); - } - return self::$CHROMIUM; - } - public static function MOZILLAFIREFOX(): Browser - { - if (!isset(self::$MOZILLAFIREFOX)) { - self::$MOZILLAFIREFOX = new Browser('ff'); - } - return self::$MOZILLAFIREFOX; - } - public static function SAFARI(): Browser - { - if (!isset(self::$SAFARI)) { - self::$SAFARI = new Browser('sf'); - } - return self::$SAFARI; - } - public static function MOBILESAFARI(): Browser - { - if (!isset(self::$MOBILESAFARI)) { - self::$MOBILESAFARI = new Browser('mf'); - } - return self::$MOBILESAFARI; - } - public static function MICROSOFTEDGE(): Browser - { - if (!isset(self::$MICROSOFTEDGE)) { - self::$MICROSOFTEDGE = new Browser('ps'); - } - return self::$MICROSOFTEDGE; - } - public static function MICROSOFTEDGEIOS(): Browser - { - if (!isset(self::$MICROSOFTEDGEIOS)) { - self::$MICROSOFTEDGEIOS = new Browser('oi'); - } - return self::$MICROSOFTEDGEIOS; - } - public static function OPERAMINI(): Browser - { - if (!isset(self::$OPERAMINI)) { - self::$OPERAMINI = new Browser('om'); - } - return self::$OPERAMINI; - } - public static function OPERA(): Browser - { - if (!isset(self::$OPERA)) { - self::$OPERA = new Browser('op'); - } - return self::$OPERA; - } - public static function OPERANEXT(): Browser - { - if (!isset(self::$OPERANEXT)) { - self::$OPERANEXT = new Browser('on'); - } - return self::$OPERANEXT; - } -} \ No newline at end of file diff --git a/src/Appwrite/Enums/Compression.php b/src/Appwrite/Enums/Compression.php deleted file mode 100644 index 1e73987..0000000 --- a/src/Appwrite/Enums/Compression.php +++ /dev/null @@ -1,51 +0,0 @@ -<?php - -namespace Appwrite\Enums; - -use JsonSerializable; - -class Compression implements JsonSerializable -{ - private static Compression $NONE; - private static Compression $GZIP; - private static Compression $ZSTD; - - private string $value; - - private function __construct(string $value) - { - $this->value = $value; - } - - public function __toString(): string - { - return $this->value; - } - - public function jsonSerialize(): string - { - return $this->value; - } - - public static function NONE(): Compression - { - if (!isset(self::$NONE)) { - self::$NONE = new Compression('none'); - } - return self::$NONE; - } - public static function GZIP(): Compression - { - if (!isset(self::$GZIP)) { - self::$GZIP = new Compression('gzip'); - } - return self::$GZIP; - } - public static function ZSTD(): Compression - { - if (!isset(self::$ZSTD)) { - self::$ZSTD = new Compression('zstd'); - } - return self::$ZSTD; - } -} \ No newline at end of file diff --git a/src/Appwrite/Enums/CreditCard.php b/src/Appwrite/Enums/CreditCard.php deleted file mode 100644 index aba9592..0000000 --- a/src/Appwrite/Enums/CreditCard.php +++ /dev/null @@ -1,155 +0,0 @@ -<?php - -namespace Appwrite\Enums; - -use JsonSerializable; - -class CreditCard implements JsonSerializable -{ - private static CreditCard $AMERICANEXPRESS; - private static CreditCard $ARGENCARD; - private static CreditCard $CABAL; - private static CreditCard $CENCOSUD; - private static CreditCard $DINERSCLUB; - private static CreditCard $DISCOVER; - private static CreditCard $ELO; - private static CreditCard $HIPERCARD; - private static CreditCard $JCB; - private static CreditCard $MASTERCARD; - private static CreditCard $NARANJA; - private static CreditCard $TARJETASHOPPING; - private static CreditCard $UNIONCHINAPAY; - private static CreditCard $VISA; - private static CreditCard $MIR; - private static CreditCard $MAESTRO; - - private string $value; - - private function __construct(string $value) - { - $this->value = $value; - } - - public function __toString(): string - { - return $this->value; - } - - public function jsonSerialize(): string - { - return $this->value; - } - - public static function AMERICANEXPRESS(): CreditCard - { - if (!isset(self::$AMERICANEXPRESS)) { - self::$AMERICANEXPRESS = new CreditCard('amex'); - } - return self::$AMERICANEXPRESS; - } - public static function ARGENCARD(): CreditCard - { - if (!isset(self::$ARGENCARD)) { - self::$ARGENCARD = new CreditCard('argencard'); - } - return self::$ARGENCARD; - } - public static function CABAL(): CreditCard - { - if (!isset(self::$CABAL)) { - self::$CABAL = new CreditCard('cabal'); - } - return self::$CABAL; - } - public static function CENCOSUD(): CreditCard - { - if (!isset(self::$CENCOSUD)) { - self::$CENCOSUD = new CreditCard('cencosud'); - } - return self::$CENCOSUD; - } - public static function DINERSCLUB(): CreditCard - { - if (!isset(self::$DINERSCLUB)) { - self::$DINERSCLUB = new CreditCard('diners'); - } - return self::$DINERSCLUB; - } - public static function DISCOVER(): CreditCard - { - if (!isset(self::$DISCOVER)) { - self::$DISCOVER = new CreditCard('discover'); - } - return self::$DISCOVER; - } - public static function ELO(): CreditCard - { - if (!isset(self::$ELO)) { - self::$ELO = new CreditCard('elo'); - } - return self::$ELO; - } - public static function HIPERCARD(): CreditCard - { - if (!isset(self::$HIPERCARD)) { - self::$HIPERCARD = new CreditCard('hipercard'); - } - return self::$HIPERCARD; - } - public static function JCB(): CreditCard - { - if (!isset(self::$JCB)) { - self::$JCB = new CreditCard('jcb'); - } - return self::$JCB; - } - public static function MASTERCARD(): CreditCard - { - if (!isset(self::$MASTERCARD)) { - self::$MASTERCARD = new CreditCard('mastercard'); - } - return self::$MASTERCARD; - } - public static function NARANJA(): CreditCard - { - if (!isset(self::$NARANJA)) { - self::$NARANJA = new CreditCard('naranja'); - } - return self::$NARANJA; - } - public static function TARJETASHOPPING(): CreditCard - { - if (!isset(self::$TARJETASHOPPING)) { - self::$TARJETASHOPPING = new CreditCard('targeta-shopping'); - } - return self::$TARJETASHOPPING; - } - public static function UNIONCHINAPAY(): CreditCard - { - if (!isset(self::$UNIONCHINAPAY)) { - self::$UNIONCHINAPAY = new CreditCard('union-china-pay'); - } - return self::$UNIONCHINAPAY; - } - public static function VISA(): CreditCard - { - if (!isset(self::$VISA)) { - self::$VISA = new CreditCard('visa'); - } - return self::$VISA; - } - public static function MIR(): CreditCard - { - if (!isset(self::$MIR)) { - self::$MIR = new CreditCard('mir'); - } - return self::$MIR; - } - public static function MAESTRO(): CreditCard - { - if (!isset(self::$MAESTRO)) { - self::$MAESTRO = new CreditCard('maestro'); - } - return self::$MAESTRO; - } -} \ No newline at end of file diff --git a/src/Appwrite/Enums/ExecutionMethod.php b/src/Appwrite/Enums/ExecutionMethod.php deleted file mode 100644 index 9ffea9c..0000000 --- a/src/Appwrite/Enums/ExecutionMethod.php +++ /dev/null @@ -1,75 +0,0 @@ -<?php - -namespace Appwrite\Enums; - -use JsonSerializable; - -class ExecutionMethod implements JsonSerializable -{ - private static ExecutionMethod $GET; - private static ExecutionMethod $POST; - private static ExecutionMethod $PUT; - private static ExecutionMethod $PATCH; - private static ExecutionMethod $DELETE; - private static ExecutionMethod $OPTIONS; - - private string $value; - - private function __construct(string $value) - { - $this->value = $value; - } - - public function __toString(): string - { - return $this->value; - } - - public function jsonSerialize(): string - { - return $this->value; - } - - public static function GET(): ExecutionMethod - { - if (!isset(self::$GET)) { - self::$GET = new ExecutionMethod('GET'); - } - return self::$GET; - } - public static function POST(): ExecutionMethod - { - if (!isset(self::$POST)) { - self::$POST = new ExecutionMethod('POST'); - } - return self::$POST; - } - public static function PUT(): ExecutionMethod - { - if (!isset(self::$PUT)) { - self::$PUT = new ExecutionMethod('PUT'); - } - return self::$PUT; - } - public static function PATCH(): ExecutionMethod - { - if (!isset(self::$PATCH)) { - self::$PATCH = new ExecutionMethod('PATCH'); - } - return self::$PATCH; - } - public static function DELETE(): ExecutionMethod - { - if (!isset(self::$DELETE)) { - self::$DELETE = new ExecutionMethod('DELETE'); - } - return self::$DELETE; - } - public static function OPTIONS(): ExecutionMethod - { - if (!isset(self::$OPTIONS)) { - self::$OPTIONS = new ExecutionMethod('OPTIONS'); - } - return self::$OPTIONS; - } -} \ No newline at end of file diff --git a/src/Appwrite/Enums/Flag.php b/src/Appwrite/Enums/Flag.php deleted file mode 100644 index e7145b1..0000000 --- a/src/Appwrite/Enums/Flag.php +++ /dev/null @@ -1,1587 +0,0 @@ -<?php - -namespace Appwrite\Enums; - -use JsonSerializable; - -class Flag implements JsonSerializable -{ - private static Flag $AFGHANISTAN; - private static Flag $ANGOLA; - private static Flag $ALBANIA; - private static Flag $ANDORRA; - private static Flag $UNITEDARABEMIRATES; - private static Flag $ARGENTINA; - private static Flag $ARMENIA; - private static Flag $ANTIGUAANDBARBUDA; - private static Flag $AUSTRALIA; - private static Flag $AUSTRIA; - private static Flag $AZERBAIJAN; - private static Flag $BURUNDI; - private static Flag $BELGIUM; - private static Flag $BENIN; - private static Flag $BURKINAFASO; - private static Flag $BANGLADESH; - private static Flag $BULGARIA; - private static Flag $BAHRAIN; - private static Flag $BAHAMAS; - private static Flag $BOSNIAANDHERZEGOVINA; - private static Flag $BELARUS; - private static Flag $BELIZE; - private static Flag $BOLIVIA; - private static Flag $BRAZIL; - private static Flag $BARBADOS; - private static Flag $BRUNEIDARUSSALAM; - private static Flag $BHUTAN; - private static Flag $BOTSWANA; - private static Flag $CENTRALAFRICANREPUBLIC; - private static Flag $CANADA; - private static Flag $SWITZERLAND; - private static Flag $CHILE; - private static Flag $CHINA; - private static Flag $CTEDIVOIRE; - private static Flag $CAMEROON; - private static Flag $DEMOCRATICREPUBLICOFTHECONGO; - private static Flag $REPUBLICOFTHECONGO; - private static Flag $COLOMBIA; - private static Flag $COMOROS; - private static Flag $CAPEVERDE; - private static Flag $COSTARICA; - private static Flag $CUBA; - private static Flag $CYPRUS; - private static Flag $CZECHREPUBLIC; - private static Flag $GERMANY; - private static Flag $DJIBOUTI; - private static Flag $DOMINICA; - private static Flag $DENMARK; - private static Flag $DOMINICANREPUBLIC; - private static Flag $ALGERIA; - private static Flag $ECUADOR; - private static Flag $EGYPT; - private static Flag $ERITREA; - private static Flag $SPAIN; - private static Flag $ESTONIA; - private static Flag $ETHIOPIA; - private static Flag $FINLAND; - private static Flag $FIJI; - private static Flag $FRANCE; - private static Flag $MICRONESIAFEDERATEDSTATESOF; - private static Flag $GABON; - private static Flag $UNITEDKINGDOM; - private static Flag $GEORGIA; - private static Flag $GHANA; - private static Flag $GUINEA; - private static Flag $GAMBIA; - private static Flag $GUINEABISSAU; - private static Flag $EQUATORIALGUINEA; - private static Flag $GREECE; - private static Flag $GRENADA; - private static Flag $GUATEMALA; - private static Flag $GUYANA; - private static Flag $HONDURAS; - private static Flag $CROATIA; - private static Flag $HAITI; - private static Flag $HUNGARY; - private static Flag $INDONESIA; - private static Flag $INDIA; - private static Flag $IRELAND; - private static Flag $IRANISLAMICREPUBLICOF; - private static Flag $IRAQ; - private static Flag $ICELAND; - private static Flag $ISRAEL; - private static Flag $ITALY; - private static Flag $JAMAICA; - private static Flag $JORDAN; - private static Flag $JAPAN; - private static Flag $KAZAKHSTAN; - private static Flag $KENYA; - private static Flag $KYRGYZSTAN; - private static Flag $CAMBODIA; - private static Flag $KIRIBATI; - private static Flag $SAINTKITTSANDNEVIS; - private static Flag $SOUTHKOREA; - private static Flag $KUWAIT; - private static Flag $LAOPEOPLESDEMOCRATICREPUBLIC; - private static Flag $LEBANON; - private static Flag $LIBERIA; - private static Flag $LIBYA; - private static Flag $SAINTLUCIA; - private static Flag $LIECHTENSTEIN; - private static Flag $SRILANKA; - private static Flag $LESOTHO; - private static Flag $LITHUANIA; - private static Flag $LUXEMBOURG; - private static Flag $LATVIA; - private static Flag $MOROCCO; - private static Flag $MONACO; - private static Flag $MOLDOVA; - private static Flag $MADAGASCAR; - private static Flag $MALDIVES; - private static Flag $MEXICO; - private static Flag $MARSHALLISLANDS; - private static Flag $NORTHMACEDONIA; - private static Flag $MALI; - private static Flag $MALTA; - private static Flag $MYANMAR; - private static Flag $MONTENEGRO; - private static Flag $MONGOLIA; - private static Flag $MOZAMBIQUE; - private static Flag $MAURITANIA; - private static Flag $MAURITIUS; - private static Flag $MALAWI; - private static Flag $MALAYSIA; - private static Flag $NAMIBIA; - private static Flag $NIGER; - private static Flag $NIGERIA; - private static Flag $NICARAGUA; - private static Flag $NETHERLANDS; - private static Flag $NORWAY; - private static Flag $NEPAL; - private static Flag $NAURU; - private static Flag $NEWZEALAND; - private static Flag $OMAN; - private static Flag $PAKISTAN; - private static Flag $PANAMA; - private static Flag $PERU; - private static Flag $PHILIPPINES; - private static Flag $PALAU; - private static Flag $PAPUANEWGUINEA; - private static Flag $POLAND; - private static Flag $FRENCHPOLYNESIA; - private static Flag $NORTHKOREA; - private static Flag $PORTUGAL; - private static Flag $PARAGUAY; - private static Flag $QATAR; - private static Flag $ROMANIA; - private static Flag $RUSSIA; - private static Flag $RWANDA; - private static Flag $SAUDIARABIA; - private static Flag $SUDAN; - private static Flag $SENEGAL; - private static Flag $SINGAPORE; - private static Flag $SOLOMONISLANDS; - private static Flag $SIERRALEONE; - private static Flag $ELSALVADOR; - private static Flag $SANMARINO; - private static Flag $SOMALIA; - private static Flag $SERBIA; - private static Flag $SOUTHSUDAN; - private static Flag $SAOTOMEANDPRINCIPE; - private static Flag $SURINAME; - private static Flag $SLOVAKIA; - private static Flag $SLOVENIA; - private static Flag $SWEDEN; - private static Flag $ESWATINI; - private static Flag $SEYCHELLES; - private static Flag $SYRIA; - private static Flag $CHAD; - private static Flag $TOGO; - private static Flag $THAILAND; - private static Flag $TAJIKISTAN; - private static Flag $TURKMENISTAN; - private static Flag $TIMORLESTE; - private static Flag $TONGA; - private static Flag $TRINIDADANDTOBAGO; - private static Flag $TUNISIA; - private static Flag $TURKEY; - private static Flag $TUVALU; - private static Flag $TANZANIA; - private static Flag $UGANDA; - private static Flag $UKRAINE; - private static Flag $URUGUAY; - private static Flag $UNITEDSTATES; - private static Flag $UZBEKISTAN; - private static Flag $VATICANCITY; - private static Flag $SAINTVINCENTANDTHEGRENADINES; - private static Flag $VENEZUELA; - private static Flag $VIETNAM; - private static Flag $VANUATU; - private static Flag $SAMOA; - private static Flag $YEMEN; - private static Flag $SOUTHAFRICA; - private static Flag $ZAMBIA; - private static Flag $ZIMBABWE; - - private string $value; - - private function __construct(string $value) - { - $this->value = $value; - } - - public function __toString(): string - { - return $this->value; - } - - public function jsonSerialize(): string - { - return $this->value; - } - - public static function AFGHANISTAN(): Flag - { - if (!isset(self::$AFGHANISTAN)) { - self::$AFGHANISTAN = new Flag('af'); - } - return self::$AFGHANISTAN; - } - public static function ANGOLA(): Flag - { - if (!isset(self::$ANGOLA)) { - self::$ANGOLA = new Flag('ao'); - } - return self::$ANGOLA; - } - public static function ALBANIA(): Flag - { - if (!isset(self::$ALBANIA)) { - self::$ALBANIA = new Flag('al'); - } - return self::$ALBANIA; - } - public static function ANDORRA(): Flag - { - if (!isset(self::$ANDORRA)) { - self::$ANDORRA = new Flag('ad'); - } - return self::$ANDORRA; - } - public static function UNITEDARABEMIRATES(): Flag - { - if (!isset(self::$UNITEDARABEMIRATES)) { - self::$UNITEDARABEMIRATES = new Flag('ae'); - } - return self::$UNITEDARABEMIRATES; - } - public static function ARGENTINA(): Flag - { - if (!isset(self::$ARGENTINA)) { - self::$ARGENTINA = new Flag('ar'); - } - return self::$ARGENTINA; - } - public static function ARMENIA(): Flag - { - if (!isset(self::$ARMENIA)) { - self::$ARMENIA = new Flag('am'); - } - return self::$ARMENIA; - } - public static function ANTIGUAANDBARBUDA(): Flag - { - if (!isset(self::$ANTIGUAANDBARBUDA)) { - self::$ANTIGUAANDBARBUDA = new Flag('ag'); - } - return self::$ANTIGUAANDBARBUDA; - } - public static function AUSTRALIA(): Flag - { - if (!isset(self::$AUSTRALIA)) { - self::$AUSTRALIA = new Flag('au'); - } - return self::$AUSTRALIA; - } - public static function AUSTRIA(): Flag - { - if (!isset(self::$AUSTRIA)) { - self::$AUSTRIA = new Flag('at'); - } - return self::$AUSTRIA; - } - public static function AZERBAIJAN(): Flag - { - if (!isset(self::$AZERBAIJAN)) { - self::$AZERBAIJAN = new Flag('az'); - } - return self::$AZERBAIJAN; - } - public static function BURUNDI(): Flag - { - if (!isset(self::$BURUNDI)) { - self::$BURUNDI = new Flag('bi'); - } - return self::$BURUNDI; - } - public static function BELGIUM(): Flag - { - if (!isset(self::$BELGIUM)) { - self::$BELGIUM = new Flag('be'); - } - return self::$BELGIUM; - } - public static function BENIN(): Flag - { - if (!isset(self::$BENIN)) { - self::$BENIN = new Flag('bj'); - } - return self::$BENIN; - } - public static function BURKINAFASO(): Flag - { - if (!isset(self::$BURKINAFASO)) { - self::$BURKINAFASO = new Flag('bf'); - } - return self::$BURKINAFASO; - } - public static function BANGLADESH(): Flag - { - if (!isset(self::$BANGLADESH)) { - self::$BANGLADESH = new Flag('bd'); - } - return self::$BANGLADESH; - } - public static function BULGARIA(): Flag - { - if (!isset(self::$BULGARIA)) { - self::$BULGARIA = new Flag('bg'); - } - return self::$BULGARIA; - } - public static function BAHRAIN(): Flag - { - if (!isset(self::$BAHRAIN)) { - self::$BAHRAIN = new Flag('bh'); - } - return self::$BAHRAIN; - } - public static function BAHAMAS(): Flag - { - if (!isset(self::$BAHAMAS)) { - self::$BAHAMAS = new Flag('bs'); - } - return self::$BAHAMAS; - } - public static function BOSNIAANDHERZEGOVINA(): Flag - { - if (!isset(self::$BOSNIAANDHERZEGOVINA)) { - self::$BOSNIAANDHERZEGOVINA = new Flag('ba'); - } - return self::$BOSNIAANDHERZEGOVINA; - } - public static function BELARUS(): Flag - { - if (!isset(self::$BELARUS)) { - self::$BELARUS = new Flag('by'); - } - return self::$BELARUS; - } - public static function BELIZE(): Flag - { - if (!isset(self::$BELIZE)) { - self::$BELIZE = new Flag('bz'); - } - return self::$BELIZE; - } - public static function BOLIVIA(): Flag - { - if (!isset(self::$BOLIVIA)) { - self::$BOLIVIA = new Flag('bo'); - } - return self::$BOLIVIA; - } - public static function BRAZIL(): Flag - { - if (!isset(self::$BRAZIL)) { - self::$BRAZIL = new Flag('br'); - } - return self::$BRAZIL; - } - public static function BARBADOS(): Flag - { - if (!isset(self::$BARBADOS)) { - self::$BARBADOS = new Flag('bb'); - } - return self::$BARBADOS; - } - public static function BRUNEIDARUSSALAM(): Flag - { - if (!isset(self::$BRUNEIDARUSSALAM)) { - self::$BRUNEIDARUSSALAM = new Flag('bn'); - } - return self::$BRUNEIDARUSSALAM; - } - public static function BHUTAN(): Flag - { - if (!isset(self::$BHUTAN)) { - self::$BHUTAN = new Flag('bt'); - } - return self::$BHUTAN; - } - public static function BOTSWANA(): Flag - { - if (!isset(self::$BOTSWANA)) { - self::$BOTSWANA = new Flag('bw'); - } - return self::$BOTSWANA; - } - public static function CENTRALAFRICANREPUBLIC(): Flag - { - if (!isset(self::$CENTRALAFRICANREPUBLIC)) { - self::$CENTRALAFRICANREPUBLIC = new Flag('cf'); - } - return self::$CENTRALAFRICANREPUBLIC; - } - public static function CANADA(): Flag - { - if (!isset(self::$CANADA)) { - self::$CANADA = new Flag('ca'); - } - return self::$CANADA; - } - public static function SWITZERLAND(): Flag - { - if (!isset(self::$SWITZERLAND)) { - self::$SWITZERLAND = new Flag('ch'); - } - return self::$SWITZERLAND; - } - public static function CHILE(): Flag - { - if (!isset(self::$CHILE)) { - self::$CHILE = new Flag('cl'); - } - return self::$CHILE; - } - public static function CHINA(): Flag - { - if (!isset(self::$CHINA)) { - self::$CHINA = new Flag('cn'); - } - return self::$CHINA; - } - public static function CTEDIVOIRE(): Flag - { - if (!isset(self::$CTEDIVOIRE)) { - self::$CTEDIVOIRE = new Flag('ci'); - } - return self::$CTEDIVOIRE; - } - public static function CAMEROON(): Flag - { - if (!isset(self::$CAMEROON)) { - self::$CAMEROON = new Flag('cm'); - } - return self::$CAMEROON; - } - public static function DEMOCRATICREPUBLICOFTHECONGO(): Flag - { - if (!isset(self::$DEMOCRATICREPUBLICOFTHECONGO)) { - self::$DEMOCRATICREPUBLICOFTHECONGO = new Flag('cd'); - } - return self::$DEMOCRATICREPUBLICOFTHECONGO; - } - public static function REPUBLICOFTHECONGO(): Flag - { - if (!isset(self::$REPUBLICOFTHECONGO)) { - self::$REPUBLICOFTHECONGO = new Flag('cg'); - } - return self::$REPUBLICOFTHECONGO; - } - public static function COLOMBIA(): Flag - { - if (!isset(self::$COLOMBIA)) { - self::$COLOMBIA = new Flag('co'); - } - return self::$COLOMBIA; - } - public static function COMOROS(): Flag - { - if (!isset(self::$COMOROS)) { - self::$COMOROS = new Flag('km'); - } - return self::$COMOROS; - } - public static function CAPEVERDE(): Flag - { - if (!isset(self::$CAPEVERDE)) { - self::$CAPEVERDE = new Flag('cv'); - } - return self::$CAPEVERDE; - } - public static function COSTARICA(): Flag - { - if (!isset(self::$COSTARICA)) { - self::$COSTARICA = new Flag('cr'); - } - return self::$COSTARICA; - } - public static function CUBA(): Flag - { - if (!isset(self::$CUBA)) { - self::$CUBA = new Flag('cu'); - } - return self::$CUBA; - } - public static function CYPRUS(): Flag - { - if (!isset(self::$CYPRUS)) { - self::$CYPRUS = new Flag('cy'); - } - return self::$CYPRUS; - } - public static function CZECHREPUBLIC(): Flag - { - if (!isset(self::$CZECHREPUBLIC)) { - self::$CZECHREPUBLIC = new Flag('cz'); - } - return self::$CZECHREPUBLIC; - } - public static function GERMANY(): Flag - { - if (!isset(self::$GERMANY)) { - self::$GERMANY = new Flag('de'); - } - return self::$GERMANY; - } - public static function DJIBOUTI(): Flag - { - if (!isset(self::$DJIBOUTI)) { - self::$DJIBOUTI = new Flag('dj'); - } - return self::$DJIBOUTI; - } - public static function DOMINICA(): Flag - { - if (!isset(self::$DOMINICA)) { - self::$DOMINICA = new Flag('dm'); - } - return self::$DOMINICA; - } - public static function DENMARK(): Flag - { - if (!isset(self::$DENMARK)) { - self::$DENMARK = new Flag('dk'); - } - return self::$DENMARK; - } - public static function DOMINICANREPUBLIC(): Flag - { - if (!isset(self::$DOMINICANREPUBLIC)) { - self::$DOMINICANREPUBLIC = new Flag('do'); - } - return self::$DOMINICANREPUBLIC; - } - public static function ALGERIA(): Flag - { - if (!isset(self::$ALGERIA)) { - self::$ALGERIA = new Flag('dz'); - } - return self::$ALGERIA; - } - public static function ECUADOR(): Flag - { - if (!isset(self::$ECUADOR)) { - self::$ECUADOR = new Flag('ec'); - } - return self::$ECUADOR; - } - public static function EGYPT(): Flag - { - if (!isset(self::$EGYPT)) { - self::$EGYPT = new Flag('eg'); - } - return self::$EGYPT; - } - public static function ERITREA(): Flag - { - if (!isset(self::$ERITREA)) { - self::$ERITREA = new Flag('er'); - } - return self::$ERITREA; - } - public static function SPAIN(): Flag - { - if (!isset(self::$SPAIN)) { - self::$SPAIN = new Flag('es'); - } - return self::$SPAIN; - } - public static function ESTONIA(): Flag - { - if (!isset(self::$ESTONIA)) { - self::$ESTONIA = new Flag('ee'); - } - return self::$ESTONIA; - } - public static function ETHIOPIA(): Flag - { - if (!isset(self::$ETHIOPIA)) { - self::$ETHIOPIA = new Flag('et'); - } - return self::$ETHIOPIA; - } - public static function FINLAND(): Flag - { - if (!isset(self::$FINLAND)) { - self::$FINLAND = new Flag('fi'); - } - return self::$FINLAND; - } - public static function FIJI(): Flag - { - if (!isset(self::$FIJI)) { - self::$FIJI = new Flag('fj'); - } - return self::$FIJI; - } - public static function FRANCE(): Flag - { - if (!isset(self::$FRANCE)) { - self::$FRANCE = new Flag('fr'); - } - return self::$FRANCE; - } - public static function MICRONESIAFEDERATEDSTATESOF(): Flag - { - if (!isset(self::$MICRONESIAFEDERATEDSTATESOF)) { - self::$MICRONESIAFEDERATEDSTATESOF = new Flag('fm'); - } - return self::$MICRONESIAFEDERATEDSTATESOF; - } - public static function GABON(): Flag - { - if (!isset(self::$GABON)) { - self::$GABON = new Flag('ga'); - } - return self::$GABON; - } - public static function UNITEDKINGDOM(): Flag - { - if (!isset(self::$UNITEDKINGDOM)) { - self::$UNITEDKINGDOM = new Flag('gb'); - } - return self::$UNITEDKINGDOM; - } - public static function GEORGIA(): Flag - { - if (!isset(self::$GEORGIA)) { - self::$GEORGIA = new Flag('ge'); - } - return self::$GEORGIA; - } - public static function GHANA(): Flag - { - if (!isset(self::$GHANA)) { - self::$GHANA = new Flag('gh'); - } - return self::$GHANA; - } - public static function GUINEA(): Flag - { - if (!isset(self::$GUINEA)) { - self::$GUINEA = new Flag('gn'); - } - return self::$GUINEA; - } - public static function GAMBIA(): Flag - { - if (!isset(self::$GAMBIA)) { - self::$GAMBIA = new Flag('gm'); - } - return self::$GAMBIA; - } - public static function GUINEABISSAU(): Flag - { - if (!isset(self::$GUINEABISSAU)) { - self::$GUINEABISSAU = new Flag('gw'); - } - return self::$GUINEABISSAU; - } - public static function EQUATORIALGUINEA(): Flag - { - if (!isset(self::$EQUATORIALGUINEA)) { - self::$EQUATORIALGUINEA = new Flag('gq'); - } - return self::$EQUATORIALGUINEA; - } - public static function GREECE(): Flag - { - if (!isset(self::$GREECE)) { - self::$GREECE = new Flag('gr'); - } - return self::$GREECE; - } - public static function GRENADA(): Flag - { - if (!isset(self::$GRENADA)) { - self::$GRENADA = new Flag('gd'); - } - return self::$GRENADA; - } - public static function GUATEMALA(): Flag - { - if (!isset(self::$GUATEMALA)) { - self::$GUATEMALA = new Flag('gt'); - } - return self::$GUATEMALA; - } - public static function GUYANA(): Flag - { - if (!isset(self::$GUYANA)) { - self::$GUYANA = new Flag('gy'); - } - return self::$GUYANA; - } - public static function HONDURAS(): Flag - { - if (!isset(self::$HONDURAS)) { - self::$HONDURAS = new Flag('hn'); - } - return self::$HONDURAS; - } - public static function CROATIA(): Flag - { - if (!isset(self::$CROATIA)) { - self::$CROATIA = new Flag('hr'); - } - return self::$CROATIA; - } - public static function HAITI(): Flag - { - if (!isset(self::$HAITI)) { - self::$HAITI = new Flag('ht'); - } - return self::$HAITI; - } - public static function HUNGARY(): Flag - { - if (!isset(self::$HUNGARY)) { - self::$HUNGARY = new Flag('hu'); - } - return self::$HUNGARY; - } - public static function INDONESIA(): Flag - { - if (!isset(self::$INDONESIA)) { - self::$INDONESIA = new Flag('id'); - } - return self::$INDONESIA; - } - public static function INDIA(): Flag - { - if (!isset(self::$INDIA)) { - self::$INDIA = new Flag('in'); - } - return self::$INDIA; - } - public static function IRELAND(): Flag - { - if (!isset(self::$IRELAND)) { - self::$IRELAND = new Flag('ie'); - } - return self::$IRELAND; - } - public static function IRANISLAMICREPUBLICOF(): Flag - { - if (!isset(self::$IRANISLAMICREPUBLICOF)) { - self::$IRANISLAMICREPUBLICOF = new Flag('ir'); - } - return self::$IRANISLAMICREPUBLICOF; - } - public static function IRAQ(): Flag - { - if (!isset(self::$IRAQ)) { - self::$IRAQ = new Flag('iq'); - } - return self::$IRAQ; - } - public static function ICELAND(): Flag - { - if (!isset(self::$ICELAND)) { - self::$ICELAND = new Flag('is'); - } - return self::$ICELAND; - } - public static function ISRAEL(): Flag - { - if (!isset(self::$ISRAEL)) { - self::$ISRAEL = new Flag('il'); - } - return self::$ISRAEL; - } - public static function ITALY(): Flag - { - if (!isset(self::$ITALY)) { - self::$ITALY = new Flag('it'); - } - return self::$ITALY; - } - public static function JAMAICA(): Flag - { - if (!isset(self::$JAMAICA)) { - self::$JAMAICA = new Flag('jm'); - } - return self::$JAMAICA; - } - public static function JORDAN(): Flag - { - if (!isset(self::$JORDAN)) { - self::$JORDAN = new Flag('jo'); - } - return self::$JORDAN; - } - public static function JAPAN(): Flag - { - if (!isset(self::$JAPAN)) { - self::$JAPAN = new Flag('jp'); - } - return self::$JAPAN; - } - public static function KAZAKHSTAN(): Flag - { - if (!isset(self::$KAZAKHSTAN)) { - self::$KAZAKHSTAN = new Flag('kz'); - } - return self::$KAZAKHSTAN; - } - public static function KENYA(): Flag - { - if (!isset(self::$KENYA)) { - self::$KENYA = new Flag('ke'); - } - return self::$KENYA; - } - public static function KYRGYZSTAN(): Flag - { - if (!isset(self::$KYRGYZSTAN)) { - self::$KYRGYZSTAN = new Flag('kg'); - } - return self::$KYRGYZSTAN; - } - public static function CAMBODIA(): Flag - { - if (!isset(self::$CAMBODIA)) { - self::$CAMBODIA = new Flag('kh'); - } - return self::$CAMBODIA; - } - public static function KIRIBATI(): Flag - { - if (!isset(self::$KIRIBATI)) { - self::$KIRIBATI = new Flag('ki'); - } - return self::$KIRIBATI; - } - public static function SAINTKITTSANDNEVIS(): Flag - { - if (!isset(self::$SAINTKITTSANDNEVIS)) { - self::$SAINTKITTSANDNEVIS = new Flag('kn'); - } - return self::$SAINTKITTSANDNEVIS; - } - public static function SOUTHKOREA(): Flag - { - if (!isset(self::$SOUTHKOREA)) { - self::$SOUTHKOREA = new Flag('kr'); - } - return self::$SOUTHKOREA; - } - public static function KUWAIT(): Flag - { - if (!isset(self::$KUWAIT)) { - self::$KUWAIT = new Flag('kw'); - } - return self::$KUWAIT; - } - public static function LAOPEOPLESDEMOCRATICREPUBLIC(): Flag - { - if (!isset(self::$LAOPEOPLESDEMOCRATICREPUBLIC)) { - self::$LAOPEOPLESDEMOCRATICREPUBLIC = new Flag('la'); - } - return self::$LAOPEOPLESDEMOCRATICREPUBLIC; - } - public static function LEBANON(): Flag - { - if (!isset(self::$LEBANON)) { - self::$LEBANON = new Flag('lb'); - } - return self::$LEBANON; - } - public static function LIBERIA(): Flag - { - if (!isset(self::$LIBERIA)) { - self::$LIBERIA = new Flag('lr'); - } - return self::$LIBERIA; - } - public static function LIBYA(): Flag - { - if (!isset(self::$LIBYA)) { - self::$LIBYA = new Flag('ly'); - } - return self::$LIBYA; - } - public static function SAINTLUCIA(): Flag - { - if (!isset(self::$SAINTLUCIA)) { - self::$SAINTLUCIA = new Flag('lc'); - } - return self::$SAINTLUCIA; - } - public static function LIECHTENSTEIN(): Flag - { - if (!isset(self::$LIECHTENSTEIN)) { - self::$LIECHTENSTEIN = new Flag('li'); - } - return self::$LIECHTENSTEIN; - } - public static function SRILANKA(): Flag - { - if (!isset(self::$SRILANKA)) { - self::$SRILANKA = new Flag('lk'); - } - return self::$SRILANKA; - } - public static function LESOTHO(): Flag - { - if (!isset(self::$LESOTHO)) { - self::$LESOTHO = new Flag('ls'); - } - return self::$LESOTHO; - } - public static function LITHUANIA(): Flag - { - if (!isset(self::$LITHUANIA)) { - self::$LITHUANIA = new Flag('lt'); - } - return self::$LITHUANIA; - } - public static function LUXEMBOURG(): Flag - { - if (!isset(self::$LUXEMBOURG)) { - self::$LUXEMBOURG = new Flag('lu'); - } - return self::$LUXEMBOURG; - } - public static function LATVIA(): Flag - { - if (!isset(self::$LATVIA)) { - self::$LATVIA = new Flag('lv'); - } - return self::$LATVIA; - } - public static function MOROCCO(): Flag - { - if (!isset(self::$MOROCCO)) { - self::$MOROCCO = new Flag('ma'); - } - return self::$MOROCCO; - } - public static function MONACO(): Flag - { - if (!isset(self::$MONACO)) { - self::$MONACO = new Flag('mc'); - } - return self::$MONACO; - } - public static function MOLDOVA(): Flag - { - if (!isset(self::$MOLDOVA)) { - self::$MOLDOVA = new Flag('md'); - } - return self::$MOLDOVA; - } - public static function MADAGASCAR(): Flag - { - if (!isset(self::$MADAGASCAR)) { - self::$MADAGASCAR = new Flag('mg'); - } - return self::$MADAGASCAR; - } - public static function MALDIVES(): Flag - { - if (!isset(self::$MALDIVES)) { - self::$MALDIVES = new Flag('mv'); - } - return self::$MALDIVES; - } - public static function MEXICO(): Flag - { - if (!isset(self::$MEXICO)) { - self::$MEXICO = new Flag('mx'); - } - return self::$MEXICO; - } - public static function MARSHALLISLANDS(): Flag - { - if (!isset(self::$MARSHALLISLANDS)) { - self::$MARSHALLISLANDS = new Flag('mh'); - } - return self::$MARSHALLISLANDS; - } - public static function NORTHMACEDONIA(): Flag - { - if (!isset(self::$NORTHMACEDONIA)) { - self::$NORTHMACEDONIA = new Flag('mk'); - } - return self::$NORTHMACEDONIA; - } - public static function MALI(): Flag - { - if (!isset(self::$MALI)) { - self::$MALI = new Flag('ml'); - } - return self::$MALI; - } - public static function MALTA(): Flag - { - if (!isset(self::$MALTA)) { - self::$MALTA = new Flag('mt'); - } - return self::$MALTA; - } - public static function MYANMAR(): Flag - { - if (!isset(self::$MYANMAR)) { - self::$MYANMAR = new Flag('mm'); - } - return self::$MYANMAR; - } - public static function MONTENEGRO(): Flag - { - if (!isset(self::$MONTENEGRO)) { - self::$MONTENEGRO = new Flag('me'); - } - return self::$MONTENEGRO; - } - public static function MONGOLIA(): Flag - { - if (!isset(self::$MONGOLIA)) { - self::$MONGOLIA = new Flag('mn'); - } - return self::$MONGOLIA; - } - public static function MOZAMBIQUE(): Flag - { - if (!isset(self::$MOZAMBIQUE)) { - self::$MOZAMBIQUE = new Flag('mz'); - } - return self::$MOZAMBIQUE; - } - public static function MAURITANIA(): Flag - { - if (!isset(self::$MAURITANIA)) { - self::$MAURITANIA = new Flag('mr'); - } - return self::$MAURITANIA; - } - public static function MAURITIUS(): Flag - { - if (!isset(self::$MAURITIUS)) { - self::$MAURITIUS = new Flag('mu'); - } - return self::$MAURITIUS; - } - public static function MALAWI(): Flag - { - if (!isset(self::$MALAWI)) { - self::$MALAWI = new Flag('mw'); - } - return self::$MALAWI; - } - public static function MALAYSIA(): Flag - { - if (!isset(self::$MALAYSIA)) { - self::$MALAYSIA = new Flag('my'); - } - return self::$MALAYSIA; - } - public static function NAMIBIA(): Flag - { - if (!isset(self::$NAMIBIA)) { - self::$NAMIBIA = new Flag('na'); - } - return self::$NAMIBIA; - } - public static function NIGER(): Flag - { - if (!isset(self::$NIGER)) { - self::$NIGER = new Flag('ne'); - } - return self::$NIGER; - } - public static function NIGERIA(): Flag - { - if (!isset(self::$NIGERIA)) { - self::$NIGERIA = new Flag('ng'); - } - return self::$NIGERIA; - } - public static function NICARAGUA(): Flag - { - if (!isset(self::$NICARAGUA)) { - self::$NICARAGUA = new Flag('ni'); - } - return self::$NICARAGUA; - } - public static function NETHERLANDS(): Flag - { - if (!isset(self::$NETHERLANDS)) { - self::$NETHERLANDS = new Flag('nl'); - } - return self::$NETHERLANDS; - } - public static function NORWAY(): Flag - { - if (!isset(self::$NORWAY)) { - self::$NORWAY = new Flag('no'); - } - return self::$NORWAY; - } - public static function NEPAL(): Flag - { - if (!isset(self::$NEPAL)) { - self::$NEPAL = new Flag('np'); - } - return self::$NEPAL; - } - public static function NAURU(): Flag - { - if (!isset(self::$NAURU)) { - self::$NAURU = new Flag('nr'); - } - return self::$NAURU; - } - public static function NEWZEALAND(): Flag - { - if (!isset(self::$NEWZEALAND)) { - self::$NEWZEALAND = new Flag('nz'); - } - return self::$NEWZEALAND; - } - public static function OMAN(): Flag - { - if (!isset(self::$OMAN)) { - self::$OMAN = new Flag('om'); - } - return self::$OMAN; - } - public static function PAKISTAN(): Flag - { - if (!isset(self::$PAKISTAN)) { - self::$PAKISTAN = new Flag('pk'); - } - return self::$PAKISTAN; - } - public static function PANAMA(): Flag - { - if (!isset(self::$PANAMA)) { - self::$PANAMA = new Flag('pa'); - } - return self::$PANAMA; - } - public static function PERU(): Flag - { - if (!isset(self::$PERU)) { - self::$PERU = new Flag('pe'); - } - return self::$PERU; - } - public static function PHILIPPINES(): Flag - { - if (!isset(self::$PHILIPPINES)) { - self::$PHILIPPINES = new Flag('ph'); - } - return self::$PHILIPPINES; - } - public static function PALAU(): Flag - { - if (!isset(self::$PALAU)) { - self::$PALAU = new Flag('pw'); - } - return self::$PALAU; - } - public static function PAPUANEWGUINEA(): Flag - { - if (!isset(self::$PAPUANEWGUINEA)) { - self::$PAPUANEWGUINEA = new Flag('pg'); - } - return self::$PAPUANEWGUINEA; - } - public static function POLAND(): Flag - { - if (!isset(self::$POLAND)) { - self::$POLAND = new Flag('pl'); - } - return self::$POLAND; - } - public static function FRENCHPOLYNESIA(): Flag - { - if (!isset(self::$FRENCHPOLYNESIA)) { - self::$FRENCHPOLYNESIA = new Flag('pf'); - } - return self::$FRENCHPOLYNESIA; - } - public static function NORTHKOREA(): Flag - { - if (!isset(self::$NORTHKOREA)) { - self::$NORTHKOREA = new Flag('kp'); - } - return self::$NORTHKOREA; - } - public static function PORTUGAL(): Flag - { - if (!isset(self::$PORTUGAL)) { - self::$PORTUGAL = new Flag('pt'); - } - return self::$PORTUGAL; - } - public static function PARAGUAY(): Flag - { - if (!isset(self::$PARAGUAY)) { - self::$PARAGUAY = new Flag('py'); - } - return self::$PARAGUAY; - } - public static function QATAR(): Flag - { - if (!isset(self::$QATAR)) { - self::$QATAR = new Flag('qa'); - } - return self::$QATAR; - } - public static function ROMANIA(): Flag - { - if (!isset(self::$ROMANIA)) { - self::$ROMANIA = new Flag('ro'); - } - return self::$ROMANIA; - } - public static function RUSSIA(): Flag - { - if (!isset(self::$RUSSIA)) { - self::$RUSSIA = new Flag('ru'); - } - return self::$RUSSIA; - } - public static function RWANDA(): Flag - { - if (!isset(self::$RWANDA)) { - self::$RWANDA = new Flag('rw'); - } - return self::$RWANDA; - } - public static function SAUDIARABIA(): Flag - { - if (!isset(self::$SAUDIARABIA)) { - self::$SAUDIARABIA = new Flag('sa'); - } - return self::$SAUDIARABIA; - } - public static function SUDAN(): Flag - { - if (!isset(self::$SUDAN)) { - self::$SUDAN = new Flag('sd'); - } - return self::$SUDAN; - } - public static function SENEGAL(): Flag - { - if (!isset(self::$SENEGAL)) { - self::$SENEGAL = new Flag('sn'); - } - return self::$SENEGAL; - } - public static function SINGAPORE(): Flag - { - if (!isset(self::$SINGAPORE)) { - self::$SINGAPORE = new Flag('sg'); - } - return self::$SINGAPORE; - } - public static function SOLOMONISLANDS(): Flag - { - if (!isset(self::$SOLOMONISLANDS)) { - self::$SOLOMONISLANDS = new Flag('sb'); - } - return self::$SOLOMONISLANDS; - } - public static function SIERRALEONE(): Flag - { - if (!isset(self::$SIERRALEONE)) { - self::$SIERRALEONE = new Flag('sl'); - } - return self::$SIERRALEONE; - } - public static function ELSALVADOR(): Flag - { - if (!isset(self::$ELSALVADOR)) { - self::$ELSALVADOR = new Flag('sv'); - } - return self::$ELSALVADOR; - } - public static function SANMARINO(): Flag - { - if (!isset(self::$SANMARINO)) { - self::$SANMARINO = new Flag('sm'); - } - return self::$SANMARINO; - } - public static function SOMALIA(): Flag - { - if (!isset(self::$SOMALIA)) { - self::$SOMALIA = new Flag('so'); - } - return self::$SOMALIA; - } - public static function SERBIA(): Flag - { - if (!isset(self::$SERBIA)) { - self::$SERBIA = new Flag('rs'); - } - return self::$SERBIA; - } - public static function SOUTHSUDAN(): Flag - { - if (!isset(self::$SOUTHSUDAN)) { - self::$SOUTHSUDAN = new Flag('ss'); - } - return self::$SOUTHSUDAN; - } - public static function SAOTOMEANDPRINCIPE(): Flag - { - if (!isset(self::$SAOTOMEANDPRINCIPE)) { - self::$SAOTOMEANDPRINCIPE = new Flag('st'); - } - return self::$SAOTOMEANDPRINCIPE; - } - public static function SURINAME(): Flag - { - if (!isset(self::$SURINAME)) { - self::$SURINAME = new Flag('sr'); - } - return self::$SURINAME; - } - public static function SLOVAKIA(): Flag - { - if (!isset(self::$SLOVAKIA)) { - self::$SLOVAKIA = new Flag('sk'); - } - return self::$SLOVAKIA; - } - public static function SLOVENIA(): Flag - { - if (!isset(self::$SLOVENIA)) { - self::$SLOVENIA = new Flag('si'); - } - return self::$SLOVENIA; - } - public static function SWEDEN(): Flag - { - if (!isset(self::$SWEDEN)) { - self::$SWEDEN = new Flag('se'); - } - return self::$SWEDEN; - } - public static function ESWATINI(): Flag - { - if (!isset(self::$ESWATINI)) { - self::$ESWATINI = new Flag('sz'); - } - return self::$ESWATINI; - } - public static function SEYCHELLES(): Flag - { - if (!isset(self::$SEYCHELLES)) { - self::$SEYCHELLES = new Flag('sc'); - } - return self::$SEYCHELLES; - } - public static function SYRIA(): Flag - { - if (!isset(self::$SYRIA)) { - self::$SYRIA = new Flag('sy'); - } - return self::$SYRIA; - } - public static function CHAD(): Flag - { - if (!isset(self::$CHAD)) { - self::$CHAD = new Flag('td'); - } - return self::$CHAD; - } - public static function TOGO(): Flag - { - if (!isset(self::$TOGO)) { - self::$TOGO = new Flag('tg'); - } - return self::$TOGO; - } - public static function THAILAND(): Flag - { - if (!isset(self::$THAILAND)) { - self::$THAILAND = new Flag('th'); - } - return self::$THAILAND; - } - public static function TAJIKISTAN(): Flag - { - if (!isset(self::$TAJIKISTAN)) { - self::$TAJIKISTAN = new Flag('tj'); - } - return self::$TAJIKISTAN; - } - public static function TURKMENISTAN(): Flag - { - if (!isset(self::$TURKMENISTAN)) { - self::$TURKMENISTAN = new Flag('tm'); - } - return self::$TURKMENISTAN; - } - public static function TIMORLESTE(): Flag - { - if (!isset(self::$TIMORLESTE)) { - self::$TIMORLESTE = new Flag('tl'); - } - return self::$TIMORLESTE; - } - public static function TONGA(): Flag - { - if (!isset(self::$TONGA)) { - self::$TONGA = new Flag('to'); - } - return self::$TONGA; - } - public static function TRINIDADANDTOBAGO(): Flag - { - if (!isset(self::$TRINIDADANDTOBAGO)) { - self::$TRINIDADANDTOBAGO = new Flag('tt'); - } - return self::$TRINIDADANDTOBAGO; - } - public static function TUNISIA(): Flag - { - if (!isset(self::$TUNISIA)) { - self::$TUNISIA = new Flag('tn'); - } - return self::$TUNISIA; - } - public static function TURKEY(): Flag - { - if (!isset(self::$TURKEY)) { - self::$TURKEY = new Flag('tr'); - } - return self::$TURKEY; - } - public static function TUVALU(): Flag - { - if (!isset(self::$TUVALU)) { - self::$TUVALU = new Flag('tv'); - } - return self::$TUVALU; - } - public static function TANZANIA(): Flag - { - if (!isset(self::$TANZANIA)) { - self::$TANZANIA = new Flag('tz'); - } - return self::$TANZANIA; - } - public static function UGANDA(): Flag - { - if (!isset(self::$UGANDA)) { - self::$UGANDA = new Flag('ug'); - } - return self::$UGANDA; - } - public static function UKRAINE(): Flag - { - if (!isset(self::$UKRAINE)) { - self::$UKRAINE = new Flag('ua'); - } - return self::$UKRAINE; - } - public static function URUGUAY(): Flag - { - if (!isset(self::$URUGUAY)) { - self::$URUGUAY = new Flag('uy'); - } - return self::$URUGUAY; - } - public static function UNITEDSTATES(): Flag - { - if (!isset(self::$UNITEDSTATES)) { - self::$UNITEDSTATES = new Flag('us'); - } - return self::$UNITEDSTATES; - } - public static function UZBEKISTAN(): Flag - { - if (!isset(self::$UZBEKISTAN)) { - self::$UZBEKISTAN = new Flag('uz'); - } - return self::$UZBEKISTAN; - } - public static function VATICANCITY(): Flag - { - if (!isset(self::$VATICANCITY)) { - self::$VATICANCITY = new Flag('va'); - } - return self::$VATICANCITY; - } - public static function SAINTVINCENTANDTHEGRENADINES(): Flag - { - if (!isset(self::$SAINTVINCENTANDTHEGRENADINES)) { - self::$SAINTVINCENTANDTHEGRENADINES = new Flag('vc'); - } - return self::$SAINTVINCENTANDTHEGRENADINES; - } - public static function VENEZUELA(): Flag - { - if (!isset(self::$VENEZUELA)) { - self::$VENEZUELA = new Flag('ve'); - } - return self::$VENEZUELA; - } - public static function VIETNAM(): Flag - { - if (!isset(self::$VIETNAM)) { - self::$VIETNAM = new Flag('vn'); - } - return self::$VIETNAM; - } - public static function VANUATU(): Flag - { - if (!isset(self::$VANUATU)) { - self::$VANUATU = new Flag('vu'); - } - return self::$VANUATU; - } - public static function SAMOA(): Flag - { - if (!isset(self::$SAMOA)) { - self::$SAMOA = new Flag('ws'); - } - return self::$SAMOA; - } - public static function YEMEN(): Flag - { - if (!isset(self::$YEMEN)) { - self::$YEMEN = new Flag('ye'); - } - return self::$YEMEN; - } - public static function SOUTHAFRICA(): Flag - { - if (!isset(self::$SOUTHAFRICA)) { - self::$SOUTHAFRICA = new Flag('za'); - } - return self::$SOUTHAFRICA; - } - public static function ZAMBIA(): Flag - { - if (!isset(self::$ZAMBIA)) { - self::$ZAMBIA = new Flag('zm'); - } - return self::$ZAMBIA; - } - public static function ZIMBABWE(): Flag - { - if (!isset(self::$ZIMBABWE)) { - self::$ZIMBABWE = new Flag('zw'); - } - return self::$ZIMBABWE; - } -} \ No newline at end of file diff --git a/src/Appwrite/Enums/ImageFormat.php b/src/Appwrite/Enums/ImageFormat.php deleted file mode 100644 index 9ec15d2..0000000 --- a/src/Appwrite/Enums/ImageFormat.php +++ /dev/null @@ -1,67 +0,0 @@ -<?php - -namespace Appwrite\Enums; - -use JsonSerializable; - -class ImageFormat implements JsonSerializable -{ - private static ImageFormat $JPG; - private static ImageFormat $JPEG; - private static ImageFormat $GIF; - private static ImageFormat $PNG; - private static ImageFormat $WEBP; - - private string $value; - - private function __construct(string $value) - { - $this->value = $value; - } - - public function __toString(): string - { - return $this->value; - } - - public function jsonSerialize(): string - { - return $this->value; - } - - public static function JPG(): ImageFormat - { - if (!isset(self::$JPG)) { - self::$JPG = new ImageFormat('jpg'); - } - return self::$JPG; - } - public static function JPEG(): ImageFormat - { - if (!isset(self::$JPEG)) { - self::$JPEG = new ImageFormat('jpeg'); - } - return self::$JPEG; - } - public static function GIF(): ImageFormat - { - if (!isset(self::$GIF)) { - self::$GIF = new ImageFormat('gif'); - } - return self::$GIF; - } - public static function PNG(): ImageFormat - { - if (!isset(self::$PNG)) { - self::$PNG = new ImageFormat('png'); - } - return self::$PNG; - } - public static function WEBP(): ImageFormat - { - if (!isset(self::$WEBP)) { - self::$WEBP = new ImageFormat('webp'); - } - return self::$WEBP; - } -} \ No newline at end of file diff --git a/src/Appwrite/Enums/ImageGravity.php b/src/Appwrite/Enums/ImageGravity.php deleted file mode 100644 index a909cb8..0000000 --- a/src/Appwrite/Enums/ImageGravity.php +++ /dev/null @@ -1,99 +0,0 @@ -<?php - -namespace Appwrite\Enums; - -use JsonSerializable; - -class ImageGravity implements JsonSerializable -{ - private static ImageGravity $CENTER; - private static ImageGravity $TOPLEFT; - private static ImageGravity $TOP; - private static ImageGravity $TOPRIGHT; - private static ImageGravity $LEFT; - private static ImageGravity $RIGHT; - private static ImageGravity $BOTTOMLEFT; - private static ImageGravity $BOTTOM; - private static ImageGravity $BOTTOMRIGHT; - - private string $value; - - private function __construct(string $value) - { - $this->value = $value; - } - - public function __toString(): string - { - return $this->value; - } - - public function jsonSerialize(): string - { - return $this->value; - } - - public static function CENTER(): ImageGravity - { - if (!isset(self::$CENTER)) { - self::$CENTER = new ImageGravity('center'); - } - return self::$CENTER; - } - public static function TOPLEFT(): ImageGravity - { - if (!isset(self::$TOPLEFT)) { - self::$TOPLEFT = new ImageGravity('top-left'); - } - return self::$TOPLEFT; - } - public static function TOP(): ImageGravity - { - if (!isset(self::$TOP)) { - self::$TOP = new ImageGravity('top'); - } - return self::$TOP; - } - public static function TOPRIGHT(): ImageGravity - { - if (!isset(self::$TOPRIGHT)) { - self::$TOPRIGHT = new ImageGravity('top-right'); - } - return self::$TOPRIGHT; - } - public static function LEFT(): ImageGravity - { - if (!isset(self::$LEFT)) { - self::$LEFT = new ImageGravity('left'); - } - return self::$LEFT; - } - public static function RIGHT(): ImageGravity - { - if (!isset(self::$RIGHT)) { - self::$RIGHT = new ImageGravity('right'); - } - return self::$RIGHT; - } - public static function BOTTOMLEFT(): ImageGravity - { - if (!isset(self::$BOTTOMLEFT)) { - self::$BOTTOMLEFT = new ImageGravity('bottom-left'); - } - return self::$BOTTOMLEFT; - } - public static function BOTTOM(): ImageGravity - { - if (!isset(self::$BOTTOM)) { - self::$BOTTOM = new ImageGravity('bottom'); - } - return self::$BOTTOM; - } - public static function BOTTOMRIGHT(): ImageGravity - { - if (!isset(self::$BOTTOMRIGHT)) { - self::$BOTTOMRIGHT = new ImageGravity('bottom-right'); - } - return self::$BOTTOMRIGHT; - } -} \ No newline at end of file diff --git a/src/Appwrite/Enums/IndexType.php b/src/Appwrite/Enums/IndexType.php deleted file mode 100644 index fa71d60..0000000 --- a/src/Appwrite/Enums/IndexType.php +++ /dev/null @@ -1,51 +0,0 @@ -<?php - -namespace Appwrite\Enums; - -use JsonSerializable; - -class IndexType implements JsonSerializable -{ - private static IndexType $KEY; - private static IndexType $FULLTEXT; - private static IndexType $UNIQUE; - - private string $value; - - private function __construct(string $value) - { - $this->value = $value; - } - - public function __toString(): string - { - return $this->value; - } - - public function jsonSerialize(): string - { - return $this->value; - } - - public static function KEY(): IndexType - { - if (!isset(self::$KEY)) { - self::$KEY = new IndexType('key'); - } - return self::$KEY; - } - public static function FULLTEXT(): IndexType - { - if (!isset(self::$FULLTEXT)) { - self::$FULLTEXT = new IndexType('fulltext'); - } - return self::$FULLTEXT; - } - public static function UNIQUE(): IndexType - { - if (!isset(self::$UNIQUE)) { - self::$UNIQUE = new IndexType('unique'); - } - return self::$UNIQUE; - } -} \ No newline at end of file diff --git a/src/Appwrite/Enums/MessagingProviderType.php b/src/Appwrite/Enums/MessagingProviderType.php deleted file mode 100644 index 24a8eb0..0000000 --- a/src/Appwrite/Enums/MessagingProviderType.php +++ /dev/null @@ -1,51 +0,0 @@ -<?php - -namespace Appwrite\Enums; - -use JsonSerializable; - -class MessagingProviderType implements JsonSerializable -{ - private static MessagingProviderType $EMAIL; - private static MessagingProviderType $SMS; - private static MessagingProviderType $PUSH; - - private string $value; - - private function __construct(string $value) - { - $this->value = $value; - } - - public function __toString(): string - { - return $this->value; - } - - public function jsonSerialize(): string - { - return $this->value; - } - - public static function EMAIL(): MessagingProviderType - { - if (!isset(self::$EMAIL)) { - self::$EMAIL = new MessagingProviderType('email'); - } - return self::$EMAIL; - } - public static function SMS(): MessagingProviderType - { - if (!isset(self::$SMS)) { - self::$SMS = new MessagingProviderType('sms'); - } - return self::$SMS; - } - public static function PUSH(): MessagingProviderType - { - if (!isset(self::$PUSH)) { - self::$PUSH = new MessagingProviderType('push'); - } - return self::$PUSH; - } -} \ No newline at end of file diff --git a/src/Appwrite/Enums/Name.php b/src/Appwrite/Enums/Name.php deleted file mode 100644 index 49fad38..0000000 --- a/src/Appwrite/Enums/Name.php +++ /dev/null @@ -1,123 +0,0 @@ -<?php - -namespace Appwrite\Enums; - -use JsonSerializable; - -class Name implements JsonSerializable -{ - private static Name $V1DATABASE; - private static Name $V1DELETES; - private static Name $V1AUDITS; - private static Name $V1MAILS; - private static Name $V1FUNCTIONS; - private static Name $V1USAGE; - private static Name $V1USAGEDUMP; - private static Name $V1WEBHOOKS; - private static Name $V1CERTIFICATES; - private static Name $V1BUILDS; - private static Name $V1MESSAGING; - private static Name $V1MIGRATIONS; - - private string $value; - - private function __construct(string $value) - { - $this->value = $value; - } - - public function __toString(): string - { - return $this->value; - } - - public function jsonSerialize(): string - { - return $this->value; - } - - public static function V1DATABASE(): Name - { - if (!isset(self::$V1DATABASE)) { - self::$V1DATABASE = new Name('v1-database'); - } - return self::$V1DATABASE; - } - public static function V1DELETES(): Name - { - if (!isset(self::$V1DELETES)) { - self::$V1DELETES = new Name('v1-deletes'); - } - return self::$V1DELETES; - } - public static function V1AUDITS(): Name - { - if (!isset(self::$V1AUDITS)) { - self::$V1AUDITS = new Name('v1-audits'); - } - return self::$V1AUDITS; - } - public static function V1MAILS(): Name - { - if (!isset(self::$V1MAILS)) { - self::$V1MAILS = new Name('v1-mails'); - } - return self::$V1MAILS; - } - public static function V1FUNCTIONS(): Name - { - if (!isset(self::$V1FUNCTIONS)) { - self::$V1FUNCTIONS = new Name('v1-functions'); - } - return self::$V1FUNCTIONS; - } - public static function V1USAGE(): Name - { - if (!isset(self::$V1USAGE)) { - self::$V1USAGE = new Name('v1-usage'); - } - return self::$V1USAGE; - } - public static function V1USAGEDUMP(): Name - { - if (!isset(self::$V1USAGEDUMP)) { - self::$V1USAGEDUMP = new Name('v1-usage-dump'); - } - return self::$V1USAGEDUMP; - } - public static function V1WEBHOOKS(): Name - { - if (!isset(self::$V1WEBHOOKS)) { - self::$V1WEBHOOKS = new Name('v1-webhooks'); - } - return self::$V1WEBHOOKS; - } - public static function V1CERTIFICATES(): Name - { - if (!isset(self::$V1CERTIFICATES)) { - self::$V1CERTIFICATES = new Name('v1-certificates'); - } - return self::$V1CERTIFICATES; - } - public static function V1BUILDS(): Name - { - if (!isset(self::$V1BUILDS)) { - self::$V1BUILDS = new Name('v1-builds'); - } - return self::$V1BUILDS; - } - public static function V1MESSAGING(): Name - { - if (!isset(self::$V1MESSAGING)) { - self::$V1MESSAGING = new Name('v1-messaging'); - } - return self::$V1MESSAGING; - } - public static function V1MIGRATIONS(): Name - { - if (!isset(self::$V1MIGRATIONS)) { - self::$V1MIGRATIONS = new Name('v1-migrations'); - } - return self::$V1MIGRATIONS; - } -} \ No newline at end of file diff --git a/src/Appwrite/Enums/OAuthProvider.php b/src/Appwrite/Enums/OAuthProvider.php deleted file mode 100644 index 6ee87be..0000000 --- a/src/Appwrite/Enums/OAuthProvider.php +++ /dev/null @@ -1,339 +0,0 @@ -<?php - -namespace Appwrite\Enums; - -use JsonSerializable; - -class OAuthProvider implements JsonSerializable -{ - private static OAuthProvider $AMAZON; - private static OAuthProvider $APPLE; - private static OAuthProvider $AUTH0; - private static OAuthProvider $AUTHENTIK; - private static OAuthProvider $AUTODESK; - private static OAuthProvider $BITBUCKET; - private static OAuthProvider $BITLY; - private static OAuthProvider $BOX; - private static OAuthProvider $DAILYMOTION; - private static OAuthProvider $DISCORD; - private static OAuthProvider $DISQUS; - private static OAuthProvider $DROPBOX; - private static OAuthProvider $ETSY; - private static OAuthProvider $FACEBOOK; - private static OAuthProvider $GITHUB; - private static OAuthProvider $GITLAB; - private static OAuthProvider $GOOGLE; - private static OAuthProvider $LINKEDIN; - private static OAuthProvider $MICROSOFT; - private static OAuthProvider $NOTION; - private static OAuthProvider $OIDC; - private static OAuthProvider $OKTA; - private static OAuthProvider $PAYPAL; - private static OAuthProvider $PAYPALSANDBOX; - private static OAuthProvider $PODIO; - private static OAuthProvider $SALESFORCE; - private static OAuthProvider $SLACK; - private static OAuthProvider $SPOTIFY; - private static OAuthProvider $STRIPE; - private static OAuthProvider $TRADESHIFT; - private static OAuthProvider $TRADESHIFTBOX; - private static OAuthProvider $TWITCH; - private static OAuthProvider $WORDPRESS; - private static OAuthProvider $YAHOO; - private static OAuthProvider $YAMMER; - private static OAuthProvider $YANDEX; - private static OAuthProvider $ZOHO; - private static OAuthProvider $ZOOM; - private static OAuthProvider $MOCK; - - private string $value; - - private function __construct(string $value) - { - $this->value = $value; - } - - public function __toString(): string - { - return $this->value; - } - - public function jsonSerialize(): string - { - return $this->value; - } - - public static function AMAZON(): OAuthProvider - { - if (!isset(self::$AMAZON)) { - self::$AMAZON = new OAuthProvider('amazon'); - } - return self::$AMAZON; - } - public static function APPLE(): OAuthProvider - { - if (!isset(self::$APPLE)) { - self::$APPLE = new OAuthProvider('apple'); - } - return self::$APPLE; - } - public static function AUTH0(): OAuthProvider - { - if (!isset(self::$AUTH0)) { - self::$AUTH0 = new OAuthProvider('auth0'); - } - return self::$AUTH0; - } - public static function AUTHENTIK(): OAuthProvider - { - if (!isset(self::$AUTHENTIK)) { - self::$AUTHENTIK = new OAuthProvider('authentik'); - } - return self::$AUTHENTIK; - } - public static function AUTODESK(): OAuthProvider - { - if (!isset(self::$AUTODESK)) { - self::$AUTODESK = new OAuthProvider('autodesk'); - } - return self::$AUTODESK; - } - public static function BITBUCKET(): OAuthProvider - { - if (!isset(self::$BITBUCKET)) { - self::$BITBUCKET = new OAuthProvider('bitbucket'); - } - return self::$BITBUCKET; - } - public static function BITLY(): OAuthProvider - { - if (!isset(self::$BITLY)) { - self::$BITLY = new OAuthProvider('bitly'); - } - return self::$BITLY; - } - public static function BOX(): OAuthProvider - { - if (!isset(self::$BOX)) { - self::$BOX = new OAuthProvider('box'); - } - return self::$BOX; - } - public static function DAILYMOTION(): OAuthProvider - { - if (!isset(self::$DAILYMOTION)) { - self::$DAILYMOTION = new OAuthProvider('dailymotion'); - } - return self::$DAILYMOTION; - } - public static function DISCORD(): OAuthProvider - { - if (!isset(self::$DISCORD)) { - self::$DISCORD = new OAuthProvider('discord'); - } - return self::$DISCORD; - } - public static function DISQUS(): OAuthProvider - { - if (!isset(self::$DISQUS)) { - self::$DISQUS = new OAuthProvider('disqus'); - } - return self::$DISQUS; - } - public static function DROPBOX(): OAuthProvider - { - if (!isset(self::$DROPBOX)) { - self::$DROPBOX = new OAuthProvider('dropbox'); - } - return self::$DROPBOX; - } - public static function ETSY(): OAuthProvider - { - if (!isset(self::$ETSY)) { - self::$ETSY = new OAuthProvider('etsy'); - } - return self::$ETSY; - } - public static function FACEBOOK(): OAuthProvider - { - if (!isset(self::$FACEBOOK)) { - self::$FACEBOOK = new OAuthProvider('facebook'); - } - return self::$FACEBOOK; - } - public static function GITHUB(): OAuthProvider - { - if (!isset(self::$GITHUB)) { - self::$GITHUB = new OAuthProvider('github'); - } - return self::$GITHUB; - } - public static function GITLAB(): OAuthProvider - { - if (!isset(self::$GITLAB)) { - self::$GITLAB = new OAuthProvider('gitlab'); - } - return self::$GITLAB; - } - public static function GOOGLE(): OAuthProvider - { - if (!isset(self::$GOOGLE)) { - self::$GOOGLE = new OAuthProvider('google'); - } - return self::$GOOGLE; - } - public static function LINKEDIN(): OAuthProvider - { - if (!isset(self::$LINKEDIN)) { - self::$LINKEDIN = new OAuthProvider('linkedin'); - } - return self::$LINKEDIN; - } - public static function MICROSOFT(): OAuthProvider - { - if (!isset(self::$MICROSOFT)) { - self::$MICROSOFT = new OAuthProvider('microsoft'); - } - return self::$MICROSOFT; - } - public static function NOTION(): OAuthProvider - { - if (!isset(self::$NOTION)) { - self::$NOTION = new OAuthProvider('notion'); - } - return self::$NOTION; - } - public static function OIDC(): OAuthProvider - { - if (!isset(self::$OIDC)) { - self::$OIDC = new OAuthProvider('oidc'); - } - return self::$OIDC; - } - public static function OKTA(): OAuthProvider - { - if (!isset(self::$OKTA)) { - self::$OKTA = new OAuthProvider('okta'); - } - return self::$OKTA; - } - public static function PAYPAL(): OAuthProvider - { - if (!isset(self::$PAYPAL)) { - self::$PAYPAL = new OAuthProvider('paypal'); - } - return self::$PAYPAL; - } - public static function PAYPALSANDBOX(): OAuthProvider - { - if (!isset(self::$PAYPALSANDBOX)) { - self::$PAYPALSANDBOX = new OAuthProvider('paypalSandbox'); - } - return self::$PAYPALSANDBOX; - } - public static function PODIO(): OAuthProvider - { - if (!isset(self::$PODIO)) { - self::$PODIO = new OAuthProvider('podio'); - } - return self::$PODIO; - } - public static function SALESFORCE(): OAuthProvider - { - if (!isset(self::$SALESFORCE)) { - self::$SALESFORCE = new OAuthProvider('salesforce'); - } - return self::$SALESFORCE; - } - public static function SLACK(): OAuthProvider - { - if (!isset(self::$SLACK)) { - self::$SLACK = new OAuthProvider('slack'); - } - return self::$SLACK; - } - public static function SPOTIFY(): OAuthProvider - { - if (!isset(self::$SPOTIFY)) { - self::$SPOTIFY = new OAuthProvider('spotify'); - } - return self::$SPOTIFY; - } - public static function STRIPE(): OAuthProvider - { - if (!isset(self::$STRIPE)) { - self::$STRIPE = new OAuthProvider('stripe'); - } - return self::$STRIPE; - } - public static function TRADESHIFT(): OAuthProvider - { - if (!isset(self::$TRADESHIFT)) { - self::$TRADESHIFT = new OAuthProvider('tradeshift'); - } - return self::$TRADESHIFT; - } - public static function TRADESHIFTBOX(): OAuthProvider - { - if (!isset(self::$TRADESHIFTBOX)) { - self::$TRADESHIFTBOX = new OAuthProvider('tradeshiftBox'); - } - return self::$TRADESHIFTBOX; - } - public static function TWITCH(): OAuthProvider - { - if (!isset(self::$TWITCH)) { - self::$TWITCH = new OAuthProvider('twitch'); - } - return self::$TWITCH; - } - public static function WORDPRESS(): OAuthProvider - { - if (!isset(self::$WORDPRESS)) { - self::$WORDPRESS = new OAuthProvider('wordpress'); - } - return self::$WORDPRESS; - } - public static function YAHOO(): OAuthProvider - { - if (!isset(self::$YAHOO)) { - self::$YAHOO = new OAuthProvider('yahoo'); - } - return self::$YAHOO; - } - public static function YAMMER(): OAuthProvider - { - if (!isset(self::$YAMMER)) { - self::$YAMMER = new OAuthProvider('yammer'); - } - return self::$YAMMER; - } - public static function YANDEX(): OAuthProvider - { - if (!isset(self::$YANDEX)) { - self::$YANDEX = new OAuthProvider('yandex'); - } - return self::$YANDEX; - } - public static function ZOHO(): OAuthProvider - { - if (!isset(self::$ZOHO)) { - self::$ZOHO = new OAuthProvider('zoho'); - } - return self::$ZOHO; - } - public static function ZOOM(): OAuthProvider - { - if (!isset(self::$ZOOM)) { - self::$ZOOM = new OAuthProvider('zoom'); - } - return self::$ZOOM; - } - public static function MOCK(): OAuthProvider - { - if (!isset(self::$MOCK)) { - self::$MOCK = new OAuthProvider('mock'); - } - return self::$MOCK; - } -} \ No newline at end of file diff --git a/src/Appwrite/Enums/PasswordHash.php b/src/Appwrite/Enums/PasswordHash.php deleted file mode 100644 index 27d080d..0000000 --- a/src/Appwrite/Enums/PasswordHash.php +++ /dev/null @@ -1,115 +0,0 @@ -<?php - -namespace Appwrite\Enums; - -use JsonSerializable; - -class PasswordHash implements JsonSerializable -{ - private static PasswordHash $SHA1; - private static PasswordHash $SHA224; - private static PasswordHash $SHA256; - private static PasswordHash $SHA384; - private static PasswordHash $SHA512224; - private static PasswordHash $SHA512256; - private static PasswordHash $SHA512; - private static PasswordHash $SHA3224; - private static PasswordHash $SHA3256; - private static PasswordHash $SHA3384; - private static PasswordHash $SHA3512; - - private string $value; - - private function __construct(string $value) - { - $this->value = $value; - } - - public function __toString(): string - { - return $this->value; - } - - public function jsonSerialize(): string - { - return $this->value; - } - - public static function SHA1(): PasswordHash - { - if (!isset(self::$SHA1)) { - self::$SHA1 = new PasswordHash('sha1'); - } - return self::$SHA1; - } - public static function SHA224(): PasswordHash - { - if (!isset(self::$SHA224)) { - self::$SHA224 = new PasswordHash('sha224'); - } - return self::$SHA224; - } - public static function SHA256(): PasswordHash - { - if (!isset(self::$SHA256)) { - self::$SHA256 = new PasswordHash('sha256'); - } - return self::$SHA256; - } - public static function SHA384(): PasswordHash - { - if (!isset(self::$SHA384)) { - self::$SHA384 = new PasswordHash('sha384'); - } - return self::$SHA384; - } - public static function SHA512224(): PasswordHash - { - if (!isset(self::$SHA512224)) { - self::$SHA512224 = new PasswordHash('sha512/224'); - } - return self::$SHA512224; - } - public static function SHA512256(): PasswordHash - { - if (!isset(self::$SHA512256)) { - self::$SHA512256 = new PasswordHash('sha512/256'); - } - return self::$SHA512256; - } - public static function SHA512(): PasswordHash - { - if (!isset(self::$SHA512)) { - self::$SHA512 = new PasswordHash('sha512'); - } - return self::$SHA512; - } - public static function SHA3224(): PasswordHash - { - if (!isset(self::$SHA3224)) { - self::$SHA3224 = new PasswordHash('sha3-224'); - } - return self::$SHA3224; - } - public static function SHA3256(): PasswordHash - { - if (!isset(self::$SHA3256)) { - self::$SHA3256 = new PasswordHash('sha3-256'); - } - return self::$SHA3256; - } - public static function SHA3384(): PasswordHash - { - if (!isset(self::$SHA3384)) { - self::$SHA3384 = new PasswordHash('sha3-384'); - } - return self::$SHA3384; - } - public static function SHA3512(): PasswordHash - { - if (!isset(self::$SHA3512)) { - self::$SHA3512 = new PasswordHash('sha3-512'); - } - return self::$SHA3512; - } -} \ No newline at end of file diff --git a/src/Appwrite/Enums/RelationMutate.php b/src/Appwrite/Enums/RelationMutate.php deleted file mode 100644 index 0357acc..0000000 --- a/src/Appwrite/Enums/RelationMutate.php +++ /dev/null @@ -1,51 +0,0 @@ -<?php - -namespace Appwrite\Enums; - -use JsonSerializable; - -class RelationMutate implements JsonSerializable -{ - private static RelationMutate $CASCADE; - private static RelationMutate $RESTRICT; - private static RelationMutate $SETNULL; - - private string $value; - - private function __construct(string $value) - { - $this->value = $value; - } - - public function __toString(): string - { - return $this->value; - } - - public function jsonSerialize(): string - { - return $this->value; - } - - public static function CASCADE(): RelationMutate - { - if (!isset(self::$CASCADE)) { - self::$CASCADE = new RelationMutate('cascade'); - } - return self::$CASCADE; - } - public static function RESTRICT(): RelationMutate - { - if (!isset(self::$RESTRICT)) { - self::$RESTRICT = new RelationMutate('restrict'); - } - return self::$RESTRICT; - } - public static function SETNULL(): RelationMutate - { - if (!isset(self::$SETNULL)) { - self::$SETNULL = new RelationMutate('setNull'); - } - return self::$SETNULL; - } -} \ No newline at end of file diff --git a/src/Appwrite/Enums/RelationshipType.php b/src/Appwrite/Enums/RelationshipType.php deleted file mode 100644 index b920b50..0000000 --- a/src/Appwrite/Enums/RelationshipType.php +++ /dev/null @@ -1,59 +0,0 @@ -<?php - -namespace Appwrite\Enums; - -use JsonSerializable; - -class RelationshipType implements JsonSerializable -{ - private static RelationshipType $ONETOONE; - private static RelationshipType $MANYTOONE; - private static RelationshipType $MANYTOMANY; - private static RelationshipType $ONETOMANY; - - private string $value; - - private function __construct(string $value) - { - $this->value = $value; - } - - public function __toString(): string - { - return $this->value; - } - - public function jsonSerialize(): string - { - return $this->value; - } - - public static function ONETOONE(): RelationshipType - { - if (!isset(self::$ONETOONE)) { - self::$ONETOONE = new RelationshipType('oneToOne'); - } - return self::$ONETOONE; - } - public static function MANYTOONE(): RelationshipType - { - if (!isset(self::$MANYTOONE)) { - self::$MANYTOONE = new RelationshipType('manyToOne'); - } - return self::$MANYTOONE; - } - public static function MANYTOMANY(): RelationshipType - { - if (!isset(self::$MANYTOMANY)) { - self::$MANYTOMANY = new RelationshipType('manyToMany'); - } - return self::$MANYTOMANY; - } - public static function ONETOMANY(): RelationshipType - { - if (!isset(self::$ONETOMANY)) { - self::$ONETOMANY = new RelationshipType('oneToMany'); - } - return self::$ONETOMANY; - } -} \ No newline at end of file diff --git a/src/Appwrite/Enums/Runtime.php b/src/Appwrite/Enums/Runtime.php deleted file mode 100644 index 05cb177..0000000 --- a/src/Appwrite/Enums/Runtime.php +++ /dev/null @@ -1,395 +0,0 @@ -<?php - -namespace Appwrite\Enums; - -use JsonSerializable; - -class Runtime implements JsonSerializable -{ - private static Runtime $NODE145; - private static Runtime $NODE160; - private static Runtime $NODE180; - private static Runtime $NODE190; - private static Runtime $NODE200; - private static Runtime $NODE210; - private static Runtime $PHP80; - private static Runtime $PHP81; - private static Runtime $PHP82; - private static Runtime $PHP83; - private static Runtime $RUBY30; - private static Runtime $RUBY31; - private static Runtime $RUBY32; - private static Runtime $RUBY33; - private static Runtime $PYTHON38; - private static Runtime $PYTHON39; - private static Runtime $PYTHON310; - private static Runtime $PYTHON311; - private static Runtime $PYTHON312; - private static Runtime $PYTHONML311; - private static Runtime $DENO140; - private static Runtime $DART215; - private static Runtime $DART216; - private static Runtime $DART217; - private static Runtime $DART218; - private static Runtime $DART30; - private static Runtime $DART31; - private static Runtime $DART33; - private static Runtime $DOTNET31; - private static Runtime $DOTNET60; - private static Runtime $DOTNET70; - private static Runtime $JAVA80; - private static Runtime $JAVA110; - private static Runtime $JAVA170; - private static Runtime $JAVA180; - private static Runtime $JAVA210; - private static Runtime $SWIFT55; - private static Runtime $SWIFT58; - private static Runtime $SWIFT59; - private static Runtime $KOTLIN16; - private static Runtime $KOTLIN18; - private static Runtime $KOTLIN19; - private static Runtime $CPP17; - private static Runtime $CPP20; - private static Runtime $BUN10; - private static Runtime $GO122; - - private string $value; - - private function __construct(string $value) - { - $this->value = $value; - } - - public function __toString(): string - { - return $this->value; - } - - public function jsonSerialize(): string - { - return $this->value; - } - - public static function NODE145(): Runtime - { - if (!isset(self::$NODE145)) { - self::$NODE145 = new Runtime('node-14.5'); - } - return self::$NODE145; - } - public static function NODE160(): Runtime - { - if (!isset(self::$NODE160)) { - self::$NODE160 = new Runtime('node-16.0'); - } - return self::$NODE160; - } - public static function NODE180(): Runtime - { - if (!isset(self::$NODE180)) { - self::$NODE180 = new Runtime('node-18.0'); - } - return self::$NODE180; - } - public static function NODE190(): Runtime - { - if (!isset(self::$NODE190)) { - self::$NODE190 = new Runtime('node-19.0'); - } - return self::$NODE190; - } - public static function NODE200(): Runtime - { - if (!isset(self::$NODE200)) { - self::$NODE200 = new Runtime('node-20.0'); - } - return self::$NODE200; - } - public static function NODE210(): Runtime - { - if (!isset(self::$NODE210)) { - self::$NODE210 = new Runtime('node-21.0'); - } - return self::$NODE210; - } - public static function PHP80(): Runtime - { - if (!isset(self::$PHP80)) { - self::$PHP80 = new Runtime('php-8.0'); - } - return self::$PHP80; - } - public static function PHP81(): Runtime - { - if (!isset(self::$PHP81)) { - self::$PHP81 = new Runtime('php-8.1'); - } - return self::$PHP81; - } - public static function PHP82(): Runtime - { - if (!isset(self::$PHP82)) { - self::$PHP82 = new Runtime('php-8.2'); - } - return self::$PHP82; - } - public static function PHP83(): Runtime - { - if (!isset(self::$PHP83)) { - self::$PHP83 = new Runtime('php-8.3'); - } - return self::$PHP83; - } - public static function RUBY30(): Runtime - { - if (!isset(self::$RUBY30)) { - self::$RUBY30 = new Runtime('ruby-3.0'); - } - return self::$RUBY30; - } - public static function RUBY31(): Runtime - { - if (!isset(self::$RUBY31)) { - self::$RUBY31 = new Runtime('ruby-3.1'); - } - return self::$RUBY31; - } - public static function RUBY32(): Runtime - { - if (!isset(self::$RUBY32)) { - self::$RUBY32 = new Runtime('ruby-3.2'); - } - return self::$RUBY32; - } - public static function RUBY33(): Runtime - { - if (!isset(self::$RUBY33)) { - self::$RUBY33 = new Runtime('ruby-3.3'); - } - return self::$RUBY33; - } - public static function PYTHON38(): Runtime - { - if (!isset(self::$PYTHON38)) { - self::$PYTHON38 = new Runtime('python-3.8'); - } - return self::$PYTHON38; - } - public static function PYTHON39(): Runtime - { - if (!isset(self::$PYTHON39)) { - self::$PYTHON39 = new Runtime('python-3.9'); - } - return self::$PYTHON39; - } - public static function PYTHON310(): Runtime - { - if (!isset(self::$PYTHON310)) { - self::$PYTHON310 = new Runtime('python-3.10'); - } - return self::$PYTHON310; - } - public static function PYTHON311(): Runtime - { - if (!isset(self::$PYTHON311)) { - self::$PYTHON311 = new Runtime('python-3.11'); - } - return self::$PYTHON311; - } - public static function PYTHON312(): Runtime - { - if (!isset(self::$PYTHON312)) { - self::$PYTHON312 = new Runtime('python-3.12'); - } - return self::$PYTHON312; - } - public static function PYTHONML311(): Runtime - { - if (!isset(self::$PYTHONML311)) { - self::$PYTHONML311 = new Runtime('python-ml-3.11'); - } - return self::$PYTHONML311; - } - public static function DENO140(): Runtime - { - if (!isset(self::$DENO140)) { - self::$DENO140 = new Runtime('deno-1.40'); - } - return self::$DENO140; - } - public static function DART215(): Runtime - { - if (!isset(self::$DART215)) { - self::$DART215 = new Runtime('dart-2.15'); - } - return self::$DART215; - } - public static function DART216(): Runtime - { - if (!isset(self::$DART216)) { - self::$DART216 = new Runtime('dart-2.16'); - } - return self::$DART216; - } - public static function DART217(): Runtime - { - if (!isset(self::$DART217)) { - self::$DART217 = new Runtime('dart-2.17'); - } - return self::$DART217; - } - public static function DART218(): Runtime - { - if (!isset(self::$DART218)) { - self::$DART218 = new Runtime('dart-2.18'); - } - return self::$DART218; - } - public static function DART30(): Runtime - { - if (!isset(self::$DART30)) { - self::$DART30 = new Runtime('dart-3.0'); - } - return self::$DART30; - } - public static function DART31(): Runtime - { - if (!isset(self::$DART31)) { - self::$DART31 = new Runtime('dart-3.1'); - } - return self::$DART31; - } - public static function DART33(): Runtime - { - if (!isset(self::$DART33)) { - self::$DART33 = new Runtime('dart-3.3'); - } - return self::$DART33; - } - public static function DOTNET31(): Runtime - { - if (!isset(self::$DOTNET31)) { - self::$DOTNET31 = new Runtime('dotnet-3.1'); - } - return self::$DOTNET31; - } - public static function DOTNET60(): Runtime - { - if (!isset(self::$DOTNET60)) { - self::$DOTNET60 = new Runtime('dotnet-6.0'); - } - return self::$DOTNET60; - } - public static function DOTNET70(): Runtime - { - if (!isset(self::$DOTNET70)) { - self::$DOTNET70 = new Runtime('dotnet-7.0'); - } - return self::$DOTNET70; - } - public static function JAVA80(): Runtime - { - if (!isset(self::$JAVA80)) { - self::$JAVA80 = new Runtime('java-8.0'); - } - return self::$JAVA80; - } - public static function JAVA110(): Runtime - { - if (!isset(self::$JAVA110)) { - self::$JAVA110 = new Runtime('java-11.0'); - } - return self::$JAVA110; - } - public static function JAVA170(): Runtime - { - if (!isset(self::$JAVA170)) { - self::$JAVA170 = new Runtime('java-17.0'); - } - return self::$JAVA170; - } - public static function JAVA180(): Runtime - { - if (!isset(self::$JAVA180)) { - self::$JAVA180 = new Runtime('java-18.0'); - } - return self::$JAVA180; - } - public static function JAVA210(): Runtime - { - if (!isset(self::$JAVA210)) { - self::$JAVA210 = new Runtime('java-21.0'); - } - return self::$JAVA210; - } - public static function SWIFT55(): Runtime - { - if (!isset(self::$SWIFT55)) { - self::$SWIFT55 = new Runtime('swift-5.5'); - } - return self::$SWIFT55; - } - public static function SWIFT58(): Runtime - { - if (!isset(self::$SWIFT58)) { - self::$SWIFT58 = new Runtime('swift-5.8'); - } - return self::$SWIFT58; - } - public static function SWIFT59(): Runtime - { - if (!isset(self::$SWIFT59)) { - self::$SWIFT59 = new Runtime('swift-5.9'); - } - return self::$SWIFT59; - } - public static function KOTLIN16(): Runtime - { - if (!isset(self::$KOTLIN16)) { - self::$KOTLIN16 = new Runtime('kotlin-1.6'); - } - return self::$KOTLIN16; - } - public static function KOTLIN18(): Runtime - { - if (!isset(self::$KOTLIN18)) { - self::$KOTLIN18 = new Runtime('kotlin-1.8'); - } - return self::$KOTLIN18; - } - public static function KOTLIN19(): Runtime - { - if (!isset(self::$KOTLIN19)) { - self::$KOTLIN19 = new Runtime('kotlin-1.9'); - } - return self::$KOTLIN19; - } - public static function CPP17(): Runtime - { - if (!isset(self::$CPP17)) { - self::$CPP17 = new Runtime('cpp-17'); - } - return self::$CPP17; - } - public static function CPP20(): Runtime - { - if (!isset(self::$CPP20)) { - self::$CPP20 = new Runtime('cpp-20'); - } - return self::$CPP20; - } - public static function BUN10(): Runtime - { - if (!isset(self::$BUN10)) { - self::$BUN10 = new Runtime('bun-1.0'); - } - return self::$BUN10; - } - public static function GO122(): Runtime - { - if (!isset(self::$GO122)) { - self::$GO122 = new Runtime('go-1.22'); - } - return self::$GO122; - } -} \ No newline at end of file diff --git a/src/Appwrite/Enums/SmtpEncryption.php b/src/Appwrite/Enums/SmtpEncryption.php deleted file mode 100644 index 53b7a04..0000000 --- a/src/Appwrite/Enums/SmtpEncryption.php +++ /dev/null @@ -1,51 +0,0 @@ -<?php - -namespace Appwrite\Enums; - -use JsonSerializable; - -class SmtpEncryption implements JsonSerializable -{ - private static SmtpEncryption $NONE; - private static SmtpEncryption $SSL; - private static SmtpEncryption $TLS; - - private string $value; - - private function __construct(string $value) - { - $this->value = $value; - } - - public function __toString(): string - { - return $this->value; - } - - public function jsonSerialize(): string - { - return $this->value; - } - - public static function NONE(): SmtpEncryption - { - if (!isset(self::$NONE)) { - self::$NONE = new SmtpEncryption('none'); - } - return self::$NONE; - } - public static function SSL(): SmtpEncryption - { - if (!isset(self::$SSL)) { - self::$SSL = new SmtpEncryption('ssl'); - } - return self::$SSL; - } - public static function TLS(): SmtpEncryption - { - if (!isset(self::$TLS)) { - self::$TLS = new SmtpEncryption('tls'); - } - return self::$TLS; - } -} \ No newline at end of file diff --git a/src/Appwrite/ID.php b/src/Appwrite/ID.php deleted file mode 100644 index 43db4c0..0000000 --- a/src/Appwrite/ID.php +++ /dev/null @@ -1,22 +0,0 @@ -<?php - -namespace Appwrite; - -class ID { - public static function unique(int $padding = 7): string - { - $uniqid = \uniqid(); - - if ($padding > 0) { - $bytes = \random_bytes(\max(1, (int)\ceil(($padding / 2)))); // one byte expands to two chars - $uniqid .= \substr(\bin2hex($bytes), 0, $padding); - } - - return $uniqid; - } - - public static function custom(string $id): string - { - return $id; - } -} diff --git a/src/Appwrite/InputFile.php b/src/Appwrite/InputFile.php deleted file mode 100644 index 8693182..0000000 --- a/src/Appwrite/InputFile.php +++ /dev/null @@ -1,51 +0,0 @@ -<?php -namespace Appwrite; - -class InputFile { - private ?string $data; - private ?string $mimeType; - private ?string $filename; - private ?string $path; - - public function __construct(){} - - public function getData(): ?string - { - return $this->data; - } - - public function getPath(): ?string - { - return $this->path; - } - - public function getMimeType(): ?string - { - return $this->mimeType; - } - - public function getFilename(): ?string - { - return $this->filename; - } - - public static function withPath(string $path, ?string $mimeType = null, ?string $filename = null) - { - $instance = new InputFile(); - $instance->path = $path; - $instance->data = null; - $instance->mimeType = $mimeType; - $instance->filename = $filename; - return $instance; - } - - public static function withData(string $data, ?string $mimeType = null, ?string $filename = null) - { - $instance = new InputFile(); - $instance->path = null; - $instance->data = $data; - $instance->mimeType = $mimeType; - $instance->filename = $filename; - return $instance; - } -} \ No newline at end of file diff --git a/src/Appwrite/Permission.php b/src/Appwrite/Permission.php deleted file mode 100644 index ce91d2a..0000000 --- a/src/Appwrite/Permission.php +++ /dev/null @@ -1,27 +0,0 @@ -<?php - -namespace Appwrite; - -class Permission -{ - public static function read(string $role): string - { - return "read(\"$role\")"; - } - public static function write(string $role): string - { - return "write(\"$role\")"; - } - public static function create(string $role): string - { - return "create(\"$role\")"; - } - public static function update(string $role): string - { - return "update(\"$role\")"; - } - public static function delete(string $role): string - { - return "delete(\"$role\")"; - } -} diff --git a/src/Appwrite/Query.php b/src/Appwrite/Query.php deleted file mode 100644 index c8dc063..0000000 --- a/src/Appwrite/Query.php +++ /dev/null @@ -1,297 +0,0 @@ -<?php - -namespace Appwrite; - -class Query implements \JsonSerializable -{ - protected string $method; - protected ?string $attribute; - protected ?array $values; - - public function __construct(string $method, ?string $attribute = null, $values = null) - { - $this->method = $method; - $this->attribute = $attribute; - - if (is_null($values) || is_array($values)) { - $this->values = $values; - } else { - $this->values = [$values]; - } - - } - - public function __toString(): string - { - return json_encode($this->jsonSerialize()); - } - - public function jsonSerialize() - { - return array_filter([ - 'method' => $this->method, - 'attribute' => $this->attribute, - 'values' => $this->values, - ]); - } - - /** - * Equal - * - * @param string $attribute - * @param mixed $value - * @return string - */ - public static function equal(string $attribute, $value): string - { - return (new Query('equal', $attribute, $value))->__toString(); - } - - /** - * Not Equal - * - * @param string $attribute - * @param mixed $value - * @return string - */ - public static function notEqual(string $attribute, $value): string - { - return (new Query('notEqual', $attribute, $value))->__toString(); - } - - /** - * Less Than - * - * @param string $attribute - * @param mixed $value - * @return string - */ - public static function lessThan(string $attribute, $value): string - { - return (new Query('lessThan', $attribute, $value))->__toString(); - } - - /** - * Less Than or Equal - * - * @param string $attribute - * @param mixed $value - * @return string - */ - public static function lessThanEqual(string $attribute, $value): string - { - return (new Query('lessThanEqual', $attribute, $value))->__toString(); - } - - /** - * Greater Than - * - * @param string $attribute - * @param mixed $value - * @return string - */ - public static function greaterThan(string $attribute, $value): string - { - return (new Query('greaterThan', $attribute, $value))->__toString(); - } - - /** - * Greater Than or Equal - * - * @param string $attribute - * @param mixed $value - * @return string - */ - public static function greaterThanEqual(string $attribute, $value): string - { - return (new Query('greaterThanEqual', $attribute, $value))->__toString(); - } - - /** - * Search - * - * @param string $attribute - * @param string $value - * @return string - */ - public static function search(string $attribute, string $value): string - { - return (new Query('search', $attribute, $value))->__toString(); - } - - /** - * Is Null - * - * @param string $attribute - * @return string - */ - public static function isNull(string $attribute): string - { - return (new Query('isNull', $attribute, null))->__toString(); - } - - /** - * Is Not Null - * - * @param string $attribute - * @return string - */ - public static function isNotNull(string $attribute): string - { - return (new Query('isNotNull', $attribute, null))->__toString(); - } - - /** - * Between - * - * @param string $attribute - * @param string|int|float $start - * @param string|int|float $end - * @return string - */ - public static function between(string $attribute, $start, $end): string - { - return (new Query('between', $attribute, [$start, $end]))->__toString(); - } - - /** - * Starts With - * - * @param string $attribute - * @param string $value - * @return string - */ - public static function startsWith(string $attribute, string $value): string - { - return (new Query('startsWith', $attribute, $value))->__toString(); - } - - /** - * Ends With - * - * @param string $attribute - * @param string $value - * @return string - */ - public static function endsWith(string $attribute, string $value): string - { - return (new Query('endsWith', $attribute, $value))->__toString(); - } - - /** - * Select - * - * @param array<string> $attributes - * @return string - */ - public static function select(array $attributes): string - { - return (new Query('select', null, $attributes))->__toString(); - } - - /** - * Cursor After - * - * @param string $documentId - * @return string - */ - public static function cursorAfter(string $documentId): string - { - return (new Query('cursorAfter', null, $documentId))->__toString(); - } - - /** - * Cursor Before - * - * @param string $documentId - * @return string - */ - public static function cursorBefore(string $documentId): string - { - return (new Query('cursorBefore', null, $documentId))->__toString(); - } - - /** - * Order Asc - * - * @param string $attribute - * @return string - */ - public static function orderAsc(string $attribute): string - { - return (new Query('orderAsc', $attribute, null))->__toString(); - } - - /** - * Order Desc - * - * @param string $attribute - * @return string - */ - public static function orderDesc(string $attribute): string - { - return (new Query('orderDesc', $attribute, null))->__toString(); - } - - /** - * Limit - * - * @param int $limit - * @return string - */ - public static function limit(int $limit): string - { - return (new Query('limit', null, $limit))->__toString(); - } - - /** - * Offset - * - * @param int $offset - * @return string - */ - public static function offset(int $offset): string - { - return (new Query('offset', null, $offset))->__toString(); - } - - /** - * Contains - * - * @param string $attribute - * @param mixed $value - * @return string - */ - public static function contains(string $attribute, $value): string - { - return (new Query('contains', $attribute, $value))->__toString(); - } - - /** - * Or - * - * @param array<string> $queries - * @return string - */ - public static function or(array $queries): string - { - foreach ($queries as &$query) { - $query = \json_decode($query, true); - } - return (new Query('or', null, $queries))->__toString(); - } - - /** - * And - * - * @param array<string> $queries - * @return string - */ - public static function and(array $queries): string - { - foreach ($queries as &$query) { - $query = \json_decode($query, true); - } - return (new Query('and', null, $queries))->__toString(); - } -} diff --git a/src/Appwrite/Role.php b/src/Appwrite/Role.php deleted file mode 100644 index 2cc3ffb..0000000 --- a/src/Appwrite/Role.php +++ /dev/null @@ -1,111 +0,0 @@ -<?php - -namespace Appwrite; - -/** - * Helper class to generate role strings for Permission. - */ -class Role -{ - /** - * Grants access to anyone. - * - * This includes authenticated and unauthenticated users. - * - * @return string - */ - public static function any(): string - { - return 'any'; - } - - /** - * Grants access to a specific user by user ID. - * - * You can optionally pass verified or unverified for - * `status` to target specific types of users. - * - * @param string $id - * @param string $status - * @return string - */ - public static function user(string $id, string $status = ""): string - { - if(empty($status)) { - return "user:$id"; - } - return "user:$id/$status"; - } - - /** - * Grants access to any authenticated or anonymous user. - * - * You can optionally pass verified or unverified for - * `status` to target specific types of users. - * - * @param string $status - * @return string - */ - public static function users(string $status = ""): string - { - if(empty($status)) { - return 'users'; - } - return "users/$status"; - } - - /** - * Grants access to any guest user without a session. - * - * Authenticated users don't have access to this role. - * - * @return string - */ - public static function guests(): string - { - return 'guests'; - } - - /** - * Grants access to a team by team ID. - * - * You can optionally pass a role for `role` to target - * team members with the specified role. - * - * @param string $id - * @param string $role - * @return string - */ - public static function team(string $id, string $role = ""): string - { - if(empty($role)) { - return "team:$id"; - } - return "team:$id/$role"; - } - - /** - * Grants access to a specific member of a team. - * - * When the member is removed from the team, they will - * no longer have access. - * - * @param string $id - * @return string - */ - public static function member(string $id): string - { - return "member:$id"; - } - - /** - * Grants access to a user with the specified label. - * - * @param string $name - * @return string - */ - public static function label(string $name): string - { - return "label:$name"; - } -} \ No newline at end of file diff --git a/src/Appwrite/Service.php b/src/Appwrite/Service.php deleted file mode 100644 index ea3ad92..0000000 --- a/src/Appwrite/Service.php +++ /dev/null @@ -1,19 +0,0 @@ -<?php - -namespace Appwrite; - -abstract class Service -{ - /** - * @var Client - */ - protected $client; - - /** - * @param Client $client - */ - public function __construct(Client $client) - { - $this->client = $client; - } -} \ No newline at end of file diff --git a/src/Appwrite/Services/Account.php b/src/Appwrite/Services/Account.php deleted file mode 100644 index 4fc1df2..0000000 --- a/src/Appwrite/Services/Account.php +++ /dev/null @@ -1,1567 +0,0 @@ -<?php - -namespace Appwrite\Services; - -use Appwrite\AppwriteException; -use Appwrite\Client; -use Appwrite\Service; -use Appwrite\InputFile; -use Appwrite\Enums\AuthenticatorType; -use Appwrite\Enums\AuthenticationFactor; -use Appwrite\Enums\OAuthProvider; - -class Account extends Service -{ - public function __construct(Client $client) - { - $this->client = $client; - } - - /** - * Get account - * - * Get the currently logged in user. - * - * @throws AppwriteException - * @return array - - */ - public function get(): array - { - $apiPath = str_replace([], [], '/account'); - - $apiParams = []; - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create account - * - * Use this endpoint to allow a new user to register a new account in your - * project. After the user registration completes successfully, you can use - * the - * [/account/verfication](https://appwrite.io/docs/references/cloud/client-web/account#createVerification) - * route to start verifying the user email address. To allow the new user to - * login to their new account, you need to create a new [account - * session](https://appwrite.io/docs/references/cloud/client-web/account#createEmailSession). - * - * @param string $userId - * @param string $email - * @param string $password - * @param string $name - * @throws AppwriteException - * @return array - - */ - public function create(string $userId, string $email, string $password, string $name = null): array - { - $apiPath = str_replace([], [], '/account'); - - $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (!isset($email)) { - throw new AppwriteException('Missing required parameter: "email"'); - } - if (!isset($password)) { - throw new AppwriteException('Missing required parameter: "password"'); - } - if (!is_null($userId)) { - $apiParams['userId'] = $userId; - } - if (!is_null($email)) { - $apiParams['email'] = $email; - } - if (!is_null($password)) { - $apiParams['password'] = $password; - } - if (!is_null($name)) { - $apiParams['name'] = $name; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update email - * - * Update currently logged in user account email address. After changing user - * address, the user confirmation status will get reset. A new confirmation - * email is not sent automatically however you can use the send confirmation - * email endpoint again to send the confirmation email. For security measures, - * user password is required to complete this request. - * This endpoint can also be used to convert an anonymous account to a normal - * one, by passing an email address and a new password. - * - * - * @param string $email - * @param string $password - * @throws AppwriteException - * @return array - - */ - public function updateEmail(string $email, string $password): array - { - $apiPath = str_replace([], [], '/account/email'); - - $apiParams = []; - if (!isset($email)) { - throw new AppwriteException('Missing required parameter: "email"'); - } - if (!isset($password)) { - throw new AppwriteException('Missing required parameter: "password"'); - } - if (!is_null($email)) { - $apiParams['email'] = $email; - } - if (!is_null($password)) { - $apiParams['password'] = $password; - } - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * List Identities - * - * Get the list of identities for the currently logged in user. - * - * @param array $queries - * @throws AppwriteException - * @return array - - */ - public function listIdentities(array $queries = null): array - { - $apiPath = str_replace([], [], '/account/identities'); - - $apiParams = []; - if (!is_null($queries)) { - $apiParams['queries'] = $queries; - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Delete identity - * - * Delete an identity by its unique ID. - * - * @param string $identityId - * @throws AppwriteException - * @return string - - */ - public function deleteIdentity(string $identityId): string - { - $apiPath = str_replace(['{identityId}'], [$identityId], '/account/identities/{identityId}'); - - $apiParams = []; - if (!isset($identityId)) { - throw new AppwriteException('Missing required parameter: "identityId"'); - } - return $this->client->call( - Client::METHOD_DELETE, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create JWT - * - * Use this endpoint to create a JSON Web Token. You can use the resulting JWT - * to authenticate on behalf of the current user when working with the - * Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes - * from its creation and will be invalid if the user will logout in that time - * frame. - * - * @throws AppwriteException - * @return array - - */ - public function createJWT(): array - { - $apiPath = str_replace([], [], '/account/jwts'); - - $apiParams = []; - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * List logs - * - * Get the list of latest security activity logs for the currently logged in - * user. Each log returns user IP address, location and date and time of log. - * - * @param array $queries - * @throws AppwriteException - * @return array - - */ - public function listLogs(array $queries = null): array - { - $apiPath = str_replace([], [], '/account/logs'); - - $apiParams = []; - if (!is_null($queries)) { - $apiParams['queries'] = $queries; - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update MFA - * - * Enable or disable MFA on an account. - * - * @param bool $mfa - * @throws AppwriteException - * @return array - - */ - public function updateMFA(bool $mfa): array - { - $apiPath = str_replace([], [], '/account/mfa'); - - $apiParams = []; - if (!isset($mfa)) { - throw new AppwriteException('Missing required parameter: "mfa"'); - } - if (!is_null($mfa)) { - $apiParams['mfa'] = $mfa; - } - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Add Authenticator - * - * Add an authenticator app to be used as an MFA factor. Verify the - * authenticator using the [verify - * authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) - * method. - * - * @param AuthenticatorType $type - * @throws AppwriteException - * @return array - - */ - public function createMfaAuthenticator(AuthenticatorType $type): array - { - $apiPath = str_replace(['{type}'], [$type], '/account/mfa/authenticators/{type}'); - - $apiParams = []; - if (!isset($type)) { - throw new AppwriteException('Missing required parameter: "type"'); - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Verify Authenticator - * - * Verify an authenticator app after adding it using the [add - * authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) - * method. - * - * @param AuthenticatorType $type - * @param string $otp - * @throws AppwriteException - * @return array - - */ - public function updateMfaAuthenticator(AuthenticatorType $type, string $otp): array - { - $apiPath = str_replace(['{type}'], [$type], '/account/mfa/authenticators/{type}'); - - $apiParams = []; - if (!isset($type)) { - throw new AppwriteException('Missing required parameter: "type"'); - } - if (!isset($otp)) { - throw new AppwriteException('Missing required parameter: "otp"'); - } - if (!is_null($otp)) { - $apiParams['otp'] = $otp; - } - return $this->client->call( - Client::METHOD_PUT, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Delete Authenticator - * - * Delete an authenticator for a user by ID. - * - * @param AuthenticatorType $type - * @param string $otp - * @throws AppwriteException - * @return string - - */ - public function deleteMfaAuthenticator(AuthenticatorType $type, string $otp): string - { - $apiPath = str_replace(['{type}'], [$type], '/account/mfa/authenticators/{type}'); - - $apiParams = []; - if (!isset($type)) { - throw new AppwriteException('Missing required parameter: "type"'); - } - if (!isset($otp)) { - throw new AppwriteException('Missing required parameter: "otp"'); - } - if (!is_null($otp)) { - $apiParams['otp'] = $otp; - } - return $this->client->call( - Client::METHOD_DELETE, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create 2FA Challenge - * - * Begin the process of MFA verification after sign-in. Finish the flow with - * [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) - * method. - * - * @param AuthenticationFactor $factor - * @throws AppwriteException - * @return array - - */ - public function createMfaChallenge(AuthenticationFactor $factor): array - { - $apiPath = str_replace([], [], '/account/mfa/challenge'); - - $apiParams = []; - if (!isset($factor)) { - throw new AppwriteException('Missing required parameter: "factor"'); - } - if (!is_null($factor)) { - $apiParams['factor'] = $factor; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create MFA Challenge (confirmation) - * - * Complete the MFA challenge by providing the one-time password. Finish the - * process of MFA verification by providing the one-time password. To begin - * the flow, use - * [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) - * method. - * - * @param string $challengeId - * @param string $otp - * @throws AppwriteException - * @return string - - */ - public function updateMfaChallenge(string $challengeId, string $otp): string - { - $apiPath = str_replace([], [], '/account/mfa/challenge'); - - $apiParams = []; - if (!isset($challengeId)) { - throw new AppwriteException('Missing required parameter: "challengeId"'); - } - if (!isset($otp)) { - throw new AppwriteException('Missing required parameter: "otp"'); - } - if (!is_null($challengeId)) { - $apiParams['challengeId'] = $challengeId; - } - if (!is_null($otp)) { - $apiParams['otp'] = $otp; - } - return $this->client->call( - Client::METHOD_PUT, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * List Factors - * - * List the factors available on the account to be used as a MFA challange. - * - * @throws AppwriteException - * @return array - - */ - public function listMfaFactors(): array - { - $apiPath = str_replace([], [], '/account/mfa/factors'); - - $apiParams = []; - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get MFA Recovery Codes - * - * Get recovery codes that can be used as backup for MFA flow. Before getting - * codes, they must be generated using - * [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) - * method. An OTP challenge is required to read recovery codes. - * - * @throws AppwriteException - * @return array - - */ - public function getMfaRecoveryCodes(): array - { - $apiPath = str_replace([], [], '/account/mfa/recovery-codes'); - - $apiParams = []; - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create MFA Recovery Codes - * - * Generate recovery codes as backup for MFA flow. It's recommended to - * generate and show then immediately after user successfully adds their - * authehticator. Recovery codes can be used as a MFA verification type in - * [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) - * method. - * - * @throws AppwriteException - * @return array - - */ - public function createMfaRecoveryCodes(): array - { - $apiPath = str_replace([], [], '/account/mfa/recovery-codes'); - - $apiParams = []; - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Regenerate MFA Recovery Codes - * - * Regenerate recovery codes that can be used as backup for MFA flow. Before - * regenerating codes, they must be first generated using - * [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) - * method. An OTP challenge is required to regenreate recovery codes. - * - * @throws AppwriteException - * @return array - - */ - public function updateMfaRecoveryCodes(): array - { - $apiPath = str_replace([], [], '/account/mfa/recovery-codes'); - - $apiParams = []; - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update name - * - * Update currently logged in user account name. - * - * @param string $name - * @throws AppwriteException - * @return array - - */ - public function updateName(string $name): array - { - $apiPath = str_replace([], [], '/account/name'); - - $apiParams = []; - if (!isset($name)) { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (!is_null($name)) { - $apiParams['name'] = $name; - } - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update password - * - * Update currently logged in user password. For validation, user is required - * to pass in the new password, and the old password. For users created with - * OAuth, Team Invites and Magic URL, oldPassword is optional. - * - * @param string $password - * @param string $oldPassword - * @throws AppwriteException - * @return array - - */ - public function updatePassword(string $password, string $oldPassword = null): array - { - $apiPath = str_replace([], [], '/account/password'); - - $apiParams = []; - if (!isset($password)) { - throw new AppwriteException('Missing required parameter: "password"'); - } - if (!is_null($password)) { - $apiParams['password'] = $password; - } - if (!is_null($oldPassword)) { - $apiParams['oldPassword'] = $oldPassword; - } - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update phone - * - * Update the currently logged in user's phone number. After updating the - * phone number, the phone verification status will be reset. A confirmation - * SMS is not sent automatically, however you can use the [POST - * /account/verification/phone](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneVerification) - * endpoint to send a confirmation SMS. - * - * @param string $phone - * @param string $password - * @throws AppwriteException - * @return array - - */ - public function updatePhone(string $phone, string $password): array - { - $apiPath = str_replace([], [], '/account/phone'); - - $apiParams = []; - if (!isset($phone)) { - throw new AppwriteException('Missing required parameter: "phone"'); - } - if (!isset($password)) { - throw new AppwriteException('Missing required parameter: "password"'); - } - if (!is_null($phone)) { - $apiParams['phone'] = $phone; - } - if (!is_null($password)) { - $apiParams['password'] = $password; - } - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get account preferences - * - * Get the preferences as a key-value object for the currently logged in user. - * - * @throws AppwriteException - * @return array - - */ - public function getPrefs(): array - { - $apiPath = str_replace([], [], '/account/prefs'); - - $apiParams = []; - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update preferences - * - * Update currently logged in user account preferences. The object you pass is - * stored as is, and replaces any previous value. The maximum allowed prefs - * size is 64kB and throws error if exceeded. - * - * @param array $prefs - * @throws AppwriteException - * @return array - - */ - public function updatePrefs(array $prefs): array - { - $apiPath = str_replace([], [], '/account/prefs'); - - $apiParams = []; - if (!isset($prefs)) { - throw new AppwriteException('Missing required parameter: "prefs"'); - } - if (!is_null($prefs)) { - $apiParams['prefs'] = $prefs; - } - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create password recovery - * - * Sends the user an email with a temporary secret key for password reset. - * When the user clicks the confirmation link he is redirected back to your - * app password reset URL with the secret key and email address values - * attached to the URL query string. Use the query string params to submit a - * request to the [PUT - * /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#updateRecovery) - * endpoint to complete the process. The verification link sent to the user's - * email address is valid for 1 hour. - * - * @param string $email - * @param string $url - * @throws AppwriteException - * @return array - - */ - public function createRecovery(string $email, string $url): array - { - $apiPath = str_replace([], [], '/account/recovery'); - - $apiParams = []; - if (!isset($email)) { - throw new AppwriteException('Missing required parameter: "email"'); - } - if (!isset($url)) { - throw new AppwriteException('Missing required parameter: "url"'); - } - if (!is_null($email)) { - $apiParams['email'] = $email; - } - if (!is_null($url)) { - $apiParams['url'] = $url; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create password recovery (confirmation) - * - * Use this endpoint to complete the user account password reset. Both the - * **userId** and **secret** arguments will be passed as query parameters to - * the redirect URL you have provided when sending your request to the [POST - * /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#createRecovery) - * endpoint. - * - * Please note that in order to avoid a [Redirect - * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) - * the only valid redirect URLs are the ones from domains you have set when - * adding your platforms in the console interface. - * - * @param string $userId - * @param string $secret - * @param string $password - * @throws AppwriteException - * @return array - - */ - public function updateRecovery(string $userId, string $secret, string $password): array - { - $apiPath = str_replace([], [], '/account/recovery'); - - $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (!isset($secret)) { - throw new AppwriteException('Missing required parameter: "secret"'); - } - if (!isset($password)) { - throw new AppwriteException('Missing required parameter: "password"'); - } - if (!is_null($userId)) { - $apiParams['userId'] = $userId; - } - if (!is_null($secret)) { - $apiParams['secret'] = $secret; - } - if (!is_null($password)) { - $apiParams['password'] = $password; - } - return $this->client->call( - Client::METHOD_PUT, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * List sessions - * - * Get the list of active sessions across different devices for the currently - * logged in user. - * - * @throws AppwriteException - * @return array - - */ - public function listSessions(): array - { - $apiPath = str_replace([], [], '/account/sessions'); - - $apiParams = []; - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Delete sessions - * - * Delete all sessions from the user account and remove any sessions cookies - * from the end client. - * - * @throws AppwriteException - * @return string - - */ - public function deleteSessions(): string - { - $apiPath = str_replace([], [], '/account/sessions'); - - $apiParams = []; - return $this->client->call( - Client::METHOD_DELETE, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create anonymous session - * - * Use this endpoint to allow a new user to register an anonymous account in - * your project. This route will also create a new session for the user. To - * allow the new user to convert an anonymous account to a normal account, you - * need to update its [email and - * password](https://appwrite.io/docs/references/cloud/client-web/account#updateEmail) - * or create an [OAuth2 - * session](https://appwrite.io/docs/references/cloud/client-web/account#CreateOAuth2Session). - * - * @throws AppwriteException - * @return array - - */ - public function createAnonymousSession(): array - { - $apiPath = str_replace([], [], '/account/sessions/anonymous'); - - $apiParams = []; - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create email password session - * - * Allow the user to login into their account by providing a valid email and - * password combination. This route will create a new session for the user. - * - * 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). - * - * @param string $email - * @param string $password - * @throws AppwriteException - * @return array - - */ - public function createEmailPasswordSession(string $email, string $password): array - { - $apiPath = str_replace([], [], '/account/sessions/email'); - - $apiParams = []; - if (!isset($email)) { - throw new AppwriteException('Missing required parameter: "email"'); - } - if (!isset($password)) { - throw new AppwriteException('Missing required parameter: "password"'); - } - if (!is_null($email)) { - $apiParams['email'] = $email; - } - if (!is_null($password)) { - $apiParams['password'] = $password; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update magic URL session - * - * Use this endpoint to create a session from token. Provide the **userId** - * and **secret** parameters from the successful response of authentication - * flows initiated by token creation. For example, magic URL and phone login. - * - * @param string $userId - * @param string $secret - * @throws AppwriteException - * @return array - - */ - public function updateMagicURLSession(string $userId, string $secret): array - { - $apiPath = str_replace([], [], '/account/sessions/magic-url'); - - $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (!isset($secret)) { - throw new AppwriteException('Missing required parameter: "secret"'); - } - if (!is_null($userId)) { - $apiParams['userId'] = $userId; - } - if (!is_null($secret)) { - $apiParams['secret'] = $secret; - } - return $this->client->call( - Client::METHOD_PUT, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update phone session - * - * Use this endpoint to create a session from token. Provide the **userId** - * and **secret** parameters from the successful response of authentication - * flows initiated by token creation. For example, magic URL and phone login. - * - * @param string $userId - * @param string $secret - * @throws AppwriteException - * @return array - - */ - public function updatePhoneSession(string $userId, string $secret): array - { - $apiPath = str_replace([], [], '/account/sessions/phone'); - - $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (!isset($secret)) { - throw new AppwriteException('Missing required parameter: "secret"'); - } - if (!is_null($userId)) { - $apiParams['userId'] = $userId; - } - if (!is_null($secret)) { - $apiParams['secret'] = $secret; - } - return $this->client->call( - Client::METHOD_PUT, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create session - * - * Use this endpoint to create a session from token. Provide the **userId** - * and **secret** parameters from the successful response of authentication - * flows initiated by token creation. For example, magic URL and phone login. - * - * @param string $userId - * @param string $secret - * @throws AppwriteException - * @return array - - */ - public function createSession(string $userId, string $secret): array - { - $apiPath = str_replace([], [], '/account/sessions/token'); - - $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (!isset($secret)) { - throw new AppwriteException('Missing required parameter: "secret"'); - } - if (!is_null($userId)) { - $apiParams['userId'] = $userId; - } - if (!is_null($secret)) { - $apiParams['secret'] = $secret; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get session - * - * Use this endpoint to get a logged in user's session using a Session ID. - * Inputting 'current' will return the current session being used. - * - * @param string $sessionId - * @throws AppwriteException - * @return array - - */ - public function getSession(string $sessionId): array - { - $apiPath = str_replace(['{sessionId}'], [$sessionId], '/account/sessions/{sessionId}'); - - $apiParams = []; - if (!isset($sessionId)) { - throw new AppwriteException('Missing required parameter: "sessionId"'); - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update session - * - * Use this endpoint to extend a session's length. Extending a session is - * useful when session expiry is short. If the session was created using an - * OAuth provider, this endpoint refreshes the access token from the provider. - * - * @param string $sessionId - * @throws AppwriteException - * @return array - - */ - public function updateSession(string $sessionId): array - { - $apiPath = str_replace(['{sessionId}'], [$sessionId], '/account/sessions/{sessionId}'); - - $apiParams = []; - if (!isset($sessionId)) { - throw new AppwriteException('Missing required parameter: "sessionId"'); - } - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Delete session - * - * Logout the user. Use 'current' as the session ID to logout on this device, - * use a session ID to logout on another device. If you're looking to logout - * the user on all devices, use [Delete - * Sessions](https://appwrite.io/docs/references/cloud/client-web/account#deleteSessions) - * instead. - * - * @param string $sessionId - * @throws AppwriteException - * @return string - - */ - public function deleteSession(string $sessionId): string - { - $apiPath = str_replace(['{sessionId}'], [$sessionId], '/account/sessions/{sessionId}'); - - $apiParams = []; - if (!isset($sessionId)) { - throw new AppwriteException('Missing required parameter: "sessionId"'); - } - return $this->client->call( - Client::METHOD_DELETE, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update status - * - * Block the currently logged in user account. Behind the scene, the user - * record is not deleted but permanently blocked from any access. To - * completely delete a user, use the Users API instead. - * - * @throws AppwriteException - * @return array - - */ - public function updateStatus(): array - { - $apiPath = str_replace([], [], '/account/status'); - - $apiParams = []; - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create email token (OTP) - * - * Sends the user an email with a secret key for creating a session. If the - * provided user ID has not be registered, a new user will be created. Use the - * returned user ID and secret and submit a request to the [POST - * /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) - * endpoint to complete the login process. The secret sent to the user's email - * is valid for 15 minutes. - * - * 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). - * - * @param string $userId - * @param string $email - * @param bool $phrase - * @throws AppwriteException - * @return array - - */ - public function createEmailToken(string $userId, string $email, bool $phrase = null): array - { - $apiPath = str_replace([], [], '/account/tokens/email'); - - $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (!isset($email)) { - throw new AppwriteException('Missing required parameter: "email"'); - } - if (!is_null($userId)) { - $apiParams['userId'] = $userId; - } - if (!is_null($email)) { - $apiParams['email'] = $email; - } - if (!is_null($phrase)) { - $apiParams['phrase'] = $phrase; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create magic URL token - * - * Sends the user an email with a secret key for creating a session. If the - * provided user ID has not been registered, a new user will be created. When - * the user clicks the link in the email, the user is redirected back to the - * URL you provided with the secret key and userId values attached to the URL - * query string. Use the query string parameters to submit a request to the - * [POST - * /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) - * endpoint to complete the login process. The link sent to the user's email - * address is valid for 1 hour. If you are on a mobile device you can leave - * the URL parameter empty, so that the login completion will be handled by - * your Appwrite instance by default. - * - * 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). - * - * - * @param string $userId - * @param string $email - * @param string $url - * @param bool $phrase - * @throws AppwriteException - * @return array - - */ - public function createMagicURLToken(string $userId, string $email, string $url = null, bool $phrase = null): array - { - $apiPath = str_replace([], [], '/account/tokens/magic-url'); - - $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (!isset($email)) { - throw new AppwriteException('Missing required parameter: "email"'); - } - if (!is_null($userId)) { - $apiParams['userId'] = $userId; - } - if (!is_null($email)) { - $apiParams['email'] = $email; - } - if (!is_null($url)) { - $apiParams['url'] = $url; - } - if (!is_null($phrase)) { - $apiParams['phrase'] = $phrase; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create OAuth2 token - * - * Allow the user to login to their account using the OAuth2 provider of their - * choice. Each OAuth2 provider should be enabled from the Appwrite console - * first. Use the success and failure arguments to provide a redirect URL's - * back to your app when login is completed. - * - * If authentication succeeds, `userId` and `secret` of a token will be - * appended to the success URL as query parameters. These can be used to - * create a new session using the [Create - * session](https://appwrite.io/docs/references/cloud/client-web/account#createSession) - * endpoint. - * - * 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). - * - * @param OAuthProvider $provider - * @param string $success - * @param string $failure - * @param array $scopes - * @throws AppwriteException - * @return string - - */ - public function createOAuth2Token(OAuthProvider $provider, string $success = null, string $failure = null, array $scopes = null): string - { - $apiPath = str_replace(['{provider}'], [$provider], '/account/tokens/oauth2/{provider}'); - - $apiParams = []; - if (!isset($provider)) { - throw new AppwriteException('Missing required parameter: "provider"'); - } - if (!is_null($success)) { - $apiParams['success'] = $success; - } - if (!is_null($failure)) { - $apiParams['failure'] = $failure; - } - if (!is_null($scopes)) { - $apiParams['scopes'] = $scopes; - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams, 'location' - ); - } - - /** - * Create phone token - * - * Sends the user an SMS with a secret key for creating a session. If the - * provided user ID has not be registered, a new user will be created. Use the - * returned user ID and secret and submit a request to the [POST - * /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) - * endpoint to complete the login process. The secret sent to the user's phone - * is valid for 15 minutes. - * - * 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). - * - * @param string $userId - * @param string $phone - * @throws AppwriteException - * @return array - - */ - public function createPhoneToken(string $userId, string $phone): array - { - $apiPath = str_replace([], [], '/account/tokens/phone'); - - $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (!isset($phone)) { - throw new AppwriteException('Missing required parameter: "phone"'); - } - if (!is_null($userId)) { - $apiParams['userId'] = $userId; - } - if (!is_null($phone)) { - $apiParams['phone'] = $phone; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create email verification - * - * Use this endpoint to send a verification message to your user email address - * to confirm they are the valid owners of that address. Both the **userId** - * and **secret** arguments will be passed as query parameters to the URL you - * have provided to be attached to the verification email. The provided URL - * should redirect the user back to your app and allow you to complete the - * verification process by verifying both the **userId** and **secret** - * parameters. Learn more about how to [complete the verification - * process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification). - * The verification link sent to the user's email address is valid for 7 days. - * - * Please note that in order to avoid a [Redirect - * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), - * the only valid redirect URLs are the ones from domains you have set when - * adding your platforms in the console interface. - * - * - * @param string $url - * @throws AppwriteException - * @return array - - */ - public function createVerification(string $url): array - { - $apiPath = str_replace([], [], '/account/verification'); - - $apiParams = []; - if (!isset($url)) { - throw new AppwriteException('Missing required parameter: "url"'); - } - if (!is_null($url)) { - $apiParams['url'] = $url; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create email verification (confirmation) - * - * Use this endpoint to complete the user email verification process. Use both - * the **userId** and **secret** parameters that were attached to your app URL - * to verify the user email ownership. If confirmed this route will return a - * 200 status code. - * - * @param string $userId - * @param string $secret - * @throws AppwriteException - * @return array - - */ - public function updateVerification(string $userId, string $secret): array - { - $apiPath = str_replace([], [], '/account/verification'); - - $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (!isset($secret)) { - throw new AppwriteException('Missing required parameter: "secret"'); - } - if (!is_null($userId)) { - $apiParams['userId'] = $userId; - } - if (!is_null($secret)) { - $apiParams['secret'] = $secret; - } - return $this->client->call( - Client::METHOD_PUT, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create phone verification - * - * 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 - * using the - * [accountUpdatePhone](https://appwrite.io/docs/references/cloud/client-web/account#updatePhone) - * endpoint. Learn more about how to [complete the verification - * process](https://appwrite.io/docs/references/cloud/client-web/account#updatePhoneVerification). - * The verification code sent to the user's phone number is valid for 15 - * minutes. - * - * @throws AppwriteException - * @return array - - */ - public function createPhoneVerification(): array - { - $apiPath = str_replace([], [], '/account/verification/phone'); - - $apiParams = []; - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create phone verification (confirmation) - * - * Use this endpoint to complete the user phone verification process. Use the - * **userId** and **secret** that were sent to your user's phone number to - * verify the user email ownership. If confirmed this route will return a 200 - * status code. - * - * @param string $userId - * @param string $secret - * @throws AppwriteException - * @return array - - */ - public function updatePhoneVerification(string $userId, string $secret): array - { - $apiPath = str_replace([], [], '/account/verification/phone'); - - $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (!isset($secret)) { - throw new AppwriteException('Missing required parameter: "secret"'); - } - if (!is_null($userId)) { - $apiParams['userId'] = $userId; - } - if (!is_null($secret)) { - $apiParams['secret'] = $secret; - } - return $this->client->call( - Client::METHOD_PUT, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } -} diff --git a/src/Appwrite/Services/Avatars.php b/src/Appwrite/Services/Avatars.php deleted file mode 100644 index 10b0ad3..0000000 --- a/src/Appwrite/Services/Avatars.php +++ /dev/null @@ -1,346 +0,0 @@ -<?php - -namespace Appwrite\Services; - -use Appwrite\AppwriteException; -use Appwrite\Client; -use Appwrite\Service; -use Appwrite\InputFile; -use Appwrite\Enums\Browser; -use Appwrite\Enums\CreditCard; -use Appwrite\Enums\Flag; - -class Avatars extends Service -{ - public function __construct(Client $client) - { - $this->client = $client; - } - - /** - * Get browser icon - * - * You can use this endpoint to show different browser icons to your users. - * The code argument receives the browser code as it appears in your user [GET - * /account/sessions](https://appwrite.io/docs/references/cloud/client-web/account#getSessions) - * endpoint. Use width, height and quality arguments to change the output - * settings. - * - * When one dimension is specified and the other is 0, the image is scaled - * with preserved aspect ratio. If both dimensions are 0, the API provides an - * image at source quality. If dimensions are not specified, the default size - * of image returned is 100x100px. - * - * @param Browser $code - * @param int $width - * @param int $height - * @param int $quality - * @throws AppwriteException - * @return string - - */ - public function getBrowser(Browser $code, int $width = null, int $height = null, int $quality = null): string - { - $apiPath = str_replace(['{code}'], [$code], '/avatars/browsers/{code}'); - - $apiParams = []; - if (!isset($code)) { - throw new AppwriteException('Missing required parameter: "code"'); - } - if (!is_null($width)) { - $apiParams['width'] = $width; - } - if (!is_null($height)) { - $apiParams['height'] = $height; - } - if (!is_null($quality)) { - $apiParams['quality'] = $quality; - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get credit card icon - * - * The credit card endpoint will return you the icon of the credit card - * provider you need. Use width, height and quality arguments to change the - * output settings. - * - * When one dimension is specified and the other is 0, the image is scaled - * with preserved aspect ratio. If both dimensions are 0, the API provides an - * image at source quality. If dimensions are not specified, the default size - * of image returned is 100x100px. - * - * - * @param CreditCard $code - * @param int $width - * @param int $height - * @param int $quality - * @throws AppwriteException - * @return string - - */ - public function getCreditCard(CreditCard $code, int $width = null, int $height = null, int $quality = null): string - { - $apiPath = str_replace(['{code}'], [$code], '/avatars/credit-cards/{code}'); - - $apiParams = []; - if (!isset($code)) { - throw new AppwriteException('Missing required parameter: "code"'); - } - if (!is_null($width)) { - $apiParams['width'] = $width; - } - if (!is_null($height)) { - $apiParams['height'] = $height; - } - if (!is_null($quality)) { - $apiParams['quality'] = $quality; - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get favicon - * - * Use this endpoint to fetch the favorite icon (AKA favicon) of any remote - * website URL. - * - * - * @param string $url - * @throws AppwriteException - * @return string - - */ - public function getFavicon(string $url): string - { - $apiPath = str_replace([], [], '/avatars/favicon'); - - $apiParams = []; - if (!isset($url)) { - throw new AppwriteException('Missing required parameter: "url"'); - } - if (!is_null($url)) { - $apiParams['url'] = $url; - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get country flag - * - * You can use this endpoint to show different country flags icons to your - * users. The code argument receives the 2 letter country code. Use width, - * height and quality arguments to change the output settings. Country codes - * follow the [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) standard. - * - * When one dimension is specified and the other is 0, the image is scaled - * with preserved aspect ratio. If both dimensions are 0, the API provides an - * image at source quality. If dimensions are not specified, the default size - * of image returned is 100x100px. - * - * - * @param Flag $code - * @param int $width - * @param int $height - * @param int $quality - * @throws AppwriteException - * @return string - - */ - public function getFlag(Flag $code, int $width = null, int $height = null, int $quality = null): string - { - $apiPath = str_replace(['{code}'], [$code], '/avatars/flags/{code}'); - - $apiParams = []; - if (!isset($code)) { - throw new AppwriteException('Missing required parameter: "code"'); - } - if (!is_null($width)) { - $apiParams['width'] = $width; - } - if (!is_null($height)) { - $apiParams['height'] = $height; - } - if (!is_null($quality)) { - $apiParams['quality'] = $quality; - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get image from URL - * - * Use this endpoint to fetch a remote image URL and crop it to any image size - * you want. This endpoint is very useful if you need to crop and display - * remote images in your app or in case you want to make sure a 3rd party - * image is properly served using a TLS protocol. - * - * When one dimension is specified and the other is 0, the image is scaled - * with preserved aspect ratio. If both dimensions are 0, the API provides an - * image at source quality. If dimensions are not specified, the default size - * of image returned is 400x400px. - * - * - * @param string $url - * @param int $width - * @param int $height - * @throws AppwriteException - * @return string - - */ - public function getImage(string $url, int $width = null, int $height = null): string - { - $apiPath = str_replace([], [], '/avatars/image'); - - $apiParams = []; - if (!isset($url)) { - throw new AppwriteException('Missing required parameter: "url"'); - } - if (!is_null($url)) { - $apiParams['url'] = $url; - } - if (!is_null($width)) { - $apiParams['width'] = $width; - } - if (!is_null($height)) { - $apiParams['height'] = $height; - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get user initials - * - * Use this endpoint to show your user initials avatar icon on your website or - * app. By default, this route will try to print your logged-in user name or - * email initials. You can also overwrite the user name if you pass the 'name' - * parameter. If no name is given and no user is logged, an empty avatar will - * be returned. - * - * You can use the color and background params to change the avatar colors. By - * default, a random theme will be selected. The random theme will persist for - * the user's initials when reloading the same theme will always return for - * the same initials. - * - * When one dimension is specified and the other is 0, the image is scaled - * with preserved aspect ratio. If both dimensions are 0, the API provides an - * image at source quality. If dimensions are not specified, the default size - * of image returned is 100x100px. - * - * - * @param string $name - * @param int $width - * @param int $height - * @param string $background - * @throws AppwriteException - * @return string - - */ - public function getInitials(string $name = null, int $width = null, int $height = null, string $background = null): string - { - $apiPath = str_replace([], [], '/avatars/initials'); - - $apiParams = []; - if (!is_null($name)) { - $apiParams['name'] = $name; - } - if (!is_null($width)) { - $apiParams['width'] = $width; - } - if (!is_null($height)) { - $apiParams['height'] = $height; - } - if (!is_null($background)) { - $apiParams['background'] = $background; - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get QR code - * - * 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. - * - * - * @param string $text - * @param int $size - * @param int $margin - * @param bool $download - * @throws AppwriteException - * @return string - - */ - public function getQR(string $text, int $size = null, int $margin = null, bool $download = null): string - { - $apiPath = str_replace([], [], '/avatars/qr'); - - $apiParams = []; - if (!isset($text)) { - throw new AppwriteException('Missing required parameter: "text"'); - } - if (!is_null($text)) { - $apiParams['text'] = $text; - } - if (!is_null($size)) { - $apiParams['size'] = $size; - } - if (!is_null($margin)) { - $apiParams['margin'] = $margin; - } - if (!is_null($download)) { - $apiParams['download'] = $download; - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } -} diff --git a/src/Appwrite/Services/Databases.php b/src/Appwrite/Services/Databases.php deleted file mode 100644 index 1975a33..0000000 --- a/src/Appwrite/Services/Databases.php +++ /dev/null @@ -1,2001 +0,0 @@ -<?php - -namespace Appwrite\Services; - -use Appwrite\AppwriteException; -use Appwrite\Client; -use Appwrite\Service; -use Appwrite\InputFile; -use Appwrite\Enums\RelationshipType; -use Appwrite\Enums\RelationMutate; -use Appwrite\Enums\IndexType; - -class Databases extends Service -{ - public function __construct(Client $client) - { - $this->client = $client; - } - - /** - * List databases - * - * Get a list of all databases from the current Appwrite project. You can use - * the search parameter to filter your results. - * - * @param array $queries - * @param string $search - * @throws AppwriteException - * @return array - - */ - public function list(array $queries = null, string $search = null): array - { - $apiPath = str_replace([], [], '/databases'); - - $apiParams = []; - if (!is_null($queries)) { - $apiParams['queries'] = $queries; - } - if (!is_null($search)) { - $apiParams['search'] = $search; - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create database - * - * Create a new Database. - * - * - * @param string $databaseId - * @param string $name - * @param bool $enabled - * @throws AppwriteException - * @return array - - */ - public function create(string $databaseId, string $name, bool $enabled = null): array - { - $apiPath = str_replace([], [], '/databases'); - - $apiParams = []; - if (!isset($databaseId)) { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (!isset($name)) { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (!is_null($databaseId)) { - $apiParams['databaseId'] = $databaseId; - } - if (!is_null($name)) { - $apiParams['name'] = $name; - } - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get database - * - * Get a database by its unique ID. This endpoint response returns a JSON - * object with the database metadata. - * - * @param string $databaseId - * @throws AppwriteException - * @return array - - */ - public function get(string $databaseId): array - { - $apiPath = str_replace(['{databaseId}'], [$databaseId], '/databases/{databaseId}'); - - $apiParams = []; - if (!isset($databaseId)) { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update database - * - * Update a database by its unique ID. - * - * @param string $databaseId - * @param string $name - * @param bool $enabled - * @throws AppwriteException - * @return array - - */ - public function update(string $databaseId, string $name, bool $enabled = null): array - { - $apiPath = str_replace(['{databaseId}'], [$databaseId], '/databases/{databaseId}'); - - $apiParams = []; - if (!isset($databaseId)) { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (!isset($name)) { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (!is_null($name)) { - $apiParams['name'] = $name; - } - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } - return $this->client->call( - Client::METHOD_PUT, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Delete database - * - * Delete a database by its unique ID. Only API keys with with databases.write - * scope can delete a database. - * - * @param string $databaseId - * @throws AppwriteException - * @return string - - */ - public function delete(string $databaseId): string - { - $apiPath = str_replace(['{databaseId}'], [$databaseId], '/databases/{databaseId}'); - - $apiParams = []; - if (!isset($databaseId)) { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - return $this->client->call( - Client::METHOD_DELETE, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * List collections - * - * Get a list of all collections that belong to the provided databaseId. You - * can use the search parameter to filter your results. - * - * @param string $databaseId - * @param array $queries - * @param string $search - * @throws AppwriteException - * @return array - - */ - public function listCollections(string $databaseId, array $queries = null, string $search = null): array - { - $apiPath = str_replace(['{databaseId}'], [$databaseId], '/databases/{databaseId}/collections'); - - $apiParams = []; - if (!isset($databaseId)) { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (!is_null($queries)) { - $apiParams['queries'] = $queries; - } - if (!is_null($search)) { - $apiParams['search'] = $search; - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create collection - * - * Create a new Collection. Before using this route, you should create a new - * database resource using either a [server - * integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) - * API or directly from your database console. - * - * @param string $databaseId - * @param string $collectionId - * @param string $name - * @param array $permissions - * @param bool $documentSecurity - * @param bool $enabled - * @throws AppwriteException - * @return array - - */ - public function createCollection(string $databaseId, string $collectionId, string $name, array $permissions = null, bool $documentSecurity = null, bool $enabled = null): array - { - $apiPath = str_replace(['{databaseId}'], [$databaseId], '/databases/{databaseId}/collections'); - - $apiParams = []; - if (!isset($databaseId)) { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (!isset($collectionId)) { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (!isset($name)) { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (!is_null($collectionId)) { - $apiParams['collectionId'] = $collectionId; - } - if (!is_null($name)) { - $apiParams['name'] = $name; - } - if (!is_null($permissions)) { - $apiParams['permissions'] = $permissions; - } - if (!is_null($documentSecurity)) { - $apiParams['documentSecurity'] = $documentSecurity; - } - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get collection - * - * Get a collection by its unique ID. This endpoint response returns a JSON - * object with the collection metadata. - * - * @param string $databaseId - * @param string $collectionId - * @throws AppwriteException - * @return array - - */ - public function getCollection(string $databaseId, string $collectionId): array - { - $apiPath = str_replace(['{databaseId}', '{collectionId}'], [$databaseId, $collectionId], '/databases/{databaseId}/collections/{collectionId}'); - - $apiParams = []; - if (!isset($databaseId)) { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (!isset($collectionId)) { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update collection - * - * Update a collection by its unique ID. - * - * @param string $databaseId - * @param string $collectionId - * @param string $name - * @param array $permissions - * @param bool $documentSecurity - * @param bool $enabled - * @throws AppwriteException - * @return array - - */ - public function updateCollection(string $databaseId, string $collectionId, string $name, array $permissions = null, bool $documentSecurity = null, bool $enabled = null): array - { - $apiPath = str_replace(['{databaseId}', '{collectionId}'], [$databaseId, $collectionId], '/databases/{databaseId}/collections/{collectionId}'); - - $apiParams = []; - if (!isset($databaseId)) { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (!isset($collectionId)) { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (!isset($name)) { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (!is_null($name)) { - $apiParams['name'] = $name; - } - if (!is_null($permissions)) { - $apiParams['permissions'] = $permissions; - } - if (!is_null($documentSecurity)) { - $apiParams['documentSecurity'] = $documentSecurity; - } - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } - return $this->client->call( - Client::METHOD_PUT, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Delete collection - * - * Delete a collection by its unique ID. Only users with write permissions - * have access to delete this resource. - * - * @param string $databaseId - * @param string $collectionId - * @throws AppwriteException - * @return string - - */ - public function deleteCollection(string $databaseId, string $collectionId): string - { - $apiPath = str_replace(['{databaseId}', '{collectionId}'], [$databaseId, $collectionId], '/databases/{databaseId}/collections/{collectionId}'); - - $apiParams = []; - if (!isset($databaseId)) { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (!isset($collectionId)) { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - return $this->client->call( - Client::METHOD_DELETE, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * List attributes - * - * List attributes in the collection. - * - * @param string $databaseId - * @param string $collectionId - * @param array $queries - * @throws AppwriteException - * @return array - - */ - public function listAttributes(string $databaseId, string $collectionId, array $queries = null): array - { - $apiPath = str_replace(['{databaseId}', '{collectionId}'], [$databaseId, $collectionId], '/databases/{databaseId}/collections/{collectionId}/attributes'); - - $apiParams = []; - if (!isset($databaseId)) { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (!isset($collectionId)) { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (!is_null($queries)) { - $apiParams['queries'] = $queries; - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create boolean attribute - * - * Create a boolean attribute. - * - * - * @param string $databaseId - * @param string $collectionId - * @param string $key - * @param bool $required - * @param bool $xdefault - * @param bool $xarray - * @throws AppwriteException - * @return array - - */ - public function createBooleanAttribute(string $databaseId, string $collectionId, string $key, bool $required, bool $xdefault = null, bool $xarray = null): array - { - $apiPath = str_replace(['{databaseId}', '{collectionId}'], [$databaseId, $collectionId], '/databases/{databaseId}/collections/{collectionId}/attributes/boolean'); - - $apiParams = []; - if (!isset($databaseId)) { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (!isset($collectionId)) { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (!isset($key)) { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (!isset($required)) { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (!is_null($key)) { - $apiParams['key'] = $key; - } - if (!is_null($required)) { - $apiParams['required'] = $required; - } - if (!is_null($xdefault)) { - $apiParams['default'] = $xdefault; - } - if (!is_null($xarray)) { - $apiParams['array'] = $xarray; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update boolean attribute - * - * Update a boolean attribute. Changing the `default` value will not update - * already existing documents. - * - * @param string $databaseId - * @param string $collectionId - * @param string $key - * @param bool $required - * @param bool $xdefault - * @throws AppwriteException - * @return array - - */ - public function updateBooleanAttribute(string $databaseId, string $collectionId, string $key, bool $required, bool $xdefault): array - { - $apiPath = str_replace(['{databaseId}', '{collectionId}', '{key}'], [$databaseId, $collectionId, $key], '/databases/{databaseId}/collections/{collectionId}/attributes/boolean/{key}'); - - $apiParams = []; - if (!isset($databaseId)) { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (!isset($collectionId)) { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (!isset($key)) { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (!isset($required)) { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (!is_null($required)) { - $apiParams['required'] = $required; - } - if (!is_null($xdefault)) { - $apiParams['default'] = $xdefault; - } - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create datetime attribute - * - * Create a date time attribute according to the ISO 8601 standard. - * - * @param string $databaseId - * @param string $collectionId - * @param string $key - * @param bool $required - * @param string $xdefault - * @param bool $xarray - * @throws AppwriteException - * @return array - - */ - public function createDatetimeAttribute(string $databaseId, string $collectionId, string $key, bool $required, string $xdefault = null, bool $xarray = null): array - { - $apiPath = str_replace(['{databaseId}', '{collectionId}'], [$databaseId, $collectionId], '/databases/{databaseId}/collections/{collectionId}/attributes/datetime'); - - $apiParams = []; - if (!isset($databaseId)) { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (!isset($collectionId)) { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (!isset($key)) { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (!isset($required)) { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (!is_null($key)) { - $apiParams['key'] = $key; - } - if (!is_null($required)) { - $apiParams['required'] = $required; - } - if (!is_null($xdefault)) { - $apiParams['default'] = $xdefault; - } - if (!is_null($xarray)) { - $apiParams['array'] = $xarray; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update dateTime attribute - * - * Update a date time attribute. Changing the `default` value will not update - * already existing documents. - * - * @param string $databaseId - * @param string $collectionId - * @param string $key - * @param bool $required - * @param string $xdefault - * @throws AppwriteException - * @return array - - */ - public function updateDatetimeAttribute(string $databaseId, string $collectionId, string $key, bool $required, string $xdefault): array - { - $apiPath = str_replace(['{databaseId}', '{collectionId}', '{key}'], [$databaseId, $collectionId, $key], '/databases/{databaseId}/collections/{collectionId}/attributes/datetime/{key}'); - - $apiParams = []; - if (!isset($databaseId)) { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (!isset($collectionId)) { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (!isset($key)) { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (!isset($required)) { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (!is_null($required)) { - $apiParams['required'] = $required; - } - if (!is_null($xdefault)) { - $apiParams['default'] = $xdefault; - } - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create email attribute - * - * Create an email attribute. - * - * - * @param string $databaseId - * @param string $collectionId - * @param string $key - * @param bool $required - * @param string $xdefault - * @param bool $xarray - * @throws AppwriteException - * @return array - - */ - public function createEmailAttribute(string $databaseId, string $collectionId, string $key, bool $required, string $xdefault = null, bool $xarray = null): array - { - $apiPath = str_replace(['{databaseId}', '{collectionId}'], [$databaseId, $collectionId], '/databases/{databaseId}/collections/{collectionId}/attributes/email'); - - $apiParams = []; - if (!isset($databaseId)) { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (!isset($collectionId)) { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (!isset($key)) { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (!isset($required)) { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (!is_null($key)) { - $apiParams['key'] = $key; - } - if (!is_null($required)) { - $apiParams['required'] = $required; - } - if (!is_null($xdefault)) { - $apiParams['default'] = $xdefault; - } - if (!is_null($xarray)) { - $apiParams['array'] = $xarray; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update email attribute - * - * Update an email attribute. Changing the `default` value will not update - * already existing documents. - * - * - * @param string $databaseId - * @param string $collectionId - * @param string $key - * @param bool $required - * @param string $xdefault - * @throws AppwriteException - * @return array - - */ - public function updateEmailAttribute(string $databaseId, string $collectionId, string $key, bool $required, string $xdefault): array - { - $apiPath = str_replace(['{databaseId}', '{collectionId}', '{key}'], [$databaseId, $collectionId, $key], '/databases/{databaseId}/collections/{collectionId}/attributes/email/{key}'); - - $apiParams = []; - if (!isset($databaseId)) { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (!isset($collectionId)) { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (!isset($key)) { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (!isset($required)) { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (!is_null($required)) { - $apiParams['required'] = $required; - } - if (!is_null($xdefault)) { - $apiParams['default'] = $xdefault; - } - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create enum attribute - * - * Create an enumeration attribute. The `elements` param acts as a white-list - * of accepted values for this attribute. - * - * - * @param string $databaseId - * @param string $collectionId - * @param string $key - * @param array $elements - * @param bool $required - * @param string $xdefault - * @param bool $xarray - * @throws AppwriteException - * @return array - - */ - public function createEnumAttribute(string $databaseId, string $collectionId, string $key, array $elements, bool $required, string $xdefault = null, bool $xarray = null): array - { - $apiPath = str_replace(['{databaseId}', '{collectionId}'], [$databaseId, $collectionId], '/databases/{databaseId}/collections/{collectionId}/attributes/enum'); - - $apiParams = []; - if (!isset($databaseId)) { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (!isset($collectionId)) { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (!isset($key)) { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (!isset($elements)) { - throw new AppwriteException('Missing required parameter: "elements"'); - } - if (!isset($required)) { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (!is_null($key)) { - $apiParams['key'] = $key; - } - if (!is_null($elements)) { - $apiParams['elements'] = $elements; - } - if (!is_null($required)) { - $apiParams['required'] = $required; - } - if (!is_null($xdefault)) { - $apiParams['default'] = $xdefault; - } - if (!is_null($xarray)) { - $apiParams['array'] = $xarray; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update enum attribute - * - * Update an enum attribute. Changing the `default` value will not update - * already existing documents. - * - * - * @param string $databaseId - * @param string $collectionId - * @param string $key - * @param array $elements - * @param bool $required - * @param string $xdefault - * @throws AppwriteException - * @return array - - */ - public function updateEnumAttribute(string $databaseId, string $collectionId, string $key, array $elements, bool $required, string $xdefault): array - { - $apiPath = str_replace(['{databaseId}', '{collectionId}', '{key}'], [$databaseId, $collectionId, $key], '/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}'); - - $apiParams = []; - if (!isset($databaseId)) { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (!isset($collectionId)) { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (!isset($key)) { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (!isset($elements)) { - throw new AppwriteException('Missing required parameter: "elements"'); - } - if (!isset($required)) { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (!is_null($elements)) { - $apiParams['elements'] = $elements; - } - if (!is_null($required)) { - $apiParams['required'] = $required; - } - if (!is_null($xdefault)) { - $apiParams['default'] = $xdefault; - } - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create float attribute - * - * Create a float attribute. Optionally, minimum and maximum values can be - * provided. - * - * - * @param string $databaseId - * @param string $collectionId - * @param string $key - * @param bool $required - * @param float $min - * @param float $max - * @param float $xdefault - * @param bool $xarray - * @throws AppwriteException - * @return array - - */ - public function createFloatAttribute(string $databaseId, string $collectionId, string $key, bool $required, float $min = null, float $max = null, float $xdefault = null, bool $xarray = null): array - { - $apiPath = str_replace(['{databaseId}', '{collectionId}'], [$databaseId, $collectionId], '/databases/{databaseId}/collections/{collectionId}/attributes/float'); - - $apiParams = []; - if (!isset($databaseId)) { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (!isset($collectionId)) { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (!isset($key)) { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (!isset($required)) { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (!is_null($key)) { - $apiParams['key'] = $key; - } - if (!is_null($required)) { - $apiParams['required'] = $required; - } - if (!is_null($min)) { - $apiParams['min'] = $min; - } - if (!is_null($max)) { - $apiParams['max'] = $max; - } - if (!is_null($xdefault)) { - $apiParams['default'] = $xdefault; - } - if (!is_null($xarray)) { - $apiParams['array'] = $xarray; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update float attribute - * - * Update a float attribute. Changing the `default` value will not update - * already existing documents. - * - * - * @param string $databaseId - * @param string $collectionId - * @param string $key - * @param bool $required - * @param float $min - * @param float $max - * @param float $xdefault - * @throws AppwriteException - * @return array - - */ - public function updateFloatAttribute(string $databaseId, string $collectionId, string $key, bool $required, float $min, float $max, float $xdefault): array - { - $apiPath = str_replace(['{databaseId}', '{collectionId}', '{key}'], [$databaseId, $collectionId, $key], '/databases/{databaseId}/collections/{collectionId}/attributes/float/{key}'); - - $apiParams = []; - if (!isset($databaseId)) { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (!isset($collectionId)) { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (!isset($key)) { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (!isset($required)) { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (!isset($min)) { - throw new AppwriteException('Missing required parameter: "min"'); - } - if (!isset($max)) { - throw new AppwriteException('Missing required parameter: "max"'); - } - if (!is_null($required)) { - $apiParams['required'] = $required; - } - if (!is_null($min)) { - $apiParams['min'] = $min; - } - if (!is_null($max)) { - $apiParams['max'] = $max; - } - if (!is_null($xdefault)) { - $apiParams['default'] = $xdefault; - } - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create integer attribute - * - * Create an integer attribute. Optionally, minimum and maximum values can be - * provided. - * - * - * @param string $databaseId - * @param string $collectionId - * @param string $key - * @param bool $required - * @param int $min - * @param int $max - * @param int $xdefault - * @param bool $xarray - * @throws AppwriteException - * @return array - - */ - public function createIntegerAttribute(string $databaseId, string $collectionId, string $key, bool $required, int $min = null, int $max = null, int $xdefault = null, bool $xarray = null): array - { - $apiPath = str_replace(['{databaseId}', '{collectionId}'], [$databaseId, $collectionId], '/databases/{databaseId}/collections/{collectionId}/attributes/integer'); - - $apiParams = []; - if (!isset($databaseId)) { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (!isset($collectionId)) { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (!isset($key)) { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (!isset($required)) { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (!is_null($key)) { - $apiParams['key'] = $key; - } - if (!is_null($required)) { - $apiParams['required'] = $required; - } - if (!is_null($min)) { - $apiParams['min'] = $min; - } - if (!is_null($max)) { - $apiParams['max'] = $max; - } - if (!is_null($xdefault)) { - $apiParams['default'] = $xdefault; - } - if (!is_null($xarray)) { - $apiParams['array'] = $xarray; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update integer attribute - * - * Update an integer attribute. Changing the `default` value will not update - * already existing documents. - * - * - * @param string $databaseId - * @param string $collectionId - * @param string $key - * @param bool $required - * @param int $min - * @param int $max - * @param int $xdefault - * @throws AppwriteException - * @return array - - */ - public function updateIntegerAttribute(string $databaseId, string $collectionId, string $key, bool $required, int $min, int $max, int $xdefault): array - { - $apiPath = str_replace(['{databaseId}', '{collectionId}', '{key}'], [$databaseId, $collectionId, $key], '/databases/{databaseId}/collections/{collectionId}/attributes/integer/{key}'); - - $apiParams = []; - if (!isset($databaseId)) { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (!isset($collectionId)) { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (!isset($key)) { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (!isset($required)) { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (!isset($min)) { - throw new AppwriteException('Missing required parameter: "min"'); - } - if (!isset($max)) { - throw new AppwriteException('Missing required parameter: "max"'); - } - if (!is_null($required)) { - $apiParams['required'] = $required; - } - if (!is_null($min)) { - $apiParams['min'] = $min; - } - if (!is_null($max)) { - $apiParams['max'] = $max; - } - if (!is_null($xdefault)) { - $apiParams['default'] = $xdefault; - } - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create IP address attribute - * - * Create IP address attribute. - * - * - * @param string $databaseId - * @param string $collectionId - * @param string $key - * @param bool $required - * @param string $xdefault - * @param bool $xarray - * @throws AppwriteException - * @return array - - */ - public function createIpAttribute(string $databaseId, string $collectionId, string $key, bool $required, string $xdefault = null, bool $xarray = null): array - { - $apiPath = str_replace(['{databaseId}', '{collectionId}'], [$databaseId, $collectionId], '/databases/{databaseId}/collections/{collectionId}/attributes/ip'); - - $apiParams = []; - if (!isset($databaseId)) { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (!isset($collectionId)) { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (!isset($key)) { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (!isset($required)) { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (!is_null($key)) { - $apiParams['key'] = $key; - } - if (!is_null($required)) { - $apiParams['required'] = $required; - } - if (!is_null($xdefault)) { - $apiParams['default'] = $xdefault; - } - if (!is_null($xarray)) { - $apiParams['array'] = $xarray; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update IP address attribute - * - * Update an ip attribute. Changing the `default` value will not update - * already existing documents. - * - * - * @param string $databaseId - * @param string $collectionId - * @param string $key - * @param bool $required - * @param string $xdefault - * @throws AppwriteException - * @return array - - */ - public function updateIpAttribute(string $databaseId, string $collectionId, string $key, bool $required, string $xdefault): array - { - $apiPath = str_replace(['{databaseId}', '{collectionId}', '{key}'], [$databaseId, $collectionId, $key], '/databases/{databaseId}/collections/{collectionId}/attributes/ip/{key}'); - - $apiParams = []; - if (!isset($databaseId)) { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (!isset($collectionId)) { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (!isset($key)) { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (!isset($required)) { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (!is_null($required)) { - $apiParams['required'] = $required; - } - if (!is_null($xdefault)) { - $apiParams['default'] = $xdefault; - } - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create relationship attribute - * - * Create relationship attribute. [Learn more about relationship - * attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). - * - * - * @param string $databaseId - * @param string $collectionId - * @param string $relatedCollectionId - * @param RelationshipType $type - * @param bool $twoWay - * @param string $key - * @param string $twoWayKey - * @param RelationMutate $onDelete - * @throws AppwriteException - * @return array - - */ - public function createRelationshipAttribute(string $databaseId, string $collectionId, string $relatedCollectionId, RelationshipType $type, bool $twoWay = null, string $key = null, string $twoWayKey = null, RelationMutate $onDelete = null): array - { - $apiPath = str_replace(['{databaseId}', '{collectionId}'], [$databaseId, $collectionId], '/databases/{databaseId}/collections/{collectionId}/attributes/relationship'); - - $apiParams = []; - if (!isset($databaseId)) { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (!isset($collectionId)) { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (!isset($relatedCollectionId)) { - throw new AppwriteException('Missing required parameter: "relatedCollectionId"'); - } - if (!isset($type)) { - throw new AppwriteException('Missing required parameter: "type"'); - } - if (!is_null($relatedCollectionId)) { - $apiParams['relatedCollectionId'] = $relatedCollectionId; - } - if (!is_null($type)) { - $apiParams['type'] = $type; - } - if (!is_null($twoWay)) { - $apiParams['twoWay'] = $twoWay; - } - if (!is_null($key)) { - $apiParams['key'] = $key; - } - if (!is_null($twoWayKey)) { - $apiParams['twoWayKey'] = $twoWayKey; - } - if (!is_null($onDelete)) { - $apiParams['onDelete'] = $onDelete; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create string attribute - * - * Create a string attribute. - * - * - * @param string $databaseId - * @param string $collectionId - * @param string $key - * @param int $size - * @param bool $required - * @param string $xdefault - * @param bool $xarray - * @param bool $encrypt - * @throws AppwriteException - * @return array - - */ - public function createStringAttribute(string $databaseId, string $collectionId, string $key, int $size, bool $required, string $xdefault = null, bool $xarray = null, bool $encrypt = null): array - { - $apiPath = str_replace(['{databaseId}', '{collectionId}'], [$databaseId, $collectionId], '/databases/{databaseId}/collections/{collectionId}/attributes/string'); - - $apiParams = []; - if (!isset($databaseId)) { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (!isset($collectionId)) { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (!isset($key)) { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (!isset($size)) { - throw new AppwriteException('Missing required parameter: "size"'); - } - if (!isset($required)) { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (!is_null($key)) { - $apiParams['key'] = $key; - } - if (!is_null($size)) { - $apiParams['size'] = $size; - } - if (!is_null($required)) { - $apiParams['required'] = $required; - } - if (!is_null($xdefault)) { - $apiParams['default'] = $xdefault; - } - if (!is_null($xarray)) { - $apiParams['array'] = $xarray; - } - if (!is_null($encrypt)) { - $apiParams['encrypt'] = $encrypt; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update string attribute - * - * Update a string attribute. Changing the `default` value will not update - * already existing documents. - * - * - * @param string $databaseId - * @param string $collectionId - * @param string $key - * @param bool $required - * @param string $xdefault - * @throws AppwriteException - * @return array - - */ - public function updateStringAttribute(string $databaseId, string $collectionId, string $key, bool $required, string $xdefault): array - { - $apiPath = str_replace(['{databaseId}', '{collectionId}', '{key}'], [$databaseId, $collectionId, $key], '/databases/{databaseId}/collections/{collectionId}/attributes/string/{key}'); - - $apiParams = []; - if (!isset($databaseId)) { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (!isset($collectionId)) { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (!isset($key)) { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (!isset($required)) { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (!is_null($required)) { - $apiParams['required'] = $required; - } - if (!is_null($xdefault)) { - $apiParams['default'] = $xdefault; - } - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create URL attribute - * - * Create a URL attribute. - * - * - * @param string $databaseId - * @param string $collectionId - * @param string $key - * @param bool $required - * @param string $xdefault - * @param bool $xarray - * @throws AppwriteException - * @return array - - */ - public function createUrlAttribute(string $databaseId, string $collectionId, string $key, bool $required, string $xdefault = null, bool $xarray = null): array - { - $apiPath = str_replace(['{databaseId}', '{collectionId}'], [$databaseId, $collectionId], '/databases/{databaseId}/collections/{collectionId}/attributes/url'); - - $apiParams = []; - if (!isset($databaseId)) { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (!isset($collectionId)) { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (!isset($key)) { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (!isset($required)) { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (!is_null($key)) { - $apiParams['key'] = $key; - } - if (!is_null($required)) { - $apiParams['required'] = $required; - } - if (!is_null($xdefault)) { - $apiParams['default'] = $xdefault; - } - if (!is_null($xarray)) { - $apiParams['array'] = $xarray; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update URL attribute - * - * Update an url attribute. Changing the `default` value will not update - * already existing documents. - * - * - * @param string $databaseId - * @param string $collectionId - * @param string $key - * @param bool $required - * @param string $xdefault - * @throws AppwriteException - * @return array - - */ - public function updateUrlAttribute(string $databaseId, string $collectionId, string $key, bool $required, string $xdefault): array - { - $apiPath = str_replace(['{databaseId}', '{collectionId}', '{key}'], [$databaseId, $collectionId, $key], '/databases/{databaseId}/collections/{collectionId}/attributes/url/{key}'); - - $apiParams = []; - if (!isset($databaseId)) { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (!isset($collectionId)) { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (!isset($key)) { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (!isset($required)) { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (!is_null($required)) { - $apiParams['required'] = $required; - } - if (!is_null($xdefault)) { - $apiParams['default'] = $xdefault; - } - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get attribute - * - * Get attribute by ID. - * - * @param string $databaseId - * @param string $collectionId - * @param string $key - * @throws AppwriteException - * @return array - - */ - public function getAttribute(string $databaseId, string $collectionId, string $key): array - { - $apiPath = str_replace(['{databaseId}', '{collectionId}', '{key}'], [$databaseId, $collectionId, $key], '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'); - - $apiParams = []; - if (!isset($databaseId)) { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (!isset($collectionId)) { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (!isset($key)) { - throw new AppwriteException('Missing required parameter: "key"'); - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Delete attribute - * - * Deletes an attribute. - * - * @param string $databaseId - * @param string $collectionId - * @param string $key - * @throws AppwriteException - * @return string - - */ - public function deleteAttribute(string $databaseId, string $collectionId, string $key): string - { - $apiPath = str_replace(['{databaseId}', '{collectionId}', '{key}'], [$databaseId, $collectionId, $key], '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'); - - $apiParams = []; - if (!isset($databaseId)) { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (!isset($collectionId)) { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (!isset($key)) { - throw new AppwriteException('Missing required parameter: "key"'); - } - return $this->client->call( - Client::METHOD_DELETE, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update relationship attribute - * - * Update relationship attribute. [Learn more about relationship - * attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). - * - * - * @param string $databaseId - * @param string $collectionId - * @param string $key - * @param RelationMutate $onDelete - * @throws AppwriteException - * @return array - - */ - public function updateRelationshipAttribute(string $databaseId, string $collectionId, string $key, RelationMutate $onDelete = null): array - { - $apiPath = str_replace(['{databaseId}', '{collectionId}', '{key}'], [$databaseId, $collectionId, $key], '/databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship'); - - $apiParams = []; - if (!isset($databaseId)) { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (!isset($collectionId)) { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (!isset($key)) { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (!is_null($onDelete)) { - $apiParams['onDelete'] = $onDelete; - } - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * List documents - * - * Get a list of all the user's documents in a given collection. You can use - * the query params to filter your results. - * - * @param string $databaseId - * @param string $collectionId - * @param array $queries - * @throws AppwriteException - * @return array - - */ - public function listDocuments(string $databaseId, string $collectionId, array $queries = null): array - { - $apiPath = str_replace(['{databaseId}', '{collectionId}'], [$databaseId, $collectionId], '/databases/{databaseId}/collections/{collectionId}/documents'); - - $apiParams = []; - if (!isset($databaseId)) { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (!isset($collectionId)) { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (!is_null($queries)) { - $apiParams['queries'] = $queries; - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create document - * - * Create a new Document. Before using this route, you should create a new - * collection resource using either a [server - * integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) - * API or directly from your database console. - * - * @param string $databaseId - * @param string $collectionId - * @param string $documentId - * @param array $data - * @param array $permissions - * @throws AppwriteException - * @return array - - */ - public function createDocument(string $databaseId, string $collectionId, string $documentId, array $data, array $permissions = null): array - { - $apiPath = str_replace(['{databaseId}', '{collectionId}'], [$databaseId, $collectionId], '/databases/{databaseId}/collections/{collectionId}/documents'); - - $apiParams = []; - if (!isset($databaseId)) { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (!isset($collectionId)) { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (!isset($documentId)) { - throw new AppwriteException('Missing required parameter: "documentId"'); - } - if (!isset($data)) { - throw new AppwriteException('Missing required parameter: "data"'); - } - if (!is_null($documentId)) { - $apiParams['documentId'] = $documentId; - } - if (!is_null($data)) { - $apiParams['data'] = $data; - } - if (!is_null($permissions)) { - $apiParams['permissions'] = $permissions; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get document - * - * Get a document by its unique ID. This endpoint response returns a JSON - * object with the document data. - * - * @param string $databaseId - * @param string $collectionId - * @param string $documentId - * @param array $queries - * @throws AppwriteException - * @return array - - */ - public function getDocument(string $databaseId, string $collectionId, string $documentId, array $queries = null): array - { - $apiPath = str_replace(['{databaseId}', '{collectionId}', '{documentId}'], [$databaseId, $collectionId, $documentId], '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'); - - $apiParams = []; - if (!isset($databaseId)) { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (!isset($collectionId)) { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (!isset($documentId)) { - throw new AppwriteException('Missing required parameter: "documentId"'); - } - if (!is_null($queries)) { - $apiParams['queries'] = $queries; - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update document - * - * Update a document by its unique ID. Using the patch method you can pass - * only specific fields that will get updated. - * - * @param string $databaseId - * @param string $collectionId - * @param string $documentId - * @param array $data - * @param array $permissions - * @throws AppwriteException - * @return array - - */ - public function updateDocument(string $databaseId, string $collectionId, string $documentId, array $data = null, array $permissions = null): array - { - $apiPath = str_replace(['{databaseId}', '{collectionId}', '{documentId}'], [$databaseId, $collectionId, $documentId], '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'); - - $apiParams = []; - if (!isset($databaseId)) { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (!isset($collectionId)) { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (!isset($documentId)) { - throw new AppwriteException('Missing required parameter: "documentId"'); - } - if (!is_null($data)) { - $apiParams['data'] = $data; - } - if (!is_null($permissions)) { - $apiParams['permissions'] = $permissions; - } - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Delete document - * - * Delete a document by its unique ID. - * - * @param string $databaseId - * @param string $collectionId - * @param string $documentId - * @throws AppwriteException - * @return string - - */ - public function deleteDocument(string $databaseId, string $collectionId, string $documentId): string - { - $apiPath = str_replace(['{databaseId}', '{collectionId}', '{documentId}'], [$databaseId, $collectionId, $documentId], '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'); - - $apiParams = []; - if (!isset($databaseId)) { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (!isset($collectionId)) { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (!isset($documentId)) { - throw new AppwriteException('Missing required parameter: "documentId"'); - } - return $this->client->call( - Client::METHOD_DELETE, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * List indexes - * - * List indexes in the collection. - * - * @param string $databaseId - * @param string $collectionId - * @param array $queries - * @throws AppwriteException - * @return array - - */ - public function listIndexes(string $databaseId, string $collectionId, array $queries = null): array - { - $apiPath = str_replace(['{databaseId}', '{collectionId}'], [$databaseId, $collectionId], '/databases/{databaseId}/collections/{collectionId}/indexes'); - - $apiParams = []; - if (!isset($databaseId)) { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (!isset($collectionId)) { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (!is_null($queries)) { - $apiParams['queries'] = $queries; - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create index - * - * Creates an index on the attributes listed. Your index should include all - * the attributes you will query in a single request. - * Attributes can be `key`, `fulltext`, and `unique`. - * - * @param string $databaseId - * @param string $collectionId - * @param string $key - * @param IndexType $type - * @param array $attributes - * @param array $orders - * @throws AppwriteException - * @return array - - */ - public function createIndex(string $databaseId, string $collectionId, string $key, IndexType $type, array $attributes, array $orders = null): array - { - $apiPath = str_replace(['{databaseId}', '{collectionId}'], [$databaseId, $collectionId], '/databases/{databaseId}/collections/{collectionId}/indexes'); - - $apiParams = []; - if (!isset($databaseId)) { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (!isset($collectionId)) { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (!isset($key)) { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (!isset($type)) { - throw new AppwriteException('Missing required parameter: "type"'); - } - if (!isset($attributes)) { - throw new AppwriteException('Missing required parameter: "attributes"'); - } - if (!is_null($key)) { - $apiParams['key'] = $key; - } - if (!is_null($type)) { - $apiParams['type'] = $type; - } - if (!is_null($attributes)) { - $apiParams['attributes'] = $attributes; - } - if (!is_null($orders)) { - $apiParams['orders'] = $orders; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get index - * - * Get index by ID. - * - * @param string $databaseId - * @param string $collectionId - * @param string $key - * @throws AppwriteException - * @return array - - */ - public function getIndex(string $databaseId, string $collectionId, string $key): array - { - $apiPath = str_replace(['{databaseId}', '{collectionId}', '{key}'], [$databaseId, $collectionId, $key], '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'); - - $apiParams = []; - if (!isset($databaseId)) { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (!isset($collectionId)) { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (!isset($key)) { - throw new AppwriteException('Missing required parameter: "key"'); - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Delete index - * - * Delete an index. - * - * @param string $databaseId - * @param string $collectionId - * @param string $key - * @throws AppwriteException - * @return string - - */ - public function deleteIndex(string $databaseId, string $collectionId, string $key): string - { - $apiPath = str_replace(['{databaseId}', '{collectionId}', '{key}'], [$databaseId, $collectionId, $key], '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'); - - $apiParams = []; - if (!isset($databaseId)) { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (!isset($collectionId)) { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (!isset($key)) { - throw new AppwriteException('Missing required parameter: "key"'); - } - return $this->client->call( - Client::METHOD_DELETE, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } -} diff --git a/src/Appwrite/Services/Functions.php b/src/Appwrite/Services/Functions.php deleted file mode 100644 index 15c5334..0000000 --- a/src/Appwrite/Services/Functions.php +++ /dev/null @@ -1,1036 +0,0 @@ -<?php - -namespace Appwrite\Services; - -use Appwrite\AppwriteException; -use Appwrite\Client; -use Appwrite\Service; -use Appwrite\InputFile; -use Appwrite\Enums\Runtime; -use Appwrite\Enums\ExecutionMethod; - -class Functions extends Service -{ - public function __construct(Client $client) - { - $this->client = $client; - } - - /** - * List functions - * - * Get a list of all the project's functions. You can use the query params to - * filter your results. - * - * @param array $queries - * @param string $search - * @throws AppwriteException - * @return array - - */ - public function list(array $queries = null, string $search = null): array - { - $apiPath = str_replace([], [], '/functions'); - - $apiParams = []; - if (!is_null($queries)) { - $apiParams['queries'] = $queries; - } - if (!is_null($search)) { - $apiParams['search'] = $search; - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create function - * - * Create a new function. You can pass a list of - * [permissions](https://appwrite.io/docs/permissions) to allow different - * project users or team with access to execute the function using the client - * API. - * - * @param string $functionId - * @param string $name - * @param Runtime $runtime - * @param array $execute - * @param array $events - * @param string $schedule - * @param int $timeout - * @param bool $enabled - * @param bool $logging - * @param string $entrypoint - * @param string $commands - * @param array $scopes - * @param string $installationId - * @param string $providerRepositoryId - * @param string $providerBranch - * @param bool $providerSilentMode - * @param string $providerRootDirectory - * @param string $templateRepository - * @param string $templateOwner - * @param string $templateRootDirectory - * @param string $templateBranch - * @throws AppwriteException - * @return array - - */ - public function create(string $functionId, string $name, Runtime $runtime, array $execute = null, array $events = null, string $schedule = null, int $timeout = null, bool $enabled = null, bool $logging = null, string $entrypoint = null, string $commands = null, array $scopes = null, string $installationId = null, string $providerRepositoryId = null, string $providerBranch = null, bool $providerSilentMode = null, string $providerRootDirectory = null, string $templateRepository = null, string $templateOwner = null, string $templateRootDirectory = null, string $templateBranch = null): array - { - $apiPath = str_replace([], [], '/functions'); - - $apiParams = []; - if (!isset($functionId)) { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (!isset($name)) { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (!isset($runtime)) { - throw new AppwriteException('Missing required parameter: "runtime"'); - } - if (!is_null($functionId)) { - $apiParams['functionId'] = $functionId; - } - if (!is_null($name)) { - $apiParams['name'] = $name; - } - if (!is_null($runtime)) { - $apiParams['runtime'] = $runtime; - } - if (!is_null($execute)) { - $apiParams['execute'] = $execute; - } - if (!is_null($events)) { - $apiParams['events'] = $events; - } - if (!is_null($schedule)) { - $apiParams['schedule'] = $schedule; - } - if (!is_null($timeout)) { - $apiParams['timeout'] = $timeout; - } - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } - if (!is_null($logging)) { - $apiParams['logging'] = $logging; - } - if (!is_null($entrypoint)) { - $apiParams['entrypoint'] = $entrypoint; - } - if (!is_null($commands)) { - $apiParams['commands'] = $commands; - } - if (!is_null($scopes)) { - $apiParams['scopes'] = $scopes; - } - if (!is_null($installationId)) { - $apiParams['installationId'] = $installationId; - } - if (!is_null($providerRepositoryId)) { - $apiParams['providerRepositoryId'] = $providerRepositoryId; - } - if (!is_null($providerBranch)) { - $apiParams['providerBranch'] = $providerBranch; - } - if (!is_null($providerSilentMode)) { - $apiParams['providerSilentMode'] = $providerSilentMode; - } - if (!is_null($providerRootDirectory)) { - $apiParams['providerRootDirectory'] = $providerRootDirectory; - } - if (!is_null($templateRepository)) { - $apiParams['templateRepository'] = $templateRepository; - } - if (!is_null($templateOwner)) { - $apiParams['templateOwner'] = $templateOwner; - } - if (!is_null($templateRootDirectory)) { - $apiParams['templateRootDirectory'] = $templateRootDirectory; - } - if (!is_null($templateBranch)) { - $apiParams['templateBranch'] = $templateBranch; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * List runtimes - * - * Get a list of all runtimes that are currently active on your instance. - * - * @throws AppwriteException - * @return array - - */ - public function listRuntimes(): array - { - $apiPath = str_replace([], [], '/functions/runtimes'); - - $apiParams = []; - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get function - * - * Get a function by its unique ID. - * - * @param string $functionId - * @throws AppwriteException - * @return array - - */ - public function get(string $functionId): array - { - $apiPath = str_replace(['{functionId}'], [$functionId], '/functions/{functionId}'); - - $apiParams = []; - if (!isset($functionId)) { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update function - * - * Update function by its unique ID. - * - * @param string $functionId - * @param string $name - * @param Runtime $runtime - * @param array $execute - * @param array $events - * @param string $schedule - * @param int $timeout - * @param bool $enabled - * @param bool $logging - * @param string $entrypoint - * @param string $commands - * @param array $scopes - * @param string $installationId - * @param string $providerRepositoryId - * @param string $providerBranch - * @param bool $providerSilentMode - * @param string $providerRootDirectory - * @throws AppwriteException - * @return array - - */ - public function update(string $functionId, string $name, Runtime $runtime = null, array $execute = null, array $events = null, string $schedule = null, int $timeout = null, bool $enabled = null, bool $logging = null, string $entrypoint = null, string $commands = null, array $scopes = null, string $installationId = null, string $providerRepositoryId = null, string $providerBranch = null, bool $providerSilentMode = null, string $providerRootDirectory = null): array - { - $apiPath = str_replace(['{functionId}'], [$functionId], '/functions/{functionId}'); - - $apiParams = []; - if (!isset($functionId)) { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (!isset($name)) { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (!is_null($name)) { - $apiParams['name'] = $name; - } - if (!is_null($runtime)) { - $apiParams['runtime'] = $runtime; - } - if (!is_null($execute)) { - $apiParams['execute'] = $execute; - } - if (!is_null($events)) { - $apiParams['events'] = $events; - } - if (!is_null($schedule)) { - $apiParams['schedule'] = $schedule; - } - if (!is_null($timeout)) { - $apiParams['timeout'] = $timeout; - } - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } - if (!is_null($logging)) { - $apiParams['logging'] = $logging; - } - if (!is_null($entrypoint)) { - $apiParams['entrypoint'] = $entrypoint; - } - if (!is_null($commands)) { - $apiParams['commands'] = $commands; - } - if (!is_null($scopes)) { - $apiParams['scopes'] = $scopes; - } - if (!is_null($installationId)) { - $apiParams['installationId'] = $installationId; - } - if (!is_null($providerRepositoryId)) { - $apiParams['providerRepositoryId'] = $providerRepositoryId; - } - if (!is_null($providerBranch)) { - $apiParams['providerBranch'] = $providerBranch; - } - if (!is_null($providerSilentMode)) { - $apiParams['providerSilentMode'] = $providerSilentMode; - } - if (!is_null($providerRootDirectory)) { - $apiParams['providerRootDirectory'] = $providerRootDirectory; - } - return $this->client->call( - Client::METHOD_PUT, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Delete function - * - * Delete a function by its unique ID. - * - * @param string $functionId - * @throws AppwriteException - * @return string - - */ - public function delete(string $functionId): string - { - $apiPath = str_replace(['{functionId}'], [$functionId], '/functions/{functionId}'); - - $apiParams = []; - if (!isset($functionId)) { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - return $this->client->call( - Client::METHOD_DELETE, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * List deployments - * - * Get a list of all the project's code deployments. You can use the query - * params to filter your results. - * - * @param string $functionId - * @param array $queries - * @param string $search - * @throws AppwriteException - * @return array - - */ - public function listDeployments(string $functionId, array $queries = null, string $search = null): array - { - $apiPath = str_replace(['{functionId}'], [$functionId], '/functions/{functionId}/deployments'); - - $apiParams = []; - if (!isset($functionId)) { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (!is_null($queries)) { - $apiParams['queries'] = $queries; - } - if (!is_null($search)) { - $apiParams['search'] = $search; - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create deployment - * - * Create a new function code deployment. Use this endpoint to upload a new - * version of your code function. To execute your newly uploaded code, you'll - * need to update the function's deployment to use your new deployment UID. - * - * This endpoint accepts a tar.gz file compressed with your code. Make sure to - * include any dependencies your code has within the compressed file. You can - * learn more about code packaging in the [Appwrite Cloud Functions - * tutorial](https://appwrite.io/docs/functions). - * - * Use the "command" param to set the entrypoint used to execute your code. - * - * @param string $functionId - * @param InputFile $code - * @param bool $activate - * @param string $entrypoint - * @param string $commands - * @throws AppwriteException - * @return array - - */ - public function createDeployment(string $functionId, InputFile $code, bool $activate, string $entrypoint = null, string $commands = null, callable $onProgress = null): array - { - $apiPath = str_replace(['{functionId}'], [$functionId], '/functions/{functionId}/deployments'); - - $apiParams = []; - if (!isset($functionId)) { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (!isset($code)) { - throw new AppwriteException('Missing required parameter: "code"'); - } - if (!isset($activate)) { - throw new AppwriteException('Missing required parameter: "activate"'); - } - if (!is_null($entrypoint)) { - $apiParams['entrypoint'] = $entrypoint; - } - if (!is_null($commands)) { - $apiParams['commands'] = $commands; - } - if (!is_null($code)) { - $apiParams['code'] = $code; - } - if (!is_null($activate)) { - $apiParams['activate'] = $activate; - } - $size = 0; - $mimeType = null; - $postedName = null; - if(empty($code->getPath() ?? null)) { - $size = strlen($code->getData()); - $mimeType = $code->getMimeType(); - $postedName = $code->getFilename(); - if ($size <= Client::CHUNK_SIZE) { - $apiParams['code'] = new \CURLFile('data://' . $mimeType . ';base64,' . base64_encode($code->getData()), $mimeType, $postedName); - return $this->client->call(Client::METHOD_POST, $apiPath, [ - 'content-type' => 'multipart/form-data', - ], $apiParams); - } - } else { - $size = filesize($code->getPath()); - $mimeType = $code->getMimeType() ?? mime_content_type($code->getPath()); - $postedName = $code->getFilename() ?? basename($code->getPath()); - //send single file if size is less than or equal to 5MB - if ($size <= Client::CHUNK_SIZE) { - $apiParams['code'] = new \CURLFile($code->getPath(), $mimeType, $postedName); - return $this->client->call(Client::METHOD_POST, $apiPath, [ - 'content-type' => 'multipart/form-data', - ], $apiParams); - } - } - - $id = ''; - $counter = 0; - - - $apiHeaders = ['content-type' => 'multipart/form-data']; - $handle = null; - - if(!empty($code->getPath())) { - $handle = @fopen($code->getPath(), "rb"); - } - - $start = $counter * Client::CHUNK_SIZE; - while ($start < $size) { - $chunk = ''; - if(!empty($handle)) { - fseek($handle, $start); - $chunk = @fread($handle, Client::CHUNK_SIZE); - } else { - $chunk = substr($file->getData(), $start, Client::CHUNK_SIZE); - } - $apiParams['code'] = new \CURLFile('data://' . $mimeType . ';base64,' . base64_encode($chunk), $mimeType, $postedName); - $apiHeaders['content-range'] = 'bytes ' . ($counter * Client::CHUNK_SIZE) . '-' . min(((($counter * Client::CHUNK_SIZE) + Client::CHUNK_SIZE) - 1), $size - 1) . '/' . $size; - if(!empty($id)) { - $apiHeaders['x-appwrite-id'] = $id; - } - $response = $this->client->call(Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams); - $counter++; - $start += Client::CHUNK_SIZE; - if(empty($id)) { - $id = $response['$id']; - } - if($onProgress !== null) { - $onProgress([ - '$id' => $response['$id'], - 'progress' => min(((($counter * Client::CHUNK_SIZE) + Client::CHUNK_SIZE)), $size) / $size * 100, - 'sizeUploaded' => min($counter * Client::CHUNK_SIZE), - 'chunksTotal' => $response['chunksTotal'], - 'chunksUploaded' => $response['chunksUploaded'], - ]); - } - } - if(!empty($handle)) { - @fclose($handle); - } - return $response; - - } - - /** - * Get deployment - * - * Get a code deployment by its unique ID. - * - * @param string $functionId - * @param string $deploymentId - * @throws AppwriteException - * @return array - - */ - public function getDeployment(string $functionId, string $deploymentId): array - { - $apiPath = str_replace(['{functionId}', '{deploymentId}'], [$functionId, $deploymentId], '/functions/{functionId}/deployments/{deploymentId}'); - - $apiParams = []; - if (!isset($functionId)) { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (!isset($deploymentId)) { - throw new AppwriteException('Missing required parameter: "deploymentId"'); - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update function deployment - * - * Update the function code deployment ID using the unique function ID. Use - * this endpoint to switch the code deployment that should be executed by the - * execution endpoint. - * - * @param string $functionId - * @param string $deploymentId - * @throws AppwriteException - * @return array - - */ - public function updateDeployment(string $functionId, string $deploymentId): array - { - $apiPath = str_replace(['{functionId}', '{deploymentId}'], [$functionId, $deploymentId], '/functions/{functionId}/deployments/{deploymentId}'); - - $apiParams = []; - if (!isset($functionId)) { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (!isset($deploymentId)) { - throw new AppwriteException('Missing required parameter: "deploymentId"'); - } - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Delete deployment - * - * Delete a code deployment by its unique ID. - * - * @param string $functionId - * @param string $deploymentId - * @throws AppwriteException - * @return string - - */ - public function deleteDeployment(string $functionId, string $deploymentId): string - { - $apiPath = str_replace(['{functionId}', '{deploymentId}'], [$functionId, $deploymentId], '/functions/{functionId}/deployments/{deploymentId}'); - - $apiParams = []; - if (!isset($functionId)) { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (!isset($deploymentId)) { - throw new AppwriteException('Missing required parameter: "deploymentId"'); - } - return $this->client->call( - Client::METHOD_DELETE, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Rebuild deployment - * - * @param string $functionId - * @param string $deploymentId - * @param string $buildId - * @throws AppwriteException - * @return string - - */ - public function createBuild(string $functionId, string $deploymentId, string $buildId = null): string - { - $apiPath = str_replace(['{functionId}', '{deploymentId}'], [$functionId, $deploymentId], '/functions/{functionId}/deployments/{deploymentId}/build'); - - $apiParams = []; - if (!isset($functionId)) { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (!isset($deploymentId)) { - throw new AppwriteException('Missing required parameter: "deploymentId"'); - } - if (!is_null($buildId)) { - $apiParams['buildId'] = $buildId; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Cancel deployment - * - * @param string $functionId - * @param string $deploymentId - * @throws AppwriteException - * @return array - - */ - public function updateDeploymentBuild(string $functionId, string $deploymentId): array - { - $apiPath = str_replace(['{functionId}', '{deploymentId}'], [$functionId, $deploymentId], '/functions/{functionId}/deployments/{deploymentId}/build'); - - $apiParams = []; - if (!isset($functionId)) { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (!isset($deploymentId)) { - throw new AppwriteException('Missing required parameter: "deploymentId"'); - } - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Download Deployment - * - * Get a Deployment's contents by its unique ID. This endpoint supports range - * requests for partial or streaming file download. - * - * @param string $functionId - * @param string $deploymentId - * @throws AppwriteException - * @return string - - */ - public function downloadDeployment(string $functionId, string $deploymentId): string - { - $apiPath = str_replace(['{functionId}', '{deploymentId}'], [$functionId, $deploymentId], '/functions/{functionId}/deployments/{deploymentId}/download'); - - $apiParams = []; - if (!isset($functionId)) { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (!isset($deploymentId)) { - throw new AppwriteException('Missing required parameter: "deploymentId"'); - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * List executions - * - * Get a list of all the current user function execution logs. You can use the - * query params to filter your results. - * - * @param string $functionId - * @param array $queries - * @param string $search - * @throws AppwriteException - * @return array - - */ - public function listExecutions(string $functionId, array $queries = null, string $search = null): array - { - $apiPath = str_replace(['{functionId}'], [$functionId], '/functions/{functionId}/executions'); - - $apiParams = []; - if (!isset($functionId)) { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (!is_null($queries)) { - $apiParams['queries'] = $queries; - } - if (!is_null($search)) { - $apiParams['search'] = $search; - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create execution - * - * Trigger a function execution. The returned object will return you the - * current execution status. You can ping the `Get Execution` endpoint to get - * updates on the current execution status. Once this endpoint is called, your - * function execution process will start asynchronously. - * - * @param string $functionId - * @param string $body - * @param bool $async - * @param string $xpath - * @param ExecutionMethod $method - * @param array $headers - * @param string $scheduledAt - * @throws AppwriteException - * @return array - - */ - public function createExecution(string $functionId, string $body = null, bool $async = null, string $xpath = null, ExecutionMethod $method = null, array $headers = null, string $scheduledAt = null): array - { - $apiPath = str_replace(['{functionId}'], [$functionId], '/functions/{functionId}/executions'); - - $apiParams = []; - if (!isset($functionId)) { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (!is_null($body)) { - $apiParams['body'] = $body; - } - if (!is_null($async)) { - $apiParams['async'] = $async; - } - if (!is_null($xpath)) { - $apiParams['path'] = $xpath; - } - if (!is_null($method)) { - $apiParams['method'] = $method; - } - if (!is_null($headers)) { - $apiParams['headers'] = $headers; - } - if (!is_null($scheduledAt)) { - $apiParams['scheduledAt'] = $scheduledAt; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get execution - * - * Get a function execution log by its unique ID. - * - * @param string $functionId - * @param string $executionId - * @throws AppwriteException - * @return array - - */ - public function getExecution(string $functionId, string $executionId): array - { - $apiPath = str_replace(['{functionId}', '{executionId}'], [$functionId, $executionId], '/functions/{functionId}/executions/{executionId}'); - - $apiParams = []; - if (!isset($functionId)) { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (!isset($executionId)) { - throw new AppwriteException('Missing required parameter: "executionId"'); - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Delete execution - * - * Delete a function execution by its unique ID. - * - * - * @param string $functionId - * @param string $executionId - * @throws AppwriteException - * @return string - - */ - public function deleteExecution(string $functionId, string $executionId): string - { - $apiPath = str_replace(['{functionId}', '{executionId}'], [$functionId, $executionId], '/functions/{functionId}/executions/{executionId}'); - - $apiParams = []; - if (!isset($functionId)) { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (!isset($executionId)) { - throw new AppwriteException('Missing required parameter: "executionId"'); - } - return $this->client->call( - Client::METHOD_DELETE, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * List variables - * - * Get a list of all variables of a specific function. - * - * @param string $functionId - * @throws AppwriteException - * @return array - - */ - public function listVariables(string $functionId): array - { - $apiPath = str_replace(['{functionId}'], [$functionId], '/functions/{functionId}/variables'); - - $apiParams = []; - if (!isset($functionId)) { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create variable - * - * Create a new function environment variable. These variables can be accessed - * in the function at runtime as environment variables. - * - * @param string $functionId - * @param string $key - * @param string $value - * @throws AppwriteException - * @return array - - */ - public function createVariable(string $functionId, string $key, string $value): array - { - $apiPath = str_replace(['{functionId}'], [$functionId], '/functions/{functionId}/variables'); - - $apiParams = []; - if (!isset($functionId)) { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (!isset($key)) { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (!isset($value)) { - throw new AppwriteException('Missing required parameter: "value"'); - } - if (!is_null($key)) { - $apiParams['key'] = $key; - } - if (!is_null($value)) { - $apiParams['value'] = $value; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get variable - * - * Get a variable by its unique ID. - * - * @param string $functionId - * @param string $variableId - * @throws AppwriteException - * @return array - - */ - public function getVariable(string $functionId, string $variableId): array - { - $apiPath = str_replace(['{functionId}', '{variableId}'], [$functionId, $variableId], '/functions/{functionId}/variables/{variableId}'); - - $apiParams = []; - if (!isset($functionId)) { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (!isset($variableId)) { - throw new AppwriteException('Missing required parameter: "variableId"'); - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update variable - * - * Update variable by its unique ID. - * - * @param string $functionId - * @param string $variableId - * @param string $key - * @param string $value - * @throws AppwriteException - * @return array - - */ - public function updateVariable(string $functionId, string $variableId, string $key, string $value = null): array - { - $apiPath = str_replace(['{functionId}', '{variableId}'], [$functionId, $variableId], '/functions/{functionId}/variables/{variableId}'); - - $apiParams = []; - if (!isset($functionId)) { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (!isset($variableId)) { - throw new AppwriteException('Missing required parameter: "variableId"'); - } - if (!isset($key)) { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (!is_null($key)) { - $apiParams['key'] = $key; - } - if (!is_null($value)) { - $apiParams['value'] = $value; - } - return $this->client->call( - Client::METHOD_PUT, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Delete variable - * - * Delete a variable by its unique ID. - * - * @param string $functionId - * @param string $variableId - * @throws AppwriteException - * @return string - - */ - public function deleteVariable(string $functionId, string $variableId): string - { - $apiPath = str_replace(['{functionId}', '{variableId}'], [$functionId, $variableId], '/functions/{functionId}/variables/{variableId}'); - - $apiParams = []; - if (!isset($functionId)) { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (!isset($variableId)) { - throw new AppwriteException('Missing required parameter: "variableId"'); - } - return $this->client->call( - Client::METHOD_DELETE, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } -} diff --git a/src/Appwrite/Services/Graphql.php b/src/Appwrite/Services/Graphql.php deleted file mode 100644 index 5dfdc0d..0000000 --- a/src/Appwrite/Services/Graphql.php +++ /dev/null @@ -1,80 +0,0 @@ -<?php - -namespace Appwrite\Services; - -use Appwrite\AppwriteException; -use Appwrite\Client; -use Appwrite\Service; -use Appwrite\InputFile; - -class Graphql extends Service -{ - public function __construct(Client $client) - { - $this->client = $client; - } - - /** - * GraphQL endpoint - * - * Execute a GraphQL mutation. - * - * @param array $query - * @throws AppwriteException - * @return array - - */ - public function query(array $query): array - { - $apiPath = str_replace([], [], '/graphql'); - - $apiParams = []; - if (!isset($query)) { - throw new AppwriteException('Missing required parameter: "query"'); - } - if (!is_null($query)) { - $apiParams['query'] = $query; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'x-sdk-graphql' => 'true', - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * GraphQL endpoint - * - * Execute a GraphQL mutation. - * - * @param array $query - * @throws AppwriteException - * @return array - - */ - public function mutation(array $query): array - { - $apiPath = str_replace([], [], '/graphql/mutation'); - - $apiParams = []; - if (!isset($query)) { - throw new AppwriteException('Missing required parameter: "query"'); - } - if (!is_null($query)) { - $apiParams['query'] = $query; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'x-sdk-graphql' => 'true', - 'content-type' => 'application/json', - ], - $apiParams - ); - } -} diff --git a/src/Appwrite/Services/Health.php b/src/Appwrite/Services/Health.php deleted file mode 100644 index 79d3c5b..0000000 --- a/src/Appwrite/Services/Health.php +++ /dev/null @@ -1,655 +0,0 @@ -<?php - -namespace Appwrite\Services; - -use Appwrite\AppwriteException; -use Appwrite\Client; -use Appwrite\Service; -use Appwrite\InputFile; -use Appwrite\Enums\Name; - -class Health extends Service -{ - public function __construct(Client $client) - { - $this->client = $client; - } - - /** - * Get HTTP - * - * Check the Appwrite HTTP server is up and responsive. - * - * @throws AppwriteException - * @return array - - */ - public function get(): array - { - $apiPath = str_replace([], [], '/health'); - - $apiParams = []; - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get antivirus - * - * Check the Appwrite Antivirus server is up and connection is successful. - * - * @throws AppwriteException - * @return array - - */ - public function getAntivirus(): array - { - $apiPath = str_replace([], [], '/health/anti-virus'); - - $apiParams = []; - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get cache - * - * Check the Appwrite in-memory cache servers are up and connection is - * successful. - * - * @throws AppwriteException - * @return array - - */ - public function getCache(): array - { - $apiPath = str_replace([], [], '/health/cache'); - - $apiParams = []; - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get the SSL certificate for a domain - * - * Get the SSL certificate for a domain - * - * @param string $domain - * @throws AppwriteException - * @return array - - */ - public function getCertificate(string $domain = null): array - { - $apiPath = str_replace([], [], '/health/certificate'); - - $apiParams = []; - if (!is_null($domain)) { - $apiParams['domain'] = $domain; - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get DB - * - * Check the Appwrite database servers are up and connection is successful. - * - * @throws AppwriteException - * @return array - - */ - public function getDB(): array - { - $apiPath = str_replace([], [], '/health/db'); - - $apiParams = []; - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get pubsub - * - * Check the Appwrite pub-sub servers are up and connection is successful. - * - * @throws AppwriteException - * @return array - - */ - public function getPubSub(): array - { - $apiPath = str_replace([], [], '/health/pubsub'); - - $apiParams = []; - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get queue - * - * Check the Appwrite queue messaging servers are up and connection is - * successful. - * - * @throws AppwriteException - * @return array - - */ - public function getQueue(): array - { - $apiPath = str_replace([], [], '/health/queue'); - - $apiParams = []; - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get builds queue - * - * Get the number of builds that are waiting to be processed in the Appwrite - * internal queue server. - * - * @param int $threshold - * @throws AppwriteException - * @return array - - */ - public function getQueueBuilds(int $threshold = null): array - { - $apiPath = str_replace([], [], '/health/queue/builds'); - - $apiParams = []; - if (!is_null($threshold)) { - $apiParams['threshold'] = $threshold; - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get certificates queue - * - * Get the number of certificates that are waiting to be issued against - * [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue - * server. - * - * @param int $threshold - * @throws AppwriteException - * @return array - - */ - public function getQueueCertificates(int $threshold = null): array - { - $apiPath = str_replace([], [], '/health/queue/certificates'); - - $apiParams = []; - if (!is_null($threshold)) { - $apiParams['threshold'] = $threshold; - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get databases queue - * - * Get the number of database changes that are waiting to be processed in the - * Appwrite internal queue server. - * - * @param string $name - * @param int $threshold - * @throws AppwriteException - * @return array - - */ - public function getQueueDatabases(string $name = null, int $threshold = null): array - { - $apiPath = str_replace([], [], '/health/queue/databases'); - - $apiParams = []; - if (!is_null($name)) { - $apiParams['name'] = $name; - } - if (!is_null($threshold)) { - $apiParams['threshold'] = $threshold; - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get deletes queue - * - * Get the number of background destructive changes that are waiting to be - * processed in the Appwrite internal queue server. - * - * @param int $threshold - * @throws AppwriteException - * @return array - - */ - public function getQueueDeletes(int $threshold = null): array - { - $apiPath = str_replace([], [], '/health/queue/deletes'); - - $apiParams = []; - if (!is_null($threshold)) { - $apiParams['threshold'] = $threshold; - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get number of failed queue jobs - * - * Returns the amount of failed jobs in a given queue. - * - * - * @param Name $name - * @param int $threshold - * @throws AppwriteException - * @return array - - */ - public function getFailedJobs(Name $name, int $threshold = null): array - { - $apiPath = str_replace(['{name}'], [$name], '/health/queue/failed/{name}'); - - $apiParams = []; - if (!isset($name)) { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (!is_null($threshold)) { - $apiParams['threshold'] = $threshold; - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get functions queue - * - * Get the number of function executions that are waiting to be processed in - * the Appwrite internal queue server. - * - * @param int $threshold - * @throws AppwriteException - * @return array - - */ - public function getQueueFunctions(int $threshold = null): array - { - $apiPath = str_replace([], [], '/health/queue/functions'); - - $apiParams = []; - if (!is_null($threshold)) { - $apiParams['threshold'] = $threshold; - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get logs queue - * - * Get the number of logs that are waiting to be processed in the Appwrite - * internal queue server. - * - * @param int $threshold - * @throws AppwriteException - * @return array - - */ - public function getQueueLogs(int $threshold = null): array - { - $apiPath = str_replace([], [], '/health/queue/logs'); - - $apiParams = []; - if (!is_null($threshold)) { - $apiParams['threshold'] = $threshold; - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get mails queue - * - * Get the number of mails that are waiting to be processed in the Appwrite - * internal queue server. - * - * @param int $threshold - * @throws AppwriteException - * @return array - - */ - public function getQueueMails(int $threshold = null): array - { - $apiPath = str_replace([], [], '/health/queue/mails'); - - $apiParams = []; - if (!is_null($threshold)) { - $apiParams['threshold'] = $threshold; - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get messaging queue - * - * Get the number of messages that are waiting to be processed in the Appwrite - * internal queue server. - * - * @param int $threshold - * @throws AppwriteException - * @return array - - */ - public function getQueueMessaging(int $threshold = null): array - { - $apiPath = str_replace([], [], '/health/queue/messaging'); - - $apiParams = []; - if (!is_null($threshold)) { - $apiParams['threshold'] = $threshold; - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get migrations queue - * - * Get the number of migrations that are waiting to be processed in the - * Appwrite internal queue server. - * - * @param int $threshold - * @throws AppwriteException - * @return array - - */ - public function getQueueMigrations(int $threshold = null): array - { - $apiPath = str_replace([], [], '/health/queue/migrations'); - - $apiParams = []; - if (!is_null($threshold)) { - $apiParams['threshold'] = $threshold; - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get usage queue - * - * Get the number of metrics that are waiting to be processed in the Appwrite - * internal queue server. - * - * @param int $threshold - * @throws AppwriteException - * @return array - - */ - public function getQueueUsage(int $threshold = null): array - { - $apiPath = str_replace([], [], '/health/queue/usage'); - - $apiParams = []; - if (!is_null($threshold)) { - $apiParams['threshold'] = $threshold; - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get usage dump queue - * - * Get the number of projects containing metrics that are waiting to be - * processed in the Appwrite internal queue server. - * - * @param int $threshold - * @throws AppwriteException - * @return array - - */ - public function getQueueUsageDump(int $threshold = null): array - { - $apiPath = str_replace([], [], '/health/queue/usage-dump'); - - $apiParams = []; - if (!is_null($threshold)) { - $apiParams['threshold'] = $threshold; - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get webhooks queue - * - * Get the number of webhooks that are waiting to be processed in the Appwrite - * internal queue server. - * - * @param int $threshold - * @throws AppwriteException - * @return array - - */ - public function getQueueWebhooks(int $threshold = null): array - { - $apiPath = str_replace([], [], '/health/queue/webhooks'); - - $apiParams = []; - if (!is_null($threshold)) { - $apiParams['threshold'] = $threshold; - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get storage - * - * Check the Appwrite storage device is up and connection is successful. - * - * @throws AppwriteException - * @return array - - */ - public function getStorage(): array - { - $apiPath = str_replace([], [], '/health/storage'); - - $apiParams = []; - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get local storage - * - * Check the Appwrite local storage device is up and connection is successful. - * - * @throws AppwriteException - * @return array - - */ - public function getStorageLocal(): array - { - $apiPath = str_replace([], [], '/health/storage/local'); - - $apiParams = []; - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get time - * - * Check the Appwrite server time is synced with Google remote NTP server. We - * use this technology to smoothly handle leap seconds with no disruptive - * events. The [Network Time - * Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is - * used by hundreds of millions of computers and devices to synchronize their - * clocks over the Internet. If your computer sets its own clock, it likely - * uses NTP. - * - * @throws AppwriteException - * @return array - - */ - public function getTime(): array - { - $apiPath = str_replace([], [], '/health/time'); - - $apiParams = []; - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } -} diff --git a/src/Appwrite/Services/Locale.php b/src/Appwrite/Services/Locale.php deleted file mode 100644 index 0cb7ae7..0000000 --- a/src/Appwrite/Services/Locale.php +++ /dev/null @@ -1,221 +0,0 @@ -<?php - -namespace Appwrite\Services; - -use Appwrite\AppwriteException; -use Appwrite\Client; -use Appwrite\Service; -use Appwrite\InputFile; - -class Locale extends Service -{ - public function __construct(Client $client) - { - $this->client = $client; - } - - /** - * Get user locale - * - * Get the current user location based on IP. Returns an object with user - * country code, country name, continent name, continent code, ip address and - * suggested currency. You can use the locale header to get the data in a - * supported language. - * - * ([IP Geolocation by DB-IP](https://db-ip.com)) - * - * @throws AppwriteException - * @return array - - */ - public function get(): array - { - $apiPath = str_replace([], [], '/locale'); - - $apiParams = []; - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * List Locale Codes - * - * List of all locale codes in [ISO - * 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes). - * - * @throws AppwriteException - * @return array - - */ - public function listCodes(): array - { - $apiPath = str_replace([], [], '/locale/codes'); - - $apiParams = []; - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * List continents - * - * List of all continents. You can use the locale header to get the data in a - * supported language. - * - * @throws AppwriteException - * @return array - - */ - public function listContinents(): array - { - $apiPath = str_replace([], [], '/locale/continents'); - - $apiParams = []; - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * List countries - * - * List of all countries. You can use the locale header to get the data in a - * supported language. - * - * @throws AppwriteException - * @return array - - */ - public function listCountries(): array - { - $apiPath = str_replace([], [], '/locale/countries'); - - $apiParams = []; - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * List EU countries - * - * 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. - * - * @throws AppwriteException - * @return array - - */ - public function listCountriesEU(): array - { - $apiPath = str_replace([], [], '/locale/countries/eu'); - - $apiParams = []; - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * List countries phone codes - * - * List of all countries phone codes. You can use the locale header to get the - * data in a supported language. - * - * @throws AppwriteException - * @return array - - */ - public function listCountriesPhones(): array - { - $apiPath = str_replace([], [], '/locale/countries/phones'); - - $apiParams = []; - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * List 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. - * - * @throws AppwriteException - * @return array - - */ - public function listCurrencies(): array - { - $apiPath = str_replace([], [], '/locale/currencies'); - - $apiParams = []; - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * List languages - * - * List of all languages classified by ISO 639-1 including 2-letter code, name - * in English, and name in the respective language. - * - * @throws AppwriteException - * @return array - - */ - public function listLanguages(): array - { - $apiPath = str_replace([], [], '/locale/languages'); - - $apiParams = []; - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } -} diff --git a/src/Appwrite/Services/Messaging.php b/src/Appwrite/Services/Messaging.php deleted file mode 100644 index 5dbcece..0000000 --- a/src/Appwrite/Services/Messaging.php +++ /dev/null @@ -1,2253 +0,0 @@ -<?php - -namespace Appwrite\Services; - -use Appwrite\AppwriteException; -use Appwrite\Client; -use Appwrite\Service; -use Appwrite\InputFile; -use Appwrite\Enums\SmtpEncryption; - -class Messaging extends Service -{ - public function __construct(Client $client) - { - $this->client = $client; - } - - /** - * List messages - * - * Get a list of all messages from the current Appwrite project. - * - * @param array $queries - * @param string $search - * @throws AppwriteException - * @return array - - */ - public function listMessages(array $queries = null, string $search = null): array - { - $apiPath = str_replace([], [], '/messaging/messages'); - - $apiParams = []; - if (!is_null($queries)) { - $apiParams['queries'] = $queries; - } - if (!is_null($search)) { - $apiParams['search'] = $search; - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create email - * - * Create a new email message. - * - * @param string $messageId - * @param string $subject - * @param string $content - * @param array $topics - * @param array $users - * @param array $targets - * @param array $cc - * @param array $bcc - * @param array $attachments - * @param bool $draft - * @param bool $html - * @param string $scheduledAt - * @throws AppwriteException - * @return array - - */ - 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): array - { - $apiPath = str_replace([], [], '/messaging/messages/email'); - - $apiParams = []; - if (!isset($messageId)) { - throw new AppwriteException('Missing required parameter: "messageId"'); - } - if (!isset($subject)) { - throw new AppwriteException('Missing required parameter: "subject"'); - } - if (!isset($content)) { - throw new AppwriteException('Missing required parameter: "content"'); - } - if (!is_null($messageId)) { - $apiParams['messageId'] = $messageId; - } - if (!is_null($subject)) { - $apiParams['subject'] = $subject; - } - if (!is_null($content)) { - $apiParams['content'] = $content; - } - if (!is_null($topics)) { - $apiParams['topics'] = $topics; - } - if (!is_null($users)) { - $apiParams['users'] = $users; - } - if (!is_null($targets)) { - $apiParams['targets'] = $targets; - } - if (!is_null($cc)) { - $apiParams['cc'] = $cc; - } - if (!is_null($bcc)) { - $apiParams['bcc'] = $bcc; - } - if (!is_null($attachments)) { - $apiParams['attachments'] = $attachments; - } - if (!is_null($draft)) { - $apiParams['draft'] = $draft; - } - if (!is_null($html)) { - $apiParams['html'] = $html; - } - if (!is_null($scheduledAt)) { - $apiParams['scheduledAt'] = $scheduledAt; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update email - * - * Update an email message by its unique ID. - * - * - * @param string $messageId - * @param array $topics - * @param array $users - * @param array $targets - * @param string $subject - * @param string $content - * @param bool $draft - * @param bool $html - * @param array $cc - * @param array $bcc - * @param string $scheduledAt - * @param array $attachments - * @throws AppwriteException - * @return array - - */ - 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): array - { - $apiPath = str_replace(['{messageId}'], [$messageId], '/messaging/messages/email/{messageId}'); - - $apiParams = []; - if (!isset($messageId)) { - throw new AppwriteException('Missing required parameter: "messageId"'); - } - if (!is_null($topics)) { - $apiParams['topics'] = $topics; - } - if (!is_null($users)) { - $apiParams['users'] = $users; - } - if (!is_null($targets)) { - $apiParams['targets'] = $targets; - } - if (!is_null($subject)) { - $apiParams['subject'] = $subject; - } - if (!is_null($content)) { - $apiParams['content'] = $content; - } - if (!is_null($draft)) { - $apiParams['draft'] = $draft; - } - if (!is_null($html)) { - $apiParams['html'] = $html; - } - if (!is_null($cc)) { - $apiParams['cc'] = $cc; - } - if (!is_null($bcc)) { - $apiParams['bcc'] = $bcc; - } - if (!is_null($scheduledAt)) { - $apiParams['scheduledAt'] = $scheduledAt; - } - if (!is_null($attachments)) { - $apiParams['attachments'] = $attachments; - } - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create push notification - * - * Create a new push notification. - * - * @param string $messageId - * @param string $title - * @param string $body - * @param array $topics - * @param array $users - * @param array $targets - * @param array $data - * @param string $action - * @param string $image - * @param string $icon - * @param string $sound - * @param string $color - * @param string $tag - * @param string $badge - * @param bool $draft - * @param string $scheduledAt - * @throws AppwriteException - * @return array - - */ - public function createPush(string $messageId, string $title, string $body, 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, string $badge = null, bool $draft = null, string $scheduledAt = null): array - { - $apiPath = str_replace([], [], '/messaging/messages/push'); - - $apiParams = []; - if (!isset($messageId)) { - throw new AppwriteException('Missing required parameter: "messageId"'); - } - if (!isset($title)) { - throw new AppwriteException('Missing required parameter: "title"'); - } - if (!isset($body)) { - throw new AppwriteException('Missing required parameter: "body"'); - } - if (!is_null($messageId)) { - $apiParams['messageId'] = $messageId; - } - if (!is_null($title)) { - $apiParams['title'] = $title; - } - if (!is_null($body)) { - $apiParams['body'] = $body; - } - if (!is_null($topics)) { - $apiParams['topics'] = $topics; - } - if (!is_null($users)) { - $apiParams['users'] = $users; - } - if (!is_null($targets)) { - $apiParams['targets'] = $targets; - } - if (!is_null($data)) { - $apiParams['data'] = $data; - } - if (!is_null($action)) { - $apiParams['action'] = $action; - } - if (!is_null($image)) { - $apiParams['image'] = $image; - } - if (!is_null($icon)) { - $apiParams['icon'] = $icon; - } - if (!is_null($sound)) { - $apiParams['sound'] = $sound; - } - if (!is_null($color)) { - $apiParams['color'] = $color; - } - if (!is_null($tag)) { - $apiParams['tag'] = $tag; - } - if (!is_null($badge)) { - $apiParams['badge'] = $badge; - } - if (!is_null($draft)) { - $apiParams['draft'] = $draft; - } - if (!is_null($scheduledAt)) { - $apiParams['scheduledAt'] = $scheduledAt; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update push notification - * - * Update a push notification by its unique ID. - * - * - * @param string $messageId - * @param array $topics - * @param array $users - * @param array $targets - * @param string $title - * @param string $body - * @param array $data - * @param string $action - * @param string $image - * @param string $icon - * @param string $sound - * @param string $color - * @param string $tag - * @param int $badge - * @param bool $draft - * @param string $scheduledAt - * @throws AppwriteException - * @return array - - */ - 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): array - { - $apiPath = str_replace(['{messageId}'], [$messageId], '/messaging/messages/push/{messageId}'); - - $apiParams = []; - if (!isset($messageId)) { - throw new AppwriteException('Missing required parameter: "messageId"'); - } - if (!is_null($topics)) { - $apiParams['topics'] = $topics; - } - if (!is_null($users)) { - $apiParams['users'] = $users; - } - if (!is_null($targets)) { - $apiParams['targets'] = $targets; - } - if (!is_null($title)) { - $apiParams['title'] = $title; - } - if (!is_null($body)) { - $apiParams['body'] = $body; - } - if (!is_null($data)) { - $apiParams['data'] = $data; - } - if (!is_null($action)) { - $apiParams['action'] = $action; - } - if (!is_null($image)) { - $apiParams['image'] = $image; - } - if (!is_null($icon)) { - $apiParams['icon'] = $icon; - } - if (!is_null($sound)) { - $apiParams['sound'] = $sound; - } - if (!is_null($color)) { - $apiParams['color'] = $color; - } - if (!is_null($tag)) { - $apiParams['tag'] = $tag; - } - if (!is_null($badge)) { - $apiParams['badge'] = $badge; - } - if (!is_null($draft)) { - $apiParams['draft'] = $draft; - } - if (!is_null($scheduledAt)) { - $apiParams['scheduledAt'] = $scheduledAt; - } - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create SMS - * - * Create a new SMS message. - * - * @param string $messageId - * @param string $content - * @param array $topics - * @param array $users - * @param array $targets - * @param bool $draft - * @param string $scheduledAt - * @throws AppwriteException - * @return array - - */ - public function createSms(string $messageId, string $content, array $topics = null, array $users = null, array $targets = null, bool $draft = null, string $scheduledAt = null): array - { - $apiPath = str_replace([], [], '/messaging/messages/sms'); - - $apiParams = []; - if (!isset($messageId)) { - throw new AppwriteException('Missing required parameter: "messageId"'); - } - if (!isset($content)) { - throw new AppwriteException('Missing required parameter: "content"'); - } - if (!is_null($messageId)) { - $apiParams['messageId'] = $messageId; - } - if (!is_null($content)) { - $apiParams['content'] = $content; - } - if (!is_null($topics)) { - $apiParams['topics'] = $topics; - } - if (!is_null($users)) { - $apiParams['users'] = $users; - } - if (!is_null($targets)) { - $apiParams['targets'] = $targets; - } - if (!is_null($draft)) { - $apiParams['draft'] = $draft; - } - if (!is_null($scheduledAt)) { - $apiParams['scheduledAt'] = $scheduledAt; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update SMS - * - * Update an email message by its unique ID. - * - * - * @param string $messageId - * @param array $topics - * @param array $users - * @param array $targets - * @param string $content - * @param bool $draft - * @param string $scheduledAt - * @throws AppwriteException - * @return array - - */ - public function updateSms(string $messageId, array $topics = null, array $users = null, array $targets = null, string $content = null, bool $draft = null, string $scheduledAt = null): array - { - $apiPath = str_replace(['{messageId}'], [$messageId], '/messaging/messages/sms/{messageId}'); - - $apiParams = []; - if (!isset($messageId)) { - throw new AppwriteException('Missing required parameter: "messageId"'); - } - if (!is_null($topics)) { - $apiParams['topics'] = $topics; - } - if (!is_null($users)) { - $apiParams['users'] = $users; - } - if (!is_null($targets)) { - $apiParams['targets'] = $targets; - } - if (!is_null($content)) { - $apiParams['content'] = $content; - } - if (!is_null($draft)) { - $apiParams['draft'] = $draft; - } - if (!is_null($scheduledAt)) { - $apiParams['scheduledAt'] = $scheduledAt; - } - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get message - * - * Get a message by its unique ID. - * - * - * @param string $messageId - * @throws AppwriteException - * @return array - - */ - public function getMessage(string $messageId): array - { - $apiPath = str_replace(['{messageId}'], [$messageId], '/messaging/messages/{messageId}'); - - $apiParams = []; - if (!isset($messageId)) { - throw new AppwriteException('Missing required parameter: "messageId"'); - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Delete message - * - * Delete a message. If the message is not a draft or scheduled, but has been - * sent, this will not recall the message. - * - * @param string $messageId - * @throws AppwriteException - * @return string - - */ - public function delete(string $messageId): string - { - $apiPath = str_replace(['{messageId}'], [$messageId], '/messaging/messages/{messageId}'); - - $apiParams = []; - if (!isset($messageId)) { - throw new AppwriteException('Missing required parameter: "messageId"'); - } - return $this->client->call( - Client::METHOD_DELETE, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * List message logs - * - * Get the message activity logs listed by its unique ID. - * - * @param string $messageId - * @param array $queries - * @throws AppwriteException - * @return array - - */ - public function listMessageLogs(string $messageId, array $queries = null): array - { - $apiPath = str_replace(['{messageId}'], [$messageId], '/messaging/messages/{messageId}/logs'); - - $apiParams = []; - if (!isset($messageId)) { - throw new AppwriteException('Missing required parameter: "messageId"'); - } - if (!is_null($queries)) { - $apiParams['queries'] = $queries; - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * List message targets - * - * Get a list of the targets associated with a message. - * - * @param string $messageId - * @param array $queries - * @throws AppwriteException - * @return array - - */ - public function listTargets(string $messageId, array $queries = null): array - { - $apiPath = str_replace(['{messageId}'], [$messageId], '/messaging/messages/{messageId}/targets'); - - $apiParams = []; - if (!isset($messageId)) { - throw new AppwriteException('Missing required parameter: "messageId"'); - } - if (!is_null($queries)) { - $apiParams['queries'] = $queries; - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * List providers - * - * Get a list of all providers from the current Appwrite project. - * - * @param array $queries - * @param string $search - * @throws AppwriteException - * @return array - - */ - public function listProviders(array $queries = null, string $search = null): array - { - $apiPath = str_replace([], [], '/messaging/providers'); - - $apiParams = []; - if (!is_null($queries)) { - $apiParams['queries'] = $queries; - } - if (!is_null($search)) { - $apiParams['search'] = $search; - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create APNS provider - * - * Create a new Apple Push Notification service provider. - * - * @param string $providerId - * @param string $name - * @param string $authKey - * @param string $authKeyId - * @param string $teamId - * @param string $bundleId - * @param bool $sandbox - * @param bool $enabled - * @throws AppwriteException - * @return array - - */ - public function createApnsProvider(string $providerId, string $name, string $authKey = null, string $authKeyId = null, string $teamId = null, string $bundleId = null, bool $sandbox = null, bool $enabled = null): array - { - $apiPath = str_replace([], [], '/messaging/providers/apns'); - - $apiParams = []; - if (!isset($providerId)) { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - if (!isset($name)) { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (!is_null($providerId)) { - $apiParams['providerId'] = $providerId; - } - if (!is_null($name)) { - $apiParams['name'] = $name; - } - if (!is_null($authKey)) { - $apiParams['authKey'] = $authKey; - } - if (!is_null($authKeyId)) { - $apiParams['authKeyId'] = $authKeyId; - } - if (!is_null($teamId)) { - $apiParams['teamId'] = $teamId; - } - if (!is_null($bundleId)) { - $apiParams['bundleId'] = $bundleId; - } - if (!is_null($sandbox)) { - $apiParams['sandbox'] = $sandbox; - } - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update APNS provider - * - * Update a Apple Push Notification service provider by its unique ID. - * - * @param string $providerId - * @param string $name - * @param bool $enabled - * @param string $authKey - * @param string $authKeyId - * @param string $teamId - * @param string $bundleId - * @param bool $sandbox - * @throws AppwriteException - * @return array - - */ - public function updateApnsProvider(string $providerId, string $name = null, bool $enabled = null, string $authKey = null, string $authKeyId = null, string $teamId = null, string $bundleId = null, bool $sandbox = null): array - { - $apiPath = str_replace(['{providerId}'], [$providerId], '/messaging/providers/apns/{providerId}'); - - $apiParams = []; - if (!isset($providerId)) { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - if (!is_null($name)) { - $apiParams['name'] = $name; - } - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } - if (!is_null($authKey)) { - $apiParams['authKey'] = $authKey; - } - if (!is_null($authKeyId)) { - $apiParams['authKeyId'] = $authKeyId; - } - if (!is_null($teamId)) { - $apiParams['teamId'] = $teamId; - } - if (!is_null($bundleId)) { - $apiParams['bundleId'] = $bundleId; - } - if (!is_null($sandbox)) { - $apiParams['sandbox'] = $sandbox; - } - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create FCM provider - * - * Create a new Firebase Cloud Messaging provider. - * - * @param string $providerId - * @param string $name - * @param array $serviceAccountJSON - * @param bool $enabled - * @throws AppwriteException - * @return array - - */ - public function createFcmProvider(string $providerId, string $name, array $serviceAccountJSON = null, bool $enabled = null): array - { - $apiPath = str_replace([], [], '/messaging/providers/fcm'); - - $apiParams = []; - if (!isset($providerId)) { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - if (!isset($name)) { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (!is_null($providerId)) { - $apiParams['providerId'] = $providerId; - } - if (!is_null($name)) { - $apiParams['name'] = $name; - } - if (!is_null($serviceAccountJSON)) { - $apiParams['serviceAccountJSON'] = $serviceAccountJSON; - } - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update FCM provider - * - * Update a Firebase Cloud Messaging provider by its unique ID. - * - * @param string $providerId - * @param string $name - * @param bool $enabled - * @param array $serviceAccountJSON - * @throws AppwriteException - * @return array - - */ - public function updateFcmProvider(string $providerId, string $name = null, bool $enabled = null, array $serviceAccountJSON = null): array - { - $apiPath = str_replace(['{providerId}'], [$providerId], '/messaging/providers/fcm/{providerId}'); - - $apiParams = []; - if (!isset($providerId)) { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - if (!is_null($name)) { - $apiParams['name'] = $name; - } - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } - if (!is_null($serviceAccountJSON)) { - $apiParams['serviceAccountJSON'] = $serviceAccountJSON; - } - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create Mailgun provider - * - * Create a new Mailgun provider. - * - * @param string $providerId - * @param string $name - * @param string $apiKey - * @param string $domain - * @param bool $isEuRegion - * @param string $fromName - * @param string $fromEmail - * @param string $replyToName - * @param string $replyToEmail - * @param bool $enabled - * @throws AppwriteException - * @return array - - */ - public function createMailgunProvider(string $providerId, string $name, string $apiKey = null, string $domain = null, bool $isEuRegion = null, string $fromName = null, string $fromEmail = null, string $replyToName = null, string $replyToEmail = null, bool $enabled = null): array - { - $apiPath = str_replace([], [], '/messaging/providers/mailgun'); - - $apiParams = []; - if (!isset($providerId)) { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - if (!isset($name)) { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (!is_null($providerId)) { - $apiParams['providerId'] = $providerId; - } - if (!is_null($name)) { - $apiParams['name'] = $name; - } - if (!is_null($apiKey)) { - $apiParams['apiKey'] = $apiKey; - } - if (!is_null($domain)) { - $apiParams['domain'] = $domain; - } - if (!is_null($isEuRegion)) { - $apiParams['isEuRegion'] = $isEuRegion; - } - if (!is_null($fromName)) { - $apiParams['fromName'] = $fromName; - } - if (!is_null($fromEmail)) { - $apiParams['fromEmail'] = $fromEmail; - } - if (!is_null($replyToName)) { - $apiParams['replyToName'] = $replyToName; - } - if (!is_null($replyToEmail)) { - $apiParams['replyToEmail'] = $replyToEmail; - } - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update Mailgun provider - * - * Update a Mailgun provider by its unique ID. - * - * @param string $providerId - * @param string $name - * @param string $apiKey - * @param string $domain - * @param bool $isEuRegion - * @param bool $enabled - * @param string $fromName - * @param string $fromEmail - * @param string $replyToName - * @param string $replyToEmail - * @throws AppwriteException - * @return array - - */ - public function updateMailgunProvider(string $providerId, string $name = null, string $apiKey = null, string $domain = null, bool $isEuRegion = null, bool $enabled = null, string $fromName = null, string $fromEmail = null, string $replyToName = null, string $replyToEmail = null): array - { - $apiPath = str_replace(['{providerId}'], [$providerId], '/messaging/providers/mailgun/{providerId}'); - - $apiParams = []; - if (!isset($providerId)) { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - if (!is_null($name)) { - $apiParams['name'] = $name; - } - if (!is_null($apiKey)) { - $apiParams['apiKey'] = $apiKey; - } - if (!is_null($domain)) { - $apiParams['domain'] = $domain; - } - if (!is_null($isEuRegion)) { - $apiParams['isEuRegion'] = $isEuRegion; - } - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } - if (!is_null($fromName)) { - $apiParams['fromName'] = $fromName; - } - if (!is_null($fromEmail)) { - $apiParams['fromEmail'] = $fromEmail; - } - if (!is_null($replyToName)) { - $apiParams['replyToName'] = $replyToName; - } - if (!is_null($replyToEmail)) { - $apiParams['replyToEmail'] = $replyToEmail; - } - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create Msg91 provider - * - * Create a new MSG91 provider. - * - * @param string $providerId - * @param string $name - * @param string $templateId - * @param string $senderId - * @param string $authKey - * @param bool $enabled - * @throws AppwriteException - * @return array - - */ - public function createMsg91Provider(string $providerId, string $name, string $templateId = null, string $senderId = null, string $authKey = null, bool $enabled = null): array - { - $apiPath = str_replace([], [], '/messaging/providers/msg91'); - - $apiParams = []; - if (!isset($providerId)) { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - if (!isset($name)) { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (!is_null($providerId)) { - $apiParams['providerId'] = $providerId; - } - if (!is_null($name)) { - $apiParams['name'] = $name; - } - if (!is_null($templateId)) { - $apiParams['templateId'] = $templateId; - } - if (!is_null($senderId)) { - $apiParams['senderId'] = $senderId; - } - if (!is_null($authKey)) { - $apiParams['authKey'] = $authKey; - } - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update Msg91 provider - * - * Update a MSG91 provider by its unique ID. - * - * @param string $providerId - * @param string $name - * @param bool $enabled - * @param string $templateId - * @param string $senderId - * @param string $authKey - * @throws AppwriteException - * @return array - - */ - public function updateMsg91Provider(string $providerId, string $name = null, bool $enabled = null, string $templateId = null, string $senderId = null, string $authKey = null): array - { - $apiPath = str_replace(['{providerId}'], [$providerId], '/messaging/providers/msg91/{providerId}'); - - $apiParams = []; - if (!isset($providerId)) { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - if (!is_null($name)) { - $apiParams['name'] = $name; - } - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } - if (!is_null($templateId)) { - $apiParams['templateId'] = $templateId; - } - if (!is_null($senderId)) { - $apiParams['senderId'] = $senderId; - } - if (!is_null($authKey)) { - $apiParams['authKey'] = $authKey; - } - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create Sendgrid provider - * - * Create a new Sendgrid provider. - * - * @param string $providerId - * @param string $name - * @param string $apiKey - * @param string $fromName - * @param string $fromEmail - * @param string $replyToName - * @param string $replyToEmail - * @param bool $enabled - * @throws AppwriteException - * @return array - - */ - public function createSendgridProvider(string $providerId, string $name, string $apiKey = null, string $fromName = null, string $fromEmail = null, string $replyToName = null, string $replyToEmail = null, bool $enabled = null): array - { - $apiPath = str_replace([], [], '/messaging/providers/sendgrid'); - - $apiParams = []; - if (!isset($providerId)) { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - if (!isset($name)) { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (!is_null($providerId)) { - $apiParams['providerId'] = $providerId; - } - if (!is_null($name)) { - $apiParams['name'] = $name; - } - if (!is_null($apiKey)) { - $apiParams['apiKey'] = $apiKey; - } - if (!is_null($fromName)) { - $apiParams['fromName'] = $fromName; - } - if (!is_null($fromEmail)) { - $apiParams['fromEmail'] = $fromEmail; - } - if (!is_null($replyToName)) { - $apiParams['replyToName'] = $replyToName; - } - if (!is_null($replyToEmail)) { - $apiParams['replyToEmail'] = $replyToEmail; - } - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update Sendgrid provider - * - * Update a Sendgrid provider by its unique ID. - * - * @param string $providerId - * @param string $name - * @param bool $enabled - * @param string $apiKey - * @param string $fromName - * @param string $fromEmail - * @param string $replyToName - * @param string $replyToEmail - * @throws AppwriteException - * @return array - - */ - public function updateSendgridProvider(string $providerId, string $name = null, bool $enabled = null, string $apiKey = null, string $fromName = null, string $fromEmail = null, string $replyToName = null, string $replyToEmail = null): array - { - $apiPath = str_replace(['{providerId}'], [$providerId], '/messaging/providers/sendgrid/{providerId}'); - - $apiParams = []; - if (!isset($providerId)) { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - if (!is_null($name)) { - $apiParams['name'] = $name; - } - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } - if (!is_null($apiKey)) { - $apiParams['apiKey'] = $apiKey; - } - if (!is_null($fromName)) { - $apiParams['fromName'] = $fromName; - } - if (!is_null($fromEmail)) { - $apiParams['fromEmail'] = $fromEmail; - } - if (!is_null($replyToName)) { - $apiParams['replyToName'] = $replyToName; - } - if (!is_null($replyToEmail)) { - $apiParams['replyToEmail'] = $replyToEmail; - } - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create SMTP provider - * - * Create a new SMTP provider. - * - * @param string $providerId - * @param string $name - * @param string $host - * @param int $port - * @param string $username - * @param string $password - * @param SmtpEncryption $encryption - * @param bool $autoTLS - * @param string $mailer - * @param string $fromName - * @param string $fromEmail - * @param string $replyToName - * @param string $replyToEmail - * @param bool $enabled - * @throws AppwriteException - * @return array - - */ - public function createSmtpProvider(string $providerId, string $name, string $host, int $port = null, string $username = null, string $password = null, SmtpEncryption $encryption = null, bool $autoTLS = null, string $mailer = null, string $fromName = null, string $fromEmail = null, string $replyToName = null, string $replyToEmail = null, bool $enabled = null): array - { - $apiPath = str_replace([], [], '/messaging/providers/smtp'); - - $apiParams = []; - if (!isset($providerId)) { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - if (!isset($name)) { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (!isset($host)) { - throw new AppwriteException('Missing required parameter: "host"'); - } - if (!is_null($providerId)) { - $apiParams['providerId'] = $providerId; - } - if (!is_null($name)) { - $apiParams['name'] = $name; - } - if (!is_null($host)) { - $apiParams['host'] = $host; - } - if (!is_null($port)) { - $apiParams['port'] = $port; - } - if (!is_null($username)) { - $apiParams['username'] = $username; - } - if (!is_null($password)) { - $apiParams['password'] = $password; - } - if (!is_null($encryption)) { - $apiParams['encryption'] = $encryption; - } - if (!is_null($autoTLS)) { - $apiParams['autoTLS'] = $autoTLS; - } - if (!is_null($mailer)) { - $apiParams['mailer'] = $mailer; - } - if (!is_null($fromName)) { - $apiParams['fromName'] = $fromName; - } - if (!is_null($fromEmail)) { - $apiParams['fromEmail'] = $fromEmail; - } - if (!is_null($replyToName)) { - $apiParams['replyToName'] = $replyToName; - } - if (!is_null($replyToEmail)) { - $apiParams['replyToEmail'] = $replyToEmail; - } - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update SMTP provider - * - * Update a SMTP provider by its unique ID. - * - * @param string $providerId - * @param string $name - * @param string $host - * @param int $port - * @param string $username - * @param string $password - * @param SmtpEncryption $encryption - * @param bool $autoTLS - * @param string $mailer - * @param string $fromName - * @param string $fromEmail - * @param string $replyToName - * @param string $replyToEmail - * @param bool $enabled - * @throws AppwriteException - * @return array - - */ - public function updateSmtpProvider(string $providerId, string $name = null, string $host = null, int $port = null, string $username = null, string $password = null, SmtpEncryption $encryption = null, bool $autoTLS = null, string $mailer = null, string $fromName = null, string $fromEmail = null, string $replyToName = null, string $replyToEmail = null, bool $enabled = null): array - { - $apiPath = str_replace(['{providerId}'], [$providerId], '/messaging/providers/smtp/{providerId}'); - - $apiParams = []; - if (!isset($providerId)) { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - if (!is_null($name)) { - $apiParams['name'] = $name; - } - if (!is_null($host)) { - $apiParams['host'] = $host; - } - if (!is_null($port)) { - $apiParams['port'] = $port; - } - if (!is_null($username)) { - $apiParams['username'] = $username; - } - if (!is_null($password)) { - $apiParams['password'] = $password; - } - if (!is_null($encryption)) { - $apiParams['encryption'] = $encryption; - } - if (!is_null($autoTLS)) { - $apiParams['autoTLS'] = $autoTLS; - } - if (!is_null($mailer)) { - $apiParams['mailer'] = $mailer; - } - if (!is_null($fromName)) { - $apiParams['fromName'] = $fromName; - } - if (!is_null($fromEmail)) { - $apiParams['fromEmail'] = $fromEmail; - } - if (!is_null($replyToName)) { - $apiParams['replyToName'] = $replyToName; - } - if (!is_null($replyToEmail)) { - $apiParams['replyToEmail'] = $replyToEmail; - } - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create Telesign provider - * - * Create a new Telesign provider. - * - * @param string $providerId - * @param string $name - * @param string $from - * @param string $customerId - * @param string $apiKey - * @param bool $enabled - * @throws AppwriteException - * @return array - - */ - public function createTelesignProvider(string $providerId, string $name, string $from = null, string $customerId = null, string $apiKey = null, bool $enabled = null): array - { - $apiPath = str_replace([], [], '/messaging/providers/telesign'); - - $apiParams = []; - if (!isset($providerId)) { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - if (!isset($name)) { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (!is_null($providerId)) { - $apiParams['providerId'] = $providerId; - } - if (!is_null($name)) { - $apiParams['name'] = $name; - } - if (!is_null($from)) { - $apiParams['from'] = $from; - } - if (!is_null($customerId)) { - $apiParams['customerId'] = $customerId; - } - if (!is_null($apiKey)) { - $apiParams['apiKey'] = $apiKey; - } - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update Telesign provider - * - * Update a Telesign provider by its unique ID. - * - * @param string $providerId - * @param string $name - * @param bool $enabled - * @param string $customerId - * @param string $apiKey - * @param string $from - * @throws AppwriteException - * @return array - - */ - public function updateTelesignProvider(string $providerId, string $name = null, bool $enabled = null, string $customerId = null, string $apiKey = null, string $from = null): array - { - $apiPath = str_replace(['{providerId}'], [$providerId], '/messaging/providers/telesign/{providerId}'); - - $apiParams = []; - if (!isset($providerId)) { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - if (!is_null($name)) { - $apiParams['name'] = $name; - } - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } - if (!is_null($customerId)) { - $apiParams['customerId'] = $customerId; - } - if (!is_null($apiKey)) { - $apiParams['apiKey'] = $apiKey; - } - if (!is_null($from)) { - $apiParams['from'] = $from; - } - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create Textmagic provider - * - * Create a new Textmagic provider. - * - * @param string $providerId - * @param string $name - * @param string $from - * @param string $username - * @param string $apiKey - * @param bool $enabled - * @throws AppwriteException - * @return array - - */ - public function createTextmagicProvider(string $providerId, string $name, string $from = null, string $username = null, string $apiKey = null, bool $enabled = null): array - { - $apiPath = str_replace([], [], '/messaging/providers/textmagic'); - - $apiParams = []; - if (!isset($providerId)) { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - if (!isset($name)) { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (!is_null($providerId)) { - $apiParams['providerId'] = $providerId; - } - if (!is_null($name)) { - $apiParams['name'] = $name; - } - if (!is_null($from)) { - $apiParams['from'] = $from; - } - if (!is_null($username)) { - $apiParams['username'] = $username; - } - if (!is_null($apiKey)) { - $apiParams['apiKey'] = $apiKey; - } - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update Textmagic provider - * - * Update a Textmagic provider by its unique ID. - * - * @param string $providerId - * @param string $name - * @param bool $enabled - * @param string $username - * @param string $apiKey - * @param string $from - * @throws AppwriteException - * @return array - - */ - public function updateTextmagicProvider(string $providerId, string $name = null, bool $enabled = null, string $username = null, string $apiKey = null, string $from = null): array - { - $apiPath = str_replace(['{providerId}'], [$providerId], '/messaging/providers/textmagic/{providerId}'); - - $apiParams = []; - if (!isset($providerId)) { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - if (!is_null($name)) { - $apiParams['name'] = $name; - } - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } - if (!is_null($username)) { - $apiParams['username'] = $username; - } - if (!is_null($apiKey)) { - $apiParams['apiKey'] = $apiKey; - } - if (!is_null($from)) { - $apiParams['from'] = $from; - } - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create Twilio provider - * - * Create a new Twilio provider. - * - * @param string $providerId - * @param string $name - * @param string $from - * @param string $accountSid - * @param string $authToken - * @param bool $enabled - * @throws AppwriteException - * @return array - - */ - public function createTwilioProvider(string $providerId, string $name, string $from = null, string $accountSid = null, string $authToken = null, bool $enabled = null): array - { - $apiPath = str_replace([], [], '/messaging/providers/twilio'); - - $apiParams = []; - if (!isset($providerId)) { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - if (!isset($name)) { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (!is_null($providerId)) { - $apiParams['providerId'] = $providerId; - } - if (!is_null($name)) { - $apiParams['name'] = $name; - } - if (!is_null($from)) { - $apiParams['from'] = $from; - } - if (!is_null($accountSid)) { - $apiParams['accountSid'] = $accountSid; - } - if (!is_null($authToken)) { - $apiParams['authToken'] = $authToken; - } - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update Twilio provider - * - * Update a Twilio provider by its unique ID. - * - * @param string $providerId - * @param string $name - * @param bool $enabled - * @param string $accountSid - * @param string $authToken - * @param string $from - * @throws AppwriteException - * @return array - - */ - public function updateTwilioProvider(string $providerId, string $name = null, bool $enabled = null, string $accountSid = null, string $authToken = null, string $from = null): array - { - $apiPath = str_replace(['{providerId}'], [$providerId], '/messaging/providers/twilio/{providerId}'); - - $apiParams = []; - if (!isset($providerId)) { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - if (!is_null($name)) { - $apiParams['name'] = $name; - } - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } - if (!is_null($accountSid)) { - $apiParams['accountSid'] = $accountSid; - } - if (!is_null($authToken)) { - $apiParams['authToken'] = $authToken; - } - if (!is_null($from)) { - $apiParams['from'] = $from; - } - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create Vonage provider - * - * Create a new Vonage provider. - * - * @param string $providerId - * @param string $name - * @param string $from - * @param string $apiKey - * @param string $apiSecret - * @param bool $enabled - * @throws AppwriteException - * @return array - - */ - public function createVonageProvider(string $providerId, string $name, string $from = null, string $apiKey = null, string $apiSecret = null, bool $enabled = null): array - { - $apiPath = str_replace([], [], '/messaging/providers/vonage'); - - $apiParams = []; - if (!isset($providerId)) { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - if (!isset($name)) { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (!is_null($providerId)) { - $apiParams['providerId'] = $providerId; - } - if (!is_null($name)) { - $apiParams['name'] = $name; - } - if (!is_null($from)) { - $apiParams['from'] = $from; - } - if (!is_null($apiKey)) { - $apiParams['apiKey'] = $apiKey; - } - if (!is_null($apiSecret)) { - $apiParams['apiSecret'] = $apiSecret; - } - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update Vonage provider - * - * Update a Vonage provider by its unique ID. - * - * @param string $providerId - * @param string $name - * @param bool $enabled - * @param string $apiKey - * @param string $apiSecret - * @param string $from - * @throws AppwriteException - * @return array - - */ - public function updateVonageProvider(string $providerId, string $name = null, bool $enabled = null, string $apiKey = null, string $apiSecret = null, string $from = null): array - { - $apiPath = str_replace(['{providerId}'], [$providerId], '/messaging/providers/vonage/{providerId}'); - - $apiParams = []; - if (!isset($providerId)) { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - if (!is_null($name)) { - $apiParams['name'] = $name; - } - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } - if (!is_null($apiKey)) { - $apiParams['apiKey'] = $apiKey; - } - if (!is_null($apiSecret)) { - $apiParams['apiSecret'] = $apiSecret; - } - if (!is_null($from)) { - $apiParams['from'] = $from; - } - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get provider - * - * Get a provider by its unique ID. - * - * - * @param string $providerId - * @throws AppwriteException - * @return array - - */ - public function getProvider(string $providerId): array - { - $apiPath = str_replace(['{providerId}'], [$providerId], '/messaging/providers/{providerId}'); - - $apiParams = []; - if (!isset($providerId)) { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Delete provider - * - * Delete a provider by its unique ID. - * - * @param string $providerId - * @throws AppwriteException - * @return string - - */ - public function deleteProvider(string $providerId): string - { - $apiPath = str_replace(['{providerId}'], [$providerId], '/messaging/providers/{providerId}'); - - $apiParams = []; - if (!isset($providerId)) { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - return $this->client->call( - Client::METHOD_DELETE, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * List provider logs - * - * Get the provider activity logs listed by its unique ID. - * - * @param string $providerId - * @param array $queries - * @throws AppwriteException - * @return array - - */ - public function listProviderLogs(string $providerId, array $queries = null): array - { - $apiPath = str_replace(['{providerId}'], [$providerId], '/messaging/providers/{providerId}/logs'); - - $apiParams = []; - if (!isset($providerId)) { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - if (!is_null($queries)) { - $apiParams['queries'] = $queries; - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * List subscriber logs - * - * Get the subscriber activity logs listed by its unique ID. - * - * @param string $subscriberId - * @param array $queries - * @throws AppwriteException - * @return array - - */ - public function listSubscriberLogs(string $subscriberId, array $queries = null): array - { - $apiPath = str_replace(['{subscriberId}'], [$subscriberId], '/messaging/subscribers/{subscriberId}/logs'); - - $apiParams = []; - if (!isset($subscriberId)) { - throw new AppwriteException('Missing required parameter: "subscriberId"'); - } - if (!is_null($queries)) { - $apiParams['queries'] = $queries; - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * List topics - * - * Get a list of all topics from the current Appwrite project. - * - * @param array $queries - * @param string $search - * @throws AppwriteException - * @return array - - */ - public function listTopics(array $queries = null, string $search = null): array - { - $apiPath = str_replace([], [], '/messaging/topics'); - - $apiParams = []; - if (!is_null($queries)) { - $apiParams['queries'] = $queries; - } - if (!is_null($search)) { - $apiParams['search'] = $search; - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create topic - * - * Create a new topic. - * - * @param string $topicId - * @param string $name - * @param array $subscribe - * @throws AppwriteException - * @return array - - */ - public function createTopic(string $topicId, string $name, array $subscribe = null): array - { - $apiPath = str_replace([], [], '/messaging/topics'); - - $apiParams = []; - if (!isset($topicId)) { - throw new AppwriteException('Missing required parameter: "topicId"'); - } - if (!isset($name)) { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (!is_null($topicId)) { - $apiParams['topicId'] = $topicId; - } - if (!is_null($name)) { - $apiParams['name'] = $name; - } - if (!is_null($subscribe)) { - $apiParams['subscribe'] = $subscribe; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get topic - * - * Get a topic by its unique ID. - * - * - * @param string $topicId - * @throws AppwriteException - * @return array - - */ - public function getTopic(string $topicId): array - { - $apiPath = str_replace(['{topicId}'], [$topicId], '/messaging/topics/{topicId}'); - - $apiParams = []; - if (!isset($topicId)) { - throw new AppwriteException('Missing required parameter: "topicId"'); - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update topic - * - * Update a topic by its unique ID. - * - * - * @param string $topicId - * @param string $name - * @param array $subscribe - * @throws AppwriteException - * @return array - - */ - public function updateTopic(string $topicId, string $name = null, array $subscribe = null): array - { - $apiPath = str_replace(['{topicId}'], [$topicId], '/messaging/topics/{topicId}'); - - $apiParams = []; - if (!isset($topicId)) { - throw new AppwriteException('Missing required parameter: "topicId"'); - } - if (!is_null($name)) { - $apiParams['name'] = $name; - } - if (!is_null($subscribe)) { - $apiParams['subscribe'] = $subscribe; - } - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Delete topic - * - * Delete a topic by its unique ID. - * - * @param string $topicId - * @throws AppwriteException - * @return string - - */ - public function deleteTopic(string $topicId): string - { - $apiPath = str_replace(['{topicId}'], [$topicId], '/messaging/topics/{topicId}'); - - $apiParams = []; - if (!isset($topicId)) { - throw new AppwriteException('Missing required parameter: "topicId"'); - } - return $this->client->call( - Client::METHOD_DELETE, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * List topic logs - * - * Get the topic activity logs listed by its unique ID. - * - * @param string $topicId - * @param array $queries - * @throws AppwriteException - * @return array - - */ - public function listTopicLogs(string $topicId, array $queries = null): array - { - $apiPath = str_replace(['{topicId}'], [$topicId], '/messaging/topics/{topicId}/logs'); - - $apiParams = []; - if (!isset($topicId)) { - throw new AppwriteException('Missing required parameter: "topicId"'); - } - if (!is_null($queries)) { - $apiParams['queries'] = $queries; - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * List subscribers - * - * Get a list of all subscribers from the current Appwrite project. - * - * @param string $topicId - * @param array $queries - * @param string $search - * @throws AppwriteException - * @return array - - */ - public function listSubscribers(string $topicId, array $queries = null, string $search = null): array - { - $apiPath = str_replace(['{topicId}'], [$topicId], '/messaging/topics/{topicId}/subscribers'); - - $apiParams = []; - if (!isset($topicId)) { - throw new AppwriteException('Missing required parameter: "topicId"'); - } - if (!is_null($queries)) { - $apiParams['queries'] = $queries; - } - if (!is_null($search)) { - $apiParams['search'] = $search; - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create subscriber - * - * Create a new subscriber. - * - * @param string $topicId - * @param string $subscriberId - * @param string $targetId - * @throws AppwriteException - * @return array - - */ - public function createSubscriber(string $topicId, string $subscriberId, string $targetId): array - { - $apiPath = str_replace(['{topicId}'], [$topicId], '/messaging/topics/{topicId}/subscribers'); - - $apiParams = []; - if (!isset($topicId)) { - throw new AppwriteException('Missing required parameter: "topicId"'); - } - if (!isset($subscriberId)) { - throw new AppwriteException('Missing required parameter: "subscriberId"'); - } - if (!isset($targetId)) { - throw new AppwriteException('Missing required parameter: "targetId"'); - } - if (!is_null($subscriberId)) { - $apiParams['subscriberId'] = $subscriberId; - } - if (!is_null($targetId)) { - $apiParams['targetId'] = $targetId; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get subscriber - * - * Get a subscriber by its unique ID. - * - * - * @param string $topicId - * @param string $subscriberId - * @throws AppwriteException - * @return array - - */ - public function getSubscriber(string $topicId, string $subscriberId): array - { - $apiPath = str_replace(['{topicId}', '{subscriberId}'], [$topicId, $subscriberId], '/messaging/topics/{topicId}/subscribers/{subscriberId}'); - - $apiParams = []; - if (!isset($topicId)) { - throw new AppwriteException('Missing required parameter: "topicId"'); - } - if (!isset($subscriberId)) { - throw new AppwriteException('Missing required parameter: "subscriberId"'); - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Delete subscriber - * - * Delete a subscriber by its unique ID. - * - * @param string $topicId - * @param string $subscriberId - * @throws AppwriteException - * @return string - - */ - public function deleteSubscriber(string $topicId, string $subscriberId): string - { - $apiPath = str_replace(['{topicId}', '{subscriberId}'], [$topicId, $subscriberId], '/messaging/topics/{topicId}/subscribers/{subscriberId}'); - - $apiParams = []; - if (!isset($topicId)) { - throw new AppwriteException('Missing required parameter: "topicId"'); - } - if (!isset($subscriberId)) { - throw new AppwriteException('Missing required parameter: "subscriberId"'); - } - return $this->client->call( - Client::METHOD_DELETE, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } -} diff --git a/src/Appwrite/Services/Storage.php b/src/Appwrite/Services/Storage.php deleted file mode 100644 index 00c90f3..0000000 --- a/src/Appwrite/Services/Storage.php +++ /dev/null @@ -1,672 +0,0 @@ -<?php - -namespace Appwrite\Services; - -use Appwrite\AppwriteException; -use Appwrite\Client; -use Appwrite\Service; -use Appwrite\InputFile; -use Appwrite\Enums\Compression; -use Appwrite\Enums\ImageGravity; -use Appwrite\Enums\ImageFormat; - -class Storage extends Service -{ - public function __construct(Client $client) - { - $this->client = $client; - } - - /** - * List buckets - * - * Get a list of all the storage buckets. You can use the query params to - * filter your results. - * - * @param array $queries - * @param string $search - * @throws AppwriteException - * @return array - - */ - public function listBuckets(array $queries = null, string $search = null): array - { - $apiPath = str_replace([], [], '/storage/buckets'); - - $apiParams = []; - if (!is_null($queries)) { - $apiParams['queries'] = $queries; - } - if (!is_null($search)) { - $apiParams['search'] = $search; - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create bucket - * - * Create a new storage bucket. - * - * @param string $bucketId - * @param string $name - * @param array $permissions - * @param bool $fileSecurity - * @param bool $enabled - * @param int $maximumFileSize - * @param array $allowedFileExtensions - * @param Compression $compression - * @param bool $encryption - * @param bool $antivirus - * @throws AppwriteException - * @return array - - */ - public function createBucket(string $bucketId, string $name, array $permissions = null, bool $fileSecurity = null, bool $enabled = null, int $maximumFileSize = null, array $allowedFileExtensions = null, Compression $compression = null, bool $encryption = null, bool $antivirus = null): array - { - $apiPath = str_replace([], [], '/storage/buckets'); - - $apiParams = []; - if (!isset($bucketId)) { - throw new AppwriteException('Missing required parameter: "bucketId"'); - } - if (!isset($name)) { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (!is_null($bucketId)) { - $apiParams['bucketId'] = $bucketId; - } - if (!is_null($name)) { - $apiParams['name'] = $name; - } - if (!is_null($permissions)) { - $apiParams['permissions'] = $permissions; - } - if (!is_null($fileSecurity)) { - $apiParams['fileSecurity'] = $fileSecurity; - } - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } - if (!is_null($maximumFileSize)) { - $apiParams['maximumFileSize'] = $maximumFileSize; - } - if (!is_null($allowedFileExtensions)) { - $apiParams['allowedFileExtensions'] = $allowedFileExtensions; - } - if (!is_null($compression)) { - $apiParams['compression'] = $compression; - } - if (!is_null($encryption)) { - $apiParams['encryption'] = $encryption; - } - if (!is_null($antivirus)) { - $apiParams['antivirus'] = $antivirus; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get bucket - * - * Get a storage bucket by its unique ID. This endpoint response returns a - * JSON object with the storage bucket metadata. - * - * @param string $bucketId - * @throws AppwriteException - * @return array - - */ - public function getBucket(string $bucketId): array - { - $apiPath = str_replace(['{bucketId}'], [$bucketId], '/storage/buckets/{bucketId}'); - - $apiParams = []; - if (!isset($bucketId)) { - throw new AppwriteException('Missing required parameter: "bucketId"'); - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update bucket - * - * Update a storage bucket by its unique ID. - * - * @param string $bucketId - * @param string $name - * @param array $permissions - * @param bool $fileSecurity - * @param bool $enabled - * @param int $maximumFileSize - * @param array $allowedFileExtensions - * @param Compression $compression - * @param bool $encryption - * @param bool $antivirus - * @throws AppwriteException - * @return array - - */ - public function updateBucket(string $bucketId, string $name, array $permissions = null, bool $fileSecurity = null, bool $enabled = null, int $maximumFileSize = null, array $allowedFileExtensions = null, Compression $compression = null, bool $encryption = null, bool $antivirus = null): array - { - $apiPath = str_replace(['{bucketId}'], [$bucketId], '/storage/buckets/{bucketId}'); - - $apiParams = []; - if (!isset($bucketId)) { - throw new AppwriteException('Missing required parameter: "bucketId"'); - } - if (!isset($name)) { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (!is_null($name)) { - $apiParams['name'] = $name; - } - if (!is_null($permissions)) { - $apiParams['permissions'] = $permissions; - } - if (!is_null($fileSecurity)) { - $apiParams['fileSecurity'] = $fileSecurity; - } - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } - if (!is_null($maximumFileSize)) { - $apiParams['maximumFileSize'] = $maximumFileSize; - } - if (!is_null($allowedFileExtensions)) { - $apiParams['allowedFileExtensions'] = $allowedFileExtensions; - } - if (!is_null($compression)) { - $apiParams['compression'] = $compression; - } - if (!is_null($encryption)) { - $apiParams['encryption'] = $encryption; - } - if (!is_null($antivirus)) { - $apiParams['antivirus'] = $antivirus; - } - return $this->client->call( - Client::METHOD_PUT, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Delete bucket - * - * Delete a storage bucket by its unique ID. - * - * @param string $bucketId - * @throws AppwriteException - * @return string - - */ - public function deleteBucket(string $bucketId): string - { - $apiPath = str_replace(['{bucketId}'], [$bucketId], '/storage/buckets/{bucketId}'); - - $apiParams = []; - if (!isset($bucketId)) { - throw new AppwriteException('Missing required parameter: "bucketId"'); - } - return $this->client->call( - Client::METHOD_DELETE, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * List files - * - * Get a list of all the user files. You can use the query params to filter - * your results. - * - * @param string $bucketId - * @param array $queries - * @param string $search - * @throws AppwriteException - * @return array - - */ - public function listFiles(string $bucketId, array $queries = null, string $search = null): array - { - $apiPath = str_replace(['{bucketId}'], [$bucketId], '/storage/buckets/{bucketId}/files'); - - $apiParams = []; - if (!isset($bucketId)) { - throw new AppwriteException('Missing required parameter: "bucketId"'); - } - if (!is_null($queries)) { - $apiParams['queries'] = $queries; - } - if (!is_null($search)) { - $apiParams['search'] = $search; - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create file - * - * Create a new file. Before using this route, you should create a new bucket - * resource using either a [server - * integration](https://appwrite.io/docs/server/storage#storageCreateBucket) - * API or directly from your Appwrite console. - * - * Larger files should be uploaded using multiple requests with the - * [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) - * header to send a partial request with a maximum supported chunk of `5MB`. - * The `content-range` header values should always be in bytes. - * - * When the first request is sent, the server will return the **File** object, - * and the subsequent part request must include the file's **id** in - * `x-appwrite-id` header to allow the server to know that the partial upload - * is for the existing file and not for a new one. - * - * If you're creating a new file using one of the Appwrite SDKs, all the - * chunking logic will be managed by the SDK internally. - * - * - * @param string $bucketId - * @param string $fileId - * @param InputFile $file - * @param array $permissions - * @throws AppwriteException - * @return array - - */ - public function createFile(string $bucketId, string $fileId, InputFile $file, array $permissions = null, callable $onProgress = null): array - { - $apiPath = str_replace(['{bucketId}'], [$bucketId], '/storage/buckets/{bucketId}/files'); - - $apiParams = []; - if (!isset($bucketId)) { - throw new AppwriteException('Missing required parameter: "bucketId"'); - } - if (!isset($fileId)) { - throw new AppwriteException('Missing required parameter: "fileId"'); - } - if (!isset($file)) { - throw new AppwriteException('Missing required parameter: "file"'); - } - if (!is_null($fileId)) { - $apiParams['fileId'] = $fileId; - } - if (!is_null($file)) { - $apiParams['file'] = $file; - } - if (!is_null($permissions)) { - $apiParams['permissions'] = $permissions; - } - $size = 0; - $mimeType = null; - $postedName = null; - if(empty($file->getPath() ?? null)) { - $size = strlen($file->getData()); - $mimeType = $file->getMimeType(); - $postedName = $file->getFilename(); - if ($size <= Client::CHUNK_SIZE) { - $apiParams['file'] = new \CURLFile('data://' . $mimeType . ';base64,' . base64_encode($file->getData()), $mimeType, $postedName); - return $this->client->call(Client::METHOD_POST, $apiPath, [ - 'content-type' => 'multipart/form-data', - ], $apiParams); - } - } 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'] = new \CURLFile($file->getPath(), $mimeType, $postedName); - return $this->client->call(Client::METHOD_POST, $apiPath, [ - 'content-type' => 'multipart/form-data', - ], $apiParams); - } - } - - $id = ''; - $counter = 0; - - if($fileId != 'unique()') { - try { - $response = $this->client->call(Client::METHOD_GET, $apiPath . '/' . $fileId); - $counter = $response['chunksUploaded'] ?? 0; - } catch(\Exception $e) { - } - } - - $apiHeaders = ['content-type' => 'multipart/form-data']; - $handle = null; - - if(!empty($file->getPath())) { - $handle = @fopen($file->getPath(), "rb"); - } - - $start = $counter * Client::CHUNK_SIZE; - while ($start < $size) { - $chunk = ''; - if(!empty($handle)) { - fseek($handle, $start); - $chunk = @fread($handle, Client::CHUNK_SIZE); - } else { - $chunk = substr($file->getData(), $start, Client::CHUNK_SIZE); - } - $apiParams['file'] = new \CURLFile('data://' . $mimeType . ';base64,' . base64_encode($chunk), $mimeType, $postedName); - $apiHeaders['content-range'] = 'bytes ' . ($counter * Client::CHUNK_SIZE) . '-' . min(((($counter * Client::CHUNK_SIZE) + Client::CHUNK_SIZE) - 1), $size - 1) . '/' . $size; - if(!empty($id)) { - $apiHeaders['x-appwrite-id'] = $id; - } - $response = $this->client->call(Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams); - $counter++; - $start += Client::CHUNK_SIZE; - if(empty($id)) { - $id = $response['$id']; - } - if($onProgress !== null) { - $onProgress([ - '$id' => $response['$id'], - 'progress' => min(((($counter * Client::CHUNK_SIZE) + Client::CHUNK_SIZE)), $size) / $size * 100, - 'sizeUploaded' => min($counter * Client::CHUNK_SIZE), - 'chunksTotal' => $response['chunksTotal'], - 'chunksUploaded' => $response['chunksUploaded'], - ]); - } - } - if(!empty($handle)) { - @fclose($handle); - } - return $response; - - } - - /** - * Get file - * - * Get a file by its unique ID. This endpoint response returns a JSON object - * with the file metadata. - * - * @param string $bucketId - * @param string $fileId - * @throws AppwriteException - * @return array - - */ - public function getFile(string $bucketId, string $fileId): array - { - $apiPath = str_replace(['{bucketId}', '{fileId}'], [$bucketId, $fileId], '/storage/buckets/{bucketId}/files/{fileId}'); - - $apiParams = []; - if (!isset($bucketId)) { - throw new AppwriteException('Missing required parameter: "bucketId"'); - } - if (!isset($fileId)) { - throw new AppwriteException('Missing required parameter: "fileId"'); - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update file - * - * Update a file by its unique ID. Only users with write permissions have - * access to update this resource. - * - * @param string $bucketId - * @param string $fileId - * @param string $name - * @param array $permissions - * @throws AppwriteException - * @return array - - */ - public function updateFile(string $bucketId, string $fileId, string $name = null, array $permissions = null): array - { - $apiPath = str_replace(['{bucketId}', '{fileId}'], [$bucketId, $fileId], '/storage/buckets/{bucketId}/files/{fileId}'); - - $apiParams = []; - if (!isset($bucketId)) { - throw new AppwriteException('Missing required parameter: "bucketId"'); - } - if (!isset($fileId)) { - throw new AppwriteException('Missing required parameter: "fileId"'); - } - if (!is_null($name)) { - $apiParams['name'] = $name; - } - if (!is_null($permissions)) { - $apiParams['permissions'] = $permissions; - } - return $this->client->call( - Client::METHOD_PUT, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Delete File - * - * Delete a file by its unique ID. Only users with write permissions have - * access to delete this resource. - * - * @param string $bucketId - * @param string $fileId - * @throws AppwriteException - * @return string - - */ - public function deleteFile(string $bucketId, string $fileId): string - { - $apiPath = str_replace(['{bucketId}', '{fileId}'], [$bucketId, $fileId], '/storage/buckets/{bucketId}/files/{fileId}'); - - $apiParams = []; - if (!isset($bucketId)) { - throw new AppwriteException('Missing required parameter: "bucketId"'); - } - if (!isset($fileId)) { - throw new AppwriteException('Missing required parameter: "fileId"'); - } - return $this->client->call( - Client::METHOD_DELETE, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get file for download - * - * Get a file content by its unique ID. The endpoint response return with a - * 'Content-Disposition: attachment' header that tells the browser to start - * downloading the file to user downloads directory. - * - * @param string $bucketId - * @param string $fileId - * @throws AppwriteException - * @return string - - */ - public function getFileDownload(string $bucketId, string $fileId): string - { - $apiPath = str_replace(['{bucketId}', '{fileId}'], [$bucketId, $fileId], '/storage/buckets/{bucketId}/files/{fileId}/download'); - - $apiParams = []; - if (!isset($bucketId)) { - throw new AppwriteException('Missing required parameter: "bucketId"'); - } - if (!isset($fileId)) { - throw new AppwriteException('Missing required parameter: "fileId"'); - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get file preview - * - * Get a file preview image. Currently, this method supports preview for image - * files (jpg, png, and gif), other supported formats, like pdf, docs, slides, - * and spreadsheets, will return the file icon image. You can also pass query - * string arguments for cutting and resizing your preview image. Preview is - * supported only for image files smaller than 10MB. - * - * @param string $bucketId - * @param string $fileId - * @param int $width - * @param int $height - * @param ImageGravity $gravity - * @param int $quality - * @param int $borderWidth - * @param string $borderColor - * @param int $borderRadius - * @param float $opacity - * @param int $rotation - * @param string $background - * @param ImageFormat $output - * @throws AppwriteException - * @return string - - */ - public function getFilePreview(string $bucketId, string $fileId, int $width = null, int $height = null, ImageGravity $gravity = null, int $quality = null, int $borderWidth = null, string $borderColor = null, int $borderRadius = null, float $opacity = null, int $rotation = null, string $background = null, ImageFormat $output = null): string - { - $apiPath = str_replace(['{bucketId}', '{fileId}'], [$bucketId, $fileId], '/storage/buckets/{bucketId}/files/{fileId}/preview'); - - $apiParams = []; - if (!isset($bucketId)) { - throw new AppwriteException('Missing required parameter: "bucketId"'); - } - if (!isset($fileId)) { - throw new AppwriteException('Missing required parameter: "fileId"'); - } - if (!is_null($width)) { - $apiParams['width'] = $width; - } - if (!is_null($height)) { - $apiParams['height'] = $height; - } - if (!is_null($gravity)) { - $apiParams['gravity'] = $gravity; - } - if (!is_null($quality)) { - $apiParams['quality'] = $quality; - } - if (!is_null($borderWidth)) { - $apiParams['borderWidth'] = $borderWidth; - } - if (!is_null($borderColor)) { - $apiParams['borderColor'] = $borderColor; - } - if (!is_null($borderRadius)) { - $apiParams['borderRadius'] = $borderRadius; - } - if (!is_null($opacity)) { - $apiParams['opacity'] = $opacity; - } - if (!is_null($rotation)) { - $apiParams['rotation'] = $rotation; - } - if (!is_null($background)) { - $apiParams['background'] = $background; - } - if (!is_null($output)) { - $apiParams['output'] = $output; - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get file for view - * - * Get a file content by its unique ID. This endpoint is similar to the - * download method but returns with no 'Content-Disposition: attachment' - * header. - * - * @param string $bucketId - * @param string $fileId - * @throws AppwriteException - * @return string - - */ - public function getFileView(string $bucketId, string $fileId): string - { - $apiPath = str_replace(['{bucketId}', '{fileId}'], [$bucketId, $fileId], '/storage/buckets/{bucketId}/files/{fileId}/view'); - - $apiParams = []; - if (!isset($bucketId)) { - throw new AppwriteException('Missing required parameter: "bucketId"'); - } - if (!isset($fileId)) { - throw new AppwriteException('Missing required parameter: "fileId"'); - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } -} diff --git a/src/Appwrite/Services/Teams.php b/src/Appwrite/Services/Teams.php deleted file mode 100644 index 8614621..0000000 --- a/src/Appwrite/Services/Teams.php +++ /dev/null @@ -1,525 +0,0 @@ -<?php - -namespace Appwrite\Services; - -use Appwrite\AppwriteException; -use Appwrite\Client; -use Appwrite\Service; -use Appwrite\InputFile; - -class Teams extends Service -{ - public function __construct(Client $client) - { - $this->client = $client; - } - - /** - * List teams - * - * Get a list of all the teams in which the current user is a member. You can - * use the parameters to filter your results. - * - * @param array $queries - * @param string $search - * @throws AppwriteException - * @return array - - */ - public function list(array $queries = null, string $search = null): array - { - $apiPath = str_replace([], [], '/teams'); - - $apiParams = []; - if (!is_null($queries)) { - $apiParams['queries'] = $queries; - } - if (!is_null($search)) { - $apiParams['search'] = $search; - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create team - * - * Create a new team. The user who creates the team will automatically be - * assigned as the owner of the team. Only the users with the owner role can - * invite new members, add new owners and delete or update the team. - * - * @param string $teamId - * @param string $name - * @param array $roles - * @throws AppwriteException - * @return array - - */ - public function create(string $teamId, string $name, array $roles = null): array - { - $apiPath = str_replace([], [], '/teams'); - - $apiParams = []; - if (!isset($teamId)) { - throw new AppwriteException('Missing required parameter: "teamId"'); - } - if (!isset($name)) { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (!is_null($teamId)) { - $apiParams['teamId'] = $teamId; - } - if (!is_null($name)) { - $apiParams['name'] = $name; - } - if (!is_null($roles)) { - $apiParams['roles'] = $roles; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get team - * - * Get a team by its ID. All team members have read access for this resource. - * - * @param string $teamId - * @throws AppwriteException - * @return array - - */ - public function get(string $teamId): array - { - $apiPath = str_replace(['{teamId}'], [$teamId], '/teams/{teamId}'); - - $apiParams = []; - if (!isset($teamId)) { - throw new AppwriteException('Missing required parameter: "teamId"'); - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update name - * - * Update the team's name by its unique ID. - * - * @param string $teamId - * @param string $name - * @throws AppwriteException - * @return array - - */ - public function updateName(string $teamId, string $name): array - { - $apiPath = str_replace(['{teamId}'], [$teamId], '/teams/{teamId}'); - - $apiParams = []; - if (!isset($teamId)) { - throw new AppwriteException('Missing required parameter: "teamId"'); - } - if (!isset($name)) { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (!is_null($name)) { - $apiParams['name'] = $name; - } - return $this->client->call( - Client::METHOD_PUT, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Delete team - * - * Delete a team using its ID. Only team members with the owner role can - * delete the team. - * - * @param string $teamId - * @throws AppwriteException - * @return string - - */ - public function delete(string $teamId): string - { - $apiPath = str_replace(['{teamId}'], [$teamId], '/teams/{teamId}'); - - $apiParams = []; - if (!isset($teamId)) { - throw new AppwriteException('Missing required parameter: "teamId"'); - } - return $this->client->call( - Client::METHOD_DELETE, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * List team memberships - * - * Use this endpoint to list a team's members using the team's ID. All team - * members have read access to this endpoint. - * - * @param string $teamId - * @param array $queries - * @param string $search - * @throws AppwriteException - * @return array - - */ - public function listMemberships(string $teamId, array $queries = null, string $search = null): array - { - $apiPath = str_replace(['{teamId}'], [$teamId], '/teams/{teamId}/memberships'); - - $apiParams = []; - if (!isset($teamId)) { - throw new AppwriteException('Missing required parameter: "teamId"'); - } - if (!is_null($queries)) { - $apiParams['queries'] = $queries; - } - if (!is_null($search)) { - $apiParams['search'] = $search; - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create team membership - * - * Invite a new member to join your team. Provide an ID for existing users, or - * invite unregistered users using an email or phone number. If initiated from - * a Client SDK, Appwrite will send an email or sms with a link to join the - * team to the invited user, and an account will be created for them if one - * doesn't exist. If initiated from a Server SDK, the new member will be added - * automatically to the team. - * - * You only need to provide one of a user ID, email, or phone number. Appwrite - * will prioritize accepting the user ID > email > phone number if you provide - * more than one of these parameters. - * - * Use the `url` parameter to redirect the user from the invitation email to - * your app. After the user is redirected, use the [Update Team Membership - * Status](https://appwrite.io/docs/references/cloud/client-web/teams#updateMembershipStatus) - * endpoint to allow the user to accept the invitation to the team. - * - * Please note that to avoid a [Redirect - * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) - * Appwrite will accept the only redirect URLs under the domains you have - * added as a platform on the Appwrite Console. - * - * - * @param string $teamId - * @param array $roles - * @param string $email - * @param string $userId - * @param string $phone - * @param string $url - * @param string $name - * @throws AppwriteException - * @return array - - */ - public function createMembership(string $teamId, array $roles, string $email = null, string $userId = null, string $phone = null, string $url = null, string $name = null): array - { - $apiPath = str_replace(['{teamId}'], [$teamId], '/teams/{teamId}/memberships'); - - $apiParams = []; - if (!isset($teamId)) { - throw new AppwriteException('Missing required parameter: "teamId"'); - } - if (!isset($roles)) { - throw new AppwriteException('Missing required parameter: "roles"'); - } - if (!is_null($email)) { - $apiParams['email'] = $email; - } - if (!is_null($userId)) { - $apiParams['userId'] = $userId; - } - if (!is_null($phone)) { - $apiParams['phone'] = $phone; - } - if (!is_null($roles)) { - $apiParams['roles'] = $roles; - } - if (!is_null($url)) { - $apiParams['url'] = $url; - } - if (!is_null($name)) { - $apiParams['name'] = $name; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get team membership - * - * Get a team member by the membership unique id. All team members have read - * access for this resource. - * - * @param string $teamId - * @param string $membershipId - * @throws AppwriteException - * @return array - - */ - public function getMembership(string $teamId, string $membershipId): array - { - $apiPath = str_replace(['{teamId}', '{membershipId}'], [$teamId, $membershipId], '/teams/{teamId}/memberships/{membershipId}'); - - $apiParams = []; - if (!isset($teamId)) { - throw new AppwriteException('Missing required parameter: "teamId"'); - } - if (!isset($membershipId)) { - throw new AppwriteException('Missing required parameter: "membershipId"'); - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update membership - * - * Modify the roles of a team member. Only team members with the owner role - * have access to this endpoint. Learn more about [roles and - * permissions](https://appwrite.io/docs/permissions). - * - * - * @param string $teamId - * @param string $membershipId - * @param array $roles - * @throws AppwriteException - * @return array - - */ - public function updateMembership(string $teamId, string $membershipId, array $roles): array - { - $apiPath = str_replace(['{teamId}', '{membershipId}'], [$teamId, $membershipId], '/teams/{teamId}/memberships/{membershipId}'); - - $apiParams = []; - if (!isset($teamId)) { - throw new AppwriteException('Missing required parameter: "teamId"'); - } - if (!isset($membershipId)) { - throw new AppwriteException('Missing required parameter: "membershipId"'); - } - if (!isset($roles)) { - throw new AppwriteException('Missing required parameter: "roles"'); - } - if (!is_null($roles)) { - $apiParams['roles'] = $roles; - } - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Delete team membership - * - * This endpoint allows a user to leave a team or for a team owner to delete - * the membership of any other team member. You can also use this endpoint to - * delete a user membership even if it is not accepted. - * - * @param string $teamId - * @param string $membershipId - * @throws AppwriteException - * @return string - - */ - public function deleteMembership(string $teamId, string $membershipId): string - { - $apiPath = str_replace(['{teamId}', '{membershipId}'], [$teamId, $membershipId], '/teams/{teamId}/memberships/{membershipId}'); - - $apiParams = []; - if (!isset($teamId)) { - throw new AppwriteException('Missing required parameter: "teamId"'); - } - if (!isset($membershipId)) { - throw new AppwriteException('Missing required parameter: "membershipId"'); - } - return $this->client->call( - Client::METHOD_DELETE, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update team membership status - * - * Use this endpoint to allow a user to accept an invitation to join a team - * after being redirected back to your app from the invitation email received - * by the user. - * - * If the request is successful, a session for the user is automatically - * created. - * - * - * @param string $teamId - * @param string $membershipId - * @param string $userId - * @param string $secret - * @throws AppwriteException - * @return array - - */ - public function updateMembershipStatus(string $teamId, string $membershipId, string $userId, string $secret): array - { - $apiPath = str_replace(['{teamId}', '{membershipId}'], [$teamId, $membershipId], '/teams/{teamId}/memberships/{membershipId}/status'); - - $apiParams = []; - if (!isset($teamId)) { - throw new AppwriteException('Missing required parameter: "teamId"'); - } - if (!isset($membershipId)) { - throw new AppwriteException('Missing required parameter: "membershipId"'); - } - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (!isset($secret)) { - throw new AppwriteException('Missing required parameter: "secret"'); - } - if (!is_null($userId)) { - $apiParams['userId'] = $userId; - } - if (!is_null($secret)) { - $apiParams['secret'] = $secret; - } - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get team preferences - * - * Get the team's shared preferences by its unique ID. If a preference doesn't - * need to be shared by all team members, prefer storing them in [user - * preferences](https://appwrite.io/docs/references/cloud/client-web/account#getPrefs). - * - * @param string $teamId - * @throws AppwriteException - * @return array - - */ - public function getPrefs(string $teamId): array - { - $apiPath = str_replace(['{teamId}'], [$teamId], '/teams/{teamId}/prefs'); - - $apiParams = []; - if (!isset($teamId)) { - throw new AppwriteException('Missing required parameter: "teamId"'); - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update preferences - * - * Update the team's preferences by its unique ID. The object you pass is - * stored as is and replaces any previous value. The maximum allowed prefs - * size is 64kB and throws an error if exceeded. - * - * @param string $teamId - * @param array $prefs - * @throws AppwriteException - * @return array - - */ - public function updatePrefs(string $teamId, array $prefs): array - { - $apiPath = str_replace(['{teamId}'], [$teamId], '/teams/{teamId}/prefs'); - - $apiParams = []; - if (!isset($teamId)) { - throw new AppwriteException('Missing required parameter: "teamId"'); - } - if (!isset($prefs)) { - throw new AppwriteException('Missing required parameter: "prefs"'); - } - if (!is_null($prefs)) { - $apiParams['prefs'] = $prefs; - } - return $this->client->call( - Client::METHOD_PUT, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } -} diff --git a/src/Appwrite/Services/Users.php b/src/Appwrite/Services/Users.php deleted file mode 100644 index 0019db5..0000000 --- a/src/Appwrite/Services/Users.php +++ /dev/null @@ -1,1640 +0,0 @@ -<?php - -namespace Appwrite\Services; - -use Appwrite\AppwriteException; -use Appwrite\Client; -use Appwrite\Service; -use Appwrite\InputFile; -use Appwrite\Enums\PasswordHash; -use Appwrite\Enums\AuthenticatorType; -use Appwrite\Enums\MessagingProviderType; - -class Users extends Service -{ - public function __construct(Client $client) - { - $this->client = $client; - } - - /** - * List users - * - * Get a list of all the project's users. You can use the query params to - * filter your results. - * - * @param array $queries - * @param string $search - * @throws AppwriteException - * @return array - - */ - public function list(array $queries = null, string $search = null): array - { - $apiPath = str_replace([], [], '/users'); - - $apiParams = []; - if (!is_null($queries)) { - $apiParams['queries'] = $queries; - } - if (!is_null($search)) { - $apiParams['search'] = $search; - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create user - * - * Create a new user. - * - * @param string $userId - * @param string $email - * @param string $phone - * @param string $password - * @param string $name - * @throws AppwriteException - * @return array - - */ - public function create(string $userId, string $email = null, string $phone = null, string $password = null, string $name = null): array - { - $apiPath = str_replace([], [], '/users'); - - $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (!is_null($userId)) { - $apiParams['userId'] = $userId; - } - if (!is_null($email)) { - $apiParams['email'] = $email; - } - if (!is_null($phone)) { - $apiParams['phone'] = $phone; - } - if (!is_null($password)) { - $apiParams['password'] = $password; - } - if (!is_null($name)) { - $apiParams['name'] = $name; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create user with Argon2 password - * - * Create a new user. Password provided must be hashed with the - * [Argon2](https://en.wikipedia.org/wiki/Argon2) algorithm. Use the [POST - * /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to - * create users with a plain text password. - * - * @param string $userId - * @param string $email - * @param string $password - * @param string $name - * @throws AppwriteException - * @return array - - */ - public function createArgon2User(string $userId, string $email, string $password, string $name = null): array - { - $apiPath = str_replace([], [], '/users/argon2'); - - $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (!isset($email)) { - throw new AppwriteException('Missing required parameter: "email"'); - } - if (!isset($password)) { - throw new AppwriteException('Missing required parameter: "password"'); - } - if (!is_null($userId)) { - $apiParams['userId'] = $userId; - } - if (!is_null($email)) { - $apiParams['email'] = $email; - } - if (!is_null($password)) { - $apiParams['password'] = $password; - } - if (!is_null($name)) { - $apiParams['name'] = $name; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create user with bcrypt password - * - * Create a new user. Password provided must be hashed with the - * [Bcrypt](https://en.wikipedia.org/wiki/Bcrypt) algorithm. Use the [POST - * /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to - * create users with a plain text password. - * - * @param string $userId - * @param string $email - * @param string $password - * @param string $name - * @throws AppwriteException - * @return array - - */ - public function createBcryptUser(string $userId, string $email, string $password, string $name = null): array - { - $apiPath = str_replace([], [], '/users/bcrypt'); - - $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (!isset($email)) { - throw new AppwriteException('Missing required parameter: "email"'); - } - if (!isset($password)) { - throw new AppwriteException('Missing required parameter: "password"'); - } - if (!is_null($userId)) { - $apiParams['userId'] = $userId; - } - if (!is_null($email)) { - $apiParams['email'] = $email; - } - if (!is_null($password)) { - $apiParams['password'] = $password; - } - if (!is_null($name)) { - $apiParams['name'] = $name; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * List Identities - * - * Get identities for all users. - * - * @param array $queries - * @param string $search - * @throws AppwriteException - * @return array - - */ - public function listIdentities(array $queries = null, string $search = null): array - { - $apiPath = str_replace([], [], '/users/identities'); - - $apiParams = []; - if (!is_null($queries)) { - $apiParams['queries'] = $queries; - } - if (!is_null($search)) { - $apiParams['search'] = $search; - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Delete identity - * - * Delete an identity by its unique ID. - * - * @param string $identityId - * @throws AppwriteException - * @return string - - */ - public function deleteIdentity(string $identityId): string - { - $apiPath = str_replace(['{identityId}'], [$identityId], '/users/identities/{identityId}'); - - $apiParams = []; - if (!isset($identityId)) { - throw new AppwriteException('Missing required parameter: "identityId"'); - } - return $this->client->call( - Client::METHOD_DELETE, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create user with MD5 password - * - * Create a new user. Password provided must be hashed with the - * [MD5](https://en.wikipedia.org/wiki/MD5) algorithm. Use the [POST - * /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to - * create users with a plain text password. - * - * @param string $userId - * @param string $email - * @param string $password - * @param string $name - * @throws AppwriteException - * @return array - - */ - public function createMD5User(string $userId, string $email, string $password, string $name = null): array - { - $apiPath = str_replace([], [], '/users/md5'); - - $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (!isset($email)) { - throw new AppwriteException('Missing required parameter: "email"'); - } - if (!isset($password)) { - throw new AppwriteException('Missing required parameter: "password"'); - } - if (!is_null($userId)) { - $apiParams['userId'] = $userId; - } - if (!is_null($email)) { - $apiParams['email'] = $email; - } - if (!is_null($password)) { - $apiParams['password'] = $password; - } - if (!is_null($name)) { - $apiParams['name'] = $name; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create user with PHPass password - * - * Create a new user. Password provided must be hashed with the - * [PHPass](https://www.openwall.com/phpass/) algorithm. Use the [POST - * /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to - * create users with a plain text password. - * - * @param string $userId - * @param string $email - * @param string $password - * @param string $name - * @throws AppwriteException - * @return array - - */ - public function createPHPassUser(string $userId, string $email, string $password, string $name = null): array - { - $apiPath = str_replace([], [], '/users/phpass'); - - $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (!isset($email)) { - throw new AppwriteException('Missing required parameter: "email"'); - } - if (!isset($password)) { - throw new AppwriteException('Missing required parameter: "password"'); - } - if (!is_null($userId)) { - $apiParams['userId'] = $userId; - } - if (!is_null($email)) { - $apiParams['email'] = $email; - } - if (!is_null($password)) { - $apiParams['password'] = $password; - } - if (!is_null($name)) { - $apiParams['name'] = $name; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create user with Scrypt password - * - * Create a new user. Password provided must be hashed with the - * [Scrypt](https://github.com/Tarsnap/scrypt) algorithm. Use the [POST - * /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to - * create users with a plain text password. - * - * @param string $userId - * @param string $email - * @param string $password - * @param string $passwordSalt - * @param int $passwordCpu - * @param int $passwordMemory - * @param int $passwordParallel - * @param int $passwordLength - * @param string $name - * @throws AppwriteException - * @return array - - */ - public function createScryptUser(string $userId, string $email, string $password, string $passwordSalt, int $passwordCpu, int $passwordMemory, int $passwordParallel, int $passwordLength, string $name = null): array - { - $apiPath = str_replace([], [], '/users/scrypt'); - - $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (!isset($email)) { - throw new AppwriteException('Missing required parameter: "email"'); - } - if (!isset($password)) { - throw new AppwriteException('Missing required parameter: "password"'); - } - if (!isset($passwordSalt)) { - throw new AppwriteException('Missing required parameter: "passwordSalt"'); - } - if (!isset($passwordCpu)) { - throw new AppwriteException('Missing required parameter: "passwordCpu"'); - } - if (!isset($passwordMemory)) { - throw new AppwriteException('Missing required parameter: "passwordMemory"'); - } - if (!isset($passwordParallel)) { - throw new AppwriteException('Missing required parameter: "passwordParallel"'); - } - if (!isset($passwordLength)) { - throw new AppwriteException('Missing required parameter: "passwordLength"'); - } - if (!is_null($userId)) { - $apiParams['userId'] = $userId; - } - if (!is_null($email)) { - $apiParams['email'] = $email; - } - if (!is_null($password)) { - $apiParams['password'] = $password; - } - if (!is_null($passwordSalt)) { - $apiParams['passwordSalt'] = $passwordSalt; - } - if (!is_null($passwordCpu)) { - $apiParams['passwordCpu'] = $passwordCpu; - } - if (!is_null($passwordMemory)) { - $apiParams['passwordMemory'] = $passwordMemory; - } - if (!is_null($passwordParallel)) { - $apiParams['passwordParallel'] = $passwordParallel; - } - if (!is_null($passwordLength)) { - $apiParams['passwordLength'] = $passwordLength; - } - if (!is_null($name)) { - $apiParams['name'] = $name; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create user with Scrypt modified password - * - * Create a new user. Password provided must be hashed with the [Scrypt - * Modified](https://gist.github.com/Meldiron/eecf84a0225eccb5a378d45bb27462cc) - * algorithm. Use the [POST - * /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to - * create users with a plain text password. - * - * @param string $userId - * @param string $email - * @param string $password - * @param string $passwordSalt - * @param string $passwordSaltSeparator - * @param string $passwordSignerKey - * @param string $name - * @throws AppwriteException - * @return array - - */ - public function createScryptModifiedUser(string $userId, string $email, string $password, string $passwordSalt, string $passwordSaltSeparator, string $passwordSignerKey, string $name = null): array - { - $apiPath = str_replace([], [], '/users/scrypt-modified'); - - $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (!isset($email)) { - throw new AppwriteException('Missing required parameter: "email"'); - } - if (!isset($password)) { - throw new AppwriteException('Missing required parameter: "password"'); - } - if (!isset($passwordSalt)) { - throw new AppwriteException('Missing required parameter: "passwordSalt"'); - } - if (!isset($passwordSaltSeparator)) { - throw new AppwriteException('Missing required parameter: "passwordSaltSeparator"'); - } - if (!isset($passwordSignerKey)) { - throw new AppwriteException('Missing required parameter: "passwordSignerKey"'); - } - if (!is_null($userId)) { - $apiParams['userId'] = $userId; - } - if (!is_null($email)) { - $apiParams['email'] = $email; - } - if (!is_null($password)) { - $apiParams['password'] = $password; - } - if (!is_null($passwordSalt)) { - $apiParams['passwordSalt'] = $passwordSalt; - } - if (!is_null($passwordSaltSeparator)) { - $apiParams['passwordSaltSeparator'] = $passwordSaltSeparator; - } - if (!is_null($passwordSignerKey)) { - $apiParams['passwordSignerKey'] = $passwordSignerKey; - } - if (!is_null($name)) { - $apiParams['name'] = $name; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create user with SHA password - * - * Create a new user. Password provided must be hashed with the - * [SHA](https://en.wikipedia.org/wiki/Secure_Hash_Algorithm) algorithm. Use - * the [POST /users](https://appwrite.io/docs/server/users#usersCreate) - * endpoint to create users with a plain text password. - * - * @param string $userId - * @param string $email - * @param string $password - * @param PasswordHash $passwordVersion - * @param string $name - * @throws AppwriteException - * @return array - - */ - public function createSHAUser(string $userId, string $email, string $password, PasswordHash $passwordVersion = null, string $name = null): array - { - $apiPath = str_replace([], [], '/users/sha'); - - $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (!isset($email)) { - throw new AppwriteException('Missing required parameter: "email"'); - } - if (!isset($password)) { - throw new AppwriteException('Missing required parameter: "password"'); - } - if (!is_null($userId)) { - $apiParams['userId'] = $userId; - } - if (!is_null($email)) { - $apiParams['email'] = $email; - } - if (!is_null($password)) { - $apiParams['password'] = $password; - } - if (!is_null($passwordVersion)) { - $apiParams['passwordVersion'] = $passwordVersion; - } - if (!is_null($name)) { - $apiParams['name'] = $name; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get user - * - * Get a user by its unique ID. - * - * @param string $userId - * @throws AppwriteException - * @return array - - */ - public function get(string $userId): array - { - $apiPath = str_replace(['{userId}'], [$userId], '/users/{userId}'); - - $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Delete user - * - * Delete a user by its unique ID, thereby releasing it's ID. Since ID is - * released and can be reused, all user-related resources like documents or - * storage files should be deleted before user deletion. If you want to keep - * ID reserved, use the - * [updateStatus](https://appwrite.io/docs/server/users#usersUpdateStatus) - * endpoint instead. - * - * @param string $userId - * @throws AppwriteException - * @return string - - */ - public function delete(string $userId): string - { - $apiPath = str_replace(['{userId}'], [$userId], '/users/{userId}'); - - $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } - return $this->client->call( - Client::METHOD_DELETE, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update email - * - * Update the user email by its unique ID. - * - * @param string $userId - * @param string $email - * @throws AppwriteException - * @return array - - */ - public function updateEmail(string $userId, string $email): array - { - $apiPath = str_replace(['{userId}'], [$userId], '/users/{userId}/email'); - - $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (!isset($email)) { - throw new AppwriteException('Missing required parameter: "email"'); - } - if (!is_null($email)) { - $apiParams['email'] = $email; - } - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create user JWT - * - * Use this endpoint to create a JSON Web Token for user by its unique ID. You - * can use the resulting JWT to authenticate on behalf of the user. The JWT - * secret will become invalid if the session it uses gets deleted. - * - * @param string $userId - * @param string $sessionId - * @param int $duration - * @throws AppwriteException - * @return array - - */ - public function createJWT(string $userId, string $sessionId = null, int $duration = null): array - { - $apiPath = str_replace(['{userId}'], [$userId], '/users/{userId}/jwts'); - - $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (!is_null($sessionId)) { - $apiParams['sessionId'] = $sessionId; - } - if (!is_null($duration)) { - $apiParams['duration'] = $duration; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update user labels - * - * Update the user labels by its unique ID. - * - * Labels can be used to grant access to resources. While teams are a way for - * user's to share access to a resource, labels can be defined by the - * developer to grant access without an invitation. See the [Permissions - * docs](https://appwrite.io/docs/permissions) for more info. - * - * @param string $userId - * @param array $labels - * @throws AppwriteException - * @return array - - */ - public function updateLabels(string $userId, array $labels): array - { - $apiPath = str_replace(['{userId}'], [$userId], '/users/{userId}/labels'); - - $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (!isset($labels)) { - throw new AppwriteException('Missing required parameter: "labels"'); - } - if (!is_null($labels)) { - $apiParams['labels'] = $labels; - } - return $this->client->call( - Client::METHOD_PUT, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * List user logs - * - * Get the user activity logs list by its unique ID. - * - * @param string $userId - * @param array $queries - * @throws AppwriteException - * @return array - - */ - public function listLogs(string $userId, array $queries = null): array - { - $apiPath = str_replace(['{userId}'], [$userId], '/users/{userId}/logs'); - - $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (!is_null($queries)) { - $apiParams['queries'] = $queries; - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * List user memberships - * - * Get the user membership list by its unique ID. - * - * @param string $userId - * @throws AppwriteException - * @return array - - */ - public function listMemberships(string $userId): array - { - $apiPath = str_replace(['{userId}'], [$userId], '/users/{userId}/memberships'); - - $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update MFA - * - * Enable or disable MFA on a user account. - * - * @param string $userId - * @param bool $mfa - * @throws AppwriteException - * @return array - - */ - public function updateMfa(string $userId, bool $mfa): array - { - $apiPath = str_replace(['{userId}'], [$userId], '/users/{userId}/mfa'); - - $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (!isset($mfa)) { - throw new AppwriteException('Missing required parameter: "mfa"'); - } - if (!is_null($mfa)) { - $apiParams['mfa'] = $mfa; - } - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Delete Authenticator - * - * Delete an authenticator app. - * - * @param string $userId - * @param AuthenticatorType $type - * @throws AppwriteException - * @return array - - */ - public function deleteMfaAuthenticator(string $userId, AuthenticatorType $type): array - { - $apiPath = str_replace(['{userId}', '{type}'], [$userId, $type], '/users/{userId}/mfa/authenticators/{type}'); - - $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (!isset($type)) { - throw new AppwriteException('Missing required parameter: "type"'); - } - return $this->client->call( - Client::METHOD_DELETE, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * List Factors - * - * List the factors available on the account to be used as a MFA challange. - * - * @param string $userId - * @throws AppwriteException - * @return array - - */ - public function listMfaFactors(string $userId): array - { - $apiPath = str_replace(['{userId}'], [$userId], '/users/{userId}/mfa/factors'); - - $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get MFA Recovery Codes - * - * Get recovery codes that can be used as backup for MFA flow by User ID. - * Before getting codes, they must be generated using - * [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) - * method. - * - * @param string $userId - * @throws AppwriteException - * @return array - - */ - public function getMfaRecoveryCodes(string $userId): array - { - $apiPath = str_replace(['{userId}'], [$userId], '/users/{userId}/mfa/recovery-codes'); - - $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Regenerate MFA Recovery Codes - * - * Regenerate recovery codes that can be used as backup for MFA flow by User - * ID. Before regenerating codes, they must be first generated using - * [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) - * method. - * - * @param string $userId - * @throws AppwriteException - * @return array - - */ - public function updateMfaRecoveryCodes(string $userId): array - { - $apiPath = str_replace(['{userId}'], [$userId], '/users/{userId}/mfa/recovery-codes'); - - $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } - return $this->client->call( - Client::METHOD_PUT, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create MFA Recovery Codes - * - * Generate recovery codes used as backup for MFA flow for User ID. Recovery - * codes can be used as a MFA verification type in - * [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) - * method by client SDK. - * - * @param string $userId - * @throws AppwriteException - * @return array - - */ - public function createMfaRecoveryCodes(string $userId): array - { - $apiPath = str_replace(['{userId}'], [$userId], '/users/{userId}/mfa/recovery-codes'); - - $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update name - * - * Update the user name by its unique ID. - * - * @param string $userId - * @param string $name - * @throws AppwriteException - * @return array - - */ - public function updateName(string $userId, string $name): array - { - $apiPath = str_replace(['{userId}'], [$userId], '/users/{userId}/name'); - - $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (!isset($name)) { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (!is_null($name)) { - $apiParams['name'] = $name; - } - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update password - * - * Update the user password by its unique ID. - * - * @param string $userId - * @param string $password - * @throws AppwriteException - * @return array - - */ - public function updatePassword(string $userId, string $password): array - { - $apiPath = str_replace(['{userId}'], [$userId], '/users/{userId}/password'); - - $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (!isset($password)) { - throw new AppwriteException('Missing required parameter: "password"'); - } - if (!is_null($password)) { - $apiParams['password'] = $password; - } - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update phone - * - * Update the user phone by its unique ID. - * - * @param string $userId - * @param string $number - * @throws AppwriteException - * @return array - - */ - public function updatePhone(string $userId, string $number): array - { - $apiPath = str_replace(['{userId}'], [$userId], '/users/{userId}/phone'); - - $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (!isset($number)) { - throw new AppwriteException('Missing required parameter: "number"'); - } - if (!is_null($number)) { - $apiParams['number'] = $number; - } - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get user preferences - * - * Get the user preferences by its unique ID. - * - * @param string $userId - * @throws AppwriteException - * @return array - - */ - public function getPrefs(string $userId): array - { - $apiPath = str_replace(['{userId}'], [$userId], '/users/{userId}/prefs'); - - $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update user preferences - * - * Update the user preferences by its unique ID. The object you pass is stored - * as is, and replaces any previous value. The maximum allowed prefs size is - * 64kB and throws error if exceeded. - * - * @param string $userId - * @param array $prefs - * @throws AppwriteException - * @return array - - */ - public function updatePrefs(string $userId, array $prefs): array - { - $apiPath = str_replace(['{userId}'], [$userId], '/users/{userId}/prefs'); - - $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (!isset($prefs)) { - throw new AppwriteException('Missing required parameter: "prefs"'); - } - if (!is_null($prefs)) { - $apiParams['prefs'] = $prefs; - } - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * List user sessions - * - * Get the user sessions list by its unique ID. - * - * @param string $userId - * @throws AppwriteException - * @return array - - */ - public function listSessions(string $userId): array - { - $apiPath = str_replace(['{userId}'], [$userId], '/users/{userId}/sessions'); - - $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create session - * - * Creates a session for a user. Returns an immediately usable session object. - * - * If you want to generate a token for a custom authentication flow, use the - * [POST - * /users/{userId}/tokens](https://appwrite.io/docs/server/users#createToken) - * endpoint. - * - * @param string $userId - * @throws AppwriteException - * @return array - - */ - public function createSession(string $userId): array - { - $apiPath = str_replace(['{userId}'], [$userId], '/users/{userId}/sessions'); - - $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Delete user sessions - * - * Delete all user's sessions by using the user's unique ID. - * - * @param string $userId - * @throws AppwriteException - * @return string - - */ - public function deleteSessions(string $userId): string - { - $apiPath = str_replace(['{userId}'], [$userId], '/users/{userId}/sessions'); - - $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } - return $this->client->call( - Client::METHOD_DELETE, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Delete user session - * - * Delete a user sessions by its unique ID. - * - * @param string $userId - * @param string $sessionId - * @throws AppwriteException - * @return string - - */ - public function deleteSession(string $userId, string $sessionId): string - { - $apiPath = str_replace(['{userId}', '{sessionId}'], [$userId, $sessionId], '/users/{userId}/sessions/{sessionId}'); - - $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (!isset($sessionId)) { - throw new AppwriteException('Missing required parameter: "sessionId"'); - } - return $this->client->call( - Client::METHOD_DELETE, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update user status - * - * Update the user status by its unique ID. Use this endpoint as an - * alternative to deleting a user if you want to keep user's ID reserved. - * - * @param string $userId - * @param bool $status - * @throws AppwriteException - * @return array - - */ - public function updateStatus(string $userId, bool $status): array - { - $apiPath = str_replace(['{userId}'], [$userId], '/users/{userId}/status'); - - $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (!isset($status)) { - throw new AppwriteException('Missing required parameter: "status"'); - } - if (!is_null($status)) { - $apiParams['status'] = $status; - } - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * List User Targets - * - * List the messaging targets that are associated with a user. - * - * @param string $userId - * @param array $queries - * @throws AppwriteException - * @return array - - */ - public function listTargets(string $userId, array $queries = null): array - { - $apiPath = str_replace(['{userId}'], [$userId], '/users/{userId}/targets'); - - $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (!is_null($queries)) { - $apiParams['queries'] = $queries; - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create User Target - * - * Create a messaging target. - * - * @param string $userId - * @param string $targetId - * @param MessagingProviderType $providerType - * @param string $identifier - * @param string $providerId - * @param string $name - * @throws AppwriteException - * @return array - - */ - public function createTarget(string $userId, string $targetId, MessagingProviderType $providerType, string $identifier, string $providerId = null, string $name = null): array - { - $apiPath = str_replace(['{userId}'], [$userId], '/users/{userId}/targets'); - - $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (!isset($targetId)) { - throw new AppwriteException('Missing required parameter: "targetId"'); - } - if (!isset($providerType)) { - throw new AppwriteException('Missing required parameter: "providerType"'); - } - if (!isset($identifier)) { - throw new AppwriteException('Missing required parameter: "identifier"'); - } - if (!is_null($targetId)) { - $apiParams['targetId'] = $targetId; - } - if (!is_null($providerType)) { - $apiParams['providerType'] = $providerType; - } - if (!is_null($identifier)) { - $apiParams['identifier'] = $identifier; - } - if (!is_null($providerId)) { - $apiParams['providerId'] = $providerId; - } - if (!is_null($name)) { - $apiParams['name'] = $name; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Get User Target - * - * Get a user's push notification target by ID. - * - * @param string $userId - * @param string $targetId - * @throws AppwriteException - * @return array - - */ - public function getTarget(string $userId, string $targetId): array - { - $apiPath = str_replace(['{userId}', '{targetId}'], [$userId, $targetId], '/users/{userId}/targets/{targetId}'); - - $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (!isset($targetId)) { - throw new AppwriteException('Missing required parameter: "targetId"'); - } - return $this->client->call( - Client::METHOD_GET, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update User target - * - * Update a messaging target. - * - * @param string $userId - * @param string $targetId - * @param string $identifier - * @param string $providerId - * @param string $name - * @throws AppwriteException - * @return array - - */ - public function updateTarget(string $userId, string $targetId, string $identifier = null, string $providerId = null, string $name = null): array - { - $apiPath = str_replace(['{userId}', '{targetId}'], [$userId, $targetId], '/users/{userId}/targets/{targetId}'); - - $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (!isset($targetId)) { - throw new AppwriteException('Missing required parameter: "targetId"'); - } - if (!is_null($identifier)) { - $apiParams['identifier'] = $identifier; - } - if (!is_null($providerId)) { - $apiParams['providerId'] = $providerId; - } - if (!is_null($name)) { - $apiParams['name'] = $name; - } - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Delete user target - * - * Delete a messaging target. - * - * @param string $userId - * @param string $targetId - * @throws AppwriteException - * @return string - - */ - public function deleteTarget(string $userId, string $targetId): string - { - $apiPath = str_replace(['{userId}', '{targetId}'], [$userId, $targetId], '/users/{userId}/targets/{targetId}'); - - $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (!isset($targetId)) { - throw new AppwriteException('Missing required parameter: "targetId"'); - } - return $this->client->call( - Client::METHOD_DELETE, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Create token - * - * Returns a token with a secret key for creating a session. Use the user ID - * and secret and submit a request to the [PUT - * /account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) - * endpoint to complete the login process. - * - * - * @param string $userId - * @param int $length - * @param int $expire - * @throws AppwriteException - * @return array - - */ - public function createToken(string $userId, int $length = null, int $expire = null): array - { - $apiPath = str_replace(['{userId}'], [$userId], '/users/{userId}/tokens'); - - $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (!is_null($length)) { - $apiParams['length'] = $length; - } - if (!is_null($expire)) { - $apiParams['expire'] = $expire; - } - return $this->client->call( - Client::METHOD_POST, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update email verification - * - * Update the user email verification status by its unique ID. - * - * @param string $userId - * @param bool $emailVerification - * @throws AppwriteException - * @return array - - */ - public function updateEmailVerification(string $userId, bool $emailVerification): array - { - $apiPath = str_replace(['{userId}'], [$userId], '/users/{userId}/verification'); - - $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (!isset($emailVerification)) { - throw new AppwriteException('Missing required parameter: "emailVerification"'); - } - if (!is_null($emailVerification)) { - $apiParams['emailVerification'] = $emailVerification; - } - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } - - /** - * Update phone verification - * - * Update the user phone verification status by its unique ID. - * - * @param string $userId - * @param bool $phoneVerification - * @throws AppwriteException - * @return array - - */ - public function updatePhoneVerification(string $userId, bool $phoneVerification): array - { - $apiPath = str_replace(['{userId}'], [$userId], '/users/{userId}/verification/phone'); - - $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (!isset($phoneVerification)) { - throw new AppwriteException('Missing required parameter: "phoneVerification"'); - } - if (!is_null($phoneVerification)) { - $apiParams['phoneVerification'] = $phoneVerification; - } - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - [ - 'content-type' => 'application/json', - ], - $apiParams - ); - } -} diff --git a/tests/Appwrite/IDTest.php b/tests/Appwrite/IDTest.php deleted file mode 100644 index 4914377..0000000 --- a/tests/Appwrite/IDTest.php +++ /dev/null @@ -1,15 +0,0 @@ -<?php - -namespace Appwrite; - -use PHPUnit\Framework\TestCase; - -final class IDTest extends TestCase { - public function testUnique(): void { - $this->assertSame('unique()', ID::unique()); - } - - public function testCustom(): void { - $this->assertSame('custom', ID::custom('custom')); - } -} diff --git a/tests/Appwrite/PermissionTest.php b/tests/Appwrite/PermissionTest.php deleted file mode 100644 index b17958d..0000000 --- a/tests/Appwrite/PermissionTest.php +++ /dev/null @@ -1,27 +0,0 @@ -<?php - -namespace Appwrite; - -use PHPUnit\Framework\TestCase; - -final class PermissionTest extends TestCase { - public function testRead(): void { - $this->assertSame('read("any")', Permission::read(Role::any())); - } - - public function testWrite(): void { - $this->assertSame('write("any")', Permission::write(Role::any())); - } - - public function testCreate(): void { - $this->assertSame('create("any")', Permission::create(Role::any())); - } - - public function testUpdate(): void { - $this->assertSame('update("any")', Permission::update(Role::any())); - } - - public function testDelete(): void { - $this->assertSame('delete("any")', Permission::delete(Role::any())); - } -} diff --git a/tests/Appwrite/QueryTest.php b/tests/Appwrite/QueryTest.php deleted file mode 100644 index bd54d13..0000000 --- a/tests/Appwrite/QueryTest.php +++ /dev/null @@ -1,149 +0,0 @@ -<?php - -namespace Appwrite; - -use PHPUnit\Framework\TestCase; - -final class BasicFilterQueryTest { - public $description; - public $value; - public $expectedValues; - - public function __construct(string $description, mixed $value, string $expectedValues) { - $this->description = $description; - $this->value = $value; - $this->expectedValues = $expectedValues; - } -} - -final class QueryTest extends TestCase { - /** - * @var BasicFilterQueryTest[] $tests - */ - private $tests; - - function __construct(string $name) - { - parent::__construct($name); - $this->tests = array( - new BasicFilterQueryTest('with a string', 's', '["s"]'), - new BasicFilterQueryTest('with a integer', 1, '[1]'), - new BasicFilterQueryTest('with a double', 1.2, '[1.2]'), - new BasicFilterQueryTest('with a whole number double', 1.0, '[1]'), - new BasicFilterQueryTest('with a bool', false, '[false]'), - new BasicFilterQueryTest('with a list', ['a', 'b', 'c'], '["a","b","c"]'), - ); - } - - public function testBasicFilterEqual(): void { - foreach($this->tests as $test) { - $this->assertSame( - "equal(\"attr\", $test->expectedValues)", - Query::equal('attr', $test->value), - $test->description, - ); - } - } - - public function testBasicFilterNotEqual(): void { - foreach($this->tests as $test) { - $this->assertSame( - "notEqual(\"attr\", $test->expectedValues)", - Query::notEqual('attr', $test->value), - $test->description, - ); - } - } - - public function testBasicFilterLessThan(): void { - foreach($this->tests as $test) { - $this->assertSame( - "lessThan(\"attr\", $test->expectedValues)", - Query::lessThan('attr', $test->value), - $test->description, - ); - } - } - - public function testBasicFilterLessThanEqual(): void { - foreach($this->tests as $test) { - $this->assertSame( - "lessThanEqual(\"attr\", $test->expectedValues)", - Query::lessThanEqual('attr', $test->value), - $test->description, - ); - } - } - - public function testBasicFilterGreaterThan(): void { - foreach($this->tests as $test) { - $this->assertSame( - "greaterThan(\"attr\", $test->expectedValues)", - Query::greaterThan('attr', $test->value), - $test->description, - ); - } - } - - public function testBasicFilterGreaterThanEqual(): void { - foreach($this->tests as $test) { - $this->assertSame( - "greaterThanEqual(\"attr\", $test->expectedValues)", - Query::greaterThanEqual('attr', $test->value), - $test->description, - ); - } - } - - public function testSearch(): void { - $this->assertSame('search("attr", ["keyword1 keyword2"])', Query::search('attr', 'keyword1 keyword2')); - } - - public function testIsNull(): void { - $this->assertSame('isNull("attr")', Query::isNull('attr')); - } - - public function testIsNotNull(): void { - $this->assertSame('isNotNull("attr")', Query::isNotNull('attr')); - } - - public function testBetweenWithIntegers(): void { - $this->assertSame('between("attr", 1, 2)', Query::between('attr', 1, 2)); - } - - public function testBetweenWithDoubles(): void { - $this->assertSame('between("attr", 1, 2)', Query::between('attr', 1.0, 2.0)); - } - - public function testBetweenWithStrings(): void { - $this->assertSame('between("attr", "a", "z")', Query::between('attr', 'a', 'z')); - } - - public function testSelect(): void { - $this->assertSame('select(["attr1","attr2"])', Query::select(['attr1', 'attr2'])); - } - - public function testOrderAsc(): void { - $this->assertSame('orderAsc("attr")', Query::orderAsc('attr')); - } - - public function testOrderDesc(): void { - $this->assertSame('orderDesc("attr")', Query::orderDesc('attr')); - } - - public function testCursorBefore(): void { - $this->assertSame('cursorBefore("attr")', Query::cursorBefore('attr')); - } - - public function testCursorAfter(): void { - $this->assertSame('cursorAfter("attr")', Query::cursorAfter('attr')); - } - - public function testLimit(): void { - $this->assertSame('limit(1)', Query::limit(1)); - } - - public function testOffset(): void { - $this->assertSame('offset(1)', Query::offset(1)); - } -} diff --git a/tests/Appwrite/RoleTest.php b/tests/Appwrite/RoleTest.php deleted file mode 100644 index f6e0be1..0000000 --- a/tests/Appwrite/RoleTest.php +++ /dev/null @@ -1,47 +0,0 @@ -<?php - -namespace Appwrite; - -use PHPUnit\Framework\TestCase; - -final class RoleTest extends TestCase { - public function testAny(): void { - $this->assertSame('any', Role::any()); - } - - public function testUserWithoutStatus(): void { - $this->assertSame('user:custom', Role::user('custom')); - } - - public function testUserWithStatus(): void { - $this->assertSame('user:custom/verified', Role::user('custom', 'verified')); - } - - public function testUsersWithoutStatus(): void { - $this->assertSame('users', Role::users()); - } - - public function testUsersWithStatus(): void { - $this->assertSame('users/verified', Role::users('verified')); - } - - public function testGuests(): void { - $this->assertSame('guests', Role::guests()); - } - - public function testTeamWithoutRole(): void { - $this->assertSame('team:custom', Role::team('custom')); - } - - public function testTeamWithRole(): void { - $this->assertSame('team:custom/owner', Role::team('custom', 'owner')); - } - - public function testMember(): void { - $this->assertSame('member:custom', Role::member('custom')); - } - - public function testLabel(): void { - $this->assertSame('label:admin', Role::label('admin')); - } -} diff --git a/tests/Appwrite/Services/AccountTest.php b/tests/Appwrite/Services/AccountTest.php deleted file mode 100644 index d974efd..0000000 --- a/tests/Appwrite/Services/AccountTest.php +++ /dev/null @@ -1,1149 +0,0 @@ -<?php - -namespace Appwrite\Services; - -use Appwrite\Client; -use Appwrite\InputFile; -use Mockery; -use PHPUnit\Framework\TestCase; - -final class AccountTest extends TestCase { - private $client; - private $account; - - protected function setUp(): void { - $this->client = Mockery::mock(Client::class); - $this->account = new Account($this->client); - } - - public function testMethodGet(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "John Doe", - "registration" => "2020-10-15T06:38:00.000+00:00", - "status" => true, - "labels" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->account->get( - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreate(): void { - - $data = array( - "\$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" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->account->create( - "<USER_ID>", - "email@example.com", - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateEmail(): void { - - $data = array( - "\$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" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->account->updateEmail( - "email@example.com", - "password" - ); - - $this->assertSame($data, $response); - } - - public function testMethodListIdentities(): void { - - $data = array( - "total" => 5, - "identities" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->account->listIdentities( - ); - - $this->assertSame($data, $response); - } - - public function testMethodDeleteIdentity(): void { - - $data = ''; - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->account->deleteIdentity( - "<IDENTITY_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateJWT(): void { - - $data = array( - "jwt" => "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->account->createJWT( - ); - - $this->assertSame($data, $response); - } - - public function testMethodListLogs(): void { - - $data = array( - "total" => 5, - "logs" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->account->listLogs( - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateMFA(): void { - - $data = array( - "\$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" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->account->updateMFA( - true - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateMfaAuthenticator(): void { - - $data = array( - "secret" => "1", - "uri" => "1",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->account->createMfaAuthenticator( - "totp" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateMfaAuthenticator(): void { - - $data = array( - "\$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" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->account->updateMfaAuthenticator( - "totp", - "<OTP>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodDeleteMfaAuthenticator(): void { - - $data = ''; - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->account->deleteMfaAuthenticator( - "totp", - "<OTP>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateMfaChallenge(): void { - - $data = array( - "\$id" => "bb8ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "userId" => "5e5ea5c168bb8", - "expire" => "2020-10-15T06:38:00.000+00:00",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->account->createMfaChallenge( - "email" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateMfaChallenge(): void { - - $data = ''; - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->account->updateMfaChallenge( - "<CHALLENGE_ID>", - "<OTP>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodListMfaFactors(): void { - - $data = array( - "totp" => true, - "phone" => true, - "email" => true, - "recoveryCode" => true,); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->account->listMfaFactors( - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetMfaRecoveryCodes(): void { - - $data = array( - "recoveryCodes" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->account->getMfaRecoveryCodes( - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateMfaRecoveryCodes(): void { - - $data = array( - "recoveryCodes" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->account->createMfaRecoveryCodes( - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateMfaRecoveryCodes(): void { - - $data = array( - "recoveryCodes" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->account->updateMfaRecoveryCodes( - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateName(): void { - - $data = array( - "\$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" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->account->updateName( - "<NAME>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdatePassword(): void { - - $data = array( - "\$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" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->account->updatePassword( - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdatePhone(): void { - - $data = array( - "\$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" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->account->updatePhone( - "+12065550100", - "password" - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetPrefs(): void { - - $data = array(); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->account->getPrefs( - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdatePrefs(): void { - - $data = array( - "\$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" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->account->updatePrefs( - array() - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateRecovery(): void { - - $data = array( - "\$id" => "bb8ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "userId" => "5e5ea5c168bb8", - "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); - - $response = $this->account->createRecovery( - "email@example.com", - "https://example.com" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateRecovery(): void { - - $data = array( - "\$id" => "bb8ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "userId" => "5e5ea5c168bb8", - "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); - - $response = $this->account->updateRecovery( - "<USER_ID>", - "<SECRET>", - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodListSessions(): void { - - $data = array( - "total" => 5, - "sessions" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->account->listSessions( - ); - - $this->assertSame($data, $response); - } - - public function testMethodDeleteSessions(): void { - - $data = ''; - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->account->deleteSessions( - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateAnonymousSession(): void { - - $data = array( - "\$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" => array(), - "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); - - $response = $this->account->createAnonymousSession( - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateEmailPasswordSession(): void { - - $data = array( - "\$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" => array(), - "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); - - $response = $this->account->createEmailPasswordSession( - "email@example.com", - "password" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateMagicURLSession(): void { - - $data = array( - "\$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" => array(), - "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); - - $response = $this->account->updateMagicURLSession( - "<USER_ID>", - "<SECRET>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdatePhoneSession(): void { - - $data = array( - "\$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" => array(), - "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); - - $response = $this->account->updatePhoneSession( - "<USER_ID>", - "<SECRET>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateSession(): void { - - $data = array( - "\$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" => array(), - "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); - - $response = $this->account->createSession( - "<USER_ID>", - "<SECRET>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetSession(): void { - - $data = array( - "\$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" => array(), - "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); - - $response = $this->account->getSession( - "<SESSION_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateSession(): void { - - $data = array( - "\$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" => array(), - "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); - - $response = $this->account->updateSession( - "<SESSION_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodDeleteSession(): void { - - $data = ''; - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->account->deleteSession( - "<SESSION_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateStatus(): void { - - $data = array( - "\$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" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->account->updateStatus( - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateEmailToken(): void { - - $data = array( - "\$id" => "bb8ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "userId" => "5e5ea5c168bb8", - "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); - - $response = $this->account->createEmailToken( - "<USER_ID>", - "email@example.com" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateMagicURLToken(): void { - - $data = array( - "\$id" => "bb8ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "userId" => "5e5ea5c168bb8", - "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); - - $response = $this->account->createMagicURLToken( - "<USER_ID>", - "email@example.com" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateOAuth2Token(): void { - - $data = array(); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->account->createOAuth2Token( - "amazon" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreatePhoneToken(): void { - - $data = array( - "\$id" => "bb8ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "userId" => "5e5ea5c168bb8", - "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); - - $response = $this->account->createPhoneToken( - "<USER_ID>", - "+12065550100" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateVerification(): void { - - $data = array( - "\$id" => "bb8ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "userId" => "5e5ea5c168bb8", - "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); - - $response = $this->account->createVerification( - "https://example.com" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateVerification(): void { - - $data = array( - "\$id" => "bb8ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "userId" => "5e5ea5c168bb8", - "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); - - $response = $this->account->updateVerification( - "<USER_ID>", - "<SECRET>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreatePhoneVerification(): void { - - $data = array( - "\$id" => "bb8ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "userId" => "5e5ea5c168bb8", - "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); - - $response = $this->account->createPhoneVerification( - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdatePhoneVerification(): void { - - $data = array( - "\$id" => "bb8ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "userId" => "5e5ea5c168bb8", - "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); - - $response = $this->account->updatePhoneVerification( - "<USER_ID>", - "<SECRET>" - ); - - $this->assertSame($data, $response); - } - -} diff --git a/tests/Appwrite/Services/AvatarsTest.php b/tests/Appwrite/Services/AvatarsTest.php deleted file mode 100644 index cb2790e..0000000 --- a/tests/Appwrite/Services/AvatarsTest.php +++ /dev/null @@ -1,130 +0,0 @@ -<?php - -namespace Appwrite\Services; - -use Appwrite\Client; -use Appwrite\InputFile; -use Mockery; -use PHPUnit\Framework\TestCase; - -final class AvatarsTest extends TestCase { - private $client; - private $avatars; - - protected function setUp(): void { - $this->client = Mockery::mock(Client::class); - $this->avatars = new Avatars($this->client); - } - - public function testMethodGetBrowser(): void { - - $data = ''; - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->avatars->getBrowser( - "aa" - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetCreditCard(): void { - - $data = ''; - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->avatars->getCreditCard( - "amex" - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetFavicon(): void { - - $data = ''; - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->avatars->getFavicon( - "https://example.com" - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetFlag(): void { - - $data = ''; - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->avatars->getFlag( - "af" - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetImage(): void { - - $data = ''; - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->avatars->getImage( - "https://example.com" - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetInitials(): void { - - $data = ''; - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->avatars->getInitials( - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetQR(): void { - - $data = ''; - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->avatars->getQR( - "<TEXT>" - ); - - $this->assertSame($data, $response); - } - -} diff --git a/tests/Appwrite/Services/DatabasesTest.php b/tests/Appwrite/Services/DatabasesTest.php deleted file mode 100644 index cf4f452..0000000 --- a/tests/Appwrite/Services/DatabasesTest.php +++ /dev/null @@ -1,1006 +0,0 @@ -<?php - -namespace Appwrite\Services; - -use Appwrite\Client; -use Appwrite\InputFile; -use Mockery; -use PHPUnit\Framework\TestCase; - -final class DatabasesTest extends TestCase { - private $client; - private $databases; - - protected function setUp(): void { - $this->client = Mockery::mock(Client::class); - $this->databases = new Databases($this->client); - } - - public function testMethodList(): void { - - $data = array( - "total" => 5, - "databases" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->databases->list( - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreate(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "name" => "My Database", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "enabled" => true,); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->databases->create( - "<DATABASE_ID>", - "<NAME>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodGet(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "name" => "My Database", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "enabled" => true,); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->databases->get( - "<DATABASE_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdate(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "name" => "My Database", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "enabled" => true,); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->databases->update( - "<DATABASE_ID>", - "<NAME>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodDelete(): void { - - $data = ''; - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->databases->delete( - "<DATABASE_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodListCollections(): void { - - $data = array( - "total" => 5, - "collections" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->databases->listCollections( - "<DATABASE_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateCollection(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(), - "databaseId" => "5e5ea5c16897e", - "name" => "My Collection", - "enabled" => true, - "documentSecurity" => true, - "attributes" => array(), - "indexes" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->databases->createCollection( - "<DATABASE_ID>", - "<COLLECTION_ID>", - "<NAME>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetCollection(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(), - "databaseId" => "5e5ea5c16897e", - "name" => "My Collection", - "enabled" => true, - "documentSecurity" => true, - "attributes" => array(), - "indexes" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->databases->getCollection( - "<DATABASE_ID>", - "<COLLECTION_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateCollection(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(), - "databaseId" => "5e5ea5c16897e", - "name" => "My Collection", - "enabled" => true, - "documentSecurity" => true, - "attributes" => array(), - "indexes" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->databases->updateCollection( - "<DATABASE_ID>", - "<COLLECTION_ID>", - "<NAME>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodDeleteCollection(): void { - - $data = ''; - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->databases->deleteCollection( - "<DATABASE_ID>", - "<COLLECTION_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodListAttributes(): void { - - $data = array( - "total" => 5, - "attributes" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->databases->listAttributes( - "<DATABASE_ID>", - "<COLLECTION_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateBooleanAttribute(): void { - - $data = array( - "key" => "isEnabled", - "type" => "boolean", - "status" => "available", - "error" => "string", - "required" => true,); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->databases->createBooleanAttribute( - "<DATABASE_ID>", - "<COLLECTION_ID>", - "", - true - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateBooleanAttribute(): void { - - $data = array( - "key" => "isEnabled", - "type" => "boolean", - "status" => "available", - "error" => "string", - "required" => true,); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->databases->updateBooleanAttribute( - "<DATABASE_ID>", - "<COLLECTION_ID>", - "", - true, - true - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateDatetimeAttribute(): void { - - $data = array( - "key" => "birthDay", - "type" => "datetime", - "status" => "available", - "error" => "string", - "required" => true, - "format" => "datetime",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->databases->createDatetimeAttribute( - "<DATABASE_ID>", - "<COLLECTION_ID>", - "", - true - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateDatetimeAttribute(): void { - - $data = array( - "key" => "birthDay", - "type" => "datetime", - "status" => "available", - "error" => "string", - "required" => true, - "format" => "datetime",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->databases->updateDatetimeAttribute( - "<DATABASE_ID>", - "<COLLECTION_ID>", - "", - true, - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateEmailAttribute(): void { - - $data = array( - "key" => "userEmail", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "format" => "email",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->databases->createEmailAttribute( - "<DATABASE_ID>", - "<COLLECTION_ID>", - "", - true - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateEmailAttribute(): void { - - $data = array( - "key" => "userEmail", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "format" => "email",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->databases->updateEmailAttribute( - "<DATABASE_ID>", - "<COLLECTION_ID>", - "", - true, - "email@example.com" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateEnumAttribute(): void { - - $data = array( - "key" => "status", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "elements" => array(), - "format" => "enum",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->databases->createEnumAttribute( - "<DATABASE_ID>", - "<COLLECTION_ID>", - "", - array(), - true - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateEnumAttribute(): void { - - $data = array( - "key" => "status", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "elements" => array(), - "format" => "enum",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->databases->updateEnumAttribute( - "<DATABASE_ID>", - "<COLLECTION_ID>", - "", - array(), - true, - "<DEFAULT>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateFloatAttribute(): void { - - $data = array( - "key" => "percentageCompleted", - "type" => "double", - "status" => "available", - "error" => "string", - "required" => true,); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->databases->createFloatAttribute( - "<DATABASE_ID>", - "<COLLECTION_ID>", - "", - true - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateFloatAttribute(): void { - - $data = array( - "key" => "percentageCompleted", - "type" => "double", - "status" => "available", - "error" => "string", - "required" => true,); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->databases->updateFloatAttribute( - "<DATABASE_ID>", - "<COLLECTION_ID>", - "", - true, - 1.0, - 1.0, - 1.0 - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateIntegerAttribute(): void { - - $data = array( - "key" => "count", - "type" => "integer", - "status" => "available", - "error" => "string", - "required" => true,); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->databases->createIntegerAttribute( - "<DATABASE_ID>", - "<COLLECTION_ID>", - "", - true - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateIntegerAttribute(): void { - - $data = array( - "key" => "count", - "type" => "integer", - "status" => "available", - "error" => "string", - "required" => true,); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->databases->updateIntegerAttribute( - "<DATABASE_ID>", - "<COLLECTION_ID>", - "", - true, - 1, - 1, - 1 - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateIpAttribute(): void { - - $data = array( - "key" => "ipAddress", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "format" => "ip",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->databases->createIpAttribute( - "<DATABASE_ID>", - "<COLLECTION_ID>", - "", - true - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateIpAttribute(): void { - - $data = array( - "key" => "ipAddress", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "format" => "ip",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->databases->updateIpAttribute( - "<DATABASE_ID>", - "<COLLECTION_ID>", - "", - true, - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateRelationshipAttribute(): void { - - $data = array( - "key" => "fullName", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "relatedCollection" => "collection", - "relationType" => "oneToOne|oneToMany|manyToOne|manyToMany", - "twoWay" => true, - "twoWayKey" => "string", - "onDelete" => "restrict|cascade|setNull", - "side" => "parent|child",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->databases->createRelationshipAttribute( - "<DATABASE_ID>", - "<COLLECTION_ID>", - "<RELATED_COLLECTION_ID>", - "oneToOne" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateStringAttribute(): void { - - $data = array( - "key" => "fullName", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "size" => 128,); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->databases->createStringAttribute( - "<DATABASE_ID>", - "<COLLECTION_ID>", - "", - 1, - true - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateStringAttribute(): void { - - $data = array( - "key" => "fullName", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "size" => 128,); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->databases->updateStringAttribute( - "<DATABASE_ID>", - "<COLLECTION_ID>", - "", - true, - "<DEFAULT>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateUrlAttribute(): void { - - $data = array( - "key" => "githubUrl", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "format" => "url",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->databases->createUrlAttribute( - "<DATABASE_ID>", - "<COLLECTION_ID>", - "", - true - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateUrlAttribute(): void { - - $data = array( - "key" => "githubUrl", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "format" => "url",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->databases->updateUrlAttribute( - "<DATABASE_ID>", - "<COLLECTION_ID>", - "", - true, - "https://example.com" - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetAttribute(): void { - - $data = ''; - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->databases->getAttribute( - "<DATABASE_ID>", - "<COLLECTION_ID>", - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodDeleteAttribute(): void { - - $data = ''; - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->databases->deleteAttribute( - "<DATABASE_ID>", - "<COLLECTION_ID>", - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateRelationshipAttribute(): void { - - $data = array( - "key" => "fullName", - "type" => "string", - "status" => "available", - "error" => "string", - "required" => true, - "relatedCollection" => "collection", - "relationType" => "oneToOne|oneToMany|manyToOne|manyToMany", - "twoWay" => true, - "twoWayKey" => "string", - "onDelete" => "restrict|cascade|setNull", - "side" => "parent|child",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->databases->updateRelationshipAttribute( - "<DATABASE_ID>", - "<COLLECTION_ID>", - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodListDocuments(): void { - - $data = array( - "total" => 5, - "documents" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->databases->listDocuments( - "<DATABASE_ID>", - "<COLLECTION_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateDocument(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$collectionId" => "5e5ea5c15117e", - "\$databaseId" => "5e5ea5c15117e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->databases->createDocument( - "<DATABASE_ID>", - "<COLLECTION_ID>", - "<DOCUMENT_ID>", - array() - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetDocument(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$collectionId" => "5e5ea5c15117e", - "\$databaseId" => "5e5ea5c15117e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->databases->getDocument( - "<DATABASE_ID>", - "<COLLECTION_ID>", - "<DOCUMENT_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateDocument(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$collectionId" => "5e5ea5c15117e", - "\$databaseId" => "5e5ea5c15117e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->databases->updateDocument( - "<DATABASE_ID>", - "<COLLECTION_ID>", - "<DOCUMENT_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodDeleteDocument(): void { - - $data = ''; - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->databases->deleteDocument( - "<DATABASE_ID>", - "<COLLECTION_ID>", - "<DOCUMENT_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodListIndexes(): void { - - $data = array( - "total" => 5, - "indexes" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->databases->listIndexes( - "<DATABASE_ID>", - "<COLLECTION_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateIndex(): void { - - $data = array( - "key" => "index1", - "type" => "primary", - "status" => "available", - "error" => "string", - "attributes" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->databases->createIndex( - "<DATABASE_ID>", - "<COLLECTION_ID>", - "", - "key", - array() - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetIndex(): void { - - $data = array( - "key" => "index1", - "type" => "primary", - "status" => "available", - "error" => "string", - "attributes" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->databases->getIndex( - "<DATABASE_ID>", - "<COLLECTION_ID>", - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodDeleteIndex(): void { - - $data = ''; - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->databases->deleteIndex( - "<DATABASE_ID>", - "<COLLECTION_ID>", - "" - ); - - $this->assertSame($data, $response); - } - -} diff --git a/tests/Appwrite/Services/FunctionsTest.php b/tests/Appwrite/Services/FunctionsTest.php deleted file mode 100644 index eeb7fc2..0000000 --- a/tests/Appwrite/Services/FunctionsTest.php +++ /dev/null @@ -1,614 +0,0 @@ -<?php - -namespace Appwrite\Services; - -use Appwrite\Client; -use Appwrite\InputFile; -use Mockery; -use PHPUnit\Framework\TestCase; - -final class FunctionsTest extends TestCase { - private $client; - private $functions; - - protected function setUp(): void { - $this->client = Mockery::mock(Client::class); - $this->functions = new Functions($this->client); - } - - public function testMethodList(): void { - - $data = array( - "total" => 5, - "functions" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->functions->list( - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreate(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "execute" => array(), - "name" => "My Function", - "enabled" => true, - "live" => true, - "logging" => true, - "runtime" => "python-3.8", - "deployment" => "5e5ea5c16897e", - "scopes" => array(), - "vars" => array(), - "events" => array(), - "schedule" => "5 4 * * *", - "timeout" => 300, - "entrypoint" => "index.js", - "commands" => "npm install", - "version" => "v2", - "installationId" => "6m40at4ejk5h2u9s1hboo", - "providerRepositoryId" => "appwrite", - "providerBranch" => "main", - "providerRootDirectory" => "functions/helloWorld", - "providerSilentMode" => true,); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->functions->create( - "<FUNCTION_ID>", - "<NAME>", - "node-14.5" - ); - - $this->assertSame($data, $response); - } - - public function testMethodListRuntimes(): void { - - $data = array( - "total" => 5, - "runtimes" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->functions->listRuntimes( - ); - - $this->assertSame($data, $response); - } - - public function testMethodGet(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "execute" => array(), - "name" => "My Function", - "enabled" => true, - "live" => true, - "logging" => true, - "runtime" => "python-3.8", - "deployment" => "5e5ea5c16897e", - "scopes" => array(), - "vars" => array(), - "events" => array(), - "schedule" => "5 4 * * *", - "timeout" => 300, - "entrypoint" => "index.js", - "commands" => "npm install", - "version" => "v2", - "installationId" => "6m40at4ejk5h2u9s1hboo", - "providerRepositoryId" => "appwrite", - "providerBranch" => "main", - "providerRootDirectory" => "functions/helloWorld", - "providerSilentMode" => true,); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->functions->get( - "<FUNCTION_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdate(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "execute" => array(), - "name" => "My Function", - "enabled" => true, - "live" => true, - "logging" => true, - "runtime" => "python-3.8", - "deployment" => "5e5ea5c16897e", - "scopes" => array(), - "vars" => array(), - "events" => array(), - "schedule" => "5 4 * * *", - "timeout" => 300, - "entrypoint" => "index.js", - "commands" => "npm install", - "version" => "v2", - "installationId" => "6m40at4ejk5h2u9s1hboo", - "providerRepositoryId" => "appwrite", - "providerBranch" => "main", - "providerRootDirectory" => "functions/helloWorld", - "providerSilentMode" => true,); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->functions->update( - "<FUNCTION_ID>", - "<NAME>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodDelete(): void { - - $data = ''; - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->functions->delete( - "<FUNCTION_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodListDeployments(): void { - - $data = array( - "total" => 5, - "deployments" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->functions->listDeployments( - "<FUNCTION_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateDeployment(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "type" => "vcs", - "resourceId" => "5e5ea6g16897e", - "resourceType" => "functions", - "entrypoint" => "index.js", - "size" => 128, - "buildId" => "5e5ea5c16897e", - "activate" => true, - "status" => "ready", - "buildLogs" => "Compiling source files...", - "buildTime" => 128, - "providerRepositoryName" => "database", - "providerRepositoryOwner" => "utopia", - "providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function", - "providerBranch" => "0.7.x", - "providerCommitHash" => "7c3f25d", - "providerCommitAuthorUrl" => "https://github.com/vermakhushboo", - "providerCommitAuthor" => "Khushboo Verma", - "providerCommitMessage" => "Update index.js", - "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", - "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->functions->createDeployment( - "<FUNCTION_ID>", - InputFile::withData('', "image/png"), - true - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetDeployment(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "type" => "vcs", - "resourceId" => "5e5ea6g16897e", - "resourceType" => "functions", - "entrypoint" => "index.js", - "size" => 128, - "buildId" => "5e5ea5c16897e", - "activate" => true, - "status" => "ready", - "buildLogs" => "Compiling source files...", - "buildTime" => 128, - "providerRepositoryName" => "database", - "providerRepositoryOwner" => "utopia", - "providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function", - "providerBranch" => "0.7.x", - "providerCommitHash" => "7c3f25d", - "providerCommitAuthorUrl" => "https://github.com/vermakhushboo", - "providerCommitAuthor" => "Khushboo Verma", - "providerCommitMessage" => "Update index.js", - "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", - "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->functions->getDeployment( - "<FUNCTION_ID>", - "<DEPLOYMENT_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateDeployment(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "execute" => array(), - "name" => "My Function", - "enabled" => true, - "live" => true, - "logging" => true, - "runtime" => "python-3.8", - "deployment" => "5e5ea5c16897e", - "scopes" => array(), - "vars" => array(), - "events" => array(), - "schedule" => "5 4 * * *", - "timeout" => 300, - "entrypoint" => "index.js", - "commands" => "npm install", - "version" => "v2", - "installationId" => "6m40at4ejk5h2u9s1hboo", - "providerRepositoryId" => "appwrite", - "providerBranch" => "main", - "providerRootDirectory" => "functions/helloWorld", - "providerSilentMode" => true,); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->functions->updateDeployment( - "<FUNCTION_ID>", - "<DEPLOYMENT_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodDeleteDeployment(): void { - - $data = ''; - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->functions->deleteDeployment( - "<FUNCTION_ID>", - "<DEPLOYMENT_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateBuild(): void { - - $data = ''; - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->functions->createBuild( - "<FUNCTION_ID>", - "<DEPLOYMENT_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateDeploymentBuild(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "deploymentId" => "5e5ea5c16897e", - "status" => "ready", - "stdout" => "", - "stderr" => "", - "startTime" => "2020-10-15T06:38:00.000+00:00", - "endTime" => "2020-10-15T06:38:00.000+00:00", - "duration" => 0, - "size" => 128,); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->functions->updateDeploymentBuild( - "<FUNCTION_ID>", - "<DEPLOYMENT_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodDownloadDeployment(): void { - - $data = ''; - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->functions->downloadDeployment( - "<FUNCTION_ID>", - "<DEPLOYMENT_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodListExecutions(): void { - - $data = array( - "total" => 5, - "executions" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->functions->listExecutions( - "<FUNCTION_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateExecution(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(), - "functionId" => "5e5ea6g16897e", - "trigger" => "http", - "status" => "processing", - "requestMethod" => "GET", - "requestPath" => "/articles?id=5", - "requestHeaders" => array(), - "responseStatusCode" => 200, - "responseBody" => "Developers are awesome.", - "responseHeaders" => array(), - "logs" => "", - "errors" => "", - "duration" => 0.4,); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->functions->createExecution( - "<FUNCTION_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetExecution(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(), - "functionId" => "5e5ea6g16897e", - "trigger" => "http", - "status" => "processing", - "requestMethod" => "GET", - "requestPath" => "/articles?id=5", - "requestHeaders" => array(), - "responseStatusCode" => 200, - "responseBody" => "Developers are awesome.", - "responseHeaders" => array(), - "logs" => "", - "errors" => "", - "duration" => 0.4,); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->functions->getExecution( - "<FUNCTION_ID>", - "<EXECUTION_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodDeleteExecution(): void { - - $data = ''; - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->functions->deleteExecution( - "<FUNCTION_ID>", - "<EXECUTION_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodListVariables(): void { - - $data = array( - "total" => 5, - "variables" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->functions->listVariables( - "<FUNCTION_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateVariable(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "key" => "API_KEY", - "value" => "myPa\$\$word1", - "resourceType" => "function", - "resourceId" => "myAwesomeFunction",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->functions->createVariable( - "<FUNCTION_ID>", - "<KEY>", - "<VALUE>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetVariable(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "key" => "API_KEY", - "value" => "myPa\$\$word1", - "resourceType" => "function", - "resourceId" => "myAwesomeFunction",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->functions->getVariable( - "<FUNCTION_ID>", - "<VARIABLE_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateVariable(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "key" => "API_KEY", - "value" => "myPa\$\$word1", - "resourceType" => "function", - "resourceId" => "myAwesomeFunction",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->functions->updateVariable( - "<FUNCTION_ID>", - "<VARIABLE_ID>", - "<KEY>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodDeleteVariable(): void { - - $data = ''; - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->functions->deleteVariable( - "<FUNCTION_ID>", - "<VARIABLE_ID>" - ); - - $this->assertSame($data, $response); - } - -} diff --git a/tests/Appwrite/Services/GraphqlTest.php b/tests/Appwrite/Services/GraphqlTest.php deleted file mode 100644 index 6c587b8..0000000 --- a/tests/Appwrite/Services/GraphqlTest.php +++ /dev/null @@ -1,51 +0,0 @@ -<?php - -namespace Appwrite\Services; - -use Appwrite\Client; -use Appwrite\InputFile; -use Mockery; -use PHPUnit\Framework\TestCase; - -final class GraphqlTest extends TestCase { - private $client; - private $graphql; - - protected function setUp(): void { - $this->client = Mockery::mock(Client::class); - $this->graphql = new Graphql($this->client); - } - - public function testMethodQuery(): void { - - $data = array(); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->graphql->query( - array() - ); - - $this->assertSame($data, $response); - } - - public function testMethodMutation(): void { - - $data = array(); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->graphql->mutation( - array() - ); - - $this->assertSame($data, $response); - } - -} diff --git a/tests/Appwrite/Services/HealthTest.php b/tests/Appwrite/Services/HealthTest.php deleted file mode 100644 index bed4e21..0000000 --- a/tests/Appwrite/Services/HealthTest.php +++ /dev/null @@ -1,410 +0,0 @@ -<?php - -namespace Appwrite\Services; - -use Appwrite\Client; -use Appwrite\InputFile; -use Mockery; -use PHPUnit\Framework\TestCase; - -final class HealthTest extends TestCase { - private $client; - private $health; - - protected function setUp(): void { - $this->client = Mockery::mock(Client::class); - $this->health = new Health($this->client); - } - - public function testMethodGet(): void { - - $data = array( - "name" => "database", - "ping" => 128, - "status" => "pass",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->health->get( - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetAntivirus(): void { - - $data = array( - "version" => "1.0.0", - "status" => "online",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->health->getAntivirus( - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetCache(): void { - - $data = array( - "name" => "database", - "ping" => 128, - "status" => "pass",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->health->getCache( - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetCertificate(): void { - - $data = array( - "name" => "/CN=www.google.com", - "subjectSN" => "", - "issuerOrganisation" => "", - "validFrom" => "1704200998", - "validTo" => "1711458597", - "signatureTypeSN" => "RSA-SHA256",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->health->getCertificate( - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetDB(): void { - - $data = array( - "name" => "database", - "ping" => 128, - "status" => "pass",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->health->getDB( - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetPubSub(): void { - - $data = array( - "name" => "database", - "ping" => 128, - "status" => "pass",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->health->getPubSub( - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetQueue(): void { - - $data = array( - "name" => "database", - "ping" => 128, - "status" => "pass",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->health->getQueue( - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetQueueBuilds(): void { - - $data = array( - "size" => 8,); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->health->getQueueBuilds( - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetQueueCertificates(): void { - - $data = array( - "size" => 8,); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->health->getQueueCertificates( - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetQueueDatabases(): void { - - $data = array( - "size" => 8,); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->health->getQueueDatabases( - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetQueueDeletes(): void { - - $data = array( - "size" => 8,); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->health->getQueueDeletes( - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetFailedJobs(): void { - - $data = array( - "size" => 8,); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->health->getFailedJobs( - "v1-database" - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetQueueFunctions(): void { - - $data = array( - "size" => 8,); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->health->getQueueFunctions( - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetQueueLogs(): void { - - $data = array( - "size" => 8,); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->health->getQueueLogs( - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetQueueMails(): void { - - $data = array( - "size" => 8,); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->health->getQueueMails( - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetQueueMessaging(): void { - - $data = array( - "size" => 8,); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->health->getQueueMessaging( - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetQueueMigrations(): void { - - $data = array( - "size" => 8,); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->health->getQueueMigrations( - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetQueueUsage(): void { - - $data = array( - "size" => 8,); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->health->getQueueUsage( - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetQueueUsageDump(): void { - - $data = array( - "size" => 8,); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->health->getQueueUsageDump( - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetQueueWebhooks(): void { - - $data = array( - "size" => 8,); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->health->getQueueWebhooks( - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetStorage(): void { - - $data = array( - "name" => "database", - "ping" => 128, - "status" => "pass",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->health->getStorage( - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetStorageLocal(): void { - - $data = array( - "name" => "database", - "ping" => 128, - "status" => "pass",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->health->getStorageLocal( - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetTime(): void { - - $data = array( - "remoteTime" => 1639490751, - "localTime" => 1639490844, - "diff" => 93,); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->health->getTime( - ); - - $this->assertSame($data, $response); - } - -} diff --git a/tests/Appwrite/Services/LocaleTest.php b/tests/Appwrite/Services/LocaleTest.php deleted file mode 100644 index 6e8f9db..0000000 --- a/tests/Appwrite/Services/LocaleTest.php +++ /dev/null @@ -1,160 +0,0 @@ -<?php - -namespace Appwrite\Services; - -use Appwrite\Client; -use Appwrite\InputFile; -use Mockery; -use PHPUnit\Framework\TestCase; - -final class LocaleTest extends TestCase { - private $client; - private $locale; - - protected function setUp(): void { - $this->client = Mockery::mock(Client::class); - $this->locale = new Locale($this->client); - } - - public function testMethodGet(): void { - - $data = array( - "ip" => "127.0.0.1", - "countryCode" => "US", - "country" => "United States", - "continentCode" => "NA", - "continent" => "North America", - "eu" => true, - "currency" => "USD",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->locale->get( - ); - - $this->assertSame($data, $response); - } - - public function testMethodListCodes(): void { - - $data = array( - "total" => 5, - "localeCodes" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->locale->listCodes( - ); - - $this->assertSame($data, $response); - } - - public function testMethodListContinents(): void { - - $data = array( - "total" => 5, - "continents" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->locale->listContinents( - ); - - $this->assertSame($data, $response); - } - - public function testMethodListCountries(): void { - - $data = array( - "total" => 5, - "countries" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->locale->listCountries( - ); - - $this->assertSame($data, $response); - } - - public function testMethodListCountriesEU(): void { - - $data = array( - "total" => 5, - "countries" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->locale->listCountriesEU( - ); - - $this->assertSame($data, $response); - } - - public function testMethodListCountriesPhones(): void { - - $data = array( - "total" => 5, - "phones" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->locale->listCountriesPhones( - ); - - $this->assertSame($data, $response); - } - - public function testMethodListCurrencies(): void { - - $data = array( - "total" => 5, - "currencies" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->locale->listCurrencies( - ); - - $this->assertSame($data, $response); - } - - public function testMethodListLanguages(): void { - - $data = array( - "total" => 5, - "languages" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->locale->listLanguages( - ); - - $this->assertSame($data, $response); - } - -} diff --git a/tests/Appwrite/Services/MessagingTest.php b/tests/Appwrite/Services/MessagingTest.php deleted file mode 100644 index 49cdac9..0000000 --- a/tests/Appwrite/Services/MessagingTest.php +++ /dev/null @@ -1,1071 +0,0 @@ -<?php - -namespace Appwrite\Services; - -use Appwrite\Client; -use Appwrite\InputFile; -use Mockery; -use PHPUnit\Framework\TestCase; - -final class MessagingTest extends TestCase { - private $client; - private $messaging; - - protected function setUp(): void { - $this->client = Mockery::mock(Client::class); - $this->messaging = new Messaging($this->client); - } - - public function testMethodListMessages(): void { - - $data = array( - "total" => 5, - "messages" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->messaging->listMessages( - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateEmail(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "providerType" => "email", - "topics" => array(), - "users" => array(), - "targets" => array(), - "deliveredTotal" => 1, - "data" => array(), - "status" => "Message status can be one of the following: draft, processing, scheduled, sent, or failed.",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->messaging->createEmail( - "<MESSAGE_ID>", - "<SUBJECT>", - "<CONTENT>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateEmail(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "providerType" => "email", - "topics" => array(), - "users" => array(), - "targets" => array(), - "deliveredTotal" => 1, - "data" => array(), - "status" => "Message status can be one of the following: draft, processing, scheduled, sent, or failed.",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->messaging->updateEmail( - "<MESSAGE_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreatePush(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "providerType" => "email", - "topics" => array(), - "users" => array(), - "targets" => array(), - "deliveredTotal" => 1, - "data" => array(), - "status" => "Message status can be one of the following: draft, processing, scheduled, sent, or failed.",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->messaging->createPush( - "<MESSAGE_ID>", - "<TITLE>", - "<BODY>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdatePush(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "providerType" => "email", - "topics" => array(), - "users" => array(), - "targets" => array(), - "deliveredTotal" => 1, - "data" => array(), - "status" => "Message status can be one of the following: draft, processing, scheduled, sent, or failed.",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->messaging->updatePush( - "<MESSAGE_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateSms(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "providerType" => "email", - "topics" => array(), - "users" => array(), - "targets" => array(), - "deliveredTotal" => 1, - "data" => array(), - "status" => "Message status can be one of the following: draft, processing, scheduled, sent, or failed.",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->messaging->createSms( - "<MESSAGE_ID>", - "<CONTENT>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateSms(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "providerType" => "email", - "topics" => array(), - "users" => array(), - "targets" => array(), - "deliveredTotal" => 1, - "data" => array(), - "status" => "Message status can be one of the following: draft, processing, scheduled, sent, or failed.",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->messaging->updateSms( - "<MESSAGE_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetMessage(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "providerType" => "email", - "topics" => array(), - "users" => array(), - "targets" => array(), - "deliveredTotal" => 1, - "data" => array(), - "status" => "Message status can be one of the following: draft, processing, scheduled, sent, or failed.",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->messaging->getMessage( - "<MESSAGE_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodDelete(): void { - - $data = ''; - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->messaging->delete( - "<MESSAGE_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodListMessageLogs(): void { - - $data = array( - "total" => 5, - "logs" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->messaging->listMessageLogs( - "<MESSAGE_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodListTargets(): void { - - $data = array( - "total" => 5, - "targets" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->messaging->listTargets( - "<MESSAGE_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodListProviders(): void { - - $data = array( - "total" => 5, - "providers" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->messaging->listProviders( - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateApnsProvider(): void { - - $data = array( - "\$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" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->messaging->createApnsProvider( - "<PROVIDER_ID>", - "<NAME>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateApnsProvider(): void { - - $data = array( - "\$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" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->messaging->updateApnsProvider( - "<PROVIDER_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateFcmProvider(): void { - - $data = array( - "\$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" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->messaging->createFcmProvider( - "<PROVIDER_ID>", - "<NAME>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateFcmProvider(): void { - - $data = array( - "\$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" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->messaging->updateFcmProvider( - "<PROVIDER_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateMailgunProvider(): void { - - $data = array( - "\$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" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->messaging->createMailgunProvider( - "<PROVIDER_ID>", - "<NAME>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateMailgunProvider(): void { - - $data = array( - "\$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" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->messaging->updateMailgunProvider( - "<PROVIDER_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateMsg91Provider(): void { - - $data = array( - "\$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" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->messaging->createMsg91Provider( - "<PROVIDER_ID>", - "<NAME>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateMsg91Provider(): void { - - $data = array( - "\$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" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->messaging->updateMsg91Provider( - "<PROVIDER_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateSendgridProvider(): void { - - $data = array( - "\$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" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->messaging->createSendgridProvider( - "<PROVIDER_ID>", - "<NAME>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateSendgridProvider(): void { - - $data = array( - "\$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" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->messaging->updateSendgridProvider( - "<PROVIDER_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateSmtpProvider(): void { - - $data = array( - "\$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" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->messaging->createSmtpProvider( - "<PROVIDER_ID>", - "<NAME>", - "<HOST>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateSmtpProvider(): void { - - $data = array( - "\$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" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->messaging->updateSmtpProvider( - "<PROVIDER_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateTelesignProvider(): void { - - $data = array( - "\$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" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->messaging->createTelesignProvider( - "<PROVIDER_ID>", - "<NAME>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateTelesignProvider(): void { - - $data = array( - "\$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" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->messaging->updateTelesignProvider( - "<PROVIDER_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateTextmagicProvider(): void { - - $data = array( - "\$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" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->messaging->createTextmagicProvider( - "<PROVIDER_ID>", - "<NAME>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateTextmagicProvider(): void { - - $data = array( - "\$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" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->messaging->updateTextmagicProvider( - "<PROVIDER_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateTwilioProvider(): void { - - $data = array( - "\$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" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->messaging->createTwilioProvider( - "<PROVIDER_ID>", - "<NAME>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateTwilioProvider(): void { - - $data = array( - "\$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" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->messaging->updateTwilioProvider( - "<PROVIDER_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateVonageProvider(): void { - - $data = array( - "\$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" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->messaging->createVonageProvider( - "<PROVIDER_ID>", - "<NAME>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateVonageProvider(): void { - - $data = array( - "\$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" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->messaging->updateVonageProvider( - "<PROVIDER_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetProvider(): void { - - $data = array( - "\$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" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->messaging->getProvider( - "<PROVIDER_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodDeleteProvider(): void { - - $data = ''; - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->messaging->deleteProvider( - "<PROVIDER_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodListProviderLogs(): void { - - $data = array( - "total" => 5, - "logs" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->messaging->listProviderLogs( - "<PROVIDER_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodListSubscriberLogs(): void { - - $data = array( - "total" => 5, - "logs" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->messaging->listSubscriberLogs( - "<SUBSCRIBER_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodListTopics(): void { - - $data = array( - "total" => 5, - "topics" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->messaging->listTopics( - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateTopic(): void { - - $data = array( - "\$id" => "259125845563242502", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "events", - "emailTotal" => 100, - "smsTotal" => 100, - "pushTotal" => 100, - "subscribe" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->messaging->createTopic( - "<TOPIC_ID>", - "<NAME>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetTopic(): void { - - $data = array( - "\$id" => "259125845563242502", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "events", - "emailTotal" => 100, - "smsTotal" => 100, - "pushTotal" => 100, - "subscribe" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->messaging->getTopic( - "<TOPIC_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateTopic(): void { - - $data = array( - "\$id" => "259125845563242502", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "events", - "emailTotal" => 100, - "smsTotal" => 100, - "pushTotal" => 100, - "subscribe" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->messaging->updateTopic( - "<TOPIC_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodDeleteTopic(): void { - - $data = ''; - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->messaging->deleteTopic( - "<TOPIC_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodListTopicLogs(): void { - - $data = array( - "total" => 5, - "logs" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->messaging->listTopicLogs( - "<TOPIC_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodListSubscribers(): void { - - $data = array( - "total" => 5, - "subscribers" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->messaging->listSubscribers( - "<TOPIC_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateSubscriber(): void { - - $data = array( - "\$id" => "259125845563242502", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "targetId" => "259125845563242502", - "target" => array(), - "userId" => "5e5ea5c16897e", - "userName" => "Aegon Targaryen", - "topicId" => "259125845563242502", - "providerType" => "email",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->messaging->createSubscriber( - "<TOPIC_ID>", - "<SUBSCRIBER_ID>", - "<TARGET_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetSubscriber(): void { - - $data = array( - "\$id" => "259125845563242502", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "targetId" => "259125845563242502", - "target" => array(), - "userId" => "5e5ea5c16897e", - "userName" => "Aegon Targaryen", - "topicId" => "259125845563242502", - "providerType" => "email",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->messaging->getSubscriber( - "<TOPIC_ID>", - "<SUBSCRIBER_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodDeleteSubscriber(): void { - - $data = ''; - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->messaging->deleteSubscriber( - "<TOPIC_ID>", - "<SUBSCRIBER_ID>" - ); - - $this->assertSame($data, $response); - } - -} diff --git a/tests/Appwrite/Services/StorageTest.php b/tests/Appwrite/Services/StorageTest.php deleted file mode 100644 index e6b1923..0000000 --- a/tests/Appwrite/Services/StorageTest.php +++ /dev/null @@ -1,309 +0,0 @@ -<?php - -namespace Appwrite\Services; - -use Appwrite\Client; -use Appwrite\InputFile; -use Mockery; -use PHPUnit\Framework\TestCase; - -final class StorageTest extends TestCase { - private $client; - private $storage; - - protected function setUp(): void { - $this->client = Mockery::mock(Client::class); - $this->storage = new Storage($this->client); - } - - public function testMethodListBuckets(): void { - - $data = array( - "total" => 5, - "buckets" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->storage->listBuckets( - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateBucket(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(), - "fileSecurity" => true, - "name" => "Documents", - "enabled" => true, - "maximumFileSize" => 100, - "allowedFileExtensions" => array(), - "compression" => "gzip", - "encryption" => true, - "antivirus" => true,); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->storage->createBucket( - "<BUCKET_ID>", - "<NAME>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetBucket(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(), - "fileSecurity" => true, - "name" => "Documents", - "enabled" => true, - "maximumFileSize" => 100, - "allowedFileExtensions" => array(), - "compression" => "gzip", - "encryption" => true, - "antivirus" => true,); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->storage->getBucket( - "<BUCKET_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateBucket(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(), - "fileSecurity" => true, - "name" => "Documents", - "enabled" => true, - "maximumFileSize" => 100, - "allowedFileExtensions" => array(), - "compression" => "gzip", - "encryption" => true, - "antivirus" => true,); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->storage->updateBucket( - "<BUCKET_ID>", - "<NAME>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodDeleteBucket(): void { - - $data = ''; - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->storage->deleteBucket( - "<BUCKET_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodListFiles(): void { - - $data = array( - "total" => 5, - "files" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->storage->listFiles( - "<BUCKET_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateFile(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "bucketId" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(), - "name" => "Pink.png", - "signature" => "5d529fd02b544198ae075bd57c1762bb", - "mimeType" => "image/png", - "sizeOriginal" => 17890, - "chunksTotal" => 17890, - "chunksUploaded" => 17890,); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->storage->createFile( - "<BUCKET_ID>", - "<FILE_ID>", - InputFile::withData('', "image/png") - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetFile(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "bucketId" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(), - "name" => "Pink.png", - "signature" => "5d529fd02b544198ae075bd57c1762bb", - "mimeType" => "image/png", - "sizeOriginal" => 17890, - "chunksTotal" => 17890, - "chunksUploaded" => 17890,); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->storage->getFile( - "<BUCKET_ID>", - "<FILE_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateFile(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "bucketId" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(), - "name" => "Pink.png", - "signature" => "5d529fd02b544198ae075bd57c1762bb", - "mimeType" => "image/png", - "sizeOriginal" => 17890, - "chunksTotal" => 17890, - "chunksUploaded" => 17890,); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->storage->updateFile( - "<BUCKET_ID>", - "<FILE_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodDeleteFile(): void { - - $data = ''; - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->storage->deleteFile( - "<BUCKET_ID>", - "<FILE_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetFileDownload(): void { - - $data = ''; - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->storage->getFileDownload( - "<BUCKET_ID>", - "<FILE_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetFilePreview(): void { - - $data = ''; - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->storage->getFilePreview( - "<BUCKET_ID>", - "<FILE_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetFileView(): void { - - $data = ''; - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->storage->getFileView( - "<BUCKET_ID>", - "<FILE_ID>" - ); - - $this->assertSame($data, $response); - } - -} diff --git a/tests/Appwrite/Services/TeamsTest.php b/tests/Appwrite/Services/TeamsTest.php deleted file mode 100644 index d77d0de..0000000 --- a/tests/Appwrite/Services/TeamsTest.php +++ /dev/null @@ -1,311 +0,0 @@ -<?php - -namespace Appwrite\Services; - -use Appwrite\Client; -use Appwrite\InputFile; -use Mockery; -use PHPUnit\Framework\TestCase; - -final class TeamsTest extends TestCase { - private $client; - private $teams; - - protected function setUp(): void { - $this->client = Mockery::mock(Client::class); - $this->teams = new Teams($this->client); - } - - public function testMethodList(): void { - - $data = array( - "total" => 5, - "teams" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->teams->list( - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreate(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "VIP", - "total" => 7, - "prefs" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->teams->create( - "<TEAM_ID>", - "<NAME>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodGet(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "VIP", - "total" => 7, - "prefs" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->teams->get( - "<TEAM_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateName(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "VIP", - "total" => 7, - "prefs" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->teams->updateName( - "<TEAM_ID>", - "<NAME>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodDelete(): void { - - $data = ''; - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->teams->delete( - "<TEAM_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodListMemberships(): void { - - $data = array( - "total" => 5, - "memberships" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->teams->listMemberships( - "<TEAM_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateMembership(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "userId" => "5e5ea5c16897e", - "userName" => "John Doe", - "userEmail" => "john@appwrite.io", - "teamId" => "5e5ea5c16897e", - "teamName" => "VIP", - "invited" => "2020-10-15T06:38:00.000+00:00", - "joined" => "2020-10-15T06:38:00.000+00:00", - "confirm" => true, - "mfa" => true, - "roles" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->teams->createMembership( - "<TEAM_ID>", - array() - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetMembership(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "userId" => "5e5ea5c16897e", - "userName" => "John Doe", - "userEmail" => "john@appwrite.io", - "teamId" => "5e5ea5c16897e", - "teamName" => "VIP", - "invited" => "2020-10-15T06:38:00.000+00:00", - "joined" => "2020-10-15T06:38:00.000+00:00", - "confirm" => true, - "mfa" => true, - "roles" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->teams->getMembership( - "<TEAM_ID>", - "<MEMBERSHIP_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateMembership(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "userId" => "5e5ea5c16897e", - "userName" => "John Doe", - "userEmail" => "john@appwrite.io", - "teamId" => "5e5ea5c16897e", - "teamName" => "VIP", - "invited" => "2020-10-15T06:38:00.000+00:00", - "joined" => "2020-10-15T06:38:00.000+00:00", - "confirm" => true, - "mfa" => true, - "roles" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->teams->updateMembership( - "<TEAM_ID>", - "<MEMBERSHIP_ID>", - array() - ); - - $this->assertSame($data, $response); - } - - public function testMethodDeleteMembership(): void { - - $data = ''; - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->teams->deleteMembership( - "<TEAM_ID>", - "<MEMBERSHIP_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateMembershipStatus(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "userId" => "5e5ea5c16897e", - "userName" => "John Doe", - "userEmail" => "john@appwrite.io", - "teamId" => "5e5ea5c16897e", - "teamName" => "VIP", - "invited" => "2020-10-15T06:38:00.000+00:00", - "joined" => "2020-10-15T06:38:00.000+00:00", - "confirm" => true, - "mfa" => true, - "roles" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->teams->updateMembershipStatus( - "<TEAM_ID>", - "<MEMBERSHIP_ID>", - "<USER_ID>", - "<SECRET>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetPrefs(): void { - - $data = array(); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->teams->getPrefs( - "<TEAM_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdatePrefs(): void { - - $data = array(); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->teams->updatePrefs( - "<TEAM_ID>", - array() - ); - - $this->assertSame($data, $response); - } - -} diff --git a/tests/Appwrite/Services/UsersTest.php b/tests/Appwrite/Services/UsersTest.php deleted file mode 100644 index 4cb0911..0000000 --- a/tests/Appwrite/Services/UsersTest.php +++ /dev/null @@ -1,1109 +0,0 @@ -<?php - -namespace Appwrite\Services; - -use Appwrite\Client; -use Appwrite\InputFile; -use Mockery; -use PHPUnit\Framework\TestCase; - -final class UsersTest extends TestCase { - private $client; - private $users; - - protected function setUp(): void { - $this->client = Mockery::mock(Client::class); - $this->users = new Users($this->client); - } - - public function testMethodList(): void { - - $data = array( - "total" => 5, - "users" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->users->list( - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreate(): void { - - $data = array( - "\$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" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->users->create( - "<USER_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateArgon2User(): void { - - $data = array( - "\$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" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->users->createArgon2User( - "<USER_ID>", - "email@example.com", - "password" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateBcryptUser(): void { - - $data = array( - "\$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" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->users->createBcryptUser( - "<USER_ID>", - "email@example.com", - "password" - ); - - $this->assertSame($data, $response); - } - - public function testMethodListIdentities(): void { - - $data = array( - "total" => 5, - "identities" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->users->listIdentities( - ); - - $this->assertSame($data, $response); - } - - public function testMethodDeleteIdentity(): void { - - $data = ''; - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->users->deleteIdentity( - "<IDENTITY_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateMD5User(): void { - - $data = array( - "\$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" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->users->createMD5User( - "<USER_ID>", - "email@example.com", - "password" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreatePHPassUser(): void { - - $data = array( - "\$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" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->users->createPHPassUser( - "<USER_ID>", - "email@example.com", - "password" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateScryptUser(): void { - - $data = array( - "\$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" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->users->createScryptUser( - "<USER_ID>", - "email@example.com", - "password", - "<PASSWORD_SALT>", - 1, - 1, - 1, - 1 - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateScryptModifiedUser(): void { - - $data = array( - "\$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" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->users->createScryptModifiedUser( - "<USER_ID>", - "email@example.com", - "password", - "<PASSWORD_SALT>", - "<PASSWORD_SALT_SEPARATOR>", - "<PASSWORD_SIGNER_KEY>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateSHAUser(): void { - - $data = array( - "\$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" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->users->createSHAUser( - "<USER_ID>", - "email@example.com", - "password" - ); - - $this->assertSame($data, $response); - } - - public function testMethodGet(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "John Doe", - "registration" => "2020-10-15T06:38:00.000+00:00", - "status" => true, - "labels" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->users->get( - "<USER_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodDelete(): void { - - $data = ''; - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->users->delete( - "<USER_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateEmail(): void { - - $data = array( - "\$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" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->users->updateEmail( - "<USER_ID>", - "email@example.com" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateJWT(): void { - - $data = array( - "jwt" => "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->users->createJWT( - "<USER_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateLabels(): void { - - $data = array( - "\$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" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->users->updateLabels( - "<USER_ID>", - array() - ); - - $this->assertSame($data, $response); - } - - public function testMethodListLogs(): void { - - $data = array( - "total" => 5, - "logs" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->users->listLogs( - "<USER_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodListMemberships(): void { - - $data = array( - "total" => 5, - "memberships" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->users->listMemberships( - "<USER_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateMfa(): void { - - $data = array( - "\$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" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->users->updateMfa( - "<USER_ID>", - true - ); - - $this->assertSame($data, $response); - } - - public function testMethodDeleteMfaAuthenticator(): void { - - $data = array( - "\$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" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->users->deleteMfaAuthenticator( - "<USER_ID>", - "totp" - ); - - $this->assertSame($data, $response); - } - - public function testMethodListMfaFactors(): void { - - $data = array( - "totp" => true, - "phone" => true, - "email" => true, - "recoveryCode" => true,); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->users->listMfaFactors( - "<USER_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetMfaRecoveryCodes(): void { - - $data = array( - "recoveryCodes" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->users->getMfaRecoveryCodes( - "<USER_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateMfaRecoveryCodes(): void { - - $data = array( - "recoveryCodes" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->users->updateMfaRecoveryCodes( - "<USER_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateMfaRecoveryCodes(): void { - - $data = array( - "recoveryCodes" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->users->createMfaRecoveryCodes( - "<USER_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateName(): void { - - $data = array( - "\$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" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->users->updateName( - "<USER_ID>", - "<NAME>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdatePassword(): void { - - $data = array( - "\$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" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->users->updatePassword( - "<USER_ID>", - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdatePhone(): void { - - $data = array( - "\$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" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->users->updatePhone( - "<USER_ID>", - "+12065550100" - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetPrefs(): void { - - $data = array(); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->users->getPrefs( - "<USER_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdatePrefs(): void { - - $data = array(); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->users->updatePrefs( - "<USER_ID>", - array() - ); - - $this->assertSame($data, $response); - } - - public function testMethodListSessions(): void { - - $data = array( - "total" => 5, - "sessions" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->users->listSessions( - "<USER_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateSession(): void { - - $data = array( - "\$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" => array(), - "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); - - $response = $this->users->createSession( - "<USER_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodDeleteSessions(): void { - - $data = ''; - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->users->deleteSessions( - "<USER_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodDeleteSession(): void { - - $data = ''; - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->users->deleteSession( - "<USER_ID>", - "<SESSION_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateStatus(): void { - - $data = array( - "\$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" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->users->updateStatus( - "<USER_ID>", - true - ); - - $this->assertSame($data, $response); - } - - public function testMethodListTargets(): void { - - $data = array( - "total" => 5, - "targets" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->users->listTargets( - "<USER_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateTarget(): void { - - $data = array( - "\$id" => "259125845563242502", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "Aegon apple token", - "userId" => "259125845563242502", - "providerType" => "email", - "identifier" => "token",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->users->createTarget( - "<USER_ID>", - "<TARGET_ID>", - "email", - "<IDENTIFIER>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetTarget(): void { - - $data = array( - "\$id" => "259125845563242502", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "Aegon apple token", - "userId" => "259125845563242502", - "providerType" => "email", - "identifier" => "token",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->users->getTarget( - "<USER_ID>", - "<TARGET_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateTarget(): void { - - $data = array( - "\$id" => "259125845563242502", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "Aegon apple token", - "userId" => "259125845563242502", - "providerType" => "email", - "identifier" => "token",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->users->updateTarget( - "<USER_ID>", - "<TARGET_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodDeleteTarget(): void { - - $data = ''; - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->users->deleteTarget( - "<USER_ID>", - "<TARGET_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateToken(): void { - - $data = array( - "\$id" => "bb8ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "userId" => "5e5ea5c168bb8", - "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); - - $response = $this->users->createToken( - "<USER_ID>" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateEmailVerification(): void { - - $data = array( - "\$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" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->users->updateEmailVerification( - "<USER_ID>", - true - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdatePhoneVerification(): void { - - $data = array( - "\$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" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->users->updatePhoneVerification( - "<USER_ID>", - true - ); - - $this->assertSame($data, $response); - } - -} From 6e68a65e21834da1a99edf27ab48a4dbc9807972 Mon Sep 17 00:00:00 2001 From: root <christyjacob4@gmail.com> Date: Tue, 20 Aug 2024 09:56:17 +0000 Subject: [PATCH 3/9] chore: update for RC version --- .../account/create-anonymous-session.md | 12 + .../account/create-email-password-session.md | 15 + docs/examples/account/create-email-token.md | 16 + docs/examples/account/create-j-w-t.md | 12 + .../account/create-magic-u-r-l-token.md | 17 + .../account/create-mfa-authenticator.md | 16 + docs/examples/account/create-mfa-challenge.md | 15 + .../account/create-mfa-recovery-codes.md | 13 + docs/examples/account/create-o-auth2token.md | 18 + docs/examples/account/create-phone-token.md | 15 + .../account/create-phone-verification.md | 13 + docs/examples/account/create-recovery.md | 16 + docs/examples/account/create-session.md | 15 + docs/examples/account/create-verification.md | 15 + docs/examples/account/create.md | 17 + docs/examples/account/delete-identity.md | 15 + .../account/delete-mfa-authenticator.md | 16 + docs/examples/account/delete-session.md | 15 + docs/examples/account/delete-sessions.md | 13 + .../account/get-mfa-recovery-codes.md | 13 + docs/examples/account/get-prefs.md | 13 + docs/examples/account/get-session.md | 15 + docs/examples/account/get.md | 13 + docs/examples/account/list-identities.md | 15 + docs/examples/account/list-logs.md | 15 + docs/examples/account/list-mfa-factors.md | 13 + docs/examples/account/list-sessions.md | 13 + docs/examples/account/update-email.md | 16 + docs/examples/account/update-m-f-a.md | 15 + .../account/update-magic-u-r-l-session.md | 15 + .../account/update-mfa-authenticator.md | 17 + docs/examples/account/update-mfa-challenge.md | 16 + .../account/update-mfa-recovery-codes.md | 13 + docs/examples/account/update-name.md | 15 + docs/examples/account/update-password.md | 16 + docs/examples/account/update-phone-session.md | 15 + .../account/update-phone-verification.md | 16 + docs/examples/account/update-phone.md | 16 + docs/examples/account/update-prefs.md | 15 + docs/examples/account/update-recovery.md | 17 + docs/examples/account/update-session.md | 15 + docs/examples/account/update-status.md | 13 + docs/examples/account/update-verification.md | 16 + docs/examples/avatars/get-browser.md | 19 + docs/examples/avatars/get-credit-card.md | 19 + docs/examples/avatars/get-favicon.md | 15 + docs/examples/avatars/get-flag.md | 19 + docs/examples/avatars/get-image.md | 17 + docs/examples/avatars/get-initials.md | 18 + docs/examples/avatars/get-q-r.md | 18 + .../databases/create-boolean-attribute.md | 20 + docs/examples/databases/create-collection.md | 20 + .../databases/create-datetime-attribute.md | 20 + docs/examples/databases/create-document.md | 19 + .../databases/create-email-attribute.md | 20 + .../databases/create-enum-attribute.md | 21 + .../databases/create-float-attribute.md | 22 + docs/examples/databases/create-index.md | 21 + .../databases/create-integer-attribute.md | 22 + .../examples/databases/create-ip-attribute.md | 20 + .../create-relationship-attribute.md | 23 + .../databases/create-string-attribute.md | 22 + .../databases/create-url-attribute.md | 20 + docs/examples/databases/create.md | 17 + docs/examples/databases/delete-attribute.md | 17 + docs/examples/databases/delete-collection.md | 16 + docs/examples/databases/delete-document.md | 17 + docs/examples/databases/delete-index.md | 17 + docs/examples/databases/delete.md | 15 + docs/examples/databases/get-attribute.md | 17 + docs/examples/databases/get-collection.md | 16 + docs/examples/databases/get-document.md | 18 + docs/examples/databases/get-index.md | 17 + docs/examples/databases/get.md | 15 + docs/examples/databases/list-attributes.md | 17 + docs/examples/databases/list-collections.md | 17 + docs/examples/databases/list-documents.md | 17 + docs/examples/databases/list-indexes.md | 17 + docs/examples/databases/list.md | 16 + .../databases/update-boolean-attribute.md | 19 + docs/examples/databases/update-collection.md | 20 + .../databases/update-datetime-attribute.md | 19 + docs/examples/databases/update-document.md | 19 + .../databases/update-email-attribute.md | 19 + .../databases/update-enum-attribute.md | 20 + .../databases/update-float-attribute.md | 21 + .../databases/update-integer-attribute.md | 21 + .../examples/databases/update-ip-attribute.md | 19 + .../update-relationship-attribute.md | 18 + .../databases/update-string-attribute.md | 19 + .../databases/update-url-attribute.md | 19 + docs/examples/databases/update.md | 17 + docs/examples/functions/create-build.md | 17 + docs/examples/functions/create-deployment.md | 20 + docs/examples/functions/create-execution.md | 21 + docs/examples/functions/create-variable.md | 17 + docs/examples/functions/create.md | 36 + docs/examples/functions/delete-deployment.md | 16 + docs/examples/functions/delete-execution.md | 16 + docs/examples/functions/delete-variable.md | 16 + docs/examples/functions/delete.md | 15 + .../functions/get-deployment-download.md | 16 + docs/examples/functions/get-deployment.md | 16 + docs/examples/functions/get-execution.md | 16 + docs/examples/functions/get-template.md | 14 + docs/examples/functions/get-variable.md | 16 + docs/examples/functions/get.md | 15 + docs/examples/functions/list-deployments.md | 17 + docs/examples/functions/list-executions.md | 17 + docs/examples/functions/list-runtimes.md | 13 + docs/examples/functions/list-templates.md | 17 + docs/examples/functions/list-variables.md | 15 + docs/examples/functions/list.md | 16 + .../functions/update-deployment-build.md | 16 + docs/examples/functions/update-deployment.md | 16 + docs/examples/functions/update-variable.md | 18 + docs/examples/functions/update.md | 31 + docs/examples/graphql/mutation.md | 15 + docs/examples/graphql/query.md | 15 + docs/examples/health/get-antivirus.md | 13 + docs/examples/health/get-cache.md | 13 + docs/examples/health/get-certificate.md | 15 + docs/examples/health/get-d-b.md | 13 + docs/examples/health/get-failed-jobs.md | 17 + docs/examples/health/get-pub-sub.md | 13 + docs/examples/health/get-queue-builds.md | 15 + .../examples/health/get-queue-certificates.md | 15 + docs/examples/health/get-queue-databases.md | 16 + docs/examples/health/get-queue-deletes.md | 15 + docs/examples/health/get-queue-functions.md | 15 + docs/examples/health/get-queue-logs.md | 15 + docs/examples/health/get-queue-mails.md | 15 + docs/examples/health/get-queue-messaging.md | 15 + docs/examples/health/get-queue-migrations.md | 15 + docs/examples/health/get-queue-usage-dump.md | 15 + docs/examples/health/get-queue-usage.md | 15 + docs/examples/health/get-queue-webhooks.md | 15 + docs/examples/health/get-queue.md | 13 + docs/examples/health/get-storage-local.md | 13 + docs/examples/health/get-storage.md | 13 + docs/examples/health/get-time.md | 13 + docs/examples/health/get.md | 13 + docs/examples/locale/get.md | 13 + docs/examples/locale/list-codes.md | 13 + docs/examples/locale/list-continents.md | 13 + docs/examples/locale/list-countries-e-u.md | 13 + docs/examples/locale/list-countries-phones.md | 13 + docs/examples/locale/list-countries.md | 13 + docs/examples/locale/list-currencies.md | 13 + docs/examples/locale/list-languages.md | 13 + .../messaging/create-apns-provider.md | 22 + docs/examples/messaging/create-email.md | 26 + .../examples/messaging/create-fcm-provider.md | 18 + .../messaging/create-mailgun-provider.md | 24 + .../messaging/create-msg91provider.md | 20 + docs/examples/messaging/create-push.md | 30 + .../messaging/create-sendgrid-provider.md | 22 + docs/examples/messaging/create-sms.md | 21 + .../messaging/create-smtp-provider.md | 28 + docs/examples/messaging/create-subscriber.md | 17 + .../messaging/create-telesign-provider.md | 20 + .../messaging/create-textmagic-provider.md | 20 + docs/examples/messaging/create-topic.md | 17 + .../messaging/create-twilio-provider.md | 20 + .../messaging/create-vonage-provider.md | 20 + docs/examples/messaging/delete-provider.md | 15 + docs/examples/messaging/delete-subscriber.md | 16 + docs/examples/messaging/delete-topic.md | 15 + docs/examples/messaging/delete.md | 15 + docs/examples/messaging/get-message.md | 15 + docs/examples/messaging/get-provider.md | 15 + docs/examples/messaging/get-subscriber.md | 16 + docs/examples/messaging/get-topic.md | 15 + docs/examples/messaging/list-message-logs.md | 16 + docs/examples/messaging/list-messages.md | 16 + docs/examples/messaging/list-provider-logs.md | 16 + docs/examples/messaging/list-providers.md | 16 + .../messaging/list-subscriber-logs.md | 16 + docs/examples/messaging/list-subscribers.md | 17 + docs/examples/messaging/list-targets.md | 16 + docs/examples/messaging/list-topic-logs.md | 16 + docs/examples/messaging/list-topics.md | 16 + .../messaging/update-apns-provider.md | 22 + docs/examples/messaging/update-email.md | 26 + .../examples/messaging/update-fcm-provider.md | 18 + .../messaging/update-mailgun-provider.md | 24 + .../messaging/update-msg91provider.md | 20 + docs/examples/messaging/update-push.md | 30 + .../messaging/update-sendgrid-provider.md | 22 + docs/examples/messaging/update-sms.md | 21 + .../messaging/update-smtp-provider.md | 28 + .../messaging/update-telesign-provider.md | 20 + .../messaging/update-textmagic-provider.md | 20 + docs/examples/messaging/update-topic.md | 17 + .../messaging/update-twilio-provider.md | 20 + .../messaging/update-vonage-provider.md | 20 + docs/examples/storage/create-bucket.md | 24 + docs/examples/storage/create-file.md | 19 + docs/examples/storage/delete-bucket.md | 15 + docs/examples/storage/delete-file.md | 16 + docs/examples/storage/get-bucket.md | 15 + docs/examples/storage/get-file-download.md | 16 + docs/examples/storage/get-file-preview.md | 27 + docs/examples/storage/get-file-view.md | 16 + docs/examples/storage/get-file.md | 16 + docs/examples/storage/list-buckets.md | 16 + docs/examples/storage/list-files.md | 17 + docs/examples/storage/update-bucket.md | 24 + docs/examples/storage/update-file.md | 18 + docs/examples/teams/create-membership.md | 21 + docs/examples/teams/create.md | 17 + docs/examples/teams/delete-membership.md | 16 + docs/examples/teams/delete.md | 15 + docs/examples/teams/get-membership.md | 16 + docs/examples/teams/get-prefs.md | 15 + docs/examples/teams/get.md | 15 + docs/examples/teams/list-memberships.md | 17 + docs/examples/teams/list.md | 16 + .../teams/update-membership-status.md | 18 + docs/examples/teams/update-membership.md | 17 + docs/examples/teams/update-name.md | 16 + docs/examples/teams/update-prefs.md | 16 + docs/examples/users/create-argon2user.md | 18 + docs/examples/users/create-bcrypt-user.md | 18 + docs/examples/users/create-j-w-t.md | 17 + docs/examples/users/create-m-d5user.md | 18 + .../users/create-mfa-recovery-codes.md | 15 + docs/examples/users/create-p-h-pass-user.md | 18 + docs/examples/users/create-s-h-a-user.md | 19 + .../users/create-scrypt-modified-user.md | 21 + docs/examples/users/create-scrypt-user.md | 23 + docs/examples/users/create-session.md | 15 + docs/examples/users/create-target.md | 21 + docs/examples/users/create-token.md | 17 + docs/examples/users/create.md | 19 + docs/examples/users/delete-identity.md | 15 + .../users/delete-mfa-authenticator.md | 17 + docs/examples/users/delete-session.md | 16 + docs/examples/users/delete-sessions.md | 15 + docs/examples/users/delete-target.md | 16 + docs/examples/users/delete.md | 15 + docs/examples/users/get-mfa-recovery-codes.md | 15 + docs/examples/users/get-prefs.md | 15 + docs/examples/users/get-target.md | 16 + docs/examples/users/get.md | 15 + docs/examples/users/list-identities.md | 16 + docs/examples/users/list-logs.md | 16 + docs/examples/users/list-memberships.md | 15 + docs/examples/users/list-mfa-factors.md | 15 + docs/examples/users/list-sessions.md | 15 + docs/examples/users/list-targets.md | 16 + docs/examples/users/list.md | 16 + .../users/update-email-verification.md | 16 + docs/examples/users/update-email.md | 16 + docs/examples/users/update-labels.md | 16 + .../users/update-mfa-recovery-codes.md | 15 + docs/examples/users/update-mfa.md | 16 + docs/examples/users/update-name.md | 16 + docs/examples/users/update-password.md | 16 + .../users/update-phone-verification.md | 16 + docs/examples/users/update-phone.md | 16 + docs/examples/users/update-prefs.md | 16 + docs/examples/users/update-status.md | 16 + docs/examples/users/update-target.md | 19 + docs/functions.md | 417 +++ docs/graphql.md | 30 + docs/health.md | 273 ++ docs/locale.md | 68 + docs/messaging.md | 864 ++++++ docs/storage.md | 234 ++ docs/teams.md | 215 ++ docs/users.md | 660 +++++ src/Appwrite/AppwriteException.php | 51 + src/Appwrite/Client.php | 316 +++ src/Appwrite/Enums/AuthenticationFactor.php | 59 + src/Appwrite/Enums/AuthenticatorType.php | 35 + src/Appwrite/Enums/Browser.php | 139 + src/Appwrite/Enums/Compression.php | 51 + src/Appwrite/Enums/CreditCard.php | 155 ++ src/Appwrite/Enums/ExecutionMethod.php | 75 + src/Appwrite/Enums/Flag.php | 1587 +++++++++++ src/Appwrite/Enums/ImageFormat.php | 67 + src/Appwrite/Enums/ImageGravity.php | 99 + src/Appwrite/Enums/IndexType.php | 51 + src/Appwrite/Enums/MessagingProviderType.php | 51 + src/Appwrite/Enums/Name.php | 123 + src/Appwrite/Enums/OAuthProvider.php | 339 +++ src/Appwrite/Enums/PasswordHash.php | 115 + src/Appwrite/Enums/RelationMutate.php | 51 + src/Appwrite/Enums/RelationshipType.php | 59 + src/Appwrite/Enums/Runtime.php | 395 +++ src/Appwrite/Enums/SmtpEncryption.php | 51 + src/Appwrite/ID.php | 22 + src/Appwrite/InputFile.php | 51 + src/Appwrite/Permission.php | 31 + src/Appwrite/Query.php | 297 ++ src/Appwrite/Role.php | 111 + src/Appwrite/Service.php | 13 + src/Appwrite/Services/Account.php | 1574 +++++++++++ src/Appwrite/Services/Avatars.php | 380 +++ src/Appwrite/Services/Databases.php | 1822 ++++++++++++ src/Appwrite/Services/Functions.php | 1169 ++++++++ src/Appwrite/Services/Graphql.php | 80 + src/Appwrite/Services/Health.php | 783 ++++++ src/Appwrite/Services/Locale.php | 261 ++ src/Appwrite/Services/Messaging.php | 2448 +++++++++++++++++ src/Appwrite/Services/Storage.php | 713 +++++ src/Appwrite/Services/Teams.php | 530 ++++ src/Appwrite/Services/Users.php | 1588 +++++++++++ tests/Appwrite/IDTest.php | 15 + tests/Appwrite/PermissionTest.php | 27 + tests/Appwrite/QueryTest.php | 149 + tests/Appwrite/RoleTest.php | 47 + tests/Appwrite/Services/AccountTest.php | 1148 ++++++++ tests/Appwrite/Services/AvatarsTest.php | 130 + tests/Appwrite/Services/DatabasesTest.php | 1006 +++++++ tests/Appwrite/Services/FunctionsTest.php | 664 +++++ tests/Appwrite/Services/GraphqlTest.php | 51 + tests/Appwrite/Services/HealthTest.php | 410 +++ tests/Appwrite/Services/LocaleTest.php | 160 ++ tests/Appwrite/Services/MessagingTest.php | 1071 ++++++++ tests/Appwrite/Services/StorageTest.php | 309 +++ tests/Appwrite/Services/TeamsTest.php | 311 +++ tests/Appwrite/Services/UsersTest.php | 1109 ++++++++ 324 files changed, 29619 insertions(+) create mode 100644 docs/examples/account/create-anonymous-session.md create mode 100644 docs/examples/account/create-email-password-session.md create mode 100644 docs/examples/account/create-email-token.md create mode 100644 docs/examples/account/create-j-w-t.md create mode 100644 docs/examples/account/create-magic-u-r-l-token.md create mode 100644 docs/examples/account/create-mfa-authenticator.md create mode 100644 docs/examples/account/create-mfa-challenge.md create mode 100644 docs/examples/account/create-mfa-recovery-codes.md create mode 100644 docs/examples/account/create-o-auth2token.md create mode 100644 docs/examples/account/create-phone-token.md create mode 100644 docs/examples/account/create-phone-verification.md create mode 100644 docs/examples/account/create-recovery.md create mode 100644 docs/examples/account/create-session.md create mode 100644 docs/examples/account/create-verification.md create mode 100644 docs/examples/account/create.md create mode 100644 docs/examples/account/delete-identity.md create mode 100644 docs/examples/account/delete-mfa-authenticator.md create mode 100644 docs/examples/account/delete-session.md create mode 100644 docs/examples/account/delete-sessions.md create mode 100644 docs/examples/account/get-mfa-recovery-codes.md create mode 100644 docs/examples/account/get-prefs.md create mode 100644 docs/examples/account/get-session.md create mode 100644 docs/examples/account/get.md create mode 100644 docs/examples/account/list-identities.md create mode 100644 docs/examples/account/list-logs.md create mode 100644 docs/examples/account/list-mfa-factors.md create mode 100644 docs/examples/account/list-sessions.md create mode 100644 docs/examples/account/update-email.md create mode 100644 docs/examples/account/update-m-f-a.md create mode 100644 docs/examples/account/update-magic-u-r-l-session.md create mode 100644 docs/examples/account/update-mfa-authenticator.md create mode 100644 docs/examples/account/update-mfa-challenge.md create mode 100644 docs/examples/account/update-mfa-recovery-codes.md create mode 100644 docs/examples/account/update-name.md create mode 100644 docs/examples/account/update-password.md create mode 100644 docs/examples/account/update-phone-session.md create mode 100644 docs/examples/account/update-phone-verification.md create mode 100644 docs/examples/account/update-phone.md create mode 100644 docs/examples/account/update-prefs.md create mode 100644 docs/examples/account/update-recovery.md create mode 100644 docs/examples/account/update-session.md create mode 100644 docs/examples/account/update-status.md create mode 100644 docs/examples/account/update-verification.md create mode 100644 docs/examples/avatars/get-browser.md create mode 100644 docs/examples/avatars/get-credit-card.md create mode 100644 docs/examples/avatars/get-favicon.md create mode 100644 docs/examples/avatars/get-flag.md create mode 100644 docs/examples/avatars/get-image.md create mode 100644 docs/examples/avatars/get-initials.md create mode 100644 docs/examples/avatars/get-q-r.md create mode 100644 docs/examples/databases/create-boolean-attribute.md create mode 100644 docs/examples/databases/create-collection.md create mode 100644 docs/examples/databases/create-datetime-attribute.md create mode 100644 docs/examples/databases/create-document.md create mode 100644 docs/examples/databases/create-email-attribute.md create mode 100644 docs/examples/databases/create-enum-attribute.md create mode 100644 docs/examples/databases/create-float-attribute.md create mode 100644 docs/examples/databases/create-index.md create mode 100644 docs/examples/databases/create-integer-attribute.md create mode 100644 docs/examples/databases/create-ip-attribute.md create mode 100644 docs/examples/databases/create-relationship-attribute.md create mode 100644 docs/examples/databases/create-string-attribute.md create mode 100644 docs/examples/databases/create-url-attribute.md create mode 100644 docs/examples/databases/create.md create mode 100644 docs/examples/databases/delete-attribute.md create mode 100644 docs/examples/databases/delete-collection.md create mode 100644 docs/examples/databases/delete-document.md create mode 100644 docs/examples/databases/delete-index.md create mode 100644 docs/examples/databases/delete.md create mode 100644 docs/examples/databases/get-attribute.md create mode 100644 docs/examples/databases/get-collection.md create mode 100644 docs/examples/databases/get-document.md create mode 100644 docs/examples/databases/get-index.md create mode 100644 docs/examples/databases/get.md create mode 100644 docs/examples/databases/list-attributes.md create mode 100644 docs/examples/databases/list-collections.md create mode 100644 docs/examples/databases/list-documents.md create mode 100644 docs/examples/databases/list-indexes.md create mode 100644 docs/examples/databases/list.md create mode 100644 docs/examples/databases/update-boolean-attribute.md create mode 100644 docs/examples/databases/update-collection.md create mode 100644 docs/examples/databases/update-datetime-attribute.md create mode 100644 docs/examples/databases/update-document.md create mode 100644 docs/examples/databases/update-email-attribute.md create mode 100644 docs/examples/databases/update-enum-attribute.md create mode 100644 docs/examples/databases/update-float-attribute.md create mode 100644 docs/examples/databases/update-integer-attribute.md create mode 100644 docs/examples/databases/update-ip-attribute.md create mode 100644 docs/examples/databases/update-relationship-attribute.md create mode 100644 docs/examples/databases/update-string-attribute.md create mode 100644 docs/examples/databases/update-url-attribute.md create mode 100644 docs/examples/databases/update.md create mode 100644 docs/examples/functions/create-build.md create mode 100644 docs/examples/functions/create-deployment.md create mode 100644 docs/examples/functions/create-execution.md create mode 100644 docs/examples/functions/create-variable.md create mode 100644 docs/examples/functions/create.md create mode 100644 docs/examples/functions/delete-deployment.md create mode 100644 docs/examples/functions/delete-execution.md create mode 100644 docs/examples/functions/delete-variable.md create mode 100644 docs/examples/functions/delete.md create mode 100644 docs/examples/functions/get-deployment-download.md create mode 100644 docs/examples/functions/get-deployment.md create mode 100644 docs/examples/functions/get-execution.md create mode 100644 docs/examples/functions/get-template.md create mode 100644 docs/examples/functions/get-variable.md create mode 100644 docs/examples/functions/get.md create mode 100644 docs/examples/functions/list-deployments.md create mode 100644 docs/examples/functions/list-executions.md create mode 100644 docs/examples/functions/list-runtimes.md create mode 100644 docs/examples/functions/list-templates.md create mode 100644 docs/examples/functions/list-variables.md create mode 100644 docs/examples/functions/list.md create mode 100644 docs/examples/functions/update-deployment-build.md create mode 100644 docs/examples/functions/update-deployment.md create mode 100644 docs/examples/functions/update-variable.md create mode 100644 docs/examples/functions/update.md create mode 100644 docs/examples/graphql/mutation.md create mode 100644 docs/examples/graphql/query.md create mode 100644 docs/examples/health/get-antivirus.md create mode 100644 docs/examples/health/get-cache.md create mode 100644 docs/examples/health/get-certificate.md create mode 100644 docs/examples/health/get-d-b.md create mode 100644 docs/examples/health/get-failed-jobs.md create mode 100644 docs/examples/health/get-pub-sub.md create mode 100644 docs/examples/health/get-queue-builds.md create mode 100644 docs/examples/health/get-queue-certificates.md create mode 100644 docs/examples/health/get-queue-databases.md create mode 100644 docs/examples/health/get-queue-deletes.md create mode 100644 docs/examples/health/get-queue-functions.md create mode 100644 docs/examples/health/get-queue-logs.md create mode 100644 docs/examples/health/get-queue-mails.md create mode 100644 docs/examples/health/get-queue-messaging.md create mode 100644 docs/examples/health/get-queue-migrations.md create mode 100644 docs/examples/health/get-queue-usage-dump.md create mode 100644 docs/examples/health/get-queue-usage.md create mode 100644 docs/examples/health/get-queue-webhooks.md create mode 100644 docs/examples/health/get-queue.md create mode 100644 docs/examples/health/get-storage-local.md create mode 100644 docs/examples/health/get-storage.md create mode 100644 docs/examples/health/get-time.md create mode 100644 docs/examples/health/get.md create mode 100644 docs/examples/locale/get.md create mode 100644 docs/examples/locale/list-codes.md create mode 100644 docs/examples/locale/list-continents.md create mode 100644 docs/examples/locale/list-countries-e-u.md create mode 100644 docs/examples/locale/list-countries-phones.md create mode 100644 docs/examples/locale/list-countries.md create mode 100644 docs/examples/locale/list-currencies.md create mode 100644 docs/examples/locale/list-languages.md create mode 100644 docs/examples/messaging/create-apns-provider.md create mode 100644 docs/examples/messaging/create-email.md create mode 100644 docs/examples/messaging/create-fcm-provider.md create mode 100644 docs/examples/messaging/create-mailgun-provider.md create mode 100644 docs/examples/messaging/create-msg91provider.md create mode 100644 docs/examples/messaging/create-push.md create mode 100644 docs/examples/messaging/create-sendgrid-provider.md create mode 100644 docs/examples/messaging/create-sms.md create mode 100644 docs/examples/messaging/create-smtp-provider.md create mode 100644 docs/examples/messaging/create-subscriber.md create mode 100644 docs/examples/messaging/create-telesign-provider.md create mode 100644 docs/examples/messaging/create-textmagic-provider.md create mode 100644 docs/examples/messaging/create-topic.md create mode 100644 docs/examples/messaging/create-twilio-provider.md create mode 100644 docs/examples/messaging/create-vonage-provider.md create mode 100644 docs/examples/messaging/delete-provider.md create mode 100644 docs/examples/messaging/delete-subscriber.md create mode 100644 docs/examples/messaging/delete-topic.md create mode 100644 docs/examples/messaging/delete.md create mode 100644 docs/examples/messaging/get-message.md create mode 100644 docs/examples/messaging/get-provider.md create mode 100644 docs/examples/messaging/get-subscriber.md create mode 100644 docs/examples/messaging/get-topic.md create mode 100644 docs/examples/messaging/list-message-logs.md create mode 100644 docs/examples/messaging/list-messages.md create mode 100644 docs/examples/messaging/list-provider-logs.md create mode 100644 docs/examples/messaging/list-providers.md create mode 100644 docs/examples/messaging/list-subscriber-logs.md create mode 100644 docs/examples/messaging/list-subscribers.md create mode 100644 docs/examples/messaging/list-targets.md create mode 100644 docs/examples/messaging/list-topic-logs.md create mode 100644 docs/examples/messaging/list-topics.md create mode 100644 docs/examples/messaging/update-apns-provider.md create mode 100644 docs/examples/messaging/update-email.md create mode 100644 docs/examples/messaging/update-fcm-provider.md create mode 100644 docs/examples/messaging/update-mailgun-provider.md create mode 100644 docs/examples/messaging/update-msg91provider.md create mode 100644 docs/examples/messaging/update-push.md create mode 100644 docs/examples/messaging/update-sendgrid-provider.md create mode 100644 docs/examples/messaging/update-sms.md create mode 100644 docs/examples/messaging/update-smtp-provider.md create mode 100644 docs/examples/messaging/update-telesign-provider.md create mode 100644 docs/examples/messaging/update-textmagic-provider.md create mode 100644 docs/examples/messaging/update-topic.md create mode 100644 docs/examples/messaging/update-twilio-provider.md create mode 100644 docs/examples/messaging/update-vonage-provider.md create mode 100644 docs/examples/storage/create-bucket.md create mode 100644 docs/examples/storage/create-file.md create mode 100644 docs/examples/storage/delete-bucket.md create mode 100644 docs/examples/storage/delete-file.md create mode 100644 docs/examples/storage/get-bucket.md create mode 100644 docs/examples/storage/get-file-download.md create mode 100644 docs/examples/storage/get-file-preview.md create mode 100644 docs/examples/storage/get-file-view.md create mode 100644 docs/examples/storage/get-file.md create mode 100644 docs/examples/storage/list-buckets.md create mode 100644 docs/examples/storage/list-files.md create mode 100644 docs/examples/storage/update-bucket.md create mode 100644 docs/examples/storage/update-file.md create mode 100644 docs/examples/teams/create-membership.md create mode 100644 docs/examples/teams/create.md create mode 100644 docs/examples/teams/delete-membership.md create mode 100644 docs/examples/teams/delete.md create mode 100644 docs/examples/teams/get-membership.md create mode 100644 docs/examples/teams/get-prefs.md create mode 100644 docs/examples/teams/get.md create mode 100644 docs/examples/teams/list-memberships.md create mode 100644 docs/examples/teams/list.md create mode 100644 docs/examples/teams/update-membership-status.md create mode 100644 docs/examples/teams/update-membership.md create mode 100644 docs/examples/teams/update-name.md create mode 100644 docs/examples/teams/update-prefs.md create mode 100644 docs/examples/users/create-argon2user.md create mode 100644 docs/examples/users/create-bcrypt-user.md create mode 100644 docs/examples/users/create-j-w-t.md create mode 100644 docs/examples/users/create-m-d5user.md create mode 100644 docs/examples/users/create-mfa-recovery-codes.md create mode 100644 docs/examples/users/create-p-h-pass-user.md create mode 100644 docs/examples/users/create-s-h-a-user.md create mode 100644 docs/examples/users/create-scrypt-modified-user.md create mode 100644 docs/examples/users/create-scrypt-user.md create mode 100644 docs/examples/users/create-session.md create mode 100644 docs/examples/users/create-target.md create mode 100644 docs/examples/users/create-token.md create mode 100644 docs/examples/users/create.md create mode 100644 docs/examples/users/delete-identity.md create mode 100644 docs/examples/users/delete-mfa-authenticator.md create mode 100644 docs/examples/users/delete-session.md create mode 100644 docs/examples/users/delete-sessions.md create mode 100644 docs/examples/users/delete-target.md create mode 100644 docs/examples/users/delete.md create mode 100644 docs/examples/users/get-mfa-recovery-codes.md create mode 100644 docs/examples/users/get-prefs.md create mode 100644 docs/examples/users/get-target.md create mode 100644 docs/examples/users/get.md create mode 100644 docs/examples/users/list-identities.md create mode 100644 docs/examples/users/list-logs.md create mode 100644 docs/examples/users/list-memberships.md create mode 100644 docs/examples/users/list-mfa-factors.md create mode 100644 docs/examples/users/list-sessions.md create mode 100644 docs/examples/users/list-targets.md create mode 100644 docs/examples/users/list.md create mode 100644 docs/examples/users/update-email-verification.md create mode 100644 docs/examples/users/update-email.md create mode 100644 docs/examples/users/update-labels.md create mode 100644 docs/examples/users/update-mfa-recovery-codes.md create mode 100644 docs/examples/users/update-mfa.md create mode 100644 docs/examples/users/update-name.md create mode 100644 docs/examples/users/update-password.md create mode 100644 docs/examples/users/update-phone-verification.md create mode 100644 docs/examples/users/update-phone.md create mode 100644 docs/examples/users/update-prefs.md create mode 100644 docs/examples/users/update-status.md create mode 100644 docs/examples/users/update-target.md create mode 100644 docs/functions.md create mode 100644 docs/graphql.md create mode 100644 docs/health.md create mode 100644 docs/locale.md create mode 100644 docs/messaging.md create mode 100644 docs/storage.md create mode 100644 docs/teams.md create mode 100644 docs/users.md create mode 100644 src/Appwrite/AppwriteException.php create mode 100644 src/Appwrite/Client.php create mode 100644 src/Appwrite/Enums/AuthenticationFactor.php create mode 100644 src/Appwrite/Enums/AuthenticatorType.php create mode 100644 src/Appwrite/Enums/Browser.php create mode 100644 src/Appwrite/Enums/Compression.php create mode 100644 src/Appwrite/Enums/CreditCard.php create mode 100644 src/Appwrite/Enums/ExecutionMethod.php create mode 100644 src/Appwrite/Enums/Flag.php create mode 100644 src/Appwrite/Enums/ImageFormat.php create mode 100644 src/Appwrite/Enums/ImageGravity.php create mode 100644 src/Appwrite/Enums/IndexType.php create mode 100644 src/Appwrite/Enums/MessagingProviderType.php create mode 100644 src/Appwrite/Enums/Name.php create mode 100644 src/Appwrite/Enums/OAuthProvider.php create mode 100644 src/Appwrite/Enums/PasswordHash.php create mode 100644 src/Appwrite/Enums/RelationMutate.php create mode 100644 src/Appwrite/Enums/RelationshipType.php create mode 100644 src/Appwrite/Enums/Runtime.php create mode 100644 src/Appwrite/Enums/SmtpEncryption.php create mode 100644 src/Appwrite/ID.php create mode 100644 src/Appwrite/InputFile.php create mode 100644 src/Appwrite/Permission.php create mode 100644 src/Appwrite/Query.php create mode 100644 src/Appwrite/Role.php create mode 100644 src/Appwrite/Service.php create mode 100644 src/Appwrite/Services/Account.php create mode 100644 src/Appwrite/Services/Avatars.php create mode 100644 src/Appwrite/Services/Databases.php create mode 100644 src/Appwrite/Services/Functions.php create mode 100644 src/Appwrite/Services/Graphql.php create mode 100644 src/Appwrite/Services/Health.php create mode 100644 src/Appwrite/Services/Locale.php create mode 100644 src/Appwrite/Services/Messaging.php create mode 100644 src/Appwrite/Services/Storage.php create mode 100644 src/Appwrite/Services/Teams.php create mode 100644 src/Appwrite/Services/Users.php create mode 100644 tests/Appwrite/IDTest.php create mode 100644 tests/Appwrite/PermissionTest.php create mode 100644 tests/Appwrite/QueryTest.php create mode 100644 tests/Appwrite/RoleTest.php create mode 100644 tests/Appwrite/Services/AccountTest.php create mode 100644 tests/Appwrite/Services/AvatarsTest.php create mode 100644 tests/Appwrite/Services/DatabasesTest.php create mode 100644 tests/Appwrite/Services/FunctionsTest.php create mode 100644 tests/Appwrite/Services/GraphqlTest.php create mode 100644 tests/Appwrite/Services/HealthTest.php create mode 100644 tests/Appwrite/Services/LocaleTest.php create mode 100644 tests/Appwrite/Services/MessagingTest.php create mode 100644 tests/Appwrite/Services/StorageTest.php create mode 100644 tests/Appwrite/Services/TeamsTest.php create mode 100644 tests/Appwrite/Services/UsersTest.php diff --git a/docs/examples/account/create-anonymous-session.md b/docs/examples/account/create-anonymous-session.md new file mode 100644 index 0000000..c43c60e --- /dev/null +++ b/docs/examples/account/create-anonymous-session.md @@ -0,0 +1,12 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID + +$account = new Account($client); + +$result = $account->createAnonymousSession(); diff --git a/docs/examples/account/create-email-password-session.md b/docs/examples/account/create-email-password-session.md new file mode 100644 index 0000000..faefc33 --- /dev/null +++ b/docs/examples/account/create-email-password-session.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID + +$account = new Account($client); + +$result = $account->createEmailPasswordSession( + email: 'email@example.com', + password: 'password' +); \ No newline at end of file diff --git a/docs/examples/account/create-email-token.md b/docs/examples/account/create-email-token.md new file mode 100644 index 0000000..68dd7f4 --- /dev/null +++ b/docs/examples/account/create-email-token.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID + +$account = new Account($client); + +$result = $account->createEmailToken( + userId: '<USER_ID>', + email: 'email@example.com', + phrase: false // optional +); \ No newline at end of file diff --git a/docs/examples/account/create-j-w-t.md b/docs/examples/account/create-j-w-t.md new file mode 100644 index 0000000..33479c4 --- /dev/null +++ b/docs/examples/account/create-j-w-t.md @@ -0,0 +1,12 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID + +$account = new Account($client); + +$result = $account->createJWT(); diff --git a/docs/examples/account/create-magic-u-r-l-token.md b/docs/examples/account/create-magic-u-r-l-token.md new file mode 100644 index 0000000..f75991c --- /dev/null +++ b/docs/examples/account/create-magic-u-r-l-token.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID + +$account = new Account($client); + +$result = $account->createMagicURLToken( + userId: '<USER_ID>', + email: 'email@example.com', + url: 'https://example.com', // optional + phrase: false // optional +); \ No newline at end of file diff --git a/docs/examples/account/create-mfa-authenticator.md b/docs/examples/account/create-mfa-authenticator.md new file mode 100644 index 0000000..95fca46 --- /dev/null +++ b/docs/examples/account/create-mfa-authenticator.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; +use Appwrite\Enums\AuthenticatorType; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->createMfaAuthenticator( + type: AuthenticatorType::TOTP() +); \ No newline at end of file diff --git a/docs/examples/account/create-mfa-challenge.md b/docs/examples/account/create-mfa-challenge.md new file mode 100644 index 0000000..34bd063 --- /dev/null +++ b/docs/examples/account/create-mfa-challenge.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; +use Appwrite\Enums\AuthenticationFactor; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID + +$account = new Account($client); + +$result = $account->createMfaChallenge( + factor: AuthenticationFactor::EMAIL() +); \ No newline at end of file diff --git a/docs/examples/account/create-mfa-recovery-codes.md b/docs/examples/account/create-mfa-recovery-codes.md new file mode 100644 index 0000000..c474967 --- /dev/null +++ b/docs/examples/account/create-mfa-recovery-codes.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->createMfaRecoveryCodes(); diff --git a/docs/examples/account/create-o-auth2token.md b/docs/examples/account/create-o-auth2token.md new file mode 100644 index 0000000..0411d6f --- /dev/null +++ b/docs/examples/account/create-o-auth2token.md @@ -0,0 +1,18 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; +use Appwrite\Enums\OAuthProvider; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID + +$account = new Account($client); + +$result = $account->createOAuth2Token( + provider: OAuthProvider::AMAZON(), + success: 'https://example.com', // optional + failure: 'https://example.com', // optional + scopes: [] // optional +); \ No newline at end of file diff --git a/docs/examples/account/create-phone-token.md b/docs/examples/account/create-phone-token.md new file mode 100644 index 0000000..e5724d3 --- /dev/null +++ b/docs/examples/account/create-phone-token.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID + +$account = new Account($client); + +$result = $account->createPhoneToken( + userId: '<USER_ID>', + phone: '+12065550100' +); \ No newline at end of file diff --git a/docs/examples/account/create-phone-verification.md b/docs/examples/account/create-phone-verification.md new file mode 100644 index 0000000..e681607 --- /dev/null +++ b/docs/examples/account/create-phone-verification.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->createPhoneVerification(); diff --git a/docs/examples/account/create-recovery.md b/docs/examples/account/create-recovery.md new file mode 100644 index 0000000..86cc2d9 --- /dev/null +++ b/docs/examples/account/create-recovery.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->createRecovery( + email: 'email@example.com', + url: 'https://example.com' +); \ No newline at end of file diff --git a/docs/examples/account/create-session.md b/docs/examples/account/create-session.md new file mode 100644 index 0000000..e714d11 --- /dev/null +++ b/docs/examples/account/create-session.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID + +$account = new Account($client); + +$result = $account->createSession( + userId: '<USER_ID>', + secret: '<SECRET>' +); \ No newline at end of file diff --git a/docs/examples/account/create-verification.md b/docs/examples/account/create-verification.md new file mode 100644 index 0000000..9541956 --- /dev/null +++ b/docs/examples/account/create-verification.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->createVerification( + url: 'https://example.com' +); \ No newline at end of file diff --git a/docs/examples/account/create.md b/docs/examples/account/create.md new file mode 100644 index 0000000..b4bc9df --- /dev/null +++ b/docs/examples/account/create.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID + +$account = new Account($client); + +$result = $account->create( + userId: '<USER_ID>', + email: 'email@example.com', + password: '', + name: '<NAME>' // optional +); \ No newline at end of file diff --git a/docs/examples/account/delete-identity.md b/docs/examples/account/delete-identity.md new file mode 100644 index 0000000..dc7f751 --- /dev/null +++ b/docs/examples/account/delete-identity.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->deleteIdentity( + identityId: '<IDENTITY_ID>' +); \ No newline at end of file diff --git a/docs/examples/account/delete-mfa-authenticator.md b/docs/examples/account/delete-mfa-authenticator.md new file mode 100644 index 0000000..a0574c5 --- /dev/null +++ b/docs/examples/account/delete-mfa-authenticator.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; +use Appwrite\Enums\AuthenticatorType; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->deleteMfaAuthenticator( + type: AuthenticatorType::TOTP() +); \ No newline at end of file diff --git a/docs/examples/account/delete-session.md b/docs/examples/account/delete-session.md new file mode 100644 index 0000000..e52d95e --- /dev/null +++ b/docs/examples/account/delete-session.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->deleteSession( + sessionId: '<SESSION_ID>' +); \ No newline at end of file diff --git a/docs/examples/account/delete-sessions.md b/docs/examples/account/delete-sessions.md new file mode 100644 index 0000000..a493317 --- /dev/null +++ b/docs/examples/account/delete-sessions.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->deleteSessions(); diff --git a/docs/examples/account/get-mfa-recovery-codes.md b/docs/examples/account/get-mfa-recovery-codes.md new file mode 100644 index 0000000..f640e9e --- /dev/null +++ b/docs/examples/account/get-mfa-recovery-codes.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->getMfaRecoveryCodes(); diff --git a/docs/examples/account/get-prefs.md b/docs/examples/account/get-prefs.md new file mode 100644 index 0000000..f6489fc --- /dev/null +++ b/docs/examples/account/get-prefs.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->getPrefs(); diff --git a/docs/examples/account/get-session.md b/docs/examples/account/get-session.md new file mode 100644 index 0000000..17bf7f7 --- /dev/null +++ b/docs/examples/account/get-session.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->getSession( + sessionId: '<SESSION_ID>' +); \ No newline at end of file diff --git a/docs/examples/account/get.md b/docs/examples/account/get.md new file mode 100644 index 0000000..8a36274 --- /dev/null +++ b/docs/examples/account/get.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->get(); diff --git a/docs/examples/account/list-identities.md b/docs/examples/account/list-identities.md new file mode 100644 index 0000000..78c6dd3 --- /dev/null +++ b/docs/examples/account/list-identities.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->listIdentities( + queries: [] // optional +); \ No newline at end of file diff --git a/docs/examples/account/list-logs.md b/docs/examples/account/list-logs.md new file mode 100644 index 0000000..0dcdb3b --- /dev/null +++ b/docs/examples/account/list-logs.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->listLogs( + queries: [] // optional +); \ No newline at end of file diff --git a/docs/examples/account/list-mfa-factors.md b/docs/examples/account/list-mfa-factors.md new file mode 100644 index 0000000..e029574 --- /dev/null +++ b/docs/examples/account/list-mfa-factors.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->listMfaFactors(); diff --git a/docs/examples/account/list-sessions.md b/docs/examples/account/list-sessions.md new file mode 100644 index 0000000..28f2823 --- /dev/null +++ b/docs/examples/account/list-sessions.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->listSessions(); diff --git a/docs/examples/account/update-email.md b/docs/examples/account/update-email.md new file mode 100644 index 0000000..60cb7cc --- /dev/null +++ b/docs/examples/account/update-email.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->updateEmail( + email: 'email@example.com', + password: 'password' +); \ No newline at end of file diff --git a/docs/examples/account/update-m-f-a.md b/docs/examples/account/update-m-f-a.md new file mode 100644 index 0000000..1869f7e --- /dev/null +++ b/docs/examples/account/update-m-f-a.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->updateMFA( + mfa: false +); \ No newline at end of file diff --git a/docs/examples/account/update-magic-u-r-l-session.md b/docs/examples/account/update-magic-u-r-l-session.md new file mode 100644 index 0000000..d5e1a9f --- /dev/null +++ b/docs/examples/account/update-magic-u-r-l-session.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID + +$account = new Account($client); + +$result = $account->updateMagicURLSession( + userId: '<USER_ID>', + secret: '<SECRET>' +); \ No newline at end of file diff --git a/docs/examples/account/update-mfa-authenticator.md b/docs/examples/account/update-mfa-authenticator.md new file mode 100644 index 0000000..f998c23 --- /dev/null +++ b/docs/examples/account/update-mfa-authenticator.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; +use Appwrite\Enums\AuthenticatorType; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->updateMfaAuthenticator( + type: AuthenticatorType::TOTP(), + otp: '<OTP>' +); \ No newline at end of file diff --git a/docs/examples/account/update-mfa-challenge.md b/docs/examples/account/update-mfa-challenge.md new file mode 100644 index 0000000..62124c5 --- /dev/null +++ b/docs/examples/account/update-mfa-challenge.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->updateMfaChallenge( + challengeId: '<CHALLENGE_ID>', + otp: '<OTP>' +); \ No newline at end of file diff --git a/docs/examples/account/update-mfa-recovery-codes.md b/docs/examples/account/update-mfa-recovery-codes.md new file mode 100644 index 0000000..7babcac --- /dev/null +++ b/docs/examples/account/update-mfa-recovery-codes.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->updateMfaRecoveryCodes(); diff --git a/docs/examples/account/update-name.md b/docs/examples/account/update-name.md new file mode 100644 index 0000000..4e0f1cb --- /dev/null +++ b/docs/examples/account/update-name.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->updateName( + name: '<NAME>' +); \ No newline at end of file diff --git a/docs/examples/account/update-password.md b/docs/examples/account/update-password.md new file mode 100644 index 0000000..e438d2b --- /dev/null +++ b/docs/examples/account/update-password.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->updatePassword( + password: '', + oldPassword: 'password' // optional +); \ No newline at end of file diff --git a/docs/examples/account/update-phone-session.md b/docs/examples/account/update-phone-session.md new file mode 100644 index 0000000..2951815 --- /dev/null +++ b/docs/examples/account/update-phone-session.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID + +$account = new Account($client); + +$result = $account->updatePhoneSession( + userId: '<USER_ID>', + secret: '<SECRET>' +); \ No newline at end of file diff --git a/docs/examples/account/update-phone-verification.md b/docs/examples/account/update-phone-verification.md new file mode 100644 index 0000000..6b95838 --- /dev/null +++ b/docs/examples/account/update-phone-verification.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->updatePhoneVerification( + userId: '<USER_ID>', + secret: '<SECRET>' +); \ No newline at end of file diff --git a/docs/examples/account/update-phone.md b/docs/examples/account/update-phone.md new file mode 100644 index 0000000..85cff81 --- /dev/null +++ b/docs/examples/account/update-phone.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->updatePhone( + phone: '+12065550100', + password: 'password' +); \ No newline at end of file diff --git a/docs/examples/account/update-prefs.md b/docs/examples/account/update-prefs.md new file mode 100644 index 0000000..c47859b --- /dev/null +++ b/docs/examples/account/update-prefs.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->updatePrefs( + prefs: [] +); \ No newline at end of file diff --git a/docs/examples/account/update-recovery.md b/docs/examples/account/update-recovery.md new file mode 100644 index 0000000..5400fb5 --- /dev/null +++ b/docs/examples/account/update-recovery.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->updateRecovery( + userId: '<USER_ID>', + secret: '<SECRET>', + password: '' +); \ No newline at end of file diff --git a/docs/examples/account/update-session.md b/docs/examples/account/update-session.md new file mode 100644 index 0000000..1a4611c --- /dev/null +++ b/docs/examples/account/update-session.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->updateSession( + sessionId: '<SESSION_ID>' +); \ No newline at end of file diff --git a/docs/examples/account/update-status.md b/docs/examples/account/update-status.md new file mode 100644 index 0000000..8511b2f --- /dev/null +++ b/docs/examples/account/update-status.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->updateStatus(); diff --git a/docs/examples/account/update-verification.md b/docs/examples/account/update-verification.md new file mode 100644 index 0000000..253693e --- /dev/null +++ b/docs/examples/account/update-verification.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->updateVerification( + userId: '<USER_ID>', + secret: '<SECRET>' +); \ No newline at end of file diff --git a/docs/examples/avatars/get-browser.md b/docs/examples/avatars/get-browser.md new file mode 100644 index 0000000..47a6c85 --- /dev/null +++ b/docs/examples/avatars/get-browser.md @@ -0,0 +1,19 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Avatars; +use Appwrite\Enums\Browser; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$avatars = new Avatars($client); + +$result = $avatars->getBrowser( + code: Browser::AVANTBROWSER(), + width: 0, // optional + height: 0, // optional + quality: 0 // optional +); \ No newline at end of file diff --git a/docs/examples/avatars/get-credit-card.md b/docs/examples/avatars/get-credit-card.md new file mode 100644 index 0000000..c1b6b15 --- /dev/null +++ b/docs/examples/avatars/get-credit-card.md @@ -0,0 +1,19 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Avatars; +use Appwrite\Enums\CreditCard; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$avatars = new Avatars($client); + +$result = $avatars->getCreditCard( + code: CreditCard::AMERICANEXPRESS(), + width: 0, // optional + height: 0, // optional + quality: 0 // optional +); \ No newline at end of file diff --git a/docs/examples/avatars/get-favicon.md b/docs/examples/avatars/get-favicon.md new file mode 100644 index 0000000..50bb5c4 --- /dev/null +++ b/docs/examples/avatars/get-favicon.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Avatars; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$avatars = new Avatars($client); + +$result = $avatars->getFavicon( + url: 'https://example.com' +); \ No newline at end of file diff --git a/docs/examples/avatars/get-flag.md b/docs/examples/avatars/get-flag.md new file mode 100644 index 0000000..c163dea --- /dev/null +++ b/docs/examples/avatars/get-flag.md @@ -0,0 +1,19 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Avatars; +use Appwrite\Enums\Flag; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$avatars = new Avatars($client); + +$result = $avatars->getFlag( + code: Flag::AFGHANISTAN(), + width: 0, // optional + height: 0, // optional + quality: 0 // optional +); \ No newline at end of file diff --git a/docs/examples/avatars/get-image.md b/docs/examples/avatars/get-image.md new file mode 100644 index 0000000..31d2bbf --- /dev/null +++ b/docs/examples/avatars/get-image.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Avatars; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$avatars = new Avatars($client); + +$result = $avatars->getImage( + url: 'https://example.com', + width: 0, // optional + height: 0 // optional +); \ No newline at end of file diff --git a/docs/examples/avatars/get-initials.md b/docs/examples/avatars/get-initials.md new file mode 100644 index 0000000..6a94e05 --- /dev/null +++ b/docs/examples/avatars/get-initials.md @@ -0,0 +1,18 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Avatars; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$avatars = new Avatars($client); + +$result = $avatars->getInitials( + name: '<NAME>', // optional + width: 0, // optional + height: 0, // optional + background: '' // optional +); \ No newline at end of file diff --git a/docs/examples/avatars/get-q-r.md b/docs/examples/avatars/get-q-r.md new file mode 100644 index 0000000..48f0008 --- /dev/null +++ b/docs/examples/avatars/get-q-r.md @@ -0,0 +1,18 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Avatars; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$avatars = new Avatars($client); + +$result = $avatars->getQR( + text: '<TEXT>', + size: 1, // optional + margin: 0, // optional + download: false // optional +); \ No newline at end of file diff --git a/docs/examples/databases/create-boolean-attribute.md b/docs/examples/databases/create-boolean-attribute.md new file mode 100644 index 0000000..27eba02 --- /dev/null +++ b/docs/examples/databases/create-boolean-attribute.md @@ -0,0 +1,20 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->createBooleanAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + default: false, // optional + array: false // optional +); \ No newline at end of file diff --git a/docs/examples/databases/create-collection.md b/docs/examples/databases/create-collection.md new file mode 100644 index 0000000..72d36d2 --- /dev/null +++ b/docs/examples/databases/create-collection.md @@ -0,0 +1,20 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->createCollection( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + name: '<NAME>', + permissions: ["read("any")"], // optional + documentSecurity: false, // optional + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/databases/create-datetime-attribute.md b/docs/examples/databases/create-datetime-attribute.md new file mode 100644 index 0000000..a959381 --- /dev/null +++ b/docs/examples/databases/create-datetime-attribute.md @@ -0,0 +1,20 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->createDatetimeAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + default: '', // optional + array: false // optional +); \ No newline at end of file diff --git a/docs/examples/databases/create-document.md b/docs/examples/databases/create-document.md new file mode 100644 index 0000000..612b114 --- /dev/null +++ b/docs/examples/databases/create-document.md @@ -0,0 +1,19 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$databases = new Databases($client); + +$result = $databases->createDocument( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + documentId: '<DOCUMENT_ID>', + data: [], + permissions: ["read("any")"] // optional +); \ No newline at end of file diff --git a/docs/examples/databases/create-email-attribute.md b/docs/examples/databases/create-email-attribute.md new file mode 100644 index 0000000..a72a42f --- /dev/null +++ b/docs/examples/databases/create-email-attribute.md @@ -0,0 +1,20 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->createEmailAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + default: 'email@example.com', // optional + array: false // optional +); \ No newline at end of file diff --git a/docs/examples/databases/create-enum-attribute.md b/docs/examples/databases/create-enum-attribute.md new file mode 100644 index 0000000..2d6e3fb --- /dev/null +++ b/docs/examples/databases/create-enum-attribute.md @@ -0,0 +1,21 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->createEnumAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + elements: [], + required: false, + default: '<DEFAULT>', // optional + array: false // optional +); \ No newline at end of file diff --git a/docs/examples/databases/create-float-attribute.md b/docs/examples/databases/create-float-attribute.md new file mode 100644 index 0000000..83f42ea --- /dev/null +++ b/docs/examples/databases/create-float-attribute.md @@ -0,0 +1,22 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->createFloatAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + min: null, // optional + max: null, // optional + default: null, // optional + array: false // optional +); \ No newline at end of file diff --git a/docs/examples/databases/create-index.md b/docs/examples/databases/create-index.md new file mode 100644 index 0000000..e795271 --- /dev/null +++ b/docs/examples/databases/create-index.md @@ -0,0 +1,21 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; +use Appwrite\Enums\IndexType; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->createIndex( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + type: IndexType::KEY(), + attributes: [], + orders: [] // optional +); \ No newline at end of file diff --git a/docs/examples/databases/create-integer-attribute.md b/docs/examples/databases/create-integer-attribute.md new file mode 100644 index 0000000..5abc89c --- /dev/null +++ b/docs/examples/databases/create-integer-attribute.md @@ -0,0 +1,22 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->createIntegerAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + min: null, // optional + max: null, // optional + default: null, // optional + array: false // optional +); \ No newline at end of file diff --git a/docs/examples/databases/create-ip-attribute.md b/docs/examples/databases/create-ip-attribute.md new file mode 100644 index 0000000..04c70f9 --- /dev/null +++ b/docs/examples/databases/create-ip-attribute.md @@ -0,0 +1,20 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->createIpAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + default: '', // optional + array: false // optional +); \ No newline at end of file diff --git a/docs/examples/databases/create-relationship-attribute.md b/docs/examples/databases/create-relationship-attribute.md new file mode 100644 index 0000000..2e0ba64 --- /dev/null +++ b/docs/examples/databases/create-relationship-attribute.md @@ -0,0 +1,23 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; +use Appwrite\Enums\RelationshipType; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->createRelationshipAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + relatedCollectionId: '<RELATED_COLLECTION_ID>', + type: RelationshipType::ONETOONE(), + twoWay: false, // optional + key: '', // optional + twoWayKey: '', // optional + onDelete: RelationMutate::CASCADE() // optional +); \ No newline at end of file diff --git a/docs/examples/databases/create-string-attribute.md b/docs/examples/databases/create-string-attribute.md new file mode 100644 index 0000000..450c9bc --- /dev/null +++ b/docs/examples/databases/create-string-attribute.md @@ -0,0 +1,22 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->createStringAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + size: 1, + required: false, + default: '<DEFAULT>', // optional + array: false, // optional + encrypt: false // optional +); \ No newline at end of file diff --git a/docs/examples/databases/create-url-attribute.md b/docs/examples/databases/create-url-attribute.md new file mode 100644 index 0000000..e7a40b7 --- /dev/null +++ b/docs/examples/databases/create-url-attribute.md @@ -0,0 +1,20 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->createUrlAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + default: 'https://example.com', // optional + array: false // optional +); \ No newline at end of file diff --git a/docs/examples/databases/create.md b/docs/examples/databases/create.md new file mode 100644 index 0000000..da4a650 --- /dev/null +++ b/docs/examples/databases/create.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->create( + databaseId: '<DATABASE_ID>', + name: '<NAME>', + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/databases/delete-attribute.md b/docs/examples/databases/delete-attribute.md new file mode 100644 index 0000000..e60d39f --- /dev/null +++ b/docs/examples/databases/delete-attribute.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->deleteAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '' +); \ No newline at end of file diff --git a/docs/examples/databases/delete-collection.md b/docs/examples/databases/delete-collection.md new file mode 100644 index 0000000..ce821e7 --- /dev/null +++ b/docs/examples/databases/delete-collection.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->deleteCollection( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>' +); \ No newline at end of file diff --git a/docs/examples/databases/delete-document.md b/docs/examples/databases/delete-document.md new file mode 100644 index 0000000..536cdcd --- /dev/null +++ b/docs/examples/databases/delete-document.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$databases = new Databases($client); + +$result = $databases->deleteDocument( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + documentId: '<DOCUMENT_ID>' +); \ No newline at end of file diff --git a/docs/examples/databases/delete-index.md b/docs/examples/databases/delete-index.md new file mode 100644 index 0000000..cb9ddf9 --- /dev/null +++ b/docs/examples/databases/delete-index.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->deleteIndex( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '' +); \ No newline at end of file diff --git a/docs/examples/databases/delete.md b/docs/examples/databases/delete.md new file mode 100644 index 0000000..5b1a322 --- /dev/null +++ b/docs/examples/databases/delete.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->delete( + databaseId: '<DATABASE_ID>' +); \ No newline at end of file diff --git a/docs/examples/databases/get-attribute.md b/docs/examples/databases/get-attribute.md new file mode 100644 index 0000000..671f9ac --- /dev/null +++ b/docs/examples/databases/get-attribute.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->getAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '' +); \ No newline at end of file diff --git a/docs/examples/databases/get-collection.md b/docs/examples/databases/get-collection.md new file mode 100644 index 0000000..23df77b --- /dev/null +++ b/docs/examples/databases/get-collection.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->getCollection( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>' +); \ No newline at end of file diff --git a/docs/examples/databases/get-document.md b/docs/examples/databases/get-document.md new file mode 100644 index 0000000..bee705f --- /dev/null +++ b/docs/examples/databases/get-document.md @@ -0,0 +1,18 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$databases = new Databases($client); + +$result = $databases->getDocument( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + documentId: '<DOCUMENT_ID>', + queries: [] // optional +); \ No newline at end of file diff --git a/docs/examples/databases/get-index.md b/docs/examples/databases/get-index.md new file mode 100644 index 0000000..b5878dd --- /dev/null +++ b/docs/examples/databases/get-index.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->getIndex( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '' +); \ No newline at end of file diff --git a/docs/examples/databases/get.md b/docs/examples/databases/get.md new file mode 100644 index 0000000..4838b0b --- /dev/null +++ b/docs/examples/databases/get.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->get( + databaseId: '<DATABASE_ID>' +); \ No newline at end of file diff --git a/docs/examples/databases/list-attributes.md b/docs/examples/databases/list-attributes.md new file mode 100644 index 0000000..6b1834f --- /dev/null +++ b/docs/examples/databases/list-attributes.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->listAttributes( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + queries: [] // optional +); \ No newline at end of file diff --git a/docs/examples/databases/list-collections.md b/docs/examples/databases/list-collections.md new file mode 100644 index 0000000..045aece --- /dev/null +++ b/docs/examples/databases/list-collections.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->listCollections( + databaseId: '<DATABASE_ID>', + queries: [], // optional + search: '<SEARCH>' // optional +); \ No newline at end of file diff --git a/docs/examples/databases/list-documents.md b/docs/examples/databases/list-documents.md new file mode 100644 index 0000000..c865f32 --- /dev/null +++ b/docs/examples/databases/list-documents.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$databases = new Databases($client); + +$result = $databases->listDocuments( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + queries: [] // optional +); \ No newline at end of file diff --git a/docs/examples/databases/list-indexes.md b/docs/examples/databases/list-indexes.md new file mode 100644 index 0000000..fee8e8f --- /dev/null +++ b/docs/examples/databases/list-indexes.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->listIndexes( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + queries: [] // optional +); \ No newline at end of file diff --git a/docs/examples/databases/list.md b/docs/examples/databases/list.md new file mode 100644 index 0000000..ea89f25 --- /dev/null +++ b/docs/examples/databases/list.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->list( + queries: [], // optional + search: '<SEARCH>' // optional +); \ No newline at end of file diff --git a/docs/examples/databases/update-boolean-attribute.md b/docs/examples/databases/update-boolean-attribute.md new file mode 100644 index 0000000..a599d60 --- /dev/null +++ b/docs/examples/databases/update-boolean-attribute.md @@ -0,0 +1,19 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->updateBooleanAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + default: false +); \ No newline at end of file diff --git a/docs/examples/databases/update-collection.md b/docs/examples/databases/update-collection.md new file mode 100644 index 0000000..70b052d --- /dev/null +++ b/docs/examples/databases/update-collection.md @@ -0,0 +1,20 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->updateCollection( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + name: '<NAME>', + permissions: ["read("any")"], // optional + documentSecurity: false, // optional + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/databases/update-datetime-attribute.md b/docs/examples/databases/update-datetime-attribute.md new file mode 100644 index 0000000..f0e92cf --- /dev/null +++ b/docs/examples/databases/update-datetime-attribute.md @@ -0,0 +1,19 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->updateDatetimeAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + default: '' +); \ No newline at end of file diff --git a/docs/examples/databases/update-document.md b/docs/examples/databases/update-document.md new file mode 100644 index 0000000..5af2f55 --- /dev/null +++ b/docs/examples/databases/update-document.md @@ -0,0 +1,19 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$databases = new Databases($client); + +$result = $databases->updateDocument( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + documentId: '<DOCUMENT_ID>', + data: [], // optional + permissions: ["read("any")"] // optional +); \ No newline at end of file diff --git a/docs/examples/databases/update-email-attribute.md b/docs/examples/databases/update-email-attribute.md new file mode 100644 index 0000000..8398758 --- /dev/null +++ b/docs/examples/databases/update-email-attribute.md @@ -0,0 +1,19 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->updateEmailAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + default: 'email@example.com' +); \ No newline at end of file diff --git a/docs/examples/databases/update-enum-attribute.md b/docs/examples/databases/update-enum-attribute.md new file mode 100644 index 0000000..0bd7db5 --- /dev/null +++ b/docs/examples/databases/update-enum-attribute.md @@ -0,0 +1,20 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->updateEnumAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + elements: [], + required: false, + default: '<DEFAULT>' +); \ No newline at end of file diff --git a/docs/examples/databases/update-float-attribute.md b/docs/examples/databases/update-float-attribute.md new file mode 100644 index 0000000..32c3ba4 --- /dev/null +++ b/docs/examples/databases/update-float-attribute.md @@ -0,0 +1,21 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->updateFloatAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + min: null, + max: null, + default: null +); \ No newline at end of file diff --git a/docs/examples/databases/update-integer-attribute.md b/docs/examples/databases/update-integer-attribute.md new file mode 100644 index 0000000..2233cc0 --- /dev/null +++ b/docs/examples/databases/update-integer-attribute.md @@ -0,0 +1,21 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->updateIntegerAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + min: null, + max: null, + default: null +); \ No newline at end of file diff --git a/docs/examples/databases/update-ip-attribute.md b/docs/examples/databases/update-ip-attribute.md new file mode 100644 index 0000000..a953ae1 --- /dev/null +++ b/docs/examples/databases/update-ip-attribute.md @@ -0,0 +1,19 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->updateIpAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + default: '' +); \ No newline at end of file diff --git a/docs/examples/databases/update-relationship-attribute.md b/docs/examples/databases/update-relationship-attribute.md new file mode 100644 index 0000000..e4e16df --- /dev/null +++ b/docs/examples/databases/update-relationship-attribute.md @@ -0,0 +1,18 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->updateRelationshipAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + onDelete: RelationMutate::CASCADE() // optional +); \ No newline at end of file diff --git a/docs/examples/databases/update-string-attribute.md b/docs/examples/databases/update-string-attribute.md new file mode 100644 index 0000000..b1a7ae4 --- /dev/null +++ b/docs/examples/databases/update-string-attribute.md @@ -0,0 +1,19 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->updateStringAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + default: '<DEFAULT>' +); \ No newline at end of file diff --git a/docs/examples/databases/update-url-attribute.md b/docs/examples/databases/update-url-attribute.md new file mode 100644 index 0000000..383d721 --- /dev/null +++ b/docs/examples/databases/update-url-attribute.md @@ -0,0 +1,19 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->updateUrlAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + default: 'https://example.com' +); \ No newline at end of file diff --git a/docs/examples/databases/update.md b/docs/examples/databases/update.md new file mode 100644 index 0000000..68cb214 --- /dev/null +++ b/docs/examples/databases/update.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->update( + databaseId: '<DATABASE_ID>', + name: '<NAME>', + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/functions/create-build.md b/docs/examples/functions/create-build.md new file mode 100644 index 0000000..43c781f --- /dev/null +++ b/docs/examples/functions/create-build.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Functions; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$functions = new Functions($client); + +$result = $functions->createBuild( + functionId: '<FUNCTION_ID>', + deploymentId: '<DEPLOYMENT_ID>', + buildId: '<BUILD_ID>' // optional +); \ No newline at end of file diff --git a/docs/examples/functions/create-deployment.md b/docs/examples/functions/create-deployment.md new file mode 100644 index 0000000..c35b886 --- /dev/null +++ b/docs/examples/functions/create-deployment.md @@ -0,0 +1,20 @@ +<?php + +use Appwrite\Client; +use Appwrite\InputFile; +use Appwrite\Services\Functions; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$functions = new Functions($client); + +$result = $functions->createDeployment( + functionId: '<FUNCTION_ID>', + code: InputFile::withPath('file.png'), + activate: false, + entrypoint: '<ENTRYPOINT>', // optional + commands: '<COMMANDS>' // optional +); \ No newline at end of file diff --git a/docs/examples/functions/create-execution.md b/docs/examples/functions/create-execution.md new file mode 100644 index 0000000..ff531d5 --- /dev/null +++ b/docs/examples/functions/create-execution.md @@ -0,0 +1,21 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Functions; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$functions = new Functions($client); + +$result = $functions->createExecution( + functionId: '<FUNCTION_ID>', + body: '<BODY>', // optional + async: false, // optional + path: '<PATH>', // optional + method: ExecutionMethod::GET(), // optional + headers: [], // optional + scheduledAt: '' // optional +); \ No newline at end of file diff --git a/docs/examples/functions/create-variable.md b/docs/examples/functions/create-variable.md new file mode 100644 index 0000000..441aa9d --- /dev/null +++ b/docs/examples/functions/create-variable.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Functions; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$functions = new Functions($client); + +$result = $functions->createVariable( + functionId: '<FUNCTION_ID>', + key: '<KEY>', + value: '<VALUE>' +); \ No newline at end of file diff --git a/docs/examples/functions/create.md b/docs/examples/functions/create.md new file mode 100644 index 0000000..44ff159 --- /dev/null +++ b/docs/examples/functions/create.md @@ -0,0 +1,36 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Functions; +use Appwrite\Enums\; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$functions = new Functions($client); + +$result = $functions->create( + functionId: '<FUNCTION_ID>', + name: '<NAME>', + runtime: ::NODE145(), + execute: ["any"], // optional + events: [], // optional + schedule: '', // optional + timeout: 1, // optional + enabled: false, // optional + logging: false, // optional + entrypoint: '<ENTRYPOINT>', // optional + commands: '<COMMANDS>', // optional + scopes: [], // optional + installationId: '<INSTALLATION_ID>', // optional + providerRepositoryId: '<PROVIDER_REPOSITORY_ID>', // optional + providerBranch: '<PROVIDER_BRANCH>', // optional + providerSilentMode: false, // optional + providerRootDirectory: '<PROVIDER_ROOT_DIRECTORY>', // optional + templateRepository: '<TEMPLATE_REPOSITORY>', // optional + templateOwner: '<TEMPLATE_OWNER>', // optional + templateRootDirectory: '<TEMPLATE_ROOT_DIRECTORY>', // optional + templateVersion: '<TEMPLATE_VERSION>' // optional +); \ No newline at end of file diff --git a/docs/examples/functions/delete-deployment.md b/docs/examples/functions/delete-deployment.md new file mode 100644 index 0000000..3f00e9d --- /dev/null +++ b/docs/examples/functions/delete-deployment.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Functions; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$functions = new Functions($client); + +$result = $functions->deleteDeployment( + functionId: '<FUNCTION_ID>', + deploymentId: '<DEPLOYMENT_ID>' +); \ No newline at end of file diff --git a/docs/examples/functions/delete-execution.md b/docs/examples/functions/delete-execution.md new file mode 100644 index 0000000..3733583 --- /dev/null +++ b/docs/examples/functions/delete-execution.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Functions; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$functions = new Functions($client); + +$result = $functions->deleteExecution( + functionId: '<FUNCTION_ID>', + executionId: '<EXECUTION_ID>' +); \ No newline at end of file diff --git a/docs/examples/functions/delete-variable.md b/docs/examples/functions/delete-variable.md new file mode 100644 index 0000000..5046e1f --- /dev/null +++ b/docs/examples/functions/delete-variable.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Functions; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$functions = new Functions($client); + +$result = $functions->deleteVariable( + functionId: '<FUNCTION_ID>', + variableId: '<VARIABLE_ID>' +); \ No newline at end of file diff --git a/docs/examples/functions/delete.md b/docs/examples/functions/delete.md new file mode 100644 index 0000000..3d4da02 --- /dev/null +++ b/docs/examples/functions/delete.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Functions; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$functions = new Functions($client); + +$result = $functions->delete( + functionId: '<FUNCTION_ID>' +); \ No newline at end of file diff --git a/docs/examples/functions/get-deployment-download.md b/docs/examples/functions/get-deployment-download.md new file mode 100644 index 0000000..b4756e7 --- /dev/null +++ b/docs/examples/functions/get-deployment-download.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Functions; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$functions = new Functions($client); + +$result = $functions->getDeploymentDownload( + functionId: '<FUNCTION_ID>', + deploymentId: '<DEPLOYMENT_ID>' +); \ No newline at end of file diff --git a/docs/examples/functions/get-deployment.md b/docs/examples/functions/get-deployment.md new file mode 100644 index 0000000..d5758dd --- /dev/null +++ b/docs/examples/functions/get-deployment.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Functions; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$functions = new Functions($client); + +$result = $functions->getDeployment( + functionId: '<FUNCTION_ID>', + deploymentId: '<DEPLOYMENT_ID>' +); \ No newline at end of file diff --git a/docs/examples/functions/get-execution.md b/docs/examples/functions/get-execution.md new file mode 100644 index 0000000..d0c7ec4 --- /dev/null +++ b/docs/examples/functions/get-execution.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Functions; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$functions = new Functions($client); + +$result = $functions->getExecution( + functionId: '<FUNCTION_ID>', + executionId: '<EXECUTION_ID>' +); \ No newline at end of file diff --git a/docs/examples/functions/get-template.md b/docs/examples/functions/get-template.md new file mode 100644 index 0000000..989026d --- /dev/null +++ b/docs/examples/functions/get-template.md @@ -0,0 +1,14 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Functions; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID + +$functions = new Functions($client); + +$result = $functions->getTemplate( + templateId: '<TEMPLATE_ID>' +); \ No newline at end of file diff --git a/docs/examples/functions/get-variable.md b/docs/examples/functions/get-variable.md new file mode 100644 index 0000000..2bd901b --- /dev/null +++ b/docs/examples/functions/get-variable.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Functions; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$functions = new Functions($client); + +$result = $functions->getVariable( + functionId: '<FUNCTION_ID>', + variableId: '<VARIABLE_ID>' +); \ No newline at end of file diff --git a/docs/examples/functions/get.md b/docs/examples/functions/get.md new file mode 100644 index 0000000..b2c6d7b --- /dev/null +++ b/docs/examples/functions/get.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Functions; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$functions = new Functions($client); + +$result = $functions->get( + functionId: '<FUNCTION_ID>' +); \ No newline at end of file diff --git a/docs/examples/functions/list-deployments.md b/docs/examples/functions/list-deployments.md new file mode 100644 index 0000000..d8bad27 --- /dev/null +++ b/docs/examples/functions/list-deployments.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Functions; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$functions = new Functions($client); + +$result = $functions->listDeployments( + functionId: '<FUNCTION_ID>', + queries: [], // optional + search: '<SEARCH>' // optional +); \ No newline at end of file diff --git a/docs/examples/functions/list-executions.md b/docs/examples/functions/list-executions.md new file mode 100644 index 0000000..fda330a --- /dev/null +++ b/docs/examples/functions/list-executions.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Functions; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$functions = new Functions($client); + +$result = $functions->listExecutions( + functionId: '<FUNCTION_ID>', + queries: [], // optional + search: '<SEARCH>' // optional +); \ No newline at end of file diff --git a/docs/examples/functions/list-runtimes.md b/docs/examples/functions/list-runtimes.md new file mode 100644 index 0000000..18d3c05 --- /dev/null +++ b/docs/examples/functions/list-runtimes.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Functions; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$functions = new Functions($client); + +$result = $functions->listRuntimes(); diff --git a/docs/examples/functions/list-templates.md b/docs/examples/functions/list-templates.md new file mode 100644 index 0000000..087d21b --- /dev/null +++ b/docs/examples/functions/list-templates.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Functions; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID + +$functions = new Functions($client); + +$result = $functions->listTemplates( + runtimes: [], // optional + useCases: [], // optional + limit: 1, // optional + offset: 0 // optional +); \ No newline at end of file diff --git a/docs/examples/functions/list-variables.md b/docs/examples/functions/list-variables.md new file mode 100644 index 0000000..137a4da --- /dev/null +++ b/docs/examples/functions/list-variables.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Functions; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$functions = new Functions($client); + +$result = $functions->listVariables( + functionId: '<FUNCTION_ID>' +); \ No newline at end of file diff --git a/docs/examples/functions/list.md b/docs/examples/functions/list.md new file mode 100644 index 0000000..7b4d362 --- /dev/null +++ b/docs/examples/functions/list.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Functions; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$functions = new Functions($client); + +$result = $functions->list( + queries: [], // optional + search: '<SEARCH>' // optional +); \ No newline at end of file diff --git a/docs/examples/functions/update-deployment-build.md b/docs/examples/functions/update-deployment-build.md new file mode 100644 index 0000000..653914e --- /dev/null +++ b/docs/examples/functions/update-deployment-build.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Functions; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$functions = new Functions($client); + +$result = $functions->updateDeploymentBuild( + functionId: '<FUNCTION_ID>', + deploymentId: '<DEPLOYMENT_ID>' +); \ No newline at end of file diff --git a/docs/examples/functions/update-deployment.md b/docs/examples/functions/update-deployment.md new file mode 100644 index 0000000..095b253 --- /dev/null +++ b/docs/examples/functions/update-deployment.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Functions; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$functions = new Functions($client); + +$result = $functions->updateDeployment( + functionId: '<FUNCTION_ID>', + deploymentId: '<DEPLOYMENT_ID>' +); \ No newline at end of file diff --git a/docs/examples/functions/update-variable.md b/docs/examples/functions/update-variable.md new file mode 100644 index 0000000..77a28f1 --- /dev/null +++ b/docs/examples/functions/update-variable.md @@ -0,0 +1,18 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Functions; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$functions = new Functions($client); + +$result = $functions->updateVariable( + functionId: '<FUNCTION_ID>', + variableId: '<VARIABLE_ID>', + key: '<KEY>', + value: '<VALUE>' // optional +); \ No newline at end of file diff --git a/docs/examples/functions/update.md b/docs/examples/functions/update.md new file mode 100644 index 0000000..db0d50a --- /dev/null +++ b/docs/examples/functions/update.md @@ -0,0 +1,31 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Functions; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$functions = new Functions($client); + +$result = $functions->update( + functionId: '<FUNCTION_ID>', + name: '<NAME>', + runtime: ::NODE145(), // optional + execute: ["any"], // optional + events: [], // optional + schedule: '', // optional + timeout: 1, // optional + enabled: false, // optional + logging: false, // optional + entrypoint: '<ENTRYPOINT>', // optional + commands: '<COMMANDS>', // optional + scopes: [], // optional + installationId: '<INSTALLATION_ID>', // optional + providerRepositoryId: '<PROVIDER_REPOSITORY_ID>', // optional + providerBranch: '<PROVIDER_BRANCH>', // optional + providerSilentMode: false, // optional + providerRootDirectory: '<PROVIDER_ROOT_DIRECTORY>' // optional +); \ No newline at end of file diff --git a/docs/examples/graphql/mutation.md b/docs/examples/graphql/mutation.md new file mode 100644 index 0000000..e074e0c --- /dev/null +++ b/docs/examples/graphql/mutation.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Graphql; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$graphql = new Graphql($client); + +$result = $graphql->mutation( + query: [] +); \ No newline at end of file diff --git a/docs/examples/graphql/query.md b/docs/examples/graphql/query.md new file mode 100644 index 0000000..b871063 --- /dev/null +++ b/docs/examples/graphql/query.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Graphql; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$graphql = new Graphql($client); + +$result = $graphql->query( + query: [] +); \ No newline at end of file diff --git a/docs/examples/health/get-antivirus.md b/docs/examples/health/get-antivirus.md new file mode 100644 index 0000000..64e83e0 --- /dev/null +++ b/docs/examples/health/get-antivirus.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Health; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$health = new Health($client); + +$result = $health->getAntivirus(); diff --git a/docs/examples/health/get-cache.md b/docs/examples/health/get-cache.md new file mode 100644 index 0000000..6096207 --- /dev/null +++ b/docs/examples/health/get-cache.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Health; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$health = new Health($client); + +$result = $health->getCache(); diff --git a/docs/examples/health/get-certificate.md b/docs/examples/health/get-certificate.md new file mode 100644 index 0000000..d5d325e --- /dev/null +++ b/docs/examples/health/get-certificate.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Health; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$health = new Health($client); + +$result = $health->getCertificate( + domain: '' // optional +); \ No newline at end of file diff --git a/docs/examples/health/get-d-b.md b/docs/examples/health/get-d-b.md new file mode 100644 index 0000000..434fcad --- /dev/null +++ b/docs/examples/health/get-d-b.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Health; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$health = new Health($client); + +$result = $health->getDB(); diff --git a/docs/examples/health/get-failed-jobs.md b/docs/examples/health/get-failed-jobs.md new file mode 100644 index 0000000..1470587 --- /dev/null +++ b/docs/examples/health/get-failed-jobs.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Health; +use Appwrite\Enums\; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$health = new Health($client); + +$result = $health->getFailedJobs( + name: ::V1DATABASE(), + threshold: null // optional +); \ No newline at end of file diff --git a/docs/examples/health/get-pub-sub.md b/docs/examples/health/get-pub-sub.md new file mode 100644 index 0000000..d2d3a5d --- /dev/null +++ b/docs/examples/health/get-pub-sub.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Health; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$health = new Health($client); + +$result = $health->getPubSub(); diff --git a/docs/examples/health/get-queue-builds.md b/docs/examples/health/get-queue-builds.md new file mode 100644 index 0000000..2911465 --- /dev/null +++ b/docs/examples/health/get-queue-builds.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Health; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$health = new Health($client); + +$result = $health->getQueueBuilds( + threshold: null // optional +); \ No newline at end of file diff --git a/docs/examples/health/get-queue-certificates.md b/docs/examples/health/get-queue-certificates.md new file mode 100644 index 0000000..9323b41 --- /dev/null +++ b/docs/examples/health/get-queue-certificates.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Health; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$health = new Health($client); + +$result = $health->getQueueCertificates( + threshold: null // optional +); \ No newline at end of file diff --git a/docs/examples/health/get-queue-databases.md b/docs/examples/health/get-queue-databases.md new file mode 100644 index 0000000..54a9814 --- /dev/null +++ b/docs/examples/health/get-queue-databases.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Health; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$health = new Health($client); + +$result = $health->getQueueDatabases( + name: '<NAME>', // optional + threshold: null // optional +); \ No newline at end of file diff --git a/docs/examples/health/get-queue-deletes.md b/docs/examples/health/get-queue-deletes.md new file mode 100644 index 0000000..aee4deb --- /dev/null +++ b/docs/examples/health/get-queue-deletes.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Health; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$health = new Health($client); + +$result = $health->getQueueDeletes( + threshold: null // optional +); \ No newline at end of file diff --git a/docs/examples/health/get-queue-functions.md b/docs/examples/health/get-queue-functions.md new file mode 100644 index 0000000..f675b75 --- /dev/null +++ b/docs/examples/health/get-queue-functions.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Health; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$health = new Health($client); + +$result = $health->getQueueFunctions( + threshold: null // optional +); \ No newline at end of file diff --git a/docs/examples/health/get-queue-logs.md b/docs/examples/health/get-queue-logs.md new file mode 100644 index 0000000..05c463b --- /dev/null +++ b/docs/examples/health/get-queue-logs.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Health; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$health = new Health($client); + +$result = $health->getQueueLogs( + threshold: null // optional +); \ No newline at end of file diff --git a/docs/examples/health/get-queue-mails.md b/docs/examples/health/get-queue-mails.md new file mode 100644 index 0000000..74d4959 --- /dev/null +++ b/docs/examples/health/get-queue-mails.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Health; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$health = new Health($client); + +$result = $health->getQueueMails( + threshold: null // optional +); \ No newline at end of file diff --git a/docs/examples/health/get-queue-messaging.md b/docs/examples/health/get-queue-messaging.md new file mode 100644 index 0000000..3fd96c6 --- /dev/null +++ b/docs/examples/health/get-queue-messaging.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Health; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$health = new Health($client); + +$result = $health->getQueueMessaging( + threshold: null // optional +); \ No newline at end of file diff --git a/docs/examples/health/get-queue-migrations.md b/docs/examples/health/get-queue-migrations.md new file mode 100644 index 0000000..9f1a8be --- /dev/null +++ b/docs/examples/health/get-queue-migrations.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Health; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$health = new Health($client); + +$result = $health->getQueueMigrations( + threshold: null // optional +); \ No newline at end of file diff --git a/docs/examples/health/get-queue-usage-dump.md b/docs/examples/health/get-queue-usage-dump.md new file mode 100644 index 0000000..b856b73 --- /dev/null +++ b/docs/examples/health/get-queue-usage-dump.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Health; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$health = new Health($client); + +$result = $health->getQueueUsageDump( + threshold: null // optional +); \ No newline at end of file diff --git a/docs/examples/health/get-queue-usage.md b/docs/examples/health/get-queue-usage.md new file mode 100644 index 0000000..9b5baeb --- /dev/null +++ b/docs/examples/health/get-queue-usage.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Health; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$health = new Health($client); + +$result = $health->getQueueUsage( + threshold: null // optional +); \ No newline at end of file diff --git a/docs/examples/health/get-queue-webhooks.md b/docs/examples/health/get-queue-webhooks.md new file mode 100644 index 0000000..e42b65b --- /dev/null +++ b/docs/examples/health/get-queue-webhooks.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Health; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$health = new Health($client); + +$result = $health->getQueueWebhooks( + threshold: null // optional +); \ No newline at end of file diff --git a/docs/examples/health/get-queue.md b/docs/examples/health/get-queue.md new file mode 100644 index 0000000..81b2218 --- /dev/null +++ b/docs/examples/health/get-queue.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Health; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$health = new Health($client); + +$result = $health->getQueue(); diff --git a/docs/examples/health/get-storage-local.md b/docs/examples/health/get-storage-local.md new file mode 100644 index 0000000..75999ce --- /dev/null +++ b/docs/examples/health/get-storage-local.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Health; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$health = new Health($client); + +$result = $health->getStorageLocal(); diff --git a/docs/examples/health/get-storage.md b/docs/examples/health/get-storage.md new file mode 100644 index 0000000..a3b56b9 --- /dev/null +++ b/docs/examples/health/get-storage.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Health; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$health = new Health($client); + +$result = $health->getStorage(); diff --git a/docs/examples/health/get-time.md b/docs/examples/health/get-time.md new file mode 100644 index 0000000..5deb238 --- /dev/null +++ b/docs/examples/health/get-time.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Health; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$health = new Health($client); + +$result = $health->getTime(); diff --git a/docs/examples/health/get.md b/docs/examples/health/get.md new file mode 100644 index 0000000..5001c48 --- /dev/null +++ b/docs/examples/health/get.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Health; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$health = new Health($client); + +$result = $health->get(); diff --git a/docs/examples/locale/get.md b/docs/examples/locale/get.md new file mode 100644 index 0000000..b9f48b4 --- /dev/null +++ b/docs/examples/locale/get.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Locale; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$locale = new Locale($client); + +$result = $locale->get(); diff --git a/docs/examples/locale/list-codes.md b/docs/examples/locale/list-codes.md new file mode 100644 index 0000000..b35683c --- /dev/null +++ b/docs/examples/locale/list-codes.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Locale; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$locale = new Locale($client); + +$result = $locale->listCodes(); diff --git a/docs/examples/locale/list-continents.md b/docs/examples/locale/list-continents.md new file mode 100644 index 0000000..1076f99 --- /dev/null +++ b/docs/examples/locale/list-continents.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Locale; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$locale = new Locale($client); + +$result = $locale->listContinents(); diff --git a/docs/examples/locale/list-countries-e-u.md b/docs/examples/locale/list-countries-e-u.md new file mode 100644 index 0000000..93a4cad --- /dev/null +++ b/docs/examples/locale/list-countries-e-u.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Locale; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$locale = new Locale($client); + +$result = $locale->listCountriesEU(); diff --git a/docs/examples/locale/list-countries-phones.md b/docs/examples/locale/list-countries-phones.md new file mode 100644 index 0000000..1d99f67 --- /dev/null +++ b/docs/examples/locale/list-countries-phones.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Locale; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$locale = new Locale($client); + +$result = $locale->listCountriesPhones(); diff --git a/docs/examples/locale/list-countries.md b/docs/examples/locale/list-countries.md new file mode 100644 index 0000000..665dd09 --- /dev/null +++ b/docs/examples/locale/list-countries.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Locale; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$locale = new Locale($client); + +$result = $locale->listCountries(); diff --git a/docs/examples/locale/list-currencies.md b/docs/examples/locale/list-currencies.md new file mode 100644 index 0000000..5cd91de --- /dev/null +++ b/docs/examples/locale/list-currencies.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Locale; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$locale = new Locale($client); + +$result = $locale->listCurrencies(); diff --git a/docs/examples/locale/list-languages.md b/docs/examples/locale/list-languages.md new file mode 100644 index 0000000..c615a3d --- /dev/null +++ b/docs/examples/locale/list-languages.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Locale; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$locale = new Locale($client); + +$result = $locale->listLanguages(); diff --git a/docs/examples/messaging/create-apns-provider.md b/docs/examples/messaging/create-apns-provider.md new file mode 100644 index 0000000..ebe69e9 --- /dev/null +++ b/docs/examples/messaging/create-apns-provider.md @@ -0,0 +1,22 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->createApnsProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', + authKey: '<AUTH_KEY>', // optional + authKeyId: '<AUTH_KEY_ID>', // optional + teamId: '<TEAM_ID>', // optional + bundleId: '<BUNDLE_ID>', // optional + sandbox: false, // optional + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/messaging/create-email.md b/docs/examples/messaging/create-email.md new file mode 100644 index 0000000..b24e4f2 --- /dev/null +++ b/docs/examples/messaging/create-email.md @@ -0,0 +1,26 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->createEmail( + messageId: '<MESSAGE_ID>', + subject: '<SUBJECT>', + content: '<CONTENT>', + topics: [], // optional + users: [], // optional + targets: [], // optional + cc: [], // optional + bcc: [], // optional + attachments: [], // optional + draft: false, // optional + html: false, // optional + scheduledAt: '' // optional +); \ No newline at end of file diff --git a/docs/examples/messaging/create-fcm-provider.md b/docs/examples/messaging/create-fcm-provider.md new file mode 100644 index 0000000..b0cfec4 --- /dev/null +++ b/docs/examples/messaging/create-fcm-provider.md @@ -0,0 +1,18 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->createFcmProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', + serviceAccountJSON: [], // optional + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/messaging/create-mailgun-provider.md b/docs/examples/messaging/create-mailgun-provider.md new file mode 100644 index 0000000..bd3bcf8 --- /dev/null +++ b/docs/examples/messaging/create-mailgun-provider.md @@ -0,0 +1,24 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->createMailgunProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', + apiKey: '<API_KEY>', // optional + domain: '<DOMAIN>', // optional + isEuRegion: false, // optional + fromName: '<FROM_NAME>', // optional + fromEmail: 'email@example.com', // optional + replyToName: '<REPLY_TO_NAME>', // optional + replyToEmail: 'email@example.com', // optional + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/messaging/create-msg91provider.md b/docs/examples/messaging/create-msg91provider.md new file mode 100644 index 0000000..da37716 --- /dev/null +++ b/docs/examples/messaging/create-msg91provider.md @@ -0,0 +1,20 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->createMsg91Provider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', + templateId: '<TEMPLATE_ID>', // optional + senderId: '<SENDER_ID>', // optional + authKey: '<AUTH_KEY>', // optional + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/messaging/create-push.md b/docs/examples/messaging/create-push.md new file mode 100644 index 0000000..7273f03 --- /dev/null +++ b/docs/examples/messaging/create-push.md @@ -0,0 +1,30 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->createPush( + messageId: '<MESSAGE_ID>', + title: '<TITLE>', + body: '<BODY>', + topics: [], // optional + users: [], // optional + targets: [], // optional + data: [], // optional + action: '<ACTION>', // optional + image: '[ID1:ID2]', // optional + icon: '<ICON>', // optional + sound: '<SOUND>', // optional + color: '<COLOR>', // optional + tag: '<TAG>', // optional + badge: '<BADGE>', // optional + draft: false, // optional + scheduledAt: '' // optional +); \ No newline at end of file diff --git a/docs/examples/messaging/create-sendgrid-provider.md b/docs/examples/messaging/create-sendgrid-provider.md new file mode 100644 index 0000000..42764a9 --- /dev/null +++ b/docs/examples/messaging/create-sendgrid-provider.md @@ -0,0 +1,22 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->createSendgridProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', + apiKey: '<API_KEY>', // optional + fromName: '<FROM_NAME>', // optional + fromEmail: 'email@example.com', // optional + replyToName: '<REPLY_TO_NAME>', // optional + replyToEmail: 'email@example.com', // optional + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/messaging/create-sms.md b/docs/examples/messaging/create-sms.md new file mode 100644 index 0000000..36fce84 --- /dev/null +++ b/docs/examples/messaging/create-sms.md @@ -0,0 +1,21 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->createSms( + messageId: '<MESSAGE_ID>', + content: '<CONTENT>', + topics: [], // optional + users: [], // optional + targets: [], // optional + draft: false, // optional + scheduledAt: '' // optional +); \ No newline at end of file diff --git a/docs/examples/messaging/create-smtp-provider.md b/docs/examples/messaging/create-smtp-provider.md new file mode 100644 index 0000000..ff8cfe0 --- /dev/null +++ b/docs/examples/messaging/create-smtp-provider.md @@ -0,0 +1,28 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->createSmtpProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', + host: '<HOST>', + port: 1, // optional + username: '<USERNAME>', // optional + password: '<PASSWORD>', // optional + encryption: SmtpEncryption::NONE(), // optional + autoTLS: false, // optional + mailer: '<MAILER>', // optional + fromName: '<FROM_NAME>', // optional + fromEmail: 'email@example.com', // optional + replyToName: '<REPLY_TO_NAME>', // optional + replyToEmail: 'email@example.com', // optional + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/messaging/create-subscriber.md b/docs/examples/messaging/create-subscriber.md new file mode 100644 index 0000000..bfba263 --- /dev/null +++ b/docs/examples/messaging/create-subscriber.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setJWT('<YOUR_JWT>'); // Your secret JSON Web Token + +$messaging = new Messaging($client); + +$result = $messaging->createSubscriber( + topicId: '<TOPIC_ID>', + subscriberId: '<SUBSCRIBER_ID>', + targetId: '<TARGET_ID>' +); \ No newline at end of file diff --git a/docs/examples/messaging/create-telesign-provider.md b/docs/examples/messaging/create-telesign-provider.md new file mode 100644 index 0000000..ec3ede7 --- /dev/null +++ b/docs/examples/messaging/create-telesign-provider.md @@ -0,0 +1,20 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->createTelesignProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', + from: '+12065550100', // optional + customerId: '<CUSTOMER_ID>', // optional + apiKey: '<API_KEY>', // optional + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/messaging/create-textmagic-provider.md b/docs/examples/messaging/create-textmagic-provider.md new file mode 100644 index 0000000..5dc00f8 --- /dev/null +++ b/docs/examples/messaging/create-textmagic-provider.md @@ -0,0 +1,20 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->createTextmagicProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', + from: '+12065550100', // optional + username: '<USERNAME>', // optional + apiKey: '<API_KEY>', // optional + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/messaging/create-topic.md b/docs/examples/messaging/create-topic.md new file mode 100644 index 0000000..dd0daf1 --- /dev/null +++ b/docs/examples/messaging/create-topic.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->createTopic( + topicId: '<TOPIC_ID>', + name: '<NAME>', + subscribe: ["any"] // optional +); \ No newline at end of file diff --git a/docs/examples/messaging/create-twilio-provider.md b/docs/examples/messaging/create-twilio-provider.md new file mode 100644 index 0000000..70a1d38 --- /dev/null +++ b/docs/examples/messaging/create-twilio-provider.md @@ -0,0 +1,20 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->createTwilioProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', + from: '+12065550100', // optional + accountSid: '<ACCOUNT_SID>', // optional + authToken: '<AUTH_TOKEN>', // optional + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/messaging/create-vonage-provider.md b/docs/examples/messaging/create-vonage-provider.md new file mode 100644 index 0000000..d6a4e11 --- /dev/null +++ b/docs/examples/messaging/create-vonage-provider.md @@ -0,0 +1,20 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->createVonageProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', + from: '+12065550100', // optional + apiKey: '<API_KEY>', // optional + apiSecret: '<API_SECRET>', // optional + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/messaging/delete-provider.md b/docs/examples/messaging/delete-provider.md new file mode 100644 index 0000000..4f267fe --- /dev/null +++ b/docs/examples/messaging/delete-provider.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->deleteProvider( + providerId: '<PROVIDER_ID>' +); \ No newline at end of file diff --git a/docs/examples/messaging/delete-subscriber.md b/docs/examples/messaging/delete-subscriber.md new file mode 100644 index 0000000..2f91487 --- /dev/null +++ b/docs/examples/messaging/delete-subscriber.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setJWT('<YOUR_JWT>'); // Your secret JSON Web Token + +$messaging = new Messaging($client); + +$result = $messaging->deleteSubscriber( + topicId: '<TOPIC_ID>', + subscriberId: '<SUBSCRIBER_ID>' +); \ No newline at end of file diff --git a/docs/examples/messaging/delete-topic.md b/docs/examples/messaging/delete-topic.md new file mode 100644 index 0000000..79dca2c --- /dev/null +++ b/docs/examples/messaging/delete-topic.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->deleteTopic( + topicId: '<TOPIC_ID>' +); \ No newline at end of file diff --git a/docs/examples/messaging/delete.md b/docs/examples/messaging/delete.md new file mode 100644 index 0000000..b0676ec --- /dev/null +++ b/docs/examples/messaging/delete.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->delete( + messageId: '<MESSAGE_ID>' +); \ No newline at end of file diff --git a/docs/examples/messaging/get-message.md b/docs/examples/messaging/get-message.md new file mode 100644 index 0000000..9ec7a0e --- /dev/null +++ b/docs/examples/messaging/get-message.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->getMessage( + messageId: '<MESSAGE_ID>' +); \ No newline at end of file diff --git a/docs/examples/messaging/get-provider.md b/docs/examples/messaging/get-provider.md new file mode 100644 index 0000000..378fc6d --- /dev/null +++ b/docs/examples/messaging/get-provider.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->getProvider( + providerId: '<PROVIDER_ID>' +); \ No newline at end of file diff --git a/docs/examples/messaging/get-subscriber.md b/docs/examples/messaging/get-subscriber.md new file mode 100644 index 0000000..a10974a --- /dev/null +++ b/docs/examples/messaging/get-subscriber.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->getSubscriber( + topicId: '<TOPIC_ID>', + subscriberId: '<SUBSCRIBER_ID>' +); \ No newline at end of file diff --git a/docs/examples/messaging/get-topic.md b/docs/examples/messaging/get-topic.md new file mode 100644 index 0000000..cb42254 --- /dev/null +++ b/docs/examples/messaging/get-topic.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->getTopic( + topicId: '<TOPIC_ID>' +); \ No newline at end of file diff --git a/docs/examples/messaging/list-message-logs.md b/docs/examples/messaging/list-message-logs.md new file mode 100644 index 0000000..d66d546 --- /dev/null +++ b/docs/examples/messaging/list-message-logs.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->listMessageLogs( + messageId: '<MESSAGE_ID>', + queries: [] // optional +); \ No newline at end of file diff --git a/docs/examples/messaging/list-messages.md b/docs/examples/messaging/list-messages.md new file mode 100644 index 0000000..c0f54a6 --- /dev/null +++ b/docs/examples/messaging/list-messages.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->listMessages( + queries: [], // optional + search: '<SEARCH>' // optional +); \ No newline at end of file diff --git a/docs/examples/messaging/list-provider-logs.md b/docs/examples/messaging/list-provider-logs.md new file mode 100644 index 0000000..865daf9 --- /dev/null +++ b/docs/examples/messaging/list-provider-logs.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->listProviderLogs( + providerId: '<PROVIDER_ID>', + queries: [] // optional +); \ No newline at end of file diff --git a/docs/examples/messaging/list-providers.md b/docs/examples/messaging/list-providers.md new file mode 100644 index 0000000..fd30837 --- /dev/null +++ b/docs/examples/messaging/list-providers.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->listProviders( + queries: [], // optional + search: '<SEARCH>' // optional +); \ No newline at end of file diff --git a/docs/examples/messaging/list-subscriber-logs.md b/docs/examples/messaging/list-subscriber-logs.md new file mode 100644 index 0000000..b69c057 --- /dev/null +++ b/docs/examples/messaging/list-subscriber-logs.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->listSubscriberLogs( + subscriberId: '<SUBSCRIBER_ID>', + queries: [] // optional +); \ No newline at end of file diff --git a/docs/examples/messaging/list-subscribers.md b/docs/examples/messaging/list-subscribers.md new file mode 100644 index 0000000..2fd2747 --- /dev/null +++ b/docs/examples/messaging/list-subscribers.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->listSubscribers( + topicId: '<TOPIC_ID>', + queries: [], // optional + search: '<SEARCH>' // optional +); \ No newline at end of file diff --git a/docs/examples/messaging/list-targets.md b/docs/examples/messaging/list-targets.md new file mode 100644 index 0000000..3abb9ef --- /dev/null +++ b/docs/examples/messaging/list-targets.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->listTargets( + messageId: '<MESSAGE_ID>', + queries: [] // optional +); \ No newline at end of file diff --git a/docs/examples/messaging/list-topic-logs.md b/docs/examples/messaging/list-topic-logs.md new file mode 100644 index 0000000..0d23c82 --- /dev/null +++ b/docs/examples/messaging/list-topic-logs.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->listTopicLogs( + topicId: '<TOPIC_ID>', + queries: [] // optional +); \ No newline at end of file diff --git a/docs/examples/messaging/list-topics.md b/docs/examples/messaging/list-topics.md new file mode 100644 index 0000000..008767e --- /dev/null +++ b/docs/examples/messaging/list-topics.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->listTopics( + queries: [], // optional + search: '<SEARCH>' // optional +); \ No newline at end of file diff --git a/docs/examples/messaging/update-apns-provider.md b/docs/examples/messaging/update-apns-provider.md new file mode 100644 index 0000000..a368ce5 --- /dev/null +++ b/docs/examples/messaging/update-apns-provider.md @@ -0,0 +1,22 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->updateApnsProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', // optional + enabled: false, // optional + authKey: '<AUTH_KEY>', // optional + authKeyId: '<AUTH_KEY_ID>', // optional + teamId: '<TEAM_ID>', // optional + bundleId: '<BUNDLE_ID>', // optional + sandbox: false // optional +); \ No newline at end of file diff --git a/docs/examples/messaging/update-email.md b/docs/examples/messaging/update-email.md new file mode 100644 index 0000000..537ca82 --- /dev/null +++ b/docs/examples/messaging/update-email.md @@ -0,0 +1,26 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->updateEmail( + messageId: '<MESSAGE_ID>', + topics: [], // optional + users: [], // optional + targets: [], // optional + subject: '<SUBJECT>', // optional + content: '<CONTENT>', // optional + draft: false, // optional + html: false, // optional + cc: [], // optional + bcc: [], // optional + scheduledAt: '', // optional + attachments: [] // optional +); \ No newline at end of file diff --git a/docs/examples/messaging/update-fcm-provider.md b/docs/examples/messaging/update-fcm-provider.md new file mode 100644 index 0000000..d8b2a0e --- /dev/null +++ b/docs/examples/messaging/update-fcm-provider.md @@ -0,0 +1,18 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->updateFcmProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', // optional + enabled: false, // optional + serviceAccountJSON: [] // optional +); \ No newline at end of file diff --git a/docs/examples/messaging/update-mailgun-provider.md b/docs/examples/messaging/update-mailgun-provider.md new file mode 100644 index 0000000..d838adb --- /dev/null +++ b/docs/examples/messaging/update-mailgun-provider.md @@ -0,0 +1,24 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->updateMailgunProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', // optional + apiKey: '<API_KEY>', // optional + domain: '<DOMAIN>', // optional + isEuRegion: false, // optional + enabled: false, // optional + fromName: '<FROM_NAME>', // optional + fromEmail: 'email@example.com', // optional + replyToName: '<REPLY_TO_NAME>', // optional + replyToEmail: '<REPLY_TO_EMAIL>' // optional +); \ No newline at end of file diff --git a/docs/examples/messaging/update-msg91provider.md b/docs/examples/messaging/update-msg91provider.md new file mode 100644 index 0000000..eb68102 --- /dev/null +++ b/docs/examples/messaging/update-msg91provider.md @@ -0,0 +1,20 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->updateMsg91Provider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', // optional + enabled: false, // optional + templateId: '<TEMPLATE_ID>', // optional + senderId: '<SENDER_ID>', // optional + authKey: '<AUTH_KEY>' // optional +); \ No newline at end of file diff --git a/docs/examples/messaging/update-push.md b/docs/examples/messaging/update-push.md new file mode 100644 index 0000000..b332ec1 --- /dev/null +++ b/docs/examples/messaging/update-push.md @@ -0,0 +1,30 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->updatePush( + messageId: '<MESSAGE_ID>', + topics: [], // optional + users: [], // optional + targets: [], // optional + title: '<TITLE>', // optional + body: '<BODY>', // optional + data: [], // optional + action: '<ACTION>', // optional + image: '[ID1:ID2]', // optional + icon: '<ICON>', // optional + sound: '<SOUND>', // optional + color: '<COLOR>', // optional + tag: '<TAG>', // optional + badge: null, // optional + draft: false, // optional + scheduledAt: '' // optional +); \ No newline at end of file diff --git a/docs/examples/messaging/update-sendgrid-provider.md b/docs/examples/messaging/update-sendgrid-provider.md new file mode 100644 index 0000000..7909fef --- /dev/null +++ b/docs/examples/messaging/update-sendgrid-provider.md @@ -0,0 +1,22 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->updateSendgridProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', // optional + enabled: false, // optional + apiKey: '<API_KEY>', // optional + fromName: '<FROM_NAME>', // optional + fromEmail: 'email@example.com', // optional + replyToName: '<REPLY_TO_NAME>', // optional + replyToEmail: '<REPLY_TO_EMAIL>' // optional +); \ No newline at end of file diff --git a/docs/examples/messaging/update-sms.md b/docs/examples/messaging/update-sms.md new file mode 100644 index 0000000..a4b4c23 --- /dev/null +++ b/docs/examples/messaging/update-sms.md @@ -0,0 +1,21 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->updateSms( + messageId: '<MESSAGE_ID>', + topics: [], // optional + users: [], // optional + targets: [], // optional + content: '<CONTENT>', // optional + draft: false, // optional + scheduledAt: '' // optional +); \ No newline at end of file diff --git a/docs/examples/messaging/update-smtp-provider.md b/docs/examples/messaging/update-smtp-provider.md new file mode 100644 index 0000000..997914f --- /dev/null +++ b/docs/examples/messaging/update-smtp-provider.md @@ -0,0 +1,28 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->updateSmtpProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', // optional + host: '<HOST>', // optional + port: 1, // optional + username: '<USERNAME>', // optional + password: '<PASSWORD>', // optional + encryption: SmtpEncryption::NONE(), // optional + autoTLS: false, // optional + mailer: '<MAILER>', // optional + fromName: '<FROM_NAME>', // optional + fromEmail: 'email@example.com', // optional + replyToName: '<REPLY_TO_NAME>', // optional + replyToEmail: '<REPLY_TO_EMAIL>', // optional + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/messaging/update-telesign-provider.md b/docs/examples/messaging/update-telesign-provider.md new file mode 100644 index 0000000..981df0c --- /dev/null +++ b/docs/examples/messaging/update-telesign-provider.md @@ -0,0 +1,20 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->updateTelesignProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', // optional + enabled: false, // optional + customerId: '<CUSTOMER_ID>', // optional + apiKey: '<API_KEY>', // optional + from: '<FROM>' // optional +); \ No newline at end of file diff --git a/docs/examples/messaging/update-textmagic-provider.md b/docs/examples/messaging/update-textmagic-provider.md new file mode 100644 index 0000000..b7f9bab --- /dev/null +++ b/docs/examples/messaging/update-textmagic-provider.md @@ -0,0 +1,20 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->updateTextmagicProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', // optional + enabled: false, // optional + username: '<USERNAME>', // optional + apiKey: '<API_KEY>', // optional + from: '<FROM>' // optional +); \ No newline at end of file diff --git a/docs/examples/messaging/update-topic.md b/docs/examples/messaging/update-topic.md new file mode 100644 index 0000000..e705c1b --- /dev/null +++ b/docs/examples/messaging/update-topic.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->updateTopic( + topicId: '<TOPIC_ID>', + name: '<NAME>', // optional + subscribe: ["any"] // optional +); \ No newline at end of file diff --git a/docs/examples/messaging/update-twilio-provider.md b/docs/examples/messaging/update-twilio-provider.md new file mode 100644 index 0000000..05c2072 --- /dev/null +++ b/docs/examples/messaging/update-twilio-provider.md @@ -0,0 +1,20 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->updateTwilioProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', // optional + enabled: false, // optional + accountSid: '<ACCOUNT_SID>', // optional + authToken: '<AUTH_TOKEN>', // optional + from: '<FROM>' // optional +); \ No newline at end of file diff --git a/docs/examples/messaging/update-vonage-provider.md b/docs/examples/messaging/update-vonage-provider.md new file mode 100644 index 0000000..3c421af --- /dev/null +++ b/docs/examples/messaging/update-vonage-provider.md @@ -0,0 +1,20 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->updateVonageProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', // optional + enabled: false, // optional + apiKey: '<API_KEY>', // optional + apiSecret: '<API_SECRET>', // optional + from: '<FROM>' // optional +); \ No newline at end of file diff --git a/docs/examples/storage/create-bucket.md b/docs/examples/storage/create-bucket.md new file mode 100644 index 0000000..ca369fb --- /dev/null +++ b/docs/examples/storage/create-bucket.md @@ -0,0 +1,24 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Storage; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$storage = new Storage($client); + +$result = $storage->createBucket( + bucketId: '<BUCKET_ID>', + name: '<NAME>', + permissions: ["read("any")"], // optional + fileSecurity: false, // optional + enabled: false, // optional + maximumFileSize: 1, // optional + allowedFileExtensions: [], // optional + compression: ::NONE(), // optional + encryption: false, // optional + antivirus: false // optional +); \ No newline at end of file diff --git a/docs/examples/storage/create-file.md b/docs/examples/storage/create-file.md new file mode 100644 index 0000000..20a25e7 --- /dev/null +++ b/docs/examples/storage/create-file.md @@ -0,0 +1,19 @@ +<?php + +use Appwrite\Client; +use Appwrite\InputFile; +use Appwrite\Services\Storage; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$storage = new Storage($client); + +$result = $storage->createFile( + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>', + file: InputFile::withPath('file.png'), + permissions: ["read("any")"] // optional +); \ No newline at end of file diff --git a/docs/examples/storage/delete-bucket.md b/docs/examples/storage/delete-bucket.md new file mode 100644 index 0000000..a9207f4 --- /dev/null +++ b/docs/examples/storage/delete-bucket.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Storage; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$storage = new Storage($client); + +$result = $storage->deleteBucket( + bucketId: '<BUCKET_ID>' +); \ No newline at end of file diff --git a/docs/examples/storage/delete-file.md b/docs/examples/storage/delete-file.md new file mode 100644 index 0000000..47f9938 --- /dev/null +++ b/docs/examples/storage/delete-file.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Storage; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$storage = new Storage($client); + +$result = $storage->deleteFile( + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>' +); \ No newline at end of file diff --git a/docs/examples/storage/get-bucket.md b/docs/examples/storage/get-bucket.md new file mode 100644 index 0000000..5faf6a6 --- /dev/null +++ b/docs/examples/storage/get-bucket.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Storage; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$storage = new Storage($client); + +$result = $storage->getBucket( + bucketId: '<BUCKET_ID>' +); \ No newline at end of file diff --git a/docs/examples/storage/get-file-download.md b/docs/examples/storage/get-file-download.md new file mode 100644 index 0000000..48ee5ad --- /dev/null +++ b/docs/examples/storage/get-file-download.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Storage; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$storage = new Storage($client); + +$result = $storage->getFileDownload( + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>' +); \ No newline at end of file diff --git a/docs/examples/storage/get-file-preview.md b/docs/examples/storage/get-file-preview.md new file mode 100644 index 0000000..4f37f38 --- /dev/null +++ b/docs/examples/storage/get-file-preview.md @@ -0,0 +1,27 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Storage; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$storage = new Storage($client); + +$result = $storage->getFilePreview( + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>', + width: 0, // optional + height: 0, // optional + gravity: ImageGravity::CENTER(), // optional + quality: 0, // optional + borderWidth: 0, // optional + borderColor: '', // optional + borderRadius: 0, // optional + opacity: 0, // optional + rotation: -360, // optional + background: '', // optional + output: ImageFormat::JPG() // optional +); \ No newline at end of file diff --git a/docs/examples/storage/get-file-view.md b/docs/examples/storage/get-file-view.md new file mode 100644 index 0000000..5637fa8 --- /dev/null +++ b/docs/examples/storage/get-file-view.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Storage; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$storage = new Storage($client); + +$result = $storage->getFileView( + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>' +); \ No newline at end of file diff --git a/docs/examples/storage/get-file.md b/docs/examples/storage/get-file.md new file mode 100644 index 0000000..41fdc91 --- /dev/null +++ b/docs/examples/storage/get-file.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Storage; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$storage = new Storage($client); + +$result = $storage->getFile( + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>' +); \ No newline at end of file diff --git a/docs/examples/storage/list-buckets.md b/docs/examples/storage/list-buckets.md new file mode 100644 index 0000000..7a988c2 --- /dev/null +++ b/docs/examples/storage/list-buckets.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Storage; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$storage = new Storage($client); + +$result = $storage->listBuckets( + queries: [], // optional + search: '<SEARCH>' // optional +); \ No newline at end of file diff --git a/docs/examples/storage/list-files.md b/docs/examples/storage/list-files.md new file mode 100644 index 0000000..038b2cd --- /dev/null +++ b/docs/examples/storage/list-files.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Storage; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$storage = new Storage($client); + +$result = $storage->listFiles( + bucketId: '<BUCKET_ID>', + queries: [], // optional + search: '<SEARCH>' // optional +); \ No newline at end of file diff --git a/docs/examples/storage/update-bucket.md b/docs/examples/storage/update-bucket.md new file mode 100644 index 0000000..96bf127 --- /dev/null +++ b/docs/examples/storage/update-bucket.md @@ -0,0 +1,24 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Storage; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$storage = new Storage($client); + +$result = $storage->updateBucket( + bucketId: '<BUCKET_ID>', + name: '<NAME>', + permissions: ["read("any")"], // optional + fileSecurity: false, // optional + enabled: false, // optional + maximumFileSize: 1, // optional + allowedFileExtensions: [], // optional + compression: ::NONE(), // optional + encryption: false, // optional + antivirus: false // optional +); \ No newline at end of file diff --git a/docs/examples/storage/update-file.md b/docs/examples/storage/update-file.md new file mode 100644 index 0000000..0ddc6d5 --- /dev/null +++ b/docs/examples/storage/update-file.md @@ -0,0 +1,18 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Storage; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$storage = new Storage($client); + +$result = $storage->updateFile( + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>', + name: '<NAME>', // optional + permissions: ["read("any")"] // optional +); \ No newline at end of file diff --git a/docs/examples/teams/create-membership.md b/docs/examples/teams/create-membership.md new file mode 100644 index 0000000..061b906 --- /dev/null +++ b/docs/examples/teams/create-membership.md @@ -0,0 +1,21 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Teams; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$teams = new Teams($client); + +$result = $teams->createMembership( + teamId: '<TEAM_ID>', + roles: [], + email: 'email@example.com', // optional + userId: '<USER_ID>', // optional + phone: '+12065550100', // optional + url: 'https://example.com', // optional + name: '<NAME>' // optional +); \ No newline at end of file diff --git a/docs/examples/teams/create.md b/docs/examples/teams/create.md new file mode 100644 index 0000000..5475bdf --- /dev/null +++ b/docs/examples/teams/create.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Teams; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$teams = new Teams($client); + +$result = $teams->create( + teamId: '<TEAM_ID>', + name: '<NAME>', + roles: [] // optional +); \ No newline at end of file diff --git a/docs/examples/teams/delete-membership.md b/docs/examples/teams/delete-membership.md new file mode 100644 index 0000000..15ced89 --- /dev/null +++ b/docs/examples/teams/delete-membership.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Teams; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$teams = new Teams($client); + +$result = $teams->deleteMembership( + teamId: '<TEAM_ID>', + membershipId: '<MEMBERSHIP_ID>' +); \ No newline at end of file diff --git a/docs/examples/teams/delete.md b/docs/examples/teams/delete.md new file mode 100644 index 0000000..98224f7 --- /dev/null +++ b/docs/examples/teams/delete.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Teams; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$teams = new Teams($client); + +$result = $teams->delete( + teamId: '<TEAM_ID>' +); \ No newline at end of file diff --git a/docs/examples/teams/get-membership.md b/docs/examples/teams/get-membership.md new file mode 100644 index 0000000..f27ee3a --- /dev/null +++ b/docs/examples/teams/get-membership.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Teams; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$teams = new Teams($client); + +$result = $teams->getMembership( + teamId: '<TEAM_ID>', + membershipId: '<MEMBERSHIP_ID>' +); \ No newline at end of file diff --git a/docs/examples/teams/get-prefs.md b/docs/examples/teams/get-prefs.md new file mode 100644 index 0000000..932777a --- /dev/null +++ b/docs/examples/teams/get-prefs.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Teams; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$teams = new Teams($client); + +$result = $teams->getPrefs( + teamId: '<TEAM_ID>' +); \ No newline at end of file diff --git a/docs/examples/teams/get.md b/docs/examples/teams/get.md new file mode 100644 index 0000000..21320ee --- /dev/null +++ b/docs/examples/teams/get.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Teams; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$teams = new Teams($client); + +$result = $teams->get( + teamId: '<TEAM_ID>' +); \ No newline at end of file diff --git a/docs/examples/teams/list-memberships.md b/docs/examples/teams/list-memberships.md new file mode 100644 index 0000000..440553c --- /dev/null +++ b/docs/examples/teams/list-memberships.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Teams; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$teams = new Teams($client); + +$result = $teams->listMemberships( + teamId: '<TEAM_ID>', + queries: [], // optional + search: '<SEARCH>' // optional +); \ No newline at end of file diff --git a/docs/examples/teams/list.md b/docs/examples/teams/list.md new file mode 100644 index 0000000..761b6c2 --- /dev/null +++ b/docs/examples/teams/list.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Teams; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$teams = new Teams($client); + +$result = $teams->list( + queries: [], // optional + search: '<SEARCH>' // optional +); \ No newline at end of file diff --git a/docs/examples/teams/update-membership-status.md b/docs/examples/teams/update-membership-status.md new file mode 100644 index 0000000..3c79245 --- /dev/null +++ b/docs/examples/teams/update-membership-status.md @@ -0,0 +1,18 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Teams; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$teams = new Teams($client); + +$result = $teams->updateMembershipStatus( + teamId: '<TEAM_ID>', + membershipId: '<MEMBERSHIP_ID>', + userId: '<USER_ID>', + secret: '<SECRET>' +); \ No newline at end of file diff --git a/docs/examples/teams/update-membership.md b/docs/examples/teams/update-membership.md new file mode 100644 index 0000000..438f354 --- /dev/null +++ b/docs/examples/teams/update-membership.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Teams; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$teams = new Teams($client); + +$result = $teams->updateMembership( + teamId: '<TEAM_ID>', + membershipId: '<MEMBERSHIP_ID>', + roles: [] +); \ No newline at end of file diff --git a/docs/examples/teams/update-name.md b/docs/examples/teams/update-name.md new file mode 100644 index 0000000..cd1f38f --- /dev/null +++ b/docs/examples/teams/update-name.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Teams; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$teams = new Teams($client); + +$result = $teams->updateName( + teamId: '<TEAM_ID>', + name: '<NAME>' +); \ No newline at end of file diff --git a/docs/examples/teams/update-prefs.md b/docs/examples/teams/update-prefs.md new file mode 100644 index 0000000..0dadd2c --- /dev/null +++ b/docs/examples/teams/update-prefs.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Teams; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$teams = new Teams($client); + +$result = $teams->updatePrefs( + teamId: '<TEAM_ID>', + prefs: [] +); \ No newline at end of file diff --git a/docs/examples/users/create-argon2user.md b/docs/examples/users/create-argon2user.md new file mode 100644 index 0000000..7bee3bc --- /dev/null +++ b/docs/examples/users/create-argon2user.md @@ -0,0 +1,18 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->createArgon2User( + userId: '<USER_ID>', + email: 'email@example.com', + password: 'password', + name: '<NAME>' // optional +); \ No newline at end of file diff --git a/docs/examples/users/create-bcrypt-user.md b/docs/examples/users/create-bcrypt-user.md new file mode 100644 index 0000000..631e4cc --- /dev/null +++ b/docs/examples/users/create-bcrypt-user.md @@ -0,0 +1,18 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->createBcryptUser( + userId: '<USER_ID>', + email: 'email@example.com', + password: 'password', + name: '<NAME>' // optional +); \ No newline at end of file diff --git a/docs/examples/users/create-j-w-t.md b/docs/examples/users/create-j-w-t.md new file mode 100644 index 0000000..2f0bc37 --- /dev/null +++ b/docs/examples/users/create-j-w-t.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->createJWT( + userId: '<USER_ID>', + sessionId: '<SESSION_ID>', // optional + duration: 0 // optional +); \ No newline at end of file diff --git a/docs/examples/users/create-m-d5user.md b/docs/examples/users/create-m-d5user.md new file mode 100644 index 0000000..0605f6f --- /dev/null +++ b/docs/examples/users/create-m-d5user.md @@ -0,0 +1,18 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->createMD5User( + userId: '<USER_ID>', + email: 'email@example.com', + password: 'password', + name: '<NAME>' // optional +); \ No newline at end of file diff --git a/docs/examples/users/create-mfa-recovery-codes.md b/docs/examples/users/create-mfa-recovery-codes.md new file mode 100644 index 0000000..f499b22 --- /dev/null +++ b/docs/examples/users/create-mfa-recovery-codes.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->createMfaRecoveryCodes( + userId: '<USER_ID>' +); \ No newline at end of file diff --git a/docs/examples/users/create-p-h-pass-user.md b/docs/examples/users/create-p-h-pass-user.md new file mode 100644 index 0000000..f6dc863 --- /dev/null +++ b/docs/examples/users/create-p-h-pass-user.md @@ -0,0 +1,18 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->createPHPassUser( + userId: '<USER_ID>', + email: 'email@example.com', + password: 'password', + name: '<NAME>' // optional +); \ No newline at end of file diff --git a/docs/examples/users/create-s-h-a-user.md b/docs/examples/users/create-s-h-a-user.md new file mode 100644 index 0000000..777096d --- /dev/null +++ b/docs/examples/users/create-s-h-a-user.md @@ -0,0 +1,19 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->createSHAUser( + userId: '<USER_ID>', + email: 'email@example.com', + password: 'password', + passwordVersion: PasswordHash::SHA1(), // optional + name: '<NAME>' // optional +); \ No newline at end of file diff --git a/docs/examples/users/create-scrypt-modified-user.md b/docs/examples/users/create-scrypt-modified-user.md new file mode 100644 index 0000000..4f8423f --- /dev/null +++ b/docs/examples/users/create-scrypt-modified-user.md @@ -0,0 +1,21 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->createScryptModifiedUser( + userId: '<USER_ID>', + email: 'email@example.com', + password: 'password', + passwordSalt: '<PASSWORD_SALT>', + passwordSaltSeparator: '<PASSWORD_SALT_SEPARATOR>', + passwordSignerKey: '<PASSWORD_SIGNER_KEY>', + name: '<NAME>' // optional +); \ No newline at end of file diff --git a/docs/examples/users/create-scrypt-user.md b/docs/examples/users/create-scrypt-user.md new file mode 100644 index 0000000..2ccc5d7 --- /dev/null +++ b/docs/examples/users/create-scrypt-user.md @@ -0,0 +1,23 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->createScryptUser( + userId: '<USER_ID>', + email: 'email@example.com', + password: 'password', + passwordSalt: '<PASSWORD_SALT>', + passwordCpu: null, + passwordMemory: null, + passwordParallel: null, + passwordLength: null, + name: '<NAME>' // optional +); \ No newline at end of file diff --git a/docs/examples/users/create-session.md b/docs/examples/users/create-session.md new file mode 100644 index 0000000..97d8c8a --- /dev/null +++ b/docs/examples/users/create-session.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->createSession( + userId: '<USER_ID>' +); \ No newline at end of file diff --git a/docs/examples/users/create-target.md b/docs/examples/users/create-target.md new file mode 100644 index 0000000..03104bc --- /dev/null +++ b/docs/examples/users/create-target.md @@ -0,0 +1,21 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; +use Appwrite\Enums\MessagingProviderType; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->createTarget( + userId: '<USER_ID>', + targetId: '<TARGET_ID>', + providerType: MessagingProviderType::EMAIL(), + identifier: '<IDENTIFIER>', + providerId: '<PROVIDER_ID>', // optional + name: '<NAME>' // optional +); \ No newline at end of file diff --git a/docs/examples/users/create-token.md b/docs/examples/users/create-token.md new file mode 100644 index 0000000..b08faac --- /dev/null +++ b/docs/examples/users/create-token.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->createToken( + userId: '<USER_ID>', + length: 4, // optional + expire: 60 // optional +); \ No newline at end of file diff --git a/docs/examples/users/create.md b/docs/examples/users/create.md new file mode 100644 index 0000000..a50e10e --- /dev/null +++ b/docs/examples/users/create.md @@ -0,0 +1,19 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->create( + userId: '<USER_ID>', + email: 'email@example.com', // optional + phone: '+12065550100', // optional + password: '', // optional + name: '<NAME>' // optional +); \ No newline at end of file diff --git a/docs/examples/users/delete-identity.md b/docs/examples/users/delete-identity.md new file mode 100644 index 0000000..138b89f --- /dev/null +++ b/docs/examples/users/delete-identity.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->deleteIdentity( + identityId: '<IDENTITY_ID>' +); \ No newline at end of file diff --git a/docs/examples/users/delete-mfa-authenticator.md b/docs/examples/users/delete-mfa-authenticator.md new file mode 100644 index 0000000..d25c2b7 --- /dev/null +++ b/docs/examples/users/delete-mfa-authenticator.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; +use Appwrite\Enums\AuthenticatorType; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->deleteMfaAuthenticator( + userId: '<USER_ID>', + type: AuthenticatorType::TOTP() +); \ No newline at end of file diff --git a/docs/examples/users/delete-session.md b/docs/examples/users/delete-session.md new file mode 100644 index 0000000..bf673b2 --- /dev/null +++ b/docs/examples/users/delete-session.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->deleteSession( + userId: '<USER_ID>', + sessionId: '<SESSION_ID>' +); \ No newline at end of file diff --git a/docs/examples/users/delete-sessions.md b/docs/examples/users/delete-sessions.md new file mode 100644 index 0000000..f2a3f21 --- /dev/null +++ b/docs/examples/users/delete-sessions.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->deleteSessions( + userId: '<USER_ID>' +); \ No newline at end of file diff --git a/docs/examples/users/delete-target.md b/docs/examples/users/delete-target.md new file mode 100644 index 0000000..20e676a --- /dev/null +++ b/docs/examples/users/delete-target.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->deleteTarget( + userId: '<USER_ID>', + targetId: '<TARGET_ID>' +); \ No newline at end of file diff --git a/docs/examples/users/delete.md b/docs/examples/users/delete.md new file mode 100644 index 0000000..225708c --- /dev/null +++ b/docs/examples/users/delete.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->delete( + userId: '<USER_ID>' +); \ No newline at end of file diff --git a/docs/examples/users/get-mfa-recovery-codes.md b/docs/examples/users/get-mfa-recovery-codes.md new file mode 100644 index 0000000..055ef04 --- /dev/null +++ b/docs/examples/users/get-mfa-recovery-codes.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->getMfaRecoveryCodes( + userId: '<USER_ID>' +); \ No newline at end of file diff --git a/docs/examples/users/get-prefs.md b/docs/examples/users/get-prefs.md new file mode 100644 index 0000000..392dc14 --- /dev/null +++ b/docs/examples/users/get-prefs.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->getPrefs( + userId: '<USER_ID>' +); \ No newline at end of file diff --git a/docs/examples/users/get-target.md b/docs/examples/users/get-target.md new file mode 100644 index 0000000..7ca05d3 --- /dev/null +++ b/docs/examples/users/get-target.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->getTarget( + userId: '<USER_ID>', + targetId: '<TARGET_ID>' +); \ No newline at end of file diff --git a/docs/examples/users/get.md b/docs/examples/users/get.md new file mode 100644 index 0000000..1cc351a --- /dev/null +++ b/docs/examples/users/get.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->get( + userId: '<USER_ID>' +); \ No newline at end of file diff --git a/docs/examples/users/list-identities.md b/docs/examples/users/list-identities.md new file mode 100644 index 0000000..040e309 --- /dev/null +++ b/docs/examples/users/list-identities.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->listIdentities( + queries: [], // optional + search: '<SEARCH>' // optional +); \ No newline at end of file diff --git a/docs/examples/users/list-logs.md b/docs/examples/users/list-logs.md new file mode 100644 index 0000000..e717bdf --- /dev/null +++ b/docs/examples/users/list-logs.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->listLogs( + userId: '<USER_ID>', + queries: [] // optional +); \ No newline at end of file diff --git a/docs/examples/users/list-memberships.md b/docs/examples/users/list-memberships.md new file mode 100644 index 0000000..da760e0 --- /dev/null +++ b/docs/examples/users/list-memberships.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->listMemberships( + userId: '<USER_ID>' +); \ No newline at end of file diff --git a/docs/examples/users/list-mfa-factors.md b/docs/examples/users/list-mfa-factors.md new file mode 100644 index 0000000..16964c5 --- /dev/null +++ b/docs/examples/users/list-mfa-factors.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->listMfaFactors( + userId: '<USER_ID>' +); \ No newline at end of file diff --git a/docs/examples/users/list-sessions.md b/docs/examples/users/list-sessions.md new file mode 100644 index 0000000..0bfa242 --- /dev/null +++ b/docs/examples/users/list-sessions.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->listSessions( + userId: '<USER_ID>' +); \ No newline at end of file diff --git a/docs/examples/users/list-targets.md b/docs/examples/users/list-targets.md new file mode 100644 index 0000000..c4815be --- /dev/null +++ b/docs/examples/users/list-targets.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->listTargets( + userId: '<USER_ID>', + queries: [] // optional +); \ No newline at end of file diff --git a/docs/examples/users/list.md b/docs/examples/users/list.md new file mode 100644 index 0000000..678e97f --- /dev/null +++ b/docs/examples/users/list.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->list( + queries: [], // optional + search: '<SEARCH>' // optional +); \ No newline at end of file diff --git a/docs/examples/users/update-email-verification.md b/docs/examples/users/update-email-verification.md new file mode 100644 index 0000000..d2d6584 --- /dev/null +++ b/docs/examples/users/update-email-verification.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->updateEmailVerification( + userId: '<USER_ID>', + emailVerification: false +); \ No newline at end of file diff --git a/docs/examples/users/update-email.md b/docs/examples/users/update-email.md new file mode 100644 index 0000000..a73100c --- /dev/null +++ b/docs/examples/users/update-email.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->updateEmail( + userId: '<USER_ID>', + email: 'email@example.com' +); \ No newline at end of file diff --git a/docs/examples/users/update-labels.md b/docs/examples/users/update-labels.md new file mode 100644 index 0000000..9651830 --- /dev/null +++ b/docs/examples/users/update-labels.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->updateLabels( + userId: '<USER_ID>', + labels: [] +); \ No newline at end of file diff --git a/docs/examples/users/update-mfa-recovery-codes.md b/docs/examples/users/update-mfa-recovery-codes.md new file mode 100644 index 0000000..d09ccd7 --- /dev/null +++ b/docs/examples/users/update-mfa-recovery-codes.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->updateMfaRecoveryCodes( + userId: '<USER_ID>' +); \ No newline at end of file diff --git a/docs/examples/users/update-mfa.md b/docs/examples/users/update-mfa.md new file mode 100644 index 0000000..5ab48c5 --- /dev/null +++ b/docs/examples/users/update-mfa.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->updateMfa( + userId: '<USER_ID>', + mfa: false +); \ No newline at end of file diff --git a/docs/examples/users/update-name.md b/docs/examples/users/update-name.md new file mode 100644 index 0000000..96e8afc --- /dev/null +++ b/docs/examples/users/update-name.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->updateName( + userId: '<USER_ID>', + name: '<NAME>' +); \ No newline at end of file diff --git a/docs/examples/users/update-password.md b/docs/examples/users/update-password.md new file mode 100644 index 0000000..ffcb817 --- /dev/null +++ b/docs/examples/users/update-password.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->updatePassword( + userId: '<USER_ID>', + password: '' +); \ No newline at end of file diff --git a/docs/examples/users/update-phone-verification.md b/docs/examples/users/update-phone-verification.md new file mode 100644 index 0000000..8054531 --- /dev/null +++ b/docs/examples/users/update-phone-verification.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->updatePhoneVerification( + userId: '<USER_ID>', + phoneVerification: false +); \ No newline at end of file diff --git a/docs/examples/users/update-phone.md b/docs/examples/users/update-phone.md new file mode 100644 index 0000000..5828633 --- /dev/null +++ b/docs/examples/users/update-phone.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->updatePhone( + userId: '<USER_ID>', + number: '+12065550100' +); \ No newline at end of file diff --git a/docs/examples/users/update-prefs.md b/docs/examples/users/update-prefs.md new file mode 100644 index 0000000..6d0ecad --- /dev/null +++ b/docs/examples/users/update-prefs.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->updatePrefs( + userId: '<USER_ID>', + prefs: [] +); \ No newline at end of file diff --git a/docs/examples/users/update-status.md b/docs/examples/users/update-status.md new file mode 100644 index 0000000..7ffbfc2 --- /dev/null +++ b/docs/examples/users/update-status.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->updateStatus( + userId: '<USER_ID>', + status: false +); \ No newline at end of file diff --git a/docs/examples/users/update-target.md b/docs/examples/users/update-target.md new file mode 100644 index 0000000..5c476db --- /dev/null +++ b/docs/examples/users/update-target.md @@ -0,0 +1,19 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->updateTarget( + userId: '<USER_ID>', + targetId: '<TARGET_ID>', + identifier: '<IDENTIFIER>', // optional + providerId: '<PROVIDER_ID>', // optional + name: '<NAME>' // optional +); \ No newline at end of file diff --git a/docs/functions.md b/docs/functions.md new file mode 100644 index 0000000..06fccc8 --- /dev/null +++ b/docs/functions.md @@ -0,0 +1,417 @@ +# Functions Service + +## List functions + +```http request +GET https://cloud.appwrite.io/v1/functions +``` + +** Get a list of all the project's functions. 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, enabled, runtime, deployment, schedule, scheduleNext, schedulePrevious, timeout, entrypoint, commands, installationId | [] | +| search | string | Search term to filter your list results. Max length: 256 chars. | | + +## Create function + +```http request +POST https://cloud.appwrite.io/v1/functions +``` + +** Create a new function. You can pass a list of [permissions](https://appwrite.io/docs/permissions) to allow different project users or team with access to execute the function using the client API. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| functionId | string | Function 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 | Function name. Max length: 128 chars. | | +| runtime | string | Execution runtime. | | +| execute | array | An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. | [] | +| events | array | Events list. Maximum of 100 events are allowed. | [] | +| schedule | string | Schedule CRON syntax. | | +| timeout | integer | Function maximum execution time in seconds. | 15 | +| enabled | boolean | Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled. | 1 | +| logging | boolean | Whether executions will be logged. When set to false, executions will not be logged, but will reduce resource used by your Appwrite project. | 1 | +| entrypoint | string | Entrypoint File. This path is relative to the "providerRootDirectory". | | +| commands | string | Build Commands. | | +| scopes | array | List of scopes allowed for API key auto-generated for every execution. Maximum of 100 scopes are allowed. | [] | +| installationId | string | Appwrite Installation ID for VCS (Version Control System) deployment. | | +| providerRepositoryId | string | Repository ID of the repo linked to the function. | | +| providerBranch | string | Production branch for the repo linked to the function. | | +| providerSilentMode | boolean | Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests. | | +| providerRootDirectory | string | Path to function code in the linked repo. | | +| templateRepository | string | Repository name of the template. | | +| templateOwner | string | The name of the owner of the template. | | +| templateRootDirectory | string | Path to function code in the template repo. | | +| templateVersion | string | Version (tag) for the repo linked to the function template. | | + +## List runtimes + +```http request +GET https://cloud.appwrite.io/v1/functions/runtimes +``` + +** Get a list of all runtimes that are currently active on your instance. ** + +## List function templates + +```http request +GET https://cloud.appwrite.io/v1/functions/templates +``` + +** List available function templates. You can use template details in [createFunction](/docs/references/cloud/server-nodejs/functions#create) method. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| runtimes | array | List of runtimes allowed for filtering function templates. Maximum of 100 runtimes are allowed. | [] | +| useCases | array | List of use cases allowed for filtering function templates. Maximum of 100 use cases are allowed. | [] | +| limit | integer | Limit the number of templates returned in the response. Default limit is 25, and maximum limit is 5000. | 25 | +| offset | integer | Offset the list of returned templates. Maximum offset is 5000. | 0 | + +## Get function template + +```http request +GET https://cloud.appwrite.io/v1/functions/templates/{templateId} +``` + +** Get a function template using ID. You can use template details in [createFunction](/docs/references/cloud/server-nodejs/functions#create) method. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| templateId | string | **Required** Template ID. | | + +## Get function + +```http request +GET https://cloud.appwrite.io/v1/functions/{functionId} +``` + +** Get a function by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| functionId | string | **Required** Function ID. | | + +## Update function + +```http request +PUT https://cloud.appwrite.io/v1/functions/{functionId} +``` + +** Update function by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| functionId | string | **Required** Function ID. | | +| name | string | Function name. Max length: 128 chars. | | +| runtime | string | Execution runtime. | | +| execute | array | An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. | [] | +| events | array | Events list. Maximum of 100 events are allowed. | [] | +| schedule | string | Schedule CRON syntax. | | +| timeout | integer | Maximum execution time in seconds. | 15 | +| enabled | boolean | Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled. | 1 | +| logging | boolean | Whether executions will be logged. When set to false, executions will not be logged, but will reduce resource used by your Appwrite project. | 1 | +| entrypoint | string | Entrypoint File. This path is relative to the "providerRootDirectory". | | +| commands | string | Build Commands. | | +| scopes | array | List of scopes allowed for API Key auto-generated for every execution. Maximum of 100 scopes are allowed. | [] | +| installationId | string | Appwrite Installation ID for VCS (Version Controle System) deployment. | | +| providerRepositoryId | string | Repository ID of the repo linked to the function | | +| providerBranch | string | Production branch for the repo linked to the function | | +| providerSilentMode | boolean | Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests. | | +| providerRootDirectory | string | Path to function code in the linked repo. | | + +## Delete function + +```http request +DELETE https://cloud.appwrite.io/v1/functions/{functionId} +``` + +** Delete a function by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| functionId | string | **Required** Function ID. | | + +## List deployments + +```http request +GET https://cloud.appwrite.io/v1/functions/{functionId}/deployments +``` + +** Get a list of all the project's code deployments. You can use the query params to filter your results. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| functionId | string | **Required** Function 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: size, buildId, activate, entrypoint, commands, type, size | [] | +| search | string | Search term to filter your list results. Max length: 256 chars. | | + +## Create deployment + +```http request +POST https://cloud.appwrite.io/v1/functions/{functionId}/deployments +``` + +** Create a new function code deployment. Use this endpoint to upload a new version of your code function. To execute your newly uploaded code, you'll need to update the function's deployment to use your new deployment UID. + +This endpoint accepts a tar.gz file compressed with your code. Make sure to include any dependencies your code has within the compressed file. You can learn more about code packaging in the [Appwrite Cloud Functions tutorial](https://appwrite.io/docs/functions). + +Use the "command" param to set the entrypoint used to execute your code. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| functionId | string | **Required** Function ID. | | +| entrypoint | string | Entrypoint File. | | +| commands | string | Build Commands. | | +| code | file | Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory. | | +| activate | boolean | Automatically activate the deployment when it is finished building. | | + +## Get deployment + +```http request +GET https://cloud.appwrite.io/v1/functions/{functionId}/deployments/{deploymentId} +``` + +** Get a code deployment by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| functionId | string | **Required** Function ID. | | +| deploymentId | string | **Required** Deployment ID. | | + +## Update deployment + +```http request +PATCH https://cloud.appwrite.io/v1/functions/{functionId}/deployments/{deploymentId} +``` + +** Update the function code deployment ID using the unique function ID. Use this endpoint to switch the code deployment that should be executed by the execution endpoint. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| functionId | string | **Required** Function ID. | | +| deploymentId | string | **Required** Deployment ID. | | + +## Delete deployment + +```http request +DELETE https://cloud.appwrite.io/v1/functions/{functionId}/deployments/{deploymentId} +``` + +** Delete a code deployment by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| functionId | string | **Required** Function ID. | | +| deploymentId | string | **Required** Deployment ID. | | + +## Rebuild deployment + +```http request +POST https://cloud.appwrite.io/v1/functions/{functionId}/deployments/{deploymentId}/build +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| functionId | string | **Required** Function ID. | | +| deploymentId | string | **Required** Deployment ID. | | +| buildId | string | Build unique ID. | | + +## Cancel deployment + +```http request +PATCH https://cloud.appwrite.io/v1/functions/{functionId}/deployments/{deploymentId}/build +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| functionId | string | **Required** Function ID. | | +| deploymentId | string | **Required** Deployment ID. | | + +## Download deployment + +```http request +GET https://cloud.appwrite.io/v1/functions/{functionId}/deployments/{deploymentId}/download +``` + +** Get a Deployment's contents by its unique ID. This endpoint supports range requests for partial or streaming file download. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| functionId | string | **Required** Function ID. | | +| deploymentId | string | **Required** Deployment ID. | | + +## List executions + +```http request +GET https://cloud.appwrite.io/v1/functions/{functionId}/executions +``` + +** Get a list of all the current user function execution logs. You can use the query params to filter your results. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| functionId | string | **Required** Function 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: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId | [] | +| search | string | Search term to filter your list results. Max length: 256 chars. | | + +## Create execution + +```http request +POST https://cloud.appwrite.io/v1/functions/{functionId}/executions +``` + +** Trigger a function execution. The returned object will return you the current execution status. You can ping the `Get Execution` endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| functionId | string | **Required** Function ID. | | +| body | string | HTTP body of execution. Default value is empty string. | | +| async | boolean | Execute code in the background. Default value is false. | | +| path | string | HTTP path of execution. Path can include query params. Default value is / | / | +| method | string | HTTP method of execution. Default value is GET. | POST | +| headers | object | HTTP headers of execution. Defaults to empty. | {} | +| scheduledAt | string | Scheduled execution time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future with precision in minutes. | | + +## Get execution + +```http request +GET https://cloud.appwrite.io/v1/functions/{functionId}/executions/{executionId} +``` + +** Get a function execution log by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| functionId | string | **Required** Function ID. | | +| executionId | string | **Required** Execution ID. | | + +## Delete execution + +```http request +DELETE https://cloud.appwrite.io/v1/functions/{functionId}/executions/{executionId} +``` + +** Delete a function execution by its unique ID. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| functionId | string | **Required** Function ID. | | +| executionId | string | **Required** Execution ID. | | + +## List variables + +```http request +GET https://cloud.appwrite.io/v1/functions/{functionId}/variables +``` + +** Get a list of all variables of a specific function. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| functionId | string | **Required** Function unique ID. | | + +## Create variable + +```http request +POST https://cloud.appwrite.io/v1/functions/{functionId}/variables +``` + +** Create a new function environment variable. These variables can be accessed in the function at runtime as environment variables. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| functionId | string | **Required** Function unique ID. | | +| key | string | Variable key. Max length: 255 chars. | | +| value | string | Variable value. Max length: 8192 chars. | | + +## Get variable + +```http request +GET https://cloud.appwrite.io/v1/functions/{functionId}/variables/{variableId} +``` + +** Get a variable by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| functionId | string | **Required** Function unique ID. | | +| variableId | string | **Required** Variable unique ID. | | + +## Update variable + +```http request +PUT https://cloud.appwrite.io/v1/functions/{functionId}/variables/{variableId} +``` + +** Update variable by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| functionId | string | **Required** Function unique ID. | | +| variableId | string | **Required** Variable unique ID. | | +| key | string | Variable key. Max length: 255 chars. | | +| value | string | Variable value. Max length: 8192 chars. | | + +## Delete variable + +```http request +DELETE https://cloud.appwrite.io/v1/functions/{functionId}/variables/{variableId} +``` + +** Delete a variable by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| functionId | string | **Required** Function unique ID. | | +| variableId | string | **Required** Variable unique ID. | | + diff --git a/docs/graphql.md b/docs/graphql.md new file mode 100644 index 0000000..e012b47 --- /dev/null +++ b/docs/graphql.md @@ -0,0 +1,30 @@ +# Graphql Service + +## GraphQL endpoint + +```http request +POST https://cloud.appwrite.io/v1/graphql +``` + +** Execute a GraphQL mutation. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| query | object | The query or queries to execute. | {} | + +## GraphQL endpoint + +```http request +POST https://cloud.appwrite.io/v1/graphql/mutation +``` + +** Execute a GraphQL mutation. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| query | object | The query or queries to execute. | {} | + diff --git a/docs/health.md b/docs/health.md new file mode 100644 index 0000000..083119e --- /dev/null +++ b/docs/health.md @@ -0,0 +1,273 @@ +# Health Service + +## Get HTTP + +```http request +GET https://cloud.appwrite.io/v1/health +``` + +** Check the Appwrite HTTP server is up and responsive. ** + +## Get antivirus + +```http request +GET https://cloud.appwrite.io/v1/health/anti-virus +``` + +** Check the Appwrite Antivirus server is up and connection is successful. ** + +## Get cache + +```http request +GET https://cloud.appwrite.io/v1/health/cache +``` + +** Check the Appwrite in-memory cache servers are up and connection is successful. ** + +## Get the SSL certificate for a domain + +```http request +GET https://cloud.appwrite.io/v1/health/certificate +``` + +** Get the SSL certificate for a domain ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| domain | string | string | | + +## Get DB + +```http request +GET https://cloud.appwrite.io/v1/health/db +``` + +** Check the Appwrite database servers are up and connection is successful. ** + +## Get pubsub + +```http request +GET https://cloud.appwrite.io/v1/health/pubsub +``` + +** Check the Appwrite pub-sub servers are up and connection is successful. ** + +## Get queue + +```http request +GET https://cloud.appwrite.io/v1/health/queue +``` + +** Check the Appwrite queue messaging servers are up and connection is successful. ** + +## Get builds queue + +```http request +GET https://cloud.appwrite.io/v1/health/queue/builds +``` + +** Get the number of builds that are waiting to be processed in the Appwrite internal queue server. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 5000 | + +## Get certificates queue + +```http request +GET https://cloud.appwrite.io/v1/health/queue/certificates +``` + +** Get the number of certificates that are waiting to be issued against [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue server. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 5000 | + +## Get databases queue + +```http request +GET https://cloud.appwrite.io/v1/health/queue/databases +``` + +** Get the number of database changes that are waiting to be processed in the Appwrite internal queue server. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| name | string | Queue name for which to check the queue size | database_db_main | +| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 5000 | + +## Get deletes queue + +```http request +GET https://cloud.appwrite.io/v1/health/queue/deletes +``` + +** Get the number of background destructive changes that are waiting to be processed in the Appwrite internal queue server. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 5000 | + +## Get number of failed queue jobs + +```http request +GET https://cloud.appwrite.io/v1/health/queue/failed/{name} +``` + +** Returns the amount of failed jobs in a given queue. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| name | string | **Required** The name of the queue | | +| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 5000 | + +## Get functions queue + +```http request +GET https://cloud.appwrite.io/v1/health/queue/functions +``` + +** Get the number of function executions that are waiting to be processed in the Appwrite internal queue server. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 5000 | + +## Get logs queue + +```http request +GET https://cloud.appwrite.io/v1/health/queue/logs +``` + +** Get the number of logs that are waiting to be processed in the Appwrite internal queue server. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 5000 | + +## Get mails queue + +```http request +GET https://cloud.appwrite.io/v1/health/queue/mails +``` + +** Get the number of mails that are waiting to be processed in the Appwrite internal queue server. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 5000 | + +## Get messaging queue + +```http request +GET https://cloud.appwrite.io/v1/health/queue/messaging +``` + +** Get the number of messages that are waiting to be processed in the Appwrite internal queue server. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 5000 | + +## Get migrations queue + +```http request +GET https://cloud.appwrite.io/v1/health/queue/migrations +``` + +** Get the number of migrations that are waiting to be processed in the Appwrite internal queue server. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 5000 | + +## Get usage queue + +```http request +GET https://cloud.appwrite.io/v1/health/queue/usage +``` + +** Get the number of metrics that are waiting to be processed in the Appwrite internal queue server. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 5000 | + +## Get usage dump queue + +```http request +GET https://cloud.appwrite.io/v1/health/queue/usage-dump +``` + +** Get the number of projects containing metrics that are waiting to be processed in the Appwrite internal queue server. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 5000 | + +## Get webhooks queue + +```http request +GET https://cloud.appwrite.io/v1/health/queue/webhooks +``` + +** Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 5000 | + +## Get storage + +```http request +GET https://cloud.appwrite.io/v1/health/storage +``` + +** Check the Appwrite storage device is up and connection is successful. ** + +## Get local storage + +```http request +GET https://cloud.appwrite.io/v1/health/storage/local +``` + +** Check the Appwrite local storage device is up and connection is successful. ** + +## Get time + +```http request +GET https://cloud.appwrite.io/v1/health/time +``` + +** Check the Appwrite server time is synced with Google remote NTP server. We use this technology to smoothly handle leap seconds with no disruptive events. The [Network Time Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is used by hundreds of millions of computers and devices to synchronize their clocks over the Internet. If your computer sets its own clock, it likely uses NTP. ** + diff --git a/docs/locale.md b/docs/locale.md new file mode 100644 index 0000000..6678bf2 --- /dev/null +++ b/docs/locale.md @@ -0,0 +1,68 @@ +# Locale Service + +## Get user locale + +```http request +GET https://cloud.appwrite.io/v1/locale +``` + +** Get the current user location based on IP. Returns an object with user country code, country name, continent name, continent code, ip address and suggested currency. You can use the locale header to get the data in a supported language. + +([IP Geolocation by DB-IP](https://db-ip.com)) ** + +## List Locale Codes + +```http request +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). ** + +## List continents + +```http request +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. ** + +## List countries + +```http request +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. ** + +## List EU countries + +```http request +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. ** + +## List countries phone codes + +```http request +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. ** + +## List currencies + +```http request +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. ** + +## List languages + +```http request +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. ** + diff --git a/docs/messaging.md b/docs/messaging.md new file mode 100644 index 0000000..f4fc48f --- /dev/null +++ b/docs/messaging.md @@ -0,0 +1,864 @@ +# Messaging Service + +## List messages + +```http request +GET https://cloud.appwrite.io/v1/messaging/messages +``` + +** Get a list of all messages from the current Appwrite project. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| queries | array | Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: scheduledAt, deliveredAt, deliveredTotal, status, description, providerType | [] | +| search | string | Search term to filter your list results. Max length: 256 chars. | | + +## Create email + +```http request +POST https://cloud.appwrite.io/v1/messaging/messages/email +``` + +** Create a new email message. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| messageId | string | Message 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. | | +| subject | string | Email Subject. | | +| content | string | Email Content. | | +| topics | array | List of Topic IDs. | [] | +| users | array | List of User IDs. | [] | +| targets | array | List of Targets IDs. | [] | +| cc | array | Array of target IDs to be added as CC. | [] | +| bcc | array | Array of target IDs to be added as BCC. | [] | +| attachments | array | Array of compound ID strings of bucket IDs and file IDs to be attached to the email. They should be formatted as <BUCKET_ID>:<FILE_ID>. | [] | +| 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. | | + +## Update email + +```http request +PATCH https://cloud.appwrite.io/v1/messaging/messages/email/{messageId} +``` + +** Update an email message by its unique ID. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| messageId | string | **Required** Message ID. | | +| topics | array | List of Topic IDs. | | +| users | array | List of User IDs. | | +| targets | array | List of Targets IDs. | | +| subject | string | Email Subject. | | +| content | string | Email Content. | | +| draft | boolean | Is message a draft | | +| html | boolean | Is content of type HTML | | +| cc | array | Array of target IDs to be added as CC. | | +| 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 <BUCKET_ID>:<FILE_ID>. | | + +## Create push notification + +```http request +POST https://cloud.appwrite.io/v1/messaging/messages/push +``` + +** Create a new push notification. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| messageId | string | Message 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. | | +| title | string | Title for push notification. | | +| body | string | Body for push notification. | | +| topics | array | List of Topic IDs. | [] | +| users | array | List of User IDs. | [] | +| targets | array | List of Targets IDs. | [] | +| data | object | Additional Data for push notification. | {} | +| action | string | Action for push notification. | | +| image | string | Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage. It should be formatted as <BUCKET_ID>:<FILE_ID>. | | +| icon | string | Icon for push notification. Available only for Android and Web Platform. | | +| sound | string | Sound for push notification. Available only for Android and IOS Platform. | | +| color | string | Color for push notification. Available only for Android Platform. | | +| tag | string | Tag for push notification. Available only for Android Platform. | | +| badge | string | Badge for push notification. Available only for IOS Platform. | | +| draft | boolean | Is message a draft | | +| 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. | | + +## Update push notification + +```http request +PATCH https://cloud.appwrite.io/v1/messaging/messages/push/{messageId} +``` + +** Update a push notification by its unique ID. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| messageId | string | **Required** Message ID. | | +| topics | array | List of Topic IDs. | | +| users | array | List of User IDs. | | +| targets | array | List of Targets IDs. | | +| title | string | Title for push notification. | | +| body | string | Body for push notification. | | +| data | object | Additional Data for push notification. | {} | +| action | string | Action for push notification. | | +| image | string | Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage. It should be formatted as <BUCKET_ID>:<FILE_ID>. | | +| icon | string | Icon for push notification. Available only for Android and Web platforms. | | +| sound | string | Sound for push notification. Available only for Android and iOS platforms. | | +| color | string | Color for push notification. Available only for Android platforms. | | +| tag | string | Tag for push notification. Available only for Android platforms. | | +| badge | integer | Badge for push notification. Available only for iOS platforms. | | +| draft | boolean | Is message a draft | | +| 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. | | + +## Create SMS + +```http request +POST https://cloud.appwrite.io/v1/messaging/messages/sms +``` + +** Create a new SMS message. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| messageId | string | Message 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. | | +| content | string | SMS Content. | | +| topics | array | List of Topic IDs. | [] | +| users | array | List of User IDs. | [] | +| targets | array | List of Targets IDs. | [] | +| draft | boolean | Is message a draft | | +| 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. | | + +## Update SMS + +```http request +PATCH https://cloud.appwrite.io/v1/messaging/messages/sms/{messageId} +``` + +** Update an email message by its unique ID. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| messageId | string | **Required** Message ID. | | +| topics | array | List of Topic IDs. | | +| users | array | List of User IDs. | | +| targets | array | List of Targets IDs. | | +| content | string | Email Content. | | +| draft | boolean | Is message a draft | | +| 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. | | + +## Get message + +```http request +GET https://cloud.appwrite.io/v1/messaging/messages/{messageId} +``` + +** Get a message by its unique ID. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| messageId | string | **Required** Message ID. | | + +## Delete message + +```http request +DELETE https://cloud.appwrite.io/v1/messaging/messages/{messageId} +``` + +** Delete a message. If the message is not a draft or scheduled, but has been sent, this will not recall the message. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| messageId | string | **Required** Message ID. | | + +## List message logs + +```http request +GET https://cloud.appwrite.io/v1/messaging/messages/{messageId}/logs +``` + +** Get the message activity logs listed by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| messageId | string | **Required** Message 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). Only supported methods are limit and offset | [] | + +## List message targets + +```http request +GET https://cloud.appwrite.io/v1/messaging/messages/{messageId}/targets +``` + +** Get a list of the targets associated with a message. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| messageId | string | **Required** Message 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: userId, providerId, identifier, providerType | [] | + +## List providers + +```http request +GET https://cloud.appwrite.io/v1/messaging/providers +``` + +** Get a list of all providers from the current Appwrite project. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| queries | array | Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, provider, type, enabled | [] | +| search | string | Search term to filter your list results. Max length: 256 chars. | | + +## Create APNS provider + +```http request +POST https://cloud.appwrite.io/v1/messaging/providers/apns +``` + +** Create a new Apple Push Notification service 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. | | +| authKey | string | APNS authentication key. | | +| authKeyId | string | APNS authentication key ID. | | +| teamId | string | APNS team ID. | | +| bundleId | string | APNS bundle ID. | | +| sandbox | boolean | Use APNS sandbox environment. | | +| enabled | boolean | Set as enabled. | | + +## Update APNS provider + +```http request +PATCH https://cloud.appwrite.io/v1/messaging/providers/apns/{providerId} +``` + +** Update a Apple Push Notification service 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. | | +| authKey | string | APNS authentication key. | | +| authKeyId | string | APNS authentication key ID. | | +| teamId | string | APNS team ID. | | +| bundleId | string | APNS bundle ID. | | +| sandbox | boolean | Use APNS sandbox environment. | | + +## Create FCM provider + +```http request +POST https://cloud.appwrite.io/v1/messaging/providers/fcm +``` + +** Create a new Firebase Cloud Messaging 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. | | +| serviceAccountJSON | object | FCM service account JSON. | {} | +| enabled | boolean | Set as enabled. | | + +## Update FCM provider + +```http request +PATCH https://cloud.appwrite.io/v1/messaging/providers/fcm/{providerId} +``` + +** Update a Firebase Cloud Messaging 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. | | +| serviceAccountJSON | object | FCM service account JSON. | {} | + +## Create Mailgun provider + +```http request +POST https://cloud.appwrite.io/v1/messaging/providers/mailgun +``` + +** Create a new Mailgun 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. | | +| apiKey | string | Mailgun API Key. | | +| domain | string | Mailgun Domain. | | +| isEuRegion | boolean | Set as EU region. | | +| fromName | string | Sender Name. | | +| fromEmail | string | Sender email address. | | +| replyToName | string | Name set in the reply to field for the mail. Default value is sender name. Reply to name must have reply to email as well. | | +| replyToEmail | string | Email set in the reply to field for the mail. Default value is sender email. Reply to email must have reply to name as well. | | +| enabled | boolean | Set as enabled. | | + +## Update Mailgun provider + +```http request +PATCH https://cloud.appwrite.io/v1/messaging/providers/mailgun/{providerId} +``` + +** Update a Mailgun provider by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| providerId | string | **Required** Provider ID. | | +| name | string | Provider name. | | +| apiKey | string | Mailgun API Key. | | +| domain | string | Mailgun Domain. | | +| isEuRegion | boolean | Set as EU region. | | +| enabled | boolean | Set as enabled. | | +| fromName | string | Sender Name. | | +| fromEmail | string | Sender email address. | | +| replyToName | string | Name set in the reply to field for the mail. Default value is sender name. | | +| replyToEmail | string | Email set in the reply to field for the mail. Default value is sender email. | | + +## Create Msg91 provider + +```http request +POST https://cloud.appwrite.io/v1/messaging/providers/msg91 +``` + +** Create a new MSG91 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. | | +| templateId | string | Msg91 template ID | | +| senderId | string | Msg91 sender ID. | | +| authKey | string | Msg91 auth key. | | +| enabled | boolean | Set as enabled. | | + +## Update Msg91 provider + +```http request +PATCH https://cloud.appwrite.io/v1/messaging/providers/msg91/{providerId} +``` + +** Update a MSG91 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. | | +| templateId | string | Msg91 template ID. | | +| senderId | string | Msg91 sender ID. | | +| authKey | string | Msg91 auth key. | | + +## Create Sendgrid provider + +```http request +POST https://cloud.appwrite.io/v1/messaging/providers/sendgrid +``` + +** Create a new Sendgrid 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. | | +| apiKey | string | Sendgrid API key. | | +| fromName | string | Sender Name. | | +| fromEmail | string | Sender email address. | | +| replyToName | string | Name set in the reply to field for the mail. Default value is sender name. | | +| replyToEmail | string | Email set in the reply to field for the mail. Default value is sender email. | | +| enabled | boolean | Set as enabled. | | + +## Update Sendgrid provider + +```http request +PATCH https://cloud.appwrite.io/v1/messaging/providers/sendgrid/{providerId} +``` + +** Update a Sendgrid 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. | | +| apiKey | string | Sendgrid API key. | | +| fromName | string | Sender Name. | | +| fromEmail | string | Sender email address. | | +| replyToName | string | Name set in the Reply To field for the mail. Default value is Sender Name. | | +| replyToEmail | string | Email set in the Reply To field for the mail. Default value is Sender Email. | | + +## Create SMTP provider + +```http request +POST https://cloud.appwrite.io/v1/messaging/providers/smtp +``` + +** Create a new SMTP 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. | | +| host | string | SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order. | | +| port | integer | The default SMTP server port. | 587 | +| username | string | Authentication username. | | +| password | string | Authentication password. | | +| encryption | string | Encryption type. Can be omitted, 'ssl', or 'tls' | | +| autoTLS | boolean | Enable SMTP AutoTLS feature. | 1 | +| mailer | string | The value to use for the X-Mailer header. | | +| fromName | string | Sender Name. | | +| fromEmail | string | Sender email address. | | +| replyToName | string | Name set in the reply to field for the mail. Default value is sender name. | | +| replyToEmail | string | Email set in the reply to field for the mail. Default value is sender email. | | +| enabled | boolean | Set as enabled. | | + +## Update SMTP provider + +```http request +PATCH https://cloud.appwrite.io/v1/messaging/providers/smtp/{providerId} +``` + +** Update a SMTP provider by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| providerId | string | **Required** Provider ID. | | +| name | string | Provider name. | | +| host | string | SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order. | | +| port | integer | SMTP port. | | +| username | string | Authentication username. | | +| password | string | Authentication password. | | +| encryption | string | Encryption type. Can be 'ssl' or 'tls' | | +| autoTLS | boolean | Enable SMTP AutoTLS feature. | | +| mailer | string | The value to use for the X-Mailer header. | | +| fromName | string | Sender Name. | | +| fromEmail | string | Sender email address. | | +| replyToName | string | Name set in the Reply To field for the mail. Default value is Sender Name. | | +| replyToEmail | string | Email set in the Reply To field for the mail. Default value is Sender Email. | | +| enabled | boolean | Set as enabled. | | + +## Create Telesign provider + +```http request +POST https://cloud.appwrite.io/v1/messaging/providers/telesign +``` + +** Create a new Telesign 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. | | +| from | string | Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. | | +| customerId | string | Telesign customer ID. | | +| apiKey | string | Telesign API key. | | +| enabled | boolean | Set as enabled. | | + +## Update Telesign provider + +```http request +PATCH https://cloud.appwrite.io/v1/messaging/providers/telesign/{providerId} +``` + +** Update a Telesign 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. | | +| customerId | string | Telesign customer ID. | | +| apiKey | string | Telesign API key. | | +| from | string | Sender number. | | + +## Create Textmagic provider + +```http request +POST https://cloud.appwrite.io/v1/messaging/providers/textmagic +``` + +** Create a new Textmagic 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. | | +| from | string | Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. | | +| username | string | Textmagic username. | | +| apiKey | string | Textmagic apiKey. | | +| enabled | boolean | Set as enabled. | | + +## Update Textmagic provider + +```http request +PATCH https://cloud.appwrite.io/v1/messaging/providers/textmagic/{providerId} +``` + +** Update a Textmagic 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. | | +| username | string | Textmagic username. | | +| apiKey | string | Textmagic apiKey. | | +| from | string | Sender number. | | + +## Create Twilio provider + +```http request +POST https://cloud.appwrite.io/v1/messaging/providers/twilio +``` + +** Create a new Twilio 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. | | +| from | string | Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. | | +| accountSid | string | Twilio account secret ID. | | +| authToken | string | Twilio authentication token. | | +| enabled | boolean | Set as enabled. | | + +## Update Twilio provider + +```http request +PATCH https://cloud.appwrite.io/v1/messaging/providers/twilio/{providerId} +``` + +** Update a Twilio 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. | | +| accountSid | string | Twilio account secret ID. | | +| authToken | string | Twilio authentication token. | | +| from | string | Sender number. | | + +## Create Vonage provider + +```http request +POST https://cloud.appwrite.io/v1/messaging/providers/vonage +``` + +** Create a new Vonage 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. | | +| from | string | Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. | | +| apiKey | string | Vonage API key. | | +| apiSecret | string | Vonage API secret. | | +| enabled | boolean | Set as enabled. | | + +## Update Vonage provider + +```http request +PATCH https://cloud.appwrite.io/v1/messaging/providers/vonage/{providerId} +``` + +** Update a Vonage 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. | | +| apiKey | string | Vonage API key. | | +| apiSecret | string | Vonage API secret. | | +| from | string | Sender number. | | + +## Get provider + +```http request +GET https://cloud.appwrite.io/v1/messaging/providers/{providerId} +``` + +** Get a provider by its unique ID. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| providerId | string | **Required** Provider ID. | | + +## Delete provider + +```http request +DELETE https://cloud.appwrite.io/v1/messaging/providers/{providerId} +``` + +** Delete a provider by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| providerId | string | **Required** Provider ID. | | + +## List provider logs + +```http request +GET https://cloud.appwrite.io/v1/messaging/providers/{providerId}/logs +``` + +** Get the provider activity logs listed by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| providerId | string | **Required** Provider 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). Only supported methods are limit and offset | [] | + +## List subscriber logs + +```http request +GET https://cloud.appwrite.io/v1/messaging/subscribers/{subscriberId}/logs +``` + +** Get the subscriber activity logs listed by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| subscriberId | string | **Required** Subscriber 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). Only supported methods are limit and offset | [] | + +## List topics + +```http request +GET https://cloud.appwrite.io/v1/messaging/topics +``` + +** Get a list of all topics from the current Appwrite project. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| queries | array | Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, description, emailTotal, smsTotal, pushTotal | [] | +| search | string | Search term to filter your list results. Max length: 256 chars. | | + +## Create topic + +```http request +POST https://cloud.appwrite.io/v1/messaging/topics +``` + +** Create a new topic. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| 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"] | + +## Get topic + +```http request +GET https://cloud.appwrite.io/v1/messaging/topics/{topicId} +``` + +** Get a topic by its unique ID. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| topicId | string | **Required** Topic ID. | | + +## Update topic + +```http request +PATCH https://cloud.appwrite.io/v1/messaging/topics/{topicId} +``` + +** Update a topic by its unique ID. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| 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. | | + +## Delete topic + +```http request +DELETE https://cloud.appwrite.io/v1/messaging/topics/{topicId} +``` + +** Delete a topic by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| topicId | string | **Required** Topic ID. | | + +## List topic logs + +```http request +GET https://cloud.appwrite.io/v1/messaging/topics/{topicId}/logs +``` + +** Get the topic activity logs listed by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| topicId | string | **Required** Topic 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). Only supported methods are limit and offset | [] | + +## List subscribers + +```http request +GET https://cloud.appwrite.io/v1/messaging/topics/{topicId}/subscribers +``` + +** Get a list of all subscribers from the current Appwrite project. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| topicId | string | **Required** Topic ID. The topic ID subscribed to. | | +| 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, provider, type, enabled | [] | +| search | string | Search term to filter your list results. Max length: 256 chars. | | + +## Create subscriber + +```http request +POST https://cloud.appwrite.io/v1/messaging/topics/{topicId}/subscribers +``` + +** Create a new subscriber. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| topicId | string | **Required** Topic ID. The topic ID to subscribe to. | | +| subscriberId | string | Subscriber ID. Choose a custom Subscriber ID or a new Subscriber ID. | | +| targetId | string | Target ID. The target ID to link to the specified Topic ID. | | + +## Get subscriber + +```http request +GET https://cloud.appwrite.io/v1/messaging/topics/{topicId}/subscribers/{subscriberId} +``` + +** Get a subscriber by its unique ID. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| topicId | string | **Required** Topic ID. The topic ID subscribed to. | | +| subscriberId | string | **Required** Subscriber ID. | | + +## Delete subscriber + +```http request +DELETE https://cloud.appwrite.io/v1/messaging/topics/{topicId}/subscribers/{subscriberId} +``` + +** Delete a subscriber by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| topicId | string | **Required** Topic ID. The topic ID subscribed to. | | +| subscriberId | string | **Required** Subscriber ID. | | + diff --git a/docs/storage.md b/docs/storage.md new file mode 100644 index 0000000..2f07dbd --- /dev/null +++ b/docs/storage.md @@ -0,0 +1,234 @@ +# Storage Service + +## List buckets + +```http request +GET https://cloud.appwrite.io/v1/storage/buckets +``` + +** Get a list of all the storage buckets. 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: enabled, name, fileSecurity, maximumFileSize, encryption, antivirus | [] | +| search | string | Search term to filter your list results. Max length: 256 chars. | | + +## Create bucket + +```http request +POST https://cloud.appwrite.io/v1/storage/buckets +``` + +** Create a new storage bucket. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| bucketId | string | Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. | | +| name | string | Bucket name | | +| permissions | array | An array of permission strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). | | +| fileSecurity | boolean | Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions). | | +| enabled | boolean | Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled. | 1 | +| maximumFileSize | integer | Maximum file size allowed in bytes. Maximum allowed value is 30MB. | [] | +| allowedFileExtensions | array | Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long. | [] | +| compression | string | Compression algorithm choosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled | none | +| encryption | boolean | Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled | 1 | +| antivirus | boolean | Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled | 1 | + +## Get bucket + +```http request +GET https://cloud.appwrite.io/v1/storage/buckets/{bucketId} +``` + +** Get a storage bucket by its unique ID. This endpoint response returns a JSON object with the storage bucket metadata. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| bucketId | string | **Required** Bucket unique ID. | | + +## Update bucket + +```http request +PUT https://cloud.appwrite.io/v1/storage/buckets/{bucketId} +``` + +** Update a storage bucket by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| bucketId | string | **Required** Bucket unique ID. | | +| name | string | Bucket name | | +| permissions | array | An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). | | +| fileSecurity | boolean | Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions). | | +| enabled | boolean | Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled. | 1 | +| maximumFileSize | integer | Maximum file size allowed in bytes. Maximum allowed value is 30MB. | [] | +| allowedFileExtensions | array | Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long. | [] | +| compression | string | Compression algorithm choosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled | none | +| encryption | boolean | Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled | 1 | +| antivirus | boolean | Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled | 1 | + +## Delete bucket + +```http request +DELETE https://cloud.appwrite.io/v1/storage/buckets/{bucketId} +``` + +** Delete a storage bucket by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| bucketId | string | **Required** Bucket unique ID. | | + +## List files + +```http request +GET https://cloud.appwrite.io/v1/storage/buckets/{bucketId}/files +``` + +** Get a list of all the user files. You can use the query params to filter your results. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| bucketId | string | **Required** Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). | | +| 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, signature, mimeType, sizeOriginal, chunksTotal, chunksUploaded | [] | +| search | string | Search term to filter your list results. Max length: 256 chars. | | + +## Create file + +```http request +POST https://cloud.appwrite.io/v1/storage/buckets/{bucketId}/files +``` + +** Create a new file. Before using this route, you should create a new bucket resource using either a [server integration](https://appwrite.io/docs/server/storage#storageCreateBucket) API or directly from your Appwrite console. + +Larger files should be uploaded using multiple requests with the [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) header to send a partial request with a maximum supported chunk of `5MB`. The `content-range` header values should always be in bytes. + +When the first request is sent, the server will return the **File** object, and the subsequent part request must include the file's **id** in `x-appwrite-id` header to allow the server to know that the partial upload is for the existing file and not for a new one. + +If you're creating a new file using one of the Appwrite SDKs, all the chunking logic will be managed by the SDK internally. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| bucketId | string | **Required** Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). | | +| fileId | string | File 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. | | +| file | file | Binary file. Appwrite SDKs provide helpers to handle file input. [Learn about file input](https://appwrite.io/docs/products/storage/upload-download#input-file). | | +| permissions | array | An array of permission strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). | | + +## Get file + +```http request +GET https://cloud.appwrite.io/v1/storage/buckets/{bucketId}/files/{fileId} +``` + +** Get a file by its unique ID. This endpoint response returns a JSON object with the file metadata. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| bucketId | string | **Required** Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). | | +| fileId | string | **Required** File ID. | | + +## Update file + +```http request +PUT https://cloud.appwrite.io/v1/storage/buckets/{bucketId}/files/{fileId} +``` + +** Update a file by its unique ID. Only users with write permissions have access to update this resource. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| bucketId | string | **Required** Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). | | +| fileId | string | **Required** File unique ID. | | +| name | string | Name of the file | | +| permissions | array | An array of permission string. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). | | + +## Delete File + +```http request +DELETE https://cloud.appwrite.io/v1/storage/buckets/{bucketId}/files/{fileId} +``` + +** Delete a file by its unique ID. Only users with write permissions have access to delete this resource. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| bucketId | string | **Required** Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). | | +| fileId | string | **Required** File ID. | | + +## Get file for download + +```http request +GET https://cloud.appwrite.io/v1/storage/buckets/{bucketId}/files/{fileId}/download +``` + +** Get a file content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| bucketId | string | **Required** Storage bucket ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). | | +| fileId | string | **Required** File ID. | | + +## Get file preview + +```http request +GET https://cloud.appwrite.io/v1/storage/buckets/{bucketId}/files/{fileId}/preview +``` + +** Get a file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets, will return the file icon image. You can also pass query string arguments for cutting and resizing your preview image. Preview is supported only for image files smaller than 10MB. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| bucketId | string | **Required** Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). | | +| fileId | string | **Required** File ID | | +| width | integer | Resize preview image width, Pass an integer between 0 to 4000. | 0 | +| height | integer | Resize preview image height, Pass an integer between 0 to 4000. | 0 | +| gravity | string | Image crop gravity. Can be one of center,top-left,top,top-right,left,right,bottom-left,bottom,bottom-right | center | +| quality | integer | Preview image quality. Pass an integer between 0 to 100. Defaults to 100. | 100 | +| borderWidth | integer | Preview image border in pixels. Pass an integer between 0 to 100. Defaults to 0. | 0 | +| borderColor | string | Preview image border color. Use a valid HEX color, no # is needed for prefix. | | +| borderRadius | integer | Preview image border radius in pixels. Pass an integer between 0 to 4000. | 0 | +| opacity | number | Preview image opacity. Only works with images having an alpha channel (like png). Pass a number between 0 to 1. | 1 | +| rotation | integer | Preview image rotation in degrees. Pass an integer between -360 and 360. | 0 | +| background | string | Preview image background color. Only works with transparent images (png). Use a valid HEX color, no # is needed for prefix. | | +| output | string | Output format type (jpeg, jpg, png, gif and webp). | | + +## Get file for view + +```http request +GET https://cloud.appwrite.io/v1/storage/buckets/{bucketId}/files/{fileId}/view +``` + +** Get a file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| bucketId | string | **Required** Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). | | +| fileId | string | **Required** File ID. | | + diff --git a/docs/teams.md b/docs/teams.md new file mode 100644 index 0000000..0804aee --- /dev/null +++ b/docs/teams.md @@ -0,0 +1,215 @@ +# Teams Service + +## List teams + +```http request +GET https://cloud.appwrite.io/v1/teams +``` + +** Get a list of all the teams in which the current user is a member. You can use the parameters 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, total, billingPlan | [] | +| search | string | Search term to filter your list results. Max length: 256 chars. | | + +## Create team + +```http request +POST https://cloud.appwrite.io/v1/teams +``` + +** Create a new team. The user who creates the team will automatically be assigned as the owner of the team. Only the users with the owner role can invite new members, add new owners and delete or update the team. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| teamId | string | Team 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 | Team name. Max length: 128 chars. | | +| roles | array | Array of strings. Use this param to set the roles in the team for the user who created it. The default role is **owner**. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long. | ["owner"] | + +## Get team + +```http request +GET https://cloud.appwrite.io/v1/teams/{teamId} +``` + +** Get a team by its ID. All team members have read access for this resource. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| teamId | string | **Required** Team ID. | | + +## Update name + +```http request +PUT https://cloud.appwrite.io/v1/teams/{teamId} +``` + +** Update the team's name by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| teamId | string | **Required** Team ID. | | +| name | string | New team name. Max length: 128 chars. | | + +## Delete team + +```http request +DELETE https://cloud.appwrite.io/v1/teams/{teamId} +``` + +** Delete a team using its ID. Only team members with the owner role can delete the team. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| teamId | string | **Required** Team ID. | | + +## List team memberships + +```http request +GET https://cloud.appwrite.io/v1/teams/{teamId}/memberships +``` + +** Use this endpoint to list a team's members using the team's ID. All team members have read access to this endpoint. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| teamId | string | **Required** Team 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: userId, teamId, invited, joined, confirm | [] | +| search | string | Search term to filter your list results. Max length: 256 chars. | | + +## Create team membership + +```http request +POST https://cloud.appwrite.io/v1/teams/{teamId}/memberships +``` + +** Invite a new member to join your team. Provide an ID for existing users, or invite unregistered users using an email or phone number. If initiated from a Client SDK, Appwrite will send an email or sms with a link to join the team to the invited user, and an account will be created for them if one doesn't exist. If initiated from a Server SDK, the new member will be added automatically to the team. + +You only need to provide one of a user ID, email, or phone number. Appwrite will prioritize accepting the user ID > email > phone number if you provide more than one of these parameters. + +Use the `url` parameter to redirect the user from the invitation email to your app. After the user is redirected, use the [Update Team Membership Status](https://appwrite.io/docs/references/cloud/client-web/teams#updateMembershipStatus) endpoint to allow the user to accept the invitation to the team. + +Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) Appwrite will accept the only redirect URLs under the domains you have added as a platform on the Appwrite Console. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| teamId | string | **Required** Team ID. | | +| email | string | Email of the new team member. | | +| userId | string | ID of the user to be added to a team. | | +| phone | string | Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. | | +| 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 32 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. | | + +## Get team membership + +```http request +GET https://cloud.appwrite.io/v1/teams/{teamId}/memberships/{membershipId} +``` + +** Get a team member by the membership unique id. All team members have read access for this resource. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| teamId | string | **Required** Team ID. | | +| membershipId | string | **Required** Membership ID. | | + +## Update membership + +```http request +PATCH https://cloud.appwrite.io/v1/teams/{teamId}/memberships/{membershipId} +``` + +** Modify the roles of a team member. Only team members with the owner role have access to this endpoint. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| teamId | string | **Required** Team ID. | | +| membershipId | string | **Required** Membership ID. | | +| roles | array | An array of strings. Use this param to set the user's 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 32 characters long. | | + +## Delete team membership + +```http request +DELETE https://cloud.appwrite.io/v1/teams/{teamId}/memberships/{membershipId} +``` + +** This endpoint allows a user to leave a team or for a team owner to delete the membership of any other team member. You can also use this endpoint to delete a user membership even if it is not accepted. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| teamId | string | **Required** Team ID. | | +| membershipId | string | **Required** Membership ID. | | + +## Update team membership status + +```http request +PATCH https://cloud.appwrite.io/v1/teams/{teamId}/memberships/{membershipId}/status +``` + +** Use this endpoint to allow a user to accept an invitation to join a team after being redirected back to your app from the invitation email received by the user. + +If the request is successful, a session for the user is automatically created. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| teamId | string | **Required** Team ID. | | +| membershipId | string | **Required** Membership ID. | | +| userId | string | User ID. | | +| secret | string | Secret key. | | + +## Get team preferences + +```http request +GET https://cloud.appwrite.io/v1/teams/{teamId}/prefs +``` + +** Get the team's shared preferences by its unique ID. If a preference doesn't need to be shared by all team members, prefer storing them in [user preferences](https://appwrite.io/docs/references/cloud/client-web/account#getPrefs). ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| teamId | string | **Required** Team ID. | | + +## Update preferences + +```http request +PUT https://cloud.appwrite.io/v1/teams/{teamId}/prefs +``` + +** Update the team's preferences by its unique ID. The object you pass is stored as is and replaces any previous value. The maximum allowed prefs size is 64kB and throws an error if exceeded. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| teamId | string | **Required** Team ID. | | +| prefs | object | Prefs key-value JSON object. | {} | + diff --git a/docs/users.md b/docs/users.md new file mode 100644 index 0000000..4101f27 --- /dev/null +++ b/docs/users.md @@ -0,0 +1,660 @@ +# Users Service + +## List users + +```http request +GET https://cloud.appwrite.io/v1/users +``` + +** Get a list of all the project's users. 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, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels | [] | +| search | string | Search term to filter your list results. Max length: 256 chars. | | + +## Create user + +```http request +POST https://cloud.appwrite.io/v1/users +``` + +** Create a new user. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | User 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. | | +| email | string | User email. | | +| phone | string | Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. | | +| password | string | Plain text user password. Must be at least 8 chars. | | +| name | string | User name. Max length: 128 chars. | | + +## Create user with Argon2 password + +```http request +POST https://cloud.appwrite.io/v1/users/argon2 +``` + +** Create a new user. Password provided must be hashed with the [Argon2](https://en.wikipedia.org/wiki/Argon2) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | User 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. | | +| email | string | User email. | | +| password | string | User password hashed using Argon2. | | +| name | string | User name. Max length: 128 chars. | | + +## Create user with bcrypt password + +```http request +POST https://cloud.appwrite.io/v1/users/bcrypt +``` + +** Create a new user. Password provided must be hashed with the [Bcrypt](https://en.wikipedia.org/wiki/Bcrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | User 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. | | +| email | string | User email. | | +| password | string | User password hashed using Bcrypt. | | +| name | string | User name. Max length: 128 chars. | | + +## List Identities + +```http request +GET https://cloud.appwrite.io/v1/users/identities +``` + +** Get identities for all users. ** + +### 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: userId, provider, providerUid, providerEmail, providerAccessTokenExpiry | [] | +| search | string | Search term to filter your list results. Max length: 256 chars. | | + +## Delete identity + +```http request +DELETE https://cloud.appwrite.io/v1/users/identities/{identityId} +``` + +** Delete an identity by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| identityId | string | **Required** Identity ID. | | + +## Create user with MD5 password + +```http request +POST https://cloud.appwrite.io/v1/users/md5 +``` + +** Create a new user. Password provided must be hashed with the [MD5](https://en.wikipedia.org/wiki/MD5) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | User 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. | | +| email | string | User email. | | +| password | string | User password hashed using MD5. | | +| name | string | User name. Max length: 128 chars. | | + +## Create user with PHPass password + +```http request +POST https://cloud.appwrite.io/v1/users/phpass +``` + +** Create a new user. Password provided must be hashed with the [PHPass](https://www.openwall.com/phpass/) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | User ID. Choose a custom ID or pass the string `ID.unique()`to auto generate it. 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. | | +| email | string | User email. | | +| password | string | User password hashed using PHPass. | | +| name | string | User name. Max length: 128 chars. | | + +## Create user with Scrypt password + +```http request +POST https://cloud.appwrite.io/v1/users/scrypt +``` + +** Create a new user. Password provided must be hashed with the [Scrypt](https://github.com/Tarsnap/scrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | User 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. | | +| email | string | User email. | | +| password | string | User password hashed using Scrypt. | | +| passwordSalt | string | Optional salt used to hash password. | | +| passwordCpu | integer | Optional CPU cost used to hash password. | | +| passwordMemory | integer | Optional memory cost used to hash password. | | +| passwordParallel | integer | Optional parallelization cost used to hash password. | | +| passwordLength | integer | Optional hash length used to hash password. | | +| name | string | User name. Max length: 128 chars. | | + +## Create user with Scrypt modified password + +```http request +POST https://cloud.appwrite.io/v1/users/scrypt-modified +``` + +** Create a new user. Password provided must be hashed with the [Scrypt Modified](https://gist.github.com/Meldiron/eecf84a0225eccb5a378d45bb27462cc) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | User 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. | | +| email | string | User email. | | +| password | string | User password hashed using Scrypt Modified. | | +| passwordSalt | string | Salt used to hash password. | | +| passwordSaltSeparator | string | Salt separator used to hash password. | | +| passwordSignerKey | string | Signer key used to hash password. | | +| name | string | User name. Max length: 128 chars. | | + +## Create user with SHA password + +```http request +POST https://cloud.appwrite.io/v1/users/sha +``` + +** Create a new user. Password provided must be hashed with the [SHA](https://en.wikipedia.org/wiki/Secure_Hash_Algorithm) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | User 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. | | +| email | string | User email. | | +| password | string | User password hashed using SHA. | | +| passwordVersion | string | Optional SHA version used to hash password. Allowed values are: 'sha1', 'sha224', 'sha256', 'sha384', 'sha512/224', 'sha512/256', 'sha512', 'sha3-224', 'sha3-256', 'sha3-384', 'sha3-512' | | +| name | string | User name. Max length: 128 chars. | | + +## Get user + +```http request +GET https://cloud.appwrite.io/v1/users/{userId} +``` + +** Get a user by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User ID. | | + +## Delete user + +```http request +DELETE https://cloud.appwrite.io/v1/users/{userId} +``` + +** Delete a user by its unique ID, thereby releasing it's ID. Since ID is released and can be reused, all user-related resources like documents or storage files should be deleted before user deletion. If you want to keep ID reserved, use the [updateStatus](https://appwrite.io/docs/server/users#usersUpdateStatus) endpoint instead. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User ID. | | + +## Update email + +```http request +PATCH https://cloud.appwrite.io/v1/users/{userId}/email +``` + +** Update the user email by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User ID. | | +| email | string | User email. | | + +## Create user JWT + +```http request +POST https://cloud.appwrite.io/v1/users/{userId}/jwts +``` + +** Use this endpoint to create a JSON Web Token for user by its unique ID. You can use the resulting JWT to authenticate on behalf of the user. The JWT secret will become invalid if the session it uses gets deleted. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User ID. | | +| sessionId | string | Session ID. Use the string 'recent' to use the most recent session. Defaults to the most recent session. | | +| duration | integer | Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds. | 900 | + +## Update user labels + +```http request +PUT https://cloud.appwrite.io/v1/users/{userId}/labels +``` + +** Update the user labels by its unique ID. + +Labels can be used to grant access to resources. While teams are a way for user's to share access to a resource, labels can be defined by the developer to grant access without an invitation. See the [Permissions docs](https://appwrite.io/docs/permissions) for more info. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User ID. | | +| labels | array | Array of user labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long. | | + +## List user logs + +```http request +GET https://cloud.appwrite.io/v1/users/{userId}/logs +``` + +** Get the user activity logs list by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User 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). Only supported methods are limit and offset | [] | + +## List user memberships + +```http request +GET https://cloud.appwrite.io/v1/users/{userId}/memberships +``` + +** Get the user membership list by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User ID. | | + +## Update MFA + +```http request +PATCH https://cloud.appwrite.io/v1/users/{userId}/mfa +``` + +** Enable or disable MFA on a user account. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User ID. | | +| mfa | boolean | Enable or disable MFA. | | + +## Delete Authenticator + +```http request +DELETE https://cloud.appwrite.io/v1/users/{userId}/mfa/authenticators/{type} +``` + +** Delete an authenticator app. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User ID. | | +| type | string | **Required** Type of authenticator. | | + +## List Factors + +```http request +GET https://cloud.appwrite.io/v1/users/{userId}/mfa/factors +``` + +** List the factors available on the account to be used as a MFA challange. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User ID. | | + +## Get MFA Recovery Codes + +```http request +GET https://cloud.appwrite.io/v1/users/{userId}/mfa/recovery-codes +``` + +** Get recovery codes that can be used as backup for MFA flow by User ID. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User ID. | | + +## Regenerate MFA Recovery Codes + +```http request +PUT https://cloud.appwrite.io/v1/users/{userId}/mfa/recovery-codes +``` + +** Regenerate recovery codes that can be used as backup for MFA flow by User ID. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User ID. | | + +## Create MFA Recovery Codes + +```http request +PATCH https://cloud.appwrite.io/v1/users/{userId}/mfa/recovery-codes +``` + +** Generate recovery codes used as backup for MFA flow for User ID. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method by client SDK. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User ID. | | + +## Update name + +```http request +PATCH https://cloud.appwrite.io/v1/users/{userId}/name +``` + +** Update the user name by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User ID. | | +| name | string | User name. Max length: 128 chars. | | + +## Update password + +```http request +PATCH https://cloud.appwrite.io/v1/users/{userId}/password +``` + +** Update the user password by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User ID. | | +| password | string | New user password. Must be at least 8 chars. | | + +## Update phone + +```http request +PATCH https://cloud.appwrite.io/v1/users/{userId}/phone +``` + +** Update the user phone by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User ID. | | +| number | string | User phone number. | | + +## Get user preferences + +```http request +GET https://cloud.appwrite.io/v1/users/{userId}/prefs +``` + +** Get the user preferences by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User ID. | | + +## Update user preferences + +```http request +PATCH https://cloud.appwrite.io/v1/users/{userId}/prefs +``` + +** Update the user preferences by its unique ID. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User ID. | | +| prefs | object | Prefs key-value JSON object. | {} | + +## List user sessions + +```http request +GET https://cloud.appwrite.io/v1/users/{userId}/sessions +``` + +** Get the user sessions list by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User ID. | | + +## Create session + +```http request +POST https://cloud.appwrite.io/v1/users/{userId}/sessions +``` + +** Creates a session for a user. Returns an immediately usable session object. + +If you want to generate a token for a custom authentication flow, use the [POST /users/{userId}/tokens](https://appwrite.io/docs/server/users#createToken) endpoint. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User 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. | | + +## Delete user sessions + +```http request +DELETE https://cloud.appwrite.io/v1/users/{userId}/sessions +``` + +** Delete all user's sessions by using the user's unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User ID. | | + +## Delete user session + +```http request +DELETE https://cloud.appwrite.io/v1/users/{userId}/sessions/{sessionId} +``` + +** Delete a user sessions by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User ID. | | +| sessionId | string | **Required** Session ID. | | + +## Update user status + +```http request +PATCH https://cloud.appwrite.io/v1/users/{userId}/status +``` + +** Update the user status by its unique ID. Use this endpoint as an alternative to deleting a user if you want to keep user's ID reserved. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User ID. | | +| status | boolean | User Status. To activate the user pass `true` and to block the user pass `false`. | | + +## List User Targets + +```http request +GET https://cloud.appwrite.io/v1/users/{userId}/targets +``` + +** List the messaging targets that are associated with a user. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User 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: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels | [] | + +## Create User Target + +```http request +POST https://cloud.appwrite.io/v1/users/{userId}/targets +``` + +** Create a messaging target. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User ID. | | +| targetId | string | Target 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. | | +| providerType | string | The target provider type. Can be one of the following: `email`, `sms` or `push`. | | +| identifier | string | The target identifier (token, email, phone etc.) | | +| providerId | string | Provider ID. Message will be sent to this target from the specified provider ID. If no provider ID is set the first setup provider will be used. | | +| name | string | Target name. Max length: 128 chars. For example: My Awesome App Galaxy S23. | | + +## Get User Target + +```http request +GET https://cloud.appwrite.io/v1/users/{userId}/targets/{targetId} +``` + +** Get a user's push notification target by ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User ID. | | +| targetId | string | **Required** Target ID. | | + +## Update User target + +```http request +PATCH https://cloud.appwrite.io/v1/users/{userId}/targets/{targetId} +``` + +** Update a messaging target. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User ID. | | +| targetId | string | **Required** Target ID. | | +| identifier | string | The target identifier (token, email, phone etc.) | | +| providerId | string | Provider ID. Message will be sent to this target from the specified provider ID. If no provider ID is set the first setup provider will be used. | | +| name | string | Target name. Max length: 128 chars. For example: My Awesome App Galaxy S23. | | + +## Delete user target + +```http request +DELETE https://cloud.appwrite.io/v1/users/{userId}/targets/{targetId} +``` + +** Delete a messaging target. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User ID. | | +| targetId | string | **Required** Target ID. | | + +## Create token + +```http request +POST https://cloud.appwrite.io/v1/users/{userId}/tokens +``` + +** Returns a token with a secret key for creating a session. Use the user ID and secret and submit a request to the [PUT /account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User ID. | | +| length | integer | Token length in characters. The default length is 6 characters | 6 | +| expire | integer | Token expiration period in seconds. The default expiration is 15 minutes. | 900 | + +## Update email verification + +```http request +PATCH https://cloud.appwrite.io/v1/users/{userId}/verification +``` + +** Update the user email verification status by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User ID. | | +| emailVerification | boolean | User email verification status. | | + +## Update phone verification + +```http request +PATCH https://cloud.appwrite.io/v1/users/{userId}/verification/phone +``` + +** Update the user phone verification status by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User ID. | | +| phoneVerification | boolean | User phone verification status. | | + diff --git a/src/Appwrite/AppwriteException.php b/src/Appwrite/AppwriteException.php new file mode 100644 index 0000000..31d7927 --- /dev/null +++ b/src/Appwrite/AppwriteException.php @@ -0,0 +1,51 @@ +<?php + +namespace Appwrite; + +use Exception; + +class AppwriteException extends Exception { + + /** + * @var mixed + */ + private ?string $response; + + /** + * @var string + */ + private string $type; + + /** + * @param ?string $message + * @param int $code + * @param string $type + * @param ?string $response + */ + public function __construct( + ?string $message = null, + int $code = 0, + string $type = '', + ?string $response = null + ) { + parent::__construct($message, $code); + $this->response = $response; + $this->type = $type; + } + + /** + * @return string + */ + public function getType(): string + { + return $this->type; + } + + /** + * @return ?string + */ + final public function getResponse(): ?string + { + return $this->response; + } +} \ No newline at end of file diff --git a/src/Appwrite/Client.php b/src/Appwrite/Client.php new file mode 100644 index 0000000..2f7e61a --- /dev/null +++ b/src/Appwrite/Client.php @@ -0,0 +1,316 @@ +<?php + +namespace Appwrite; + +class Client +{ + const METHOD_GET = 'GET'; + const METHOD_POST = 'POST'; + const METHOD_PUT = 'PUT'; + const METHOD_PATCH = 'PATCH'; + const METHOD_DELETE = 'DELETE'; + const METHOD_HEAD = 'HEAD'; + const METHOD_OPTIONS = 'OPTIONS'; + const METHOD_CONNECT = 'CONNECT'; + const METHOD_TRACE = 'TRACE'; + + const CHUNK_SIZE = 5 * 1024 * 1024; + + /** + * Is Self Signed Certificates Allowed? + * + * @var bool + */ + protected bool $selfSigned = false; + + /** + * Service host name + * + * @var string + */ + protected string $endpoint = 'https://cloud.appwrite.io/v1'; + + /** + * Global Headers + * + * @var array + */ + protected array $headers = [ + 'content-type' => '', + 'user-agent' => 'AppwritePHPSDK/12.0.0-rc.1 ()', + 'x-sdk-name'=> 'PHP', + 'x-sdk-platform'=> 'server', + 'x-sdk-language'=> 'php', + 'x-sdk-version'=> '12.0.0-rc.1', + ]; + + /** + * Client constructor. + */ + public function __construct() + { + $this->headers['X-Appwrite-Response-Format'] = '1.6.0'; + + } + + /** + * Set Project + * + * Your project ID + * + * @param string $value + * + * @return Client + */ + public function setProject(string $value): Client + { + $this->addHeader('X-Appwrite-Project', $value); + + return $this; + } + + /** + * Set Key + * + * Your secret API key + * + * @param string $value + * + * @return Client + */ + public function setKey(string $value): Client + { + $this->addHeader('X-Appwrite-Key', $value); + + return $this; + } + + /** + * Set JWT + * + * Your secret JSON Web Token + * + * @param string $value + * + * @return Client + */ + public function setJWT(string $value): Client + { + $this->addHeader('X-Appwrite-JWT', $value); + + return $this; + } + + /** + * Set Locale + * + * @param string $value + * + * @return Client + */ + public function setLocale(string $value): Client + { + $this->addHeader('X-Appwrite-Locale', $value); + + return $this; + } + + /** + * Set Session + * + * The user session to authenticate with + * + * @param string $value + * + * @return Client + */ + public function setSession(string $value): Client + { + $this->addHeader('X-Appwrite-Session', $value); + + return $this; + } + + /** + * Set ForwardedUserAgent + * + * The user agent string of the client that made the request + * + * @param string $value + * + * @return Client + */ + public function setForwardedUserAgent(string $value): Client + { + $this->addHeader('X-Forwarded-User-Agent', $value); + + return $this; + } + + + /*** + * @param bool $status + * @return $this + */ + public function setSelfSigned(bool $status = true): Client + { + $this->selfSigned = $status; + + return $this; + } + + /*** + * @param $endpoint + * @return $this + */ + public function setEndpoint(string $endpoint): Client + { + $this->endpoint = $endpoint; + + return $this; + } + + /** + * @param $key + * @param $value + */ + public function addHeader(string $key, string $value): Client + { + $this->headers[strtolower($key)] = $value; + + return $this; + } + + /** + * Call + * + * Make an API call + * + * @param string $method + * @param string $path + * @param array $params + * @param array $headers + * @return array|string + * @throws AppwriteException + */ + public function call( + string $method, + string $path = '', + array $headers = [], + array $params = [], + ?string $responseType = null + ) + { + $headers = array_merge($this->headers, $headers); + $ch = curl_init($this->endpoint . $path . (($method == self::METHOD_GET && !empty($params)) ? '?' . http_build_query($params) : '')); + $responseHeaders = []; + + switch ($headers['content-type']) { + case 'application/json': + $query = json_encode($params); + break; + + case 'multipart/form-data': + $query = $this->flatten($params); + break; + + default: + $query = http_build_query($params); + break; + } + + foreach ($headers as $i => $header) { + $headers[] = $i . ':' . $header; + unset($headers[$i]); + } + + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($ch, CURLOPT_USERAGENT, php_uname('s') . '-' . php_uname('r') . ':php-' . phpversion()); + curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, $responseType !== 'location'); + curl_setopt($ch, CURLOPT_HEADERFUNCTION, function($curl, $header) use (&$responseHeaders) { + $len = strlen($header); + $header = explode(':', strtolower($header), 2); + + if (count($header) < 2) { // ignore invalid headers + return $len; + } + + $responseHeaders[strtolower(trim($header[0]))] = trim($header[1]); + + return $len; + }); + + if($method != self::METHOD_GET) { + curl_setopt($ch, CURLOPT_POSTFIELDS, $query); + } + + // Allow self signed certificates + if($this->selfSigned) { + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); + } + + $responseBody = curl_exec($ch); + $contentType = $responseHeaders['content-type'] ?? ''; + $responseStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE); + + $warnings = $responseHeaders['x-appwrite-warning'] ?? ''; + if ($warnings) { + foreach(explode(';', $warnings) as $warning) { + echo 'Warning: ' . $warning . PHP_EOL; + } + } + + switch(substr($contentType, 0, strpos($contentType, ';'))) { + case 'application/json': + $responseBody = json_decode($responseBody, true); + break; + } + + if (curl_errno($ch)) { + throw new AppwriteException(curl_error($ch), $responseStatus, $responseBody['type'] ?? '', $responseBody); + } + + curl_close($ch); + + if($responseStatus >= 400) { + if(is_array($responseBody)) { + throw new AppwriteException($responseBody['message'], $responseStatus, $responseBody['type'] ?? '', json_encode($responseBody)); + } else { + throw new AppwriteException($responseBody, $responseStatus); + } + } + + if ($responseType === 'location') { + return $responseHeaders['location']; + } + + return $responseBody; + } + + /** + * Flatten params array to PHP multiple format + * + * @param array $data + * @param string $prefix + * @return array + */ + protected function flatten(array $data, string $prefix = ''): array { + $output = []; + + foreach($data as $key => $value) { + $finalKey = $prefix ? "{$prefix}[{$key}]" : $key; + + if (is_array($value)) { + $output += $this->flatten($value, $finalKey); // @todo: handle name collision here if needed + } + else { + $output[$finalKey] = $value; + } + } + + return $output; + } +} diff --git a/src/Appwrite/Enums/AuthenticationFactor.php b/src/Appwrite/Enums/AuthenticationFactor.php new file mode 100644 index 0000000..5258c8c --- /dev/null +++ b/src/Appwrite/Enums/AuthenticationFactor.php @@ -0,0 +1,59 @@ +<?php + +namespace Appwrite\Enums; + +use JsonSerializable; + +class AuthenticationFactor implements JsonSerializable +{ + private static AuthenticationFactor $EMAIL; + private static AuthenticationFactor $PHONE; + private static AuthenticationFactor $TOTP; + private static AuthenticationFactor $RECOVERYCODE; + + private string $value; + + private function __construct(string $value) + { + $this->value = $value; + } + + public function __toString(): string + { + return $this->value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function EMAIL(): AuthenticationFactor + { + if (!isset(self::$EMAIL)) { + self::$EMAIL = new AuthenticationFactor('email'); + } + return self::$EMAIL; + } + public static function PHONE(): AuthenticationFactor + { + if (!isset(self::$PHONE)) { + self::$PHONE = new AuthenticationFactor('phone'); + } + return self::$PHONE; + } + public static function TOTP(): AuthenticationFactor + { + if (!isset(self::$TOTP)) { + self::$TOTP = new AuthenticationFactor('totp'); + } + return self::$TOTP; + } + public static function RECOVERYCODE(): AuthenticationFactor + { + if (!isset(self::$RECOVERYCODE)) { + self::$RECOVERYCODE = new AuthenticationFactor('recoverycode'); + } + return self::$RECOVERYCODE; + } +} \ No newline at end of file diff --git a/src/Appwrite/Enums/AuthenticatorType.php b/src/Appwrite/Enums/AuthenticatorType.php new file mode 100644 index 0000000..9e8634a --- /dev/null +++ b/src/Appwrite/Enums/AuthenticatorType.php @@ -0,0 +1,35 @@ +<?php + +namespace Appwrite\Enums; + +use JsonSerializable; + +class AuthenticatorType implements JsonSerializable +{ + private static AuthenticatorType $TOTP; + + private string $value; + + private function __construct(string $value) + { + $this->value = $value; + } + + public function __toString(): string + { + return $this->value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function TOTP(): AuthenticatorType + { + if (!isset(self::$TOTP)) { + self::$TOTP = new AuthenticatorType('totp'); + } + return self::$TOTP; + } +} \ No newline at end of file diff --git a/src/Appwrite/Enums/Browser.php b/src/Appwrite/Enums/Browser.php new file mode 100644 index 0000000..fc560f2 --- /dev/null +++ b/src/Appwrite/Enums/Browser.php @@ -0,0 +1,139 @@ +<?php + +namespace Appwrite\Enums; + +use JsonSerializable; + +class Browser implements JsonSerializable +{ + private static Browser $AVANTBROWSER; + private static Browser $ANDROIDWEBVIEWBETA; + private static Browser $GOOGLECHROME; + private static Browser $GOOGLECHROMEIOS; + private static Browser $GOOGLECHROMEMOBILE; + private static Browser $CHROMIUM; + private static Browser $MOZILLAFIREFOX; + private static Browser $SAFARI; + private static Browser $MOBILESAFARI; + private static Browser $MICROSOFTEDGE; + private static Browser $MICROSOFTEDGEIOS; + private static Browser $OPERAMINI; + private static Browser $OPERA; + private static Browser $OPERANEXT; + + private string $value; + + private function __construct(string $value) + { + $this->value = $value; + } + + public function __toString(): string + { + return $this->value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function AVANTBROWSER(): Browser + { + if (!isset(self::$AVANTBROWSER)) { + self::$AVANTBROWSER = new Browser('aa'); + } + return self::$AVANTBROWSER; + } + public static function ANDROIDWEBVIEWBETA(): Browser + { + if (!isset(self::$ANDROIDWEBVIEWBETA)) { + self::$ANDROIDWEBVIEWBETA = new Browser('an'); + } + return self::$ANDROIDWEBVIEWBETA; + } + public static function GOOGLECHROME(): Browser + { + if (!isset(self::$GOOGLECHROME)) { + self::$GOOGLECHROME = new Browser('ch'); + } + return self::$GOOGLECHROME; + } + public static function GOOGLECHROMEIOS(): Browser + { + if (!isset(self::$GOOGLECHROMEIOS)) { + self::$GOOGLECHROMEIOS = new Browser('ci'); + } + return self::$GOOGLECHROMEIOS; + } + public static function GOOGLECHROMEMOBILE(): Browser + { + if (!isset(self::$GOOGLECHROMEMOBILE)) { + self::$GOOGLECHROMEMOBILE = new Browser('cm'); + } + return self::$GOOGLECHROMEMOBILE; + } + public static function CHROMIUM(): Browser + { + if (!isset(self::$CHROMIUM)) { + self::$CHROMIUM = new Browser('cr'); + } + return self::$CHROMIUM; + } + public static function MOZILLAFIREFOX(): Browser + { + if (!isset(self::$MOZILLAFIREFOX)) { + self::$MOZILLAFIREFOX = new Browser('ff'); + } + return self::$MOZILLAFIREFOX; + } + public static function SAFARI(): Browser + { + if (!isset(self::$SAFARI)) { + self::$SAFARI = new Browser('sf'); + } + return self::$SAFARI; + } + public static function MOBILESAFARI(): Browser + { + if (!isset(self::$MOBILESAFARI)) { + self::$MOBILESAFARI = new Browser('mf'); + } + return self::$MOBILESAFARI; + } + public static function MICROSOFTEDGE(): Browser + { + if (!isset(self::$MICROSOFTEDGE)) { + self::$MICROSOFTEDGE = new Browser('ps'); + } + return self::$MICROSOFTEDGE; + } + public static function MICROSOFTEDGEIOS(): Browser + { + if (!isset(self::$MICROSOFTEDGEIOS)) { + self::$MICROSOFTEDGEIOS = new Browser('oi'); + } + return self::$MICROSOFTEDGEIOS; + } + public static function OPERAMINI(): Browser + { + if (!isset(self::$OPERAMINI)) { + self::$OPERAMINI = new Browser('om'); + } + return self::$OPERAMINI; + } + public static function OPERA(): Browser + { + if (!isset(self::$OPERA)) { + self::$OPERA = new Browser('op'); + } + return self::$OPERA; + } + public static function OPERANEXT(): Browser + { + if (!isset(self::$OPERANEXT)) { + self::$OPERANEXT = new Browser('on'); + } + return self::$OPERANEXT; + } +} \ No newline at end of file diff --git a/src/Appwrite/Enums/Compression.php b/src/Appwrite/Enums/Compression.php new file mode 100644 index 0000000..1e73987 --- /dev/null +++ b/src/Appwrite/Enums/Compression.php @@ -0,0 +1,51 @@ +<?php + +namespace Appwrite\Enums; + +use JsonSerializable; + +class Compression implements JsonSerializable +{ + private static Compression $NONE; + private static Compression $GZIP; + private static Compression $ZSTD; + + private string $value; + + private function __construct(string $value) + { + $this->value = $value; + } + + public function __toString(): string + { + return $this->value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function NONE(): Compression + { + if (!isset(self::$NONE)) { + self::$NONE = new Compression('none'); + } + return self::$NONE; + } + public static function GZIP(): Compression + { + if (!isset(self::$GZIP)) { + self::$GZIP = new Compression('gzip'); + } + return self::$GZIP; + } + public static function ZSTD(): Compression + { + if (!isset(self::$ZSTD)) { + self::$ZSTD = new Compression('zstd'); + } + return self::$ZSTD; + } +} \ No newline at end of file diff --git a/src/Appwrite/Enums/CreditCard.php b/src/Appwrite/Enums/CreditCard.php new file mode 100644 index 0000000..aba9592 --- /dev/null +++ b/src/Appwrite/Enums/CreditCard.php @@ -0,0 +1,155 @@ +<?php + +namespace Appwrite\Enums; + +use JsonSerializable; + +class CreditCard implements JsonSerializable +{ + private static CreditCard $AMERICANEXPRESS; + private static CreditCard $ARGENCARD; + private static CreditCard $CABAL; + private static CreditCard $CENCOSUD; + private static CreditCard $DINERSCLUB; + private static CreditCard $DISCOVER; + private static CreditCard $ELO; + private static CreditCard $HIPERCARD; + private static CreditCard $JCB; + private static CreditCard $MASTERCARD; + private static CreditCard $NARANJA; + private static CreditCard $TARJETASHOPPING; + private static CreditCard $UNIONCHINAPAY; + private static CreditCard $VISA; + private static CreditCard $MIR; + private static CreditCard $MAESTRO; + + private string $value; + + private function __construct(string $value) + { + $this->value = $value; + } + + public function __toString(): string + { + return $this->value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function AMERICANEXPRESS(): CreditCard + { + if (!isset(self::$AMERICANEXPRESS)) { + self::$AMERICANEXPRESS = new CreditCard('amex'); + } + return self::$AMERICANEXPRESS; + } + public static function ARGENCARD(): CreditCard + { + if (!isset(self::$ARGENCARD)) { + self::$ARGENCARD = new CreditCard('argencard'); + } + return self::$ARGENCARD; + } + public static function CABAL(): CreditCard + { + if (!isset(self::$CABAL)) { + self::$CABAL = new CreditCard('cabal'); + } + return self::$CABAL; + } + public static function CENCOSUD(): CreditCard + { + if (!isset(self::$CENCOSUD)) { + self::$CENCOSUD = new CreditCard('cencosud'); + } + return self::$CENCOSUD; + } + public static function DINERSCLUB(): CreditCard + { + if (!isset(self::$DINERSCLUB)) { + self::$DINERSCLUB = new CreditCard('diners'); + } + return self::$DINERSCLUB; + } + public static function DISCOVER(): CreditCard + { + if (!isset(self::$DISCOVER)) { + self::$DISCOVER = new CreditCard('discover'); + } + return self::$DISCOVER; + } + public static function ELO(): CreditCard + { + if (!isset(self::$ELO)) { + self::$ELO = new CreditCard('elo'); + } + return self::$ELO; + } + public static function HIPERCARD(): CreditCard + { + if (!isset(self::$HIPERCARD)) { + self::$HIPERCARD = new CreditCard('hipercard'); + } + return self::$HIPERCARD; + } + public static function JCB(): CreditCard + { + if (!isset(self::$JCB)) { + self::$JCB = new CreditCard('jcb'); + } + return self::$JCB; + } + public static function MASTERCARD(): CreditCard + { + if (!isset(self::$MASTERCARD)) { + self::$MASTERCARD = new CreditCard('mastercard'); + } + return self::$MASTERCARD; + } + public static function NARANJA(): CreditCard + { + if (!isset(self::$NARANJA)) { + self::$NARANJA = new CreditCard('naranja'); + } + return self::$NARANJA; + } + public static function TARJETASHOPPING(): CreditCard + { + if (!isset(self::$TARJETASHOPPING)) { + self::$TARJETASHOPPING = new CreditCard('targeta-shopping'); + } + return self::$TARJETASHOPPING; + } + public static function UNIONCHINAPAY(): CreditCard + { + if (!isset(self::$UNIONCHINAPAY)) { + self::$UNIONCHINAPAY = new CreditCard('union-china-pay'); + } + return self::$UNIONCHINAPAY; + } + public static function VISA(): CreditCard + { + if (!isset(self::$VISA)) { + self::$VISA = new CreditCard('visa'); + } + return self::$VISA; + } + public static function MIR(): CreditCard + { + if (!isset(self::$MIR)) { + self::$MIR = new CreditCard('mir'); + } + return self::$MIR; + } + public static function MAESTRO(): CreditCard + { + if (!isset(self::$MAESTRO)) { + self::$MAESTRO = new CreditCard('maestro'); + } + return self::$MAESTRO; + } +} \ No newline at end of file diff --git a/src/Appwrite/Enums/ExecutionMethod.php b/src/Appwrite/Enums/ExecutionMethod.php new file mode 100644 index 0000000..9ffea9c --- /dev/null +++ b/src/Appwrite/Enums/ExecutionMethod.php @@ -0,0 +1,75 @@ +<?php + +namespace Appwrite\Enums; + +use JsonSerializable; + +class ExecutionMethod implements JsonSerializable +{ + private static ExecutionMethod $GET; + private static ExecutionMethod $POST; + private static ExecutionMethod $PUT; + private static ExecutionMethod $PATCH; + private static ExecutionMethod $DELETE; + private static ExecutionMethod $OPTIONS; + + private string $value; + + private function __construct(string $value) + { + $this->value = $value; + } + + public function __toString(): string + { + return $this->value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function GET(): ExecutionMethod + { + if (!isset(self::$GET)) { + self::$GET = new ExecutionMethod('GET'); + } + return self::$GET; + } + public static function POST(): ExecutionMethod + { + if (!isset(self::$POST)) { + self::$POST = new ExecutionMethod('POST'); + } + return self::$POST; + } + public static function PUT(): ExecutionMethod + { + if (!isset(self::$PUT)) { + self::$PUT = new ExecutionMethod('PUT'); + } + return self::$PUT; + } + public static function PATCH(): ExecutionMethod + { + if (!isset(self::$PATCH)) { + self::$PATCH = new ExecutionMethod('PATCH'); + } + return self::$PATCH; + } + public static function DELETE(): ExecutionMethod + { + if (!isset(self::$DELETE)) { + self::$DELETE = new ExecutionMethod('DELETE'); + } + return self::$DELETE; + } + public static function OPTIONS(): ExecutionMethod + { + if (!isset(self::$OPTIONS)) { + self::$OPTIONS = new ExecutionMethod('OPTIONS'); + } + return self::$OPTIONS; + } +} \ No newline at end of file diff --git a/src/Appwrite/Enums/Flag.php b/src/Appwrite/Enums/Flag.php new file mode 100644 index 0000000..e7145b1 --- /dev/null +++ b/src/Appwrite/Enums/Flag.php @@ -0,0 +1,1587 @@ +<?php + +namespace Appwrite\Enums; + +use JsonSerializable; + +class Flag implements JsonSerializable +{ + private static Flag $AFGHANISTAN; + private static Flag $ANGOLA; + private static Flag $ALBANIA; + private static Flag $ANDORRA; + private static Flag $UNITEDARABEMIRATES; + private static Flag $ARGENTINA; + private static Flag $ARMENIA; + private static Flag $ANTIGUAANDBARBUDA; + private static Flag $AUSTRALIA; + private static Flag $AUSTRIA; + private static Flag $AZERBAIJAN; + private static Flag $BURUNDI; + private static Flag $BELGIUM; + private static Flag $BENIN; + private static Flag $BURKINAFASO; + private static Flag $BANGLADESH; + private static Flag $BULGARIA; + private static Flag $BAHRAIN; + private static Flag $BAHAMAS; + private static Flag $BOSNIAANDHERZEGOVINA; + private static Flag $BELARUS; + private static Flag $BELIZE; + private static Flag $BOLIVIA; + private static Flag $BRAZIL; + private static Flag $BARBADOS; + private static Flag $BRUNEIDARUSSALAM; + private static Flag $BHUTAN; + private static Flag $BOTSWANA; + private static Flag $CENTRALAFRICANREPUBLIC; + private static Flag $CANADA; + private static Flag $SWITZERLAND; + private static Flag $CHILE; + private static Flag $CHINA; + private static Flag $CTEDIVOIRE; + private static Flag $CAMEROON; + private static Flag $DEMOCRATICREPUBLICOFTHECONGO; + private static Flag $REPUBLICOFTHECONGO; + private static Flag $COLOMBIA; + private static Flag $COMOROS; + private static Flag $CAPEVERDE; + private static Flag $COSTARICA; + private static Flag $CUBA; + private static Flag $CYPRUS; + private static Flag $CZECHREPUBLIC; + private static Flag $GERMANY; + private static Flag $DJIBOUTI; + private static Flag $DOMINICA; + private static Flag $DENMARK; + private static Flag $DOMINICANREPUBLIC; + private static Flag $ALGERIA; + private static Flag $ECUADOR; + private static Flag $EGYPT; + private static Flag $ERITREA; + private static Flag $SPAIN; + private static Flag $ESTONIA; + private static Flag $ETHIOPIA; + private static Flag $FINLAND; + private static Flag $FIJI; + private static Flag $FRANCE; + private static Flag $MICRONESIAFEDERATEDSTATESOF; + private static Flag $GABON; + private static Flag $UNITEDKINGDOM; + private static Flag $GEORGIA; + private static Flag $GHANA; + private static Flag $GUINEA; + private static Flag $GAMBIA; + private static Flag $GUINEABISSAU; + private static Flag $EQUATORIALGUINEA; + private static Flag $GREECE; + private static Flag $GRENADA; + private static Flag $GUATEMALA; + private static Flag $GUYANA; + private static Flag $HONDURAS; + private static Flag $CROATIA; + private static Flag $HAITI; + private static Flag $HUNGARY; + private static Flag $INDONESIA; + private static Flag $INDIA; + private static Flag $IRELAND; + private static Flag $IRANISLAMICREPUBLICOF; + private static Flag $IRAQ; + private static Flag $ICELAND; + private static Flag $ISRAEL; + private static Flag $ITALY; + private static Flag $JAMAICA; + private static Flag $JORDAN; + private static Flag $JAPAN; + private static Flag $KAZAKHSTAN; + private static Flag $KENYA; + private static Flag $KYRGYZSTAN; + private static Flag $CAMBODIA; + private static Flag $KIRIBATI; + private static Flag $SAINTKITTSANDNEVIS; + private static Flag $SOUTHKOREA; + private static Flag $KUWAIT; + private static Flag $LAOPEOPLESDEMOCRATICREPUBLIC; + private static Flag $LEBANON; + private static Flag $LIBERIA; + private static Flag $LIBYA; + private static Flag $SAINTLUCIA; + private static Flag $LIECHTENSTEIN; + private static Flag $SRILANKA; + private static Flag $LESOTHO; + private static Flag $LITHUANIA; + private static Flag $LUXEMBOURG; + private static Flag $LATVIA; + private static Flag $MOROCCO; + private static Flag $MONACO; + private static Flag $MOLDOVA; + private static Flag $MADAGASCAR; + private static Flag $MALDIVES; + private static Flag $MEXICO; + private static Flag $MARSHALLISLANDS; + private static Flag $NORTHMACEDONIA; + private static Flag $MALI; + private static Flag $MALTA; + private static Flag $MYANMAR; + private static Flag $MONTENEGRO; + private static Flag $MONGOLIA; + private static Flag $MOZAMBIQUE; + private static Flag $MAURITANIA; + private static Flag $MAURITIUS; + private static Flag $MALAWI; + private static Flag $MALAYSIA; + private static Flag $NAMIBIA; + private static Flag $NIGER; + private static Flag $NIGERIA; + private static Flag $NICARAGUA; + private static Flag $NETHERLANDS; + private static Flag $NORWAY; + private static Flag $NEPAL; + private static Flag $NAURU; + private static Flag $NEWZEALAND; + private static Flag $OMAN; + private static Flag $PAKISTAN; + private static Flag $PANAMA; + private static Flag $PERU; + private static Flag $PHILIPPINES; + private static Flag $PALAU; + private static Flag $PAPUANEWGUINEA; + private static Flag $POLAND; + private static Flag $FRENCHPOLYNESIA; + private static Flag $NORTHKOREA; + private static Flag $PORTUGAL; + private static Flag $PARAGUAY; + private static Flag $QATAR; + private static Flag $ROMANIA; + private static Flag $RUSSIA; + private static Flag $RWANDA; + private static Flag $SAUDIARABIA; + private static Flag $SUDAN; + private static Flag $SENEGAL; + private static Flag $SINGAPORE; + private static Flag $SOLOMONISLANDS; + private static Flag $SIERRALEONE; + private static Flag $ELSALVADOR; + private static Flag $SANMARINO; + private static Flag $SOMALIA; + private static Flag $SERBIA; + private static Flag $SOUTHSUDAN; + private static Flag $SAOTOMEANDPRINCIPE; + private static Flag $SURINAME; + private static Flag $SLOVAKIA; + private static Flag $SLOVENIA; + private static Flag $SWEDEN; + private static Flag $ESWATINI; + private static Flag $SEYCHELLES; + private static Flag $SYRIA; + private static Flag $CHAD; + private static Flag $TOGO; + private static Flag $THAILAND; + private static Flag $TAJIKISTAN; + private static Flag $TURKMENISTAN; + private static Flag $TIMORLESTE; + private static Flag $TONGA; + private static Flag $TRINIDADANDTOBAGO; + private static Flag $TUNISIA; + private static Flag $TURKEY; + private static Flag $TUVALU; + private static Flag $TANZANIA; + private static Flag $UGANDA; + private static Flag $UKRAINE; + private static Flag $URUGUAY; + private static Flag $UNITEDSTATES; + private static Flag $UZBEKISTAN; + private static Flag $VATICANCITY; + private static Flag $SAINTVINCENTANDTHEGRENADINES; + private static Flag $VENEZUELA; + private static Flag $VIETNAM; + private static Flag $VANUATU; + private static Flag $SAMOA; + private static Flag $YEMEN; + private static Flag $SOUTHAFRICA; + private static Flag $ZAMBIA; + private static Flag $ZIMBABWE; + + private string $value; + + private function __construct(string $value) + { + $this->value = $value; + } + + public function __toString(): string + { + return $this->value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function AFGHANISTAN(): Flag + { + if (!isset(self::$AFGHANISTAN)) { + self::$AFGHANISTAN = new Flag('af'); + } + return self::$AFGHANISTAN; + } + public static function ANGOLA(): Flag + { + if (!isset(self::$ANGOLA)) { + self::$ANGOLA = new Flag('ao'); + } + return self::$ANGOLA; + } + public static function ALBANIA(): Flag + { + if (!isset(self::$ALBANIA)) { + self::$ALBANIA = new Flag('al'); + } + return self::$ALBANIA; + } + public static function ANDORRA(): Flag + { + if (!isset(self::$ANDORRA)) { + self::$ANDORRA = new Flag('ad'); + } + return self::$ANDORRA; + } + public static function UNITEDARABEMIRATES(): Flag + { + if (!isset(self::$UNITEDARABEMIRATES)) { + self::$UNITEDARABEMIRATES = new Flag('ae'); + } + return self::$UNITEDARABEMIRATES; + } + public static function ARGENTINA(): Flag + { + if (!isset(self::$ARGENTINA)) { + self::$ARGENTINA = new Flag('ar'); + } + return self::$ARGENTINA; + } + public static function ARMENIA(): Flag + { + if (!isset(self::$ARMENIA)) { + self::$ARMENIA = new Flag('am'); + } + return self::$ARMENIA; + } + public static function ANTIGUAANDBARBUDA(): Flag + { + if (!isset(self::$ANTIGUAANDBARBUDA)) { + self::$ANTIGUAANDBARBUDA = new Flag('ag'); + } + return self::$ANTIGUAANDBARBUDA; + } + public static function AUSTRALIA(): Flag + { + if (!isset(self::$AUSTRALIA)) { + self::$AUSTRALIA = new Flag('au'); + } + return self::$AUSTRALIA; + } + public static function AUSTRIA(): Flag + { + if (!isset(self::$AUSTRIA)) { + self::$AUSTRIA = new Flag('at'); + } + return self::$AUSTRIA; + } + public static function AZERBAIJAN(): Flag + { + if (!isset(self::$AZERBAIJAN)) { + self::$AZERBAIJAN = new Flag('az'); + } + return self::$AZERBAIJAN; + } + public static function BURUNDI(): Flag + { + if (!isset(self::$BURUNDI)) { + self::$BURUNDI = new Flag('bi'); + } + return self::$BURUNDI; + } + public static function BELGIUM(): Flag + { + if (!isset(self::$BELGIUM)) { + self::$BELGIUM = new Flag('be'); + } + return self::$BELGIUM; + } + public static function BENIN(): Flag + { + if (!isset(self::$BENIN)) { + self::$BENIN = new Flag('bj'); + } + return self::$BENIN; + } + public static function BURKINAFASO(): Flag + { + if (!isset(self::$BURKINAFASO)) { + self::$BURKINAFASO = new Flag('bf'); + } + return self::$BURKINAFASO; + } + public static function BANGLADESH(): Flag + { + if (!isset(self::$BANGLADESH)) { + self::$BANGLADESH = new Flag('bd'); + } + return self::$BANGLADESH; + } + public static function BULGARIA(): Flag + { + if (!isset(self::$BULGARIA)) { + self::$BULGARIA = new Flag('bg'); + } + return self::$BULGARIA; + } + public static function BAHRAIN(): Flag + { + if (!isset(self::$BAHRAIN)) { + self::$BAHRAIN = new Flag('bh'); + } + return self::$BAHRAIN; + } + public static function BAHAMAS(): Flag + { + if (!isset(self::$BAHAMAS)) { + self::$BAHAMAS = new Flag('bs'); + } + return self::$BAHAMAS; + } + public static function BOSNIAANDHERZEGOVINA(): Flag + { + if (!isset(self::$BOSNIAANDHERZEGOVINA)) { + self::$BOSNIAANDHERZEGOVINA = new Flag('ba'); + } + return self::$BOSNIAANDHERZEGOVINA; + } + public static function BELARUS(): Flag + { + if (!isset(self::$BELARUS)) { + self::$BELARUS = new Flag('by'); + } + return self::$BELARUS; + } + public static function BELIZE(): Flag + { + if (!isset(self::$BELIZE)) { + self::$BELIZE = new Flag('bz'); + } + return self::$BELIZE; + } + public static function BOLIVIA(): Flag + { + if (!isset(self::$BOLIVIA)) { + self::$BOLIVIA = new Flag('bo'); + } + return self::$BOLIVIA; + } + public static function BRAZIL(): Flag + { + if (!isset(self::$BRAZIL)) { + self::$BRAZIL = new Flag('br'); + } + return self::$BRAZIL; + } + public static function BARBADOS(): Flag + { + if (!isset(self::$BARBADOS)) { + self::$BARBADOS = new Flag('bb'); + } + return self::$BARBADOS; + } + public static function BRUNEIDARUSSALAM(): Flag + { + if (!isset(self::$BRUNEIDARUSSALAM)) { + self::$BRUNEIDARUSSALAM = new Flag('bn'); + } + return self::$BRUNEIDARUSSALAM; + } + public static function BHUTAN(): Flag + { + if (!isset(self::$BHUTAN)) { + self::$BHUTAN = new Flag('bt'); + } + return self::$BHUTAN; + } + public static function BOTSWANA(): Flag + { + if (!isset(self::$BOTSWANA)) { + self::$BOTSWANA = new Flag('bw'); + } + return self::$BOTSWANA; + } + public static function CENTRALAFRICANREPUBLIC(): Flag + { + if (!isset(self::$CENTRALAFRICANREPUBLIC)) { + self::$CENTRALAFRICANREPUBLIC = new Flag('cf'); + } + return self::$CENTRALAFRICANREPUBLIC; + } + public static function CANADA(): Flag + { + if (!isset(self::$CANADA)) { + self::$CANADA = new Flag('ca'); + } + return self::$CANADA; + } + public static function SWITZERLAND(): Flag + { + if (!isset(self::$SWITZERLAND)) { + self::$SWITZERLAND = new Flag('ch'); + } + return self::$SWITZERLAND; + } + public static function CHILE(): Flag + { + if (!isset(self::$CHILE)) { + self::$CHILE = new Flag('cl'); + } + return self::$CHILE; + } + public static function CHINA(): Flag + { + if (!isset(self::$CHINA)) { + self::$CHINA = new Flag('cn'); + } + return self::$CHINA; + } + public static function CTEDIVOIRE(): Flag + { + if (!isset(self::$CTEDIVOIRE)) { + self::$CTEDIVOIRE = new Flag('ci'); + } + return self::$CTEDIVOIRE; + } + public static function CAMEROON(): Flag + { + if (!isset(self::$CAMEROON)) { + self::$CAMEROON = new Flag('cm'); + } + return self::$CAMEROON; + } + public static function DEMOCRATICREPUBLICOFTHECONGO(): Flag + { + if (!isset(self::$DEMOCRATICREPUBLICOFTHECONGO)) { + self::$DEMOCRATICREPUBLICOFTHECONGO = new Flag('cd'); + } + return self::$DEMOCRATICREPUBLICOFTHECONGO; + } + public static function REPUBLICOFTHECONGO(): Flag + { + if (!isset(self::$REPUBLICOFTHECONGO)) { + self::$REPUBLICOFTHECONGO = new Flag('cg'); + } + return self::$REPUBLICOFTHECONGO; + } + public static function COLOMBIA(): Flag + { + if (!isset(self::$COLOMBIA)) { + self::$COLOMBIA = new Flag('co'); + } + return self::$COLOMBIA; + } + public static function COMOROS(): Flag + { + if (!isset(self::$COMOROS)) { + self::$COMOROS = new Flag('km'); + } + return self::$COMOROS; + } + public static function CAPEVERDE(): Flag + { + if (!isset(self::$CAPEVERDE)) { + self::$CAPEVERDE = new Flag('cv'); + } + return self::$CAPEVERDE; + } + public static function COSTARICA(): Flag + { + if (!isset(self::$COSTARICA)) { + self::$COSTARICA = new Flag('cr'); + } + return self::$COSTARICA; + } + public static function CUBA(): Flag + { + if (!isset(self::$CUBA)) { + self::$CUBA = new Flag('cu'); + } + return self::$CUBA; + } + public static function CYPRUS(): Flag + { + if (!isset(self::$CYPRUS)) { + self::$CYPRUS = new Flag('cy'); + } + return self::$CYPRUS; + } + public static function CZECHREPUBLIC(): Flag + { + if (!isset(self::$CZECHREPUBLIC)) { + self::$CZECHREPUBLIC = new Flag('cz'); + } + return self::$CZECHREPUBLIC; + } + public static function GERMANY(): Flag + { + if (!isset(self::$GERMANY)) { + self::$GERMANY = new Flag('de'); + } + return self::$GERMANY; + } + public static function DJIBOUTI(): Flag + { + if (!isset(self::$DJIBOUTI)) { + self::$DJIBOUTI = new Flag('dj'); + } + return self::$DJIBOUTI; + } + public static function DOMINICA(): Flag + { + if (!isset(self::$DOMINICA)) { + self::$DOMINICA = new Flag('dm'); + } + return self::$DOMINICA; + } + public static function DENMARK(): Flag + { + if (!isset(self::$DENMARK)) { + self::$DENMARK = new Flag('dk'); + } + return self::$DENMARK; + } + public static function DOMINICANREPUBLIC(): Flag + { + if (!isset(self::$DOMINICANREPUBLIC)) { + self::$DOMINICANREPUBLIC = new Flag('do'); + } + return self::$DOMINICANREPUBLIC; + } + public static function ALGERIA(): Flag + { + if (!isset(self::$ALGERIA)) { + self::$ALGERIA = new Flag('dz'); + } + return self::$ALGERIA; + } + public static function ECUADOR(): Flag + { + if (!isset(self::$ECUADOR)) { + self::$ECUADOR = new Flag('ec'); + } + return self::$ECUADOR; + } + public static function EGYPT(): Flag + { + if (!isset(self::$EGYPT)) { + self::$EGYPT = new Flag('eg'); + } + return self::$EGYPT; + } + public static function ERITREA(): Flag + { + if (!isset(self::$ERITREA)) { + self::$ERITREA = new Flag('er'); + } + return self::$ERITREA; + } + public static function SPAIN(): Flag + { + if (!isset(self::$SPAIN)) { + self::$SPAIN = new Flag('es'); + } + return self::$SPAIN; + } + public static function ESTONIA(): Flag + { + if (!isset(self::$ESTONIA)) { + self::$ESTONIA = new Flag('ee'); + } + return self::$ESTONIA; + } + public static function ETHIOPIA(): Flag + { + if (!isset(self::$ETHIOPIA)) { + self::$ETHIOPIA = new Flag('et'); + } + return self::$ETHIOPIA; + } + public static function FINLAND(): Flag + { + if (!isset(self::$FINLAND)) { + self::$FINLAND = new Flag('fi'); + } + return self::$FINLAND; + } + public static function FIJI(): Flag + { + if (!isset(self::$FIJI)) { + self::$FIJI = new Flag('fj'); + } + return self::$FIJI; + } + public static function FRANCE(): Flag + { + if (!isset(self::$FRANCE)) { + self::$FRANCE = new Flag('fr'); + } + return self::$FRANCE; + } + public static function MICRONESIAFEDERATEDSTATESOF(): Flag + { + if (!isset(self::$MICRONESIAFEDERATEDSTATESOF)) { + self::$MICRONESIAFEDERATEDSTATESOF = new Flag('fm'); + } + return self::$MICRONESIAFEDERATEDSTATESOF; + } + public static function GABON(): Flag + { + if (!isset(self::$GABON)) { + self::$GABON = new Flag('ga'); + } + return self::$GABON; + } + public static function UNITEDKINGDOM(): Flag + { + if (!isset(self::$UNITEDKINGDOM)) { + self::$UNITEDKINGDOM = new Flag('gb'); + } + return self::$UNITEDKINGDOM; + } + public static function GEORGIA(): Flag + { + if (!isset(self::$GEORGIA)) { + self::$GEORGIA = new Flag('ge'); + } + return self::$GEORGIA; + } + public static function GHANA(): Flag + { + if (!isset(self::$GHANA)) { + self::$GHANA = new Flag('gh'); + } + return self::$GHANA; + } + public static function GUINEA(): Flag + { + if (!isset(self::$GUINEA)) { + self::$GUINEA = new Flag('gn'); + } + return self::$GUINEA; + } + public static function GAMBIA(): Flag + { + if (!isset(self::$GAMBIA)) { + self::$GAMBIA = new Flag('gm'); + } + return self::$GAMBIA; + } + public static function GUINEABISSAU(): Flag + { + if (!isset(self::$GUINEABISSAU)) { + self::$GUINEABISSAU = new Flag('gw'); + } + return self::$GUINEABISSAU; + } + public static function EQUATORIALGUINEA(): Flag + { + if (!isset(self::$EQUATORIALGUINEA)) { + self::$EQUATORIALGUINEA = new Flag('gq'); + } + return self::$EQUATORIALGUINEA; + } + public static function GREECE(): Flag + { + if (!isset(self::$GREECE)) { + self::$GREECE = new Flag('gr'); + } + return self::$GREECE; + } + public static function GRENADA(): Flag + { + if (!isset(self::$GRENADA)) { + self::$GRENADA = new Flag('gd'); + } + return self::$GRENADA; + } + public static function GUATEMALA(): Flag + { + if (!isset(self::$GUATEMALA)) { + self::$GUATEMALA = new Flag('gt'); + } + return self::$GUATEMALA; + } + public static function GUYANA(): Flag + { + if (!isset(self::$GUYANA)) { + self::$GUYANA = new Flag('gy'); + } + return self::$GUYANA; + } + public static function HONDURAS(): Flag + { + if (!isset(self::$HONDURAS)) { + self::$HONDURAS = new Flag('hn'); + } + return self::$HONDURAS; + } + public static function CROATIA(): Flag + { + if (!isset(self::$CROATIA)) { + self::$CROATIA = new Flag('hr'); + } + return self::$CROATIA; + } + public static function HAITI(): Flag + { + if (!isset(self::$HAITI)) { + self::$HAITI = new Flag('ht'); + } + return self::$HAITI; + } + public static function HUNGARY(): Flag + { + if (!isset(self::$HUNGARY)) { + self::$HUNGARY = new Flag('hu'); + } + return self::$HUNGARY; + } + public static function INDONESIA(): Flag + { + if (!isset(self::$INDONESIA)) { + self::$INDONESIA = new Flag('id'); + } + return self::$INDONESIA; + } + public static function INDIA(): Flag + { + if (!isset(self::$INDIA)) { + self::$INDIA = new Flag('in'); + } + return self::$INDIA; + } + public static function IRELAND(): Flag + { + if (!isset(self::$IRELAND)) { + self::$IRELAND = new Flag('ie'); + } + return self::$IRELAND; + } + public static function IRANISLAMICREPUBLICOF(): Flag + { + if (!isset(self::$IRANISLAMICREPUBLICOF)) { + self::$IRANISLAMICREPUBLICOF = new Flag('ir'); + } + return self::$IRANISLAMICREPUBLICOF; + } + public static function IRAQ(): Flag + { + if (!isset(self::$IRAQ)) { + self::$IRAQ = new Flag('iq'); + } + return self::$IRAQ; + } + public static function ICELAND(): Flag + { + if (!isset(self::$ICELAND)) { + self::$ICELAND = new Flag('is'); + } + return self::$ICELAND; + } + public static function ISRAEL(): Flag + { + if (!isset(self::$ISRAEL)) { + self::$ISRAEL = new Flag('il'); + } + return self::$ISRAEL; + } + public static function ITALY(): Flag + { + if (!isset(self::$ITALY)) { + self::$ITALY = new Flag('it'); + } + return self::$ITALY; + } + public static function JAMAICA(): Flag + { + if (!isset(self::$JAMAICA)) { + self::$JAMAICA = new Flag('jm'); + } + return self::$JAMAICA; + } + public static function JORDAN(): Flag + { + if (!isset(self::$JORDAN)) { + self::$JORDAN = new Flag('jo'); + } + return self::$JORDAN; + } + public static function JAPAN(): Flag + { + if (!isset(self::$JAPAN)) { + self::$JAPAN = new Flag('jp'); + } + return self::$JAPAN; + } + public static function KAZAKHSTAN(): Flag + { + if (!isset(self::$KAZAKHSTAN)) { + self::$KAZAKHSTAN = new Flag('kz'); + } + return self::$KAZAKHSTAN; + } + public static function KENYA(): Flag + { + if (!isset(self::$KENYA)) { + self::$KENYA = new Flag('ke'); + } + return self::$KENYA; + } + public static function KYRGYZSTAN(): Flag + { + if (!isset(self::$KYRGYZSTAN)) { + self::$KYRGYZSTAN = new Flag('kg'); + } + return self::$KYRGYZSTAN; + } + public static function CAMBODIA(): Flag + { + if (!isset(self::$CAMBODIA)) { + self::$CAMBODIA = new Flag('kh'); + } + return self::$CAMBODIA; + } + public static function KIRIBATI(): Flag + { + if (!isset(self::$KIRIBATI)) { + self::$KIRIBATI = new Flag('ki'); + } + return self::$KIRIBATI; + } + public static function SAINTKITTSANDNEVIS(): Flag + { + if (!isset(self::$SAINTKITTSANDNEVIS)) { + self::$SAINTKITTSANDNEVIS = new Flag('kn'); + } + return self::$SAINTKITTSANDNEVIS; + } + public static function SOUTHKOREA(): Flag + { + if (!isset(self::$SOUTHKOREA)) { + self::$SOUTHKOREA = new Flag('kr'); + } + return self::$SOUTHKOREA; + } + public static function KUWAIT(): Flag + { + if (!isset(self::$KUWAIT)) { + self::$KUWAIT = new Flag('kw'); + } + return self::$KUWAIT; + } + public static function LAOPEOPLESDEMOCRATICREPUBLIC(): Flag + { + if (!isset(self::$LAOPEOPLESDEMOCRATICREPUBLIC)) { + self::$LAOPEOPLESDEMOCRATICREPUBLIC = new Flag('la'); + } + return self::$LAOPEOPLESDEMOCRATICREPUBLIC; + } + public static function LEBANON(): Flag + { + if (!isset(self::$LEBANON)) { + self::$LEBANON = new Flag('lb'); + } + return self::$LEBANON; + } + public static function LIBERIA(): Flag + { + if (!isset(self::$LIBERIA)) { + self::$LIBERIA = new Flag('lr'); + } + return self::$LIBERIA; + } + public static function LIBYA(): Flag + { + if (!isset(self::$LIBYA)) { + self::$LIBYA = new Flag('ly'); + } + return self::$LIBYA; + } + public static function SAINTLUCIA(): Flag + { + if (!isset(self::$SAINTLUCIA)) { + self::$SAINTLUCIA = new Flag('lc'); + } + return self::$SAINTLUCIA; + } + public static function LIECHTENSTEIN(): Flag + { + if (!isset(self::$LIECHTENSTEIN)) { + self::$LIECHTENSTEIN = new Flag('li'); + } + return self::$LIECHTENSTEIN; + } + public static function SRILANKA(): Flag + { + if (!isset(self::$SRILANKA)) { + self::$SRILANKA = new Flag('lk'); + } + return self::$SRILANKA; + } + public static function LESOTHO(): Flag + { + if (!isset(self::$LESOTHO)) { + self::$LESOTHO = new Flag('ls'); + } + return self::$LESOTHO; + } + public static function LITHUANIA(): Flag + { + if (!isset(self::$LITHUANIA)) { + self::$LITHUANIA = new Flag('lt'); + } + return self::$LITHUANIA; + } + public static function LUXEMBOURG(): Flag + { + if (!isset(self::$LUXEMBOURG)) { + self::$LUXEMBOURG = new Flag('lu'); + } + return self::$LUXEMBOURG; + } + public static function LATVIA(): Flag + { + if (!isset(self::$LATVIA)) { + self::$LATVIA = new Flag('lv'); + } + return self::$LATVIA; + } + public static function MOROCCO(): Flag + { + if (!isset(self::$MOROCCO)) { + self::$MOROCCO = new Flag('ma'); + } + return self::$MOROCCO; + } + public static function MONACO(): Flag + { + if (!isset(self::$MONACO)) { + self::$MONACO = new Flag('mc'); + } + return self::$MONACO; + } + public static function MOLDOVA(): Flag + { + if (!isset(self::$MOLDOVA)) { + self::$MOLDOVA = new Flag('md'); + } + return self::$MOLDOVA; + } + public static function MADAGASCAR(): Flag + { + if (!isset(self::$MADAGASCAR)) { + self::$MADAGASCAR = new Flag('mg'); + } + return self::$MADAGASCAR; + } + public static function MALDIVES(): Flag + { + if (!isset(self::$MALDIVES)) { + self::$MALDIVES = new Flag('mv'); + } + return self::$MALDIVES; + } + public static function MEXICO(): Flag + { + if (!isset(self::$MEXICO)) { + self::$MEXICO = new Flag('mx'); + } + return self::$MEXICO; + } + public static function MARSHALLISLANDS(): Flag + { + if (!isset(self::$MARSHALLISLANDS)) { + self::$MARSHALLISLANDS = new Flag('mh'); + } + return self::$MARSHALLISLANDS; + } + public static function NORTHMACEDONIA(): Flag + { + if (!isset(self::$NORTHMACEDONIA)) { + self::$NORTHMACEDONIA = new Flag('mk'); + } + return self::$NORTHMACEDONIA; + } + public static function MALI(): Flag + { + if (!isset(self::$MALI)) { + self::$MALI = new Flag('ml'); + } + return self::$MALI; + } + public static function MALTA(): Flag + { + if (!isset(self::$MALTA)) { + self::$MALTA = new Flag('mt'); + } + return self::$MALTA; + } + public static function MYANMAR(): Flag + { + if (!isset(self::$MYANMAR)) { + self::$MYANMAR = new Flag('mm'); + } + return self::$MYANMAR; + } + public static function MONTENEGRO(): Flag + { + if (!isset(self::$MONTENEGRO)) { + self::$MONTENEGRO = new Flag('me'); + } + return self::$MONTENEGRO; + } + public static function MONGOLIA(): Flag + { + if (!isset(self::$MONGOLIA)) { + self::$MONGOLIA = new Flag('mn'); + } + return self::$MONGOLIA; + } + public static function MOZAMBIQUE(): Flag + { + if (!isset(self::$MOZAMBIQUE)) { + self::$MOZAMBIQUE = new Flag('mz'); + } + return self::$MOZAMBIQUE; + } + public static function MAURITANIA(): Flag + { + if (!isset(self::$MAURITANIA)) { + self::$MAURITANIA = new Flag('mr'); + } + return self::$MAURITANIA; + } + public static function MAURITIUS(): Flag + { + if (!isset(self::$MAURITIUS)) { + self::$MAURITIUS = new Flag('mu'); + } + return self::$MAURITIUS; + } + public static function MALAWI(): Flag + { + if (!isset(self::$MALAWI)) { + self::$MALAWI = new Flag('mw'); + } + return self::$MALAWI; + } + public static function MALAYSIA(): Flag + { + if (!isset(self::$MALAYSIA)) { + self::$MALAYSIA = new Flag('my'); + } + return self::$MALAYSIA; + } + public static function NAMIBIA(): Flag + { + if (!isset(self::$NAMIBIA)) { + self::$NAMIBIA = new Flag('na'); + } + return self::$NAMIBIA; + } + public static function NIGER(): Flag + { + if (!isset(self::$NIGER)) { + self::$NIGER = new Flag('ne'); + } + return self::$NIGER; + } + public static function NIGERIA(): Flag + { + if (!isset(self::$NIGERIA)) { + self::$NIGERIA = new Flag('ng'); + } + return self::$NIGERIA; + } + public static function NICARAGUA(): Flag + { + if (!isset(self::$NICARAGUA)) { + self::$NICARAGUA = new Flag('ni'); + } + return self::$NICARAGUA; + } + public static function NETHERLANDS(): Flag + { + if (!isset(self::$NETHERLANDS)) { + self::$NETHERLANDS = new Flag('nl'); + } + return self::$NETHERLANDS; + } + public static function NORWAY(): Flag + { + if (!isset(self::$NORWAY)) { + self::$NORWAY = new Flag('no'); + } + return self::$NORWAY; + } + public static function NEPAL(): Flag + { + if (!isset(self::$NEPAL)) { + self::$NEPAL = new Flag('np'); + } + return self::$NEPAL; + } + public static function NAURU(): Flag + { + if (!isset(self::$NAURU)) { + self::$NAURU = new Flag('nr'); + } + return self::$NAURU; + } + public static function NEWZEALAND(): Flag + { + if (!isset(self::$NEWZEALAND)) { + self::$NEWZEALAND = new Flag('nz'); + } + return self::$NEWZEALAND; + } + public static function OMAN(): Flag + { + if (!isset(self::$OMAN)) { + self::$OMAN = new Flag('om'); + } + return self::$OMAN; + } + public static function PAKISTAN(): Flag + { + if (!isset(self::$PAKISTAN)) { + self::$PAKISTAN = new Flag('pk'); + } + return self::$PAKISTAN; + } + public static function PANAMA(): Flag + { + if (!isset(self::$PANAMA)) { + self::$PANAMA = new Flag('pa'); + } + return self::$PANAMA; + } + public static function PERU(): Flag + { + if (!isset(self::$PERU)) { + self::$PERU = new Flag('pe'); + } + return self::$PERU; + } + public static function PHILIPPINES(): Flag + { + if (!isset(self::$PHILIPPINES)) { + self::$PHILIPPINES = new Flag('ph'); + } + return self::$PHILIPPINES; + } + public static function PALAU(): Flag + { + if (!isset(self::$PALAU)) { + self::$PALAU = new Flag('pw'); + } + return self::$PALAU; + } + public static function PAPUANEWGUINEA(): Flag + { + if (!isset(self::$PAPUANEWGUINEA)) { + self::$PAPUANEWGUINEA = new Flag('pg'); + } + return self::$PAPUANEWGUINEA; + } + public static function POLAND(): Flag + { + if (!isset(self::$POLAND)) { + self::$POLAND = new Flag('pl'); + } + return self::$POLAND; + } + public static function FRENCHPOLYNESIA(): Flag + { + if (!isset(self::$FRENCHPOLYNESIA)) { + self::$FRENCHPOLYNESIA = new Flag('pf'); + } + return self::$FRENCHPOLYNESIA; + } + public static function NORTHKOREA(): Flag + { + if (!isset(self::$NORTHKOREA)) { + self::$NORTHKOREA = new Flag('kp'); + } + return self::$NORTHKOREA; + } + public static function PORTUGAL(): Flag + { + if (!isset(self::$PORTUGAL)) { + self::$PORTUGAL = new Flag('pt'); + } + return self::$PORTUGAL; + } + public static function PARAGUAY(): Flag + { + if (!isset(self::$PARAGUAY)) { + self::$PARAGUAY = new Flag('py'); + } + return self::$PARAGUAY; + } + public static function QATAR(): Flag + { + if (!isset(self::$QATAR)) { + self::$QATAR = new Flag('qa'); + } + return self::$QATAR; + } + public static function ROMANIA(): Flag + { + if (!isset(self::$ROMANIA)) { + self::$ROMANIA = new Flag('ro'); + } + return self::$ROMANIA; + } + public static function RUSSIA(): Flag + { + if (!isset(self::$RUSSIA)) { + self::$RUSSIA = new Flag('ru'); + } + return self::$RUSSIA; + } + public static function RWANDA(): Flag + { + if (!isset(self::$RWANDA)) { + self::$RWANDA = new Flag('rw'); + } + return self::$RWANDA; + } + public static function SAUDIARABIA(): Flag + { + if (!isset(self::$SAUDIARABIA)) { + self::$SAUDIARABIA = new Flag('sa'); + } + return self::$SAUDIARABIA; + } + public static function SUDAN(): Flag + { + if (!isset(self::$SUDAN)) { + self::$SUDAN = new Flag('sd'); + } + return self::$SUDAN; + } + public static function SENEGAL(): Flag + { + if (!isset(self::$SENEGAL)) { + self::$SENEGAL = new Flag('sn'); + } + return self::$SENEGAL; + } + public static function SINGAPORE(): Flag + { + if (!isset(self::$SINGAPORE)) { + self::$SINGAPORE = new Flag('sg'); + } + return self::$SINGAPORE; + } + public static function SOLOMONISLANDS(): Flag + { + if (!isset(self::$SOLOMONISLANDS)) { + self::$SOLOMONISLANDS = new Flag('sb'); + } + return self::$SOLOMONISLANDS; + } + public static function SIERRALEONE(): Flag + { + if (!isset(self::$SIERRALEONE)) { + self::$SIERRALEONE = new Flag('sl'); + } + return self::$SIERRALEONE; + } + public static function ELSALVADOR(): Flag + { + if (!isset(self::$ELSALVADOR)) { + self::$ELSALVADOR = new Flag('sv'); + } + return self::$ELSALVADOR; + } + public static function SANMARINO(): Flag + { + if (!isset(self::$SANMARINO)) { + self::$SANMARINO = new Flag('sm'); + } + return self::$SANMARINO; + } + public static function SOMALIA(): Flag + { + if (!isset(self::$SOMALIA)) { + self::$SOMALIA = new Flag('so'); + } + return self::$SOMALIA; + } + public static function SERBIA(): Flag + { + if (!isset(self::$SERBIA)) { + self::$SERBIA = new Flag('rs'); + } + return self::$SERBIA; + } + public static function SOUTHSUDAN(): Flag + { + if (!isset(self::$SOUTHSUDAN)) { + self::$SOUTHSUDAN = new Flag('ss'); + } + return self::$SOUTHSUDAN; + } + public static function SAOTOMEANDPRINCIPE(): Flag + { + if (!isset(self::$SAOTOMEANDPRINCIPE)) { + self::$SAOTOMEANDPRINCIPE = new Flag('st'); + } + return self::$SAOTOMEANDPRINCIPE; + } + public static function SURINAME(): Flag + { + if (!isset(self::$SURINAME)) { + self::$SURINAME = new Flag('sr'); + } + return self::$SURINAME; + } + public static function SLOVAKIA(): Flag + { + if (!isset(self::$SLOVAKIA)) { + self::$SLOVAKIA = new Flag('sk'); + } + return self::$SLOVAKIA; + } + public static function SLOVENIA(): Flag + { + if (!isset(self::$SLOVENIA)) { + self::$SLOVENIA = new Flag('si'); + } + return self::$SLOVENIA; + } + public static function SWEDEN(): Flag + { + if (!isset(self::$SWEDEN)) { + self::$SWEDEN = new Flag('se'); + } + return self::$SWEDEN; + } + public static function ESWATINI(): Flag + { + if (!isset(self::$ESWATINI)) { + self::$ESWATINI = new Flag('sz'); + } + return self::$ESWATINI; + } + public static function SEYCHELLES(): Flag + { + if (!isset(self::$SEYCHELLES)) { + self::$SEYCHELLES = new Flag('sc'); + } + return self::$SEYCHELLES; + } + public static function SYRIA(): Flag + { + if (!isset(self::$SYRIA)) { + self::$SYRIA = new Flag('sy'); + } + return self::$SYRIA; + } + public static function CHAD(): Flag + { + if (!isset(self::$CHAD)) { + self::$CHAD = new Flag('td'); + } + return self::$CHAD; + } + public static function TOGO(): Flag + { + if (!isset(self::$TOGO)) { + self::$TOGO = new Flag('tg'); + } + return self::$TOGO; + } + public static function THAILAND(): Flag + { + if (!isset(self::$THAILAND)) { + self::$THAILAND = new Flag('th'); + } + return self::$THAILAND; + } + public static function TAJIKISTAN(): Flag + { + if (!isset(self::$TAJIKISTAN)) { + self::$TAJIKISTAN = new Flag('tj'); + } + return self::$TAJIKISTAN; + } + public static function TURKMENISTAN(): Flag + { + if (!isset(self::$TURKMENISTAN)) { + self::$TURKMENISTAN = new Flag('tm'); + } + return self::$TURKMENISTAN; + } + public static function TIMORLESTE(): Flag + { + if (!isset(self::$TIMORLESTE)) { + self::$TIMORLESTE = new Flag('tl'); + } + return self::$TIMORLESTE; + } + public static function TONGA(): Flag + { + if (!isset(self::$TONGA)) { + self::$TONGA = new Flag('to'); + } + return self::$TONGA; + } + public static function TRINIDADANDTOBAGO(): Flag + { + if (!isset(self::$TRINIDADANDTOBAGO)) { + self::$TRINIDADANDTOBAGO = new Flag('tt'); + } + return self::$TRINIDADANDTOBAGO; + } + public static function TUNISIA(): Flag + { + if (!isset(self::$TUNISIA)) { + self::$TUNISIA = new Flag('tn'); + } + return self::$TUNISIA; + } + public static function TURKEY(): Flag + { + if (!isset(self::$TURKEY)) { + self::$TURKEY = new Flag('tr'); + } + return self::$TURKEY; + } + public static function TUVALU(): Flag + { + if (!isset(self::$TUVALU)) { + self::$TUVALU = new Flag('tv'); + } + return self::$TUVALU; + } + public static function TANZANIA(): Flag + { + if (!isset(self::$TANZANIA)) { + self::$TANZANIA = new Flag('tz'); + } + return self::$TANZANIA; + } + public static function UGANDA(): Flag + { + if (!isset(self::$UGANDA)) { + self::$UGANDA = new Flag('ug'); + } + return self::$UGANDA; + } + public static function UKRAINE(): Flag + { + if (!isset(self::$UKRAINE)) { + self::$UKRAINE = new Flag('ua'); + } + return self::$UKRAINE; + } + public static function URUGUAY(): Flag + { + if (!isset(self::$URUGUAY)) { + self::$URUGUAY = new Flag('uy'); + } + return self::$URUGUAY; + } + public static function UNITEDSTATES(): Flag + { + if (!isset(self::$UNITEDSTATES)) { + self::$UNITEDSTATES = new Flag('us'); + } + return self::$UNITEDSTATES; + } + public static function UZBEKISTAN(): Flag + { + if (!isset(self::$UZBEKISTAN)) { + self::$UZBEKISTAN = new Flag('uz'); + } + return self::$UZBEKISTAN; + } + public static function VATICANCITY(): Flag + { + if (!isset(self::$VATICANCITY)) { + self::$VATICANCITY = new Flag('va'); + } + return self::$VATICANCITY; + } + public static function SAINTVINCENTANDTHEGRENADINES(): Flag + { + if (!isset(self::$SAINTVINCENTANDTHEGRENADINES)) { + self::$SAINTVINCENTANDTHEGRENADINES = new Flag('vc'); + } + return self::$SAINTVINCENTANDTHEGRENADINES; + } + public static function VENEZUELA(): Flag + { + if (!isset(self::$VENEZUELA)) { + self::$VENEZUELA = new Flag('ve'); + } + return self::$VENEZUELA; + } + public static function VIETNAM(): Flag + { + if (!isset(self::$VIETNAM)) { + self::$VIETNAM = new Flag('vn'); + } + return self::$VIETNAM; + } + public static function VANUATU(): Flag + { + if (!isset(self::$VANUATU)) { + self::$VANUATU = new Flag('vu'); + } + return self::$VANUATU; + } + public static function SAMOA(): Flag + { + if (!isset(self::$SAMOA)) { + self::$SAMOA = new Flag('ws'); + } + return self::$SAMOA; + } + public static function YEMEN(): Flag + { + if (!isset(self::$YEMEN)) { + self::$YEMEN = new Flag('ye'); + } + return self::$YEMEN; + } + public static function SOUTHAFRICA(): Flag + { + if (!isset(self::$SOUTHAFRICA)) { + self::$SOUTHAFRICA = new Flag('za'); + } + return self::$SOUTHAFRICA; + } + public static function ZAMBIA(): Flag + { + if (!isset(self::$ZAMBIA)) { + self::$ZAMBIA = new Flag('zm'); + } + return self::$ZAMBIA; + } + public static function ZIMBABWE(): Flag + { + if (!isset(self::$ZIMBABWE)) { + self::$ZIMBABWE = new Flag('zw'); + } + return self::$ZIMBABWE; + } +} \ No newline at end of file diff --git a/src/Appwrite/Enums/ImageFormat.php b/src/Appwrite/Enums/ImageFormat.php new file mode 100644 index 0000000..9ec15d2 --- /dev/null +++ b/src/Appwrite/Enums/ImageFormat.php @@ -0,0 +1,67 @@ +<?php + +namespace Appwrite\Enums; + +use JsonSerializable; + +class ImageFormat implements JsonSerializable +{ + private static ImageFormat $JPG; + private static ImageFormat $JPEG; + private static ImageFormat $GIF; + private static ImageFormat $PNG; + private static ImageFormat $WEBP; + + private string $value; + + private function __construct(string $value) + { + $this->value = $value; + } + + public function __toString(): string + { + return $this->value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function JPG(): ImageFormat + { + if (!isset(self::$JPG)) { + self::$JPG = new ImageFormat('jpg'); + } + return self::$JPG; + } + public static function JPEG(): ImageFormat + { + if (!isset(self::$JPEG)) { + self::$JPEG = new ImageFormat('jpeg'); + } + return self::$JPEG; + } + public static function GIF(): ImageFormat + { + if (!isset(self::$GIF)) { + self::$GIF = new ImageFormat('gif'); + } + return self::$GIF; + } + public static function PNG(): ImageFormat + { + if (!isset(self::$PNG)) { + self::$PNG = new ImageFormat('png'); + } + return self::$PNG; + } + public static function WEBP(): ImageFormat + { + if (!isset(self::$WEBP)) { + self::$WEBP = new ImageFormat('webp'); + } + return self::$WEBP; + } +} \ No newline at end of file diff --git a/src/Appwrite/Enums/ImageGravity.php b/src/Appwrite/Enums/ImageGravity.php new file mode 100644 index 0000000..a909cb8 --- /dev/null +++ b/src/Appwrite/Enums/ImageGravity.php @@ -0,0 +1,99 @@ +<?php + +namespace Appwrite\Enums; + +use JsonSerializable; + +class ImageGravity implements JsonSerializable +{ + private static ImageGravity $CENTER; + private static ImageGravity $TOPLEFT; + private static ImageGravity $TOP; + private static ImageGravity $TOPRIGHT; + private static ImageGravity $LEFT; + private static ImageGravity $RIGHT; + private static ImageGravity $BOTTOMLEFT; + private static ImageGravity $BOTTOM; + private static ImageGravity $BOTTOMRIGHT; + + private string $value; + + private function __construct(string $value) + { + $this->value = $value; + } + + public function __toString(): string + { + return $this->value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function CENTER(): ImageGravity + { + if (!isset(self::$CENTER)) { + self::$CENTER = new ImageGravity('center'); + } + return self::$CENTER; + } + public static function TOPLEFT(): ImageGravity + { + if (!isset(self::$TOPLEFT)) { + self::$TOPLEFT = new ImageGravity('top-left'); + } + return self::$TOPLEFT; + } + public static function TOP(): ImageGravity + { + if (!isset(self::$TOP)) { + self::$TOP = new ImageGravity('top'); + } + return self::$TOP; + } + public static function TOPRIGHT(): ImageGravity + { + if (!isset(self::$TOPRIGHT)) { + self::$TOPRIGHT = new ImageGravity('top-right'); + } + return self::$TOPRIGHT; + } + public static function LEFT(): ImageGravity + { + if (!isset(self::$LEFT)) { + self::$LEFT = new ImageGravity('left'); + } + return self::$LEFT; + } + public static function RIGHT(): ImageGravity + { + if (!isset(self::$RIGHT)) { + self::$RIGHT = new ImageGravity('right'); + } + return self::$RIGHT; + } + public static function BOTTOMLEFT(): ImageGravity + { + if (!isset(self::$BOTTOMLEFT)) { + self::$BOTTOMLEFT = new ImageGravity('bottom-left'); + } + return self::$BOTTOMLEFT; + } + public static function BOTTOM(): ImageGravity + { + if (!isset(self::$BOTTOM)) { + self::$BOTTOM = new ImageGravity('bottom'); + } + return self::$BOTTOM; + } + public static function BOTTOMRIGHT(): ImageGravity + { + if (!isset(self::$BOTTOMRIGHT)) { + self::$BOTTOMRIGHT = new ImageGravity('bottom-right'); + } + return self::$BOTTOMRIGHT; + } +} \ No newline at end of file diff --git a/src/Appwrite/Enums/IndexType.php b/src/Appwrite/Enums/IndexType.php new file mode 100644 index 0000000..fa71d60 --- /dev/null +++ b/src/Appwrite/Enums/IndexType.php @@ -0,0 +1,51 @@ +<?php + +namespace Appwrite\Enums; + +use JsonSerializable; + +class IndexType implements JsonSerializable +{ + private static IndexType $KEY; + private static IndexType $FULLTEXT; + private static IndexType $UNIQUE; + + private string $value; + + private function __construct(string $value) + { + $this->value = $value; + } + + public function __toString(): string + { + return $this->value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function KEY(): IndexType + { + if (!isset(self::$KEY)) { + self::$KEY = new IndexType('key'); + } + return self::$KEY; + } + public static function FULLTEXT(): IndexType + { + if (!isset(self::$FULLTEXT)) { + self::$FULLTEXT = new IndexType('fulltext'); + } + return self::$FULLTEXT; + } + public static function UNIQUE(): IndexType + { + if (!isset(self::$UNIQUE)) { + self::$UNIQUE = new IndexType('unique'); + } + return self::$UNIQUE; + } +} \ No newline at end of file diff --git a/src/Appwrite/Enums/MessagingProviderType.php b/src/Appwrite/Enums/MessagingProviderType.php new file mode 100644 index 0000000..24a8eb0 --- /dev/null +++ b/src/Appwrite/Enums/MessagingProviderType.php @@ -0,0 +1,51 @@ +<?php + +namespace Appwrite\Enums; + +use JsonSerializable; + +class MessagingProviderType implements JsonSerializable +{ + private static MessagingProviderType $EMAIL; + private static MessagingProviderType $SMS; + private static MessagingProviderType $PUSH; + + private string $value; + + private function __construct(string $value) + { + $this->value = $value; + } + + public function __toString(): string + { + return $this->value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function EMAIL(): MessagingProviderType + { + if (!isset(self::$EMAIL)) { + self::$EMAIL = new MessagingProviderType('email'); + } + return self::$EMAIL; + } + public static function SMS(): MessagingProviderType + { + if (!isset(self::$SMS)) { + self::$SMS = new MessagingProviderType('sms'); + } + return self::$SMS; + } + public static function PUSH(): MessagingProviderType + { + if (!isset(self::$PUSH)) { + self::$PUSH = new MessagingProviderType('push'); + } + return self::$PUSH; + } +} \ No newline at end of file diff --git a/src/Appwrite/Enums/Name.php b/src/Appwrite/Enums/Name.php new file mode 100644 index 0000000..49fad38 --- /dev/null +++ b/src/Appwrite/Enums/Name.php @@ -0,0 +1,123 @@ +<?php + +namespace Appwrite\Enums; + +use JsonSerializable; + +class Name implements JsonSerializable +{ + private static Name $V1DATABASE; + private static Name $V1DELETES; + private static Name $V1AUDITS; + private static Name $V1MAILS; + private static Name $V1FUNCTIONS; + private static Name $V1USAGE; + private static Name $V1USAGEDUMP; + private static Name $V1WEBHOOKS; + private static Name $V1CERTIFICATES; + private static Name $V1BUILDS; + private static Name $V1MESSAGING; + private static Name $V1MIGRATIONS; + + private string $value; + + private function __construct(string $value) + { + $this->value = $value; + } + + public function __toString(): string + { + return $this->value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function V1DATABASE(): Name + { + if (!isset(self::$V1DATABASE)) { + self::$V1DATABASE = new Name('v1-database'); + } + return self::$V1DATABASE; + } + public static function V1DELETES(): Name + { + if (!isset(self::$V1DELETES)) { + self::$V1DELETES = new Name('v1-deletes'); + } + return self::$V1DELETES; + } + public static function V1AUDITS(): Name + { + if (!isset(self::$V1AUDITS)) { + self::$V1AUDITS = new Name('v1-audits'); + } + return self::$V1AUDITS; + } + public static function V1MAILS(): Name + { + if (!isset(self::$V1MAILS)) { + self::$V1MAILS = new Name('v1-mails'); + } + return self::$V1MAILS; + } + public static function V1FUNCTIONS(): Name + { + if (!isset(self::$V1FUNCTIONS)) { + self::$V1FUNCTIONS = new Name('v1-functions'); + } + return self::$V1FUNCTIONS; + } + public static function V1USAGE(): Name + { + if (!isset(self::$V1USAGE)) { + self::$V1USAGE = new Name('v1-usage'); + } + return self::$V1USAGE; + } + public static function V1USAGEDUMP(): Name + { + if (!isset(self::$V1USAGEDUMP)) { + self::$V1USAGEDUMP = new Name('v1-usage-dump'); + } + return self::$V1USAGEDUMP; + } + public static function V1WEBHOOKS(): Name + { + if (!isset(self::$V1WEBHOOKS)) { + self::$V1WEBHOOKS = new Name('v1-webhooks'); + } + return self::$V1WEBHOOKS; + } + public static function V1CERTIFICATES(): Name + { + if (!isset(self::$V1CERTIFICATES)) { + self::$V1CERTIFICATES = new Name('v1-certificates'); + } + return self::$V1CERTIFICATES; + } + public static function V1BUILDS(): Name + { + if (!isset(self::$V1BUILDS)) { + self::$V1BUILDS = new Name('v1-builds'); + } + return self::$V1BUILDS; + } + public static function V1MESSAGING(): Name + { + if (!isset(self::$V1MESSAGING)) { + self::$V1MESSAGING = new Name('v1-messaging'); + } + return self::$V1MESSAGING; + } + public static function V1MIGRATIONS(): Name + { + if (!isset(self::$V1MIGRATIONS)) { + self::$V1MIGRATIONS = new Name('v1-migrations'); + } + return self::$V1MIGRATIONS; + } +} \ No newline at end of file diff --git a/src/Appwrite/Enums/OAuthProvider.php b/src/Appwrite/Enums/OAuthProvider.php new file mode 100644 index 0000000..6ee87be --- /dev/null +++ b/src/Appwrite/Enums/OAuthProvider.php @@ -0,0 +1,339 @@ +<?php + +namespace Appwrite\Enums; + +use JsonSerializable; + +class OAuthProvider implements JsonSerializable +{ + private static OAuthProvider $AMAZON; + private static OAuthProvider $APPLE; + private static OAuthProvider $AUTH0; + private static OAuthProvider $AUTHENTIK; + private static OAuthProvider $AUTODESK; + private static OAuthProvider $BITBUCKET; + private static OAuthProvider $BITLY; + private static OAuthProvider $BOX; + private static OAuthProvider $DAILYMOTION; + private static OAuthProvider $DISCORD; + private static OAuthProvider $DISQUS; + private static OAuthProvider $DROPBOX; + private static OAuthProvider $ETSY; + private static OAuthProvider $FACEBOOK; + private static OAuthProvider $GITHUB; + private static OAuthProvider $GITLAB; + private static OAuthProvider $GOOGLE; + private static OAuthProvider $LINKEDIN; + private static OAuthProvider $MICROSOFT; + private static OAuthProvider $NOTION; + private static OAuthProvider $OIDC; + private static OAuthProvider $OKTA; + private static OAuthProvider $PAYPAL; + private static OAuthProvider $PAYPALSANDBOX; + private static OAuthProvider $PODIO; + private static OAuthProvider $SALESFORCE; + private static OAuthProvider $SLACK; + private static OAuthProvider $SPOTIFY; + private static OAuthProvider $STRIPE; + private static OAuthProvider $TRADESHIFT; + private static OAuthProvider $TRADESHIFTBOX; + private static OAuthProvider $TWITCH; + private static OAuthProvider $WORDPRESS; + private static OAuthProvider $YAHOO; + private static OAuthProvider $YAMMER; + private static OAuthProvider $YANDEX; + private static OAuthProvider $ZOHO; + private static OAuthProvider $ZOOM; + private static OAuthProvider $MOCK; + + private string $value; + + private function __construct(string $value) + { + $this->value = $value; + } + + public function __toString(): string + { + return $this->value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function AMAZON(): OAuthProvider + { + if (!isset(self::$AMAZON)) { + self::$AMAZON = new OAuthProvider('amazon'); + } + return self::$AMAZON; + } + public static function APPLE(): OAuthProvider + { + if (!isset(self::$APPLE)) { + self::$APPLE = new OAuthProvider('apple'); + } + return self::$APPLE; + } + public static function AUTH0(): OAuthProvider + { + if (!isset(self::$AUTH0)) { + self::$AUTH0 = new OAuthProvider('auth0'); + } + return self::$AUTH0; + } + public static function AUTHENTIK(): OAuthProvider + { + if (!isset(self::$AUTHENTIK)) { + self::$AUTHENTIK = new OAuthProvider('authentik'); + } + return self::$AUTHENTIK; + } + public static function AUTODESK(): OAuthProvider + { + if (!isset(self::$AUTODESK)) { + self::$AUTODESK = new OAuthProvider('autodesk'); + } + return self::$AUTODESK; + } + public static function BITBUCKET(): OAuthProvider + { + if (!isset(self::$BITBUCKET)) { + self::$BITBUCKET = new OAuthProvider('bitbucket'); + } + return self::$BITBUCKET; + } + public static function BITLY(): OAuthProvider + { + if (!isset(self::$BITLY)) { + self::$BITLY = new OAuthProvider('bitly'); + } + return self::$BITLY; + } + public static function BOX(): OAuthProvider + { + if (!isset(self::$BOX)) { + self::$BOX = new OAuthProvider('box'); + } + return self::$BOX; + } + public static function DAILYMOTION(): OAuthProvider + { + if (!isset(self::$DAILYMOTION)) { + self::$DAILYMOTION = new OAuthProvider('dailymotion'); + } + return self::$DAILYMOTION; + } + public static function DISCORD(): OAuthProvider + { + if (!isset(self::$DISCORD)) { + self::$DISCORD = new OAuthProvider('discord'); + } + return self::$DISCORD; + } + public static function DISQUS(): OAuthProvider + { + if (!isset(self::$DISQUS)) { + self::$DISQUS = new OAuthProvider('disqus'); + } + return self::$DISQUS; + } + public static function DROPBOX(): OAuthProvider + { + if (!isset(self::$DROPBOX)) { + self::$DROPBOX = new OAuthProvider('dropbox'); + } + return self::$DROPBOX; + } + public static function ETSY(): OAuthProvider + { + if (!isset(self::$ETSY)) { + self::$ETSY = new OAuthProvider('etsy'); + } + return self::$ETSY; + } + public static function FACEBOOK(): OAuthProvider + { + if (!isset(self::$FACEBOOK)) { + self::$FACEBOOK = new OAuthProvider('facebook'); + } + return self::$FACEBOOK; + } + public static function GITHUB(): OAuthProvider + { + if (!isset(self::$GITHUB)) { + self::$GITHUB = new OAuthProvider('github'); + } + return self::$GITHUB; + } + public static function GITLAB(): OAuthProvider + { + if (!isset(self::$GITLAB)) { + self::$GITLAB = new OAuthProvider('gitlab'); + } + return self::$GITLAB; + } + public static function GOOGLE(): OAuthProvider + { + if (!isset(self::$GOOGLE)) { + self::$GOOGLE = new OAuthProvider('google'); + } + return self::$GOOGLE; + } + public static function LINKEDIN(): OAuthProvider + { + if (!isset(self::$LINKEDIN)) { + self::$LINKEDIN = new OAuthProvider('linkedin'); + } + return self::$LINKEDIN; + } + public static function MICROSOFT(): OAuthProvider + { + if (!isset(self::$MICROSOFT)) { + self::$MICROSOFT = new OAuthProvider('microsoft'); + } + return self::$MICROSOFT; + } + public static function NOTION(): OAuthProvider + { + if (!isset(self::$NOTION)) { + self::$NOTION = new OAuthProvider('notion'); + } + return self::$NOTION; + } + public static function OIDC(): OAuthProvider + { + if (!isset(self::$OIDC)) { + self::$OIDC = new OAuthProvider('oidc'); + } + return self::$OIDC; + } + public static function OKTA(): OAuthProvider + { + if (!isset(self::$OKTA)) { + self::$OKTA = new OAuthProvider('okta'); + } + return self::$OKTA; + } + public static function PAYPAL(): OAuthProvider + { + if (!isset(self::$PAYPAL)) { + self::$PAYPAL = new OAuthProvider('paypal'); + } + return self::$PAYPAL; + } + public static function PAYPALSANDBOX(): OAuthProvider + { + if (!isset(self::$PAYPALSANDBOX)) { + self::$PAYPALSANDBOX = new OAuthProvider('paypalSandbox'); + } + return self::$PAYPALSANDBOX; + } + public static function PODIO(): OAuthProvider + { + if (!isset(self::$PODIO)) { + self::$PODIO = new OAuthProvider('podio'); + } + return self::$PODIO; + } + public static function SALESFORCE(): OAuthProvider + { + if (!isset(self::$SALESFORCE)) { + self::$SALESFORCE = new OAuthProvider('salesforce'); + } + return self::$SALESFORCE; + } + public static function SLACK(): OAuthProvider + { + if (!isset(self::$SLACK)) { + self::$SLACK = new OAuthProvider('slack'); + } + return self::$SLACK; + } + public static function SPOTIFY(): OAuthProvider + { + if (!isset(self::$SPOTIFY)) { + self::$SPOTIFY = new OAuthProvider('spotify'); + } + return self::$SPOTIFY; + } + public static function STRIPE(): OAuthProvider + { + if (!isset(self::$STRIPE)) { + self::$STRIPE = new OAuthProvider('stripe'); + } + return self::$STRIPE; + } + public static function TRADESHIFT(): OAuthProvider + { + if (!isset(self::$TRADESHIFT)) { + self::$TRADESHIFT = new OAuthProvider('tradeshift'); + } + return self::$TRADESHIFT; + } + public static function TRADESHIFTBOX(): OAuthProvider + { + if (!isset(self::$TRADESHIFTBOX)) { + self::$TRADESHIFTBOX = new OAuthProvider('tradeshiftBox'); + } + return self::$TRADESHIFTBOX; + } + public static function TWITCH(): OAuthProvider + { + if (!isset(self::$TWITCH)) { + self::$TWITCH = new OAuthProvider('twitch'); + } + return self::$TWITCH; + } + public static function WORDPRESS(): OAuthProvider + { + if (!isset(self::$WORDPRESS)) { + self::$WORDPRESS = new OAuthProvider('wordpress'); + } + return self::$WORDPRESS; + } + public static function YAHOO(): OAuthProvider + { + if (!isset(self::$YAHOO)) { + self::$YAHOO = new OAuthProvider('yahoo'); + } + return self::$YAHOO; + } + public static function YAMMER(): OAuthProvider + { + if (!isset(self::$YAMMER)) { + self::$YAMMER = new OAuthProvider('yammer'); + } + return self::$YAMMER; + } + public static function YANDEX(): OAuthProvider + { + if (!isset(self::$YANDEX)) { + self::$YANDEX = new OAuthProvider('yandex'); + } + return self::$YANDEX; + } + public static function ZOHO(): OAuthProvider + { + if (!isset(self::$ZOHO)) { + self::$ZOHO = new OAuthProvider('zoho'); + } + return self::$ZOHO; + } + public static function ZOOM(): OAuthProvider + { + if (!isset(self::$ZOOM)) { + self::$ZOOM = new OAuthProvider('zoom'); + } + return self::$ZOOM; + } + public static function MOCK(): OAuthProvider + { + if (!isset(self::$MOCK)) { + self::$MOCK = new OAuthProvider('mock'); + } + return self::$MOCK; + } +} \ No newline at end of file diff --git a/src/Appwrite/Enums/PasswordHash.php b/src/Appwrite/Enums/PasswordHash.php new file mode 100644 index 0000000..27d080d --- /dev/null +++ b/src/Appwrite/Enums/PasswordHash.php @@ -0,0 +1,115 @@ +<?php + +namespace Appwrite\Enums; + +use JsonSerializable; + +class PasswordHash implements JsonSerializable +{ + private static PasswordHash $SHA1; + private static PasswordHash $SHA224; + private static PasswordHash $SHA256; + private static PasswordHash $SHA384; + private static PasswordHash $SHA512224; + private static PasswordHash $SHA512256; + private static PasswordHash $SHA512; + private static PasswordHash $SHA3224; + private static PasswordHash $SHA3256; + private static PasswordHash $SHA3384; + private static PasswordHash $SHA3512; + + private string $value; + + private function __construct(string $value) + { + $this->value = $value; + } + + public function __toString(): string + { + return $this->value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function SHA1(): PasswordHash + { + if (!isset(self::$SHA1)) { + self::$SHA1 = new PasswordHash('sha1'); + } + return self::$SHA1; + } + public static function SHA224(): PasswordHash + { + if (!isset(self::$SHA224)) { + self::$SHA224 = new PasswordHash('sha224'); + } + return self::$SHA224; + } + public static function SHA256(): PasswordHash + { + if (!isset(self::$SHA256)) { + self::$SHA256 = new PasswordHash('sha256'); + } + return self::$SHA256; + } + public static function SHA384(): PasswordHash + { + if (!isset(self::$SHA384)) { + self::$SHA384 = new PasswordHash('sha384'); + } + return self::$SHA384; + } + public static function SHA512224(): PasswordHash + { + if (!isset(self::$SHA512224)) { + self::$SHA512224 = new PasswordHash('sha512/224'); + } + return self::$SHA512224; + } + public static function SHA512256(): PasswordHash + { + if (!isset(self::$SHA512256)) { + self::$SHA512256 = new PasswordHash('sha512/256'); + } + return self::$SHA512256; + } + public static function SHA512(): PasswordHash + { + if (!isset(self::$SHA512)) { + self::$SHA512 = new PasswordHash('sha512'); + } + return self::$SHA512; + } + public static function SHA3224(): PasswordHash + { + if (!isset(self::$SHA3224)) { + self::$SHA3224 = new PasswordHash('sha3-224'); + } + return self::$SHA3224; + } + public static function SHA3256(): PasswordHash + { + if (!isset(self::$SHA3256)) { + self::$SHA3256 = new PasswordHash('sha3-256'); + } + return self::$SHA3256; + } + public static function SHA3384(): PasswordHash + { + if (!isset(self::$SHA3384)) { + self::$SHA3384 = new PasswordHash('sha3-384'); + } + return self::$SHA3384; + } + public static function SHA3512(): PasswordHash + { + if (!isset(self::$SHA3512)) { + self::$SHA3512 = new PasswordHash('sha3-512'); + } + return self::$SHA3512; + } +} \ No newline at end of file diff --git a/src/Appwrite/Enums/RelationMutate.php b/src/Appwrite/Enums/RelationMutate.php new file mode 100644 index 0000000..0357acc --- /dev/null +++ b/src/Appwrite/Enums/RelationMutate.php @@ -0,0 +1,51 @@ +<?php + +namespace Appwrite\Enums; + +use JsonSerializable; + +class RelationMutate implements JsonSerializable +{ + private static RelationMutate $CASCADE; + private static RelationMutate $RESTRICT; + private static RelationMutate $SETNULL; + + private string $value; + + private function __construct(string $value) + { + $this->value = $value; + } + + public function __toString(): string + { + return $this->value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function CASCADE(): RelationMutate + { + if (!isset(self::$CASCADE)) { + self::$CASCADE = new RelationMutate('cascade'); + } + return self::$CASCADE; + } + public static function RESTRICT(): RelationMutate + { + if (!isset(self::$RESTRICT)) { + self::$RESTRICT = new RelationMutate('restrict'); + } + return self::$RESTRICT; + } + public static function SETNULL(): RelationMutate + { + if (!isset(self::$SETNULL)) { + self::$SETNULL = new RelationMutate('setNull'); + } + return self::$SETNULL; + } +} \ No newline at end of file diff --git a/src/Appwrite/Enums/RelationshipType.php b/src/Appwrite/Enums/RelationshipType.php new file mode 100644 index 0000000..b920b50 --- /dev/null +++ b/src/Appwrite/Enums/RelationshipType.php @@ -0,0 +1,59 @@ +<?php + +namespace Appwrite\Enums; + +use JsonSerializable; + +class RelationshipType implements JsonSerializable +{ + private static RelationshipType $ONETOONE; + private static RelationshipType $MANYTOONE; + private static RelationshipType $MANYTOMANY; + private static RelationshipType $ONETOMANY; + + private string $value; + + private function __construct(string $value) + { + $this->value = $value; + } + + public function __toString(): string + { + return $this->value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function ONETOONE(): RelationshipType + { + if (!isset(self::$ONETOONE)) { + self::$ONETOONE = new RelationshipType('oneToOne'); + } + return self::$ONETOONE; + } + public static function MANYTOONE(): RelationshipType + { + if (!isset(self::$MANYTOONE)) { + self::$MANYTOONE = new RelationshipType('manyToOne'); + } + return self::$MANYTOONE; + } + public static function MANYTOMANY(): RelationshipType + { + if (!isset(self::$MANYTOMANY)) { + self::$MANYTOMANY = new RelationshipType('manyToMany'); + } + return self::$MANYTOMANY; + } + public static function ONETOMANY(): RelationshipType + { + if (!isset(self::$ONETOMANY)) { + self::$ONETOMANY = new RelationshipType('oneToMany'); + } + return self::$ONETOMANY; + } +} \ No newline at end of file diff --git a/src/Appwrite/Enums/Runtime.php b/src/Appwrite/Enums/Runtime.php new file mode 100644 index 0000000..05cb177 --- /dev/null +++ b/src/Appwrite/Enums/Runtime.php @@ -0,0 +1,395 @@ +<?php + +namespace Appwrite\Enums; + +use JsonSerializable; + +class Runtime implements JsonSerializable +{ + private static Runtime $NODE145; + private static Runtime $NODE160; + private static Runtime $NODE180; + private static Runtime $NODE190; + private static Runtime $NODE200; + private static Runtime $NODE210; + private static Runtime $PHP80; + private static Runtime $PHP81; + private static Runtime $PHP82; + private static Runtime $PHP83; + private static Runtime $RUBY30; + private static Runtime $RUBY31; + private static Runtime $RUBY32; + private static Runtime $RUBY33; + private static Runtime $PYTHON38; + private static Runtime $PYTHON39; + private static Runtime $PYTHON310; + private static Runtime $PYTHON311; + private static Runtime $PYTHON312; + private static Runtime $PYTHONML311; + private static Runtime $DENO140; + private static Runtime $DART215; + private static Runtime $DART216; + private static Runtime $DART217; + private static Runtime $DART218; + private static Runtime $DART30; + private static Runtime $DART31; + private static Runtime $DART33; + private static Runtime $DOTNET31; + private static Runtime $DOTNET60; + private static Runtime $DOTNET70; + private static Runtime $JAVA80; + private static Runtime $JAVA110; + private static Runtime $JAVA170; + private static Runtime $JAVA180; + private static Runtime $JAVA210; + private static Runtime $SWIFT55; + private static Runtime $SWIFT58; + private static Runtime $SWIFT59; + private static Runtime $KOTLIN16; + private static Runtime $KOTLIN18; + private static Runtime $KOTLIN19; + private static Runtime $CPP17; + private static Runtime $CPP20; + private static Runtime $BUN10; + private static Runtime $GO122; + + private string $value; + + private function __construct(string $value) + { + $this->value = $value; + } + + public function __toString(): string + { + return $this->value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function NODE145(): Runtime + { + if (!isset(self::$NODE145)) { + self::$NODE145 = new Runtime('node-14.5'); + } + return self::$NODE145; + } + public static function NODE160(): Runtime + { + if (!isset(self::$NODE160)) { + self::$NODE160 = new Runtime('node-16.0'); + } + return self::$NODE160; + } + public static function NODE180(): Runtime + { + if (!isset(self::$NODE180)) { + self::$NODE180 = new Runtime('node-18.0'); + } + return self::$NODE180; + } + public static function NODE190(): Runtime + { + if (!isset(self::$NODE190)) { + self::$NODE190 = new Runtime('node-19.0'); + } + return self::$NODE190; + } + public static function NODE200(): Runtime + { + if (!isset(self::$NODE200)) { + self::$NODE200 = new Runtime('node-20.0'); + } + return self::$NODE200; + } + public static function NODE210(): Runtime + { + if (!isset(self::$NODE210)) { + self::$NODE210 = new Runtime('node-21.0'); + } + return self::$NODE210; + } + public static function PHP80(): Runtime + { + if (!isset(self::$PHP80)) { + self::$PHP80 = new Runtime('php-8.0'); + } + return self::$PHP80; + } + public static function PHP81(): Runtime + { + if (!isset(self::$PHP81)) { + self::$PHP81 = new Runtime('php-8.1'); + } + return self::$PHP81; + } + public static function PHP82(): Runtime + { + if (!isset(self::$PHP82)) { + self::$PHP82 = new Runtime('php-8.2'); + } + return self::$PHP82; + } + public static function PHP83(): Runtime + { + if (!isset(self::$PHP83)) { + self::$PHP83 = new Runtime('php-8.3'); + } + return self::$PHP83; + } + public static function RUBY30(): Runtime + { + if (!isset(self::$RUBY30)) { + self::$RUBY30 = new Runtime('ruby-3.0'); + } + return self::$RUBY30; + } + public static function RUBY31(): Runtime + { + if (!isset(self::$RUBY31)) { + self::$RUBY31 = new Runtime('ruby-3.1'); + } + return self::$RUBY31; + } + public static function RUBY32(): Runtime + { + if (!isset(self::$RUBY32)) { + self::$RUBY32 = new Runtime('ruby-3.2'); + } + return self::$RUBY32; + } + public static function RUBY33(): Runtime + { + if (!isset(self::$RUBY33)) { + self::$RUBY33 = new Runtime('ruby-3.3'); + } + return self::$RUBY33; + } + public static function PYTHON38(): Runtime + { + if (!isset(self::$PYTHON38)) { + self::$PYTHON38 = new Runtime('python-3.8'); + } + return self::$PYTHON38; + } + public static function PYTHON39(): Runtime + { + if (!isset(self::$PYTHON39)) { + self::$PYTHON39 = new Runtime('python-3.9'); + } + return self::$PYTHON39; + } + public static function PYTHON310(): Runtime + { + if (!isset(self::$PYTHON310)) { + self::$PYTHON310 = new Runtime('python-3.10'); + } + return self::$PYTHON310; + } + public static function PYTHON311(): Runtime + { + if (!isset(self::$PYTHON311)) { + self::$PYTHON311 = new Runtime('python-3.11'); + } + return self::$PYTHON311; + } + public static function PYTHON312(): Runtime + { + if (!isset(self::$PYTHON312)) { + self::$PYTHON312 = new Runtime('python-3.12'); + } + return self::$PYTHON312; + } + public static function PYTHONML311(): Runtime + { + if (!isset(self::$PYTHONML311)) { + self::$PYTHONML311 = new Runtime('python-ml-3.11'); + } + return self::$PYTHONML311; + } + public static function DENO140(): Runtime + { + if (!isset(self::$DENO140)) { + self::$DENO140 = new Runtime('deno-1.40'); + } + return self::$DENO140; + } + public static function DART215(): Runtime + { + if (!isset(self::$DART215)) { + self::$DART215 = new Runtime('dart-2.15'); + } + return self::$DART215; + } + public static function DART216(): Runtime + { + if (!isset(self::$DART216)) { + self::$DART216 = new Runtime('dart-2.16'); + } + return self::$DART216; + } + public static function DART217(): Runtime + { + if (!isset(self::$DART217)) { + self::$DART217 = new Runtime('dart-2.17'); + } + return self::$DART217; + } + public static function DART218(): Runtime + { + if (!isset(self::$DART218)) { + self::$DART218 = new Runtime('dart-2.18'); + } + return self::$DART218; + } + public static function DART30(): Runtime + { + if (!isset(self::$DART30)) { + self::$DART30 = new Runtime('dart-3.0'); + } + return self::$DART30; + } + public static function DART31(): Runtime + { + if (!isset(self::$DART31)) { + self::$DART31 = new Runtime('dart-3.1'); + } + return self::$DART31; + } + public static function DART33(): Runtime + { + if (!isset(self::$DART33)) { + self::$DART33 = new Runtime('dart-3.3'); + } + return self::$DART33; + } + public static function DOTNET31(): Runtime + { + if (!isset(self::$DOTNET31)) { + self::$DOTNET31 = new Runtime('dotnet-3.1'); + } + return self::$DOTNET31; + } + public static function DOTNET60(): Runtime + { + if (!isset(self::$DOTNET60)) { + self::$DOTNET60 = new Runtime('dotnet-6.0'); + } + return self::$DOTNET60; + } + public static function DOTNET70(): Runtime + { + if (!isset(self::$DOTNET70)) { + self::$DOTNET70 = new Runtime('dotnet-7.0'); + } + return self::$DOTNET70; + } + public static function JAVA80(): Runtime + { + if (!isset(self::$JAVA80)) { + self::$JAVA80 = new Runtime('java-8.0'); + } + return self::$JAVA80; + } + public static function JAVA110(): Runtime + { + if (!isset(self::$JAVA110)) { + self::$JAVA110 = new Runtime('java-11.0'); + } + return self::$JAVA110; + } + public static function JAVA170(): Runtime + { + if (!isset(self::$JAVA170)) { + self::$JAVA170 = new Runtime('java-17.0'); + } + return self::$JAVA170; + } + public static function JAVA180(): Runtime + { + if (!isset(self::$JAVA180)) { + self::$JAVA180 = new Runtime('java-18.0'); + } + return self::$JAVA180; + } + public static function JAVA210(): Runtime + { + if (!isset(self::$JAVA210)) { + self::$JAVA210 = new Runtime('java-21.0'); + } + return self::$JAVA210; + } + public static function SWIFT55(): Runtime + { + if (!isset(self::$SWIFT55)) { + self::$SWIFT55 = new Runtime('swift-5.5'); + } + return self::$SWIFT55; + } + public static function SWIFT58(): Runtime + { + if (!isset(self::$SWIFT58)) { + self::$SWIFT58 = new Runtime('swift-5.8'); + } + return self::$SWIFT58; + } + public static function SWIFT59(): Runtime + { + if (!isset(self::$SWIFT59)) { + self::$SWIFT59 = new Runtime('swift-5.9'); + } + return self::$SWIFT59; + } + public static function KOTLIN16(): Runtime + { + if (!isset(self::$KOTLIN16)) { + self::$KOTLIN16 = new Runtime('kotlin-1.6'); + } + return self::$KOTLIN16; + } + public static function KOTLIN18(): Runtime + { + if (!isset(self::$KOTLIN18)) { + self::$KOTLIN18 = new Runtime('kotlin-1.8'); + } + return self::$KOTLIN18; + } + public static function KOTLIN19(): Runtime + { + if (!isset(self::$KOTLIN19)) { + self::$KOTLIN19 = new Runtime('kotlin-1.9'); + } + return self::$KOTLIN19; + } + public static function CPP17(): Runtime + { + if (!isset(self::$CPP17)) { + self::$CPP17 = new Runtime('cpp-17'); + } + return self::$CPP17; + } + public static function CPP20(): Runtime + { + if (!isset(self::$CPP20)) { + self::$CPP20 = new Runtime('cpp-20'); + } + return self::$CPP20; + } + public static function BUN10(): Runtime + { + if (!isset(self::$BUN10)) { + self::$BUN10 = new Runtime('bun-1.0'); + } + return self::$BUN10; + } + public static function GO122(): Runtime + { + if (!isset(self::$GO122)) { + self::$GO122 = new Runtime('go-1.22'); + } + return self::$GO122; + } +} \ No newline at end of file diff --git a/src/Appwrite/Enums/SmtpEncryption.php b/src/Appwrite/Enums/SmtpEncryption.php new file mode 100644 index 0000000..53b7a04 --- /dev/null +++ b/src/Appwrite/Enums/SmtpEncryption.php @@ -0,0 +1,51 @@ +<?php + +namespace Appwrite\Enums; + +use JsonSerializable; + +class SmtpEncryption implements JsonSerializable +{ + private static SmtpEncryption $NONE; + private static SmtpEncryption $SSL; + private static SmtpEncryption $TLS; + + private string $value; + + private function __construct(string $value) + { + $this->value = $value; + } + + public function __toString(): string + { + return $this->value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function NONE(): SmtpEncryption + { + if (!isset(self::$NONE)) { + self::$NONE = new SmtpEncryption('none'); + } + return self::$NONE; + } + public static function SSL(): SmtpEncryption + { + if (!isset(self::$SSL)) { + self::$SSL = new SmtpEncryption('ssl'); + } + return self::$SSL; + } + public static function TLS(): SmtpEncryption + { + if (!isset(self::$TLS)) { + self::$TLS = new SmtpEncryption('tls'); + } + return self::$TLS; + } +} \ No newline at end of file diff --git a/src/Appwrite/ID.php b/src/Appwrite/ID.php new file mode 100644 index 0000000..43db4c0 --- /dev/null +++ b/src/Appwrite/ID.php @@ -0,0 +1,22 @@ +<?php + +namespace Appwrite; + +class ID { + public static function unique(int $padding = 7): string + { + $uniqid = \uniqid(); + + if ($padding > 0) { + $bytes = \random_bytes(\max(1, (int)\ceil(($padding / 2)))); // one byte expands to two chars + $uniqid .= \substr(\bin2hex($bytes), 0, $padding); + } + + return $uniqid; + } + + public static function custom(string $id): string + { + return $id; + } +} diff --git a/src/Appwrite/InputFile.php b/src/Appwrite/InputFile.php new file mode 100644 index 0000000..c8a0de7 --- /dev/null +++ b/src/Appwrite/InputFile.php @@ -0,0 +1,51 @@ +<?php +namespace Appwrite; + +class InputFile { + private ?string $data; + private ?string $mimeType; + private ?string $filename; + private ?string $path; + + public function __construct(){} + + public function getData(): ?string + { + return $this->data; + } + + public function getPath(): ?string + { + return $this->path; + } + + public function getMimeType(): ?string + { + return $this->mimeType; + } + + public function getFilename(): ?string + { + return $this->filename; + } + + public static function withPath(string $path, ?string $mimeType = null, ?string $filename = null): InputFile + { + $instance = new InputFile(); + $instance->path = $path; + $instance->data = null; + $instance->mimeType = $mimeType; + $instance->filename = $filename; + return $instance; + } + + public static function withData(string $data, ?string $mimeType = null, ?string $filename = null): InputFile + { + $instance = new InputFile(); + $instance->path = null; + $instance->data = $data; + $instance->mimeType = $mimeType; + $instance->filename = $filename; + return $instance; + } +} \ No newline at end of file diff --git a/src/Appwrite/Permission.php b/src/Appwrite/Permission.php new file mode 100644 index 0000000..8c250e3 --- /dev/null +++ b/src/Appwrite/Permission.php @@ -0,0 +1,31 @@ +<?php + +namespace Appwrite; + +class Permission +{ + public static function read(string $role): string + { + return "read(\"$role\")"; + } + + public static function write(string $role): string + { + return "write(\"$role\")"; + } + + public static function create(string $role): string + { + return "create(\"$role\")"; + } + + public static function update(string $role): string + { + return "update(\"$role\")"; + } + + public static function delete(string $role): string + { + return "delete(\"$role\")"; + } +} diff --git a/src/Appwrite/Query.php b/src/Appwrite/Query.php new file mode 100644 index 0000000..a27235a --- /dev/null +++ b/src/Appwrite/Query.php @@ -0,0 +1,297 @@ +<?php + +namespace Appwrite; + +class Query implements \JsonSerializable +{ + protected string $method; + protected ?string $attribute; + protected ?array $values; + + public function __construct(string $method, ?string $attribute = null, $values = null) + { + $this->method = $method; + $this->attribute = $attribute; + + if (is_null($values) || is_array($values)) { + $this->values = $values; + } else { + $this->values = [$values]; + } + + } + + public function __toString(): string + { + return json_encode($this); + } + + public function jsonSerialize(): mixed + { + return array_filter([ + 'method' => $this->method, + 'attribute' => $this->attribute, + 'values' => $this->values, + ]); + } + + /** + * Equal + * + * @param string $attribute + * @param mixed $value + * @return string + */ + public static function equal(string $attribute, mixed $value): string + { + return (new Query('equal', $attribute, $value))->__toString(); + } + + /** + * Not Equal + * + * @param string $attribute + * @param mixed $value + * @return string + */ + public static function notEqual(string $attribute, mixed $value): string + { + return (new Query('notEqual', $attribute, $value))->__toString(); + } + + /** + * Less Than + * + * @param string $attribute + * @param mixed $value + * @return string + */ + public static function lessThan(string $attribute, mixed $value): string + { + return (new Query('lessThan', $attribute, $value))->__toString(); + } + + /** + * Less Than or Equal + * + * @param string $attribute + * @param mixed $value + * @return string + */ + public static function lessThanEqual(string $attribute, mixed $value): string + { + return (new Query('lessThanEqual', $attribute, $value))->__toString(); + } + + /** + * Greater Than + * + * @param string $attribute + * @param mixed $value + * @return string + */ + public static function greaterThan(string $attribute, mixed $value): string + { + return (new Query('greaterThan', $attribute, $value))->__toString(); + } + + /** + * Greater Than or Equal + * + * @param string $attribute + * @param mixed $value + * @return string + */ + public static function greaterThanEqual(string $attribute, mixed $value): string + { + return (new Query('greaterThanEqual', $attribute, $value))->__toString(); + } + + /** + * Search + * + * @param string $attribute + * @param string $value + * @return string + */ + public static function search(string $attribute, string $value): string + { + return (new Query('search', $attribute, $value))->__toString(); + } + + /** + * Is Null + * + * @param string $attribute + * @return string + */ + public static function isNull(string $attribute): string + { + return (new Query('isNull', $attribute, null))->__toString(); + } + + /** + * Is Not Null + * + * @param string $attribute + * @return string + */ + public static function isNotNull(string $attribute): string + { + return (new Query('isNotNull', $attribute, null))->__toString(); + } + + /** + * Between + * + * @param string $attribute + * @param string|int|float $start + * @param string|int|float $end + * @return string + */ + public static function between(string $attribute, mixed $start, mixed $end): string + { + return (new Query('between', $attribute, [$start, $end]))->__toString(); + } + + /** + * Starts With + * + * @param string $attribute + * @param string $value + * @return string + */ + public static function startsWith(string $attribute, string $value): string + { + return (new Query('startsWith', $attribute, $value))->__toString(); + } + + /** + * Ends With + * + * @param string $attribute + * @param string $value + * @return string + */ + public static function endsWith(string $attribute, string $value): string + { + return (new Query('endsWith', $attribute, $value))->__toString(); + } + + /** + * Select + * + * @param array<string> $attributes + * @return string + */ + public static function select(array $attributes): string + { + return (new Query('select', null, $attributes))->__toString(); + } + + /** + * Cursor After + * + * @param string $documentId + * @return string + */ + public static function cursorAfter(string $documentId): string + { + return (new Query('cursorAfter', null, $documentId))->__toString(); + } + + /** + * Cursor Before + * + * @param string $documentId + * @return string + */ + public static function cursorBefore(string $documentId): string + { + return (new Query('cursorBefore', null, $documentId))->__toString(); + } + + /** + * Order Asc + * + * @param string $attribute + * @return string + */ + public static function orderAsc(string $attribute): string + { + return (new Query('orderAsc', $attribute, null))->__toString(); + } + + /** + * Order Desc + * + * @param string $attribute + * @return string + */ + public static function orderDesc(string $attribute): string + { + return (new Query('orderDesc', $attribute, null))->__toString(); + } + + /** + * Limit + * + * @param int $limit + * @return string + */ + public static function limit(int $limit): string + { + return (new Query('limit', null, $limit))->__toString(); + } + + /** + * Offset + * + * @param int $offset + * @return string + */ + public static function offset(int $offset): string + { + return (new Query('offset', null, $offset))->__toString(); + } + + /** + * Contains + * + * @param string $attribute + * @param mixed $value + * @return string + */ + public static function contains(string $attribute, $value): string + { + return (new Query('contains', $attribute, $value))->__toString(); + } + + /** + * Or + * + * @param array<string> $queries + * @return string + */ + public static function or(array $queries): string + { + foreach ($queries as &$query) { + $query = \json_decode($query, true); + } + return (new Query('or', null, $queries))->__toString(); + } + + /** + * And + * + * @param array<string> $queries + * @return string + */ + public static function and(array $queries): string + { + foreach ($queries as &$query) { + $query = \json_decode($query, true); + } + return (new Query('and', null, $queries))->__toString(); + } +} diff --git a/src/Appwrite/Role.php b/src/Appwrite/Role.php new file mode 100644 index 0000000..2cc3ffb --- /dev/null +++ b/src/Appwrite/Role.php @@ -0,0 +1,111 @@ +<?php + +namespace Appwrite; + +/** + * Helper class to generate role strings for Permission. + */ +class Role +{ + /** + * Grants access to anyone. + * + * This includes authenticated and unauthenticated users. + * + * @return string + */ + public static function any(): string + { + return 'any'; + } + + /** + * Grants access to a specific user by user ID. + * + * You can optionally pass verified or unverified for + * `status` to target specific types of users. + * + * @param string $id + * @param string $status + * @return string + */ + public static function user(string $id, string $status = ""): string + { + if(empty($status)) { + return "user:$id"; + } + return "user:$id/$status"; + } + + /** + * Grants access to any authenticated or anonymous user. + * + * You can optionally pass verified or unverified for + * `status` to target specific types of users. + * + * @param string $status + * @return string + */ + public static function users(string $status = ""): string + { + if(empty($status)) { + return 'users'; + } + return "users/$status"; + } + + /** + * Grants access to any guest user without a session. + * + * Authenticated users don't have access to this role. + * + * @return string + */ + public static function guests(): string + { + return 'guests'; + } + + /** + * Grants access to a team by team ID. + * + * You can optionally pass a role for `role` to target + * team members with the specified role. + * + * @param string $id + * @param string $role + * @return string + */ + public static function team(string $id, string $role = ""): string + { + if(empty($role)) { + return "team:$id"; + } + return "team:$id/$role"; + } + + /** + * Grants access to a specific member of a team. + * + * When the member is removed from the team, they will + * no longer have access. + * + * @param string $id + * @return string + */ + public static function member(string $id): string + { + return "member:$id"; + } + + /** + * Grants access to a user with the specified label. + * + * @param string $name + * @return string + */ + public static function label(string $name): string + { + return "label:$name"; + } +} \ No newline at end of file diff --git a/src/Appwrite/Service.php b/src/Appwrite/Service.php new file mode 100644 index 0000000..a9a89a1 --- /dev/null +++ b/src/Appwrite/Service.php @@ -0,0 +1,13 @@ +<?php + +namespace Appwrite; + +abstract class Service +{ + protected Client $client; + + public function __construct(Client $client) + { + $this->client = $client; + } +} \ No newline at end of file diff --git a/src/Appwrite/Services/Account.php b/src/Appwrite/Services/Account.php new file mode 100644 index 0000000..bbaec76 --- /dev/null +++ b/src/Appwrite/Services/Account.php @@ -0,0 +1,1574 @@ +<?php + +namespace Appwrite\Services; + +use Appwrite\AppwriteException; +use Appwrite\Client; +use Appwrite\Service; +use Appwrite\InputFile; +use Appwrite\Enums\AuthenticatorType; +use Appwrite\Enums\AuthenticationFactor; +use Appwrite\Enums\OAuthProvider; + +class Account extends Service +{ + public function __construct(Client $client) + { + parent::__construct($client); + } + + /** + * Get account + * + * Get the currently logged in user. + * + * @throws AppwriteException + * @return array + */ + public function get(): array + { + $apiPath = str_replace( + [], + [], + '/account' + ); + + $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create account + * + * Use this endpoint to allow a new user to register a new account in your + * project. After the user registration completes successfully, you can use + * the + * [/account/verfication](https://appwrite.io/docs/references/cloud/client-web/account#createVerification) + * route to start verifying the user email address. To allow the new user to + * login to their new account, you need to create a new [account + * session](https://appwrite.io/docs/references/cloud/client-web/account#createEmailSession). + * + * @param string $userId + * @param string $email + * @param string $password + * @param ?string $name + * @throws AppwriteException + * @return array + */ + public function create(string $userId, string $email, string $password, ?string $name = null): array + { + $apiPath = str_replace( + [], + [], + '/account' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + $apiParams['email'] = $email; + $apiParams['password'] = $password; + + if (!is_null($name)) { + $apiParams['name'] = $name; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update email + * + * Update currently logged in user account email address. After changing user + * address, the user confirmation status will get reset. A new confirmation + * email is not sent automatically however you can use the send confirmation + * email endpoint again to send the confirmation email. For security measures, + * user password is required to complete this request. + * This endpoint can also be used to convert an anonymous account to a normal + * one, by passing an email address and a new password. + * + * + * @param string $email + * @param string $password + * @throws AppwriteException + * @return array + */ + public function updateEmail(string $email, string $password): array + { + $apiPath = str_replace( + [], + [], + '/account/email' + ); + + $apiParams = []; + $apiParams['email'] = $email; + $apiParams['password'] = $password; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * List Identities + * + * Get the list of identities for the currently logged in user. + * + * @param ?array $queries + * @throws AppwriteException + * @return array + */ + public function listIdentities(?array $queries = null): array + { + $apiPath = str_replace( + [], + [], + '/account/identities' + ); + + $apiParams = []; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Delete identity + * + * Delete an identity by its unique ID. + * + * @param string $identityId + * @throws AppwriteException + * @return string + */ + public function deleteIdentity(string $identityId): string + { + $apiPath = str_replace( + ['{identityId}'], + [$identityId], + '/account/identities/{identityId}' + ); + + $apiParams = []; + $apiParams['identityId'] = $identityId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create JWT + * + * Use this endpoint to create a JSON Web Token. You can use the resulting JWT + * to authenticate on behalf of the current user when working with the + * Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes + * from its creation and will be invalid if the user will logout in that time + * frame. + * + * @throws AppwriteException + * @return array + */ + public function createJWT(): array + { + $apiPath = str_replace( + [], + [], + '/account/jwts' + ); + + $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * List logs + * + * Get the list of latest security activity logs for the currently logged in + * user. Each log returns user IP address, location and date and time of log. + * + * @param ?array $queries + * @throws AppwriteException + * @return array + */ + public function listLogs(?array $queries = null): array + { + $apiPath = str_replace( + [], + [], + '/account/logs' + ); + + $apiParams = []; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update MFA + * + * Enable or disable MFA on an account. + * + * @param bool $mfa + * @throws AppwriteException + * @return array + */ + public function updateMFA(bool $mfa): array + { + $apiPath = str_replace( + [], + [], + '/account/mfa' + ); + + $apiParams = []; + $apiParams['mfa'] = $mfa; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create Authenticator + * + * Add an authenticator app to be used as an MFA factor. Verify the + * authenticator using the [verify + * authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) + * method. + * + * @param AuthenticatorType $type + * @throws AppwriteException + * @return array + */ + public function createMfaAuthenticator(AuthenticatorType $type): array + { + $apiPath = str_replace( + ['{type}'], + [$type], + '/account/mfa/authenticators/{type}' + ); + + $apiParams = []; + $apiParams['type'] = $type; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Verify Authenticator + * + * Verify an authenticator app after adding it using the [add + * authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) + * method. + * + * @param AuthenticatorType $type + * @param string $otp + * @throws AppwriteException + * @return array + */ + public function updateMfaAuthenticator(AuthenticatorType $type, string $otp): array + { + $apiPath = str_replace( + ['{type}'], + [$type], + '/account/mfa/authenticators/{type}' + ); + + $apiParams = []; + $apiParams['type'] = $type; + $apiParams['otp'] = $otp; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PUT, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Delete Authenticator + * + * Delete an authenticator for a user by ID. + * + * @param AuthenticatorType $type + * @throws AppwriteException + * @return string + */ + public function deleteMfaAuthenticator(AuthenticatorType $type): string + { + $apiPath = str_replace( + ['{type}'], + [$type], + '/account/mfa/authenticators/{type}' + ); + + $apiParams = []; + $apiParams['type'] = $type; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create MFA Challenge + * + * Begin the process of MFA verification after sign-in. Finish the flow with + * [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) + * method. + * + * @param AuthenticationFactor $factor + * @throws AppwriteException + * @return array + */ + public function createMfaChallenge(AuthenticationFactor $factor): array + { + $apiPath = str_replace( + [], + [], + '/account/mfa/challenge' + ); + + $apiParams = []; + $apiParams['factor'] = $factor; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create MFA Challenge (confirmation) + * + * Complete the MFA challenge by providing the one-time password. Finish the + * process of MFA verification by providing the one-time password. To begin + * the flow, use + * [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) + * method. + * + * @param string $challengeId + * @param string $otp + * @throws AppwriteException + * @return string + */ + public function updateMfaChallenge(string $challengeId, string $otp): string + { + $apiPath = str_replace( + [], + [], + '/account/mfa/challenge' + ); + + $apiParams = []; + $apiParams['challengeId'] = $challengeId; + $apiParams['otp'] = $otp; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PUT, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * List Factors + * + * List the factors available on the account to be used as a MFA challange. + * + * @throws AppwriteException + * @return array + */ + public function listMfaFactors(): array + { + $apiPath = str_replace( + [], + [], + '/account/mfa/factors' + ); + + $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get MFA Recovery Codes + * + * Get recovery codes that can be used as backup for MFA flow. Before getting + * codes, they must be generated using + * [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) + * method. An OTP challenge is required to read recovery codes. + * + * @throws AppwriteException + * @return array + */ + public function getMfaRecoveryCodes(): array + { + $apiPath = str_replace( + [], + [], + '/account/mfa/recovery-codes' + ); + + $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create MFA Recovery Codes + * + * Generate recovery codes as backup for MFA flow. It's recommended to + * generate and show then immediately after user successfully adds their + * authehticator. Recovery codes can be used as a MFA verification type in + * [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) + * method. + * + * @throws AppwriteException + * @return array + */ + public function createMfaRecoveryCodes(): array + { + $apiPath = str_replace( + [], + [], + '/account/mfa/recovery-codes' + ); + + $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Regenerate MFA Recovery Codes + * + * Regenerate recovery codes that can be used as backup for MFA flow. Before + * regenerating codes, they must be first generated using + * [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) + * method. An OTP challenge is required to regenreate recovery codes. + * + * @throws AppwriteException + * @return array + */ + public function updateMfaRecoveryCodes(): array + { + $apiPath = str_replace( + [], + [], + '/account/mfa/recovery-codes' + ); + + $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update name + * + * Update currently logged in user account name. + * + * @param string $name + * @throws AppwriteException + * @return array + */ + public function updateName(string $name): array + { + $apiPath = str_replace( + [], + [], + '/account/name' + ); + + $apiParams = []; + $apiParams['name'] = $name; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update password + * + * Update currently logged in user password. For validation, user is required + * to pass in the new password, and the old password. For users created with + * OAuth, Team Invites and Magic URL, oldPassword is optional. + * + * @param string $password + * @param ?string $oldPassword + * @throws AppwriteException + * @return array + */ + public function updatePassword(string $password, ?string $oldPassword = null): array + { + $apiPath = str_replace( + [], + [], + '/account/password' + ); + + $apiParams = []; + $apiParams['password'] = $password; + + if (!is_null($oldPassword)) { + $apiParams['oldPassword'] = $oldPassword; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update phone + * + * Update the currently logged in user's phone number. After updating the + * phone number, the phone verification status will be reset. A confirmation + * SMS is not sent automatically, however you can use the [POST + * /account/verification/phone](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneVerification) + * endpoint to send a confirmation SMS. + * + * @param string $phone + * @param string $password + * @throws AppwriteException + * @return array + */ + public function updatePhone(string $phone, string $password): array + { + $apiPath = str_replace( + [], + [], + '/account/phone' + ); + + $apiParams = []; + $apiParams['phone'] = $phone; + $apiParams['password'] = $password; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get account preferences + * + * Get the preferences as a key-value object for the currently logged in user. + * + * @throws AppwriteException + * @return array + */ + public function getPrefs(): array + { + $apiPath = str_replace( + [], + [], + '/account/prefs' + ); + + $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update preferences + * + * Update currently logged in user account preferences. The object you pass is + * stored as is, and replaces any previous value. The maximum allowed prefs + * size is 64kB and throws error if exceeded. + * + * @param array $prefs + * @throws AppwriteException + * @return array + */ + public function updatePrefs(array $prefs): array + { + $apiPath = str_replace( + [], + [], + '/account/prefs' + ); + + $apiParams = []; + $apiParams['prefs'] = $prefs; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create password recovery + * + * Sends the user an email with a temporary secret key for password reset. + * When the user clicks the confirmation link he is redirected back to your + * app password reset URL with the secret key and email address values + * attached to the URL query string. Use the query string params to submit a + * request to the [PUT + * /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#updateRecovery) + * endpoint to complete the process. The verification link sent to the user's + * email address is valid for 1 hour. + * + * @param string $email + * @param string $url + * @throws AppwriteException + * @return array + */ + public function createRecovery(string $email, string $url): array + { + $apiPath = str_replace( + [], + [], + '/account/recovery' + ); + + $apiParams = []; + $apiParams['email'] = $email; + $apiParams['url'] = $url; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create password recovery (confirmation) + * + * Use this endpoint to complete the user account password reset. Both the + * **userId** and **secret** arguments will be passed as query parameters to + * the redirect URL you have provided when sending your request to the [POST + * /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#createRecovery) + * endpoint. + * + * Please note that in order to avoid a [Redirect + * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) + * the only valid redirect URLs are the ones from domains you have set when + * adding your platforms in the console interface. + * + * @param string $userId + * @param string $secret + * @param string $password + * @throws AppwriteException + * @return array + */ + public function updateRecovery(string $userId, string $secret, string $password): array + { + $apiPath = str_replace( + [], + [], + '/account/recovery' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + $apiParams['secret'] = $secret; + $apiParams['password'] = $password; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PUT, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * List sessions + * + * Get the list of active sessions across different devices for the currently + * logged in user. + * + * @throws AppwriteException + * @return array + */ + public function listSessions(): array + { + $apiPath = str_replace( + [], + [], + '/account/sessions' + ); + + $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Delete sessions + * + * Delete all sessions from the user account and remove any sessions cookies + * from the end client. + * + * @throws AppwriteException + * @return string + */ + public function deleteSessions(): string + { + $apiPath = str_replace( + [], + [], + '/account/sessions' + ); + + $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create anonymous session + * + * Use this endpoint to allow a new user to register an anonymous account in + * your project. This route will also create a new session for the user. To + * allow the new user to convert an anonymous account to a normal account, you + * need to update its [email and + * password](https://appwrite.io/docs/references/cloud/client-web/account#updateEmail) + * or create an [OAuth2 + * session](https://appwrite.io/docs/references/cloud/client-web/account#CreateOAuth2Session). + * + * @throws AppwriteException + * @return array + */ + public function createAnonymousSession(): array + { + $apiPath = str_replace( + [], + [], + '/account/sessions/anonymous' + ); + + $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create email password session + * + * Allow the user to login into their account by providing a valid email and + * password combination. This route will create a new session for the user. + * + * 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). + * + * @param string $email + * @param string $password + * @throws AppwriteException + * @return array + */ + public function createEmailPasswordSession(string $email, string $password): array + { + $apiPath = str_replace( + [], + [], + '/account/sessions/email' + ); + + $apiParams = []; + $apiParams['email'] = $email; + $apiParams['password'] = $password; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update magic URL session + * + * Use this endpoint to create a session from token. Provide the **userId** + * and **secret** parameters from the successful response of authentication + * flows initiated by token creation. For example, magic URL and phone login. + * + * @param string $userId + * @param string $secret + * @throws AppwriteException + * @return array + */ + public function updateMagicURLSession(string $userId, string $secret): array + { + $apiPath = str_replace( + [], + [], + '/account/sessions/magic-url' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + $apiParams['secret'] = $secret; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PUT, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update phone session + * + * Use this endpoint to create a session from token. Provide the **userId** + * and **secret** parameters from the successful response of authentication + * flows initiated by token creation. For example, magic URL and phone login. + * + * @param string $userId + * @param string $secret + * @throws AppwriteException + * @return array + */ + public function updatePhoneSession(string $userId, string $secret): array + { + $apiPath = str_replace( + [], + [], + '/account/sessions/phone' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + $apiParams['secret'] = $secret; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PUT, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create session + * + * Use this endpoint to create a session from token. Provide the **userId** + * and **secret** parameters from the successful response of authentication + * flows initiated by token creation. For example, magic URL and phone login. + * + * @param string $userId + * @param string $secret + * @throws AppwriteException + * @return array + */ + public function createSession(string $userId, string $secret): array + { + $apiPath = str_replace( + [], + [], + '/account/sessions/token' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + $apiParams['secret'] = $secret; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get session + * + * Use this endpoint to get a logged in user's session using a Session ID. + * Inputting 'current' will return the current session being used. + * + * @param string $sessionId + * @throws AppwriteException + * @return array + */ + public function getSession(string $sessionId): array + { + $apiPath = str_replace( + ['{sessionId}'], + [$sessionId], + '/account/sessions/{sessionId}' + ); + + $apiParams = []; + $apiParams['sessionId'] = $sessionId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update session + * + * Use this endpoint to extend a session's length. Extending a session is + * useful when session expiry is short. If the session was created using an + * OAuth provider, this endpoint refreshes the access token from the provider. + * + * @param string $sessionId + * @throws AppwriteException + * @return array + */ + public function updateSession(string $sessionId): array + { + $apiPath = str_replace( + ['{sessionId}'], + [$sessionId], + '/account/sessions/{sessionId}' + ); + + $apiParams = []; + $apiParams['sessionId'] = $sessionId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Delete session + * + * Logout the user. Use 'current' as the session ID to logout on this device, + * use a session ID to logout on another device. If you're looking to logout + * the user on all devices, use [Delete + * Sessions](https://appwrite.io/docs/references/cloud/client-web/account#deleteSessions) + * instead. + * + * @param string $sessionId + * @throws AppwriteException + * @return string + */ + public function deleteSession(string $sessionId): string + { + $apiPath = str_replace( + ['{sessionId}'], + [$sessionId], + '/account/sessions/{sessionId}' + ); + + $apiParams = []; + $apiParams['sessionId'] = $sessionId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update status + * + * Block the currently logged in user account. Behind the scene, the user + * record is not deleted but permanently blocked from any access. To + * completely delete a user, use the Users API instead. + * + * @throws AppwriteException + * @return array + */ + public function updateStatus(): array + { + $apiPath = str_replace( + [], + [], + '/account/status' + ); + + $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create email token (OTP) + * + * Sends the user an email with a secret key for creating a session. If the + * provided user ID has not be registered, a new user will be created. Use the + * returned user ID and secret and submit a request to the [POST + * /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) + * endpoint to complete the login process. The secret sent to the user's email + * is valid for 15 minutes. + * + * 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). + * + * @param string $userId + * @param string $email + * @param ?bool $phrase + * @throws AppwriteException + * @return array + */ + public function createEmailToken(string $userId, string $email, ?bool $phrase = null): array + { + $apiPath = str_replace( + [], + [], + '/account/tokens/email' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + $apiParams['email'] = $email; + + if (!is_null($phrase)) { + $apiParams['phrase'] = $phrase; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create magic URL token + * + * Sends the user an email with a secret key for creating a session. If the + * provided user ID has not been registered, a new user will be created. When + * the user clicks the link in the email, the user is redirected back to the + * URL you provided with the secret key and userId values attached to the URL + * query string. Use the query string parameters to submit a request to the + * [POST + * /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) + * endpoint to complete the login process. The link sent to the user's email + * address is valid for 1 hour. If you are on a mobile device you can leave + * the URL parameter empty, so that the login completion will be handled by + * your Appwrite instance by default. + * + * 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). + * + * + * @param string $userId + * @param string $email + * @param ?string $url + * @param ?bool $phrase + * @throws AppwriteException + * @return array + */ + public function createMagicURLToken(string $userId, string $email, ?string $url = null, ?bool $phrase = null): array + { + $apiPath = str_replace( + [], + [], + '/account/tokens/magic-url' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + $apiParams['email'] = $email; + + if (!is_null($url)) { + $apiParams['url'] = $url; + } + + if (!is_null($phrase)) { + $apiParams['phrase'] = $phrase; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create OAuth2 token + * + * Allow the user to login to their account using the OAuth2 provider of their + * choice. Each OAuth2 provider should be enabled from the Appwrite console + * first. Use the success and failure arguments to provide a redirect URL's + * back to your app when login is completed. + * + * If authentication succeeds, `userId` and `secret` of a token will be + * appended to the success URL as query parameters. These can be used to + * create a new session using the [Create + * session](https://appwrite.io/docs/references/cloud/client-web/account#createSession) + * endpoint. + * + * 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). + * + * @param OAuthProvider $provider + * @param ?string $success + * @param ?string $failure + * @param ?array $scopes + * @throws AppwriteException + * @return string + */ + public function createOAuth2Token(OAuthProvider $provider, ?string $success = null, ?string $failure = null, ?array $scopes = null): string + { + $apiPath = str_replace( + ['{provider}'], + [$provider], + '/account/tokens/oauth2/{provider}' + ); + + $apiParams = []; + $apiParams['provider'] = $provider; + + if (!is_null($success)) { + $apiParams['success'] = $success; + } + + if (!is_null($failure)) { + $apiParams['failure'] = $failure; + } + + if (!is_null($scopes)) { + $apiParams['scopes'] = $scopes; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams, 'location' + ); + } + + /** + * Create phone token + * + * Sends the user an SMS with a secret key for creating a session. If the + * provided user ID has not be registered, a new user will be created. Use the + * returned user ID and secret and submit a request to the [POST + * /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) + * endpoint to complete the login process. The secret sent to the user's phone + * is valid for 15 minutes. + * + * 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). + * + * @param string $userId + * @param string $phone + * @throws AppwriteException + * @return array + */ + public function createPhoneToken(string $userId, string $phone): array + { + $apiPath = str_replace( + [], + [], + '/account/tokens/phone' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + $apiParams['phone'] = $phone; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create email verification + * + * Use this endpoint to send a verification message to your user email address + * to confirm they are the valid owners of that address. Both the **userId** + * and **secret** arguments will be passed as query parameters to the URL you + * have provided to be attached to the verification email. The provided URL + * should redirect the user back to your app and allow you to complete the + * verification process by verifying both the **userId** and **secret** + * parameters. Learn more about how to [complete the verification + * process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification). + * The verification link sent to the user's email address is valid for 7 days. + * + * Please note that in order to avoid a [Redirect + * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), + * the only valid redirect URLs are the ones from domains you have set when + * adding your platforms in the console interface. + * + * + * @param string $url + * @throws AppwriteException + * @return array + */ + public function createVerification(string $url): array + { + $apiPath = str_replace( + [], + [], + '/account/verification' + ); + + $apiParams = []; + $apiParams['url'] = $url; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create email verification (confirmation) + * + * Use this endpoint to complete the user email verification process. Use both + * the **userId** and **secret** parameters that were attached to your app URL + * to verify the user email ownership. If confirmed this route will return a + * 200 status code. + * + * @param string $userId + * @param string $secret + * @throws AppwriteException + * @return array + */ + public function updateVerification(string $userId, string $secret): array + { + $apiPath = str_replace( + [], + [], + '/account/verification' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + $apiParams['secret'] = $secret; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PUT, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create phone verification + * + * 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 + * using the + * [accountUpdatePhone](https://appwrite.io/docs/references/cloud/client-web/account#updatePhone) + * endpoint. Learn more about how to [complete the verification + * process](https://appwrite.io/docs/references/cloud/client-web/account#updatePhoneVerification). + * The verification code sent to the user's phone number is valid for 15 + * minutes. + * + * @throws AppwriteException + * @return array + */ + public function createPhoneVerification(): array + { + $apiPath = str_replace( + [], + [], + '/account/verification/phone' + ); + + $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update phone verification (confirmation) + * + * Use this endpoint to complete the user phone verification process. Use the + * **userId** and **secret** that were sent to your user's phone number to + * verify the user email ownership. If confirmed this route will return a 200 + * status code. + * + * @param string $userId + * @param string $secret + * @throws AppwriteException + * @return array + */ + public function updatePhoneVerification(string $userId, string $secret): array + { + $apiPath = str_replace( + [], + [], + '/account/verification/phone' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + $apiParams['secret'] = $secret; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PUT, + $apiPath, + $apiHeaders, + $apiParams + ); + } +} \ No newline at end of file diff --git a/src/Appwrite/Services/Avatars.php b/src/Appwrite/Services/Avatars.php new file mode 100644 index 0000000..73052e5 --- /dev/null +++ b/src/Appwrite/Services/Avatars.php @@ -0,0 +1,380 @@ +<?php + +namespace Appwrite\Services; + +use Appwrite\AppwriteException; +use Appwrite\Client; +use Appwrite\Service; +use Appwrite\InputFile; +use Appwrite\Enums\Browser; +use Appwrite\Enums\CreditCard; +use Appwrite\Enums\Flag; + +class Avatars extends Service +{ + public function __construct(Client $client) + { + parent::__construct($client); + } + + /** + * Get browser icon + * + * You can use this endpoint to show different browser icons to your users. + * The code argument receives the browser code as it appears in your user [GET + * /account/sessions](https://appwrite.io/docs/references/cloud/client-web/account#getSessions) + * endpoint. Use width, height and quality arguments to change the output + * settings. + * + * When one dimension is specified and the other is 0, the image is scaled + * with preserved aspect ratio. If both dimensions are 0, the API provides an + * image at source quality. If dimensions are not specified, the default size + * of image returned is 100x100px. + * + * @param Browser $code + * @param ?int $width + * @param ?int $height + * @param ?int $quality + * @throws AppwriteException + * @return string + */ + public function getBrowser(Browser $code, ?int $width = null, ?int $height = null, ?int $quality = null): string + { + $apiPath = str_replace( + ['{code}'], + [$code], + '/avatars/browsers/{code}' + ); + + $apiParams = []; + $apiParams['code'] = $code; + + if (!is_null($width)) { + $apiParams['width'] = $width; + } + + if (!is_null($height)) { + $apiParams['height'] = $height; + } + + if (!is_null($quality)) { + $apiParams['quality'] = $quality; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get credit card icon + * + * The credit card endpoint will return you the icon of the credit card + * provider you need. Use width, height and quality arguments to change the + * output settings. + * + * When one dimension is specified and the other is 0, the image is scaled + * with preserved aspect ratio. If both dimensions are 0, the API provides an + * image at source quality. If dimensions are not specified, the default size + * of image returned is 100x100px. + * + * + * @param CreditCard $code + * @param ?int $width + * @param ?int $height + * @param ?int $quality + * @throws AppwriteException + * @return string + */ + public function getCreditCard(CreditCard $code, ?int $width = null, ?int $height = null, ?int $quality = null): string + { + $apiPath = str_replace( + ['{code}'], + [$code], + '/avatars/credit-cards/{code}' + ); + + $apiParams = []; + $apiParams['code'] = $code; + + if (!is_null($width)) { + $apiParams['width'] = $width; + } + + if (!is_null($height)) { + $apiParams['height'] = $height; + } + + if (!is_null($quality)) { + $apiParams['quality'] = $quality; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get favicon + * + * Use this endpoint to fetch the favorite icon (AKA favicon) of any remote + * website URL. + * + * This endpoint does not follow HTTP redirects. + * + * @param string $url + * @throws AppwriteException + * @return string + */ + public function getFavicon(string $url): string + { + $apiPath = str_replace( + [], + [], + '/avatars/favicon' + ); + + $apiParams = []; + $apiParams['url'] = $url; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get country flag + * + * You can use this endpoint to show different country flags icons to your + * users. The code argument receives the 2 letter country code. Use width, + * height and quality arguments to change the output settings. Country codes + * follow the [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) standard. + * + * When one dimension is specified and the other is 0, the image is scaled + * with preserved aspect ratio. If both dimensions are 0, the API provides an + * image at source quality. If dimensions are not specified, the default size + * of image returned is 100x100px. + * + * + * @param Flag $code + * @param ?int $width + * @param ?int $height + * @param ?int $quality + * @throws AppwriteException + * @return string + */ + public function getFlag(Flag $code, ?int $width = null, ?int $height = null, ?int $quality = null): string + { + $apiPath = str_replace( + ['{code}'], + [$code], + '/avatars/flags/{code}' + ); + + $apiParams = []; + $apiParams['code'] = $code; + + if (!is_null($width)) { + $apiParams['width'] = $width; + } + + if (!is_null($height)) { + $apiParams['height'] = $height; + } + + if (!is_null($quality)) { + $apiParams['quality'] = $quality; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get image from URL + * + * Use this endpoint to fetch a remote image URL and crop it to any image size + * you want. This endpoint is very useful if you need to crop and display + * remote images in your app or in case you want to make sure a 3rd party + * image is properly served using a TLS protocol. + * + * When one dimension is specified and the other is 0, the image is scaled + * with preserved aspect ratio. If both dimensions are 0, the API provides an + * image at source quality. If dimensions are not specified, the default size + * of image returned is 400x400px. + * + * This endpoint does not follow HTTP redirects. + * + * @param string $url + * @param ?int $width + * @param ?int $height + * @throws AppwriteException + * @return string + */ + public function getImage(string $url, ?int $width = null, ?int $height = null): string + { + $apiPath = str_replace( + [], + [], + '/avatars/image' + ); + + $apiParams = []; + $apiParams['url'] = $url; + + if (!is_null($width)) { + $apiParams['width'] = $width; + } + + if (!is_null($height)) { + $apiParams['height'] = $height; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get user initials + * + * Use this endpoint to show your user initials avatar icon on your website or + * app. By default, this route will try to print your logged-in user name or + * email initials. You can also overwrite the user name if you pass the 'name' + * parameter. If no name is given and no user is logged, an empty avatar will + * be returned. + * + * You can use the color and background params to change the avatar colors. By + * default, a random theme will be selected. The random theme will persist for + * the user's initials when reloading the same theme will always return for + * the same initials. + * + * When one dimension is specified and the other is 0, the image is scaled + * with preserved aspect ratio. If both dimensions are 0, the API provides an + * image at source quality. If dimensions are not specified, the default size + * of image returned is 100x100px. + * + * + * @param ?string $name + * @param ?int $width + * @param ?int $height + * @param ?string $background + * @throws AppwriteException + * @return string + */ + public function getInitials(?string $name = null, ?int $width = null, ?int $height = null, ?string $background = null): string + { + $apiPath = str_replace( + [], + [], + '/avatars/initials' + ); + + $apiParams = []; + + if (!is_null($name)) { + $apiParams['name'] = $name; + } + + if (!is_null($width)) { + $apiParams['width'] = $width; + } + + if (!is_null($height)) { + $apiParams['height'] = $height; + } + + if (!is_null($background)) { + $apiParams['background'] = $background; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get QR code + * + * 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. + * + * + * @param string $text + * @param ?int $size + * @param ?int $margin + * @param ?bool $download + * @throws AppwriteException + * @return string + */ + public function getQR(string $text, ?int $size = null, ?int $margin = null, ?bool $download = null): string + { + $apiPath = str_replace( + [], + [], + '/avatars/qr' + ); + + $apiParams = []; + $apiParams['text'] = $text; + + if (!is_null($size)) { + $apiParams['size'] = $size; + } + + if (!is_null($margin)) { + $apiParams['margin'] = $margin; + } + + if (!is_null($download)) { + $apiParams['download'] = $download; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } +} \ No newline at end of file diff --git a/src/Appwrite/Services/Databases.php b/src/Appwrite/Services/Databases.php new file mode 100644 index 0000000..a0ac3a4 --- /dev/null +++ b/src/Appwrite/Services/Databases.php @@ -0,0 +1,1822 @@ +<?php + +namespace Appwrite\Services; + +use Appwrite\AppwriteException; +use Appwrite\Client; +use Appwrite\Service; +use Appwrite\InputFile; +use Appwrite\Enums\RelationshipType; +use Appwrite\Enums\RelationMutate; +use Appwrite\Enums\IndexType; + +class Databases extends Service +{ + public function __construct(Client $client) + { + parent::__construct($client); + } + + /** + * List databases + * + * Get a list of all databases from the current Appwrite project. You can use + * the search parameter to filter your results. + * + * @param ?array $queries + * @param ?string $search + * @throws AppwriteException + * @return array + */ + public function list(?array $queries = null, ?string $search = null): array + { + $apiPath = str_replace( + [], + [], + '/databases' + ); + + $apiParams = []; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + if (!is_null($search)) { + $apiParams['search'] = $search; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create database + * + * Create a new Database. + * + * + * @param string $databaseId + * @param string $name + * @param ?bool $enabled + * @throws AppwriteException + * @return array + */ + public function create(string $databaseId, string $name, ?bool $enabled = null): array + { + $apiPath = str_replace( + [], + [], + '/databases' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['name'] = $name; + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get database + * + * Get a database by its unique ID. This endpoint response returns a JSON + * object with the database metadata. + * + * @param string $databaseId + * @throws AppwriteException + * @return array + */ + public function get(string $databaseId): array + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/databases/{databaseId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update database + * + * Update a database by its unique ID. + * + * @param string $databaseId + * @param string $name + * @param ?bool $enabled + * @throws AppwriteException + * @return array + */ + public function update(string $databaseId, string $name, ?bool $enabled = null): array + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/databases/{databaseId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['name'] = $name; + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PUT, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Delete database + * + * Delete a database by its unique ID. Only API keys with with databases.write + * scope can delete a database. + * + * @param string $databaseId + * @throws AppwriteException + * @return string + */ + public function delete(string $databaseId): string + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/databases/{databaseId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * List collections + * + * Get a list of all collections that belong to the provided databaseId. You + * can use the search parameter to filter your results. + * + * @param string $databaseId + * @param ?array $queries + * @param ?string $search + * @throws AppwriteException + * @return array + */ + public function listCollections(string $databaseId, ?array $queries = null, ?string $search = null): array + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/databases/{databaseId}/collections' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + if (!is_null($search)) { + $apiParams['search'] = $search; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create collection + * + * Create a new Collection. Before using this route, you should create a new + * database resource using either a [server + * integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) + * API or directly from your database console. + * + * @param string $databaseId + * @param string $collectionId + * @param string $name + * @param ?array $permissions + * @param ?bool $documentSecurity + * @param ?bool $enabled + * @throws AppwriteException + * @return array + */ + public function createCollection(string $databaseId, string $collectionId, string $name, ?array $permissions = null, ?bool $documentSecurity = null, ?bool $enabled = null): array + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/databases/{databaseId}/collections' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['name'] = $name; + + if (!is_null($permissions)) { + $apiParams['permissions'] = $permissions; + } + + if (!is_null($documentSecurity)) { + $apiParams['documentSecurity'] = $documentSecurity; + } + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get collection + * + * Get a collection by its unique ID. This endpoint response returns a JSON + * object with the collection metadata. + * + * @param string $databaseId + * @param string $collectionId + * @throws AppwriteException + * @return array + */ + public function getCollection(string $databaseId, string $collectionId): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/databases/{databaseId}/collections/{collectionId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update collection + * + * Update a collection by its unique ID. + * + * @param string $databaseId + * @param string $collectionId + * @param string $name + * @param ?array $permissions + * @param ?bool $documentSecurity + * @param ?bool $enabled + * @throws AppwriteException + * @return array + */ + public function updateCollection(string $databaseId, string $collectionId, string $name, ?array $permissions = null, ?bool $documentSecurity = null, ?bool $enabled = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/databases/{databaseId}/collections/{collectionId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['name'] = $name; + + if (!is_null($permissions)) { + $apiParams['permissions'] = $permissions; + } + + if (!is_null($documentSecurity)) { + $apiParams['documentSecurity'] = $documentSecurity; + } + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PUT, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Delete collection + * + * Delete a collection by its unique ID. Only users with write permissions + * have access to delete this resource. + * + * @param string $databaseId + * @param string $collectionId + * @throws AppwriteException + * @return string + */ + public function deleteCollection(string $databaseId, string $collectionId): string + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/databases/{databaseId}/collections/{collectionId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * List attributes + * + * List attributes in the collection. + * + * @param string $databaseId + * @param string $collectionId + * @param ?array $queries + * @throws AppwriteException + * @return array + */ + public function listAttributes(string $databaseId, string $collectionId, ?array $queries = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/databases/{databaseId}/collections/{collectionId}/attributes' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create boolean attribute + * + * Create a boolean attribute. + * + * + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @param bool $required + * @param ?bool $xdefault + * @param ?bool $xarray + * @throws AppwriteException + * @return array + */ + public function createBooleanAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?bool $xdefault = null, ?bool $xarray = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/databases/{databaseId}/collections/{collectionId}/attributes/boolean' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + + if (!is_null($xdefault)) { + $apiParams['default'] = $xdefault; + } + + if (!is_null($xarray)) { + $apiParams['array'] = $xarray; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update boolean attribute + * + * Update a boolean attribute. Changing the `default` value will not update + * already existing documents. + * + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @param bool $required + * @param ?bool $xdefault + * @throws AppwriteException + * @return array + */ + public function updateBooleanAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?bool $xdefault): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{key}'], + [$databaseId, $collectionId, $key], + '/databases/{databaseId}/collections/{collectionId}/attributes/boolean/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create datetime attribute + * + * Create a date time attribute according to the ISO 8601 standard. + * + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @param bool $required + * @param ?string $xdefault + * @param ?bool $xarray + * @throws AppwriteException + * @return array + */ + public function createDatetimeAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/databases/{databaseId}/collections/{collectionId}/attributes/datetime' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + + if (!is_null($xdefault)) { + $apiParams['default'] = $xdefault; + } + + if (!is_null($xarray)) { + $apiParams['array'] = $xarray; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update dateTime attribute + * + * Update a date time attribute. Changing the `default` value will not update + * already existing documents. + * + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @param bool $required + * @param ?string $xdefault + * @throws AppwriteException + * @return array + */ + public function updateDatetimeAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{key}'], + [$databaseId, $collectionId, $key], + '/databases/{databaseId}/collections/{collectionId}/attributes/datetime/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create email attribute + * + * Create an email attribute. + * + * + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @param bool $required + * @param ?string $xdefault + * @param ?bool $xarray + * @throws AppwriteException + * @return array + */ + public function createEmailAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/databases/{databaseId}/collections/{collectionId}/attributes/email' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + + if (!is_null($xdefault)) { + $apiParams['default'] = $xdefault; + } + + if (!is_null($xarray)) { + $apiParams['array'] = $xarray; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update email attribute + * + * Update an email attribute. Changing the `default` value will not update + * already existing documents. + * + * + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @param bool $required + * @param ?string $xdefault + * @throws AppwriteException + * @return array + */ + public function updateEmailAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{key}'], + [$databaseId, $collectionId, $key], + '/databases/{databaseId}/collections/{collectionId}/attributes/email/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create enum attribute + * + * Create an enumeration attribute. The `elements` param acts as a white-list + * of accepted values for this attribute. + * + * + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @param array $elements + * @param bool $required + * @param ?string $xdefault + * @param ?bool $xarray + * @throws AppwriteException + * @return array + */ + public function createEnumAttribute(string $databaseId, string $collectionId, string $key, array $elements, bool $required, ?string $xdefault = null, ?bool $xarray = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/databases/{databaseId}/collections/{collectionId}/attributes/enum' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['elements'] = $elements; + $apiParams['required'] = $required; + + if (!is_null($xdefault)) { + $apiParams['default'] = $xdefault; + } + + if (!is_null($xarray)) { + $apiParams['array'] = $xarray; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update enum attribute + * + * Update an enum attribute. Changing the `default` value will not update + * already existing documents. + * + * + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @param array $elements + * @param bool $required + * @param ?string $xdefault + * @throws AppwriteException + * @return array + */ + public function updateEnumAttribute(string $databaseId, string $collectionId, string $key, array $elements, bool $required, ?string $xdefault): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{key}'], + [$databaseId, $collectionId, $key], + '/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['elements'] = $elements; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create float attribute + * + * Create a float attribute. Optionally, minimum and maximum values can be + * provided. + * + * + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @param bool $required + * @param ?float $min + * @param ?float $max + * @param ?float $xdefault + * @param ?bool $xarray + * @throws AppwriteException + * @return array + */ + public function createFloatAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?float $min = null, ?float $max = null, ?float $xdefault = null, ?bool $xarray = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/databases/{databaseId}/collections/{collectionId}/attributes/float' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + + if (!is_null($min)) { + $apiParams['min'] = $min; + } + + if (!is_null($max)) { + $apiParams['max'] = $max; + } + + if (!is_null($xdefault)) { + $apiParams['default'] = $xdefault; + } + + if (!is_null($xarray)) { + $apiParams['array'] = $xarray; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update float attribute + * + * Update a float attribute. Changing the `default` value will not update + * already existing documents. + * + * + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @param bool $required + * @param float $min + * @param float $max + * @param ?float $xdefault + * @throws AppwriteException + * @return array + */ + public function updateFloatAttribute(string $databaseId, string $collectionId, string $key, bool $required, float $min, float $max, ?float $xdefault): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{key}'], + [$databaseId, $collectionId, $key], + '/databases/{databaseId}/collections/{collectionId}/attributes/float/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['min'] = $min; + $apiParams['max'] = $max; + $apiParams['default'] = $xdefault; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create integer attribute + * + * Create an integer attribute. Optionally, minimum and maximum values can be + * provided. + * + * + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @param bool $required + * @param ?int $min + * @param ?int $max + * @param ?int $xdefault + * @param ?bool $xarray + * @throws AppwriteException + * @return array + */ + public function createIntegerAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?int $min = null, ?int $max = null, ?int $xdefault = null, ?bool $xarray = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/databases/{databaseId}/collections/{collectionId}/attributes/integer' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + + if (!is_null($min)) { + $apiParams['min'] = $min; + } + + if (!is_null($max)) { + $apiParams['max'] = $max; + } + + if (!is_null($xdefault)) { + $apiParams['default'] = $xdefault; + } + + if (!is_null($xarray)) { + $apiParams['array'] = $xarray; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update integer attribute + * + * Update an integer attribute. Changing the `default` value will not update + * already existing documents. + * + * + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @param bool $required + * @param int $min + * @param int $max + * @param ?int $xdefault + * @throws AppwriteException + * @return array + */ + public function updateIntegerAttribute(string $databaseId, string $collectionId, string $key, bool $required, int $min, int $max, ?int $xdefault): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{key}'], + [$databaseId, $collectionId, $key], + '/databases/{databaseId}/collections/{collectionId}/attributes/integer/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['min'] = $min; + $apiParams['max'] = $max; + $apiParams['default'] = $xdefault; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create IP address attribute + * + * Create IP address attribute. + * + * + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @param bool $required + * @param ?string $xdefault + * @param ?bool $xarray + * @throws AppwriteException + * @return array + */ + public function createIpAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/databases/{databaseId}/collections/{collectionId}/attributes/ip' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + + if (!is_null($xdefault)) { + $apiParams['default'] = $xdefault; + } + + if (!is_null($xarray)) { + $apiParams['array'] = $xarray; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update IP address attribute + * + * Update an ip attribute. Changing the `default` value will not update + * already existing documents. + * + * + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @param bool $required + * @param ?string $xdefault + * @throws AppwriteException + * @return array + */ + public function updateIpAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{key}'], + [$databaseId, $collectionId, $key], + '/databases/{databaseId}/collections/{collectionId}/attributes/ip/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create relationship attribute + * + * Create relationship attribute. [Learn more about relationship + * attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). + * + * + * @param string $databaseId + * @param string $collectionId + * @param string $relatedCollectionId + * @param RelationshipType $type + * @param ?bool $twoWay + * @param ?string $key + * @param ?string $twoWayKey + * @param ?RelationMutate $onDelete + * @throws AppwriteException + * @return array + */ + public function createRelationshipAttribute(string $databaseId, string $collectionId, string $relatedCollectionId, RelationshipType $type, ?bool $twoWay = null, ?string $key = null, ?string $twoWayKey = null, ?RelationMutate $onDelete = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/databases/{databaseId}/collections/{collectionId}/attributes/relationship' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['relatedCollectionId'] = $relatedCollectionId; + $apiParams['type'] = $type; + + if (!is_null($twoWay)) { + $apiParams['twoWay'] = $twoWay; + } + + if (!is_null($key)) { + $apiParams['key'] = $key; + } + + if (!is_null($twoWayKey)) { + $apiParams['twoWayKey'] = $twoWayKey; + } + + if (!is_null($onDelete)) { + $apiParams['onDelete'] = $onDelete; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create string attribute + * + * Create a string attribute. + * + * + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @param int $size + * @param bool $required + * @param ?string $xdefault + * @param ?bool $xarray + * @param ?bool $encrypt + * @throws AppwriteException + * @return array + */ + public function createStringAttribute(string $databaseId, string $collectionId, string $key, int $size, bool $required, ?string $xdefault = null, ?bool $xarray = null, ?bool $encrypt = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/databases/{databaseId}/collections/{collectionId}/attributes/string' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['size'] = $size; + $apiParams['required'] = $required; + + if (!is_null($xdefault)) { + $apiParams['default'] = $xdefault; + } + + if (!is_null($xarray)) { + $apiParams['array'] = $xarray; + } + + if (!is_null($encrypt)) { + $apiParams['encrypt'] = $encrypt; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update string attribute + * + * Update a string attribute. Changing the `default` value will not update + * already existing documents. + * + * + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @param bool $required + * @param ?string $xdefault + * @throws AppwriteException + * @return array + */ + public function updateStringAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{key}'], + [$databaseId, $collectionId, $key], + '/databases/{databaseId}/collections/{collectionId}/attributes/string/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create URL attribute + * + * Create a URL attribute. + * + * + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @param bool $required + * @param ?string $xdefault + * @param ?bool $xarray + * @throws AppwriteException + * @return array + */ + public function createUrlAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/databases/{databaseId}/collections/{collectionId}/attributes/url' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + + if (!is_null($xdefault)) { + $apiParams['default'] = $xdefault; + } + + if (!is_null($xarray)) { + $apiParams['array'] = $xarray; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update URL attribute + * + * Update an url attribute. Changing the `default` value will not update + * already existing documents. + * + * + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @param bool $required + * @param ?string $xdefault + * @throws AppwriteException + * @return array + */ + public function updateUrlAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{key}'], + [$databaseId, $collectionId, $key], + '/databases/{databaseId}/collections/{collectionId}/attributes/url/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get attribute + * + * Get attribute by ID. + * + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @throws AppwriteException + * @return array + */ + public function getAttribute(string $databaseId, string $collectionId, string $key): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{key}'], + [$databaseId, $collectionId, $key], + '/databases/{databaseId}/collections/{collectionId}/attributes/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Delete attribute + * + * Deletes an attribute. + * + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @throws AppwriteException + * @return string + */ + public function deleteAttribute(string $databaseId, string $collectionId, string $key): string + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{key}'], + [$databaseId, $collectionId, $key], + '/databases/{databaseId}/collections/{collectionId}/attributes/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update relationship attribute + * + * Update relationship attribute. [Learn more about relationship + * attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). + * + * + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @param ?RelationMutate $onDelete + * @throws AppwriteException + * @return array + */ + public function updateRelationshipAttribute(string $databaseId, string $collectionId, string $key, ?RelationMutate $onDelete = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{key}'], + [$databaseId, $collectionId, $key], + '/databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + + if (!is_null($onDelete)) { + $apiParams['onDelete'] = $onDelete; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * List documents + * + * Get a list of all the user's documents in a given collection. You can use + * the query params to filter your results. + * + * @param string $databaseId + * @param string $collectionId + * @param ?array $queries + * @throws AppwriteException + * @return array + */ + public function listDocuments(string $databaseId, string $collectionId, ?array $queries = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/databases/{databaseId}/collections/{collectionId}/documents' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create document + * + * Create a new Document. Before using this route, you should create a new + * collection resource using either a [server + * integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) + * API or directly from your database console. + * + * @param string $databaseId + * @param string $collectionId + * @param string $documentId + * @param array $data + * @param ?array $permissions + * @throws AppwriteException + * @return array + */ + public function createDocument(string $databaseId, string $collectionId, string $documentId, array $data, ?array $permissions = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/databases/{databaseId}/collections/{collectionId}/documents' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['documentId'] = $documentId; + $apiParams['data'] = $data; + + if (!is_null($permissions)) { + $apiParams['permissions'] = $permissions; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get document + * + * Get a document by its unique ID. This endpoint response returns a JSON + * object with the document data. + * + * @param string $databaseId + * @param string $collectionId + * @param string $documentId + * @param ?array $queries + * @throws AppwriteException + * @return array + */ + public function getDocument(string $databaseId, string $collectionId, string $documentId, ?array $queries = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{documentId}'], + [$databaseId, $collectionId, $documentId], + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['documentId'] = $documentId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update document + * + * Update a document by its unique ID. Using the patch method you can pass + * only specific fields that will get updated. + * + * @param string $databaseId + * @param string $collectionId + * @param string $documentId + * @param ?array $data + * @param ?array $permissions + * @throws AppwriteException + * @return array + */ + public function updateDocument(string $databaseId, string $collectionId, string $documentId, ?array $data = null, ?array $permissions = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{documentId}'], + [$databaseId, $collectionId, $documentId], + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['documentId'] = $documentId; + + if (!is_null($data)) { + $apiParams['data'] = $data; + } + + if (!is_null($permissions)) { + $apiParams['permissions'] = $permissions; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Delete document + * + * Delete a document by its unique ID. + * + * @param string $databaseId + * @param string $collectionId + * @param string $documentId + * @throws AppwriteException + * @return string + */ + public function deleteDocument(string $databaseId, string $collectionId, string $documentId): string + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{documentId}'], + [$databaseId, $collectionId, $documentId], + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['documentId'] = $documentId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * List indexes + * + * List indexes in the collection. + * + * @param string $databaseId + * @param string $collectionId + * @param ?array $queries + * @throws AppwriteException + * @return array + */ + public function listIndexes(string $databaseId, string $collectionId, ?array $queries = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/databases/{databaseId}/collections/{collectionId}/indexes' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create index + * + * Creates an index on the attributes listed. Your index should include all + * the attributes you will query in a single request. + * Attributes can be `key`, `fulltext`, and `unique`. + * + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @param IndexType $type + * @param array $attributes + * @param ?array $orders + * @throws AppwriteException + * @return array + */ + public function createIndex(string $databaseId, string $collectionId, string $key, IndexType $type, array $attributes, ?array $orders = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/databases/{databaseId}/collections/{collectionId}/indexes' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['type'] = $type; + $apiParams['attributes'] = $attributes; + + if (!is_null($orders)) { + $apiParams['orders'] = $orders; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get index + * + * Get index by ID. + * + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @throws AppwriteException + * @return array + */ + public function getIndex(string $databaseId, string $collectionId, string $key): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{key}'], + [$databaseId, $collectionId, $key], + '/databases/{databaseId}/collections/{collectionId}/indexes/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Delete index + * + * Delete an index. + * + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @throws AppwriteException + * @return string + */ + public function deleteIndex(string $databaseId, string $collectionId, string $key): string + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{key}'], + [$databaseId, $collectionId, $key], + '/databases/{databaseId}/collections/{collectionId}/indexes/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } +} \ No newline at end of file diff --git a/src/Appwrite/Services/Functions.php b/src/Appwrite/Services/Functions.php new file mode 100644 index 0000000..56521f1 --- /dev/null +++ b/src/Appwrite/Services/Functions.php @@ -0,0 +1,1169 @@ +<?php + +namespace Appwrite\Services; + +use Appwrite\AppwriteException; +use Appwrite\Client; +use Appwrite\Service; +use Appwrite\InputFile; +use Appwrite\Enums\Runtime; +use Appwrite\Enums\ExecutionMethod; + +class Functions extends Service +{ + public function __construct(Client $client) + { + parent::__construct($client); + } + + /** + * List functions + * + * Get a list of all the project's functions. You can use the query params to + * filter your results. + * + * @param ?array $queries + * @param ?string $search + * @throws AppwriteException + * @return array + */ + public function list(?array $queries = null, ?string $search = null): array + { + $apiPath = str_replace( + [], + [], + '/functions' + ); + + $apiParams = []; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + if (!is_null($search)) { + $apiParams['search'] = $search; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create function + * + * Create a new function. You can pass a list of + * [permissions](https://appwrite.io/docs/permissions) to allow different + * project users or team with access to execute the function using the client + * API. + * + * @param string $functionId + * @param string $name + * @param Runtime $runtime + * @param ?array $execute + * @param ?array $events + * @param ?string $schedule + * @param ?int $timeout + * @param ?bool $enabled + * @param ?bool $logging + * @param ?string $entrypoint + * @param ?string $commands + * @param ?array $scopes + * @param ?string $installationId + * @param ?string $providerRepositoryId + * @param ?string $providerBranch + * @param ?bool $providerSilentMode + * @param ?string $providerRootDirectory + * @param ?string $templateRepository + * @param ?string $templateOwner + * @param ?string $templateRootDirectory + * @param ?string $templateVersion + * @throws AppwriteException + * @return array + */ + public function create(string $functionId, string $name, Runtime $runtime, ?array $execute = null, ?array $events = null, ?string $schedule = null, ?int $timeout = null, ?bool $enabled = null, ?bool $logging = null, ?string $entrypoint = null, ?string $commands = null, ?array $scopes = null, ?string $installationId = null, ?string $providerRepositoryId = null, ?string $providerBranch = null, ?bool $providerSilentMode = null, ?string $providerRootDirectory = null, ?string $templateRepository = null, ?string $templateOwner = null, ?string $templateRootDirectory = null, ?string $templateVersion = null): array + { + $apiPath = str_replace( + [], + [], + '/functions' + ); + + $apiParams = []; + $apiParams['functionId'] = $functionId; + $apiParams['name'] = $name; + $apiParams['runtime'] = $runtime; + + if (!is_null($execute)) { + $apiParams['execute'] = $execute; + } + + if (!is_null($events)) { + $apiParams['events'] = $events; + } + + if (!is_null($schedule)) { + $apiParams['schedule'] = $schedule; + } + + if (!is_null($timeout)) { + $apiParams['timeout'] = $timeout; + } + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + if (!is_null($logging)) { + $apiParams['logging'] = $logging; + } + + if (!is_null($entrypoint)) { + $apiParams['entrypoint'] = $entrypoint; + } + + if (!is_null($commands)) { + $apiParams['commands'] = $commands; + } + + if (!is_null($scopes)) { + $apiParams['scopes'] = $scopes; + } + + if (!is_null($installationId)) { + $apiParams['installationId'] = $installationId; + } + + if (!is_null($providerRepositoryId)) { + $apiParams['providerRepositoryId'] = $providerRepositoryId; + } + + if (!is_null($providerBranch)) { + $apiParams['providerBranch'] = $providerBranch; + } + + if (!is_null($providerSilentMode)) { + $apiParams['providerSilentMode'] = $providerSilentMode; + } + + if (!is_null($providerRootDirectory)) { + $apiParams['providerRootDirectory'] = $providerRootDirectory; + } + + if (!is_null($templateRepository)) { + $apiParams['templateRepository'] = $templateRepository; + } + + if (!is_null($templateOwner)) { + $apiParams['templateOwner'] = $templateOwner; + } + + if (!is_null($templateRootDirectory)) { + $apiParams['templateRootDirectory'] = $templateRootDirectory; + } + + if (!is_null($templateVersion)) { + $apiParams['templateVersion'] = $templateVersion; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * List runtimes + * + * Get a list of all runtimes that are currently active on your instance. + * + * @throws AppwriteException + * @return array + */ + public function listRuntimes(): array + { + $apiPath = str_replace( + [], + [], + '/functions/runtimes' + ); + + $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * List function templates + * + * List available function templates. You can use template details in + * [createFunction](/docs/references/cloud/server-nodejs/functions#create) + * method. + * + * @param ?array $runtimes + * @param ?array $useCases + * @param ?int $limit + * @param ?int $offset + * @throws AppwriteException + * @return array + */ + public function listTemplates(?array $runtimes = null, ?array $useCases = null, ?int $limit = null, ?int $offset = null): array + { + $apiPath = str_replace( + [], + [], + '/functions/templates' + ); + + $apiParams = []; + + if (!is_null($runtimes)) { + $apiParams['runtimes'] = $runtimes; + } + + if (!is_null($useCases)) { + $apiParams['useCases'] = $useCases; + } + + if (!is_null($limit)) { + $apiParams['limit'] = $limit; + } + + if (!is_null($offset)) { + $apiParams['offset'] = $offset; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get function template + * + * Get a function template using ID. You can use template details in + * [createFunction](/docs/references/cloud/server-nodejs/functions#create) + * method. + * + * @param string $templateId + * @throws AppwriteException + * @return array + */ + public function getTemplate(string $templateId): array + { + $apiPath = str_replace( + ['{templateId}'], + [$templateId], + '/functions/templates/{templateId}' + ); + + $apiParams = []; + $apiParams['templateId'] = $templateId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get function + * + * Get a function by its unique ID. + * + * @param string $functionId + * @throws AppwriteException + * @return array + */ + public function get(string $functionId): array + { + $apiPath = str_replace( + ['{functionId}'], + [$functionId], + '/functions/{functionId}' + ); + + $apiParams = []; + $apiParams['functionId'] = $functionId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update function + * + * Update function by its unique ID. + * + * @param string $functionId + * @param string $name + * @param ?Runtime $runtime + * @param ?array $execute + * @param ?array $events + * @param ?string $schedule + * @param ?int $timeout + * @param ?bool $enabled + * @param ?bool $logging + * @param ?string $entrypoint + * @param ?string $commands + * @param ?array $scopes + * @param ?string $installationId + * @param ?string $providerRepositoryId + * @param ?string $providerBranch + * @param ?bool $providerSilentMode + * @param ?string $providerRootDirectory + * @throws AppwriteException + * @return array + */ + public function update(string $functionId, string $name, ?Runtime $runtime = null, ?array $execute = null, ?array $events = null, ?string $schedule = null, ?int $timeout = null, ?bool $enabled = null, ?bool $logging = null, ?string $entrypoint = null, ?string $commands = null, ?array $scopes = null, ?string $installationId = null, ?string $providerRepositoryId = null, ?string $providerBranch = null, ?bool $providerSilentMode = null, ?string $providerRootDirectory = null): array + { + $apiPath = str_replace( + ['{functionId}'], + [$functionId], + '/functions/{functionId}' + ); + + $apiParams = []; + $apiParams['functionId'] = $functionId; + $apiParams['name'] = $name; + + if (!is_null($runtime)) { + $apiParams['runtime'] = $runtime; + } + + if (!is_null($execute)) { + $apiParams['execute'] = $execute; + } + + if (!is_null($events)) { + $apiParams['events'] = $events; + } + + if (!is_null($schedule)) { + $apiParams['schedule'] = $schedule; + } + + if (!is_null($timeout)) { + $apiParams['timeout'] = $timeout; + } + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + if (!is_null($logging)) { + $apiParams['logging'] = $logging; + } + + if (!is_null($entrypoint)) { + $apiParams['entrypoint'] = $entrypoint; + } + + if (!is_null($commands)) { + $apiParams['commands'] = $commands; + } + + if (!is_null($scopes)) { + $apiParams['scopes'] = $scopes; + } + + if (!is_null($installationId)) { + $apiParams['installationId'] = $installationId; + } + $apiParams['providerRepositoryId'] = $providerRepositoryId; + + if (!is_null($providerBranch)) { + $apiParams['providerBranch'] = $providerBranch; + } + + if (!is_null($providerSilentMode)) { + $apiParams['providerSilentMode'] = $providerSilentMode; + } + + if (!is_null($providerRootDirectory)) { + $apiParams['providerRootDirectory'] = $providerRootDirectory; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PUT, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Delete function + * + * Delete a function by its unique ID. + * + * @param string $functionId + * @throws AppwriteException + * @return string + */ + public function delete(string $functionId): string + { + $apiPath = str_replace( + ['{functionId}'], + [$functionId], + '/functions/{functionId}' + ); + + $apiParams = []; + $apiParams['functionId'] = $functionId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * List deployments + * + * Get a list of all the project's code deployments. You can use the query + * params to filter your results. + * + * @param string $functionId + * @param ?array $queries + * @param ?string $search + * @throws AppwriteException + * @return array + */ + public function listDeployments(string $functionId, ?array $queries = null, ?string $search = null): array + { + $apiPath = str_replace( + ['{functionId}'], + [$functionId], + '/functions/{functionId}/deployments' + ); + + $apiParams = []; + $apiParams['functionId'] = $functionId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + if (!is_null($search)) { + $apiParams['search'] = $search; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create deployment + * + * Create a new function code deployment. Use this endpoint to upload a new + * version of your code function. To execute your newly uploaded code, you'll + * need to update the function's deployment to use your new deployment UID. + * + * This endpoint accepts a tar.gz file compressed with your code. Make sure to + * include any dependencies your code has within the compressed file. You can + * learn more about code packaging in the [Appwrite Cloud Functions + * tutorial](https://appwrite.io/docs/functions). + * + * Use the "command" param to set the entrypoint used to execute your code. + * + * @param string $functionId + * @param InputFile $code + * @param bool $activate + * @param ?string $entrypoint + * @param ?string $commands + * @throws AppwriteException + * @return array + */ + public function createDeployment(string $functionId, InputFile $code, bool $activate, ?string $entrypoint = null, ?string $commands = null, callable $onProgress = null): array + { + $apiPath = str_replace( + ['{functionId}'], + [$functionId], + '/functions/{functionId}/deployments' + ); + + $apiParams = []; + $apiParams['functionId'] = $functionId; + $apiParams['code'] = $code; + $apiParams['activate'] = $activate; + + if (!is_null($entrypoint)) { + $apiParams['entrypoint'] = $entrypoint; + } + + if (!is_null($commands)) { + $apiParams['commands'] = $commands; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'multipart/form-data'; + $size = 0; + $mimeType = null; + $postedName = null; + if(empty($code->getPath() ?? null)) { + $size = strlen($code->getData()); + $mimeType = $code->getMimeType(); + $postedName = $code->getFilename(); + if ($size <= Client::CHUNK_SIZE) { + $apiParams['code'] = new \CURLFile('data://' . $mimeType . ';base64,' . base64_encode($code->getData()), $mimeType, $postedName); + return $this->client->call(Client::METHOD_POST, $apiPath, [ + 'content-type' => 'multipart/form-data', + ], $apiParams); + } + } else { + $size = filesize($code->getPath()); + $mimeType = $code->getMimeType() ?? mime_content_type($code->getPath()); + $postedName = $code->getFilename() ?? basename($code->getPath()); + //send single file if size is less than or equal to 5MB + if ($size <= Client::CHUNK_SIZE) { + $apiParams['code'] = new \CURLFile($code->getPath(), $mimeType, $postedName); + return $this->client->call(Client::METHOD_POST, $apiPath, [ + 'content-type' => 'multipart/form-data', + ], $apiParams); + } + } + + $id = ''; + $counter = 0; + + + $apiHeaders = ['content-type' => 'multipart/form-data']; + $handle = null; + + if(!empty($code->getPath())) { + $handle = @fopen($code->getPath(), "rb"); + } + + $start = $counter * Client::CHUNK_SIZE; + while ($start < $size) { + $chunk = ''; + if(!empty($handle)) { + fseek($handle, $start); + $chunk = @fread($handle, Client::CHUNK_SIZE); + } else { + $chunk = substr($file->getData(), $start, Client::CHUNK_SIZE); + } + $apiParams['code'] = new \CURLFile('data://' . $mimeType . ';base64,' . base64_encode($chunk), $mimeType, $postedName); + $apiHeaders['content-range'] = 'bytes ' . ($counter * Client::CHUNK_SIZE) . '-' . min(((($counter * Client::CHUNK_SIZE) + Client::CHUNK_SIZE) - 1), $size - 1) . '/' . $size; + if(!empty($id)) { + $apiHeaders['x-appwrite-id'] = $id; + } + $response = $this->client->call(Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams); + $counter++; + $start += Client::CHUNK_SIZE; + if(empty($id)) { + $id = $response['$id']; + } + if($onProgress !== null) { + $onProgress([ + '$id' => $response['$id'], + 'progress' => min(((($counter * Client::CHUNK_SIZE) + Client::CHUNK_SIZE)), $size) / $size * 100, + 'sizeUploaded' => min($counter * Client::CHUNK_SIZE), + 'chunksTotal' => $response['chunksTotal'], + 'chunksUploaded' => $response['chunksUploaded'], + ]); + } + } + if(!empty($handle)) { + @fclose($handle); + } + return $response; + + } + + /** + * Get deployment + * + * Get a code deployment by its unique ID. + * + * @param string $functionId + * @param string $deploymentId + * @throws AppwriteException + * @return array + */ + public function getDeployment(string $functionId, string $deploymentId): array + { + $apiPath = str_replace( + ['{functionId}', '{deploymentId}'], + [$functionId, $deploymentId], + '/functions/{functionId}/deployments/{deploymentId}' + ); + + $apiParams = []; + $apiParams['functionId'] = $functionId; + $apiParams['deploymentId'] = $deploymentId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update deployment + * + * Update the function code deployment ID using the unique function ID. Use + * this endpoint to switch the code deployment that should be executed by the + * execution endpoint. + * + * @param string $functionId + * @param string $deploymentId + * @throws AppwriteException + * @return array + */ + public function updateDeployment(string $functionId, string $deploymentId): array + { + $apiPath = str_replace( + ['{functionId}', '{deploymentId}'], + [$functionId, $deploymentId], + '/functions/{functionId}/deployments/{deploymentId}' + ); + + $apiParams = []; + $apiParams['functionId'] = $functionId; + $apiParams['deploymentId'] = $deploymentId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Delete deployment + * + * Delete a code deployment by its unique ID. + * + * @param string $functionId + * @param string $deploymentId + * @throws AppwriteException + * @return string + */ + public function deleteDeployment(string $functionId, string $deploymentId): string + { + $apiPath = str_replace( + ['{functionId}', '{deploymentId}'], + [$functionId, $deploymentId], + '/functions/{functionId}/deployments/{deploymentId}' + ); + + $apiParams = []; + $apiParams['functionId'] = $functionId; + $apiParams['deploymentId'] = $deploymentId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Rebuild deployment + * + * @param string $functionId + * @param string $deploymentId + * @param ?string $buildId + * @throws AppwriteException + * @return string + */ + public function createBuild(string $functionId, string $deploymentId, ?string $buildId = null): string + { + $apiPath = str_replace( + ['{functionId}', '{deploymentId}'], + [$functionId, $deploymentId], + '/functions/{functionId}/deployments/{deploymentId}/build' + ); + + $apiParams = []; + $apiParams['functionId'] = $functionId; + $apiParams['deploymentId'] = $deploymentId; + + if (!is_null($buildId)) { + $apiParams['buildId'] = $buildId; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Cancel deployment + * + * @param string $functionId + * @param string $deploymentId + * @throws AppwriteException + * @return array + */ + public function updateDeploymentBuild(string $functionId, string $deploymentId): array + { + $apiPath = str_replace( + ['{functionId}', '{deploymentId}'], + [$functionId, $deploymentId], + '/functions/{functionId}/deployments/{deploymentId}/build' + ); + + $apiParams = []; + $apiParams['functionId'] = $functionId; + $apiParams['deploymentId'] = $deploymentId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Download deployment + * + * Get a Deployment's contents by its unique ID. This endpoint supports range + * requests for partial or streaming file download. + * + * @param string $functionId + * @param string $deploymentId + * @throws AppwriteException + * @return string + */ + public function getDeploymentDownload(string $functionId, string $deploymentId): string + { + $apiPath = str_replace( + ['{functionId}', '{deploymentId}'], + [$functionId, $deploymentId], + '/functions/{functionId}/deployments/{deploymentId}/download' + ); + + $apiParams = []; + $apiParams['functionId'] = $functionId; + $apiParams['deploymentId'] = $deploymentId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * List executions + * + * Get a list of all the current user function execution logs. You can use the + * query params to filter your results. + * + * @param string $functionId + * @param ?array $queries + * @param ?string $search + * @throws AppwriteException + * @return array + */ + public function listExecutions(string $functionId, ?array $queries = null, ?string $search = null): array + { + $apiPath = str_replace( + ['{functionId}'], + [$functionId], + '/functions/{functionId}/executions' + ); + + $apiParams = []; + $apiParams['functionId'] = $functionId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + if (!is_null($search)) { + $apiParams['search'] = $search; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create execution + * + * Trigger a function execution. The returned object will return you the + * current execution status. You can ping the `Get Execution` endpoint to get + * updates on the current execution status. Once this endpoint is called, your + * function execution process will start asynchronously. + * + * @param string $functionId + * @param ?string $body + * @param ?bool $async + * @param ?string $xpath + * @param ?ExecutionMethod $method + * @param ?array $headers + * @param ?string $scheduledAt + * @throws AppwriteException + * @return array + */ + public function createExecution(string $functionId, ?string $body = null, ?bool $async = null, ?string $xpath = null, ?ExecutionMethod $method = null, ?array $headers = null, ?string $scheduledAt = null, callable $onProgress = null): array + { + $apiPath = str_replace( + ['{functionId}'], + [$functionId], + '/functions/{functionId}/executions' + ); + + $apiParams = []; + $apiParams['functionId'] = $functionId; + + if (!is_null($body)) { + $apiParams['body'] = $body; + } + + if (!is_null($async)) { + $apiParams['async'] = $async; + } + + if (!is_null($xpath)) { + $apiParams['path'] = $xpath; + } + + if (!is_null($method)) { + $apiParams['method'] = $method; + } + + if (!is_null($headers)) { + $apiParams['headers'] = $headers; + } + + if (!is_null($scheduledAt)) { + $apiParams['scheduledAt'] = $scheduledAt; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'multipart/form-data'; + + } + + /** + * Get execution + * + * Get a function execution log by its unique ID. + * + * @param string $functionId + * @param string $executionId + * @throws AppwriteException + * @return array + */ + public function getExecution(string $functionId, string $executionId): array + { + $apiPath = str_replace( + ['{functionId}', '{executionId}'], + [$functionId, $executionId], + '/functions/{functionId}/executions/{executionId}' + ); + + $apiParams = []; + $apiParams['functionId'] = $functionId; + $apiParams['executionId'] = $executionId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Delete execution + * + * Delete a function execution by its unique ID. + * + * + * @param string $functionId + * @param string $executionId + * @throws AppwriteException + * @return string + */ + public function deleteExecution(string $functionId, string $executionId): string + { + $apiPath = str_replace( + ['{functionId}', '{executionId}'], + [$functionId, $executionId], + '/functions/{functionId}/executions/{executionId}' + ); + + $apiParams = []; + $apiParams['functionId'] = $functionId; + $apiParams['executionId'] = $executionId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * List variables + * + * Get a list of all variables of a specific function. + * + * @param string $functionId + * @throws AppwriteException + * @return array + */ + public function listVariables(string $functionId): array + { + $apiPath = str_replace( + ['{functionId}'], + [$functionId], + '/functions/{functionId}/variables' + ); + + $apiParams = []; + $apiParams['functionId'] = $functionId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create variable + * + * Create a new function environment variable. These variables can be accessed + * in the function at runtime as environment variables. + * + * @param string $functionId + * @param string $key + * @param string $value + * @throws AppwriteException + * @return array + */ + public function createVariable(string $functionId, string $key, string $value): array + { + $apiPath = str_replace( + ['{functionId}'], + [$functionId], + '/functions/{functionId}/variables' + ); + + $apiParams = []; + $apiParams['functionId'] = $functionId; + $apiParams['key'] = $key; + $apiParams['value'] = $value; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get variable + * + * Get a variable by its unique ID. + * + * @param string $functionId + * @param string $variableId + * @throws AppwriteException + * @return array + */ + public function getVariable(string $functionId, string $variableId): array + { + $apiPath = str_replace( + ['{functionId}', '{variableId}'], + [$functionId, $variableId], + '/functions/{functionId}/variables/{variableId}' + ); + + $apiParams = []; + $apiParams['functionId'] = $functionId; + $apiParams['variableId'] = $variableId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update variable + * + * Update variable by its unique ID. + * + * @param string $functionId + * @param string $variableId + * @param string $key + * @param ?string $value + * @throws AppwriteException + * @return array + */ + public function updateVariable(string $functionId, string $variableId, string $key, ?string $value = null): array + { + $apiPath = str_replace( + ['{functionId}', '{variableId}'], + [$functionId, $variableId], + '/functions/{functionId}/variables/{variableId}' + ); + + $apiParams = []; + $apiParams['functionId'] = $functionId; + $apiParams['variableId'] = $variableId; + $apiParams['key'] = $key; + + if (!is_null($value)) { + $apiParams['value'] = $value; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PUT, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Delete variable + * + * Delete a variable by its unique ID. + * + * @param string $functionId + * @param string $variableId + * @throws AppwriteException + * @return string + */ + public function deleteVariable(string $functionId, string $variableId): string + { + $apiPath = str_replace( + ['{functionId}', '{variableId}'], + [$functionId, $variableId], + '/functions/{functionId}/variables/{variableId}' + ); + + $apiParams = []; + $apiParams['functionId'] = $functionId; + $apiParams['variableId'] = $variableId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } +} \ No newline at end of file diff --git a/src/Appwrite/Services/Graphql.php b/src/Appwrite/Services/Graphql.php new file mode 100644 index 0000000..fcb161c --- /dev/null +++ b/src/Appwrite/Services/Graphql.php @@ -0,0 +1,80 @@ +<?php + +namespace Appwrite\Services; + +use Appwrite\AppwriteException; +use Appwrite\Client; +use Appwrite\Service; +use Appwrite\InputFile; + +class Graphql extends Service +{ + public function __construct(Client $client) + { + parent::__construct($client); + } + + /** + * GraphQL endpoint + * + * Execute a GraphQL mutation. + * + * @param array $query + * @throws AppwriteException + * @return array + */ + public function query(array $query): array + { + $apiPath = str_replace( + [], + [], + '/graphql' + ); + + $apiParams = []; + $apiParams['query'] = $query; + + $apiHeaders = []; + $apiHeaders['x-sdk-graphql'] = 'true'; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * GraphQL endpoint + * + * Execute a GraphQL mutation. + * + * @param array $query + * @throws AppwriteException + * @return array + */ + public function mutation(array $query): array + { + $apiPath = str_replace( + [], + [], + '/graphql/mutation' + ); + + $apiParams = []; + $apiParams['query'] = $query; + + $apiHeaders = []; + $apiHeaders['x-sdk-graphql'] = 'true'; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } +} \ No newline at end of file diff --git a/src/Appwrite/Services/Health.php b/src/Appwrite/Services/Health.php new file mode 100644 index 0000000..7ac5942 --- /dev/null +++ b/src/Appwrite/Services/Health.php @@ -0,0 +1,783 @@ +<?php + +namespace Appwrite\Services; + +use Appwrite\AppwriteException; +use Appwrite\Client; +use Appwrite\Service; +use Appwrite\InputFile; +use Appwrite\Enums\Name; + +class Health extends Service +{ + public function __construct(Client $client) + { + parent::__construct($client); + } + + /** + * Get HTTP + * + * Check the Appwrite HTTP server is up and responsive. + * + * @throws AppwriteException + * @return array + */ + public function get(): array + { + $apiPath = str_replace( + [], + [], + '/health' + ); + + $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get antivirus + * + * Check the Appwrite Antivirus server is up and connection is successful. + * + * @throws AppwriteException + * @return array + */ + public function getAntivirus(): array + { + $apiPath = str_replace( + [], + [], + '/health/anti-virus' + ); + + $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get cache + * + * Check the Appwrite in-memory cache servers are up and connection is + * successful. + * + * @throws AppwriteException + * @return array + */ + public function getCache(): array + { + $apiPath = str_replace( + [], + [], + '/health/cache' + ); + + $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get the SSL certificate for a domain + * + * Get the SSL certificate for a domain + * + * @param ?string $domain + * @throws AppwriteException + * @return array + */ + public function getCertificate(?string $domain = null): array + { + $apiPath = str_replace( + [], + [], + '/health/certificate' + ); + + $apiParams = []; + + if (!is_null($domain)) { + $apiParams['domain'] = $domain; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get DB + * + * Check the Appwrite database servers are up and connection is successful. + * + * @throws AppwriteException + * @return array + */ + public function getDB(): array + { + $apiPath = str_replace( + [], + [], + '/health/db' + ); + + $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get pubsub + * + * Check the Appwrite pub-sub servers are up and connection is successful. + * + * @throws AppwriteException + * @return array + */ + public function getPubSub(): array + { + $apiPath = str_replace( + [], + [], + '/health/pubsub' + ); + + $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get queue + * + * Check the Appwrite queue messaging servers are up and connection is + * successful. + * + * @throws AppwriteException + * @return array + */ + public function getQueue(): array + { + $apiPath = str_replace( + [], + [], + '/health/queue' + ); + + $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get builds queue + * + * Get the number of builds that are waiting to be processed in the Appwrite + * internal queue server. + * + * @param ?int $threshold + * @throws AppwriteException + * @return array + */ + public function getQueueBuilds(?int $threshold = null): array + { + $apiPath = str_replace( + [], + [], + '/health/queue/builds' + ); + + $apiParams = []; + + if (!is_null($threshold)) { + $apiParams['threshold'] = $threshold; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get certificates queue + * + * Get the number of certificates that are waiting to be issued against + * [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue + * server. + * + * @param ?int $threshold + * @throws AppwriteException + * @return array + */ + public function getQueueCertificates(?int $threshold = null): array + { + $apiPath = str_replace( + [], + [], + '/health/queue/certificates' + ); + + $apiParams = []; + + if (!is_null($threshold)) { + $apiParams['threshold'] = $threshold; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get databases queue + * + * Get the number of database changes that are waiting to be processed in the + * Appwrite internal queue server. + * + * @param ?string $name + * @param ?int $threshold + * @throws AppwriteException + * @return array + */ + public function getQueueDatabases(?string $name = null, ?int $threshold = null): array + { + $apiPath = str_replace( + [], + [], + '/health/queue/databases' + ); + + $apiParams = []; + + if (!is_null($name)) { + $apiParams['name'] = $name; + } + + if (!is_null($threshold)) { + $apiParams['threshold'] = $threshold; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get deletes queue + * + * Get the number of background destructive changes that are waiting to be + * processed in the Appwrite internal queue server. + * + * @param ?int $threshold + * @throws AppwriteException + * @return array + */ + public function getQueueDeletes(?int $threshold = null): array + { + $apiPath = str_replace( + [], + [], + '/health/queue/deletes' + ); + + $apiParams = []; + + if (!is_null($threshold)) { + $apiParams['threshold'] = $threshold; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get number of failed queue jobs + * + * Returns the amount of failed jobs in a given queue. + * + * + * @param Name $name + * @param ?int $threshold + * @throws AppwriteException + * @return array + */ + public function getFailedJobs(Name $name, ?int $threshold = null): array + { + $apiPath = str_replace( + ['{name}'], + [$name], + '/health/queue/failed/{name}' + ); + + $apiParams = []; + $apiParams['name'] = $name; + + if (!is_null($threshold)) { + $apiParams['threshold'] = $threshold; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get functions queue + * + * Get the number of function executions that are waiting to be processed in + * the Appwrite internal queue server. + * + * @param ?int $threshold + * @throws AppwriteException + * @return array + */ + public function getQueueFunctions(?int $threshold = null): array + { + $apiPath = str_replace( + [], + [], + '/health/queue/functions' + ); + + $apiParams = []; + + if (!is_null($threshold)) { + $apiParams['threshold'] = $threshold; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get logs queue + * + * Get the number of logs that are waiting to be processed in the Appwrite + * internal queue server. + * + * @param ?int $threshold + * @throws AppwriteException + * @return array + */ + public function getQueueLogs(?int $threshold = null): array + { + $apiPath = str_replace( + [], + [], + '/health/queue/logs' + ); + + $apiParams = []; + + if (!is_null($threshold)) { + $apiParams['threshold'] = $threshold; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get mails queue + * + * Get the number of mails that are waiting to be processed in the Appwrite + * internal queue server. + * + * @param ?int $threshold + * @throws AppwriteException + * @return array + */ + public function getQueueMails(?int $threshold = null): array + { + $apiPath = str_replace( + [], + [], + '/health/queue/mails' + ); + + $apiParams = []; + + if (!is_null($threshold)) { + $apiParams['threshold'] = $threshold; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get messaging queue + * + * Get the number of messages that are waiting to be processed in the Appwrite + * internal queue server. + * + * @param ?int $threshold + * @throws AppwriteException + * @return array + */ + public function getQueueMessaging(?int $threshold = null): array + { + $apiPath = str_replace( + [], + [], + '/health/queue/messaging' + ); + + $apiParams = []; + + if (!is_null($threshold)) { + $apiParams['threshold'] = $threshold; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get migrations queue + * + * Get the number of migrations that are waiting to be processed in the + * Appwrite internal queue server. + * + * @param ?int $threshold + * @throws AppwriteException + * @return array + */ + public function getQueueMigrations(?int $threshold = null): array + { + $apiPath = str_replace( + [], + [], + '/health/queue/migrations' + ); + + $apiParams = []; + + if (!is_null($threshold)) { + $apiParams['threshold'] = $threshold; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get usage queue + * + * Get the number of metrics that are waiting to be processed in the Appwrite + * internal queue server. + * + * @param ?int $threshold + * @throws AppwriteException + * @return array + */ + public function getQueueUsage(?int $threshold = null): array + { + $apiPath = str_replace( + [], + [], + '/health/queue/usage' + ); + + $apiParams = []; + + if (!is_null($threshold)) { + $apiParams['threshold'] = $threshold; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get usage dump queue + * + * Get the number of projects containing metrics that are waiting to be + * processed in the Appwrite internal queue server. + * + * @param ?int $threshold + * @throws AppwriteException + * @return array + */ + public function getQueueUsageDump(?int $threshold = null): array + { + $apiPath = str_replace( + [], + [], + '/health/queue/usage-dump' + ); + + $apiParams = []; + + if (!is_null($threshold)) { + $apiParams['threshold'] = $threshold; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get webhooks queue + * + * Get the number of webhooks that are waiting to be processed in the Appwrite + * internal queue server. + * + * @param ?int $threshold + * @throws AppwriteException + * @return array + */ + public function getQueueWebhooks(?int $threshold = null): array + { + $apiPath = str_replace( + [], + [], + '/health/queue/webhooks' + ); + + $apiParams = []; + + if (!is_null($threshold)) { + $apiParams['threshold'] = $threshold; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get storage + * + * Check the Appwrite storage device is up and connection is successful. + * + * @throws AppwriteException + * @return array + */ + public function getStorage(): array + { + $apiPath = str_replace( + [], + [], + '/health/storage' + ); + + $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get local storage + * + * Check the Appwrite local storage device is up and connection is successful. + * + * @throws AppwriteException + * @return array + */ + public function getStorageLocal(): array + { + $apiPath = str_replace( + [], + [], + '/health/storage/local' + ); + + $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get time + * + * Check the Appwrite server time is synced with Google remote NTP server. We + * use this technology to smoothly handle leap seconds with no disruptive + * events. The [Network Time + * Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is + * used by hundreds of millions of computers and devices to synchronize their + * clocks over the Internet. If your computer sets its own clock, it likely + * uses NTP. + * + * @throws AppwriteException + * @return array + */ + public function getTime(): array + { + $apiPath = str_replace( + [], + [], + '/health/time' + ); + + $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } +} \ No newline at end of file diff --git a/src/Appwrite/Services/Locale.php b/src/Appwrite/Services/Locale.php new file mode 100644 index 0000000..6ea96d1 --- /dev/null +++ b/src/Appwrite/Services/Locale.php @@ -0,0 +1,261 @@ +<?php + +namespace Appwrite\Services; + +use Appwrite\AppwriteException; +use Appwrite\Client; +use Appwrite\Service; +use Appwrite\InputFile; + +class Locale extends Service +{ + public function __construct(Client $client) + { + parent::__construct($client); + } + + /** + * Get user locale + * + * Get the current user location based on IP. Returns an object with user + * country code, country name, continent name, continent code, ip address and + * suggested currency. You can use the locale header to get the data in a + * supported language. + * + * ([IP Geolocation by DB-IP](https://db-ip.com)) + * + * @throws AppwriteException + * @return array + */ + public function get(): array + { + $apiPath = str_replace( + [], + [], + '/locale' + ); + + $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * List Locale Codes + * + * List of all locale codes in [ISO + * 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes). + * + * @throws AppwriteException + * @return array + */ + public function listCodes(): array + { + $apiPath = str_replace( + [], + [], + '/locale/codes' + ); + + $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * List continents + * + * List of all continents. You can use the locale header to get the data in a + * supported language. + * + * @throws AppwriteException + * @return array + */ + public function listContinents(): array + { + $apiPath = str_replace( + [], + [], + '/locale/continents' + ); + + $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * List countries + * + * List of all countries. You can use the locale header to get the data in a + * supported language. + * + * @throws AppwriteException + * @return array + */ + public function listCountries(): array + { + $apiPath = str_replace( + [], + [], + '/locale/countries' + ); + + $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * List EU countries + * + * 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. + * + * @throws AppwriteException + * @return array + */ + public function listCountriesEU(): array + { + $apiPath = str_replace( + [], + [], + '/locale/countries/eu' + ); + + $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * List countries phone codes + * + * List of all countries phone codes. You can use the locale header to get the + * data in a supported language. + * + * @throws AppwriteException + * @return array + */ + public function listCountriesPhones(): array + { + $apiPath = str_replace( + [], + [], + '/locale/countries/phones' + ); + + $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * List 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. + * + * @throws AppwriteException + * @return array + */ + public function listCurrencies(): array + { + $apiPath = str_replace( + [], + [], + '/locale/currencies' + ); + + $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * List languages + * + * List of all languages classified by ISO 639-1 including 2-letter code, name + * in English, and name in the respective language. + * + * @throws AppwriteException + * @return array + */ + public function listLanguages(): array + { + $apiPath = str_replace( + [], + [], + '/locale/languages' + ); + + $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } +} \ No newline at end of file diff --git a/src/Appwrite/Services/Messaging.php b/src/Appwrite/Services/Messaging.php new file mode 100644 index 0000000..dc3b41b --- /dev/null +++ b/src/Appwrite/Services/Messaging.php @@ -0,0 +1,2448 @@ +<?php + +namespace Appwrite\Services; + +use Appwrite\AppwriteException; +use Appwrite\Client; +use Appwrite\Service; +use Appwrite\InputFile; +use Appwrite\Enums\SmtpEncryption; + +class Messaging extends Service +{ + public function __construct(Client $client) + { + parent::__construct($client); + } + + /** + * List messages + * + * Get a list of all messages from the current Appwrite project. + * + * @param ?array $queries + * @param ?string $search + * @throws AppwriteException + * @return array + */ + public function listMessages(?array $queries = null, ?string $search = null): array + { + $apiPath = str_replace( + [], + [], + '/messaging/messages' + ); + + $apiParams = []; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + if (!is_null($search)) { + $apiParams['search'] = $search; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create email + * + * Create a new email message. + * + * @param string $messageId + * @param string $subject + * @param string $content + * @param ?array $topics + * @param ?array $users + * @param ?array $targets + * @param ?array $cc + * @param ?array $bcc + * @param ?array $attachments + * @param ?bool $draft + * @param ?bool $html + * @param ?string $scheduledAt + * @throws AppwriteException + * @return array + */ + 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): array + { + $apiPath = str_replace( + [], + [], + '/messaging/messages/email' + ); + + $apiParams = []; + $apiParams['messageId'] = $messageId; + $apiParams['subject'] = $subject; + $apiParams['content'] = $content; + + if (!is_null($topics)) { + $apiParams['topics'] = $topics; + } + + if (!is_null($users)) { + $apiParams['users'] = $users; + } + + if (!is_null($targets)) { + $apiParams['targets'] = $targets; + } + + if (!is_null($cc)) { + $apiParams['cc'] = $cc; + } + + if (!is_null($bcc)) { + $apiParams['bcc'] = $bcc; + } + + if (!is_null($attachments)) { + $apiParams['attachments'] = $attachments; + } + + if (!is_null($draft)) { + $apiParams['draft'] = $draft; + } + + if (!is_null($html)) { + $apiParams['html'] = $html; + } + + if (!is_null($scheduledAt)) { + $apiParams['scheduledAt'] = $scheduledAt; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update email + * + * Update an email message by its unique ID. + * + * + * @param string $messageId + * @param ?array $topics + * @param ?array $users + * @param ?array $targets + * @param ?string $subject + * @param ?string $content + * @param ?bool $draft + * @param ?bool $html + * @param ?array $cc + * @param ?array $bcc + * @param ?string $scheduledAt + * @param ?array $attachments + * @throws AppwriteException + * @return array + */ + 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): array + { + $apiPath = str_replace( + ['{messageId}'], + [$messageId], + '/messaging/messages/email/{messageId}' + ); + + $apiParams = []; + $apiParams['messageId'] = $messageId; + + if (!is_null($topics)) { + $apiParams['topics'] = $topics; + } + + if (!is_null($users)) { + $apiParams['users'] = $users; + } + + if (!is_null($targets)) { + $apiParams['targets'] = $targets; + } + + if (!is_null($subject)) { + $apiParams['subject'] = $subject; + } + + if (!is_null($content)) { + $apiParams['content'] = $content; + } + + if (!is_null($draft)) { + $apiParams['draft'] = $draft; + } + + if (!is_null($html)) { + $apiParams['html'] = $html; + } + + if (!is_null($cc)) { + $apiParams['cc'] = $cc; + } + + if (!is_null($bcc)) { + $apiParams['bcc'] = $bcc; + } + + if (!is_null($scheduledAt)) { + $apiParams['scheduledAt'] = $scheduledAt; + } + + if (!is_null($attachments)) { + $apiParams['attachments'] = $attachments; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create push notification + * + * Create a new push notification. + * + * @param string $messageId + * @param string $title + * @param string $body + * @param ?array $topics + * @param ?array $users + * @param ?array $targets + * @param ?array $data + * @param ?string $action + * @param ?string $image + * @param ?string $icon + * @param ?string $sound + * @param ?string $color + * @param ?string $tag + * @param ?string $badge + * @param ?bool $draft + * @param ?string $scheduledAt + * @throws AppwriteException + * @return array + */ + public function createPush(string $messageId, string $title, string $body, ?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, ?string $badge = null, ?bool $draft = null, ?string $scheduledAt = null): array + { + $apiPath = str_replace( + [], + [], + '/messaging/messages/push' + ); + + $apiParams = []; + $apiParams['messageId'] = $messageId; + $apiParams['title'] = $title; + $apiParams['body'] = $body; + + if (!is_null($topics)) { + $apiParams['topics'] = $topics; + } + + if (!is_null($users)) { + $apiParams['users'] = $users; + } + + if (!is_null($targets)) { + $apiParams['targets'] = $targets; + } + + if (!is_null($data)) { + $apiParams['data'] = $data; + } + + if (!is_null($action)) { + $apiParams['action'] = $action; + } + + if (!is_null($image)) { + $apiParams['image'] = $image; + } + + if (!is_null($icon)) { + $apiParams['icon'] = $icon; + } + + if (!is_null($sound)) { + $apiParams['sound'] = $sound; + } + + if (!is_null($color)) { + $apiParams['color'] = $color; + } + + if (!is_null($tag)) { + $apiParams['tag'] = $tag; + } + + if (!is_null($badge)) { + $apiParams['badge'] = $badge; + } + + if (!is_null($draft)) { + $apiParams['draft'] = $draft; + } + + if (!is_null($scheduledAt)) { + $apiParams['scheduledAt'] = $scheduledAt; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update push notification + * + * Update a push notification by its unique ID. + * + * + * @param string $messageId + * @param ?array $topics + * @param ?array $users + * @param ?array $targets + * @param ?string $title + * @param ?string $body + * @param ?array $data + * @param ?string $action + * @param ?string $image + * @param ?string $icon + * @param ?string $sound + * @param ?string $color + * @param ?string $tag + * @param ?int $badge + * @param ?bool $draft + * @param ?string $scheduledAt + * @throws AppwriteException + * @return array + */ + 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): array + { + $apiPath = str_replace( + ['{messageId}'], + [$messageId], + '/messaging/messages/push/{messageId}' + ); + + $apiParams = []; + $apiParams['messageId'] = $messageId; + + if (!is_null($topics)) { + $apiParams['topics'] = $topics; + } + + if (!is_null($users)) { + $apiParams['users'] = $users; + } + + if (!is_null($targets)) { + $apiParams['targets'] = $targets; + } + + if (!is_null($title)) { + $apiParams['title'] = $title; + } + + if (!is_null($body)) { + $apiParams['body'] = $body; + } + + if (!is_null($data)) { + $apiParams['data'] = $data; + } + + if (!is_null($action)) { + $apiParams['action'] = $action; + } + + if (!is_null($image)) { + $apiParams['image'] = $image; + } + + if (!is_null($icon)) { + $apiParams['icon'] = $icon; + } + + if (!is_null($sound)) { + $apiParams['sound'] = $sound; + } + + if (!is_null($color)) { + $apiParams['color'] = $color; + } + + if (!is_null($tag)) { + $apiParams['tag'] = $tag; + } + + if (!is_null($badge)) { + $apiParams['badge'] = $badge; + } + + if (!is_null($draft)) { + $apiParams['draft'] = $draft; + } + + if (!is_null($scheduledAt)) { + $apiParams['scheduledAt'] = $scheduledAt; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create SMS + * + * Create a new SMS message. + * + * @param string $messageId + * @param string $content + * @param ?array $topics + * @param ?array $users + * @param ?array $targets + * @param ?bool $draft + * @param ?string $scheduledAt + * @throws AppwriteException + * @return array + */ + public function createSms(string $messageId, string $content, ?array $topics = null, ?array $users = null, ?array $targets = null, ?bool $draft = null, ?string $scheduledAt = null): array + { + $apiPath = str_replace( + [], + [], + '/messaging/messages/sms' + ); + + $apiParams = []; + $apiParams['messageId'] = $messageId; + $apiParams['content'] = $content; + + if (!is_null($topics)) { + $apiParams['topics'] = $topics; + } + + if (!is_null($users)) { + $apiParams['users'] = $users; + } + + if (!is_null($targets)) { + $apiParams['targets'] = $targets; + } + + if (!is_null($draft)) { + $apiParams['draft'] = $draft; + } + + if (!is_null($scheduledAt)) { + $apiParams['scheduledAt'] = $scheduledAt; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update SMS + * + * Update an email message by its unique ID. + * + * + * @param string $messageId + * @param ?array $topics + * @param ?array $users + * @param ?array $targets + * @param ?string $content + * @param ?bool $draft + * @param ?string $scheduledAt + * @throws AppwriteException + * @return array + */ + public function updateSms(string $messageId, ?array $topics = null, ?array $users = null, ?array $targets = null, ?string $content = null, ?bool $draft = null, ?string $scheduledAt = null): array + { + $apiPath = str_replace( + ['{messageId}'], + [$messageId], + '/messaging/messages/sms/{messageId}' + ); + + $apiParams = []; + $apiParams['messageId'] = $messageId; + + if (!is_null($topics)) { + $apiParams['topics'] = $topics; + } + + if (!is_null($users)) { + $apiParams['users'] = $users; + } + + if (!is_null($targets)) { + $apiParams['targets'] = $targets; + } + + if (!is_null($content)) { + $apiParams['content'] = $content; + } + + if (!is_null($draft)) { + $apiParams['draft'] = $draft; + } + + if (!is_null($scheduledAt)) { + $apiParams['scheduledAt'] = $scheduledAt; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get message + * + * Get a message by its unique ID. + * + * + * @param string $messageId + * @throws AppwriteException + * @return array + */ + public function getMessage(string $messageId): array + { + $apiPath = str_replace( + ['{messageId}'], + [$messageId], + '/messaging/messages/{messageId}' + ); + + $apiParams = []; + $apiParams['messageId'] = $messageId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Delete message + * + * Delete a message. If the message is not a draft or scheduled, but has been + * sent, this will not recall the message. + * + * @param string $messageId + * @throws AppwriteException + * @return string + */ + public function delete(string $messageId): string + { + $apiPath = str_replace( + ['{messageId}'], + [$messageId], + '/messaging/messages/{messageId}' + ); + + $apiParams = []; + $apiParams['messageId'] = $messageId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * List message logs + * + * Get the message activity logs listed by its unique ID. + * + * @param string $messageId + * @param ?array $queries + * @throws AppwriteException + * @return array + */ + public function listMessageLogs(string $messageId, ?array $queries = null): array + { + $apiPath = str_replace( + ['{messageId}'], + [$messageId], + '/messaging/messages/{messageId}/logs' + ); + + $apiParams = []; + $apiParams['messageId'] = $messageId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * List message targets + * + * Get a list of the targets associated with a message. + * + * @param string $messageId + * @param ?array $queries + * @throws AppwriteException + * @return array + */ + public function listTargets(string $messageId, ?array $queries = null): array + { + $apiPath = str_replace( + ['{messageId}'], + [$messageId], + '/messaging/messages/{messageId}/targets' + ); + + $apiParams = []; + $apiParams['messageId'] = $messageId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * List providers + * + * Get a list of all providers from the current Appwrite project. + * + * @param ?array $queries + * @param ?string $search + * @throws AppwriteException + * @return array + */ + public function listProviders(?array $queries = null, ?string $search = null): array + { + $apiPath = str_replace( + [], + [], + '/messaging/providers' + ); + + $apiParams = []; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + if (!is_null($search)) { + $apiParams['search'] = $search; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create APNS provider + * + * Create a new Apple Push Notification service provider. + * + * @param string $providerId + * @param string $name + * @param ?string $authKey + * @param ?string $authKeyId + * @param ?string $teamId + * @param ?string $bundleId + * @param ?bool $sandbox + * @param ?bool $enabled + * @throws AppwriteException + * @return array + */ + public function createApnsProvider(string $providerId, string $name, ?string $authKey = null, ?string $authKeyId = null, ?string $teamId = null, ?string $bundleId = null, ?bool $sandbox = null, ?bool $enabled = null): array + { + $apiPath = str_replace( + [], + [], + '/messaging/providers/apns' + ); + + $apiParams = []; + $apiParams['providerId'] = $providerId; + $apiParams['name'] = $name; + + if (!is_null($authKey)) { + $apiParams['authKey'] = $authKey; + } + + if (!is_null($authKeyId)) { + $apiParams['authKeyId'] = $authKeyId; + } + + if (!is_null($teamId)) { + $apiParams['teamId'] = $teamId; + } + + if (!is_null($bundleId)) { + $apiParams['bundleId'] = $bundleId; + } + + if (!is_null($sandbox)) { + $apiParams['sandbox'] = $sandbox; + } + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update APNS provider + * + * Update a Apple Push Notification service provider by its unique ID. + * + * @param string $providerId + * @param ?string $name + * @param ?bool $enabled + * @param ?string $authKey + * @param ?string $authKeyId + * @param ?string $teamId + * @param ?string $bundleId + * @param ?bool $sandbox + * @throws AppwriteException + * @return array + */ + public function updateApnsProvider(string $providerId, ?string $name = null, ?bool $enabled = null, ?string $authKey = null, ?string $authKeyId = null, ?string $teamId = null, ?string $bundleId = null, ?bool $sandbox = null): array + { + $apiPath = str_replace( + ['{providerId}'], + [$providerId], + '/messaging/providers/apns/{providerId}' + ); + + $apiParams = []; + $apiParams['providerId'] = $providerId; + + if (!is_null($name)) { + $apiParams['name'] = $name; + } + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + if (!is_null($authKey)) { + $apiParams['authKey'] = $authKey; + } + + if (!is_null($authKeyId)) { + $apiParams['authKeyId'] = $authKeyId; + } + + if (!is_null($teamId)) { + $apiParams['teamId'] = $teamId; + } + + if (!is_null($bundleId)) { + $apiParams['bundleId'] = $bundleId; + } + + if (!is_null($sandbox)) { + $apiParams['sandbox'] = $sandbox; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create FCM provider + * + * Create a new Firebase Cloud Messaging provider. + * + * @param string $providerId + * @param string $name + * @param ?array $serviceAccountJSON + * @param ?bool $enabled + * @throws AppwriteException + * @return array + */ + public function createFcmProvider(string $providerId, string $name, ?array $serviceAccountJSON = null, ?bool $enabled = null): array + { + $apiPath = str_replace( + [], + [], + '/messaging/providers/fcm' + ); + + $apiParams = []; + $apiParams['providerId'] = $providerId; + $apiParams['name'] = $name; + + if (!is_null($serviceAccountJSON)) { + $apiParams['serviceAccountJSON'] = $serviceAccountJSON; + } + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update FCM provider + * + * Update a Firebase Cloud Messaging provider by its unique ID. + * + * @param string $providerId + * @param ?string $name + * @param ?bool $enabled + * @param ?array $serviceAccountJSON + * @throws AppwriteException + * @return array + */ + public function updateFcmProvider(string $providerId, ?string $name = null, ?bool $enabled = null, ?array $serviceAccountJSON = null): array + { + $apiPath = str_replace( + ['{providerId}'], + [$providerId], + '/messaging/providers/fcm/{providerId}' + ); + + $apiParams = []; + $apiParams['providerId'] = $providerId; + + if (!is_null($name)) { + $apiParams['name'] = $name; + } + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + if (!is_null($serviceAccountJSON)) { + $apiParams['serviceAccountJSON'] = $serviceAccountJSON; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create Mailgun provider + * + * Create a new Mailgun provider. + * + * @param string $providerId + * @param string $name + * @param ?string $apiKey + * @param ?string $domain + * @param ?bool $isEuRegion + * @param ?string $fromName + * @param ?string $fromEmail + * @param ?string $replyToName + * @param ?string $replyToEmail + * @param ?bool $enabled + * @throws AppwriteException + * @return array + */ + public function createMailgunProvider(string $providerId, string $name, ?string $apiKey = null, ?string $domain = null, ?bool $isEuRegion = null, ?string $fromName = null, ?string $fromEmail = null, ?string $replyToName = null, ?string $replyToEmail = null, ?bool $enabled = null): array + { + $apiPath = str_replace( + [], + [], + '/messaging/providers/mailgun' + ); + + $apiParams = []; + $apiParams['providerId'] = $providerId; + $apiParams['name'] = $name; + + if (!is_null($apiKey)) { + $apiParams['apiKey'] = $apiKey; + } + + if (!is_null($domain)) { + $apiParams['domain'] = $domain; + } + + if (!is_null($isEuRegion)) { + $apiParams['isEuRegion'] = $isEuRegion; + } + + if (!is_null($fromName)) { + $apiParams['fromName'] = $fromName; + } + + if (!is_null($fromEmail)) { + $apiParams['fromEmail'] = $fromEmail; + } + + if (!is_null($replyToName)) { + $apiParams['replyToName'] = $replyToName; + } + + if (!is_null($replyToEmail)) { + $apiParams['replyToEmail'] = $replyToEmail; + } + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update Mailgun provider + * + * Update a Mailgun provider by its unique ID. + * + * @param string $providerId + * @param ?string $name + * @param ?string $apiKey + * @param ?string $domain + * @param ?bool $isEuRegion + * @param ?bool $enabled + * @param ?string $fromName + * @param ?string $fromEmail + * @param ?string $replyToName + * @param ?string $replyToEmail + * @throws AppwriteException + * @return array + */ + public function updateMailgunProvider(string $providerId, ?string $name = null, ?string $apiKey = null, ?string $domain = null, ?bool $isEuRegion = null, ?bool $enabled = null, ?string $fromName = null, ?string $fromEmail = null, ?string $replyToName = null, ?string $replyToEmail = null): array + { + $apiPath = str_replace( + ['{providerId}'], + [$providerId], + '/messaging/providers/mailgun/{providerId}' + ); + + $apiParams = []; + $apiParams['providerId'] = $providerId; + + if (!is_null($name)) { + $apiParams['name'] = $name; + } + + if (!is_null($apiKey)) { + $apiParams['apiKey'] = $apiKey; + } + + if (!is_null($domain)) { + $apiParams['domain'] = $domain; + } + + if (!is_null($isEuRegion)) { + $apiParams['isEuRegion'] = $isEuRegion; + } + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + if (!is_null($fromName)) { + $apiParams['fromName'] = $fromName; + } + + if (!is_null($fromEmail)) { + $apiParams['fromEmail'] = $fromEmail; + } + + if (!is_null($replyToName)) { + $apiParams['replyToName'] = $replyToName; + } + + if (!is_null($replyToEmail)) { + $apiParams['replyToEmail'] = $replyToEmail; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create Msg91 provider + * + * Create a new MSG91 provider. + * + * @param string $providerId + * @param string $name + * @param ?string $templateId + * @param ?string $senderId + * @param ?string $authKey + * @param ?bool $enabled + * @throws AppwriteException + * @return array + */ + public function createMsg91Provider(string $providerId, string $name, ?string $templateId = null, ?string $senderId = null, ?string $authKey = null, ?bool $enabled = null): array + { + $apiPath = str_replace( + [], + [], + '/messaging/providers/msg91' + ); + + $apiParams = []; + $apiParams['providerId'] = $providerId; + $apiParams['name'] = $name; + + if (!is_null($templateId)) { + $apiParams['templateId'] = $templateId; + } + + if (!is_null($senderId)) { + $apiParams['senderId'] = $senderId; + } + + if (!is_null($authKey)) { + $apiParams['authKey'] = $authKey; + } + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update Msg91 provider + * + * Update a MSG91 provider by its unique ID. + * + * @param string $providerId + * @param ?string $name + * @param ?bool $enabled + * @param ?string $templateId + * @param ?string $senderId + * @param ?string $authKey + * @throws AppwriteException + * @return array + */ + public function updateMsg91Provider(string $providerId, ?string $name = null, ?bool $enabled = null, ?string $templateId = null, ?string $senderId = null, ?string $authKey = null): array + { + $apiPath = str_replace( + ['{providerId}'], + [$providerId], + '/messaging/providers/msg91/{providerId}' + ); + + $apiParams = []; + $apiParams['providerId'] = $providerId; + + if (!is_null($name)) { + $apiParams['name'] = $name; + } + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + if (!is_null($templateId)) { + $apiParams['templateId'] = $templateId; + } + + if (!is_null($senderId)) { + $apiParams['senderId'] = $senderId; + } + + if (!is_null($authKey)) { + $apiParams['authKey'] = $authKey; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create Sendgrid provider + * + * Create a new Sendgrid provider. + * + * @param string $providerId + * @param string $name + * @param ?string $apiKey + * @param ?string $fromName + * @param ?string $fromEmail + * @param ?string $replyToName + * @param ?string $replyToEmail + * @param ?bool $enabled + * @throws AppwriteException + * @return array + */ + public function createSendgridProvider(string $providerId, string $name, ?string $apiKey = null, ?string $fromName = null, ?string $fromEmail = null, ?string $replyToName = null, ?string $replyToEmail = null, ?bool $enabled = null): array + { + $apiPath = str_replace( + [], + [], + '/messaging/providers/sendgrid' + ); + + $apiParams = []; + $apiParams['providerId'] = $providerId; + $apiParams['name'] = $name; + + if (!is_null($apiKey)) { + $apiParams['apiKey'] = $apiKey; + } + + if (!is_null($fromName)) { + $apiParams['fromName'] = $fromName; + } + + if (!is_null($fromEmail)) { + $apiParams['fromEmail'] = $fromEmail; + } + + if (!is_null($replyToName)) { + $apiParams['replyToName'] = $replyToName; + } + + if (!is_null($replyToEmail)) { + $apiParams['replyToEmail'] = $replyToEmail; + } + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update Sendgrid provider + * + * Update a Sendgrid provider by its unique ID. + * + * @param string $providerId + * @param ?string $name + * @param ?bool $enabled + * @param ?string $apiKey + * @param ?string $fromName + * @param ?string $fromEmail + * @param ?string $replyToName + * @param ?string $replyToEmail + * @throws AppwriteException + * @return array + */ + public function updateSendgridProvider(string $providerId, ?string $name = null, ?bool $enabled = null, ?string $apiKey = null, ?string $fromName = null, ?string $fromEmail = null, ?string $replyToName = null, ?string $replyToEmail = null): array + { + $apiPath = str_replace( + ['{providerId}'], + [$providerId], + '/messaging/providers/sendgrid/{providerId}' + ); + + $apiParams = []; + $apiParams['providerId'] = $providerId; + + if (!is_null($name)) { + $apiParams['name'] = $name; + } + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + if (!is_null($apiKey)) { + $apiParams['apiKey'] = $apiKey; + } + + if (!is_null($fromName)) { + $apiParams['fromName'] = $fromName; + } + + if (!is_null($fromEmail)) { + $apiParams['fromEmail'] = $fromEmail; + } + + if (!is_null($replyToName)) { + $apiParams['replyToName'] = $replyToName; + } + + if (!is_null($replyToEmail)) { + $apiParams['replyToEmail'] = $replyToEmail; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create SMTP provider + * + * Create a new SMTP provider. + * + * @param string $providerId + * @param string $name + * @param string $host + * @param ?int $port + * @param ?string $username + * @param ?string $password + * @param ?SmtpEncryption $encryption + * @param ?bool $autoTLS + * @param ?string $mailer + * @param ?string $fromName + * @param ?string $fromEmail + * @param ?string $replyToName + * @param ?string $replyToEmail + * @param ?bool $enabled + * @throws AppwriteException + * @return array + */ + public function createSmtpProvider(string $providerId, string $name, string $host, ?int $port = null, ?string $username = null, ?string $password = null, ?SmtpEncryption $encryption = null, ?bool $autoTLS = null, ?string $mailer = null, ?string $fromName = null, ?string $fromEmail = null, ?string $replyToName = null, ?string $replyToEmail = null, ?bool $enabled = null): array + { + $apiPath = str_replace( + [], + [], + '/messaging/providers/smtp' + ); + + $apiParams = []; + $apiParams['providerId'] = $providerId; + $apiParams['name'] = $name; + $apiParams['host'] = $host; + + if (!is_null($port)) { + $apiParams['port'] = $port; + } + + if (!is_null($username)) { + $apiParams['username'] = $username; + } + + if (!is_null($password)) { + $apiParams['password'] = $password; + } + + if (!is_null($encryption)) { + $apiParams['encryption'] = $encryption; + } + + if (!is_null($autoTLS)) { + $apiParams['autoTLS'] = $autoTLS; + } + + if (!is_null($mailer)) { + $apiParams['mailer'] = $mailer; + } + + if (!is_null($fromName)) { + $apiParams['fromName'] = $fromName; + } + + if (!is_null($fromEmail)) { + $apiParams['fromEmail'] = $fromEmail; + } + + if (!is_null($replyToName)) { + $apiParams['replyToName'] = $replyToName; + } + + if (!is_null($replyToEmail)) { + $apiParams['replyToEmail'] = $replyToEmail; + } + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update SMTP provider + * + * Update a SMTP provider by its unique ID. + * + * @param string $providerId + * @param ?string $name + * @param ?string $host + * @param ?int $port + * @param ?string $username + * @param ?string $password + * @param ?SmtpEncryption $encryption + * @param ?bool $autoTLS + * @param ?string $mailer + * @param ?string $fromName + * @param ?string $fromEmail + * @param ?string $replyToName + * @param ?string $replyToEmail + * @param ?bool $enabled + * @throws AppwriteException + * @return array + */ + public function updateSmtpProvider(string $providerId, ?string $name = null, ?string $host = null, ?int $port = null, ?string $username = null, ?string $password = null, ?SmtpEncryption $encryption = null, ?bool $autoTLS = null, ?string $mailer = null, ?string $fromName = null, ?string $fromEmail = null, ?string $replyToName = null, ?string $replyToEmail = null, ?bool $enabled = null): array + { + $apiPath = str_replace( + ['{providerId}'], + [$providerId], + '/messaging/providers/smtp/{providerId}' + ); + + $apiParams = []; + $apiParams['providerId'] = $providerId; + + if (!is_null($name)) { + $apiParams['name'] = $name; + } + + if (!is_null($host)) { + $apiParams['host'] = $host; + } + + if (!is_null($port)) { + $apiParams['port'] = $port; + } + + if (!is_null($username)) { + $apiParams['username'] = $username; + } + + if (!is_null($password)) { + $apiParams['password'] = $password; + } + + if (!is_null($encryption)) { + $apiParams['encryption'] = $encryption; + } + + if (!is_null($autoTLS)) { + $apiParams['autoTLS'] = $autoTLS; + } + + if (!is_null($mailer)) { + $apiParams['mailer'] = $mailer; + } + + if (!is_null($fromName)) { + $apiParams['fromName'] = $fromName; + } + + if (!is_null($fromEmail)) { + $apiParams['fromEmail'] = $fromEmail; + } + + if (!is_null($replyToName)) { + $apiParams['replyToName'] = $replyToName; + } + + if (!is_null($replyToEmail)) { + $apiParams['replyToEmail'] = $replyToEmail; + } + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create Telesign provider + * + * Create a new Telesign provider. + * + * @param string $providerId + * @param string $name + * @param ?string $from + * @param ?string $customerId + * @param ?string $apiKey + * @param ?bool $enabled + * @throws AppwriteException + * @return array + */ + public function createTelesignProvider(string $providerId, string $name, ?string $from = null, ?string $customerId = null, ?string $apiKey = null, ?bool $enabled = null): array + { + $apiPath = str_replace( + [], + [], + '/messaging/providers/telesign' + ); + + $apiParams = []; + $apiParams['providerId'] = $providerId; + $apiParams['name'] = $name; + + if (!is_null($from)) { + $apiParams['from'] = $from; + } + + if (!is_null($customerId)) { + $apiParams['customerId'] = $customerId; + } + + if (!is_null($apiKey)) { + $apiParams['apiKey'] = $apiKey; + } + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update Telesign provider + * + * Update a Telesign provider by its unique ID. + * + * @param string $providerId + * @param ?string $name + * @param ?bool $enabled + * @param ?string $customerId + * @param ?string $apiKey + * @param ?string $from + * @throws AppwriteException + * @return array + */ + public function updateTelesignProvider(string $providerId, ?string $name = null, ?bool $enabled = null, ?string $customerId = null, ?string $apiKey = null, ?string $from = null): array + { + $apiPath = str_replace( + ['{providerId}'], + [$providerId], + '/messaging/providers/telesign/{providerId}' + ); + + $apiParams = []; + $apiParams['providerId'] = $providerId; + + if (!is_null($name)) { + $apiParams['name'] = $name; + } + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + if (!is_null($customerId)) { + $apiParams['customerId'] = $customerId; + } + + if (!is_null($apiKey)) { + $apiParams['apiKey'] = $apiKey; + } + + if (!is_null($from)) { + $apiParams['from'] = $from; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create Textmagic provider + * + * Create a new Textmagic provider. + * + * @param string $providerId + * @param string $name + * @param ?string $from + * @param ?string $username + * @param ?string $apiKey + * @param ?bool $enabled + * @throws AppwriteException + * @return array + */ + public function createTextmagicProvider(string $providerId, string $name, ?string $from = null, ?string $username = null, ?string $apiKey = null, ?bool $enabled = null): array + { + $apiPath = str_replace( + [], + [], + '/messaging/providers/textmagic' + ); + + $apiParams = []; + $apiParams['providerId'] = $providerId; + $apiParams['name'] = $name; + + if (!is_null($from)) { + $apiParams['from'] = $from; + } + + if (!is_null($username)) { + $apiParams['username'] = $username; + } + + if (!is_null($apiKey)) { + $apiParams['apiKey'] = $apiKey; + } + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update Textmagic provider + * + * Update a Textmagic provider by its unique ID. + * + * @param string $providerId + * @param ?string $name + * @param ?bool $enabled + * @param ?string $username + * @param ?string $apiKey + * @param ?string $from + * @throws AppwriteException + * @return array + */ + public function updateTextmagicProvider(string $providerId, ?string $name = null, ?bool $enabled = null, ?string $username = null, ?string $apiKey = null, ?string $from = null): array + { + $apiPath = str_replace( + ['{providerId}'], + [$providerId], + '/messaging/providers/textmagic/{providerId}' + ); + + $apiParams = []; + $apiParams['providerId'] = $providerId; + + if (!is_null($name)) { + $apiParams['name'] = $name; + } + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + if (!is_null($username)) { + $apiParams['username'] = $username; + } + + if (!is_null($apiKey)) { + $apiParams['apiKey'] = $apiKey; + } + + if (!is_null($from)) { + $apiParams['from'] = $from; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create Twilio provider + * + * Create a new Twilio provider. + * + * @param string $providerId + * @param string $name + * @param ?string $from + * @param ?string $accountSid + * @param ?string $authToken + * @param ?bool $enabled + * @throws AppwriteException + * @return array + */ + public function createTwilioProvider(string $providerId, string $name, ?string $from = null, ?string $accountSid = null, ?string $authToken = null, ?bool $enabled = null): array + { + $apiPath = str_replace( + [], + [], + '/messaging/providers/twilio' + ); + + $apiParams = []; + $apiParams['providerId'] = $providerId; + $apiParams['name'] = $name; + + if (!is_null($from)) { + $apiParams['from'] = $from; + } + + if (!is_null($accountSid)) { + $apiParams['accountSid'] = $accountSid; + } + + if (!is_null($authToken)) { + $apiParams['authToken'] = $authToken; + } + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update Twilio provider + * + * Update a Twilio provider by its unique ID. + * + * @param string $providerId + * @param ?string $name + * @param ?bool $enabled + * @param ?string $accountSid + * @param ?string $authToken + * @param ?string $from + * @throws AppwriteException + * @return array + */ + public function updateTwilioProvider(string $providerId, ?string $name = null, ?bool $enabled = null, ?string $accountSid = null, ?string $authToken = null, ?string $from = null): array + { + $apiPath = str_replace( + ['{providerId}'], + [$providerId], + '/messaging/providers/twilio/{providerId}' + ); + + $apiParams = []; + $apiParams['providerId'] = $providerId; + + if (!is_null($name)) { + $apiParams['name'] = $name; + } + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + if (!is_null($accountSid)) { + $apiParams['accountSid'] = $accountSid; + } + + if (!is_null($authToken)) { + $apiParams['authToken'] = $authToken; + } + + if (!is_null($from)) { + $apiParams['from'] = $from; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create Vonage provider + * + * Create a new Vonage provider. + * + * @param string $providerId + * @param string $name + * @param ?string $from + * @param ?string $apiKey + * @param ?string $apiSecret + * @param ?bool $enabled + * @throws AppwriteException + * @return array + */ + public function createVonageProvider(string $providerId, string $name, ?string $from = null, ?string $apiKey = null, ?string $apiSecret = null, ?bool $enabled = null): array + { + $apiPath = str_replace( + [], + [], + '/messaging/providers/vonage' + ); + + $apiParams = []; + $apiParams['providerId'] = $providerId; + $apiParams['name'] = $name; + + if (!is_null($from)) { + $apiParams['from'] = $from; + } + + if (!is_null($apiKey)) { + $apiParams['apiKey'] = $apiKey; + } + + if (!is_null($apiSecret)) { + $apiParams['apiSecret'] = $apiSecret; + } + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update Vonage provider + * + * Update a Vonage provider by its unique ID. + * + * @param string $providerId + * @param ?string $name + * @param ?bool $enabled + * @param ?string $apiKey + * @param ?string $apiSecret + * @param ?string $from + * @throws AppwriteException + * @return array + */ + public function updateVonageProvider(string $providerId, ?string $name = null, ?bool $enabled = null, ?string $apiKey = null, ?string $apiSecret = null, ?string $from = null): array + { + $apiPath = str_replace( + ['{providerId}'], + [$providerId], + '/messaging/providers/vonage/{providerId}' + ); + + $apiParams = []; + $apiParams['providerId'] = $providerId; + + if (!is_null($name)) { + $apiParams['name'] = $name; + } + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + if (!is_null($apiKey)) { + $apiParams['apiKey'] = $apiKey; + } + + if (!is_null($apiSecret)) { + $apiParams['apiSecret'] = $apiSecret; + } + + if (!is_null($from)) { + $apiParams['from'] = $from; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get provider + * + * Get a provider by its unique ID. + * + * + * @param string $providerId + * @throws AppwriteException + * @return array + */ + public function getProvider(string $providerId): array + { + $apiPath = str_replace( + ['{providerId}'], + [$providerId], + '/messaging/providers/{providerId}' + ); + + $apiParams = []; + $apiParams['providerId'] = $providerId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Delete provider + * + * Delete a provider by its unique ID. + * + * @param string $providerId + * @throws AppwriteException + * @return string + */ + public function deleteProvider(string $providerId): string + { + $apiPath = str_replace( + ['{providerId}'], + [$providerId], + '/messaging/providers/{providerId}' + ); + + $apiParams = []; + $apiParams['providerId'] = $providerId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * List provider logs + * + * Get the provider activity logs listed by its unique ID. + * + * @param string $providerId + * @param ?array $queries + * @throws AppwriteException + * @return array + */ + public function listProviderLogs(string $providerId, ?array $queries = null): array + { + $apiPath = str_replace( + ['{providerId}'], + [$providerId], + '/messaging/providers/{providerId}/logs' + ); + + $apiParams = []; + $apiParams['providerId'] = $providerId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * List subscriber logs + * + * Get the subscriber activity logs listed by its unique ID. + * + * @param string $subscriberId + * @param ?array $queries + * @throws AppwriteException + * @return array + */ + public function listSubscriberLogs(string $subscriberId, ?array $queries = null): array + { + $apiPath = str_replace( + ['{subscriberId}'], + [$subscriberId], + '/messaging/subscribers/{subscriberId}/logs' + ); + + $apiParams = []; + $apiParams['subscriberId'] = $subscriberId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * List topics + * + * Get a list of all topics from the current Appwrite project. + * + * @param ?array $queries + * @param ?string $search + * @throws AppwriteException + * @return array + */ + public function listTopics(?array $queries = null, ?string $search = null): array + { + $apiPath = str_replace( + [], + [], + '/messaging/topics' + ); + + $apiParams = []; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + if (!is_null($search)) { + $apiParams['search'] = $search; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create topic + * + * Create a new topic. + * + * @param string $topicId + * @param string $name + * @param ?array $subscribe + * @throws AppwriteException + * @return array + */ + public function createTopic(string $topicId, string $name, ?array $subscribe = null): array + { + $apiPath = str_replace( + [], + [], + '/messaging/topics' + ); + + $apiParams = []; + $apiParams['topicId'] = $topicId; + $apiParams['name'] = $name; + + if (!is_null($subscribe)) { + $apiParams['subscribe'] = $subscribe; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get topic + * + * Get a topic by its unique ID. + * + * + * @param string $topicId + * @throws AppwriteException + * @return array + */ + public function getTopic(string $topicId): array + { + $apiPath = str_replace( + ['{topicId}'], + [$topicId], + '/messaging/topics/{topicId}' + ); + + $apiParams = []; + $apiParams['topicId'] = $topicId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update topic + * + * Update a topic by its unique ID. + * + * + * @param string $topicId + * @param ?string $name + * @param ?array $subscribe + * @throws AppwriteException + * @return array + */ + public function updateTopic(string $topicId, ?string $name = null, ?array $subscribe = null): array + { + $apiPath = str_replace( + ['{topicId}'], + [$topicId], + '/messaging/topics/{topicId}' + ); + + $apiParams = []; + $apiParams['topicId'] = $topicId; + + if (!is_null($name)) { + $apiParams['name'] = $name; + } + + if (!is_null($subscribe)) { + $apiParams['subscribe'] = $subscribe; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Delete topic + * + * Delete a topic by its unique ID. + * + * @param string $topicId + * @throws AppwriteException + * @return string + */ + public function deleteTopic(string $topicId): string + { + $apiPath = str_replace( + ['{topicId}'], + [$topicId], + '/messaging/topics/{topicId}' + ); + + $apiParams = []; + $apiParams['topicId'] = $topicId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * List topic logs + * + * Get the topic activity logs listed by its unique ID. + * + * @param string $topicId + * @param ?array $queries + * @throws AppwriteException + * @return array + */ + public function listTopicLogs(string $topicId, ?array $queries = null): array + { + $apiPath = str_replace( + ['{topicId}'], + [$topicId], + '/messaging/topics/{topicId}/logs' + ); + + $apiParams = []; + $apiParams['topicId'] = $topicId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * List subscribers + * + * Get a list of all subscribers from the current Appwrite project. + * + * @param string $topicId + * @param ?array $queries + * @param ?string $search + * @throws AppwriteException + * @return array + */ + public function listSubscribers(string $topicId, ?array $queries = null, ?string $search = null): array + { + $apiPath = str_replace( + ['{topicId}'], + [$topicId], + '/messaging/topics/{topicId}/subscribers' + ); + + $apiParams = []; + $apiParams['topicId'] = $topicId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + if (!is_null($search)) { + $apiParams['search'] = $search; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create subscriber + * + * Create a new subscriber. + * + * @param string $topicId + * @param string $subscriberId + * @param string $targetId + * @throws AppwriteException + * @return array + */ + public function createSubscriber(string $topicId, string $subscriberId, string $targetId): array + { + $apiPath = str_replace( + ['{topicId}'], + [$topicId], + '/messaging/topics/{topicId}/subscribers' + ); + + $apiParams = []; + $apiParams['topicId'] = $topicId; + $apiParams['subscriberId'] = $subscriberId; + $apiParams['targetId'] = $targetId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get subscriber + * + * Get a subscriber by its unique ID. + * + * + * @param string $topicId + * @param string $subscriberId + * @throws AppwriteException + * @return array + */ + public function getSubscriber(string $topicId, string $subscriberId): array + { + $apiPath = str_replace( + ['{topicId}', '{subscriberId}'], + [$topicId, $subscriberId], + '/messaging/topics/{topicId}/subscribers/{subscriberId}' + ); + + $apiParams = []; + $apiParams['topicId'] = $topicId; + $apiParams['subscriberId'] = $subscriberId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Delete subscriber + * + * Delete a subscriber by its unique ID. + * + * @param string $topicId + * @param string $subscriberId + * @throws AppwriteException + * @return string + */ + public function deleteSubscriber(string $topicId, string $subscriberId): string + { + $apiPath = str_replace( + ['{topicId}', '{subscriberId}'], + [$topicId, $subscriberId], + '/messaging/topics/{topicId}/subscribers/{subscriberId}' + ); + + $apiParams = []; + $apiParams['topicId'] = $topicId; + $apiParams['subscriberId'] = $subscriberId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } +} \ No newline at end of file diff --git a/src/Appwrite/Services/Storage.php b/src/Appwrite/Services/Storage.php new file mode 100644 index 0000000..fd2ebf9 --- /dev/null +++ b/src/Appwrite/Services/Storage.php @@ -0,0 +1,713 @@ +<?php + +namespace Appwrite\Services; + +use Appwrite\AppwriteException; +use Appwrite\Client; +use Appwrite\Service; +use Appwrite\InputFile; +use Appwrite\Enums\Compression; +use Appwrite\Enums\ImageGravity; +use Appwrite\Enums\ImageFormat; + +class Storage extends Service +{ + public function __construct(Client $client) + { + parent::__construct($client); + } + + /** + * List buckets + * + * Get a list of all the storage buckets. You can use the query params to + * filter your results. + * + * @param ?array $queries + * @param ?string $search + * @throws AppwriteException + * @return array + */ + public function listBuckets(?array $queries = null, ?string $search = null): array + { + $apiPath = str_replace( + [], + [], + '/storage/buckets' + ); + + $apiParams = []; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + if (!is_null($search)) { + $apiParams['search'] = $search; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create bucket + * + * Create a new storage bucket. + * + * @param string $bucketId + * @param string $name + * @param ?array $permissions + * @param ?bool $fileSecurity + * @param ?bool $enabled + * @param ?int $maximumFileSize + * @param ?array $allowedFileExtensions + * @param ?Compression $compression + * @param ?bool $encryption + * @param ?bool $antivirus + * @throws AppwriteException + * @return array + */ + public function createBucket(string $bucketId, string $name, ?array $permissions = null, ?bool $fileSecurity = null, ?bool $enabled = null, ?int $maximumFileSize = null, ?array $allowedFileExtensions = null, ?Compression $compression = null, ?bool $encryption = null, ?bool $antivirus = null): array + { + $apiPath = str_replace( + [], + [], + '/storage/buckets' + ); + + $apiParams = []; + $apiParams['bucketId'] = $bucketId; + $apiParams['name'] = $name; + + if (!is_null($permissions)) { + $apiParams['permissions'] = $permissions; + } + + if (!is_null($fileSecurity)) { + $apiParams['fileSecurity'] = $fileSecurity; + } + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + if (!is_null($maximumFileSize)) { + $apiParams['maximumFileSize'] = $maximumFileSize; + } + + if (!is_null($allowedFileExtensions)) { + $apiParams['allowedFileExtensions'] = $allowedFileExtensions; + } + + if (!is_null($compression)) { + $apiParams['compression'] = $compression; + } + + if (!is_null($encryption)) { + $apiParams['encryption'] = $encryption; + } + + if (!is_null($antivirus)) { + $apiParams['antivirus'] = $antivirus; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get bucket + * + * Get a storage bucket by its unique ID. This endpoint response returns a + * JSON object with the storage bucket metadata. + * + * @param string $bucketId + * @throws AppwriteException + * @return array + */ + public function getBucket(string $bucketId): array + { + $apiPath = str_replace( + ['{bucketId}'], + [$bucketId], + '/storage/buckets/{bucketId}' + ); + + $apiParams = []; + $apiParams['bucketId'] = $bucketId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update bucket + * + * Update a storage bucket by its unique ID. + * + * @param string $bucketId + * @param string $name + * @param ?array $permissions + * @param ?bool $fileSecurity + * @param ?bool $enabled + * @param ?int $maximumFileSize + * @param ?array $allowedFileExtensions + * @param ?Compression $compression + * @param ?bool $encryption + * @param ?bool $antivirus + * @throws AppwriteException + * @return array + */ + public function updateBucket(string $bucketId, string $name, ?array $permissions = null, ?bool $fileSecurity = null, ?bool $enabled = null, ?int $maximumFileSize = null, ?array $allowedFileExtensions = null, ?Compression $compression = null, ?bool $encryption = null, ?bool $antivirus = null): array + { + $apiPath = str_replace( + ['{bucketId}'], + [$bucketId], + '/storage/buckets/{bucketId}' + ); + + $apiParams = []; + $apiParams['bucketId'] = $bucketId; + $apiParams['name'] = $name; + + if (!is_null($permissions)) { + $apiParams['permissions'] = $permissions; + } + + if (!is_null($fileSecurity)) { + $apiParams['fileSecurity'] = $fileSecurity; + } + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + if (!is_null($maximumFileSize)) { + $apiParams['maximumFileSize'] = $maximumFileSize; + } + + if (!is_null($allowedFileExtensions)) { + $apiParams['allowedFileExtensions'] = $allowedFileExtensions; + } + + if (!is_null($compression)) { + $apiParams['compression'] = $compression; + } + + if (!is_null($encryption)) { + $apiParams['encryption'] = $encryption; + } + + if (!is_null($antivirus)) { + $apiParams['antivirus'] = $antivirus; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PUT, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Delete bucket + * + * Delete a storage bucket by its unique ID. + * + * @param string $bucketId + * @throws AppwriteException + * @return string + */ + public function deleteBucket(string $bucketId): string + { + $apiPath = str_replace( + ['{bucketId}'], + [$bucketId], + '/storage/buckets/{bucketId}' + ); + + $apiParams = []; + $apiParams['bucketId'] = $bucketId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * List files + * + * Get a list of all the user files. You can use the query params to filter + * your results. + * + * @param string $bucketId + * @param ?array $queries + * @param ?string $search + * @throws AppwriteException + * @return array + */ + public function listFiles(string $bucketId, ?array $queries = null, ?string $search = null): array + { + $apiPath = str_replace( + ['{bucketId}'], + [$bucketId], + '/storage/buckets/{bucketId}/files' + ); + + $apiParams = []; + $apiParams['bucketId'] = $bucketId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + if (!is_null($search)) { + $apiParams['search'] = $search; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create file + * + * Create a new file. Before using this route, you should create a new bucket + * resource using either a [server + * integration](https://appwrite.io/docs/server/storage#storageCreateBucket) + * API or directly from your Appwrite console. + * + * Larger files should be uploaded using multiple requests with the + * [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) + * header to send a partial request with a maximum supported chunk of `5MB`. + * The `content-range` header values should always be in bytes. + * + * When the first request is sent, the server will return the **File** object, + * and the subsequent part request must include the file's **id** in + * `x-appwrite-id` header to allow the server to know that the partial upload + * is for the existing file and not for a new one. + * + * If you're creating a new file using one of the Appwrite SDKs, all the + * chunking logic will be managed by the SDK internally. + * + * + * @param string $bucketId + * @param string $fileId + * @param InputFile $file + * @param ?array $permissions + * @throws AppwriteException + * @return array + */ + public function createFile(string $bucketId, string $fileId, InputFile $file, ?array $permissions = null, callable $onProgress = null): array + { + $apiPath = str_replace( + ['{bucketId}'], + [$bucketId], + '/storage/buckets/{bucketId}/files' + ); + + $apiParams = []; + $apiParams['bucketId'] = $bucketId; + $apiParams['fileId'] = $fileId; + $apiParams['file'] = $file; + + if (!is_null($permissions)) { + $apiParams['permissions'] = $permissions; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'multipart/form-data'; + $size = 0; + $mimeType = null; + $postedName = null; + if(empty($file->getPath() ?? null)) { + $size = strlen($file->getData()); + $mimeType = $file->getMimeType(); + $postedName = $file->getFilename(); + if ($size <= Client::CHUNK_SIZE) { + $apiParams['file'] = new \CURLFile('data://' . $mimeType . ';base64,' . base64_encode($file->getData()), $mimeType, $postedName); + return $this->client->call(Client::METHOD_POST, $apiPath, [ + 'content-type' => 'multipart/form-data', + ], $apiParams); + } + } 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'] = new \CURLFile($file->getPath(), $mimeType, $postedName); + return $this->client->call(Client::METHOD_POST, $apiPath, [ + 'content-type' => 'multipart/form-data', + ], $apiParams); + } + } + + $id = ''; + $counter = 0; + + if($fileId != 'unique()') { + try { + $response = $this->client->call(Client::METHOD_GET, $apiPath . '/' . $fileId); + $counter = $response['chunksUploaded'] ?? 0; + } catch(\Exception $e) { + } + } + + $apiHeaders = ['content-type' => 'multipart/form-data']; + $handle = null; + + if(!empty($file->getPath())) { + $handle = @fopen($file->getPath(), "rb"); + } + + $start = $counter * Client::CHUNK_SIZE; + while ($start < $size) { + $chunk = ''; + if(!empty($handle)) { + fseek($handle, $start); + $chunk = @fread($handle, Client::CHUNK_SIZE); + } else { + $chunk = substr($file->getData(), $start, Client::CHUNK_SIZE); + } + $apiParams['file'] = new \CURLFile('data://' . $mimeType . ';base64,' . base64_encode($chunk), $mimeType, $postedName); + $apiHeaders['content-range'] = 'bytes ' . ($counter * Client::CHUNK_SIZE) . '-' . min(((($counter * Client::CHUNK_SIZE) + Client::CHUNK_SIZE) - 1), $size - 1) . '/' . $size; + if(!empty($id)) { + $apiHeaders['x-appwrite-id'] = $id; + } + $response = $this->client->call(Client::METHOD_POST, $apiPath, $apiHeaders, $apiParams); + $counter++; + $start += Client::CHUNK_SIZE; + if(empty($id)) { + $id = $response['$id']; + } + if($onProgress !== null) { + $onProgress([ + '$id' => $response['$id'], + 'progress' => min(((($counter * Client::CHUNK_SIZE) + Client::CHUNK_SIZE)), $size) / $size * 100, + 'sizeUploaded' => min($counter * Client::CHUNK_SIZE), + 'chunksTotal' => $response['chunksTotal'], + 'chunksUploaded' => $response['chunksUploaded'], + ]); + } + } + if(!empty($handle)) { + @fclose($handle); + } + return $response; + + } + + /** + * Get file + * + * Get a file by its unique ID. This endpoint response returns a JSON object + * with the file metadata. + * + * @param string $bucketId + * @param string $fileId + * @throws AppwriteException + * @return array + */ + public function getFile(string $bucketId, string $fileId): array + { + $apiPath = str_replace( + ['{bucketId}', '{fileId}'], + [$bucketId, $fileId], + '/storage/buckets/{bucketId}/files/{fileId}' + ); + + $apiParams = []; + $apiParams['bucketId'] = $bucketId; + $apiParams['fileId'] = $fileId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update file + * + * Update a file by its unique ID. Only users with write permissions have + * access to update this resource. + * + * @param string $bucketId + * @param string $fileId + * @param ?string $name + * @param ?array $permissions + * @throws AppwriteException + * @return array + */ + public function updateFile(string $bucketId, string $fileId, ?string $name = null, ?array $permissions = null): array + { + $apiPath = str_replace( + ['{bucketId}', '{fileId}'], + [$bucketId, $fileId], + '/storage/buckets/{bucketId}/files/{fileId}' + ); + + $apiParams = []; + $apiParams['bucketId'] = $bucketId; + $apiParams['fileId'] = $fileId; + + if (!is_null($name)) { + $apiParams['name'] = $name; + } + + if (!is_null($permissions)) { + $apiParams['permissions'] = $permissions; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PUT, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Delete File + * + * Delete a file by its unique ID. Only users with write permissions have + * access to delete this resource. + * + * @param string $bucketId + * @param string $fileId + * @throws AppwriteException + * @return string + */ + public function deleteFile(string $bucketId, string $fileId): string + { + $apiPath = str_replace( + ['{bucketId}', '{fileId}'], + [$bucketId, $fileId], + '/storage/buckets/{bucketId}/files/{fileId}' + ); + + $apiParams = []; + $apiParams['bucketId'] = $bucketId; + $apiParams['fileId'] = $fileId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get file for download + * + * Get a file content by its unique ID. The endpoint response return with a + * 'Content-Disposition: attachment' header that tells the browser to start + * downloading the file to user downloads directory. + * + * @param string $bucketId + * @param string $fileId + * @throws AppwriteException + * @return string + */ + public function getFileDownload(string $bucketId, string $fileId): string + { + $apiPath = str_replace( + ['{bucketId}', '{fileId}'], + [$bucketId, $fileId], + '/storage/buckets/{bucketId}/files/{fileId}/download' + ); + + $apiParams = []; + $apiParams['bucketId'] = $bucketId; + $apiParams['fileId'] = $fileId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get file preview + * + * Get a file preview image. Currently, this method supports preview for image + * files (jpg, png, and gif), other supported formats, like pdf, docs, slides, + * and spreadsheets, will return the file icon image. You can also pass query + * string arguments for cutting and resizing your preview image. Preview is + * supported only for image files smaller than 10MB. + * + * @param string $bucketId + * @param string $fileId + * @param ?int $width + * @param ?int $height + * @param ?ImageGravity $gravity + * @param ?int $quality + * @param ?int $borderWidth + * @param ?string $borderColor + * @param ?int $borderRadius + * @param ?float $opacity + * @param ?int $rotation + * @param ?string $background + * @param ?ImageFormat $output + * @throws AppwriteException + * @return string + */ + public function getFilePreview(string $bucketId, string $fileId, ?int $width = null, ?int $height = null, ?ImageGravity $gravity = null, ?int $quality = null, ?int $borderWidth = null, ?string $borderColor = null, ?int $borderRadius = null, ?float $opacity = null, ?int $rotation = null, ?string $background = null, ?ImageFormat $output = null): string + { + $apiPath = str_replace( + ['{bucketId}', '{fileId}'], + [$bucketId, $fileId], + '/storage/buckets/{bucketId}/files/{fileId}/preview' + ); + + $apiParams = []; + $apiParams['bucketId'] = $bucketId; + $apiParams['fileId'] = $fileId; + + if (!is_null($width)) { + $apiParams['width'] = $width; + } + + if (!is_null($height)) { + $apiParams['height'] = $height; + } + + if (!is_null($gravity)) { + $apiParams['gravity'] = $gravity; + } + + if (!is_null($quality)) { + $apiParams['quality'] = $quality; + } + + if (!is_null($borderWidth)) { + $apiParams['borderWidth'] = $borderWidth; + } + + if (!is_null($borderColor)) { + $apiParams['borderColor'] = $borderColor; + } + + if (!is_null($borderRadius)) { + $apiParams['borderRadius'] = $borderRadius; + } + + if (!is_null($opacity)) { + $apiParams['opacity'] = $opacity; + } + + if (!is_null($rotation)) { + $apiParams['rotation'] = $rotation; + } + + if (!is_null($background)) { + $apiParams['background'] = $background; + } + + if (!is_null($output)) { + $apiParams['output'] = $output; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get file for view + * + * Get a file content by its unique ID. This endpoint is similar to the + * download method but returns with no 'Content-Disposition: attachment' + * header. + * + * @param string $bucketId + * @param string $fileId + * @throws AppwriteException + * @return string + */ + public function getFileView(string $bucketId, string $fileId): string + { + $apiPath = str_replace( + ['{bucketId}', '{fileId}'], + [$bucketId, $fileId], + '/storage/buckets/{bucketId}/files/{fileId}/view' + ); + + $apiParams = []; + $apiParams['bucketId'] = $bucketId; + $apiParams['fileId'] = $fileId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } +} \ No newline at end of file diff --git a/src/Appwrite/Services/Teams.php b/src/Appwrite/Services/Teams.php new file mode 100644 index 0000000..53c35b1 --- /dev/null +++ b/src/Appwrite/Services/Teams.php @@ -0,0 +1,530 @@ +<?php + +namespace Appwrite\Services; + +use Appwrite\AppwriteException; +use Appwrite\Client; +use Appwrite\Service; +use Appwrite\InputFile; + +class Teams extends Service +{ + public function __construct(Client $client) + { + parent::__construct($client); + } + + /** + * List teams + * + * Get a list of all the teams in which the current user is a member. You can + * use the parameters to filter your results. + * + * @param ?array $queries + * @param ?string $search + * @throws AppwriteException + * @return array + */ + public function list(?array $queries = null, ?string $search = null): array + { + $apiPath = str_replace( + [], + [], + '/teams' + ); + + $apiParams = []; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + if (!is_null($search)) { + $apiParams['search'] = $search; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create team + * + * Create a new team. The user who creates the team will automatically be + * assigned as the owner of the team. Only the users with the owner role can + * invite new members, add new owners and delete or update the team. + * + * @param string $teamId + * @param string $name + * @param ?array $roles + * @throws AppwriteException + * @return array + */ + public function create(string $teamId, string $name, ?array $roles = null): array + { + $apiPath = str_replace( + [], + [], + '/teams' + ); + + $apiParams = []; + $apiParams['teamId'] = $teamId; + $apiParams['name'] = $name; + + if (!is_null($roles)) { + $apiParams['roles'] = $roles; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get team + * + * Get a team by its ID. All team members have read access for this resource. + * + * @param string $teamId + * @throws AppwriteException + * @return array + */ + public function get(string $teamId): array + { + $apiPath = str_replace( + ['{teamId}'], + [$teamId], + '/teams/{teamId}' + ); + + $apiParams = []; + $apiParams['teamId'] = $teamId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update name + * + * Update the team's name by its unique ID. + * + * @param string $teamId + * @param string $name + * @throws AppwriteException + * @return array + */ + public function updateName(string $teamId, string $name): array + { + $apiPath = str_replace( + ['{teamId}'], + [$teamId], + '/teams/{teamId}' + ); + + $apiParams = []; + $apiParams['teamId'] = $teamId; + $apiParams['name'] = $name; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PUT, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Delete team + * + * Delete a team using its ID. Only team members with the owner role can + * delete the team. + * + * @param string $teamId + * @throws AppwriteException + * @return string + */ + public function delete(string $teamId): string + { + $apiPath = str_replace( + ['{teamId}'], + [$teamId], + '/teams/{teamId}' + ); + + $apiParams = []; + $apiParams['teamId'] = $teamId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * List team memberships + * + * Use this endpoint to list a team's members using the team's ID. All team + * members have read access to this endpoint. + * + * @param string $teamId + * @param ?array $queries + * @param ?string $search + * @throws AppwriteException + * @return array + */ + public function listMemberships(string $teamId, ?array $queries = null, ?string $search = null): array + { + $apiPath = str_replace( + ['{teamId}'], + [$teamId], + '/teams/{teamId}/memberships' + ); + + $apiParams = []; + $apiParams['teamId'] = $teamId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + if (!is_null($search)) { + $apiParams['search'] = $search; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create team membership + * + * Invite a new member to join your team. Provide an ID for existing users, or + * invite unregistered users using an email or phone number. If initiated from + * a Client SDK, Appwrite will send an email or sms with a link to join the + * team to the invited user, and an account will be created for them if one + * doesn't exist. If initiated from a Server SDK, the new member will be added + * automatically to the team. + * + * You only need to provide one of a user ID, email, or phone number. Appwrite + * will prioritize accepting the user ID > email > phone number if you provide + * more than one of these parameters. + * + * Use the `url` parameter to redirect the user from the invitation email to + * your app. After the user is redirected, use the [Update Team Membership + * Status](https://appwrite.io/docs/references/cloud/client-web/teams#updateMembershipStatus) + * endpoint to allow the user to accept the invitation to the team. + * + * Please note that to avoid a [Redirect + * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) + * Appwrite will accept the only redirect URLs under the domains you have + * added as a platform on the Appwrite Console. + * + * + * @param string $teamId + * @param array $roles + * @param ?string $email + * @param ?string $userId + * @param ?string $phone + * @param ?string $url + * @param ?string $name + * @throws AppwriteException + * @return array + */ + public function createMembership(string $teamId, array $roles, ?string $email = null, ?string $userId = null, ?string $phone = null, ?string $url = null, ?string $name = null): array + { + $apiPath = str_replace( + ['{teamId}'], + [$teamId], + '/teams/{teamId}/memberships' + ); + + $apiParams = []; + $apiParams['teamId'] = $teamId; + $apiParams['roles'] = $roles; + + if (!is_null($email)) { + $apiParams['email'] = $email; + } + + if (!is_null($userId)) { + $apiParams['userId'] = $userId; + } + + if (!is_null($phone)) { + $apiParams['phone'] = $phone; + } + + if (!is_null($url)) { + $apiParams['url'] = $url; + } + + if (!is_null($name)) { + $apiParams['name'] = $name; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get team membership + * + * Get a team member by the membership unique id. All team members have read + * access for this resource. + * + * @param string $teamId + * @param string $membershipId + * @throws AppwriteException + * @return array + */ + public function getMembership(string $teamId, string $membershipId): array + { + $apiPath = str_replace( + ['{teamId}', '{membershipId}'], + [$teamId, $membershipId], + '/teams/{teamId}/memberships/{membershipId}' + ); + + $apiParams = []; + $apiParams['teamId'] = $teamId; + $apiParams['membershipId'] = $membershipId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update membership + * + * Modify the roles of a team member. Only team members with the owner role + * have access to this endpoint. Learn more about [roles and + * permissions](https://appwrite.io/docs/permissions). + * + * + * @param string $teamId + * @param string $membershipId + * @param array $roles + * @throws AppwriteException + * @return array + */ + public function updateMembership(string $teamId, string $membershipId, array $roles): array + { + $apiPath = str_replace( + ['{teamId}', '{membershipId}'], + [$teamId, $membershipId], + '/teams/{teamId}/memberships/{membershipId}' + ); + + $apiParams = []; + $apiParams['teamId'] = $teamId; + $apiParams['membershipId'] = $membershipId; + $apiParams['roles'] = $roles; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Delete team membership + * + * This endpoint allows a user to leave a team or for a team owner to delete + * the membership of any other team member. You can also use this endpoint to + * delete a user membership even if it is not accepted. + * + * @param string $teamId + * @param string $membershipId + * @throws AppwriteException + * @return string + */ + public function deleteMembership(string $teamId, string $membershipId): string + { + $apiPath = str_replace( + ['{teamId}', '{membershipId}'], + [$teamId, $membershipId], + '/teams/{teamId}/memberships/{membershipId}' + ); + + $apiParams = []; + $apiParams['teamId'] = $teamId; + $apiParams['membershipId'] = $membershipId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update team membership status + * + * Use this endpoint to allow a user to accept an invitation to join a team + * after being redirected back to your app from the invitation email received + * by the user. + * + * If the request is successful, a session for the user is automatically + * created. + * + * + * @param string $teamId + * @param string $membershipId + * @param string $userId + * @param string $secret + * @throws AppwriteException + * @return array + */ + public function updateMembershipStatus(string $teamId, string $membershipId, string $userId, string $secret): array + { + $apiPath = str_replace( + ['{teamId}', '{membershipId}'], + [$teamId, $membershipId], + '/teams/{teamId}/memberships/{membershipId}/status' + ); + + $apiParams = []; + $apiParams['teamId'] = $teamId; + $apiParams['membershipId'] = $membershipId; + $apiParams['userId'] = $userId; + $apiParams['secret'] = $secret; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get team preferences + * + * Get the team's shared preferences by its unique ID. If a preference doesn't + * need to be shared by all team members, prefer storing them in [user + * preferences](https://appwrite.io/docs/references/cloud/client-web/account#getPrefs). + * + * @param string $teamId + * @throws AppwriteException + * @return array + */ + public function getPrefs(string $teamId): array + { + $apiPath = str_replace( + ['{teamId}'], + [$teamId], + '/teams/{teamId}/prefs' + ); + + $apiParams = []; + $apiParams['teamId'] = $teamId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update preferences + * + * Update the team's preferences by its unique ID. The object you pass is + * stored as is and replaces any previous value. The maximum allowed prefs + * size is 64kB and throws an error if exceeded. + * + * @param string $teamId + * @param array $prefs + * @throws AppwriteException + * @return array + */ + public function updatePrefs(string $teamId, array $prefs): array + { + $apiPath = str_replace( + ['{teamId}'], + [$teamId], + '/teams/{teamId}/prefs' + ); + + $apiParams = []; + $apiParams['teamId'] = $teamId; + $apiParams['prefs'] = $prefs; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PUT, + $apiPath, + $apiHeaders, + $apiParams + ); + } +} \ No newline at end of file diff --git a/src/Appwrite/Services/Users.php b/src/Appwrite/Services/Users.php new file mode 100644 index 0000000..3da6d52 --- /dev/null +++ b/src/Appwrite/Services/Users.php @@ -0,0 +1,1588 @@ +<?php + +namespace Appwrite\Services; + +use Appwrite\AppwriteException; +use Appwrite\Client; +use Appwrite\Service; +use Appwrite\InputFile; +use Appwrite\Enums\PasswordHash; +use Appwrite\Enums\AuthenticatorType; +use Appwrite\Enums\MessagingProviderType; + +class Users extends Service +{ + public function __construct(Client $client) + { + parent::__construct($client); + } + + /** + * List users + * + * Get a list of all the project's users. You can use the query params to + * filter your results. + * + * @param ?array $queries + * @param ?string $search + * @throws AppwriteException + * @return array + */ + public function list(?array $queries = null, ?string $search = null): array + { + $apiPath = str_replace( + [], + [], + '/users' + ); + + $apiParams = []; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + if (!is_null($search)) { + $apiParams['search'] = $search; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create user + * + * Create a new user. + * + * @param string $userId + * @param ?string $email + * @param ?string $phone + * @param ?string $password + * @param ?string $name + * @throws AppwriteException + * @return array + */ + public function create(string $userId, ?string $email = null, ?string $phone = null, ?string $password = null, ?string $name = null): array + { + $apiPath = str_replace( + [], + [], + '/users' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + + if (!is_null($email)) { + $apiParams['email'] = $email; + } + + if (!is_null($phone)) { + $apiParams['phone'] = $phone; + } + + if (!is_null($password)) { + $apiParams['password'] = $password; + } + + if (!is_null($name)) { + $apiParams['name'] = $name; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create user with Argon2 password + * + * Create a new user. Password provided must be hashed with the + * [Argon2](https://en.wikipedia.org/wiki/Argon2) algorithm. Use the [POST + * /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to + * create users with a plain text password. + * + * @param string $userId + * @param string $email + * @param string $password + * @param ?string $name + * @throws AppwriteException + * @return array + */ + public function createArgon2User(string $userId, string $email, string $password, ?string $name = null): array + { + $apiPath = str_replace( + [], + [], + '/users/argon2' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + $apiParams['email'] = $email; + $apiParams['password'] = $password; + + if (!is_null($name)) { + $apiParams['name'] = $name; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create user with bcrypt password + * + * Create a new user. Password provided must be hashed with the + * [Bcrypt](https://en.wikipedia.org/wiki/Bcrypt) algorithm. Use the [POST + * /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to + * create users with a plain text password. + * + * @param string $userId + * @param string $email + * @param string $password + * @param ?string $name + * @throws AppwriteException + * @return array + */ + public function createBcryptUser(string $userId, string $email, string $password, ?string $name = null): array + { + $apiPath = str_replace( + [], + [], + '/users/bcrypt' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + $apiParams['email'] = $email; + $apiParams['password'] = $password; + + if (!is_null($name)) { + $apiParams['name'] = $name; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * List Identities + * + * Get identities for all users. + * + * @param ?array $queries + * @param ?string $search + * @throws AppwriteException + * @return array + */ + public function listIdentities(?array $queries = null, ?string $search = null): array + { + $apiPath = str_replace( + [], + [], + '/users/identities' + ); + + $apiParams = []; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + if (!is_null($search)) { + $apiParams['search'] = $search; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Delete identity + * + * Delete an identity by its unique ID. + * + * @param string $identityId + * @throws AppwriteException + * @return string + */ + public function deleteIdentity(string $identityId): string + { + $apiPath = str_replace( + ['{identityId}'], + [$identityId], + '/users/identities/{identityId}' + ); + + $apiParams = []; + $apiParams['identityId'] = $identityId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create user with MD5 password + * + * Create a new user. Password provided must be hashed with the + * [MD5](https://en.wikipedia.org/wiki/MD5) algorithm. Use the [POST + * /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to + * create users with a plain text password. + * + * @param string $userId + * @param string $email + * @param string $password + * @param ?string $name + * @throws AppwriteException + * @return array + */ + public function createMD5User(string $userId, string $email, string $password, ?string $name = null): array + { + $apiPath = str_replace( + [], + [], + '/users/md5' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + $apiParams['email'] = $email; + $apiParams['password'] = $password; + + if (!is_null($name)) { + $apiParams['name'] = $name; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create user with PHPass password + * + * Create a new user. Password provided must be hashed with the + * [PHPass](https://www.openwall.com/phpass/) algorithm. Use the [POST + * /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to + * create users with a plain text password. + * + * @param string $userId + * @param string $email + * @param string $password + * @param ?string $name + * @throws AppwriteException + * @return array + */ + public function createPHPassUser(string $userId, string $email, string $password, ?string $name = null): array + { + $apiPath = str_replace( + [], + [], + '/users/phpass' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + $apiParams['email'] = $email; + $apiParams['password'] = $password; + + if (!is_null($name)) { + $apiParams['name'] = $name; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create user with Scrypt password + * + * Create a new user. Password provided must be hashed with the + * [Scrypt](https://github.com/Tarsnap/scrypt) algorithm. Use the [POST + * /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to + * create users with a plain text password. + * + * @param string $userId + * @param string $email + * @param string $password + * @param string $passwordSalt + * @param int $passwordCpu + * @param int $passwordMemory + * @param int $passwordParallel + * @param int $passwordLength + * @param ?string $name + * @throws AppwriteException + * @return array + */ + public function createScryptUser(string $userId, string $email, string $password, string $passwordSalt, int $passwordCpu, int $passwordMemory, int $passwordParallel, int $passwordLength, ?string $name = null): array + { + $apiPath = str_replace( + [], + [], + '/users/scrypt' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + $apiParams['email'] = $email; + $apiParams['password'] = $password; + $apiParams['passwordSalt'] = $passwordSalt; + $apiParams['passwordCpu'] = $passwordCpu; + $apiParams['passwordMemory'] = $passwordMemory; + $apiParams['passwordParallel'] = $passwordParallel; + $apiParams['passwordLength'] = $passwordLength; + + if (!is_null($name)) { + $apiParams['name'] = $name; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create user with Scrypt modified password + * + * Create a new user. Password provided must be hashed with the [Scrypt + * Modified](https://gist.github.com/Meldiron/eecf84a0225eccb5a378d45bb27462cc) + * algorithm. Use the [POST + * /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to + * create users with a plain text password. + * + * @param string $userId + * @param string $email + * @param string $password + * @param string $passwordSalt + * @param string $passwordSaltSeparator + * @param string $passwordSignerKey + * @param ?string $name + * @throws AppwriteException + * @return array + */ + public function createScryptModifiedUser(string $userId, string $email, string $password, string $passwordSalt, string $passwordSaltSeparator, string $passwordSignerKey, ?string $name = null): array + { + $apiPath = str_replace( + [], + [], + '/users/scrypt-modified' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + $apiParams['email'] = $email; + $apiParams['password'] = $password; + $apiParams['passwordSalt'] = $passwordSalt; + $apiParams['passwordSaltSeparator'] = $passwordSaltSeparator; + $apiParams['passwordSignerKey'] = $passwordSignerKey; + + if (!is_null($name)) { + $apiParams['name'] = $name; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create user with SHA password + * + * Create a new user. Password provided must be hashed with the + * [SHA](https://en.wikipedia.org/wiki/Secure_Hash_Algorithm) algorithm. Use + * the [POST /users](https://appwrite.io/docs/server/users#usersCreate) + * endpoint to create users with a plain text password. + * + * @param string $userId + * @param string $email + * @param string $password + * @param ?PasswordHash $passwordVersion + * @param ?string $name + * @throws AppwriteException + * @return array + */ + public function createSHAUser(string $userId, string $email, string $password, ?PasswordHash $passwordVersion = null, ?string $name = null): array + { + $apiPath = str_replace( + [], + [], + '/users/sha' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + $apiParams['email'] = $email; + $apiParams['password'] = $password; + + if (!is_null($passwordVersion)) { + $apiParams['passwordVersion'] = $passwordVersion; + } + + if (!is_null($name)) { + $apiParams['name'] = $name; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get user + * + * Get a user by its unique ID. + * + * @param string $userId + * @throws AppwriteException + * @return array + */ + public function get(string $userId): array + { + $apiPath = str_replace( + ['{userId}'], + [$userId], + '/users/{userId}' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Delete user + * + * Delete a user by its unique ID, thereby releasing it's ID. Since ID is + * released and can be reused, all user-related resources like documents or + * storage files should be deleted before user deletion. If you want to keep + * ID reserved, use the + * [updateStatus](https://appwrite.io/docs/server/users#usersUpdateStatus) + * endpoint instead. + * + * @param string $userId + * @throws AppwriteException + * @return string + */ + public function delete(string $userId): string + { + $apiPath = str_replace( + ['{userId}'], + [$userId], + '/users/{userId}' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update email + * + * Update the user email by its unique ID. + * + * @param string $userId + * @param string $email + * @throws AppwriteException + * @return array + */ + public function updateEmail(string $userId, string $email): array + { + $apiPath = str_replace( + ['{userId}'], + [$userId], + '/users/{userId}/email' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + $apiParams['email'] = $email; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create user JWT + * + * Use this endpoint to create a JSON Web Token for user by its unique ID. You + * can use the resulting JWT to authenticate on behalf of the user. The JWT + * secret will become invalid if the session it uses gets deleted. + * + * @param string $userId + * @param ?string $sessionId + * @param ?int $duration + * @throws AppwriteException + * @return array + */ + public function createJWT(string $userId, ?string $sessionId = null, ?int $duration = null): array + { + $apiPath = str_replace( + ['{userId}'], + [$userId], + '/users/{userId}/jwts' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + + if (!is_null($sessionId)) { + $apiParams['sessionId'] = $sessionId; + } + + if (!is_null($duration)) { + $apiParams['duration'] = $duration; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update user labels + * + * Update the user labels by its unique ID. + * + * Labels can be used to grant access to resources. While teams are a way for + * user's to share access to a resource, labels can be defined by the + * developer to grant access without an invitation. See the [Permissions + * docs](https://appwrite.io/docs/permissions) for more info. + * + * @param string $userId + * @param array $labels + * @throws AppwriteException + * @return array + */ + public function updateLabels(string $userId, array $labels): array + { + $apiPath = str_replace( + ['{userId}'], + [$userId], + '/users/{userId}/labels' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + $apiParams['labels'] = $labels; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PUT, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * List user logs + * + * Get the user activity logs list by its unique ID. + * + * @param string $userId + * @param ?array $queries + * @throws AppwriteException + * @return array + */ + public function listLogs(string $userId, ?array $queries = null): array + { + $apiPath = str_replace( + ['{userId}'], + [$userId], + '/users/{userId}/logs' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * List user memberships + * + * Get the user membership list by its unique ID. + * + * @param string $userId + * @throws AppwriteException + * @return array + */ + public function listMemberships(string $userId): array + { + $apiPath = str_replace( + ['{userId}'], + [$userId], + '/users/{userId}/memberships' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update MFA + * + * Enable or disable MFA on a user account. + * + * @param string $userId + * @param bool $mfa + * @throws AppwriteException + * @return array + */ + public function updateMfa(string $userId, bool $mfa): array + { + $apiPath = str_replace( + ['{userId}'], + [$userId], + '/users/{userId}/mfa' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + $apiParams['mfa'] = $mfa; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Delete Authenticator + * + * Delete an authenticator app. + * + * @param string $userId + * @param AuthenticatorType $type + * @throws AppwriteException + * @return array + */ + public function deleteMfaAuthenticator(string $userId, AuthenticatorType $type): array + { + $apiPath = str_replace( + ['{userId}', '{type}'], + [$userId, $type], + '/users/{userId}/mfa/authenticators/{type}' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + $apiParams['type'] = $type; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * List Factors + * + * List the factors available on the account to be used as a MFA challange. + * + * @param string $userId + * @throws AppwriteException + * @return array + */ + public function listMfaFactors(string $userId): array + { + $apiPath = str_replace( + ['{userId}'], + [$userId], + '/users/{userId}/mfa/factors' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get MFA Recovery Codes + * + * Get recovery codes that can be used as backup for MFA flow by User ID. + * Before getting codes, they must be generated using + * [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) + * method. + * + * @param string $userId + * @throws AppwriteException + * @return array + */ + public function getMfaRecoveryCodes(string $userId): array + { + $apiPath = str_replace( + ['{userId}'], + [$userId], + '/users/{userId}/mfa/recovery-codes' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Regenerate MFA Recovery Codes + * + * Regenerate recovery codes that can be used as backup for MFA flow by User + * ID. Before regenerating codes, they must be first generated using + * [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) + * method. + * + * @param string $userId + * @throws AppwriteException + * @return array + */ + public function updateMfaRecoveryCodes(string $userId): array + { + $apiPath = str_replace( + ['{userId}'], + [$userId], + '/users/{userId}/mfa/recovery-codes' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PUT, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create MFA Recovery Codes + * + * Generate recovery codes used as backup for MFA flow for User ID. Recovery + * codes can be used as a MFA verification type in + * [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) + * method by client SDK. + * + * @param string $userId + * @throws AppwriteException + * @return array + */ + public function createMfaRecoveryCodes(string $userId): array + { + $apiPath = str_replace( + ['{userId}'], + [$userId], + '/users/{userId}/mfa/recovery-codes' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update name + * + * Update the user name by its unique ID. + * + * @param string $userId + * @param string $name + * @throws AppwriteException + * @return array + */ + public function updateName(string $userId, string $name): array + { + $apiPath = str_replace( + ['{userId}'], + [$userId], + '/users/{userId}/name' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + $apiParams['name'] = $name; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update password + * + * Update the user password by its unique ID. + * + * @param string $userId + * @param string $password + * @throws AppwriteException + * @return array + */ + public function updatePassword(string $userId, string $password): array + { + $apiPath = str_replace( + ['{userId}'], + [$userId], + '/users/{userId}/password' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + $apiParams['password'] = $password; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update phone + * + * Update the user phone by its unique ID. + * + * @param string $userId + * @param string $number + * @throws AppwriteException + * @return array + */ + public function updatePhone(string $userId, string $number): array + { + $apiPath = str_replace( + ['{userId}'], + [$userId], + '/users/{userId}/phone' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + $apiParams['number'] = $number; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get user preferences + * + * Get the user preferences by its unique ID. + * + * @param string $userId + * @throws AppwriteException + * @return array + */ + public function getPrefs(string $userId): array + { + $apiPath = str_replace( + ['{userId}'], + [$userId], + '/users/{userId}/prefs' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update user preferences + * + * Update the user preferences by its unique ID. The object you pass is stored + * as is, and replaces any previous value. The maximum allowed prefs size is + * 64kB and throws error if exceeded. + * + * @param string $userId + * @param array $prefs + * @throws AppwriteException + * @return array + */ + public function updatePrefs(string $userId, array $prefs): array + { + $apiPath = str_replace( + ['{userId}'], + [$userId], + '/users/{userId}/prefs' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + $apiParams['prefs'] = $prefs; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * List user sessions + * + * Get the user sessions list by its unique ID. + * + * @param string $userId + * @throws AppwriteException + * @return array + */ + public function listSessions(string $userId): array + { + $apiPath = str_replace( + ['{userId}'], + [$userId], + '/users/{userId}/sessions' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create session + * + * Creates a session for a user. Returns an immediately usable session object. + * + * If you want to generate a token for a custom authentication flow, use the + * [POST + * /users/{userId}/tokens](https://appwrite.io/docs/server/users#createToken) + * endpoint. + * + * @param string $userId + * @throws AppwriteException + * @return array + */ + public function createSession(string $userId): array + { + $apiPath = str_replace( + ['{userId}'], + [$userId], + '/users/{userId}/sessions' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Delete user sessions + * + * Delete all user's sessions by using the user's unique ID. + * + * @param string $userId + * @throws AppwriteException + * @return string + */ + public function deleteSessions(string $userId): string + { + $apiPath = str_replace( + ['{userId}'], + [$userId], + '/users/{userId}/sessions' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Delete user session + * + * Delete a user sessions by its unique ID. + * + * @param string $userId + * @param string $sessionId + * @throws AppwriteException + * @return string + */ + public function deleteSession(string $userId, string $sessionId): string + { + $apiPath = str_replace( + ['{userId}', '{sessionId}'], + [$userId, $sessionId], + '/users/{userId}/sessions/{sessionId}' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + $apiParams['sessionId'] = $sessionId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update user status + * + * Update the user status by its unique ID. Use this endpoint as an + * alternative to deleting a user if you want to keep user's ID reserved. + * + * @param string $userId + * @param bool $status + * @throws AppwriteException + * @return array + */ + public function updateStatus(string $userId, bool $status): array + { + $apiPath = str_replace( + ['{userId}'], + [$userId], + '/users/{userId}/status' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + $apiParams['status'] = $status; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * List User Targets + * + * List the messaging targets that are associated with a user. + * + * @param string $userId + * @param ?array $queries + * @throws AppwriteException + * @return array + */ + public function listTargets(string $userId, ?array $queries = null): array + { + $apiPath = str_replace( + ['{userId}'], + [$userId], + '/users/{userId}/targets' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create User Target + * + * Create a messaging target. + * + * @param string $userId + * @param string $targetId + * @param MessagingProviderType $providerType + * @param string $identifier + * @param ?string $providerId + * @param ?string $name + * @throws AppwriteException + * @return array + */ + public function createTarget(string $userId, string $targetId, MessagingProviderType $providerType, string $identifier, ?string $providerId = null, ?string $name = null): array + { + $apiPath = str_replace( + ['{userId}'], + [$userId], + '/users/{userId}/targets' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + $apiParams['targetId'] = $targetId; + $apiParams['providerType'] = $providerType; + $apiParams['identifier'] = $identifier; + + if (!is_null($providerId)) { + $apiParams['providerId'] = $providerId; + } + + if (!is_null($name)) { + $apiParams['name'] = $name; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get User Target + * + * Get a user's push notification target by ID. + * + * @param string $userId + * @param string $targetId + * @throws AppwriteException + * @return array + */ + public function getTarget(string $userId, string $targetId): array + { + $apiPath = str_replace( + ['{userId}', '{targetId}'], + [$userId, $targetId], + '/users/{userId}/targets/{targetId}' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + $apiParams['targetId'] = $targetId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update User target + * + * Update a messaging target. + * + * @param string $userId + * @param string $targetId + * @param ?string $identifier + * @param ?string $providerId + * @param ?string $name + * @throws AppwriteException + * @return array + */ + public function updateTarget(string $userId, string $targetId, ?string $identifier = null, ?string $providerId = null, ?string $name = null): array + { + $apiPath = str_replace( + ['{userId}', '{targetId}'], + [$userId, $targetId], + '/users/{userId}/targets/{targetId}' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + $apiParams['targetId'] = $targetId; + + if (!is_null($identifier)) { + $apiParams['identifier'] = $identifier; + } + + if (!is_null($providerId)) { + $apiParams['providerId'] = $providerId; + } + + if (!is_null($name)) { + $apiParams['name'] = $name; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Delete user target + * + * Delete a messaging target. + * + * @param string $userId + * @param string $targetId + * @throws AppwriteException + * @return string + */ + public function deleteTarget(string $userId, string $targetId): string + { + $apiPath = str_replace( + ['{userId}', '{targetId}'], + [$userId, $targetId], + '/users/{userId}/targets/{targetId}' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + $apiParams['targetId'] = $targetId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create token + * + * Returns a token with a secret key for creating a session. Use the user ID + * and secret and submit a request to the [PUT + * /account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) + * endpoint to complete the login process. + * + * + * @param string $userId + * @param ?int $length + * @param ?int $expire + * @throws AppwriteException + * @return array + */ + public function createToken(string $userId, ?int $length = null, ?int $expire = null): array + { + $apiPath = str_replace( + ['{userId}'], + [$userId], + '/users/{userId}/tokens' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + + if (!is_null($length)) { + $apiParams['length'] = $length; + } + + if (!is_null($expire)) { + $apiParams['expire'] = $expire; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update email verification + * + * Update the user email verification status by its unique ID. + * + * @param string $userId + * @param bool $emailVerification + * @throws AppwriteException + * @return array + */ + public function updateEmailVerification(string $userId, bool $emailVerification): array + { + $apiPath = str_replace( + ['{userId}'], + [$userId], + '/users/{userId}/verification' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + $apiParams['emailVerification'] = $emailVerification; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update phone verification + * + * Update the user phone verification status by its unique ID. + * + * @param string $userId + * @param bool $phoneVerification + * @throws AppwriteException + * @return array + */ + public function updatePhoneVerification(string $userId, bool $phoneVerification): array + { + $apiPath = str_replace( + ['{userId}'], + [$userId], + '/users/{userId}/verification/phone' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + $apiParams['phoneVerification'] = $phoneVerification; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } +} \ No newline at end of file diff --git a/tests/Appwrite/IDTest.php b/tests/Appwrite/IDTest.php new file mode 100644 index 0000000..4914377 --- /dev/null +++ b/tests/Appwrite/IDTest.php @@ -0,0 +1,15 @@ +<?php + +namespace Appwrite; + +use PHPUnit\Framework\TestCase; + +final class IDTest extends TestCase { + public function testUnique(): void { + $this->assertSame('unique()', ID::unique()); + } + + public function testCustom(): void { + $this->assertSame('custom', ID::custom('custom')); + } +} diff --git a/tests/Appwrite/PermissionTest.php b/tests/Appwrite/PermissionTest.php new file mode 100644 index 0000000..b17958d --- /dev/null +++ b/tests/Appwrite/PermissionTest.php @@ -0,0 +1,27 @@ +<?php + +namespace Appwrite; + +use PHPUnit\Framework\TestCase; + +final class PermissionTest extends TestCase { + public function testRead(): void { + $this->assertSame('read("any")', Permission::read(Role::any())); + } + + public function testWrite(): void { + $this->assertSame('write("any")', Permission::write(Role::any())); + } + + public function testCreate(): void { + $this->assertSame('create("any")', Permission::create(Role::any())); + } + + public function testUpdate(): void { + $this->assertSame('update("any")', Permission::update(Role::any())); + } + + public function testDelete(): void { + $this->assertSame('delete("any")', Permission::delete(Role::any())); + } +} diff --git a/tests/Appwrite/QueryTest.php b/tests/Appwrite/QueryTest.php new file mode 100644 index 0000000..bd54d13 --- /dev/null +++ b/tests/Appwrite/QueryTest.php @@ -0,0 +1,149 @@ +<?php + +namespace Appwrite; + +use PHPUnit\Framework\TestCase; + +final class BasicFilterQueryTest { + public $description; + public $value; + public $expectedValues; + + public function __construct(string $description, mixed $value, string $expectedValues) { + $this->description = $description; + $this->value = $value; + $this->expectedValues = $expectedValues; + } +} + +final class QueryTest extends TestCase { + /** + * @var BasicFilterQueryTest[] $tests + */ + private $tests; + + function __construct(string $name) + { + parent::__construct($name); + $this->tests = array( + new BasicFilterQueryTest('with a string', 's', '["s"]'), + new BasicFilterQueryTest('with a integer', 1, '[1]'), + new BasicFilterQueryTest('with a double', 1.2, '[1.2]'), + new BasicFilterQueryTest('with a whole number double', 1.0, '[1]'), + new BasicFilterQueryTest('with a bool', false, '[false]'), + new BasicFilterQueryTest('with a list', ['a', 'b', 'c'], '["a","b","c"]'), + ); + } + + public function testBasicFilterEqual(): void { + foreach($this->tests as $test) { + $this->assertSame( + "equal(\"attr\", $test->expectedValues)", + Query::equal('attr', $test->value), + $test->description, + ); + } + } + + public function testBasicFilterNotEqual(): void { + foreach($this->tests as $test) { + $this->assertSame( + "notEqual(\"attr\", $test->expectedValues)", + Query::notEqual('attr', $test->value), + $test->description, + ); + } + } + + public function testBasicFilterLessThan(): void { + foreach($this->tests as $test) { + $this->assertSame( + "lessThan(\"attr\", $test->expectedValues)", + Query::lessThan('attr', $test->value), + $test->description, + ); + } + } + + public function testBasicFilterLessThanEqual(): void { + foreach($this->tests as $test) { + $this->assertSame( + "lessThanEqual(\"attr\", $test->expectedValues)", + Query::lessThanEqual('attr', $test->value), + $test->description, + ); + } + } + + public function testBasicFilterGreaterThan(): void { + foreach($this->tests as $test) { + $this->assertSame( + "greaterThan(\"attr\", $test->expectedValues)", + Query::greaterThan('attr', $test->value), + $test->description, + ); + } + } + + public function testBasicFilterGreaterThanEqual(): void { + foreach($this->tests as $test) { + $this->assertSame( + "greaterThanEqual(\"attr\", $test->expectedValues)", + Query::greaterThanEqual('attr', $test->value), + $test->description, + ); + } + } + + public function testSearch(): void { + $this->assertSame('search("attr", ["keyword1 keyword2"])', Query::search('attr', 'keyword1 keyword2')); + } + + public function testIsNull(): void { + $this->assertSame('isNull("attr")', Query::isNull('attr')); + } + + public function testIsNotNull(): void { + $this->assertSame('isNotNull("attr")', Query::isNotNull('attr')); + } + + public function testBetweenWithIntegers(): void { + $this->assertSame('between("attr", 1, 2)', Query::between('attr', 1, 2)); + } + + public function testBetweenWithDoubles(): void { + $this->assertSame('between("attr", 1, 2)', Query::between('attr', 1.0, 2.0)); + } + + public function testBetweenWithStrings(): void { + $this->assertSame('between("attr", "a", "z")', Query::between('attr', 'a', 'z')); + } + + public function testSelect(): void { + $this->assertSame('select(["attr1","attr2"])', Query::select(['attr1', 'attr2'])); + } + + public function testOrderAsc(): void { + $this->assertSame('orderAsc("attr")', Query::orderAsc('attr')); + } + + public function testOrderDesc(): void { + $this->assertSame('orderDesc("attr")', Query::orderDesc('attr')); + } + + public function testCursorBefore(): void { + $this->assertSame('cursorBefore("attr")', Query::cursorBefore('attr')); + } + + public function testCursorAfter(): void { + $this->assertSame('cursorAfter("attr")', Query::cursorAfter('attr')); + } + + public function testLimit(): void { + $this->assertSame('limit(1)', Query::limit(1)); + } + + public function testOffset(): void { + $this->assertSame('offset(1)', Query::offset(1)); + } +} diff --git a/tests/Appwrite/RoleTest.php b/tests/Appwrite/RoleTest.php new file mode 100644 index 0000000..f6e0be1 --- /dev/null +++ b/tests/Appwrite/RoleTest.php @@ -0,0 +1,47 @@ +<?php + +namespace Appwrite; + +use PHPUnit\Framework\TestCase; + +final class RoleTest extends TestCase { + public function testAny(): void { + $this->assertSame('any', Role::any()); + } + + public function testUserWithoutStatus(): void { + $this->assertSame('user:custom', Role::user('custom')); + } + + public function testUserWithStatus(): void { + $this->assertSame('user:custom/verified', Role::user('custom', 'verified')); + } + + public function testUsersWithoutStatus(): void { + $this->assertSame('users', Role::users()); + } + + public function testUsersWithStatus(): void { + $this->assertSame('users/verified', Role::users('verified')); + } + + public function testGuests(): void { + $this->assertSame('guests', Role::guests()); + } + + public function testTeamWithoutRole(): void { + $this->assertSame('team:custom', Role::team('custom')); + } + + public function testTeamWithRole(): void { + $this->assertSame('team:custom/owner', Role::team('custom', 'owner')); + } + + public function testMember(): void { + $this->assertSame('member:custom', Role::member('custom')); + } + + public function testLabel(): void { + $this->assertSame('label:admin', Role::label('admin')); + } +} diff --git a/tests/Appwrite/Services/AccountTest.php b/tests/Appwrite/Services/AccountTest.php new file mode 100644 index 0000000..9c518a5 --- /dev/null +++ b/tests/Appwrite/Services/AccountTest.php @@ -0,0 +1,1148 @@ +<?php + +namespace Appwrite\Services; + +use Appwrite\Client; +use Appwrite\InputFile; +use Mockery; +use PHPUnit\Framework\TestCase; + +final class AccountTest extends TestCase { + private $client; + private $account; + + protected function setUp(): void { + $this->client = Mockery::mock(Client::class); + $this->account = new Account($this->client); + } + + public function testMethodGet(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "John Doe", + "registration" => "2020-10-15T06:38:00.000+00:00", + "status" => true, + "labels" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array(), + "accessedAt" => "2020-10-15T06:38:00.000+00:00",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->account->get( + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreate(): void { + + $data = array( + "\$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" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array(), + "accessedAt" => "2020-10-15T06:38:00.000+00:00",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->account->create( + "<USER_ID>", + "email@example.com", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateEmail(): void { + + $data = array( + "\$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" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array(), + "accessedAt" => "2020-10-15T06:38:00.000+00:00",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->account->updateEmail( + "email@example.com", + "password" + ); + + $this->assertSame($data, $response); + } + + public function testMethodListIdentities(): void { + + $data = array( + "total" => 5, + "identities" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->account->listIdentities( + ); + + $this->assertSame($data, $response); + } + + public function testMethodDeleteIdentity(): void { + + $data = ''; + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->account->deleteIdentity( + "<IDENTITY_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateJWT(): void { + + $data = array( + "jwt" => "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->account->createJWT( + ); + + $this->assertSame($data, $response); + } + + public function testMethodListLogs(): void { + + $data = array( + "total" => 5, + "logs" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->account->listLogs( + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateMFA(): void { + + $data = array( + "\$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" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array(), + "accessedAt" => "2020-10-15T06:38:00.000+00:00",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->account->updateMFA( + true + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateMfaAuthenticator(): void { + + $data = array( + "secret" => "1", + "uri" => "1",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->account->createMfaAuthenticator( + "totp" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateMfaAuthenticator(): void { + + $data = array( + "\$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" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array(), + "accessedAt" => "2020-10-15T06:38:00.000+00:00",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->account->updateMfaAuthenticator( + "totp", + "<OTP>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodDeleteMfaAuthenticator(): void { + + $data = ''; + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->account->deleteMfaAuthenticator( + "totp" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateMfaChallenge(): void { + + $data = array( + "\$id" => "bb8ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5ea5c168bb8", + "expire" => "2020-10-15T06:38:00.000+00:00",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->account->createMfaChallenge( + "email" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateMfaChallenge(): void { + + $data = ''; + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->account->updateMfaChallenge( + "<CHALLENGE_ID>", + "<OTP>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodListMfaFactors(): void { + + $data = array( + "totp" => true, + "phone" => true, + "email" => true, + "recoveryCode" => true,); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->account->listMfaFactors( + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetMfaRecoveryCodes(): void { + + $data = array( + "recoveryCodes" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->account->getMfaRecoveryCodes( + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateMfaRecoveryCodes(): void { + + $data = array( + "recoveryCodes" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->account->createMfaRecoveryCodes( + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateMfaRecoveryCodes(): void { + + $data = array( + "recoveryCodes" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->account->updateMfaRecoveryCodes( + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateName(): void { + + $data = array( + "\$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" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array(), + "accessedAt" => "2020-10-15T06:38:00.000+00:00",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->account->updateName( + "<NAME>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdatePassword(): void { + + $data = array( + "\$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" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array(), + "accessedAt" => "2020-10-15T06:38:00.000+00:00",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->account->updatePassword( + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdatePhone(): void { + + $data = array( + "\$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" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array(), + "accessedAt" => "2020-10-15T06:38:00.000+00:00",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->account->updatePhone( + "+12065550100", + "password" + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetPrefs(): void { + + $data = array(); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->account->getPrefs( + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdatePrefs(): void { + + $data = array( + "\$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" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array(), + "accessedAt" => "2020-10-15T06:38:00.000+00:00",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->account->updatePrefs( + array() + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateRecovery(): void { + + $data = array( + "\$id" => "bb8ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5ea5c168bb8", + "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); + + $response = $this->account->createRecovery( + "email@example.com", + "https://example.com" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateRecovery(): void { + + $data = array( + "\$id" => "bb8ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5ea5c168bb8", + "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); + + $response = $this->account->updateRecovery( + "<USER_ID>", + "<SECRET>", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodListSessions(): void { + + $data = array( + "total" => 5, + "sessions" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->account->listSessions( + ); + + $this->assertSame($data, $response); + } + + public function testMethodDeleteSessions(): void { + + $data = ''; + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->account->deleteSessions( + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateAnonymousSession(): void { + + $data = array( + "\$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" => array(), + "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); + + $response = $this->account->createAnonymousSession( + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateEmailPasswordSession(): void { + + $data = array( + "\$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" => array(), + "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); + + $response = $this->account->createEmailPasswordSession( + "email@example.com", + "password" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateMagicURLSession(): void { + + $data = array( + "\$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" => array(), + "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); + + $response = $this->account->updateMagicURLSession( + "<USER_ID>", + "<SECRET>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdatePhoneSession(): void { + + $data = array( + "\$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" => array(), + "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); + + $response = $this->account->updatePhoneSession( + "<USER_ID>", + "<SECRET>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateSession(): void { + + $data = array( + "\$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" => array(), + "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); + + $response = $this->account->createSession( + "<USER_ID>", + "<SECRET>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetSession(): void { + + $data = array( + "\$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" => array(), + "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); + + $response = $this->account->getSession( + "<SESSION_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateSession(): void { + + $data = array( + "\$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" => array(), + "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); + + $response = $this->account->updateSession( + "<SESSION_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodDeleteSession(): void { + + $data = ''; + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->account->deleteSession( + "<SESSION_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateStatus(): void { + + $data = array( + "\$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" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array(), + "accessedAt" => "2020-10-15T06:38:00.000+00:00",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->account->updateStatus( + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateEmailToken(): void { + + $data = array( + "\$id" => "bb8ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5ea5c168bb8", + "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); + + $response = $this->account->createEmailToken( + "<USER_ID>", + "email@example.com" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateMagicURLToken(): void { + + $data = array( + "\$id" => "bb8ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5ea5c168bb8", + "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); + + $response = $this->account->createMagicURLToken( + "<USER_ID>", + "email@example.com" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateOAuth2Token(): void { + + $data = array(); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->account->createOAuth2Token( + "amazon" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreatePhoneToken(): void { + + $data = array( + "\$id" => "bb8ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5ea5c168bb8", + "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); + + $response = $this->account->createPhoneToken( + "<USER_ID>", + "+12065550100" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateVerification(): void { + + $data = array( + "\$id" => "bb8ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5ea5c168bb8", + "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); + + $response = $this->account->createVerification( + "https://example.com" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateVerification(): void { + + $data = array( + "\$id" => "bb8ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5ea5c168bb8", + "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); + + $response = $this->account->updateVerification( + "<USER_ID>", + "<SECRET>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreatePhoneVerification(): void { + + $data = array( + "\$id" => "bb8ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5ea5c168bb8", + "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); + + $response = $this->account->createPhoneVerification( + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdatePhoneVerification(): void { + + $data = array( + "\$id" => "bb8ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5ea5c168bb8", + "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); + + $response = $this->account->updatePhoneVerification( + "<USER_ID>", + "<SECRET>" + ); + + $this->assertSame($data, $response); + } + +} diff --git a/tests/Appwrite/Services/AvatarsTest.php b/tests/Appwrite/Services/AvatarsTest.php new file mode 100644 index 0000000..cb2790e --- /dev/null +++ b/tests/Appwrite/Services/AvatarsTest.php @@ -0,0 +1,130 @@ +<?php + +namespace Appwrite\Services; + +use Appwrite\Client; +use Appwrite\InputFile; +use Mockery; +use PHPUnit\Framework\TestCase; + +final class AvatarsTest extends TestCase { + private $client; + private $avatars; + + protected function setUp(): void { + $this->client = Mockery::mock(Client::class); + $this->avatars = new Avatars($this->client); + } + + public function testMethodGetBrowser(): void { + + $data = ''; + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->avatars->getBrowser( + "aa" + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetCreditCard(): void { + + $data = ''; + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->avatars->getCreditCard( + "amex" + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetFavicon(): void { + + $data = ''; + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->avatars->getFavicon( + "https://example.com" + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetFlag(): void { + + $data = ''; + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->avatars->getFlag( + "af" + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetImage(): void { + + $data = ''; + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->avatars->getImage( + "https://example.com" + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetInitials(): void { + + $data = ''; + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->avatars->getInitials( + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetQR(): void { + + $data = ''; + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->avatars->getQR( + "<TEXT>" + ); + + $this->assertSame($data, $response); + } + +} diff --git a/tests/Appwrite/Services/DatabasesTest.php b/tests/Appwrite/Services/DatabasesTest.php new file mode 100644 index 0000000..cf4f452 --- /dev/null +++ b/tests/Appwrite/Services/DatabasesTest.php @@ -0,0 +1,1006 @@ +<?php + +namespace Appwrite\Services; + +use Appwrite\Client; +use Appwrite\InputFile; +use Mockery; +use PHPUnit\Framework\TestCase; + +final class DatabasesTest extends TestCase { + private $client; + private $databases; + + protected function setUp(): void { + $this->client = Mockery::mock(Client::class); + $this->databases = new Databases($this->client); + } + + public function testMethodList(): void { + + $data = array( + "total" => 5, + "databases" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->list( + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreate(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "name" => "My Database", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "enabled" => true,); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->create( + "<DATABASE_ID>", + "<NAME>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodGet(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "name" => "My Database", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "enabled" => true,); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->get( + "<DATABASE_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdate(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "name" => "My Database", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "enabled" => true,); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->update( + "<DATABASE_ID>", + "<NAME>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodDelete(): void { + + $data = ''; + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->delete( + "<DATABASE_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodListCollections(): void { + + $data = array( + "total" => 5, + "collections" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->listCollections( + "<DATABASE_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateCollection(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "databaseId" => "5e5ea5c16897e", + "name" => "My Collection", + "enabled" => true, + "documentSecurity" => true, + "attributes" => array(), + "indexes" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->createCollection( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "<NAME>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetCollection(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "databaseId" => "5e5ea5c16897e", + "name" => "My Collection", + "enabled" => true, + "documentSecurity" => true, + "attributes" => array(), + "indexes" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->getCollection( + "<DATABASE_ID>", + "<COLLECTION_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateCollection(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "databaseId" => "5e5ea5c16897e", + "name" => "My Collection", + "enabled" => true, + "documentSecurity" => true, + "attributes" => array(), + "indexes" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->updateCollection( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "<NAME>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodDeleteCollection(): void { + + $data = ''; + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->deleteCollection( + "<DATABASE_ID>", + "<COLLECTION_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodListAttributes(): void { + + $data = array( + "total" => 5, + "attributes" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->listAttributes( + "<DATABASE_ID>", + "<COLLECTION_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateBooleanAttribute(): void { + + $data = array( + "key" => "isEnabled", + "type" => "boolean", + "status" => "available", + "error" => "string", + "required" => true,); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->createBooleanAttribute( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "", + true + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateBooleanAttribute(): void { + + $data = array( + "key" => "isEnabled", + "type" => "boolean", + "status" => "available", + "error" => "string", + "required" => true,); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->updateBooleanAttribute( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "", + true, + true + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateDatetimeAttribute(): void { + + $data = array( + "key" => "birthDay", + "type" => "datetime", + "status" => "available", + "error" => "string", + "required" => true, + "format" => "datetime",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->createDatetimeAttribute( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "", + true + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateDatetimeAttribute(): void { + + $data = array( + "key" => "birthDay", + "type" => "datetime", + "status" => "available", + "error" => "string", + "required" => true, + "format" => "datetime",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->updateDatetimeAttribute( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "", + true, + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateEmailAttribute(): void { + + $data = array( + "key" => "userEmail", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "format" => "email",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->createEmailAttribute( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "", + true + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateEmailAttribute(): void { + + $data = array( + "key" => "userEmail", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "format" => "email",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->updateEmailAttribute( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "", + true, + "email@example.com" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateEnumAttribute(): void { + + $data = array( + "key" => "status", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "elements" => array(), + "format" => "enum",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->createEnumAttribute( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "", + array(), + true + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateEnumAttribute(): void { + + $data = array( + "key" => "status", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "elements" => array(), + "format" => "enum",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->updateEnumAttribute( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "", + array(), + true, + "<DEFAULT>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateFloatAttribute(): void { + + $data = array( + "key" => "percentageCompleted", + "type" => "double", + "status" => "available", + "error" => "string", + "required" => true,); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->createFloatAttribute( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "", + true + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateFloatAttribute(): void { + + $data = array( + "key" => "percentageCompleted", + "type" => "double", + "status" => "available", + "error" => "string", + "required" => true,); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->updateFloatAttribute( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "", + true, + 1.0, + 1.0, + 1.0 + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateIntegerAttribute(): void { + + $data = array( + "key" => "count", + "type" => "integer", + "status" => "available", + "error" => "string", + "required" => true,); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->createIntegerAttribute( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "", + true + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateIntegerAttribute(): void { + + $data = array( + "key" => "count", + "type" => "integer", + "status" => "available", + "error" => "string", + "required" => true,); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->updateIntegerAttribute( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "", + true, + 1, + 1, + 1 + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateIpAttribute(): void { + + $data = array( + "key" => "ipAddress", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "format" => "ip",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->createIpAttribute( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "", + true + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateIpAttribute(): void { + + $data = array( + "key" => "ipAddress", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "format" => "ip",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->updateIpAttribute( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "", + true, + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateRelationshipAttribute(): void { + + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "relatedCollection" => "collection", + "relationType" => "oneToOne|oneToMany|manyToOne|manyToMany", + "twoWay" => true, + "twoWayKey" => "string", + "onDelete" => "restrict|cascade|setNull", + "side" => "parent|child",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->createRelationshipAttribute( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "<RELATED_COLLECTION_ID>", + "oneToOne" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateStringAttribute(): void { + + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "size" => 128,); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->createStringAttribute( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "", + 1, + true + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateStringAttribute(): void { + + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "size" => 128,); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->updateStringAttribute( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "", + true, + "<DEFAULT>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateUrlAttribute(): void { + + $data = array( + "key" => "githubUrl", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "format" => "url",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->createUrlAttribute( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "", + true + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateUrlAttribute(): void { + + $data = array( + "key" => "githubUrl", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "format" => "url",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->updateUrlAttribute( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "", + true, + "https://example.com" + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetAttribute(): void { + + $data = ''; + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->getAttribute( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodDeleteAttribute(): void { + + $data = ''; + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->deleteAttribute( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateRelationshipAttribute(): void { + + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "relatedCollection" => "collection", + "relationType" => "oneToOne|oneToMany|manyToOne|manyToMany", + "twoWay" => true, + "twoWayKey" => "string", + "onDelete" => "restrict|cascade|setNull", + "side" => "parent|child",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->updateRelationshipAttribute( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodListDocuments(): void { + + $data = array( + "total" => 5, + "documents" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->listDocuments( + "<DATABASE_ID>", + "<COLLECTION_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateDocument(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$collectionId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->createDocument( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "<DOCUMENT_ID>", + array() + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetDocument(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$collectionId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->getDocument( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "<DOCUMENT_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateDocument(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$collectionId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->updateDocument( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "<DOCUMENT_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodDeleteDocument(): void { + + $data = ''; + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->deleteDocument( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "<DOCUMENT_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodListIndexes(): void { + + $data = array( + "total" => 5, + "indexes" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->listIndexes( + "<DATABASE_ID>", + "<COLLECTION_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateIndex(): void { + + $data = array( + "key" => "index1", + "type" => "primary", + "status" => "available", + "error" => "string", + "attributes" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->createIndex( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "", + "key", + array() + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetIndex(): void { + + $data = array( + "key" => "index1", + "type" => "primary", + "status" => "available", + "error" => "string", + "attributes" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->getIndex( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodDeleteIndex(): void { + + $data = ''; + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->deleteIndex( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "" + ); + + $this->assertSame($data, $response); + } + +} diff --git a/tests/Appwrite/Services/FunctionsTest.php b/tests/Appwrite/Services/FunctionsTest.php new file mode 100644 index 0000000..ea44a6e --- /dev/null +++ b/tests/Appwrite/Services/FunctionsTest.php @@ -0,0 +1,664 @@ +<?php + +namespace Appwrite\Services; + +use Appwrite\Client; +use Appwrite\InputFile; +use Mockery; +use PHPUnit\Framework\TestCase; + +final class FunctionsTest extends TestCase { + private $client; + private $functions; + + protected function setUp(): void { + $this->client = Mockery::mock(Client::class); + $this->functions = new Functions($this->client); + } + + public function testMethodList(): void { + + $data = array( + "total" => 5, + "functions" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->functions->list( + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreate(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "execute" => array(), + "name" => "My Function", + "enabled" => true, + "live" => true, + "logging" => true, + "runtime" => "python-3.8", + "deployment" => "5e5ea5c16897e", + "scopes" => array(), + "vars" => array(), + "events" => array(), + "schedule" => "5 4 * * *", + "timeout" => 300, + "entrypoint" => "index.js", + "commands" => "npm install", + "version" => "v2", + "installationId" => "6m40at4ejk5h2u9s1hboo", + "providerRepositoryId" => "appwrite", + "providerBranch" => "main", + "providerRootDirectory" => "functions/helloWorld", + "providerSilentMode" => true,); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->functions->create( + "<FUNCTION_ID>", + "<NAME>", + "node-14.5" + ); + + $this->assertSame($data, $response); + } + + public function testMethodListRuntimes(): void { + + $data = array( + "total" => 5, + "runtimes" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->functions->listRuntimes( + ); + + $this->assertSame($data, $response); + } + + public function testMethodListTemplates(): void { + + $data = array( + "total" => 5, + "templates" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->functions->listTemplates( + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetTemplate(): void { + + $data = array( + "icon" => "icon-lightning-bolt", + "id" => "starter", + "name" => "Starter function", + "tagline" => "A simple function to get started.", + "permissions" => array(), + "events" => array(), + "cron" => "0 0 * * *", + "timeout" => 300, + "useCases" => array(), + "runtimes" => array(), + "instructions" => "For documentation and instructions check out <link>.", + "vcsProvider" => "github", + "providerRepositoryId" => "templates", + "providerOwner" => "appwrite", + "providerVersion" => "main", + "variables" => array(), + "scopes" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->functions->getTemplate( + "<TEMPLATE_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodGet(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "execute" => array(), + "name" => "My Function", + "enabled" => true, + "live" => true, + "logging" => true, + "runtime" => "python-3.8", + "deployment" => "5e5ea5c16897e", + "scopes" => array(), + "vars" => array(), + "events" => array(), + "schedule" => "5 4 * * *", + "timeout" => 300, + "entrypoint" => "index.js", + "commands" => "npm install", + "version" => "v2", + "installationId" => "6m40at4ejk5h2u9s1hboo", + "providerRepositoryId" => "appwrite", + "providerBranch" => "main", + "providerRootDirectory" => "functions/helloWorld", + "providerSilentMode" => true,); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->functions->get( + "<FUNCTION_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdate(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "execute" => array(), + "name" => "My Function", + "enabled" => true, + "live" => true, + "logging" => true, + "runtime" => "python-3.8", + "deployment" => "5e5ea5c16897e", + "scopes" => array(), + "vars" => array(), + "events" => array(), + "schedule" => "5 4 * * *", + "timeout" => 300, + "entrypoint" => "index.js", + "commands" => "npm install", + "version" => "v2", + "installationId" => "6m40at4ejk5h2u9s1hboo", + "providerRepositoryId" => "appwrite", + "providerBranch" => "main", + "providerRootDirectory" => "functions/helloWorld", + "providerSilentMode" => true,); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->functions->update( + "<FUNCTION_ID>", + "<NAME>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodDelete(): void { + + $data = ''; + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->functions->delete( + "<FUNCTION_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodListDeployments(): void { + + $data = array( + "total" => 5, + "deployments" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->functions->listDeployments( + "<FUNCTION_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateDeployment(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "vcs", + "resourceId" => "5e5ea6g16897e", + "resourceType" => "functions", + "entrypoint" => "index.js", + "size" => 128, + "buildId" => "5e5ea5c16897e", + "activate" => true, + "status" => "ready", + "buildLogs" => "Compiling source files...", + "buildTime" => 128, + "providerRepositoryName" => "database", + "providerRepositoryOwner" => "utopia", + "providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function", + "providerBranch" => "0.7.x", + "providerCommitHash" => "7c3f25d", + "providerCommitAuthorUrl" => "https://github.com/vermakhushboo", + "providerCommitAuthor" => "Khushboo Verma", + "providerCommitMessage" => "Update index.js", + "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", + "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->functions->createDeployment( + "<FUNCTION_ID>", + InputFile::withData('', "image/png"), + true + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetDeployment(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "vcs", + "resourceId" => "5e5ea6g16897e", + "resourceType" => "functions", + "entrypoint" => "index.js", + "size" => 128, + "buildId" => "5e5ea5c16897e", + "activate" => true, + "status" => "ready", + "buildLogs" => "Compiling source files...", + "buildTime" => 128, + "providerRepositoryName" => "database", + "providerRepositoryOwner" => "utopia", + "providerRepositoryUrl" => "https://github.com/vermakhushboo/g4-node-function", + "providerBranch" => "0.7.x", + "providerCommitHash" => "7c3f25d", + "providerCommitAuthorUrl" => "https://github.com/vermakhushboo", + "providerCommitAuthor" => "Khushboo Verma", + "providerCommitMessage" => "Update index.js", + "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", + "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->functions->getDeployment( + "<FUNCTION_ID>", + "<DEPLOYMENT_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateDeployment(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "execute" => array(), + "name" => "My Function", + "enabled" => true, + "live" => true, + "logging" => true, + "runtime" => "python-3.8", + "deployment" => "5e5ea5c16897e", + "scopes" => array(), + "vars" => array(), + "events" => array(), + "schedule" => "5 4 * * *", + "timeout" => 300, + "entrypoint" => "index.js", + "commands" => "npm install", + "version" => "v2", + "installationId" => "6m40at4ejk5h2u9s1hboo", + "providerRepositoryId" => "appwrite", + "providerBranch" => "main", + "providerRootDirectory" => "functions/helloWorld", + "providerSilentMode" => true,); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->functions->updateDeployment( + "<FUNCTION_ID>", + "<DEPLOYMENT_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodDeleteDeployment(): void { + + $data = ''; + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->functions->deleteDeployment( + "<FUNCTION_ID>", + "<DEPLOYMENT_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateBuild(): void { + + $data = ''; + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->functions->createBuild( + "<FUNCTION_ID>", + "<DEPLOYMENT_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateDeploymentBuild(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "deploymentId" => "5e5ea5c16897e", + "status" => "ready", + "stdout" => "", + "stderr" => "", + "startTime" => "2020-10-15T06:38:00.000+00:00", + "endTime" => "2020-10-15T06:38:00.000+00:00", + "duration" => 0, + "size" => 128,); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->functions->updateDeploymentBuild( + "<FUNCTION_ID>", + "<DEPLOYMENT_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetDeploymentDownload(): void { + + $data = ''; + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->functions->getDeploymentDownload( + "<FUNCTION_ID>", + "<DEPLOYMENT_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodListExecutions(): void { + + $data = array( + "total" => 5, + "executions" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->functions->listExecutions( + "<FUNCTION_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateExecution(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "functionId" => "5e5ea6g16897e", + "trigger" => "http", + "status" => "processing", + "requestMethod" => "GET", + "requestPath" => "/articles?id=5", + "requestHeaders" => array(), + "responseStatusCode" => 200, + "responseBody" => "Developers are awesome.", + "responseHeaders" => array(), + "logs" => "", + "errors" => "", + "duration" => 0.4,); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->functions->createExecution( + "<FUNCTION_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetExecution(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "functionId" => "5e5ea6g16897e", + "trigger" => "http", + "status" => "processing", + "requestMethod" => "GET", + "requestPath" => "/articles?id=5", + "requestHeaders" => array(), + "responseStatusCode" => 200, + "responseBody" => "Developers are awesome.", + "responseHeaders" => array(), + "logs" => "", + "errors" => "", + "duration" => 0.4,); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->functions->getExecution( + "<FUNCTION_ID>", + "<EXECUTION_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodDeleteExecution(): void { + + $data = ''; + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->functions->deleteExecution( + "<FUNCTION_ID>", + "<EXECUTION_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodListVariables(): void { + + $data = array( + "total" => 5, + "variables" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->functions->listVariables( + "<FUNCTION_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateVariable(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "API_KEY", + "value" => "myPa\$\$word1", + "resourceType" => "function", + "resourceId" => "myAwesomeFunction",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->functions->createVariable( + "<FUNCTION_ID>", + "<KEY>", + "<VALUE>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetVariable(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "API_KEY", + "value" => "myPa\$\$word1", + "resourceType" => "function", + "resourceId" => "myAwesomeFunction",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->functions->getVariable( + "<FUNCTION_ID>", + "<VARIABLE_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateVariable(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "API_KEY", + "value" => "myPa\$\$word1", + "resourceType" => "function", + "resourceId" => "myAwesomeFunction",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->functions->updateVariable( + "<FUNCTION_ID>", + "<VARIABLE_ID>", + "<KEY>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodDeleteVariable(): void { + + $data = ''; + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->functions->deleteVariable( + "<FUNCTION_ID>", + "<VARIABLE_ID>" + ); + + $this->assertSame($data, $response); + } + +} diff --git a/tests/Appwrite/Services/GraphqlTest.php b/tests/Appwrite/Services/GraphqlTest.php new file mode 100644 index 0000000..6c587b8 --- /dev/null +++ b/tests/Appwrite/Services/GraphqlTest.php @@ -0,0 +1,51 @@ +<?php + +namespace Appwrite\Services; + +use Appwrite\Client; +use Appwrite\InputFile; +use Mockery; +use PHPUnit\Framework\TestCase; + +final class GraphqlTest extends TestCase { + private $client; + private $graphql; + + protected function setUp(): void { + $this->client = Mockery::mock(Client::class); + $this->graphql = new Graphql($this->client); + } + + public function testMethodQuery(): void { + + $data = array(); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->graphql->query( + array() + ); + + $this->assertSame($data, $response); + } + + public function testMethodMutation(): void { + + $data = array(); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->graphql->mutation( + array() + ); + + $this->assertSame($data, $response); + } + +} diff --git a/tests/Appwrite/Services/HealthTest.php b/tests/Appwrite/Services/HealthTest.php new file mode 100644 index 0000000..bed4e21 --- /dev/null +++ b/tests/Appwrite/Services/HealthTest.php @@ -0,0 +1,410 @@ +<?php + +namespace Appwrite\Services; + +use Appwrite\Client; +use Appwrite\InputFile; +use Mockery; +use PHPUnit\Framework\TestCase; + +final class HealthTest extends TestCase { + private $client; + private $health; + + protected function setUp(): void { + $this->client = Mockery::mock(Client::class); + $this->health = new Health($this->client); + } + + public function testMethodGet(): void { + + $data = array( + "name" => "database", + "ping" => 128, + "status" => "pass",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->health->get( + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetAntivirus(): void { + + $data = array( + "version" => "1.0.0", + "status" => "online",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->health->getAntivirus( + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetCache(): void { + + $data = array( + "name" => "database", + "ping" => 128, + "status" => "pass",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->health->getCache( + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetCertificate(): void { + + $data = array( + "name" => "/CN=www.google.com", + "subjectSN" => "", + "issuerOrganisation" => "", + "validFrom" => "1704200998", + "validTo" => "1711458597", + "signatureTypeSN" => "RSA-SHA256",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->health->getCertificate( + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetDB(): void { + + $data = array( + "name" => "database", + "ping" => 128, + "status" => "pass",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->health->getDB( + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetPubSub(): void { + + $data = array( + "name" => "database", + "ping" => 128, + "status" => "pass",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->health->getPubSub( + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetQueue(): void { + + $data = array( + "name" => "database", + "ping" => 128, + "status" => "pass",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->health->getQueue( + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetQueueBuilds(): void { + + $data = array( + "size" => 8,); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->health->getQueueBuilds( + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetQueueCertificates(): void { + + $data = array( + "size" => 8,); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->health->getQueueCertificates( + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetQueueDatabases(): void { + + $data = array( + "size" => 8,); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->health->getQueueDatabases( + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetQueueDeletes(): void { + + $data = array( + "size" => 8,); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->health->getQueueDeletes( + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetFailedJobs(): void { + + $data = array( + "size" => 8,); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->health->getFailedJobs( + "v1-database" + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetQueueFunctions(): void { + + $data = array( + "size" => 8,); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->health->getQueueFunctions( + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetQueueLogs(): void { + + $data = array( + "size" => 8,); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->health->getQueueLogs( + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetQueueMails(): void { + + $data = array( + "size" => 8,); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->health->getQueueMails( + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetQueueMessaging(): void { + + $data = array( + "size" => 8,); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->health->getQueueMessaging( + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetQueueMigrations(): void { + + $data = array( + "size" => 8,); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->health->getQueueMigrations( + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetQueueUsage(): void { + + $data = array( + "size" => 8,); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->health->getQueueUsage( + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetQueueUsageDump(): void { + + $data = array( + "size" => 8,); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->health->getQueueUsageDump( + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetQueueWebhooks(): void { + + $data = array( + "size" => 8,); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->health->getQueueWebhooks( + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetStorage(): void { + + $data = array( + "name" => "database", + "ping" => 128, + "status" => "pass",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->health->getStorage( + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetStorageLocal(): void { + + $data = array( + "name" => "database", + "ping" => 128, + "status" => "pass",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->health->getStorageLocal( + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetTime(): void { + + $data = array( + "remoteTime" => 1639490751, + "localTime" => 1639490844, + "diff" => 93,); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->health->getTime( + ); + + $this->assertSame($data, $response); + } + +} diff --git a/tests/Appwrite/Services/LocaleTest.php b/tests/Appwrite/Services/LocaleTest.php new file mode 100644 index 0000000..6e8f9db --- /dev/null +++ b/tests/Appwrite/Services/LocaleTest.php @@ -0,0 +1,160 @@ +<?php + +namespace Appwrite\Services; + +use Appwrite\Client; +use Appwrite\InputFile; +use Mockery; +use PHPUnit\Framework\TestCase; + +final class LocaleTest extends TestCase { + private $client; + private $locale; + + protected function setUp(): void { + $this->client = Mockery::mock(Client::class); + $this->locale = new Locale($this->client); + } + + public function testMethodGet(): void { + + $data = array( + "ip" => "127.0.0.1", + "countryCode" => "US", + "country" => "United States", + "continentCode" => "NA", + "continent" => "North America", + "eu" => true, + "currency" => "USD",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->locale->get( + ); + + $this->assertSame($data, $response); + } + + public function testMethodListCodes(): void { + + $data = array( + "total" => 5, + "localeCodes" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->locale->listCodes( + ); + + $this->assertSame($data, $response); + } + + public function testMethodListContinents(): void { + + $data = array( + "total" => 5, + "continents" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->locale->listContinents( + ); + + $this->assertSame($data, $response); + } + + public function testMethodListCountries(): void { + + $data = array( + "total" => 5, + "countries" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->locale->listCountries( + ); + + $this->assertSame($data, $response); + } + + public function testMethodListCountriesEU(): void { + + $data = array( + "total" => 5, + "countries" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->locale->listCountriesEU( + ); + + $this->assertSame($data, $response); + } + + public function testMethodListCountriesPhones(): void { + + $data = array( + "total" => 5, + "phones" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->locale->listCountriesPhones( + ); + + $this->assertSame($data, $response); + } + + public function testMethodListCurrencies(): void { + + $data = array( + "total" => 5, + "currencies" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->locale->listCurrencies( + ); + + $this->assertSame($data, $response); + } + + public function testMethodListLanguages(): void { + + $data = array( + "total" => 5, + "languages" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->locale->listLanguages( + ); + + $this->assertSame($data, $response); + } + +} diff --git a/tests/Appwrite/Services/MessagingTest.php b/tests/Appwrite/Services/MessagingTest.php new file mode 100644 index 0000000..49cdac9 --- /dev/null +++ b/tests/Appwrite/Services/MessagingTest.php @@ -0,0 +1,1071 @@ +<?php + +namespace Appwrite\Services; + +use Appwrite\Client; +use Appwrite\InputFile; +use Mockery; +use PHPUnit\Framework\TestCase; + +final class MessagingTest extends TestCase { + private $client; + private $messaging; + + protected function setUp(): void { + $this->client = Mockery::mock(Client::class); + $this->messaging = new Messaging($this->client); + } + + public function testMethodListMessages(): void { + + $data = array( + "total" => 5, + "messages" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->listMessages( + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateEmail(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "providerType" => "email", + "topics" => array(), + "users" => array(), + "targets" => array(), + "deliveredTotal" => 1, + "data" => array(), + "status" => "Message status can be one of the following: draft, processing, scheduled, sent, or failed.",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->createEmail( + "<MESSAGE_ID>", + "<SUBJECT>", + "<CONTENT>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateEmail(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "providerType" => "email", + "topics" => array(), + "users" => array(), + "targets" => array(), + "deliveredTotal" => 1, + "data" => array(), + "status" => "Message status can be one of the following: draft, processing, scheduled, sent, or failed.",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->updateEmail( + "<MESSAGE_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreatePush(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "providerType" => "email", + "topics" => array(), + "users" => array(), + "targets" => array(), + "deliveredTotal" => 1, + "data" => array(), + "status" => "Message status can be one of the following: draft, processing, scheduled, sent, or failed.",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->createPush( + "<MESSAGE_ID>", + "<TITLE>", + "<BODY>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdatePush(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "providerType" => "email", + "topics" => array(), + "users" => array(), + "targets" => array(), + "deliveredTotal" => 1, + "data" => array(), + "status" => "Message status can be one of the following: draft, processing, scheduled, sent, or failed.",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->updatePush( + "<MESSAGE_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateSms(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "providerType" => "email", + "topics" => array(), + "users" => array(), + "targets" => array(), + "deliveredTotal" => 1, + "data" => array(), + "status" => "Message status can be one of the following: draft, processing, scheduled, sent, or failed.",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->createSms( + "<MESSAGE_ID>", + "<CONTENT>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateSms(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "providerType" => "email", + "topics" => array(), + "users" => array(), + "targets" => array(), + "deliveredTotal" => 1, + "data" => array(), + "status" => "Message status can be one of the following: draft, processing, scheduled, sent, or failed.",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->updateSms( + "<MESSAGE_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetMessage(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "providerType" => "email", + "topics" => array(), + "users" => array(), + "targets" => array(), + "deliveredTotal" => 1, + "data" => array(), + "status" => "Message status can be one of the following: draft, processing, scheduled, sent, or failed.",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->getMessage( + "<MESSAGE_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodDelete(): void { + + $data = ''; + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->delete( + "<MESSAGE_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodListMessageLogs(): void { + + $data = array( + "total" => 5, + "logs" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->listMessageLogs( + "<MESSAGE_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodListTargets(): void { + + $data = array( + "total" => 5, + "targets" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->listTargets( + "<MESSAGE_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodListProviders(): void { + + $data = array( + "total" => 5, + "providers" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->listProviders( + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateApnsProvider(): void { + + $data = array( + "\$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" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->createApnsProvider( + "<PROVIDER_ID>", + "<NAME>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateApnsProvider(): void { + + $data = array( + "\$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" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->updateApnsProvider( + "<PROVIDER_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateFcmProvider(): void { + + $data = array( + "\$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" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->createFcmProvider( + "<PROVIDER_ID>", + "<NAME>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateFcmProvider(): void { + + $data = array( + "\$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" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->updateFcmProvider( + "<PROVIDER_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateMailgunProvider(): void { + + $data = array( + "\$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" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->createMailgunProvider( + "<PROVIDER_ID>", + "<NAME>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateMailgunProvider(): void { + + $data = array( + "\$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" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->updateMailgunProvider( + "<PROVIDER_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateMsg91Provider(): void { + + $data = array( + "\$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" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->createMsg91Provider( + "<PROVIDER_ID>", + "<NAME>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateMsg91Provider(): void { + + $data = array( + "\$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" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->updateMsg91Provider( + "<PROVIDER_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateSendgridProvider(): void { + + $data = array( + "\$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" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->createSendgridProvider( + "<PROVIDER_ID>", + "<NAME>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateSendgridProvider(): void { + + $data = array( + "\$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" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->updateSendgridProvider( + "<PROVIDER_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateSmtpProvider(): void { + + $data = array( + "\$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" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->createSmtpProvider( + "<PROVIDER_ID>", + "<NAME>", + "<HOST>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateSmtpProvider(): void { + + $data = array( + "\$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" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->updateSmtpProvider( + "<PROVIDER_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateTelesignProvider(): void { + + $data = array( + "\$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" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->createTelesignProvider( + "<PROVIDER_ID>", + "<NAME>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateTelesignProvider(): void { + + $data = array( + "\$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" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->updateTelesignProvider( + "<PROVIDER_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateTextmagicProvider(): void { + + $data = array( + "\$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" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->createTextmagicProvider( + "<PROVIDER_ID>", + "<NAME>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateTextmagicProvider(): void { + + $data = array( + "\$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" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->updateTextmagicProvider( + "<PROVIDER_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateTwilioProvider(): void { + + $data = array( + "\$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" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->createTwilioProvider( + "<PROVIDER_ID>", + "<NAME>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateTwilioProvider(): void { + + $data = array( + "\$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" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->updateTwilioProvider( + "<PROVIDER_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateVonageProvider(): void { + + $data = array( + "\$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" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->createVonageProvider( + "<PROVIDER_ID>", + "<NAME>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateVonageProvider(): void { + + $data = array( + "\$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" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->updateVonageProvider( + "<PROVIDER_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetProvider(): void { + + $data = array( + "\$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" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->getProvider( + "<PROVIDER_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodDeleteProvider(): void { + + $data = ''; + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->deleteProvider( + "<PROVIDER_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodListProviderLogs(): void { + + $data = array( + "total" => 5, + "logs" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->listProviderLogs( + "<PROVIDER_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodListSubscriberLogs(): void { + + $data = array( + "total" => 5, + "logs" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->listSubscriberLogs( + "<SUBSCRIBER_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodListTopics(): void { + + $data = array( + "total" => 5, + "topics" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->listTopics( + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateTopic(): void { + + $data = array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "events", + "emailTotal" => 100, + "smsTotal" => 100, + "pushTotal" => 100, + "subscribe" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->createTopic( + "<TOPIC_ID>", + "<NAME>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetTopic(): void { + + $data = array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "events", + "emailTotal" => 100, + "smsTotal" => 100, + "pushTotal" => 100, + "subscribe" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->getTopic( + "<TOPIC_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateTopic(): void { + + $data = array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "events", + "emailTotal" => 100, + "smsTotal" => 100, + "pushTotal" => 100, + "subscribe" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->updateTopic( + "<TOPIC_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodDeleteTopic(): void { + + $data = ''; + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->deleteTopic( + "<TOPIC_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodListTopicLogs(): void { + + $data = array( + "total" => 5, + "logs" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->listTopicLogs( + "<TOPIC_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodListSubscribers(): void { + + $data = array( + "total" => 5, + "subscribers" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->listSubscribers( + "<TOPIC_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateSubscriber(): void { + + $data = array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "targetId" => "259125845563242502", + "target" => array(), + "userId" => "5e5ea5c16897e", + "userName" => "Aegon Targaryen", + "topicId" => "259125845563242502", + "providerType" => "email",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->createSubscriber( + "<TOPIC_ID>", + "<SUBSCRIBER_ID>", + "<TARGET_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetSubscriber(): void { + + $data = array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "targetId" => "259125845563242502", + "target" => array(), + "userId" => "5e5ea5c16897e", + "userName" => "Aegon Targaryen", + "topicId" => "259125845563242502", + "providerType" => "email",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->getSubscriber( + "<TOPIC_ID>", + "<SUBSCRIBER_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodDeleteSubscriber(): void { + + $data = ''; + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->deleteSubscriber( + "<TOPIC_ID>", + "<SUBSCRIBER_ID>" + ); + + $this->assertSame($data, $response); + } + +} diff --git a/tests/Appwrite/Services/StorageTest.php b/tests/Appwrite/Services/StorageTest.php new file mode 100644 index 0000000..e6b1923 --- /dev/null +++ b/tests/Appwrite/Services/StorageTest.php @@ -0,0 +1,309 @@ +<?php + +namespace Appwrite\Services; + +use Appwrite\Client; +use Appwrite\InputFile; +use Mockery; +use PHPUnit\Framework\TestCase; + +final class StorageTest extends TestCase { + private $client; + private $storage; + + protected function setUp(): void { + $this->client = Mockery::mock(Client::class); + $this->storage = new Storage($this->client); + } + + public function testMethodListBuckets(): void { + + $data = array( + "total" => 5, + "buckets" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->storage->listBuckets( + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateBucket(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "fileSecurity" => true, + "name" => "Documents", + "enabled" => true, + "maximumFileSize" => 100, + "allowedFileExtensions" => array(), + "compression" => "gzip", + "encryption" => true, + "antivirus" => true,); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->storage->createBucket( + "<BUCKET_ID>", + "<NAME>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetBucket(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "fileSecurity" => true, + "name" => "Documents", + "enabled" => true, + "maximumFileSize" => 100, + "allowedFileExtensions" => array(), + "compression" => "gzip", + "encryption" => true, + "antivirus" => true,); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->storage->getBucket( + "<BUCKET_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateBucket(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "fileSecurity" => true, + "name" => "Documents", + "enabled" => true, + "maximumFileSize" => 100, + "allowedFileExtensions" => array(), + "compression" => "gzip", + "encryption" => true, + "antivirus" => true,); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->storage->updateBucket( + "<BUCKET_ID>", + "<NAME>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodDeleteBucket(): void { + + $data = ''; + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->storage->deleteBucket( + "<BUCKET_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodListFiles(): void { + + $data = array( + "total" => 5, + "files" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->storage->listFiles( + "<BUCKET_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateFile(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "bucketId" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "name" => "Pink.png", + "signature" => "5d529fd02b544198ae075bd57c1762bb", + "mimeType" => "image/png", + "sizeOriginal" => 17890, + "chunksTotal" => 17890, + "chunksUploaded" => 17890,); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->storage->createFile( + "<BUCKET_ID>", + "<FILE_ID>", + InputFile::withData('', "image/png") + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetFile(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "bucketId" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "name" => "Pink.png", + "signature" => "5d529fd02b544198ae075bd57c1762bb", + "mimeType" => "image/png", + "sizeOriginal" => 17890, + "chunksTotal" => 17890, + "chunksUploaded" => 17890,); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->storage->getFile( + "<BUCKET_ID>", + "<FILE_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateFile(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "bucketId" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "name" => "Pink.png", + "signature" => "5d529fd02b544198ae075bd57c1762bb", + "mimeType" => "image/png", + "sizeOriginal" => 17890, + "chunksTotal" => 17890, + "chunksUploaded" => 17890,); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->storage->updateFile( + "<BUCKET_ID>", + "<FILE_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodDeleteFile(): void { + + $data = ''; + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->storage->deleteFile( + "<BUCKET_ID>", + "<FILE_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetFileDownload(): void { + + $data = ''; + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->storage->getFileDownload( + "<BUCKET_ID>", + "<FILE_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetFilePreview(): void { + + $data = ''; + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->storage->getFilePreview( + "<BUCKET_ID>", + "<FILE_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetFileView(): void { + + $data = ''; + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->storage->getFileView( + "<BUCKET_ID>", + "<FILE_ID>" + ); + + $this->assertSame($data, $response); + } + +} diff --git a/tests/Appwrite/Services/TeamsTest.php b/tests/Appwrite/Services/TeamsTest.php new file mode 100644 index 0000000..d77d0de --- /dev/null +++ b/tests/Appwrite/Services/TeamsTest.php @@ -0,0 +1,311 @@ +<?php + +namespace Appwrite\Services; + +use Appwrite\Client; +use Appwrite\InputFile; +use Mockery; +use PHPUnit\Framework\TestCase; + +final class TeamsTest extends TestCase { + private $client; + private $teams; + + protected function setUp(): void { + $this->client = Mockery::mock(Client::class); + $this->teams = new Teams($this->client); + } + + public function testMethodList(): void { + + $data = array( + "total" => 5, + "teams" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->teams->list( + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreate(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "VIP", + "total" => 7, + "prefs" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->teams->create( + "<TEAM_ID>", + "<NAME>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodGet(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "VIP", + "total" => 7, + "prefs" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->teams->get( + "<TEAM_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateName(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "VIP", + "total" => 7, + "prefs" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->teams->updateName( + "<TEAM_ID>", + "<NAME>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodDelete(): void { + + $data = ''; + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->teams->delete( + "<TEAM_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodListMemberships(): void { + + $data = array( + "total" => 5, + "memberships" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->teams->listMemberships( + "<TEAM_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateMembership(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5ea5c16897e", + "userName" => "John Doe", + "userEmail" => "john@appwrite.io", + "teamId" => "5e5ea5c16897e", + "teamName" => "VIP", + "invited" => "2020-10-15T06:38:00.000+00:00", + "joined" => "2020-10-15T06:38:00.000+00:00", + "confirm" => true, + "mfa" => true, + "roles" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->teams->createMembership( + "<TEAM_ID>", + array() + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetMembership(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5ea5c16897e", + "userName" => "John Doe", + "userEmail" => "john@appwrite.io", + "teamId" => "5e5ea5c16897e", + "teamName" => "VIP", + "invited" => "2020-10-15T06:38:00.000+00:00", + "joined" => "2020-10-15T06:38:00.000+00:00", + "confirm" => true, + "mfa" => true, + "roles" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->teams->getMembership( + "<TEAM_ID>", + "<MEMBERSHIP_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateMembership(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5ea5c16897e", + "userName" => "John Doe", + "userEmail" => "john@appwrite.io", + "teamId" => "5e5ea5c16897e", + "teamName" => "VIP", + "invited" => "2020-10-15T06:38:00.000+00:00", + "joined" => "2020-10-15T06:38:00.000+00:00", + "confirm" => true, + "mfa" => true, + "roles" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->teams->updateMembership( + "<TEAM_ID>", + "<MEMBERSHIP_ID>", + array() + ); + + $this->assertSame($data, $response); + } + + public function testMethodDeleteMembership(): void { + + $data = ''; + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->teams->deleteMembership( + "<TEAM_ID>", + "<MEMBERSHIP_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateMembershipStatus(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5ea5c16897e", + "userName" => "John Doe", + "userEmail" => "john@appwrite.io", + "teamId" => "5e5ea5c16897e", + "teamName" => "VIP", + "invited" => "2020-10-15T06:38:00.000+00:00", + "joined" => "2020-10-15T06:38:00.000+00:00", + "confirm" => true, + "mfa" => true, + "roles" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->teams->updateMembershipStatus( + "<TEAM_ID>", + "<MEMBERSHIP_ID>", + "<USER_ID>", + "<SECRET>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetPrefs(): void { + + $data = array(); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->teams->getPrefs( + "<TEAM_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdatePrefs(): void { + + $data = array(); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->teams->updatePrefs( + "<TEAM_ID>", + array() + ); + + $this->assertSame($data, $response); + } + +} diff --git a/tests/Appwrite/Services/UsersTest.php b/tests/Appwrite/Services/UsersTest.php new file mode 100644 index 0000000..4cb0911 --- /dev/null +++ b/tests/Appwrite/Services/UsersTest.php @@ -0,0 +1,1109 @@ +<?php + +namespace Appwrite\Services; + +use Appwrite\Client; +use Appwrite\InputFile; +use Mockery; +use PHPUnit\Framework\TestCase; + +final class UsersTest extends TestCase { + private $client; + private $users; + + protected function setUp(): void { + $this->client = Mockery::mock(Client::class); + $this->users = new Users($this->client); + } + + public function testMethodList(): void { + + $data = array( + "total" => 5, + "users" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->users->list( + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreate(): void { + + $data = array( + "\$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" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array(), + "accessedAt" => "2020-10-15T06:38:00.000+00:00",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->users->create( + "<USER_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateArgon2User(): void { + + $data = array( + "\$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" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array(), + "accessedAt" => "2020-10-15T06:38:00.000+00:00",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->users->createArgon2User( + "<USER_ID>", + "email@example.com", + "password" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateBcryptUser(): void { + + $data = array( + "\$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" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array(), + "accessedAt" => "2020-10-15T06:38:00.000+00:00",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->users->createBcryptUser( + "<USER_ID>", + "email@example.com", + "password" + ); + + $this->assertSame($data, $response); + } + + public function testMethodListIdentities(): void { + + $data = array( + "total" => 5, + "identities" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->users->listIdentities( + ); + + $this->assertSame($data, $response); + } + + public function testMethodDeleteIdentity(): void { + + $data = ''; + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->users->deleteIdentity( + "<IDENTITY_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateMD5User(): void { + + $data = array( + "\$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" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array(), + "accessedAt" => "2020-10-15T06:38:00.000+00:00",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->users->createMD5User( + "<USER_ID>", + "email@example.com", + "password" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreatePHPassUser(): void { + + $data = array( + "\$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" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array(), + "accessedAt" => "2020-10-15T06:38:00.000+00:00",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->users->createPHPassUser( + "<USER_ID>", + "email@example.com", + "password" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateScryptUser(): void { + + $data = array( + "\$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" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array(), + "accessedAt" => "2020-10-15T06:38:00.000+00:00",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->users->createScryptUser( + "<USER_ID>", + "email@example.com", + "password", + "<PASSWORD_SALT>", + 1, + 1, + 1, + 1 + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateScryptModifiedUser(): void { + + $data = array( + "\$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" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array(), + "accessedAt" => "2020-10-15T06:38:00.000+00:00",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->users->createScryptModifiedUser( + "<USER_ID>", + "email@example.com", + "password", + "<PASSWORD_SALT>", + "<PASSWORD_SALT_SEPARATOR>", + "<PASSWORD_SIGNER_KEY>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateSHAUser(): void { + + $data = array( + "\$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" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array(), + "accessedAt" => "2020-10-15T06:38:00.000+00:00",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->users->createSHAUser( + "<USER_ID>", + "email@example.com", + "password" + ); + + $this->assertSame($data, $response); + } + + public function testMethodGet(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "John Doe", + "registration" => "2020-10-15T06:38:00.000+00:00", + "status" => true, + "labels" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array(), + "accessedAt" => "2020-10-15T06:38:00.000+00:00",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->users->get( + "<USER_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodDelete(): void { + + $data = ''; + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->users->delete( + "<USER_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateEmail(): void { + + $data = array( + "\$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" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array(), + "accessedAt" => "2020-10-15T06:38:00.000+00:00",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->users->updateEmail( + "<USER_ID>", + "email@example.com" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateJWT(): void { + + $data = array( + "jwt" => "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->users->createJWT( + "<USER_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateLabels(): void { + + $data = array( + "\$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" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array(), + "accessedAt" => "2020-10-15T06:38:00.000+00:00",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->users->updateLabels( + "<USER_ID>", + array() + ); + + $this->assertSame($data, $response); + } + + public function testMethodListLogs(): void { + + $data = array( + "total" => 5, + "logs" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->users->listLogs( + "<USER_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodListMemberships(): void { + + $data = array( + "total" => 5, + "memberships" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->users->listMemberships( + "<USER_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateMfa(): void { + + $data = array( + "\$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" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array(), + "accessedAt" => "2020-10-15T06:38:00.000+00:00",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->users->updateMfa( + "<USER_ID>", + true + ); + + $this->assertSame($data, $response); + } + + public function testMethodDeleteMfaAuthenticator(): void { + + $data = array( + "\$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" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array(), + "accessedAt" => "2020-10-15T06:38:00.000+00:00",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->users->deleteMfaAuthenticator( + "<USER_ID>", + "totp" + ); + + $this->assertSame($data, $response); + } + + public function testMethodListMfaFactors(): void { + + $data = array( + "totp" => true, + "phone" => true, + "email" => true, + "recoveryCode" => true,); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->users->listMfaFactors( + "<USER_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetMfaRecoveryCodes(): void { + + $data = array( + "recoveryCodes" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->users->getMfaRecoveryCodes( + "<USER_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateMfaRecoveryCodes(): void { + + $data = array( + "recoveryCodes" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->users->updateMfaRecoveryCodes( + "<USER_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateMfaRecoveryCodes(): void { + + $data = array( + "recoveryCodes" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->users->createMfaRecoveryCodes( + "<USER_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateName(): void { + + $data = array( + "\$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" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array(), + "accessedAt" => "2020-10-15T06:38:00.000+00:00",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->users->updateName( + "<USER_ID>", + "<NAME>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdatePassword(): void { + + $data = array( + "\$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" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array(), + "accessedAt" => "2020-10-15T06:38:00.000+00:00",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->users->updatePassword( + "<USER_ID>", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdatePhone(): void { + + $data = array( + "\$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" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array(), + "accessedAt" => "2020-10-15T06:38:00.000+00:00",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->users->updatePhone( + "<USER_ID>", + "+12065550100" + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetPrefs(): void { + + $data = array(); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->users->getPrefs( + "<USER_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdatePrefs(): void { + + $data = array(); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->users->updatePrefs( + "<USER_ID>", + array() + ); + + $this->assertSame($data, $response); + } + + public function testMethodListSessions(): void { + + $data = array( + "total" => 5, + "sessions" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->users->listSessions( + "<USER_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateSession(): void { + + $data = array( + "\$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" => array(), + "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); + + $response = $this->users->createSession( + "<USER_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodDeleteSessions(): void { + + $data = ''; + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->users->deleteSessions( + "<USER_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodDeleteSession(): void { + + $data = ''; + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->users->deleteSession( + "<USER_ID>", + "<SESSION_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateStatus(): void { + + $data = array( + "\$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" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array(), + "accessedAt" => "2020-10-15T06:38:00.000+00:00",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->users->updateStatus( + "<USER_ID>", + true + ); + + $this->assertSame($data, $response); + } + + public function testMethodListTargets(): void { + + $data = array( + "total" => 5, + "targets" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->users->listTargets( + "<USER_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateTarget(): void { + + $data = array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Aegon apple token", + "userId" => "259125845563242502", + "providerType" => "email", + "identifier" => "token",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->users->createTarget( + "<USER_ID>", + "<TARGET_ID>", + "email", + "<IDENTIFIER>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetTarget(): void { + + $data = array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Aegon apple token", + "userId" => "259125845563242502", + "providerType" => "email", + "identifier" => "token",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->users->getTarget( + "<USER_ID>", + "<TARGET_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateTarget(): void { + + $data = array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Aegon apple token", + "userId" => "259125845563242502", + "providerType" => "email", + "identifier" => "token",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->users->updateTarget( + "<USER_ID>", + "<TARGET_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodDeleteTarget(): void { + + $data = ''; + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->users->deleteTarget( + "<USER_ID>", + "<TARGET_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateToken(): void { + + $data = array( + "\$id" => "bb8ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5ea5c168bb8", + "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); + + $response = $this->users->createToken( + "<USER_ID>" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateEmailVerification(): void { + + $data = array( + "\$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" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array(), + "accessedAt" => "2020-10-15T06:38:00.000+00:00",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->users->updateEmailVerification( + "<USER_ID>", + true + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdatePhoneVerification(): void { + + $data = array( + "\$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" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array(), + "accessedAt" => "2020-10-15T06:38:00.000+00:00",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->users->updatePhoneVerification( + "<USER_ID>", + true + ); + + $this->assertSame($data, $response); + } + +} From 71b764c94012d102bd33e9b3fc014e471f574880 Mon Sep 17 00:00:00 2001 From: root <christyjacob4@gmail.com> Date: Tue, 20 Aug 2024 11:03:11 +0000 Subject: [PATCH 4/9] chore: update SDKs to new RC version --- docs/examples/functions/create.md | 3 +- .../examples/functions/list-specifications.md | 13 +++++ docs/examples/functions/update.md | 3 +- docs/functions.md | 11 ++++ src/Appwrite/Client.php | 4 +- src/Appwrite/Services/Functions.php | 54 +++++++++++++++++-- tests/Appwrite/Services/FunctionsTest.php | 29 ++++++++-- 7 files changed, 105 insertions(+), 12 deletions(-) create mode 100644 docs/examples/functions/list-specifications.md diff --git a/docs/examples/functions/create.md b/docs/examples/functions/create.md index 44ff159..8c59076 100644 --- a/docs/examples/functions/create.md +++ b/docs/examples/functions/create.md @@ -32,5 +32,6 @@ $result = $functions->create( templateRepository: '<TEMPLATE_REPOSITORY>', // optional templateOwner: '<TEMPLATE_OWNER>', // optional templateRootDirectory: '<TEMPLATE_ROOT_DIRECTORY>', // optional - templateVersion: '<TEMPLATE_VERSION>' // optional + templateVersion: '<TEMPLATE_VERSION>', // optional + specification: '' // optional ); \ No newline at end of file diff --git a/docs/examples/functions/list-specifications.md b/docs/examples/functions/list-specifications.md new file mode 100644 index 0000000..678c2fa --- /dev/null +++ b/docs/examples/functions/list-specifications.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Functions; + +$client = (new Client()) + ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$functions = new Functions($client); + +$result = $functions->listSpecifications(); diff --git a/docs/examples/functions/update.md b/docs/examples/functions/update.md index db0d50a..bd028cb 100644 --- a/docs/examples/functions/update.md +++ b/docs/examples/functions/update.md @@ -27,5 +27,6 @@ $result = $functions->update( providerRepositoryId: '<PROVIDER_REPOSITORY_ID>', // optional providerBranch: '<PROVIDER_BRANCH>', // optional providerSilentMode: false, // optional - providerRootDirectory: '<PROVIDER_ROOT_DIRECTORY>' // optional + providerRootDirectory: '<PROVIDER_ROOT_DIRECTORY>', // optional + specification: '' // optional ); \ No newline at end of file diff --git a/docs/functions.md b/docs/functions.md index 06fccc8..08a932c 100644 --- a/docs/functions.md +++ b/docs/functions.md @@ -48,6 +48,7 @@ POST https://cloud.appwrite.io/v1/functions | templateOwner | string | The name of the owner of the template. | | | templateRootDirectory | string | Path to function code in the template repo. | | | templateVersion | string | Version (tag) for the repo linked to the function template. | | +| specification | string | Runtime specification for the function and builds. | s-0.5vcpu-512mb | ## List runtimes @@ -57,6 +58,15 @@ GET https://cloud.appwrite.io/v1/functions/runtimes ** Get a list of all runtimes that are currently active on your instance. ** +## List available function runtime specifications + +```http request +GET https://cloud.appwrite.io/v1/functions/specifications +``` + +** List allowed function specifications for this instance. + ** + ## List function templates ```http request @@ -131,6 +141,7 @@ PUT https://cloud.appwrite.io/v1/functions/{functionId} | providerBranch | string | Production branch for the repo linked to the function | | | providerSilentMode | boolean | Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests. | | | providerRootDirectory | string | Path to function code in the linked repo. | | +| specification | string | Runtime specification for the function and builds. | s-0.5vcpu-512mb | ## Delete function diff --git a/src/Appwrite/Client.php b/src/Appwrite/Client.php index 2f7e61a..8314ca8 100644 --- a/src/Appwrite/Client.php +++ b/src/Appwrite/Client.php @@ -37,11 +37,11 @@ class Client */ protected array $headers = [ 'content-type' => '', - 'user-agent' => 'AppwritePHPSDK/12.0.0-rc.1 ()', + 'user-agent' => 'AppwritePHPSDK/12.0.0-rc.2 ()', 'x-sdk-name'=> 'PHP', 'x-sdk-platform'=> 'server', 'x-sdk-language'=> 'php', - 'x-sdk-version'=> '12.0.0-rc.1', + 'x-sdk-version'=> '12.0.0-rc.2', ]; /** diff --git a/src/Appwrite/Services/Functions.php b/src/Appwrite/Services/Functions.php index 56521f1..57e4830 100644 --- a/src/Appwrite/Services/Functions.php +++ b/src/Appwrite/Services/Functions.php @@ -85,10 +85,11 @@ public function list(?array $queries = null, ?string $search = null): array * @param ?string $templateOwner * @param ?string $templateRootDirectory * @param ?string $templateVersion + * @param ?string $specification * @throws AppwriteException * @return array */ - public function create(string $functionId, string $name, Runtime $runtime, ?array $execute = null, ?array $events = null, ?string $schedule = null, ?int $timeout = null, ?bool $enabled = null, ?bool $logging = null, ?string $entrypoint = null, ?string $commands = null, ?array $scopes = null, ?string $installationId = null, ?string $providerRepositoryId = null, ?string $providerBranch = null, ?bool $providerSilentMode = null, ?string $providerRootDirectory = null, ?string $templateRepository = null, ?string $templateOwner = null, ?string $templateRootDirectory = null, ?string $templateVersion = null): array + public function create(string $functionId, string $name, Runtime $runtime, ?array $execute = null, ?array $events = null, ?string $schedule = null, ?int $timeout = null, ?bool $enabled = null, ?bool $logging = null, ?string $entrypoint = null, ?string $commands = null, ?array $scopes = null, ?string $installationId = null, ?string $providerRepositoryId = null, ?string $providerBranch = null, ?bool $providerSilentMode = null, ?string $providerRootDirectory = null, ?string $templateRepository = null, ?string $templateOwner = null, ?string $templateRootDirectory = null, ?string $templateVersion = null, ?string $specification = null): array { $apiPath = str_replace( [], @@ -173,6 +174,10 @@ public function create(string $functionId, string $name, Runtime $runtime, ?arra $apiParams['templateVersion'] = $templateVersion; } + if (!is_null($specification)) { + $apiParams['specification'] = $specification; + } + $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -213,6 +218,36 @@ public function listRuntimes(): array ); } + /** + * List available function runtime specifications + * + * List allowed function specifications for this instance. + * + * + * @throws AppwriteException + * @return array + */ + public function listSpecifications(): array + { + $apiPath = str_replace( + [], + [], + '/functions/specifications' + ); + + $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * List function templates * @@ -350,10 +385,11 @@ public function get(string $functionId): array * @param ?string $providerBranch * @param ?bool $providerSilentMode * @param ?string $providerRootDirectory + * @param ?string $specification * @throws AppwriteException * @return array */ - public function update(string $functionId, string $name, ?Runtime $runtime = null, ?array $execute = null, ?array $events = null, ?string $schedule = null, ?int $timeout = null, ?bool $enabled = null, ?bool $logging = null, ?string $entrypoint = null, ?string $commands = null, ?array $scopes = null, ?string $installationId = null, ?string $providerRepositoryId = null, ?string $providerBranch = null, ?bool $providerSilentMode = null, ?string $providerRootDirectory = null): array + public function update(string $functionId, string $name, ?Runtime $runtime = null, ?array $execute = null, ?array $events = null, ?string $schedule = null, ?int $timeout = null, ?bool $enabled = null, ?bool $logging = null, ?string $entrypoint = null, ?string $commands = null, ?array $scopes = null, ?string $installationId = null, ?string $providerRepositoryId = null, ?string $providerBranch = null, ?bool $providerSilentMode = null, ?string $providerRootDirectory = null, ?string $specification = null): array { $apiPath = str_replace( ['{functionId}'], @@ -422,6 +458,10 @@ public function update(string $functionId, string $name, ?Runtime $runtime = nul $apiParams['providerRootDirectory'] = $providerRootDirectory; } + if (!is_null($specification)) { + $apiParams['specification'] = $specification; + } + $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -887,7 +927,7 @@ public function listExecutions(string $functionId, ?array $queries = null, ?stri * @throws AppwriteException * @return array */ - public function createExecution(string $functionId, ?string $body = null, ?bool $async = null, ?string $xpath = null, ?ExecutionMethod $method = null, ?array $headers = null, ?string $scheduledAt = null, callable $onProgress = null): array + public function createExecution(string $functionId, ?string $body = null, ?bool $async = null, ?string $xpath = null, ?ExecutionMethod $method = null, ?array $headers = null, ?string $scheduledAt = null): array { $apiPath = str_replace( ['{functionId}'], @@ -923,8 +963,14 @@ public function createExecution(string $functionId, ?string $body = null, ?bool } $apiHeaders = []; - $apiHeaders['content-type'] = 'multipart/form-data'; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); } /** diff --git a/tests/Appwrite/Services/FunctionsTest.php b/tests/Appwrite/Services/FunctionsTest.php index ea44a6e..27904c8 100644 --- a/tests/Appwrite/Services/FunctionsTest.php +++ b/tests/Appwrite/Services/FunctionsTest.php @@ -58,7 +58,8 @@ public function testMethodCreate(): void { "providerRepositoryId" => "appwrite", "providerBranch" => "main", "providerRootDirectory" => "functions/helloWorld", - "providerSilentMode" => true,); + "providerSilentMode" => true, + "specification" => "s-0.5vcpu-512mb",); $this->client @@ -91,6 +92,23 @@ public function testMethodListRuntimes(): void { $this->assertSame($data, $response); } + public function testMethodListSpecifications(): void { + + $data = array( + "total" => 5, + "specifications" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->functions->listSpecifications( + ); + + $this->assertSame($data, $response); + } + public function testMethodListTemplates(): void { $data = array( @@ -166,7 +184,8 @@ public function testMethodGet(): void { "providerRepositoryId" => "appwrite", "providerBranch" => "main", "providerRootDirectory" => "functions/helloWorld", - "providerSilentMode" => true,); + "providerSilentMode" => true, + "specification" => "s-0.5vcpu-512mb",); $this->client @@ -205,7 +224,8 @@ public function testMethodUpdate(): void { "providerRepositoryId" => "appwrite", "providerBranch" => "main", "providerRootDirectory" => "functions/helloWorld", - "providerSilentMode" => true,); + "providerSilentMode" => true, + "specification" => "s-0.5vcpu-512mb",); $this->client @@ -360,7 +380,8 @@ public function testMethodUpdateDeployment(): void { "providerRepositoryId" => "appwrite", "providerBranch" => "main", "providerRootDirectory" => "functions/helloWorld", - "providerSilentMode" => true,); + "providerSilentMode" => true, + "specification" => "s-0.5vcpu-512mb",); $this->client From eb7b1ca99e748d290a6d870ff0ba642c4004b472 Mon Sep 17 00:00:00 2001 From: root <christyjacob4@gmail.com> Date: Fri, 23 Aug 2024 10:50:08 +0000 Subject: [PATCH 5/9] chore: updates for next rc release --- docs/examples/account/create-anonymous-session.md | 2 +- docs/examples/account/create-email-password-session.md | 2 +- docs/examples/account/create-email-token.md | 2 +- docs/examples/account/create-j-w-t.md | 2 +- docs/examples/account/create-magic-u-r-l-token.md | 2 +- docs/examples/account/create-mfa-authenticator.md | 2 +- docs/examples/account/create-mfa-challenge.md | 2 +- docs/examples/account/create-mfa-recovery-codes.md | 2 +- docs/examples/account/create-o-auth2token.md | 2 +- docs/examples/account/create-phone-token.md | 2 +- docs/examples/account/create-phone-verification.md | 2 +- docs/examples/account/create-recovery.md | 2 +- docs/examples/account/create-session.md | 2 +- docs/examples/account/create-verification.md | 2 +- docs/examples/account/create.md | 2 +- docs/examples/account/delete-identity.md | 2 +- docs/examples/account/delete-mfa-authenticator.md | 2 +- docs/examples/account/delete-session.md | 2 +- docs/examples/account/delete-sessions.md | 2 +- docs/examples/account/get-mfa-recovery-codes.md | 2 +- docs/examples/account/get-prefs.md | 2 +- docs/examples/account/get-session.md | 2 +- docs/examples/account/get.md | 2 +- docs/examples/account/list-identities.md | 2 +- docs/examples/account/list-logs.md | 2 +- docs/examples/account/list-mfa-factors.md | 2 +- docs/examples/account/list-sessions.md | 2 +- docs/examples/account/update-email.md | 2 +- docs/examples/account/update-m-f-a.md | 2 +- docs/examples/account/update-magic-u-r-l-session.md | 2 +- docs/examples/account/update-mfa-authenticator.md | 2 +- docs/examples/account/update-mfa-challenge.md | 2 +- docs/examples/account/update-mfa-recovery-codes.md | 2 +- docs/examples/account/update-name.md | 2 +- docs/examples/account/update-password.md | 2 +- docs/examples/account/update-phone-session.md | 2 +- docs/examples/account/update-phone-verification.md | 2 +- docs/examples/account/update-phone.md | 2 +- docs/examples/account/update-prefs.md | 2 +- docs/examples/account/update-recovery.md | 2 +- docs/examples/account/update-session.md | 2 +- docs/examples/account/update-status.md | 2 +- docs/examples/account/update-verification.md | 2 +- docs/examples/avatars/get-browser.md | 2 +- docs/examples/avatars/get-credit-card.md | 2 +- docs/examples/avatars/get-favicon.md | 2 +- docs/examples/avatars/get-flag.md | 2 +- docs/examples/avatars/get-image.md | 2 +- docs/examples/avatars/get-initials.md | 2 +- docs/examples/avatars/get-q-r.md | 2 +- docs/examples/databases/create-boolean-attribute.md | 4 ++-- docs/examples/databases/create-collection.md | 4 ++-- docs/examples/databases/create-datetime-attribute.md | 4 ++-- docs/examples/databases/create-document.md | 2 +- docs/examples/databases/create-email-attribute.md | 4 ++-- docs/examples/databases/create-enum-attribute.md | 4 ++-- docs/examples/databases/create-float-attribute.md | 4 ++-- docs/examples/databases/create-index.md | 4 ++-- docs/examples/databases/create-integer-attribute.md | 4 ++-- docs/examples/databases/create-ip-attribute.md | 4 ++-- .../databases/create-relationship-attribute.md | 4 ++-- docs/examples/databases/create-string-attribute.md | 4 ++-- docs/examples/databases/create-url-attribute.md | 4 ++-- docs/examples/databases/create.md | 4 ++-- docs/examples/databases/delete-attribute.md | 4 ++-- docs/examples/databases/delete-collection.md | 4 ++-- docs/examples/databases/delete-document.md | 2 +- docs/examples/databases/delete-index.md | 4 ++-- docs/examples/databases/delete.md | 4 ++-- docs/examples/databases/get-attribute.md | 4 ++-- docs/examples/databases/get-collection.md | 4 ++-- docs/examples/databases/get-document.md | 2 +- docs/examples/databases/get-index.md | 4 ++-- docs/examples/databases/get.md | 4 ++-- docs/examples/databases/list-attributes.md | 4 ++-- docs/examples/databases/list-collections.md | 4 ++-- docs/examples/databases/list-documents.md | 2 +- docs/examples/databases/list-indexes.md | 4 ++-- docs/examples/databases/list.md | 4 ++-- docs/examples/databases/update-boolean-attribute.md | 4 ++-- docs/examples/databases/update-collection.md | 4 ++-- docs/examples/databases/update-datetime-attribute.md | 4 ++-- docs/examples/databases/update-document.md | 2 +- docs/examples/databases/update-email-attribute.md | 4 ++-- docs/examples/databases/update-enum-attribute.md | 4 ++-- docs/examples/databases/update-float-attribute.md | 4 ++-- docs/examples/databases/update-integer-attribute.md | 4 ++-- docs/examples/databases/update-ip-attribute.md | 4 ++-- .../databases/update-relationship-attribute.md | 4 ++-- docs/examples/databases/update-string-attribute.md | 4 ++-- docs/examples/databases/update-url-attribute.md | 4 ++-- docs/examples/databases/update.md | 4 ++-- docs/examples/functions/create-build.md | 4 ++-- docs/examples/functions/create-deployment.md | 4 ++-- docs/examples/functions/create-execution.md | 2 +- docs/examples/functions/create-variable.md | 4 ++-- docs/examples/functions/create.md | 4 ++-- docs/examples/functions/delete-deployment.md | 4 ++-- docs/examples/functions/delete-execution.md | 4 ++-- docs/examples/functions/delete-variable.md | 4 ++-- docs/examples/functions/delete.md | 4 ++-- docs/examples/functions/get-deployment-download.md | 2 +- docs/examples/functions/get-deployment.md | 4 ++-- docs/examples/functions/get-execution.md | 2 +- docs/examples/functions/get-template.md | 2 +- docs/examples/functions/get-variable.md | 4 ++-- docs/examples/functions/get.md | 4 ++-- docs/examples/functions/list-deployments.md | 4 ++-- docs/examples/functions/list-executions.md | 2 +- docs/examples/functions/list-runtimes.md | 4 ++-- docs/examples/functions/list-specifications.md | 4 ++-- docs/examples/functions/list-templates.md | 2 +- docs/examples/functions/list-variables.md | 4 ++-- docs/examples/functions/list.md | 4 ++-- docs/examples/functions/update-deployment-build.md | 4 ++-- docs/examples/functions/update-deployment.md | 4 ++-- docs/examples/functions/update-variable.md | 4 ++-- docs/examples/functions/update.md | 4 ++-- docs/examples/graphql/mutation.md | 4 ++-- docs/examples/graphql/query.md | 4 ++-- docs/examples/health/get-antivirus.md | 4 ++-- docs/examples/health/get-cache.md | 4 ++-- docs/examples/health/get-certificate.md | 4 ++-- docs/examples/health/get-d-b.md | 4 ++-- docs/examples/health/get-failed-jobs.md | 4 ++-- docs/examples/health/get-pub-sub.md | 4 ++-- docs/examples/health/get-queue-builds.md | 4 ++-- docs/examples/health/get-queue-certificates.md | 4 ++-- docs/examples/health/get-queue-databases.md | 4 ++-- docs/examples/health/get-queue-deletes.md | 4 ++-- docs/examples/health/get-queue-functions.md | 4 ++-- docs/examples/health/get-queue-logs.md | 4 ++-- docs/examples/health/get-queue-mails.md | 4 ++-- docs/examples/health/get-queue-messaging.md | 4 ++-- docs/examples/health/get-queue-migrations.md | 4 ++-- docs/examples/health/get-queue-usage-dump.md | 4 ++-- docs/examples/health/get-queue-usage.md | 4 ++-- docs/examples/health/get-queue-webhooks.md | 4 ++-- docs/examples/health/get-queue.md | 4 ++-- docs/examples/health/get-storage-local.md | 4 ++-- docs/examples/health/get-storage.md | 4 ++-- docs/examples/health/get-time.md | 4 ++-- docs/examples/health/get.md | 4 ++-- docs/examples/locale/get.md | 2 +- docs/examples/locale/list-codes.md | 2 +- docs/examples/locale/list-continents.md | 2 +- docs/examples/locale/list-countries-e-u.md | 2 +- docs/examples/locale/list-countries-phones.md | 2 +- docs/examples/locale/list-countries.md | 2 +- docs/examples/locale/list-currencies.md | 2 +- docs/examples/locale/list-languages.md | 2 +- docs/examples/messaging/create-apns-provider.md | 4 ++-- docs/examples/messaging/create-email.md | 4 ++-- docs/examples/messaging/create-fcm-provider.md | 4 ++-- docs/examples/messaging/create-mailgun-provider.md | 4 ++-- docs/examples/messaging/create-msg91provider.md | 4 ++-- docs/examples/messaging/create-push.md | 4 ++-- docs/examples/messaging/create-sendgrid-provider.md | 4 ++-- docs/examples/messaging/create-sms.md | 4 ++-- docs/examples/messaging/create-smtp-provider.md | 4 ++-- docs/examples/messaging/create-subscriber.md | 4 ++-- docs/examples/messaging/create-telesign-provider.md | 4 ++-- docs/examples/messaging/create-textmagic-provider.md | 4 ++-- docs/examples/messaging/create-topic.md | 4 ++-- docs/examples/messaging/create-twilio-provider.md | 4 ++-- docs/examples/messaging/create-vonage-provider.md | 4 ++-- docs/examples/messaging/delete-provider.md | 4 ++-- docs/examples/messaging/delete-subscriber.md | 4 ++-- docs/examples/messaging/delete-topic.md | 4 ++-- docs/examples/messaging/delete.md | 4 ++-- docs/examples/messaging/get-message.md | 4 ++-- docs/examples/messaging/get-provider.md | 4 ++-- docs/examples/messaging/get-subscriber.md | 4 ++-- docs/examples/messaging/get-topic.md | 4 ++-- docs/examples/messaging/list-message-logs.md | 4 ++-- docs/examples/messaging/list-messages.md | 4 ++-- docs/examples/messaging/list-provider-logs.md | 4 ++-- docs/examples/messaging/list-providers.md | 4 ++-- docs/examples/messaging/list-subscriber-logs.md | 4 ++-- docs/examples/messaging/list-subscribers.md | 4 ++-- docs/examples/messaging/list-targets.md | 4 ++-- docs/examples/messaging/list-topic-logs.md | 4 ++-- docs/examples/messaging/list-topics.md | 4 ++-- docs/examples/messaging/update-apns-provider.md | 4 ++-- docs/examples/messaging/update-email.md | 4 ++-- docs/examples/messaging/update-fcm-provider.md | 4 ++-- docs/examples/messaging/update-mailgun-provider.md | 4 ++-- docs/examples/messaging/update-msg91provider.md | 4 ++-- docs/examples/messaging/update-push.md | 4 ++-- docs/examples/messaging/update-sendgrid-provider.md | 4 ++-- docs/examples/messaging/update-sms.md | 4 ++-- docs/examples/messaging/update-smtp-provider.md | 4 ++-- docs/examples/messaging/update-telesign-provider.md | 4 ++-- docs/examples/messaging/update-textmagic-provider.md | 4 ++-- docs/examples/messaging/update-topic.md | 4 ++-- docs/examples/messaging/update-twilio-provider.md | 4 ++-- docs/examples/messaging/update-vonage-provider.md | 4 ++-- docs/examples/storage/create-bucket.md | 4 ++-- docs/examples/storage/create-file.md | 2 +- docs/examples/storage/delete-bucket.md | 4 ++-- docs/examples/storage/delete-file.md | 2 +- docs/examples/storage/get-bucket.md | 4 ++-- docs/examples/storage/get-file-download.md | 2 +- docs/examples/storage/get-file-preview.md | 2 +- docs/examples/storage/get-file-view.md | 2 +- docs/examples/storage/get-file.md | 2 +- docs/examples/storage/list-buckets.md | 4 ++-- docs/examples/storage/list-files.md | 2 +- docs/examples/storage/update-bucket.md | 4 ++-- docs/examples/storage/update-file.md | 2 +- docs/examples/teams/create-membership.md | 2 +- docs/examples/teams/create.md | 2 +- docs/examples/teams/delete-membership.md | 2 +- docs/examples/teams/delete.md | 2 +- docs/examples/teams/get-membership.md | 2 +- docs/examples/teams/get-prefs.md | 2 +- docs/examples/teams/get.md | 2 +- docs/examples/teams/list-memberships.md | 2 +- docs/examples/teams/list.md | 2 +- docs/examples/teams/update-membership-status.md | 2 +- docs/examples/teams/update-membership.md | 2 +- docs/examples/teams/update-name.md | 2 +- docs/examples/teams/update-prefs.md | 2 +- docs/examples/users/create-argon2user.md | 4 ++-- docs/examples/users/create-bcrypt-user.md | 4 ++-- docs/examples/users/create-j-w-t.md | 4 ++-- docs/examples/users/create-m-d5user.md | 4 ++-- docs/examples/users/create-mfa-recovery-codes.md | 4 ++-- docs/examples/users/create-p-h-pass-user.md | 4 ++-- docs/examples/users/create-s-h-a-user.md | 4 ++-- docs/examples/users/create-scrypt-modified-user.md | 4 ++-- docs/examples/users/create-scrypt-user.md | 4 ++-- docs/examples/users/create-session.md | 4 ++-- docs/examples/users/create-target.md | 4 ++-- docs/examples/users/create-token.md | 4 ++-- docs/examples/users/create.md | 4 ++-- docs/examples/users/delete-identity.md | 4 ++-- docs/examples/users/delete-mfa-authenticator.md | 4 ++-- docs/examples/users/delete-session.md | 4 ++-- docs/examples/users/delete-sessions.md | 4 ++-- docs/examples/users/delete-target.md | 4 ++-- docs/examples/users/delete.md | 4 ++-- docs/examples/users/get-mfa-recovery-codes.md | 4 ++-- docs/examples/users/get-prefs.md | 4 ++-- docs/examples/users/get-target.md | 4 ++-- docs/examples/users/get.md | 4 ++-- docs/examples/users/list-identities.md | 4 ++-- docs/examples/users/list-logs.md | 4 ++-- docs/examples/users/list-memberships.md | 4 ++-- docs/examples/users/list-mfa-factors.md | 4 ++-- docs/examples/users/list-sessions.md | 4 ++-- docs/examples/users/list-targets.md | 4 ++-- docs/examples/users/list.md | 4 ++-- docs/examples/users/update-email-verification.md | 4 ++-- docs/examples/users/update-email.md | 4 ++-- docs/examples/users/update-labels.md | 4 ++-- docs/examples/users/update-mfa-recovery-codes.md | 4 ++-- docs/examples/users/update-mfa.md | 4 ++-- docs/examples/users/update-name.md | 4 ++-- docs/examples/users/update-password.md | 4 ++-- docs/examples/users/update-phone-verification.md | 4 ++-- docs/examples/users/update-phone.md | 4 ++-- docs/examples/users/update-prefs.md | 4 ++-- docs/examples/users/update-status.md | 4 ++-- docs/examples/users/update-target.md | 4 ++-- src/Appwrite/Client.php | 4 ++-- src/Appwrite/Enums/Runtime.php | 10 +++++----- tests/Appwrite/Services/FunctionsTest.php | 2 ++ 268 files changed, 449 insertions(+), 447 deletions(-) diff --git a/docs/examples/account/create-anonymous-session.md b/docs/examples/account/create-anonymous-session.md index c43c60e..4cf9538 100644 --- a/docs/examples/account/create-anonymous-session.md +++ b/docs/examples/account/create-anonymous-session.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>'); // Your project ID + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID $account = new Account($client); diff --git a/docs/examples/account/create-email-password-session.md b/docs/examples/account/create-email-password-session.md index faefc33..b0e4d75 100644 --- a/docs/examples/account/create-email-password-session.md +++ b/docs/examples/account/create-email-password-session.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>'); // Your project ID + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID $account = new Account($client); diff --git a/docs/examples/account/create-email-token.md b/docs/examples/account/create-email-token.md index 68dd7f4..afa9bc9 100644 --- a/docs/examples/account/create-email-token.md +++ b/docs/examples/account/create-email-token.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>'); // Your project ID + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID $account = new Account($client); diff --git a/docs/examples/account/create-j-w-t.md b/docs/examples/account/create-j-w-t.md index 33479c4..2658a66 100644 --- a/docs/examples/account/create-j-w-t.md +++ b/docs/examples/account/create-j-w-t.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>'); // Your project ID + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID $account = new Account($client); diff --git a/docs/examples/account/create-magic-u-r-l-token.md b/docs/examples/account/create-magic-u-r-l-token.md index f75991c..1ac0087 100644 --- a/docs/examples/account/create-magic-u-r-l-token.md +++ b/docs/examples/account/create-magic-u-r-l-token.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>'); // Your project ID + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID $account = new Account($client); diff --git a/docs/examples/account/create-mfa-authenticator.md b/docs/examples/account/create-mfa-authenticator.md index 95fca46..7833852 100644 --- a/docs/examples/account/create-mfa-authenticator.md +++ b/docs/examples/account/create-mfa-authenticator.md @@ -6,7 +6,7 @@ use Appwrite\Enums\AuthenticatorType; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/create-mfa-challenge.md b/docs/examples/account/create-mfa-challenge.md index 34bd063..a58d674 100644 --- a/docs/examples/account/create-mfa-challenge.md +++ b/docs/examples/account/create-mfa-challenge.md @@ -6,7 +6,7 @@ use Appwrite\Enums\AuthenticationFactor; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>'); // Your project ID + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID $account = new Account($client); diff --git a/docs/examples/account/create-mfa-recovery-codes.md b/docs/examples/account/create-mfa-recovery-codes.md index c474967..d82a97a 100644 --- a/docs/examples/account/create-mfa-recovery-codes.md +++ b/docs/examples/account/create-mfa-recovery-codes.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/create-o-auth2token.md b/docs/examples/account/create-o-auth2token.md index 0411d6f..21b9ef1 100644 --- a/docs/examples/account/create-o-auth2token.md +++ b/docs/examples/account/create-o-auth2token.md @@ -6,7 +6,7 @@ use Appwrite\Enums\OAuthProvider; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>'); // Your project ID + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID $account = new Account($client); diff --git a/docs/examples/account/create-phone-token.md b/docs/examples/account/create-phone-token.md index e5724d3..72462ff 100644 --- a/docs/examples/account/create-phone-token.md +++ b/docs/examples/account/create-phone-token.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>'); // Your project ID + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID $account = new Account($client); diff --git a/docs/examples/account/create-phone-verification.md b/docs/examples/account/create-phone-verification.md index e681607..cb81da5 100644 --- a/docs/examples/account/create-phone-verification.md +++ b/docs/examples/account/create-phone-verification.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/create-recovery.md b/docs/examples/account/create-recovery.md index 86cc2d9..a924379 100644 --- a/docs/examples/account/create-recovery.md +++ b/docs/examples/account/create-recovery.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/create-session.md b/docs/examples/account/create-session.md index e714d11..aa089ae 100644 --- a/docs/examples/account/create-session.md +++ b/docs/examples/account/create-session.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>'); // Your project ID + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID $account = new Account($client); diff --git a/docs/examples/account/create-verification.md b/docs/examples/account/create-verification.md index 9541956..99929f1 100644 --- a/docs/examples/account/create-verification.md +++ b/docs/examples/account/create-verification.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/create.md b/docs/examples/account/create.md index b4bc9df..2b25cde 100644 --- a/docs/examples/account/create.md +++ b/docs/examples/account/create.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>'); // Your project ID + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID $account = new Account($client); diff --git a/docs/examples/account/delete-identity.md b/docs/examples/account/delete-identity.md index dc7f751..31e5f42 100644 --- a/docs/examples/account/delete-identity.md +++ b/docs/examples/account/delete-identity.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/delete-mfa-authenticator.md b/docs/examples/account/delete-mfa-authenticator.md index a0574c5..5367409 100644 --- a/docs/examples/account/delete-mfa-authenticator.md +++ b/docs/examples/account/delete-mfa-authenticator.md @@ -6,7 +6,7 @@ use Appwrite\Enums\AuthenticatorType; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/delete-session.md b/docs/examples/account/delete-session.md index e52d95e..d44aca8 100644 --- a/docs/examples/account/delete-session.md +++ b/docs/examples/account/delete-session.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/delete-sessions.md b/docs/examples/account/delete-sessions.md index a493317..bf9e5c1 100644 --- a/docs/examples/account/delete-sessions.md +++ b/docs/examples/account/delete-sessions.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/get-mfa-recovery-codes.md b/docs/examples/account/get-mfa-recovery-codes.md index f640e9e..43c3f06 100644 --- a/docs/examples/account/get-mfa-recovery-codes.md +++ b/docs/examples/account/get-mfa-recovery-codes.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/get-prefs.md b/docs/examples/account/get-prefs.md index f6489fc..808699a 100644 --- a/docs/examples/account/get-prefs.md +++ b/docs/examples/account/get-prefs.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/get-session.md b/docs/examples/account/get-session.md index 17bf7f7..dfd1c23 100644 --- a/docs/examples/account/get-session.md +++ b/docs/examples/account/get-session.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/get.md b/docs/examples/account/get.md index 8a36274..427632d 100644 --- a/docs/examples/account/get.md +++ b/docs/examples/account/get.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/list-identities.md b/docs/examples/account/list-identities.md index 78c6dd3..d928921 100644 --- a/docs/examples/account/list-identities.md +++ b/docs/examples/account/list-identities.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/list-logs.md b/docs/examples/account/list-logs.md index 0dcdb3b..72199a2 100644 --- a/docs/examples/account/list-logs.md +++ b/docs/examples/account/list-logs.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/list-mfa-factors.md b/docs/examples/account/list-mfa-factors.md index e029574..d670b97 100644 --- a/docs/examples/account/list-mfa-factors.md +++ b/docs/examples/account/list-mfa-factors.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/list-sessions.md b/docs/examples/account/list-sessions.md index 28f2823..bbc1b78 100644 --- a/docs/examples/account/list-sessions.md +++ b/docs/examples/account/list-sessions.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/update-email.md b/docs/examples/account/update-email.md index 60cb7cc..c5fd462 100644 --- a/docs/examples/account/update-email.md +++ b/docs/examples/account/update-email.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/update-m-f-a.md b/docs/examples/account/update-m-f-a.md index 1869f7e..9489b96 100644 --- a/docs/examples/account/update-m-f-a.md +++ b/docs/examples/account/update-m-f-a.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/update-magic-u-r-l-session.md b/docs/examples/account/update-magic-u-r-l-session.md index d5e1a9f..e80adf9 100644 --- a/docs/examples/account/update-magic-u-r-l-session.md +++ b/docs/examples/account/update-magic-u-r-l-session.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>'); // Your project ID + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID $account = new Account($client); diff --git a/docs/examples/account/update-mfa-authenticator.md b/docs/examples/account/update-mfa-authenticator.md index f998c23..d3c36a3 100644 --- a/docs/examples/account/update-mfa-authenticator.md +++ b/docs/examples/account/update-mfa-authenticator.md @@ -6,7 +6,7 @@ use Appwrite\Enums\AuthenticatorType; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/update-mfa-challenge.md b/docs/examples/account/update-mfa-challenge.md index 62124c5..dcc5dcd 100644 --- a/docs/examples/account/update-mfa-challenge.md +++ b/docs/examples/account/update-mfa-challenge.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/update-mfa-recovery-codes.md b/docs/examples/account/update-mfa-recovery-codes.md index 7babcac..cf6204a 100644 --- a/docs/examples/account/update-mfa-recovery-codes.md +++ b/docs/examples/account/update-mfa-recovery-codes.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/update-name.md b/docs/examples/account/update-name.md index 4e0f1cb..a55a076 100644 --- a/docs/examples/account/update-name.md +++ b/docs/examples/account/update-name.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/update-password.md b/docs/examples/account/update-password.md index e438d2b..9ef2757 100644 --- a/docs/examples/account/update-password.md +++ b/docs/examples/account/update-password.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/update-phone-session.md b/docs/examples/account/update-phone-session.md index 2951815..973d29d 100644 --- a/docs/examples/account/update-phone-session.md +++ b/docs/examples/account/update-phone-session.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>'); // Your project ID + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID $account = new Account($client); diff --git a/docs/examples/account/update-phone-verification.md b/docs/examples/account/update-phone-verification.md index 6b95838..a116447 100644 --- a/docs/examples/account/update-phone-verification.md +++ b/docs/examples/account/update-phone-verification.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/update-phone.md b/docs/examples/account/update-phone.md index 85cff81..be489f7 100644 --- a/docs/examples/account/update-phone.md +++ b/docs/examples/account/update-phone.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/update-prefs.md b/docs/examples/account/update-prefs.md index c47859b..0d47ee8 100644 --- a/docs/examples/account/update-prefs.md +++ b/docs/examples/account/update-prefs.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/update-recovery.md b/docs/examples/account/update-recovery.md index 5400fb5..523a617 100644 --- a/docs/examples/account/update-recovery.md +++ b/docs/examples/account/update-recovery.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/update-session.md b/docs/examples/account/update-session.md index 1a4611c..3eebb12 100644 --- a/docs/examples/account/update-session.md +++ b/docs/examples/account/update-session.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/update-status.md b/docs/examples/account/update-status.md index 8511b2f..d343c95 100644 --- a/docs/examples/account/update-status.md +++ b/docs/examples/account/update-status.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/account/update-verification.md b/docs/examples/account/update-verification.md index 253693e..a03e87f 100644 --- a/docs/examples/account/update-verification.md +++ b/docs/examples/account/update-verification.md @@ -5,7 +5,7 @@ use Appwrite\Services\Account; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $account = new Account($client); diff --git a/docs/examples/avatars/get-browser.md b/docs/examples/avatars/get-browser.md index 47a6c85..d7e7e76 100644 --- a/docs/examples/avatars/get-browser.md +++ b/docs/examples/avatars/get-browser.md @@ -6,7 +6,7 @@ use Appwrite\Enums\Browser; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $avatars = new Avatars($client); diff --git a/docs/examples/avatars/get-credit-card.md b/docs/examples/avatars/get-credit-card.md index c1b6b15..55e2516 100644 --- a/docs/examples/avatars/get-credit-card.md +++ b/docs/examples/avatars/get-credit-card.md @@ -6,7 +6,7 @@ use Appwrite\Enums\CreditCard; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $avatars = new Avatars($client); diff --git a/docs/examples/avatars/get-favicon.md b/docs/examples/avatars/get-favicon.md index 50bb5c4..5f5c5d7 100644 --- a/docs/examples/avatars/get-favicon.md +++ b/docs/examples/avatars/get-favicon.md @@ -5,7 +5,7 @@ use Appwrite\Services\Avatars; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $avatars = new Avatars($client); diff --git a/docs/examples/avatars/get-flag.md b/docs/examples/avatars/get-flag.md index c163dea..2e5e4b6 100644 --- a/docs/examples/avatars/get-flag.md +++ b/docs/examples/avatars/get-flag.md @@ -6,7 +6,7 @@ use Appwrite\Enums\Flag; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $avatars = new Avatars($client); diff --git a/docs/examples/avatars/get-image.md b/docs/examples/avatars/get-image.md index 31d2bbf..0ab77fe 100644 --- a/docs/examples/avatars/get-image.md +++ b/docs/examples/avatars/get-image.md @@ -5,7 +5,7 @@ use Appwrite\Services\Avatars; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $avatars = new Avatars($client); diff --git a/docs/examples/avatars/get-initials.md b/docs/examples/avatars/get-initials.md index 6a94e05..2bd0bbe 100644 --- a/docs/examples/avatars/get-initials.md +++ b/docs/examples/avatars/get-initials.md @@ -5,7 +5,7 @@ use Appwrite\Services\Avatars; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $avatars = new Avatars($client); diff --git a/docs/examples/avatars/get-q-r.md b/docs/examples/avatars/get-q-r.md index 48f0008..05f8128 100644 --- a/docs/examples/avatars/get-q-r.md +++ b/docs/examples/avatars/get-q-r.md @@ -5,7 +5,7 @@ use Appwrite\Services\Avatars; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $avatars = new Avatars($client); diff --git a/docs/examples/databases/create-boolean-attribute.md b/docs/examples/databases/create-boolean-attribute.md index 27eba02..823dd03 100644 --- a/docs/examples/databases/create-boolean-attribute.md +++ b/docs/examples/databases/create-boolean-attribute.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/create-collection.md b/docs/examples/databases/create-collection.md index 72d36d2..ae886b9 100644 --- a/docs/examples/databases/create-collection.md +++ b/docs/examples/databases/create-collection.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/create-datetime-attribute.md b/docs/examples/databases/create-datetime-attribute.md index a959381..fb3ce70 100644 --- a/docs/examples/databases/create-datetime-attribute.md +++ b/docs/examples/databases/create-datetime-attribute.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/create-document.md b/docs/examples/databases/create-document.md index 612b114..f68ea81 100644 --- a/docs/examples/databases/create-document.md +++ b/docs/examples/databases/create-document.md @@ -5,7 +5,7 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $databases = new Databases($client); diff --git a/docs/examples/databases/create-email-attribute.md b/docs/examples/databases/create-email-attribute.md index a72a42f..b2f7770 100644 --- a/docs/examples/databases/create-email-attribute.md +++ b/docs/examples/databases/create-email-attribute.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/create-enum-attribute.md b/docs/examples/databases/create-enum-attribute.md index 2d6e3fb..de2553c 100644 --- a/docs/examples/databases/create-enum-attribute.md +++ b/docs/examples/databases/create-enum-attribute.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/create-float-attribute.md b/docs/examples/databases/create-float-attribute.md index 83f42ea..ad534aa 100644 --- a/docs/examples/databases/create-float-attribute.md +++ b/docs/examples/databases/create-float-attribute.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/create-index.md b/docs/examples/databases/create-index.md index e795271..7f95d3f 100644 --- a/docs/examples/databases/create-index.md +++ b/docs/examples/databases/create-index.md @@ -6,8 +6,8 @@ use Appwrite\Enums\IndexType; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/create-integer-attribute.md b/docs/examples/databases/create-integer-attribute.md index 5abc89c..fb48118 100644 --- a/docs/examples/databases/create-integer-attribute.md +++ b/docs/examples/databases/create-integer-attribute.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/create-ip-attribute.md b/docs/examples/databases/create-ip-attribute.md index 04c70f9..d40e237 100644 --- a/docs/examples/databases/create-ip-attribute.md +++ b/docs/examples/databases/create-ip-attribute.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/create-relationship-attribute.md b/docs/examples/databases/create-relationship-attribute.md index 2e0ba64..4b353f1 100644 --- a/docs/examples/databases/create-relationship-attribute.md +++ b/docs/examples/databases/create-relationship-attribute.md @@ -6,8 +6,8 @@ use Appwrite\Enums\RelationshipType; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/create-string-attribute.md b/docs/examples/databases/create-string-attribute.md index 450c9bc..a04dfba 100644 --- a/docs/examples/databases/create-string-attribute.md +++ b/docs/examples/databases/create-string-attribute.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/create-url-attribute.md b/docs/examples/databases/create-url-attribute.md index e7a40b7..bfa8af0 100644 --- a/docs/examples/databases/create-url-attribute.md +++ b/docs/examples/databases/create-url-attribute.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/create.md b/docs/examples/databases/create.md index da4a650..3b9881a 100644 --- a/docs/examples/databases/create.md +++ b/docs/examples/databases/create.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/delete-attribute.md b/docs/examples/databases/delete-attribute.md index e60d39f..2db4c76 100644 --- a/docs/examples/databases/delete-attribute.md +++ b/docs/examples/databases/delete-attribute.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/delete-collection.md b/docs/examples/databases/delete-collection.md index ce821e7..4af5130 100644 --- a/docs/examples/databases/delete-collection.md +++ b/docs/examples/databases/delete-collection.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/delete-document.md b/docs/examples/databases/delete-document.md index 536cdcd..05a3abb 100644 --- a/docs/examples/databases/delete-document.md +++ b/docs/examples/databases/delete-document.md @@ -5,7 +5,7 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $databases = new Databases($client); diff --git a/docs/examples/databases/delete-index.md b/docs/examples/databases/delete-index.md index cb9ddf9..67cda12 100644 --- a/docs/examples/databases/delete-index.md +++ b/docs/examples/databases/delete-index.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/delete.md b/docs/examples/databases/delete.md index 5b1a322..2480a7c 100644 --- a/docs/examples/databases/delete.md +++ b/docs/examples/databases/delete.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/get-attribute.md b/docs/examples/databases/get-attribute.md index 671f9ac..a9dad4b 100644 --- a/docs/examples/databases/get-attribute.md +++ b/docs/examples/databases/get-attribute.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/get-collection.md b/docs/examples/databases/get-collection.md index 23df77b..deeddec 100644 --- a/docs/examples/databases/get-collection.md +++ b/docs/examples/databases/get-collection.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/get-document.md b/docs/examples/databases/get-document.md index bee705f..851e2d5 100644 --- a/docs/examples/databases/get-document.md +++ b/docs/examples/databases/get-document.md @@ -5,7 +5,7 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $databases = new Databases($client); diff --git a/docs/examples/databases/get-index.md b/docs/examples/databases/get-index.md index b5878dd..a6e60f5 100644 --- a/docs/examples/databases/get-index.md +++ b/docs/examples/databases/get-index.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/get.md b/docs/examples/databases/get.md index 4838b0b..7234b23 100644 --- a/docs/examples/databases/get.md +++ b/docs/examples/databases/get.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/list-attributes.md b/docs/examples/databases/list-attributes.md index 6b1834f..fb53eae 100644 --- a/docs/examples/databases/list-attributes.md +++ b/docs/examples/databases/list-attributes.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/list-collections.md b/docs/examples/databases/list-collections.md index 045aece..941e4a6 100644 --- a/docs/examples/databases/list-collections.md +++ b/docs/examples/databases/list-collections.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/list-documents.md b/docs/examples/databases/list-documents.md index c865f32..6ccddf6 100644 --- a/docs/examples/databases/list-documents.md +++ b/docs/examples/databases/list-documents.md @@ -5,7 +5,7 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $databases = new Databases($client); diff --git a/docs/examples/databases/list-indexes.md b/docs/examples/databases/list-indexes.md index fee8e8f..b3935fc 100644 --- a/docs/examples/databases/list-indexes.md +++ b/docs/examples/databases/list-indexes.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/list.md b/docs/examples/databases/list.md index ea89f25..d5d078f 100644 --- a/docs/examples/databases/list.md +++ b/docs/examples/databases/list.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/update-boolean-attribute.md b/docs/examples/databases/update-boolean-attribute.md index a599d60..1b3355a 100644 --- a/docs/examples/databases/update-boolean-attribute.md +++ b/docs/examples/databases/update-boolean-attribute.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/update-collection.md b/docs/examples/databases/update-collection.md index 70b052d..790bb2b 100644 --- a/docs/examples/databases/update-collection.md +++ b/docs/examples/databases/update-collection.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/update-datetime-attribute.md b/docs/examples/databases/update-datetime-attribute.md index f0e92cf..978cde0 100644 --- a/docs/examples/databases/update-datetime-attribute.md +++ b/docs/examples/databases/update-datetime-attribute.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/update-document.md b/docs/examples/databases/update-document.md index 5af2f55..a1b7018 100644 --- a/docs/examples/databases/update-document.md +++ b/docs/examples/databases/update-document.md @@ -5,7 +5,7 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $databases = new Databases($client); diff --git a/docs/examples/databases/update-email-attribute.md b/docs/examples/databases/update-email-attribute.md index 8398758..1623b64 100644 --- a/docs/examples/databases/update-email-attribute.md +++ b/docs/examples/databases/update-email-attribute.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/update-enum-attribute.md b/docs/examples/databases/update-enum-attribute.md index 0bd7db5..8a8d035 100644 --- a/docs/examples/databases/update-enum-attribute.md +++ b/docs/examples/databases/update-enum-attribute.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/update-float-attribute.md b/docs/examples/databases/update-float-attribute.md index 32c3ba4..105ebc6 100644 --- a/docs/examples/databases/update-float-attribute.md +++ b/docs/examples/databases/update-float-attribute.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/update-integer-attribute.md b/docs/examples/databases/update-integer-attribute.md index 2233cc0..65bed51 100644 --- a/docs/examples/databases/update-integer-attribute.md +++ b/docs/examples/databases/update-integer-attribute.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/update-ip-attribute.md b/docs/examples/databases/update-ip-attribute.md index a953ae1..f7ce1a6 100644 --- a/docs/examples/databases/update-ip-attribute.md +++ b/docs/examples/databases/update-ip-attribute.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/update-relationship-attribute.md b/docs/examples/databases/update-relationship-attribute.md index e4e16df..a0ba877 100644 --- a/docs/examples/databases/update-relationship-attribute.md +++ b/docs/examples/databases/update-relationship-attribute.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/update-string-attribute.md b/docs/examples/databases/update-string-attribute.md index b1a7ae4..08c5c5e 100644 --- a/docs/examples/databases/update-string-attribute.md +++ b/docs/examples/databases/update-string-attribute.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/update-url-attribute.md b/docs/examples/databases/update-url-attribute.md index 383d721..9595176 100644 --- a/docs/examples/databases/update-url-attribute.md +++ b/docs/examples/databases/update-url-attribute.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/update.md b/docs/examples/databases/update.md index 68cb214..d9bf5e9 100644 --- a/docs/examples/databases/update.md +++ b/docs/examples/databases/update.md @@ -5,8 +5,8 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/functions/create-build.md b/docs/examples/functions/create-build.md index 43c781f..429653c 100644 --- a/docs/examples/functions/create-build.md +++ b/docs/examples/functions/create-build.md @@ -5,8 +5,8 @@ use Appwrite\Services\Functions; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $functions = new Functions($client); diff --git a/docs/examples/functions/create-deployment.md b/docs/examples/functions/create-deployment.md index c35b886..90f4c7e 100644 --- a/docs/examples/functions/create-deployment.md +++ b/docs/examples/functions/create-deployment.md @@ -6,8 +6,8 @@ use Appwrite\Services\Functions; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $functions = new Functions($client); diff --git a/docs/examples/functions/create-execution.md b/docs/examples/functions/create-execution.md index ff531d5..4c62b9a 100644 --- a/docs/examples/functions/create-execution.md +++ b/docs/examples/functions/create-execution.md @@ -5,7 +5,7 @@ use Appwrite\Services\Functions; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $functions = new Functions($client); diff --git a/docs/examples/functions/create-variable.md b/docs/examples/functions/create-variable.md index 441aa9d..fc1ee4a 100644 --- a/docs/examples/functions/create-variable.md +++ b/docs/examples/functions/create-variable.md @@ -5,8 +5,8 @@ use Appwrite\Services\Functions; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $functions = new Functions($client); diff --git a/docs/examples/functions/create.md b/docs/examples/functions/create.md index 8c59076..6b16c59 100644 --- a/docs/examples/functions/create.md +++ b/docs/examples/functions/create.md @@ -6,8 +6,8 @@ use Appwrite\Enums\; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $functions = new Functions($client); diff --git a/docs/examples/functions/delete-deployment.md b/docs/examples/functions/delete-deployment.md index 3f00e9d..23439f2 100644 --- a/docs/examples/functions/delete-deployment.md +++ b/docs/examples/functions/delete-deployment.md @@ -5,8 +5,8 @@ use Appwrite\Services\Functions; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $functions = new Functions($client); diff --git a/docs/examples/functions/delete-execution.md b/docs/examples/functions/delete-execution.md index 3733583..4fbef18 100644 --- a/docs/examples/functions/delete-execution.md +++ b/docs/examples/functions/delete-execution.md @@ -5,8 +5,8 @@ use Appwrite\Services\Functions; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $functions = new Functions($client); diff --git a/docs/examples/functions/delete-variable.md b/docs/examples/functions/delete-variable.md index 5046e1f..344506b 100644 --- a/docs/examples/functions/delete-variable.md +++ b/docs/examples/functions/delete-variable.md @@ -5,8 +5,8 @@ use Appwrite\Services\Functions; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $functions = new Functions($client); diff --git a/docs/examples/functions/delete.md b/docs/examples/functions/delete.md index 3d4da02..6596754 100644 --- a/docs/examples/functions/delete.md +++ b/docs/examples/functions/delete.md @@ -5,8 +5,8 @@ use Appwrite\Services\Functions; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $functions = new Functions($client); diff --git a/docs/examples/functions/get-deployment-download.md b/docs/examples/functions/get-deployment-download.md index b4756e7..c50a1b9 100644 --- a/docs/examples/functions/get-deployment-download.md +++ b/docs/examples/functions/get-deployment-download.md @@ -5,7 +5,7 @@ use Appwrite\Services\Functions; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $functions = new Functions($client); diff --git a/docs/examples/functions/get-deployment.md b/docs/examples/functions/get-deployment.md index d5758dd..73d7081 100644 --- a/docs/examples/functions/get-deployment.md +++ b/docs/examples/functions/get-deployment.md @@ -5,8 +5,8 @@ use Appwrite\Services\Functions; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $functions = new Functions($client); diff --git a/docs/examples/functions/get-execution.md b/docs/examples/functions/get-execution.md index d0c7ec4..9bb8d6a 100644 --- a/docs/examples/functions/get-execution.md +++ b/docs/examples/functions/get-execution.md @@ -5,7 +5,7 @@ use Appwrite\Services\Functions; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $functions = new Functions($client); diff --git a/docs/examples/functions/get-template.md b/docs/examples/functions/get-template.md index 989026d..421557d 100644 --- a/docs/examples/functions/get-template.md +++ b/docs/examples/functions/get-template.md @@ -5,7 +5,7 @@ use Appwrite\Services\Functions; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>'); // Your project ID + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID $functions = new Functions($client); diff --git a/docs/examples/functions/get-variable.md b/docs/examples/functions/get-variable.md index 2bd901b..cdb5ce9 100644 --- a/docs/examples/functions/get-variable.md +++ b/docs/examples/functions/get-variable.md @@ -5,8 +5,8 @@ use Appwrite\Services\Functions; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $functions = new Functions($client); diff --git a/docs/examples/functions/get.md b/docs/examples/functions/get.md index b2c6d7b..d249ce7 100644 --- a/docs/examples/functions/get.md +++ b/docs/examples/functions/get.md @@ -5,8 +5,8 @@ use Appwrite\Services\Functions; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $functions = new Functions($client); diff --git a/docs/examples/functions/list-deployments.md b/docs/examples/functions/list-deployments.md index d8bad27..9046c18 100644 --- a/docs/examples/functions/list-deployments.md +++ b/docs/examples/functions/list-deployments.md @@ -5,8 +5,8 @@ use Appwrite\Services\Functions; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $functions = new Functions($client); diff --git a/docs/examples/functions/list-executions.md b/docs/examples/functions/list-executions.md index fda330a..05e60a0 100644 --- a/docs/examples/functions/list-executions.md +++ b/docs/examples/functions/list-executions.md @@ -5,7 +5,7 @@ use Appwrite\Services\Functions; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $functions = new Functions($client); diff --git a/docs/examples/functions/list-runtimes.md b/docs/examples/functions/list-runtimes.md index 18d3c05..1d22978 100644 --- a/docs/examples/functions/list-runtimes.md +++ b/docs/examples/functions/list-runtimes.md @@ -5,8 +5,8 @@ use Appwrite\Services\Functions; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $functions = new Functions($client); diff --git a/docs/examples/functions/list-specifications.md b/docs/examples/functions/list-specifications.md index 678c2fa..e68a4b0 100644 --- a/docs/examples/functions/list-specifications.md +++ b/docs/examples/functions/list-specifications.md @@ -5,8 +5,8 @@ use Appwrite\Services\Functions; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $functions = new Functions($client); diff --git a/docs/examples/functions/list-templates.md b/docs/examples/functions/list-templates.md index 087d21b..a661903 100644 --- a/docs/examples/functions/list-templates.md +++ b/docs/examples/functions/list-templates.md @@ -5,7 +5,7 @@ use Appwrite\Services\Functions; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>'); // Your project ID + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID $functions = new Functions($client); diff --git a/docs/examples/functions/list-variables.md b/docs/examples/functions/list-variables.md index 137a4da..b9687a4 100644 --- a/docs/examples/functions/list-variables.md +++ b/docs/examples/functions/list-variables.md @@ -5,8 +5,8 @@ use Appwrite\Services\Functions; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $functions = new Functions($client); diff --git a/docs/examples/functions/list.md b/docs/examples/functions/list.md index 7b4d362..22aa3cf 100644 --- a/docs/examples/functions/list.md +++ b/docs/examples/functions/list.md @@ -5,8 +5,8 @@ use Appwrite\Services\Functions; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $functions = new Functions($client); diff --git a/docs/examples/functions/update-deployment-build.md b/docs/examples/functions/update-deployment-build.md index 653914e..98f2a3a 100644 --- a/docs/examples/functions/update-deployment-build.md +++ b/docs/examples/functions/update-deployment-build.md @@ -5,8 +5,8 @@ use Appwrite\Services\Functions; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $functions = new Functions($client); diff --git a/docs/examples/functions/update-deployment.md b/docs/examples/functions/update-deployment.md index 095b253..9c6ad6d 100644 --- a/docs/examples/functions/update-deployment.md +++ b/docs/examples/functions/update-deployment.md @@ -5,8 +5,8 @@ use Appwrite\Services\Functions; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $functions = new Functions($client); diff --git a/docs/examples/functions/update-variable.md b/docs/examples/functions/update-variable.md index 77a28f1..b1b5008 100644 --- a/docs/examples/functions/update-variable.md +++ b/docs/examples/functions/update-variable.md @@ -5,8 +5,8 @@ use Appwrite\Services\Functions; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $functions = new Functions($client); diff --git a/docs/examples/functions/update.md b/docs/examples/functions/update.md index bd028cb..8f84ca8 100644 --- a/docs/examples/functions/update.md +++ b/docs/examples/functions/update.md @@ -5,8 +5,8 @@ use Appwrite\Services\Functions; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $functions = new Functions($client); diff --git a/docs/examples/graphql/mutation.md b/docs/examples/graphql/mutation.md index e074e0c..1a0da4a 100644 --- a/docs/examples/graphql/mutation.md +++ b/docs/examples/graphql/mutation.md @@ -5,8 +5,8 @@ use Appwrite\Services\Graphql; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $graphql = new Graphql($client); diff --git a/docs/examples/graphql/query.md b/docs/examples/graphql/query.md index b871063..eea9e8f 100644 --- a/docs/examples/graphql/query.md +++ b/docs/examples/graphql/query.md @@ -5,8 +5,8 @@ use Appwrite\Services\Graphql; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $graphql = new Graphql($client); diff --git a/docs/examples/health/get-antivirus.md b/docs/examples/health/get-antivirus.md index 64e83e0..1f0dd2f 100644 --- a/docs/examples/health/get-antivirus.md +++ b/docs/examples/health/get-antivirus.md @@ -5,8 +5,8 @@ use Appwrite\Services\Health; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $health = new Health($client); diff --git a/docs/examples/health/get-cache.md b/docs/examples/health/get-cache.md index 6096207..4755d69 100644 --- a/docs/examples/health/get-cache.md +++ b/docs/examples/health/get-cache.md @@ -5,8 +5,8 @@ use Appwrite\Services\Health; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $health = new Health($client); diff --git a/docs/examples/health/get-certificate.md b/docs/examples/health/get-certificate.md index d5d325e..1f0cda4 100644 --- a/docs/examples/health/get-certificate.md +++ b/docs/examples/health/get-certificate.md @@ -5,8 +5,8 @@ use Appwrite\Services\Health; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $health = new Health($client); diff --git a/docs/examples/health/get-d-b.md b/docs/examples/health/get-d-b.md index 434fcad..fec1daa 100644 --- a/docs/examples/health/get-d-b.md +++ b/docs/examples/health/get-d-b.md @@ -5,8 +5,8 @@ use Appwrite\Services\Health; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $health = new Health($client); diff --git a/docs/examples/health/get-failed-jobs.md b/docs/examples/health/get-failed-jobs.md index 1470587..8e331bc 100644 --- a/docs/examples/health/get-failed-jobs.md +++ b/docs/examples/health/get-failed-jobs.md @@ -6,8 +6,8 @@ use Appwrite\Enums\; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $health = new Health($client); diff --git a/docs/examples/health/get-pub-sub.md b/docs/examples/health/get-pub-sub.md index d2d3a5d..fb266b1 100644 --- a/docs/examples/health/get-pub-sub.md +++ b/docs/examples/health/get-pub-sub.md @@ -5,8 +5,8 @@ use Appwrite\Services\Health; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $health = new Health($client); diff --git a/docs/examples/health/get-queue-builds.md b/docs/examples/health/get-queue-builds.md index 2911465..7886dfb 100644 --- a/docs/examples/health/get-queue-builds.md +++ b/docs/examples/health/get-queue-builds.md @@ -5,8 +5,8 @@ use Appwrite\Services\Health; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $health = new Health($client); diff --git a/docs/examples/health/get-queue-certificates.md b/docs/examples/health/get-queue-certificates.md index 9323b41..b00611e 100644 --- a/docs/examples/health/get-queue-certificates.md +++ b/docs/examples/health/get-queue-certificates.md @@ -5,8 +5,8 @@ use Appwrite\Services\Health; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $health = new Health($client); diff --git a/docs/examples/health/get-queue-databases.md b/docs/examples/health/get-queue-databases.md index 54a9814..81e8442 100644 --- a/docs/examples/health/get-queue-databases.md +++ b/docs/examples/health/get-queue-databases.md @@ -5,8 +5,8 @@ use Appwrite\Services\Health; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $health = new Health($client); diff --git a/docs/examples/health/get-queue-deletes.md b/docs/examples/health/get-queue-deletes.md index aee4deb..fe51b07 100644 --- a/docs/examples/health/get-queue-deletes.md +++ b/docs/examples/health/get-queue-deletes.md @@ -5,8 +5,8 @@ use Appwrite\Services\Health; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $health = new Health($client); diff --git a/docs/examples/health/get-queue-functions.md b/docs/examples/health/get-queue-functions.md index f675b75..e6ee688 100644 --- a/docs/examples/health/get-queue-functions.md +++ b/docs/examples/health/get-queue-functions.md @@ -5,8 +5,8 @@ use Appwrite\Services\Health; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $health = new Health($client); diff --git a/docs/examples/health/get-queue-logs.md b/docs/examples/health/get-queue-logs.md index 05c463b..4c9b0cd 100644 --- a/docs/examples/health/get-queue-logs.md +++ b/docs/examples/health/get-queue-logs.md @@ -5,8 +5,8 @@ use Appwrite\Services\Health; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $health = new Health($client); diff --git a/docs/examples/health/get-queue-mails.md b/docs/examples/health/get-queue-mails.md index 74d4959..02d4ed2 100644 --- a/docs/examples/health/get-queue-mails.md +++ b/docs/examples/health/get-queue-mails.md @@ -5,8 +5,8 @@ use Appwrite\Services\Health; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $health = new Health($client); diff --git a/docs/examples/health/get-queue-messaging.md b/docs/examples/health/get-queue-messaging.md index 3fd96c6..ec69788 100644 --- a/docs/examples/health/get-queue-messaging.md +++ b/docs/examples/health/get-queue-messaging.md @@ -5,8 +5,8 @@ use Appwrite\Services\Health; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $health = new Health($client); diff --git a/docs/examples/health/get-queue-migrations.md b/docs/examples/health/get-queue-migrations.md index 9f1a8be..f52f78a 100644 --- a/docs/examples/health/get-queue-migrations.md +++ b/docs/examples/health/get-queue-migrations.md @@ -5,8 +5,8 @@ use Appwrite\Services\Health; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $health = new Health($client); diff --git a/docs/examples/health/get-queue-usage-dump.md b/docs/examples/health/get-queue-usage-dump.md index b856b73..9b477f2 100644 --- a/docs/examples/health/get-queue-usage-dump.md +++ b/docs/examples/health/get-queue-usage-dump.md @@ -5,8 +5,8 @@ use Appwrite\Services\Health; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $health = new Health($client); diff --git a/docs/examples/health/get-queue-usage.md b/docs/examples/health/get-queue-usage.md index 9b5baeb..018e8ac 100644 --- a/docs/examples/health/get-queue-usage.md +++ b/docs/examples/health/get-queue-usage.md @@ -5,8 +5,8 @@ use Appwrite\Services\Health; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $health = new Health($client); diff --git a/docs/examples/health/get-queue-webhooks.md b/docs/examples/health/get-queue-webhooks.md index e42b65b..7e7af12 100644 --- a/docs/examples/health/get-queue-webhooks.md +++ b/docs/examples/health/get-queue-webhooks.md @@ -5,8 +5,8 @@ use Appwrite\Services\Health; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $health = new Health($client); diff --git a/docs/examples/health/get-queue.md b/docs/examples/health/get-queue.md index 81b2218..ef34100 100644 --- a/docs/examples/health/get-queue.md +++ b/docs/examples/health/get-queue.md @@ -5,8 +5,8 @@ use Appwrite\Services\Health; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $health = new Health($client); diff --git a/docs/examples/health/get-storage-local.md b/docs/examples/health/get-storage-local.md index 75999ce..0c26902 100644 --- a/docs/examples/health/get-storage-local.md +++ b/docs/examples/health/get-storage-local.md @@ -5,8 +5,8 @@ use Appwrite\Services\Health; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $health = new Health($client); diff --git a/docs/examples/health/get-storage.md b/docs/examples/health/get-storage.md index a3b56b9..abfc5bb 100644 --- a/docs/examples/health/get-storage.md +++ b/docs/examples/health/get-storage.md @@ -5,8 +5,8 @@ use Appwrite\Services\Health; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $health = new Health($client); diff --git a/docs/examples/health/get-time.md b/docs/examples/health/get-time.md index 5deb238..4577be3 100644 --- a/docs/examples/health/get-time.md +++ b/docs/examples/health/get-time.md @@ -5,8 +5,8 @@ use Appwrite\Services\Health; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $health = new Health($client); diff --git a/docs/examples/health/get.md b/docs/examples/health/get.md index 5001c48..514d083 100644 --- a/docs/examples/health/get.md +++ b/docs/examples/health/get.md @@ -5,8 +5,8 @@ use Appwrite\Services\Health; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $health = new Health($client); diff --git a/docs/examples/locale/get.md b/docs/examples/locale/get.md index b9f48b4..82247d4 100644 --- a/docs/examples/locale/get.md +++ b/docs/examples/locale/get.md @@ -5,7 +5,7 @@ use Appwrite\Services\Locale; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $locale = new Locale($client); diff --git a/docs/examples/locale/list-codes.md b/docs/examples/locale/list-codes.md index b35683c..a88c2b6 100644 --- a/docs/examples/locale/list-codes.md +++ b/docs/examples/locale/list-codes.md @@ -5,7 +5,7 @@ use Appwrite\Services\Locale; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $locale = new Locale($client); diff --git a/docs/examples/locale/list-continents.md b/docs/examples/locale/list-continents.md index 1076f99..e861ece 100644 --- a/docs/examples/locale/list-continents.md +++ b/docs/examples/locale/list-continents.md @@ -5,7 +5,7 @@ use Appwrite\Services\Locale; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $locale = new Locale($client); diff --git a/docs/examples/locale/list-countries-e-u.md b/docs/examples/locale/list-countries-e-u.md index 93a4cad..2b8bf7e 100644 --- a/docs/examples/locale/list-countries-e-u.md +++ b/docs/examples/locale/list-countries-e-u.md @@ -5,7 +5,7 @@ use Appwrite\Services\Locale; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $locale = new Locale($client); diff --git a/docs/examples/locale/list-countries-phones.md b/docs/examples/locale/list-countries-phones.md index 1d99f67..fba9ff8 100644 --- a/docs/examples/locale/list-countries-phones.md +++ b/docs/examples/locale/list-countries-phones.md @@ -5,7 +5,7 @@ use Appwrite\Services\Locale; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $locale = new Locale($client); diff --git a/docs/examples/locale/list-countries.md b/docs/examples/locale/list-countries.md index 665dd09..60801b4 100644 --- a/docs/examples/locale/list-countries.md +++ b/docs/examples/locale/list-countries.md @@ -5,7 +5,7 @@ use Appwrite\Services\Locale; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $locale = new Locale($client); diff --git a/docs/examples/locale/list-currencies.md b/docs/examples/locale/list-currencies.md index 5cd91de..5fb1667 100644 --- a/docs/examples/locale/list-currencies.md +++ b/docs/examples/locale/list-currencies.md @@ -5,7 +5,7 @@ use Appwrite\Services\Locale; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $locale = new Locale($client); diff --git a/docs/examples/locale/list-languages.md b/docs/examples/locale/list-languages.md index c615a3d..aec67ca 100644 --- a/docs/examples/locale/list-languages.md +++ b/docs/examples/locale/list-languages.md @@ -5,7 +5,7 @@ use Appwrite\Services\Locale; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $locale = new Locale($client); diff --git a/docs/examples/messaging/create-apns-provider.md b/docs/examples/messaging/create-apns-provider.md index ebe69e9..bdc5d7f 100644 --- a/docs/examples/messaging/create-apns-provider.md +++ b/docs/examples/messaging/create-apns-provider.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/create-email.md b/docs/examples/messaging/create-email.md index b24e4f2..fe51bf1 100644 --- a/docs/examples/messaging/create-email.md +++ b/docs/examples/messaging/create-email.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/create-fcm-provider.md b/docs/examples/messaging/create-fcm-provider.md index b0cfec4..7252fde 100644 --- a/docs/examples/messaging/create-fcm-provider.md +++ b/docs/examples/messaging/create-fcm-provider.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/create-mailgun-provider.md b/docs/examples/messaging/create-mailgun-provider.md index bd3bcf8..72f3360 100644 --- a/docs/examples/messaging/create-mailgun-provider.md +++ b/docs/examples/messaging/create-mailgun-provider.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/create-msg91provider.md b/docs/examples/messaging/create-msg91provider.md index da37716..bb7a79a 100644 --- a/docs/examples/messaging/create-msg91provider.md +++ b/docs/examples/messaging/create-msg91provider.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/create-push.md b/docs/examples/messaging/create-push.md index 7273f03..7838576 100644 --- a/docs/examples/messaging/create-push.md +++ b/docs/examples/messaging/create-push.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/create-sendgrid-provider.md b/docs/examples/messaging/create-sendgrid-provider.md index 42764a9..53381f6 100644 --- a/docs/examples/messaging/create-sendgrid-provider.md +++ b/docs/examples/messaging/create-sendgrid-provider.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/create-sms.md b/docs/examples/messaging/create-sms.md index 36fce84..8c0cb79 100644 --- a/docs/examples/messaging/create-sms.md +++ b/docs/examples/messaging/create-sms.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/create-smtp-provider.md b/docs/examples/messaging/create-smtp-provider.md index ff8cfe0..fd771fa 100644 --- a/docs/examples/messaging/create-smtp-provider.md +++ b/docs/examples/messaging/create-smtp-provider.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/create-subscriber.md b/docs/examples/messaging/create-subscriber.md index bfba263..c0324ab 100644 --- a/docs/examples/messaging/create-subscriber.md +++ b/docs/examples/messaging/create-subscriber.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setJWT('<YOUR_JWT>'); // Your secret JSON Web Token + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setJWT('<YOUR_JWT>'); // Your secret JSON Web Token $messaging = new Messaging($client); diff --git a/docs/examples/messaging/create-telesign-provider.md b/docs/examples/messaging/create-telesign-provider.md index ec3ede7..89e17a1 100644 --- a/docs/examples/messaging/create-telesign-provider.md +++ b/docs/examples/messaging/create-telesign-provider.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/create-textmagic-provider.md b/docs/examples/messaging/create-textmagic-provider.md index 5dc00f8..0e0c868 100644 --- a/docs/examples/messaging/create-textmagic-provider.md +++ b/docs/examples/messaging/create-textmagic-provider.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/create-topic.md b/docs/examples/messaging/create-topic.md index dd0daf1..79e3d26 100644 --- a/docs/examples/messaging/create-topic.md +++ b/docs/examples/messaging/create-topic.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/create-twilio-provider.md b/docs/examples/messaging/create-twilio-provider.md index 70a1d38..f370df2 100644 --- a/docs/examples/messaging/create-twilio-provider.md +++ b/docs/examples/messaging/create-twilio-provider.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/create-vonage-provider.md b/docs/examples/messaging/create-vonage-provider.md index d6a4e11..4663b05 100644 --- a/docs/examples/messaging/create-vonage-provider.md +++ b/docs/examples/messaging/create-vonage-provider.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/delete-provider.md b/docs/examples/messaging/delete-provider.md index 4f267fe..a3d8d47 100644 --- a/docs/examples/messaging/delete-provider.md +++ b/docs/examples/messaging/delete-provider.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/delete-subscriber.md b/docs/examples/messaging/delete-subscriber.md index 2f91487..a5f7eb7 100644 --- a/docs/examples/messaging/delete-subscriber.md +++ b/docs/examples/messaging/delete-subscriber.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setJWT('<YOUR_JWT>'); // Your secret JSON Web Token + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setJWT('<YOUR_JWT>'); // Your secret JSON Web Token $messaging = new Messaging($client); diff --git a/docs/examples/messaging/delete-topic.md b/docs/examples/messaging/delete-topic.md index 79dca2c..7333a8d 100644 --- a/docs/examples/messaging/delete-topic.md +++ b/docs/examples/messaging/delete-topic.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/delete.md b/docs/examples/messaging/delete.md index b0676ec..b9b3380 100644 --- a/docs/examples/messaging/delete.md +++ b/docs/examples/messaging/delete.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/get-message.md b/docs/examples/messaging/get-message.md index 9ec7a0e..c6ff233 100644 --- a/docs/examples/messaging/get-message.md +++ b/docs/examples/messaging/get-message.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/get-provider.md b/docs/examples/messaging/get-provider.md index 378fc6d..1d29307 100644 --- a/docs/examples/messaging/get-provider.md +++ b/docs/examples/messaging/get-provider.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/get-subscriber.md b/docs/examples/messaging/get-subscriber.md index a10974a..503e701 100644 --- a/docs/examples/messaging/get-subscriber.md +++ b/docs/examples/messaging/get-subscriber.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/get-topic.md b/docs/examples/messaging/get-topic.md index cb42254..3277168 100644 --- a/docs/examples/messaging/get-topic.md +++ b/docs/examples/messaging/get-topic.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/list-message-logs.md b/docs/examples/messaging/list-message-logs.md index d66d546..283b2a7 100644 --- a/docs/examples/messaging/list-message-logs.md +++ b/docs/examples/messaging/list-message-logs.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/list-messages.md b/docs/examples/messaging/list-messages.md index c0f54a6..a4190e6 100644 --- a/docs/examples/messaging/list-messages.md +++ b/docs/examples/messaging/list-messages.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/list-provider-logs.md b/docs/examples/messaging/list-provider-logs.md index 865daf9..bf80f20 100644 --- a/docs/examples/messaging/list-provider-logs.md +++ b/docs/examples/messaging/list-provider-logs.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/list-providers.md b/docs/examples/messaging/list-providers.md index fd30837..1dc0e3c 100644 --- a/docs/examples/messaging/list-providers.md +++ b/docs/examples/messaging/list-providers.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/list-subscriber-logs.md b/docs/examples/messaging/list-subscriber-logs.md index b69c057..c0c88d6 100644 --- a/docs/examples/messaging/list-subscriber-logs.md +++ b/docs/examples/messaging/list-subscriber-logs.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/list-subscribers.md b/docs/examples/messaging/list-subscribers.md index 2fd2747..7597ad8 100644 --- a/docs/examples/messaging/list-subscribers.md +++ b/docs/examples/messaging/list-subscribers.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/list-targets.md b/docs/examples/messaging/list-targets.md index 3abb9ef..1825a08 100644 --- a/docs/examples/messaging/list-targets.md +++ b/docs/examples/messaging/list-targets.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/list-topic-logs.md b/docs/examples/messaging/list-topic-logs.md index 0d23c82..1ab8c36 100644 --- a/docs/examples/messaging/list-topic-logs.md +++ b/docs/examples/messaging/list-topic-logs.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/list-topics.md b/docs/examples/messaging/list-topics.md index 008767e..cfcba97 100644 --- a/docs/examples/messaging/list-topics.md +++ b/docs/examples/messaging/list-topics.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/update-apns-provider.md b/docs/examples/messaging/update-apns-provider.md index a368ce5..d717755 100644 --- a/docs/examples/messaging/update-apns-provider.md +++ b/docs/examples/messaging/update-apns-provider.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/update-email.md b/docs/examples/messaging/update-email.md index 537ca82..d3b6569 100644 --- a/docs/examples/messaging/update-email.md +++ b/docs/examples/messaging/update-email.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/update-fcm-provider.md b/docs/examples/messaging/update-fcm-provider.md index d8b2a0e..9a80b44 100644 --- a/docs/examples/messaging/update-fcm-provider.md +++ b/docs/examples/messaging/update-fcm-provider.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/update-mailgun-provider.md b/docs/examples/messaging/update-mailgun-provider.md index d838adb..7891cb5 100644 --- a/docs/examples/messaging/update-mailgun-provider.md +++ b/docs/examples/messaging/update-mailgun-provider.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/update-msg91provider.md b/docs/examples/messaging/update-msg91provider.md index eb68102..98f4f13 100644 --- a/docs/examples/messaging/update-msg91provider.md +++ b/docs/examples/messaging/update-msg91provider.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/update-push.md b/docs/examples/messaging/update-push.md index b332ec1..09a4d96 100644 --- a/docs/examples/messaging/update-push.md +++ b/docs/examples/messaging/update-push.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/update-sendgrid-provider.md b/docs/examples/messaging/update-sendgrid-provider.md index 7909fef..2820e2e 100644 --- a/docs/examples/messaging/update-sendgrid-provider.md +++ b/docs/examples/messaging/update-sendgrid-provider.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/update-sms.md b/docs/examples/messaging/update-sms.md index a4b4c23..a342b7a 100644 --- a/docs/examples/messaging/update-sms.md +++ b/docs/examples/messaging/update-sms.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/update-smtp-provider.md b/docs/examples/messaging/update-smtp-provider.md index 997914f..66dde3e 100644 --- a/docs/examples/messaging/update-smtp-provider.md +++ b/docs/examples/messaging/update-smtp-provider.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/update-telesign-provider.md b/docs/examples/messaging/update-telesign-provider.md index 981df0c..3c1b760 100644 --- a/docs/examples/messaging/update-telesign-provider.md +++ b/docs/examples/messaging/update-telesign-provider.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/update-textmagic-provider.md b/docs/examples/messaging/update-textmagic-provider.md index b7f9bab..3328ac7 100644 --- a/docs/examples/messaging/update-textmagic-provider.md +++ b/docs/examples/messaging/update-textmagic-provider.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/update-topic.md b/docs/examples/messaging/update-topic.md index e705c1b..5669e5f 100644 --- a/docs/examples/messaging/update-topic.md +++ b/docs/examples/messaging/update-topic.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/update-twilio-provider.md b/docs/examples/messaging/update-twilio-provider.md index 05c2072..07b7a2e 100644 --- a/docs/examples/messaging/update-twilio-provider.md +++ b/docs/examples/messaging/update-twilio-provider.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/update-vonage-provider.md b/docs/examples/messaging/update-vonage-provider.md index 3c421af..ba7f530 100644 --- a/docs/examples/messaging/update-vonage-provider.md +++ b/docs/examples/messaging/update-vonage-provider.md @@ -5,8 +5,8 @@ use Appwrite\Services\Messaging; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/storage/create-bucket.md b/docs/examples/storage/create-bucket.md index ca369fb..0c8ef0f 100644 --- a/docs/examples/storage/create-bucket.md +++ b/docs/examples/storage/create-bucket.md @@ -5,8 +5,8 @@ use Appwrite\Services\Storage; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $storage = new Storage($client); diff --git a/docs/examples/storage/create-file.md b/docs/examples/storage/create-file.md index 20a25e7..a948546 100644 --- a/docs/examples/storage/create-file.md +++ b/docs/examples/storage/create-file.md @@ -6,7 +6,7 @@ use Appwrite\Services\Storage; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $storage = new Storage($client); diff --git a/docs/examples/storage/delete-bucket.md b/docs/examples/storage/delete-bucket.md index a9207f4..7843318 100644 --- a/docs/examples/storage/delete-bucket.md +++ b/docs/examples/storage/delete-bucket.md @@ -5,8 +5,8 @@ use Appwrite\Services\Storage; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $storage = new Storage($client); diff --git a/docs/examples/storage/delete-file.md b/docs/examples/storage/delete-file.md index 47f9938..4274c25 100644 --- a/docs/examples/storage/delete-file.md +++ b/docs/examples/storage/delete-file.md @@ -5,7 +5,7 @@ use Appwrite\Services\Storage; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $storage = new Storage($client); diff --git a/docs/examples/storage/get-bucket.md b/docs/examples/storage/get-bucket.md index 5faf6a6..85a5b75 100644 --- a/docs/examples/storage/get-bucket.md +++ b/docs/examples/storage/get-bucket.md @@ -5,8 +5,8 @@ use Appwrite\Services\Storage; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $storage = new Storage($client); diff --git a/docs/examples/storage/get-file-download.md b/docs/examples/storage/get-file-download.md index 48ee5ad..72be0f6 100644 --- a/docs/examples/storage/get-file-download.md +++ b/docs/examples/storage/get-file-download.md @@ -5,7 +5,7 @@ use Appwrite\Services\Storage; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $storage = new Storage($client); diff --git a/docs/examples/storage/get-file-preview.md b/docs/examples/storage/get-file-preview.md index 4f37f38..aef4f4a 100644 --- a/docs/examples/storage/get-file-preview.md +++ b/docs/examples/storage/get-file-preview.md @@ -5,7 +5,7 @@ use Appwrite\Services\Storage; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $storage = new Storage($client); diff --git a/docs/examples/storage/get-file-view.md b/docs/examples/storage/get-file-view.md index 5637fa8..782e49b 100644 --- a/docs/examples/storage/get-file-view.md +++ b/docs/examples/storage/get-file-view.md @@ -5,7 +5,7 @@ use Appwrite\Services\Storage; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $storage = new Storage($client); diff --git a/docs/examples/storage/get-file.md b/docs/examples/storage/get-file.md index 41fdc91..80196a5 100644 --- a/docs/examples/storage/get-file.md +++ b/docs/examples/storage/get-file.md @@ -5,7 +5,7 @@ use Appwrite\Services\Storage; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $storage = new Storage($client); diff --git a/docs/examples/storage/list-buckets.md b/docs/examples/storage/list-buckets.md index 7a988c2..a53eb91 100644 --- a/docs/examples/storage/list-buckets.md +++ b/docs/examples/storage/list-buckets.md @@ -5,8 +5,8 @@ use Appwrite\Services\Storage; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $storage = new Storage($client); diff --git a/docs/examples/storage/list-files.md b/docs/examples/storage/list-files.md index 038b2cd..767fe86 100644 --- a/docs/examples/storage/list-files.md +++ b/docs/examples/storage/list-files.md @@ -5,7 +5,7 @@ use Appwrite\Services\Storage; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $storage = new Storage($client); diff --git a/docs/examples/storage/update-bucket.md b/docs/examples/storage/update-bucket.md index 96bf127..e4a0f5d 100644 --- a/docs/examples/storage/update-bucket.md +++ b/docs/examples/storage/update-bucket.md @@ -5,8 +5,8 @@ use Appwrite\Services\Storage; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $storage = new Storage($client); diff --git a/docs/examples/storage/update-file.md b/docs/examples/storage/update-file.md index 0ddc6d5..506593f 100644 --- a/docs/examples/storage/update-file.md +++ b/docs/examples/storage/update-file.md @@ -5,7 +5,7 @@ use Appwrite\Services\Storage; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $storage = new Storage($client); diff --git a/docs/examples/teams/create-membership.md b/docs/examples/teams/create-membership.md index 061b906..51b1795 100644 --- a/docs/examples/teams/create-membership.md +++ b/docs/examples/teams/create-membership.md @@ -5,7 +5,7 @@ use Appwrite\Services\Teams; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $teams = new Teams($client); diff --git a/docs/examples/teams/create.md b/docs/examples/teams/create.md index 5475bdf..3cc6b19 100644 --- a/docs/examples/teams/create.md +++ b/docs/examples/teams/create.md @@ -5,7 +5,7 @@ use Appwrite\Services\Teams; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $teams = new Teams($client); diff --git a/docs/examples/teams/delete-membership.md b/docs/examples/teams/delete-membership.md index 15ced89..04f4056 100644 --- a/docs/examples/teams/delete-membership.md +++ b/docs/examples/teams/delete-membership.md @@ -5,7 +5,7 @@ use Appwrite\Services\Teams; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $teams = new Teams($client); diff --git a/docs/examples/teams/delete.md b/docs/examples/teams/delete.md index 98224f7..7344645 100644 --- a/docs/examples/teams/delete.md +++ b/docs/examples/teams/delete.md @@ -5,7 +5,7 @@ use Appwrite\Services\Teams; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $teams = new Teams($client); diff --git a/docs/examples/teams/get-membership.md b/docs/examples/teams/get-membership.md index f27ee3a..5f4bd63 100644 --- a/docs/examples/teams/get-membership.md +++ b/docs/examples/teams/get-membership.md @@ -5,7 +5,7 @@ use Appwrite\Services\Teams; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $teams = new Teams($client); diff --git a/docs/examples/teams/get-prefs.md b/docs/examples/teams/get-prefs.md index 932777a..27f6e06 100644 --- a/docs/examples/teams/get-prefs.md +++ b/docs/examples/teams/get-prefs.md @@ -5,7 +5,7 @@ use Appwrite\Services\Teams; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $teams = new Teams($client); diff --git a/docs/examples/teams/get.md b/docs/examples/teams/get.md index 21320ee..f1ce134 100644 --- a/docs/examples/teams/get.md +++ b/docs/examples/teams/get.md @@ -5,7 +5,7 @@ use Appwrite\Services\Teams; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $teams = new Teams($client); diff --git a/docs/examples/teams/list-memberships.md b/docs/examples/teams/list-memberships.md index 440553c..9d0c988 100644 --- a/docs/examples/teams/list-memberships.md +++ b/docs/examples/teams/list-memberships.md @@ -5,7 +5,7 @@ use Appwrite\Services\Teams; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $teams = new Teams($client); diff --git a/docs/examples/teams/list.md b/docs/examples/teams/list.md index 761b6c2..7ab8f81 100644 --- a/docs/examples/teams/list.md +++ b/docs/examples/teams/list.md @@ -5,7 +5,7 @@ use Appwrite\Services\Teams; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $teams = new Teams($client); diff --git a/docs/examples/teams/update-membership-status.md b/docs/examples/teams/update-membership-status.md index 3c79245..6179020 100644 --- a/docs/examples/teams/update-membership-status.md +++ b/docs/examples/teams/update-membership-status.md @@ -5,7 +5,7 @@ use Appwrite\Services\Teams; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $teams = new Teams($client); diff --git a/docs/examples/teams/update-membership.md b/docs/examples/teams/update-membership.md index 438f354..3b6cafa 100644 --- a/docs/examples/teams/update-membership.md +++ b/docs/examples/teams/update-membership.md @@ -5,7 +5,7 @@ use Appwrite\Services\Teams; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $teams = new Teams($client); diff --git a/docs/examples/teams/update-name.md b/docs/examples/teams/update-name.md index cd1f38f..62768a9 100644 --- a/docs/examples/teams/update-name.md +++ b/docs/examples/teams/update-name.md @@ -5,7 +5,7 @@ use Appwrite\Services\Teams; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $teams = new Teams($client); diff --git a/docs/examples/teams/update-prefs.md b/docs/examples/teams/update-prefs.md index 0dadd2c..ec52ac0 100644 --- a/docs/examples/teams/update-prefs.md +++ b/docs/examples/teams/update-prefs.md @@ -5,7 +5,7 @@ use Appwrite\Services\Teams; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setProject('<YOUR_PROJECT_ID>') // Your project ID ->setSession(''); // The user session to authenticate with $teams = new Teams($client); diff --git a/docs/examples/users/create-argon2user.md b/docs/examples/users/create-argon2user.md index 7bee3bc..a482b5d 100644 --- a/docs/examples/users/create-argon2user.md +++ b/docs/examples/users/create-argon2user.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/create-bcrypt-user.md b/docs/examples/users/create-bcrypt-user.md index 631e4cc..af71dcd 100644 --- a/docs/examples/users/create-bcrypt-user.md +++ b/docs/examples/users/create-bcrypt-user.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/create-j-w-t.md b/docs/examples/users/create-j-w-t.md index 2f0bc37..994cdc3 100644 --- a/docs/examples/users/create-j-w-t.md +++ b/docs/examples/users/create-j-w-t.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/create-m-d5user.md b/docs/examples/users/create-m-d5user.md index 0605f6f..13bb884 100644 --- a/docs/examples/users/create-m-d5user.md +++ b/docs/examples/users/create-m-d5user.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/create-mfa-recovery-codes.md b/docs/examples/users/create-mfa-recovery-codes.md index f499b22..faec234 100644 --- a/docs/examples/users/create-mfa-recovery-codes.md +++ b/docs/examples/users/create-mfa-recovery-codes.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/create-p-h-pass-user.md b/docs/examples/users/create-p-h-pass-user.md index f6dc863..da0889d 100644 --- a/docs/examples/users/create-p-h-pass-user.md +++ b/docs/examples/users/create-p-h-pass-user.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/create-s-h-a-user.md b/docs/examples/users/create-s-h-a-user.md index 777096d..ecb9af7 100644 --- a/docs/examples/users/create-s-h-a-user.md +++ b/docs/examples/users/create-s-h-a-user.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/create-scrypt-modified-user.md b/docs/examples/users/create-scrypt-modified-user.md index 4f8423f..d1c9906 100644 --- a/docs/examples/users/create-scrypt-modified-user.md +++ b/docs/examples/users/create-scrypt-modified-user.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/create-scrypt-user.md b/docs/examples/users/create-scrypt-user.md index 2ccc5d7..3c833b0 100644 --- a/docs/examples/users/create-scrypt-user.md +++ b/docs/examples/users/create-scrypt-user.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/create-session.md b/docs/examples/users/create-session.md index 97d8c8a..498e161 100644 --- a/docs/examples/users/create-session.md +++ b/docs/examples/users/create-session.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/create-target.md b/docs/examples/users/create-target.md index 03104bc..999cae1 100644 --- a/docs/examples/users/create-target.md +++ b/docs/examples/users/create-target.md @@ -6,8 +6,8 @@ use Appwrite\Enums\MessagingProviderType; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/create-token.md b/docs/examples/users/create-token.md index b08faac..9d8e163 100644 --- a/docs/examples/users/create-token.md +++ b/docs/examples/users/create-token.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/create.md b/docs/examples/users/create.md index a50e10e..16549ae 100644 --- a/docs/examples/users/create.md +++ b/docs/examples/users/create.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/delete-identity.md b/docs/examples/users/delete-identity.md index 138b89f..9ca1556 100644 --- a/docs/examples/users/delete-identity.md +++ b/docs/examples/users/delete-identity.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/delete-mfa-authenticator.md b/docs/examples/users/delete-mfa-authenticator.md index d25c2b7..94a9e04 100644 --- a/docs/examples/users/delete-mfa-authenticator.md +++ b/docs/examples/users/delete-mfa-authenticator.md @@ -6,8 +6,8 @@ use Appwrite\Enums\AuthenticatorType; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/delete-session.md b/docs/examples/users/delete-session.md index bf673b2..e711a92 100644 --- a/docs/examples/users/delete-session.md +++ b/docs/examples/users/delete-session.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/delete-sessions.md b/docs/examples/users/delete-sessions.md index f2a3f21..3b46021 100644 --- a/docs/examples/users/delete-sessions.md +++ b/docs/examples/users/delete-sessions.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/delete-target.md b/docs/examples/users/delete-target.md index 20e676a..6b9975d 100644 --- a/docs/examples/users/delete-target.md +++ b/docs/examples/users/delete-target.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/delete.md b/docs/examples/users/delete.md index 225708c..f1dbbf3 100644 --- a/docs/examples/users/delete.md +++ b/docs/examples/users/delete.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/get-mfa-recovery-codes.md b/docs/examples/users/get-mfa-recovery-codes.md index 055ef04..b0e3a75 100644 --- a/docs/examples/users/get-mfa-recovery-codes.md +++ b/docs/examples/users/get-mfa-recovery-codes.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/get-prefs.md b/docs/examples/users/get-prefs.md index 392dc14..59589f7 100644 --- a/docs/examples/users/get-prefs.md +++ b/docs/examples/users/get-prefs.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/get-target.md b/docs/examples/users/get-target.md index 7ca05d3..ba146a3 100644 --- a/docs/examples/users/get-target.md +++ b/docs/examples/users/get-target.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/get.md b/docs/examples/users/get.md index 1cc351a..4ff399b 100644 --- a/docs/examples/users/get.md +++ b/docs/examples/users/get.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/list-identities.md b/docs/examples/users/list-identities.md index 040e309..53ba78d 100644 --- a/docs/examples/users/list-identities.md +++ b/docs/examples/users/list-identities.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/list-logs.md b/docs/examples/users/list-logs.md index e717bdf..434dbaf 100644 --- a/docs/examples/users/list-logs.md +++ b/docs/examples/users/list-logs.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/list-memberships.md b/docs/examples/users/list-memberships.md index da760e0..addc6b7 100644 --- a/docs/examples/users/list-memberships.md +++ b/docs/examples/users/list-memberships.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/list-mfa-factors.md b/docs/examples/users/list-mfa-factors.md index 16964c5..0d137aa 100644 --- a/docs/examples/users/list-mfa-factors.md +++ b/docs/examples/users/list-mfa-factors.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/list-sessions.md b/docs/examples/users/list-sessions.md index 0bfa242..5dcac1f 100644 --- a/docs/examples/users/list-sessions.md +++ b/docs/examples/users/list-sessions.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/list-targets.md b/docs/examples/users/list-targets.md index c4815be..a91ac5e 100644 --- a/docs/examples/users/list-targets.md +++ b/docs/examples/users/list-targets.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/list.md b/docs/examples/users/list.md index 678e97f..9b8d1d5 100644 --- a/docs/examples/users/list.md +++ b/docs/examples/users/list.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/update-email-verification.md b/docs/examples/users/update-email-verification.md index d2d6584..e74e887 100644 --- a/docs/examples/users/update-email-verification.md +++ b/docs/examples/users/update-email-verification.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/update-email.md b/docs/examples/users/update-email.md index a73100c..fc40fac 100644 --- a/docs/examples/users/update-email.md +++ b/docs/examples/users/update-email.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/update-labels.md b/docs/examples/users/update-labels.md index 9651830..45fe23b 100644 --- a/docs/examples/users/update-labels.md +++ b/docs/examples/users/update-labels.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/update-mfa-recovery-codes.md b/docs/examples/users/update-mfa-recovery-codes.md index d09ccd7..369c248 100644 --- a/docs/examples/users/update-mfa-recovery-codes.md +++ b/docs/examples/users/update-mfa-recovery-codes.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/update-mfa.md b/docs/examples/users/update-mfa.md index 5ab48c5..5df7aa2 100644 --- a/docs/examples/users/update-mfa.md +++ b/docs/examples/users/update-mfa.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/update-name.md b/docs/examples/users/update-name.md index 96e8afc..7050d19 100644 --- a/docs/examples/users/update-name.md +++ b/docs/examples/users/update-name.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/update-password.md b/docs/examples/users/update-password.md index ffcb817..8dcb57b 100644 --- a/docs/examples/users/update-password.md +++ b/docs/examples/users/update-password.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/update-phone-verification.md b/docs/examples/users/update-phone-verification.md index 8054531..12e44da 100644 --- a/docs/examples/users/update-phone-verification.md +++ b/docs/examples/users/update-phone-verification.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/update-phone.md b/docs/examples/users/update-phone.md index 5828633..95c3115 100644 --- a/docs/examples/users/update-phone.md +++ b/docs/examples/users/update-phone.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/update-prefs.md b/docs/examples/users/update-prefs.md index 6d0ecad..2ffd938 100644 --- a/docs/examples/users/update-prefs.md +++ b/docs/examples/users/update-prefs.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/update-status.md b/docs/examples/users/update-status.md index 7ffbfc2..28a0532 100644 --- a/docs/examples/users/update-status.md +++ b/docs/examples/users/update-status.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/update-target.md b/docs/examples/users/update-target.md index 5c476db..a1b654d 100644 --- a/docs/examples/users/update-target.md +++ b/docs/examples/users/update-target.md @@ -5,8 +5,8 @@ use Appwrite\Services\Users; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setKey('<YOUR_API_KEY>'); // Your secret API key + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key $users = new Users($client); diff --git a/src/Appwrite/Client.php b/src/Appwrite/Client.php index 8314ca8..bcbfd6f 100644 --- a/src/Appwrite/Client.php +++ b/src/Appwrite/Client.php @@ -37,11 +37,11 @@ class Client */ protected array $headers = [ 'content-type' => '', - 'user-agent' => 'AppwritePHPSDK/12.0.0-rc.2 ()', + 'user-agent' => 'AppwritePHPSDK/12.0.0-rc.3 ()', 'x-sdk-name'=> 'PHP', 'x-sdk-platform'=> 'server', 'x-sdk-language'=> 'php', - 'x-sdk-version'=> '12.0.0-rc.2', + 'x-sdk-version'=> '12.0.0-rc.3', ]; /** diff --git a/src/Appwrite/Enums/Runtime.php b/src/Appwrite/Enums/Runtime.php index 05cb177..bb0fd1a 100644 --- a/src/Appwrite/Enums/Runtime.php +++ b/src/Appwrite/Enums/Runtime.php @@ -51,7 +51,7 @@ class Runtime implements JsonSerializable private static Runtime $CPP17; private static Runtime $CPP20; private static Runtime $BUN10; - private static Runtime $GO122; + private static Runtime $GO123; private string $value; @@ -385,11 +385,11 @@ public static function BUN10(): Runtime } return self::$BUN10; } - public static function GO122(): Runtime + public static function GO123(): Runtime { - if (!isset(self::$GO122)) { - self::$GO122 = new Runtime('go-1.22'); + if (!isset(self::$GO123)) { + self::$GO123 = new Runtime('go-1.23'); } - return self::$GO122; + return self::$GO123; } } \ No newline at end of file diff --git a/tests/Appwrite/Services/FunctionsTest.php b/tests/Appwrite/Services/FunctionsTest.php index 27904c8..62a5d0e 100644 --- a/tests/Appwrite/Services/FunctionsTest.php +++ b/tests/Appwrite/Services/FunctionsTest.php @@ -285,6 +285,7 @@ public function testMethodCreateDeployment(): void { "resourceType" => "functions", "entrypoint" => "index.js", "size" => 128, + "buildSize" => 128, "buildId" => "5e5ea5c16897e", "activate" => true, "status" => "ready", @@ -326,6 +327,7 @@ public function testMethodGetDeployment(): void { "resourceType" => "functions", "entrypoint" => "index.js", "size" => 128, + "buildSize" => 128, "buildId" => "5e5ea5c16897e", "activate" => true, "status" => "ready", From d906d4c0fdf2e69a1c09533fdce92da8455cc788 Mon Sep 17 00:00:00 2001 From: root <christyjacob4@gmail.com> Date: Fri, 23 Aug 2024 15:26:56 +0000 Subject: [PATCH 6/9] chore: update SDKs for appwrite 1.6.0 --- src/Appwrite/Client.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Appwrite/Client.php b/src/Appwrite/Client.php index bcbfd6f..b102f8d 100644 --- a/src/Appwrite/Client.php +++ b/src/Appwrite/Client.php @@ -37,11 +37,11 @@ class Client */ protected array $headers = [ 'content-type' => '', - 'user-agent' => 'AppwritePHPSDK/12.0.0-rc.3 ()', + 'user-agent' => 'AppwritePHPSDK/12.0.0 ()', 'x-sdk-name'=> 'PHP', 'x-sdk-platform'=> 'server', 'x-sdk-language'=> 'php', - 'x-sdk-version'=> '12.0.0-rc.3', + 'x-sdk-version'=> '12.0.0', ]; /** From 43cec0283612465ffacb64f6bf827c36de4f166a Mon Sep 17 00:00:00 2001 From: root <christyjacob4@gmail.com> Date: Mon, 26 Aug 2024 16:57:09 +0000 Subject: [PATCH 7/9] chore: update team email --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index f10aacc..6dea965 100644 --- a/composer.json +++ b/composer.json @@ -5,7 +5,7 @@ "license": "BSD-3-Clause", "support": { "url": "https://appwrite.io/support", - "email": "team@localhost.test" + "email": "team@appwrite.io" }, "autoload": { "psr-4": { From 148ae6b7b237b401c45b9f47060104e60e1e4875 Mon Sep 17 00:00:00 2001 From: root <christyjacob4@gmail.com> Date: Tue, 27 Aug 2024 10:55:11 +0000 Subject: [PATCH 8/9] chore: update Appwrite version --- docs/examples/functions/list-templates.md | 17 -------- docs/functions.md | 17 -------- src/Appwrite/Services/Functions.php | 51 ----------------------- tests/Appwrite/Services/FunctionsTest.php | 17 -------- 4 files changed, 102 deletions(-) delete mode 100644 docs/examples/functions/list-templates.md diff --git a/docs/examples/functions/list-templates.md b/docs/examples/functions/list-templates.md deleted file mode 100644 index a661903..0000000 --- a/docs/examples/functions/list-templates.md +++ /dev/null @@ -1,17 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Functions; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>'); // Your project ID - -$functions = new Functions($client); - -$result = $functions->listTemplates( - runtimes: [], // optional - useCases: [], // optional - limit: 1, // optional - offset: 0 // optional -); \ No newline at end of file diff --git a/docs/functions.md b/docs/functions.md index 08a932c..7e3c2ea 100644 --- a/docs/functions.md +++ b/docs/functions.md @@ -67,23 +67,6 @@ GET https://cloud.appwrite.io/v1/functions/specifications ** List allowed function specifications for this instance. ** -## List function templates - -```http request -GET https://cloud.appwrite.io/v1/functions/templates -``` - -** List available function templates. You can use template details in [createFunction](/docs/references/cloud/server-nodejs/functions#create) method. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| runtimes | array | List of runtimes allowed for filtering function templates. Maximum of 100 runtimes are allowed. | [] | -| useCases | array | List of use cases allowed for filtering function templates. Maximum of 100 use cases are allowed. | [] | -| limit | integer | Limit the number of templates returned in the response. Default limit is 25, and maximum limit is 5000. | 25 | -| offset | integer | Offset the list of returned templates. Maximum offset is 5000. | 0 | - ## Get function template ```http request diff --git a/src/Appwrite/Services/Functions.php b/src/Appwrite/Services/Functions.php index 57e4830..9feb474 100644 --- a/src/Appwrite/Services/Functions.php +++ b/src/Appwrite/Services/Functions.php @@ -248,57 +248,6 @@ public function listSpecifications(): array ); } - /** - * List function templates - * - * List available function templates. You can use template details in - * [createFunction](/docs/references/cloud/server-nodejs/functions#create) - * method. - * - * @param ?array $runtimes - * @param ?array $useCases - * @param ?int $limit - * @param ?int $offset - * @throws AppwriteException - * @return array - */ - public function listTemplates(?array $runtimes = null, ?array $useCases = null, ?int $limit = null, ?int $offset = null): array - { - $apiPath = str_replace( - [], - [], - '/functions/templates' - ); - - $apiParams = []; - - if (!is_null($runtimes)) { - $apiParams['runtimes'] = $runtimes; - } - - if (!is_null($useCases)) { - $apiParams['useCases'] = $useCases; - } - - if (!is_null($limit)) { - $apiParams['limit'] = $limit; - } - - if (!is_null($offset)) { - $apiParams['offset'] = $offset; - } - - $apiHeaders = []; - $apiHeaders['content-type'] = 'application/json'; - - return $this->client->call( - Client::METHOD_GET, - $apiPath, - $apiHeaders, - $apiParams - ); - } - /** * Get function template * diff --git a/tests/Appwrite/Services/FunctionsTest.php b/tests/Appwrite/Services/FunctionsTest.php index 62a5d0e..d839500 100644 --- a/tests/Appwrite/Services/FunctionsTest.php +++ b/tests/Appwrite/Services/FunctionsTest.php @@ -109,23 +109,6 @@ public function testMethodListSpecifications(): void { $this->assertSame($data, $response); } - public function testMethodListTemplates(): void { - - $data = array( - "total" => 5, - "templates" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->functions->listTemplates( - ); - - $this->assertSame($data, $response); - } - public function testMethodGetTemplate(): void { $data = array( From b3bb237d1563a3e70f76b3e442f225f5ad058404 Mon Sep 17 00:00:00 2001 From: root <christyjacob4@gmail.com> Date: Tue, 27 Aug 2024 11:16:58 +0000 Subject: [PATCH 9/9] chore: updates for appwrite 1.6.x --- .../functions/get-deployment-download.md | 2 +- docs/examples/functions/get-template.md | 14 -------- docs/functions.md | 14 -------- src/Appwrite/Services/Functions.php | 33 ------------------- tests/Appwrite/Services/FunctionsTest.php | 33 ------------------- 5 files changed, 1 insertion(+), 95 deletions(-) delete mode 100644 docs/examples/functions/get-template.md diff --git a/docs/examples/functions/get-deployment-download.md b/docs/examples/functions/get-deployment-download.md index c50a1b9..4103ec8 100644 --- a/docs/examples/functions/get-deployment-download.md +++ b/docs/examples/functions/get-deployment-download.md @@ -6,7 +6,7 @@ use Appwrite\Services\Functions; $client = (new Client()) ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint ->setProject('<YOUR_PROJECT_ID>') // Your project ID - ->setSession(''); // The user session to authenticate with + ->setKey('<YOUR_API_KEY>'); // Your secret API key $functions = new Functions($client); diff --git a/docs/examples/functions/get-template.md b/docs/examples/functions/get-template.md deleted file mode 100644 index 421557d..0000000 --- a/docs/examples/functions/get-template.md +++ /dev/null @@ -1,14 +0,0 @@ -<?php - -use Appwrite\Client; -use Appwrite\Services\Functions; - -$client = (new Client()) - ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('<YOUR_PROJECT_ID>'); // Your project ID - -$functions = new Functions($client); - -$result = $functions->getTemplate( - templateId: '<TEMPLATE_ID>' -); \ No newline at end of file diff --git a/docs/functions.md b/docs/functions.md index 7e3c2ea..625d258 100644 --- a/docs/functions.md +++ b/docs/functions.md @@ -67,20 +67,6 @@ GET https://cloud.appwrite.io/v1/functions/specifications ** List allowed function specifications for this instance. ** -## Get function template - -```http request -GET https://cloud.appwrite.io/v1/functions/templates/{templateId} -``` - -** Get a function template using ID. You can use template details in [createFunction](/docs/references/cloud/server-nodejs/functions#create) method. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| templateId | string | **Required** Template ID. | | - ## Get function ```http request diff --git a/src/Appwrite/Services/Functions.php b/src/Appwrite/Services/Functions.php index 9feb474..2e1d60f 100644 --- a/src/Appwrite/Services/Functions.php +++ b/src/Appwrite/Services/Functions.php @@ -248,39 +248,6 @@ public function listSpecifications(): array ); } - /** - * Get function template - * - * Get a function template using ID. You can use template details in - * [createFunction](/docs/references/cloud/server-nodejs/functions#create) - * method. - * - * @param string $templateId - * @throws AppwriteException - * @return array - */ - public function getTemplate(string $templateId): array - { - $apiPath = str_replace( - ['{templateId}'], - [$templateId], - '/functions/templates/{templateId}' - ); - - $apiParams = []; - $apiParams['templateId'] = $templateId; - - $apiHeaders = []; - $apiHeaders['content-type'] = 'application/json'; - - return $this->client->call( - Client::METHOD_GET, - $apiPath, - $apiHeaders, - $apiParams - ); - } - /** * Get function * diff --git a/tests/Appwrite/Services/FunctionsTest.php b/tests/Appwrite/Services/FunctionsTest.php index d839500..854f83b 100644 --- a/tests/Appwrite/Services/FunctionsTest.php +++ b/tests/Appwrite/Services/FunctionsTest.php @@ -109,39 +109,6 @@ public function testMethodListSpecifications(): void { $this->assertSame($data, $response); } - public function testMethodGetTemplate(): void { - - $data = array( - "icon" => "icon-lightning-bolt", - "id" => "starter", - "name" => "Starter function", - "tagline" => "A simple function to get started.", - "permissions" => array(), - "events" => array(), - "cron" => "0 0 * * *", - "timeout" => 300, - "useCases" => array(), - "runtimes" => array(), - "instructions" => "For documentation and instructions check out <link>.", - "vcsProvider" => "github", - "providerRepositoryId" => "templates", - "providerOwner" => "appwrite", - "providerVersion" => "main", - "variables" => array(), - "scopes" => array(),); - - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->functions->getTemplate( - "<TEMPLATE_ID>" - ); - - $this->assertSame($data, $response); - } - public function testMethodGet(): void { $data = array(