From a19b754cdb3ca5eb82dbf4f7ca8307d6f383daf9 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Mon, 9 Sep 2024 19:24:48 +1200 Subject: [PATCH] Add update attribute parameters --- README.md | 4 +- docs/account.md | 11 +- docs/avatars.md | 6 +- docs/databases.md | 11 + .../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 | 5 +- 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 | 7 +- docs/examples/databases/update-collection.md | 4 +- .../databases/update-datetime-attribute.md | 7 +- docs/examples/databases/update-document.md | 2 +- .../databases/update-email-attribute.md | 7 +- .../databases/update-enum-attribute.md | 7 +- .../databases/update-float-attribute.md | 7 +- .../databases/update-integer-attribute.md | 7 +- .../examples/databases/update-ip-attribute.md | 7 +- .../update-relationship-attribute.md | 7 +- .../databases/update-string-attribute.md | 8 +- .../databases/update-url-attribute.md | 7 +- 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 | 8 +- 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 +- ...ployment.md => get-deployment-download.md} | 6 +- 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 +- .../examples/functions/list-specifications.md | 13 + 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 | 8 +- 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 | 59 +- docs/storage.md | 6 +- docs/teams.md | 2 +- docs/users.md | 16 + src/Appwrite/AppwriteException.php | 23 +- src/Appwrite/Client.php | 48 +- src/Appwrite/Enums/Name.php | 10 +- src/Appwrite/Enums/Runtime.php | 32 +- src/Appwrite/InputFile.php | 4 +- src/Appwrite/Permission.php | 4 + src/Appwrite/Query.php | 18 +- src/Appwrite/Service.php | 8 +- src/Appwrite/Services/Account.php | 1015 +++++----- src/Appwrite/Services/Avatars.php | 210 +- src/Appwrite/Services/Databases.php | 1630 ++++++++-------- src/Appwrite/Services/Functions.php | 783 +++++--- src/Appwrite/Services/Graphql.php | 52 +- src/Appwrite/Services/Health.php | 426 +++-- src/Appwrite/Services/Locale.php | 124 +- src/Appwrite/Services/Messaging.php | 1699 +++++++++-------- src/Appwrite/Services/Storage.php | 413 ++-- src/Appwrite/Services/Teams.php | 353 ++-- src/Appwrite/Services/Users.php | 1210 ++++++------ tests/Appwrite/Services/AccountTest.php | 3 +- tests/Appwrite/Services/FunctionsTest.php | 85 +- tests/Appwrite/Services/UsersTest.php | 17 + 293 files changed, 4979 insertions(+), 4276 deletions(-) create mode 100644 docs/examples/functions/delete-execution.md rename docs/examples/functions/{download-deployment.md => get-deployment-download.md} (61%) create mode 100644 docs/examples/functions/list-specifications.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..57ef550 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # Appwrite PHP SDK ![License](https://img.shields.io/github/license/appwrite/sdk-for-php.svg?style=flat-square&v=1) -![Version](https://img.shields.io/badge/api%20version-1.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) -**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..d23e642 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. ** @@ -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} @@ -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 @@ -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/databases.md b/docs/databases.md index 9267e14..538973c 100644 --- a/docs/databases.md +++ b/docs/databases.md @@ -213,6 +213,7 @@ PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectio | key | string | **Required** Attribute Key. | | | required | boolean | Is attribute required? | | | default | boolean | Default value for attribute when not provided. Cannot be set when attribute is required. | | +| newKey | string | New attribute key. | | ## Create datetime attribute @@ -250,6 +251,7 @@ PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectio | key | string | **Required** Attribute Key. | | | required | boolean | Is attribute required? | | | default | string | Default value for attribute when not provided. Cannot be set when attribute is required. | | +| newKey | string | New attribute key. | | ## Create email attribute @@ -289,6 +291,7 @@ PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectio | key | string | **Required** Attribute Key. | | | required | boolean | Is attribute required? | | | default | string | Default value for attribute when not provided. Cannot be set when attribute is required. | | +| newKey | string | New attribute key. | | ## Create enum attribute @@ -330,6 +333,7 @@ PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectio | elements | array | Array of elements in enumerated type. Uses length of longest element to determine size. Maximum of 100 elements are allowed, each 255 characters long. | | | required | boolean | Is attribute required? | | | default | string | Default value for attribute when not provided. Cannot be set when attribute is required. | | +| newKey | string | New attribute key. | | ## Create float attribute @@ -373,6 +377,7 @@ PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectio | min | number | Minimum value to enforce on new documents | | | max | number | Maximum value to enforce on new documents | | | default | number | Default value for attribute when not provided. Cannot be set when attribute is required. | | +| newKey | string | New attribute key. | | ## Create integer attribute @@ -416,6 +421,7 @@ PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectio | min | integer | Minimum value to enforce on new documents | | | max | integer | Maximum value to enforce on new documents | | | default | integer | Default value for attribute when not provided. Cannot be set when attribute is required. | | +| newKey | string | New attribute key. | | ## Create IP address attribute @@ -455,6 +461,7 @@ PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectio | key | string | **Required** Attribute Key. | | | required | boolean | Is attribute required? | | | default | string | Default value for attribute when not provided. Cannot be set when attribute is required. | | +| newKey | string | New attribute key. | | ## Create relationship attribute @@ -518,6 +525,8 @@ PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectio | key | string | **Required** Attribute Key. | | | required | boolean | Is attribute required? | | | default | string | Default value for attribute when not provided. Cannot be set when attribute is required. | | +| size | integer | Maximum size of the string attribute. | | +| newKey | string | New attribute key. | | ## Create URL attribute @@ -557,6 +566,7 @@ PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectio | key | string | **Required** Attribute Key. | | | required | boolean | Is attribute required? | | | default | string | Default value for attribute when not provided. Cannot be set when attribute is required. | | +| newKey | string | New attribute key. | | ## Get attribute @@ -607,6 +617,7 @@ PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectio | collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | | key | string | **Required** Attribute Key. | | | onDelete | string | Constraints option | | +| newKey | string | New attribute key. | | ## List documents diff --git a/docs/examples/account/create-anonymous-session.md b/docs/examples/account/create-anonymous-session.md index 950bb4a..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('5df5acd0d48c2'); // Your project ID + ->setProject(''); // 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..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('5df5acd0d48c2'); // Your project ID + ->setProject(''); // 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..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('5df5acd0d48c2'); // Your project ID + ->setProject(''); // 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..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('5df5acd0d48c2'); // Your project ID + ->setProject(''); // 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..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('5df5acd0d48c2'); // Your project ID + ->setProject(''); // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2'); // Your project ID + ->setProject(''); // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2'); // Your project ID + ->setProject(''); // 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..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('5df5acd0d48c2'); // Your project ID + ->setProject(''); // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2'); // Your project ID + ->setProject(''); // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2'); // Your project ID + ->setProject(''); // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..5367409 100644 --- a/docs/examples/account/delete-mfa-authenticator.md +++ b/docs/examples/account/delete-mfa-authenticator.md @@ -6,12 +6,11 @@ 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 ->setSession(''); // The user session to authenticate with $account = new Account($client); $result = $account->deleteMfaAuthenticator( - type: AuthenticatorType::TOTP(), - otp: '' + 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 index 9b06705..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2'); // Your project ID + ->setProject(''); // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2'); // Your project ID + ->setProject(''); // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/create.md b/docs/examples/databases/create.md index 10f46ff..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/delete.md b/docs/examples/databases/delete.md index 999fe3a..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/get.md b/docs/examples/databases/get.md index d30acdc..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key $databases = new Databases($client); diff --git a/docs/examples/databases/list.md b/docs/examples/databases/list.md index d2bfe71..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..133fbb8 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 + ->setKey(''); // Your secret API key $databases = new Databases($client); @@ -15,5 +15,6 @@ $result = $databases->updateBooleanAttribute( collectionId: '', key: '', required: false, - default: false + default: false, + newKey: '' // optional ); \ No newline at end of file diff --git a/docs/examples/databases/update-collection.md b/docs/examples/databases/update-collection.md index c923217..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..4773e54 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 + ->setKey(''); // Your secret API key $databases = new Databases($client); @@ -15,5 +15,6 @@ $result = $databases->updateDatetimeAttribute( collectionId: '', key: '', required: false, - default: '' + default: '', + newKey: '' // optional ); \ No newline at end of file diff --git a/docs/examples/databases/update-document.md b/docs/examples/databases/update-document.md index 837653f..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..9c1bdb4 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 + ->setKey(''); // Your secret API key $databases = new Databases($client); @@ -15,5 +15,6 @@ $result = $databases->updateEmailAttribute( collectionId: '', key: '', required: false, - default: 'email@example.com' + default: 'email@example.com', + newKey: '' // optional ); \ No newline at end of file diff --git a/docs/examples/databases/update-enum-attribute.md b/docs/examples/databases/update-enum-attribute.md index 55368c6..88229bc 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 + ->setKey(''); // Your secret API key $databases = new Databases($client); @@ -16,5 +16,6 @@ $result = $databases->updateEnumAttribute( key: '', elements: [], required: false, - default: '' + default: '', + newKey: '' // optional ); \ No newline at end of file diff --git a/docs/examples/databases/update-float-attribute.md b/docs/examples/databases/update-float-attribute.md index a7ec238..7beac26 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 + ->setKey(''); // Your secret API key $databases = new Databases($client); @@ -17,5 +17,6 @@ $result = $databases->updateFloatAttribute( required: false, min: null, max: null, - default: null + default: null, + newKey: '' // optional ); \ No newline at end of file diff --git a/docs/examples/databases/update-integer-attribute.md b/docs/examples/databases/update-integer-attribute.md index 4567a3c..e92385d 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 + ->setKey(''); // Your secret API key $databases = new Databases($client); @@ -17,5 +17,6 @@ $result = $databases->updateIntegerAttribute( required: false, min: null, max: null, - default: null + default: null, + newKey: '' // optional ); \ No newline at end of file diff --git a/docs/examples/databases/update-ip-attribute.md b/docs/examples/databases/update-ip-attribute.md index 8e7c87b..e88e75c 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 + ->setKey(''); // Your secret API key $databases = new Databases($client); @@ -15,5 +15,6 @@ $result = $databases->updateIpAttribute( collectionId: '', key: '', required: false, - default: '' + default: '', + newKey: '' // optional ); \ No newline at end of file diff --git a/docs/examples/databases/update-relationship-attribute.md b/docs/examples/databases/update-relationship-attribute.md index 756de78..0afaea2 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 + ->setKey(''); // Your secret API key $databases = new Databases($client); @@ -14,5 +14,6 @@ $result = $databases->updateRelationshipAttribute( databaseId: '', collectionId: '', key: '', - onDelete: RelationMutate::CASCADE() // optional + onDelete: RelationMutate::CASCADE(), // optional + newKey: '' // 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 index 819aee4..9e821e4 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 + ->setKey(''); // Your secret API key $databases = new Databases($client); @@ -15,5 +15,7 @@ $result = $databases->updateStringAttribute( collectionId: '', key: '', required: false, - default: '' + default: '', + size: null, // optional + newKey: '' // optional ); \ No newline at end of file diff --git a/docs/examples/databases/update-url-attribute.md b/docs/examples/databases/update-url-attribute.md index d7f9c89..1825e55 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 + ->setKey(''); // Your secret API key $databases = new Databases($client); @@ -15,5 +15,6 @@ $result = $databases->updateUrlAttribute( collectionId: '', key: '', required: false, - default: 'https://example.com' + default: 'https://example.com', + newKey: '' // optional ); \ No newline at end of file diff --git a/docs/examples/databases/update.md b/docs/examples/databases/update.md index 484875a..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..429653c 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 + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key $functions = new Functions($client); diff --git a/docs/examples/functions/create.md b/docs/examples/functions/create.md index 0c282ba..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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 @@ -31,5 +32,6 @@ $result = $functions->create( templateRepository: '', // optional templateOwner: '', // optional templateRootDirectory: '', // optional - templateBranch: '' // optional + templateVersion: '', // optional + specification: '' // optional ); \ No newline at end of file diff --git a/docs/examples/functions/delete-deployment.md b/docs/examples/functions/delete-deployment.md index 6a609cd..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..4fbef18 --- /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 + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key $functions = new Functions($client); diff --git a/docs/examples/functions/delete.md b/docs/examples/functions/delete.md index 08b5cc4..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key $functions = new Functions($client); diff --git a/docs/examples/functions/download-deployment.md b/docs/examples/functions/get-deployment-download.md similarity index 61% rename from docs/examples/functions/download-deployment.md rename to docs/examples/functions/get-deployment-download.md index 9f3b3da..4103ec8 100644 --- a/docs/examples/functions/download-deployment.md +++ b/docs/examples/functions/get-deployment-download.md @@ -5,12 +5,12 @@ 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 + ->setKey(''); // Your secret API key $functions = new Functions($client); -$result = $functions->downloadDeployment( +$result = $functions->getDeploymentDownload( functionId: '', deploymentId: '' ); \ No newline at end of file diff --git a/docs/examples/functions/get-deployment.md b/docs/examples/functions/get-deployment.md index 12e37f3..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key $functions = new Functions($client); diff --git a/docs/examples/functions/get.md b/docs/examples/functions/get.md index 00993f7..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key $functions = new Functions($client); diff --git a/docs/examples/functions/list-specifications.md b/docs/examples/functions/list-specifications.md new file mode 100644 index 0000000..e68a4b0 --- /dev/null +++ b/docs/examples/functions/list-specifications.md @@ -0,0 +1,13 @@ +setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$functions = new Functions($client); + +$result = $functions->listSpecifications(); diff --git a/docs/examples/functions/list-variables.md b/docs/examples/functions/list-variables.md index 681102b..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key $functions = new Functions($client); diff --git a/docs/examples/functions/list.md b/docs/examples/functions/list.md index b59494b..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..98f2a3a --- /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 + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key $functions = new Functions($client); diff --git a/docs/examples/functions/update.md b/docs/examples/functions/update.md index e55108f..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key $functions = new Functions($client); @@ -22,9 +22,11 @@ $result = $functions->update( logging: false, // optional entrypoint: '', // optional commands: '', // optional + scopes: [], // optional installationId: '', // optional providerRepositoryId: '', // optional providerBranch: '', // optional providerSilentMode: false, // optional - providerRootDirectory: '' // optional + providerRootDirectory: '', // optional + specification: '' // optional ); \ No newline at end of file diff --git a/docs/examples/graphql/mutation.md b/docs/examples/graphql/mutation.md index 1be4802..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key $graphql = new Graphql($client); diff --git a/docs/examples/graphql/query.md b/docs/examples/graphql/query.md index 5467fe1..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key $health = new Health($client); diff --git a/docs/examples/health/get.md b/docs/examples/health/get.md index 6e8216c..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key $health = new Health($client); diff --git a/docs/examples/locale/get.md b/docs/examples/locale/get.md index beecee9..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...'); // Your secret JSON Web Token + ->setProject('') // Your project ID + ->setJWT(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...'); // Your secret JSON Web Token + ->setProject('') // Your project ID + ->setJWT(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key $messaging = new Messaging($client); diff --git a/docs/examples/messaging/delete.md b/docs/examples/messaging/delete.md index 5c05eed..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID + ->setProject('') // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..994cdc3 --- /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 + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/create.md b/docs/examples/users/create.md index 7cf4b6f..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/delete.md b/docs/examples/users/delete.md index b715e84..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/get.md b/docs/examples/users/get.md index 5428d73..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key $users = new Users($client); diff --git a/docs/examples/users/list.md b/docs/examples/users/list.md index 63616e5..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // 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..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('5df5acd0d48c2') // Your project ID - ->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key $users = new Users($client); diff --git a/docs/functions.md b/docs/functions.md index f742744..625d258 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. | | @@ -46,7 +47,8 @@ POST https://cloud.appwrite.io/v1/functions | 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. | | +| 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 @@ -56,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. + ** + ## Get function ```http request @@ -93,11 +104,13 @@ 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 | | | 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 @@ -126,7 +139,7 @@ GET https://cloud.appwrite.io/v1/functions/{functionId}/deployments | 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 | [] | +| 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 @@ -166,7 +179,7 @@ GET https://cloud.appwrite.io/v1/functions/{functionId}/deployments/{deploymentI | functionId | string | **Required** Function ID. | | | deploymentId | string | **Required** Deployment ID. | | -## Update function deployment +## Update deployment ```http request PATCH https://cloud.appwrite.io/v1/functions/{functionId}/deployments/{deploymentId} @@ -196,13 +209,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,9 +235,8 @@ 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 +## Download deployment ```http request GET https://cloud.appwrite.io/v1/functions/{functionId}/deployments/{deploymentId}/download @@ -240,7 +264,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 +285,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 with precision in minutes. | | ## Get execution @@ -277,6 +302,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..4101f27 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. | | +| 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/AppwriteException.php b/src/Appwrite/AppwriteException.php index 5b722d5..31d7927 100644 --- a/src/Appwrite/AppwriteException.php +++ b/src/Appwrite/AppwriteException.php @@ -9,20 +9,25 @@ class AppwriteException extends Exception { /** * @var mixed */ - private $response; + private ?string $response; /** * @var string */ - private $type; + private string $type; /** - * @param String $message + * @param ?string $message * @param int $code - * @param mixed $response + * @param string $type + * @param ?string $response */ - public function __construct($message = null, $code = 0, $type = null, $response = null) - { + public function __construct( + ?string $message = null, + int $code = 0, + string $type = '', + ?string $response = null + ) { parent::__construct($message, $code); $this->response = $response; $this->type = $type; @@ -31,15 +36,15 @@ public function __construct($message = null, $code = 0, $type = null, $response /** * @return string */ - public function getType() + public function getType(): string { return $this->type; } /** - * @return mixed + * @return ?string */ - final public function getResponse() + final public function getResponse(): ?string { return $this->response; } diff --git a/src/Appwrite/Client.php b/src/Appwrite/Client.php index f88c044..b102f8d 100644 --- a/src/Appwrite/Client.php +++ b/src/Appwrite/Client.php @@ -14,42 +14,42 @@ class Client const METHOD_CONNECT = 'CONNECT'; const METHOD_TRACE = 'TRACE'; - const CHUNK_SIZE = 5*1024*1024; + const CHUNK_SIZE = 5 * 1024 * 1024; /** * Is Self Signed Certificates Allowed? * * @var bool */ - protected $selfSigned = false; + protected bool $selfSigned = false; /** * Service host name * * @var string */ - protected $endpoint = 'https://cloud.appwrite.io/v1'; + protected string $endpoint = 'https://cloud.appwrite.io/v1'; /** * Global Headers * * @var array */ - protected $headers = [ + protected array $headers = [ 'content-type' => '', - 'user-agent' => 'AppwritePHPSDK/11.1.0 ()', + 'user-agent' => 'AppwritePHPSDK/12.0.0 ()', 'x-sdk-name'=> 'PHP', 'x-sdk-platform'=> 'server', 'x-sdk-language'=> 'php', - 'x-sdk-version'=> '11.1.0', + 'x-sdk-version'=> '12.0.0', ]; /** - * SDK constructor. + * Client constructor. */ public function __construct() { - $this->headers['X-Appwrite-Response-Format'] = '1.5.0'; + $this->headers['X-Appwrite-Response-Format'] = '1.6.0'; } @@ -62,7 +62,7 @@ public function __construct() * * @return Client */ - public function setProject($value) + public function setProject(string $value): Client { $this->addHeader('X-Appwrite-Project', $value); @@ -78,7 +78,7 @@ public function setProject($value) * * @return Client */ - public function setKey($value) + public function setKey(string $value): Client { $this->addHeader('X-Appwrite-Key', $value); @@ -94,7 +94,7 @@ public function setKey($value) * * @return Client */ - public function setJWT($value) + public function setJWT(string $value): Client { $this->addHeader('X-Appwrite-JWT', $value); @@ -108,7 +108,7 @@ public function setJWT($value) * * @return Client */ - public function setLocale($value) + public function setLocale(string $value): Client { $this->addHeader('X-Appwrite-Locale', $value); @@ -124,7 +124,7 @@ public function setLocale($value) * * @return Client */ - public function setSession($value) + public function setSession(string $value): Client { $this->addHeader('X-Appwrite-Session', $value); @@ -140,7 +140,7 @@ public function setSession($value) * * @return Client */ - public function setForwardedUserAgent($value) + public function setForwardedUserAgent(string $value): Client { $this->addHeader('X-Forwarded-User-Agent', $value); @@ -152,7 +152,7 @@ public function setForwardedUserAgent($value) * @param bool $status * @return $this */ - public function setSelfSigned($status = true) + public function setSelfSigned(bool $status = true): Client { $this->selfSigned = $status; @@ -163,7 +163,7 @@ public function setSelfSigned($status = true) * @param $endpoint * @return $this */ - public function setEndpoint($endpoint) + public function setEndpoint(string $endpoint): Client { $this->endpoint = $endpoint; @@ -174,7 +174,7 @@ public function setEndpoint($endpoint) * @param $key * @param $value */ - public function addHeader($key, $value) + public function addHeader(string $key, string $value): Client { $this->headers[strtolower($key)] = $value; @@ -193,7 +193,13 @@ public function addHeader($key, $value) * @return array|string * @throws AppwriteException */ - public function call($method, $path = '', $headers = array(), array $params = array(), ?string $responseType = null) + 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) : '')); @@ -264,14 +270,14 @@ public function call($method, $path = '', $headers = array(), array $params = ar } if (curl_errno($ch)) { - throw new AppwriteException(curl_error($ch), $responseStatus, $responseBody); + 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'] ?? '', $responseBody); + throw new AppwriteException($responseBody['message'], $responseStatus, $responseBody['type'] ?? '', json_encode($responseBody)); } else { throw new AppwriteException($responseBody, $responseStatus); } @@ -291,7 +297,7 @@ public function call($method, $path = '', $headers = array(), array $params = ar * @param string $prefix * @return array */ - protected function flatten(array $data, $prefix = '') { + protected function flatten(array $data, string $prefix = ''): array { $output = []; foreach($data as $key => $value) { 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..bb0fd1a 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 $GO123; 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 GO123(): Runtime + { + if (!isset(self::$GO123)) { + self::$GO123 = new Runtime('go-1.23'); + } + return self::$GO123; + } } \ No newline at end of file diff --git a/src/Appwrite/InputFile.php b/src/Appwrite/InputFile.php index 8693182..c8a0de7 100644 --- a/src/Appwrite/InputFile.php +++ b/src/Appwrite/InputFile.php @@ -29,7 +29,7 @@ public function getFilename(): ?string return $this->filename; } - public static function withPath(string $path, ?string $mimeType = null, ?string $filename = null) + public static function withPath(string $path, ?string $mimeType = null, ?string $filename = null): InputFile { $instance = new InputFile(); $instance->path = $path; @@ -39,7 +39,7 @@ public static function withPath(string $path, ?string $mimeType = null, ?string return $instance; } - public static function withData(string $data, ?string $mimeType = null, ?string $filename = null) + public static function withData(string $data, ?string $mimeType = null, ?string $filename = null): InputFile { $instance = new InputFile(); $instance->path = null; diff --git a/src/Appwrite/Permission.php b/src/Appwrite/Permission.php index ce91d2a..8c250e3 100644 --- a/src/Appwrite/Permission.php +++ b/src/Appwrite/Permission.php @@ -8,18 +8,22 @@ 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 index c8dc063..a27235a 100644 --- a/src/Appwrite/Query.php +++ b/src/Appwrite/Query.php @@ -23,10 +23,10 @@ public function __construct(string $method, ?string $attribute = null, $values = public function __toString(): string { - return json_encode($this->jsonSerialize()); + return json_encode($this); } - public function jsonSerialize() + public function jsonSerialize(): mixed { return array_filter([ 'method' => $this->method, @@ -42,7 +42,7 @@ public function jsonSerialize() * @param mixed $value * @return string */ - public static function equal(string $attribute, $value): string + public static function equal(string $attribute, mixed $value): string { return (new Query('equal', $attribute, $value))->__toString(); } @@ -54,7 +54,7 @@ public static function equal(string $attribute, $value): string * @param mixed $value * @return string */ - public static function notEqual(string $attribute, $value): string + public static function notEqual(string $attribute, mixed $value): string { return (new Query('notEqual', $attribute, $value))->__toString(); } @@ -66,7 +66,7 @@ public static function notEqual(string $attribute, $value): string * @param mixed $value * @return string */ - public static function lessThan(string $attribute, $value): string + public static function lessThan(string $attribute, mixed $value): string { return (new Query('lessThan', $attribute, $value))->__toString(); } @@ -78,7 +78,7 @@ public static function lessThan(string $attribute, $value): string * @param mixed $value * @return string */ - public static function lessThanEqual(string $attribute, $value): string + public static function lessThanEqual(string $attribute, mixed $value): string { return (new Query('lessThanEqual', $attribute, $value))->__toString(); } @@ -90,7 +90,7 @@ public static function lessThanEqual(string $attribute, $value): string * @param mixed $value * @return string */ - public static function greaterThan(string $attribute, $value): string + public static function greaterThan(string $attribute, mixed $value): string { return (new Query('greaterThan', $attribute, $value))->__toString(); } @@ -102,7 +102,7 @@ public static function greaterThan(string $attribute, $value): string * @param mixed $value * @return string */ - public static function greaterThanEqual(string $attribute, $value): string + public static function greaterThanEqual(string $attribute, mixed $value): string { return (new Query('greaterThanEqual', $attribute, $value))->__toString(); } @@ -149,7 +149,7 @@ public static function isNotNull(string $attribute): string * @param string|int|float $end * @return string */ - public static function between(string $attribute, $start, $end): string + public static function between(string $attribute, mixed $start, mixed $end): string { return (new Query('between', $attribute, [$start, $end]))->__toString(); } diff --git a/src/Appwrite/Service.php b/src/Appwrite/Service.php index ea3ad92..a9a89a1 100644 --- a/src/Appwrite/Service.php +++ b/src/Appwrite/Service.php @@ -4,14 +4,8 @@ abstract class Service { - /** - * @var Client - */ - protected $client; + protected Client $client; - /** - * @param Client $client - */ public function __construct(Client $client) { $this->client = $client; diff --git a/src/Appwrite/Services/Account.php b/src/Appwrite/Services/Account.php index 7a4f586..bbaec76 100644 --- a/src/Appwrite/Services/Account.php +++ b/src/Appwrite/Services/Account.php @@ -14,7 +14,7 @@ class Account extends Service { public function __construct(Client $client) { - $this->client = $client; + parent::__construct($client); } /** @@ -24,19 +24,24 @@ public function __construct(Client $client) * * @throws AppwriteException * @return array - */ public function get(): array { - $apiPath = str_replace([], [], '/account'); + $apiPath = str_replace( + [], + [], + '/account' + ); $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -55,43 +60,34 @@ public function get(): array * @param string $userId * @param string $email * @param string $password - * @param string $name + * @param ?string $name * @throws AppwriteException * @return array - */ - public function create(string $userId, string $email, string $password, string $name = null): array + public function create(string $userId, string $email, string $password, ?string $name = null): array { - $apiPath = str_replace([], [], '/account'); + $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; - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -112,31 +108,26 @@ public function create(string $userId, string $email, string $password, string $ * @param string $password * @throws AppwriteException * @return array - */ public function updateEmail(string $email, string $password): array { - $apiPath = str_replace([], [], '/account/email'); + $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; - } + $apiParams['email'] = $email; + $apiParams['password'] = $password; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_PATCH, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -146,25 +137,31 @@ public function updateEmail(string $email, string $password): array * * Get the list of identities for the currently logged in user. * - * @param array $queries + * @param ?array $queries * @throws AppwriteException * @return array - */ - public function listIdentities(array $queries = null): array + public function listIdentities(?array $queries = null): array { - $apiPath = str_replace([], [], '/account/identities'); + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -177,22 +174,25 @@ public function listIdentities(array $queries = null): array * @param string $identityId * @throws AppwriteException * @return string - */ public function deleteIdentity(string $identityId): string { - $apiPath = str_replace(['{identityId}'], [$identityId], '/account/identities/{identityId}'); + $apiPath = str_replace( + ['{identityId}'], + [$identityId], + '/account/identities/{identityId}' + ); $apiParams = []; - if (!isset($identityId)) { - throw new AppwriteException('Missing required parameter: "identityId"'); - } + $apiParams['identityId'] = $identityId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_DELETE, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -208,19 +208,24 @@ public function deleteIdentity(string $identityId): string * * @throws AppwriteException * @return array - */ public function createJWT(): array { - $apiPath = str_replace([], [], '/account/jwt'); + $apiPath = str_replace( + [], + [], + '/account/jwts' + ); $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_POST, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -231,25 +236,31 @@ public function createJWT(): array * 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 + * @param ?array $queries * @throws AppwriteException * @return array - */ - public function listLogs(array $queries = null): array + public function listLogs(?array $queries = null): array { - $apiPath = str_replace([], [], '/account/logs'); + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -262,31 +273,31 @@ public function listLogs(array $queries = null): array * @param bool $mfa * @throws AppwriteException * @return array - */ public function updateMFA(bool $mfa): array { - $apiPath = str_replace([], [], '/account/mfa'); + $apiPath = str_replace( + [], + [], + '/account/mfa' + ); $apiParams = []; - if (!isset($mfa)) { - throw new AppwriteException('Missing required parameter: "mfa"'); - } - if (!is_null($mfa)) { - $apiParams['mfa'] = $mfa; - } + $apiParams['mfa'] = $mfa; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_PATCH, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } /** - * Add Authenticator + * Create Authenticator * * Add an authenticator app to be used as an MFA factor. Verify the * authenticator using the [verify @@ -296,22 +307,25 @@ public function updateMFA(bool $mfa): array * @param AuthenticatorType $type * @throws AppwriteException * @return array - */ public function createMfaAuthenticator(AuthenticatorType $type): array { - $apiPath = str_replace(['{type}'], [$type], '/account/mfa/authenticators/{type}'); + $apiPath = str_replace( + ['{type}'], + [$type], + '/account/mfa/authenticators/{type}' + ); $apiParams = []; - if (!isset($type)) { - throw new AppwriteException('Missing required parameter: "type"'); - } + $apiParams['type'] = $type; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_POST, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -321,34 +335,32 @@ 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 * @throws AppwriteException * @return array - */ public function updateMfaAuthenticator(AuthenticatorType $type, string $otp): array { - $apiPath = str_replace(['{type}'], [$type], '/account/mfa/authenticators/{type}'); + $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; - } + $apiParams['type'] = $type; + $apiParams['otp'] = $otp; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_PUT, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -359,37 +371,33 @@ public function updateMfaAuthenticator(AuthenticatorType $type, string $otp): ar * 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 + public function deleteMfaAuthenticator(AuthenticatorType $type): string { - $apiPath = str_replace(['{type}'], [$type], '/account/mfa/authenticators/{type}'); + $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; - } + $apiParams['type'] = $type; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_DELETE, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } /** - * Create 2FA Challenge + * Create MFA Challenge * * Begin the process of MFA verification after sign-in. Finish the flow with * [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) @@ -398,25 +406,25 @@ public function deleteMfaAuthenticator(AuthenticatorType $type, string $otp): st * @param AuthenticationFactor $factor * @throws AppwriteException * @return array - */ public function createMfaChallenge(AuthenticationFactor $factor): array { - $apiPath = str_replace([], [], '/account/mfa/challenge'); + $apiPath = str_replace( + [], + [], + '/account/mfa/challenge' + ); $apiParams = []; - if (!isset($factor)) { - throw new AppwriteException('Missing required parameter: "factor"'); - } - if (!is_null($factor)) { - $apiParams['factor'] = $factor; - } + $apiParams['factor'] = $factor; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_POST, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -434,31 +442,26 @@ public function createMfaChallenge(AuthenticationFactor $factor): array * @param string $otp * @throws AppwriteException * @return string - */ public function updateMfaChallenge(string $challengeId, string $otp): string { - $apiPath = str_replace([], [], '/account/mfa/challenge'); + $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; - } + $apiParams['challengeId'] = $challengeId; + $apiParams['otp'] = $otp; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_PUT, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -470,19 +473,24 @@ public function updateMfaChallenge(string $challengeId, string $otp): string * * @throws AppwriteException * @return array - */ public function listMfaFactors(): array { - $apiPath = str_replace([], [], '/account/mfa/factors'); + $apiPath = str_replace( + [], + [], + '/account/mfa/factors' + ); $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -497,19 +505,24 @@ public function listMfaFactors(): array * * @throws AppwriteException * @return array - */ public function getMfaRecoveryCodes(): array { - $apiPath = str_replace([], [], '/account/mfa/recovery-codes'); + $apiPath = str_replace( + [], + [], + '/account/mfa/recovery-codes' + ); $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -525,19 +538,24 @@ public function getMfaRecoveryCodes(): array * * @throws AppwriteException * @return array - */ public function createMfaRecoveryCodes(): array { - $apiPath = str_replace([], [], '/account/mfa/recovery-codes'); + $apiPath = str_replace( + [], + [], + '/account/mfa/recovery-codes' + ); $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_POST, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -552,19 +570,24 @@ public function createMfaRecoveryCodes(): array * * @throws AppwriteException * @return array - */ public function updateMfaRecoveryCodes(): array { - $apiPath = str_replace([], [], '/account/mfa/recovery-codes'); + $apiPath = str_replace( + [], + [], + '/account/mfa/recovery-codes' + ); $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_PATCH, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -577,25 +600,25 @@ public function updateMfaRecoveryCodes(): array * @param string $name * @throws AppwriteException * @return array - */ public function updateName(string $name): array { - $apiPath = str_replace([], [], '/account/name'); + $apiPath = str_replace( + [], + [], + '/account/name' + ); $apiParams = []; - if (!isset($name)) { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (!is_null($name)) { - $apiParams['name'] = $name; - } + $apiParams['name'] = $name; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_PATCH, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -608,31 +631,32 @@ public function updateName(string $name): array * OAuth, Team Invites and Magic URL, oldPassword is optional. * * @param string $password - * @param string $oldPassword + * @param ?string $oldPassword * @throws AppwriteException * @return array - */ - public function updatePassword(string $password, string $oldPassword = null): array + public function updatePassword(string $password, ?string $oldPassword = null): array { - $apiPath = str_replace([], [], '/account/password'); + $apiPath = str_replace( + [], + [], + '/account/password' + ); $apiParams = []; - if (!isset($password)) { - throw new AppwriteException('Missing required parameter: "password"'); - } - if (!is_null($password)) { - $apiParams['password'] = $password; - } + $apiParams['password'] = $password; + if (!is_null($oldPassword)) { $apiParams['oldPassword'] = $oldPassword; } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_PATCH, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -650,31 +674,26 @@ public function updatePassword(string $password, string $oldPassword = null): ar * @param string $password * @throws AppwriteException * @return array - */ public function updatePhone(string $phone, string $password): array { - $apiPath = str_replace([], [], '/account/phone'); + $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; - } + $apiParams['phone'] = $phone; + $apiParams['password'] = $password; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_PATCH, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -686,19 +705,24 @@ public function updatePhone(string $phone, string $password): array * * @throws AppwriteException * @return array - */ public function getPrefs(): array { - $apiPath = str_replace([], [], '/account/prefs'); + $apiPath = str_replace( + [], + [], + '/account/prefs' + ); $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -713,25 +737,25 @@ public function getPrefs(): array * @param array $prefs * @throws AppwriteException * @return array - */ public function updatePrefs(array $prefs): array { - $apiPath = str_replace([], [], '/account/prefs'); + $apiPath = str_replace( + [], + [], + '/account/prefs' + ); $apiParams = []; - if (!isset($prefs)) { - throw new AppwriteException('Missing required parameter: "prefs"'); - } - if (!is_null($prefs)) { - $apiParams['prefs'] = $prefs; - } + $apiParams['prefs'] = $prefs; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_PATCH, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -752,31 +776,26 @@ public function updatePrefs(array $prefs): array * @param string $url * @throws AppwriteException * @return array - */ public function createRecovery(string $email, string $url): array { - $apiPath = str_replace([], [], '/account/recovery'); + $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; - } + $apiParams['email'] = $email; + $apiParams['url'] = $url; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_POST, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -800,37 +819,27 @@ public function createRecovery(string $email, string $url): array * @param string $password * @throws AppwriteException * @return array - */ public function updateRecovery(string $userId, string $secret, string $password): array { - $apiPath = str_replace([], [], '/account/recovery'); + $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; - } + $apiParams['userId'] = $userId; + $apiParams['secret'] = $secret; + $apiParams['password'] = $password; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_PUT, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -843,19 +852,24 @@ public function updateRecovery(string $userId, string $secret, string $password) * * @throws AppwriteException * @return array - */ public function listSessions(): array { - $apiPath = str_replace([], [], '/account/sessions'); + $apiPath = str_replace( + [], + [], + '/account/sessions' + ); $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -868,19 +882,24 @@ public function listSessions(): array * * @throws AppwriteException * @return string - */ public function deleteSessions(): string { - $apiPath = str_replace([], [], '/account/sessions'); + $apiPath = str_replace( + [], + [], + '/account/sessions' + ); $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_DELETE, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -898,19 +917,24 @@ public function deleteSessions(): string * * @throws AppwriteException * @return array - */ public function createAnonymousSession(): array { - $apiPath = str_replace([], [], '/account/sessions/anonymous'); + $apiPath = str_replace( + [], + [], + '/account/sessions/anonymous' + ); $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_POST, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -929,31 +953,26 @@ public function createAnonymousSession(): array * @param string $password * @throws AppwriteException * @return array - */ public function createEmailPasswordSession(string $email, string $password): array { - $apiPath = str_replace([], [], '/account/sessions/email'); + $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; - } + $apiParams['email'] = $email; + $apiParams['password'] = $password; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_POST, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -969,31 +988,26 @@ public function createEmailPasswordSession(string $email, string $password): arr * @param string $secret * @throws AppwriteException * @return array - */ public function updateMagicURLSession(string $userId, string $secret): array { - $apiPath = str_replace([], [], '/account/sessions/magic-url'); + $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; - } + $apiParams['userId'] = $userId; + $apiParams['secret'] = $secret; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_PUT, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1009,31 +1023,26 @@ public function updateMagicURLSession(string $userId, string $secret): array * @param string $secret * @throws AppwriteException * @return array - */ public function updatePhoneSession(string $userId, string $secret): array { - $apiPath = str_replace([], [], '/account/sessions/phone'); + $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; - } + $apiParams['userId'] = $userId; + $apiParams['secret'] = $secret; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_PUT, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1049,31 +1058,26 @@ public function updatePhoneSession(string $userId, string $secret): array * @param string $secret * @throws AppwriteException * @return array - */ public function createSession(string $userId, string $secret): array { - $apiPath = str_replace([], [], '/account/sessions/token'); + $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; - } + $apiParams['userId'] = $userId; + $apiParams['secret'] = $secret; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_POST, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1087,22 +1091,25 @@ public function createSession(string $userId, string $secret): array * @param string $sessionId * @throws AppwriteException * @return array - */ public function getSession(string $sessionId): array { - $apiPath = str_replace(['{sessionId}'], [$sessionId], '/account/sessions/{sessionId}'); + $apiPath = str_replace( + ['{sessionId}'], + [$sessionId], + '/account/sessions/{sessionId}' + ); $apiParams = []; - if (!isset($sessionId)) { - throw new AppwriteException('Missing required parameter: "sessionId"'); - } + $apiParams['sessionId'] = $sessionId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1117,22 +1124,25 @@ public function getSession(string $sessionId): array * @param string $sessionId * @throws AppwriteException * @return array - */ public function updateSession(string $sessionId): array { - $apiPath = str_replace(['{sessionId}'], [$sessionId], '/account/sessions/{sessionId}'); + $apiPath = str_replace( + ['{sessionId}'], + [$sessionId], + '/account/sessions/{sessionId}' + ); $apiParams = []; - if (!isset($sessionId)) { - throw new AppwriteException('Missing required parameter: "sessionId"'); - } + $apiParams['sessionId'] = $sessionId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_PATCH, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1149,22 +1159,25 @@ public function updateSession(string $sessionId): array * @param string $sessionId * @throws AppwriteException * @return string - */ public function deleteSession(string $sessionId): string { - $apiPath = str_replace(['{sessionId}'], [$sessionId], '/account/sessions/{sessionId}'); + $apiPath = str_replace( + ['{sessionId}'], + [$sessionId], + '/account/sessions/{sessionId}' + ); $apiParams = []; - if (!isset($sessionId)) { - throw new AppwriteException('Missing required parameter: "sessionId"'); - } + $apiParams['sessionId'] = $sessionId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_DELETE, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1178,19 +1191,24 @@ public function deleteSession(string $sessionId): string * * @throws AppwriteException * @return array - */ public function updateStatus(): array { - $apiPath = str_replace([], [], '/account/status'); + $apiPath = str_replace( + [], + [], + '/account/status' + ); $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_PATCH, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1211,37 +1229,33 @@ public function updateStatus(): array * * @param string $userId * @param string $email - * @param bool $phrase + * @param ?bool $phrase * @throws AppwriteException * @return array - */ - public function createEmailToken(string $userId, string $email, bool $phrase = null): array + public function createEmailToken(string $userId, string $email, ?bool $phrase = null): array { - $apiPath = str_replace([], [], '/account/tokens/email'); + $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; - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1268,41 +1282,38 @@ public function createEmailToken(string $userId, string $email, bool $phrase = n * * @param string $userId * @param string $email - * @param string $url - * @param bool $phrase + * @param ?string $url + * @param ?bool $phrase * @throws AppwriteException * @return array - */ - public function createMagicURLToken(string $userId, string $email, string $url = null, bool $phrase = null): array + public function createMagicURLToken(string $userId, string $email, ?string $url = null, ?bool $phrase = null): array { - $apiPath = str_replace([], [], '/account/tokens/magic-url'); + $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; - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1326,36 +1337,42 @@ public function createMagicURLToken(string $userId, string $email, string $url = * limits](https://appwrite.io/docs/authentication-security#limits). * * @param OAuthProvider $provider - * @param string $success - * @param string $failure - * @param array $scopes + * @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 + public function createOAuth2Token(OAuthProvider $provider, ?string $success = null, ?string $failure = null, ?array $scopes = null): string { - $apiPath = str_replace(['{provider}'], [$provider], '/account/tokens/oauth2/{provider}'); + $apiPath = str_replace( + ['{provider}'], + [$provider], + '/account/tokens/oauth2/{provider}' + ); $apiParams = []; - if (!isset($provider)) { - throw new AppwriteException('Missing required parameter: "provider"'); - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams, 'location' ); } @@ -1378,31 +1395,26 @@ public function createOAuth2Token(OAuthProvider $provider, string $success = nul * @param string $phone * @throws AppwriteException * @return array - */ public function createPhoneToken(string $userId, string $phone): array { - $apiPath = str_replace([], [], '/account/tokens/phone'); + $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; - } + $apiParams['userId'] = $userId; + $apiParams['phone'] = $phone; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_POST, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1429,25 +1441,25 @@ public function createPhoneToken(string $userId, string $phone): array * @param string $url * @throws AppwriteException * @return array - */ public function createVerification(string $url): array { - $apiPath = str_replace([], [], '/account/verification'); + $apiPath = str_replace( + [], + [], + '/account/verification' + ); $apiParams = []; - if (!isset($url)) { - throw new AppwriteException('Missing required parameter: "url"'); - } - if (!is_null($url)) { - $apiParams['url'] = $url; - } + $apiParams['url'] = $url; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_POST, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1464,31 +1476,26 @@ public function createVerification(string $url): array * @param string $secret * @throws AppwriteException * @return array - */ public function updateVerification(string $userId, string $secret): array { - $apiPath = str_replace([], [], '/account/verification'); + $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; - } + $apiParams['userId'] = $userId; + $apiParams['secret'] = $secret; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_PUT, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1507,25 +1514,30 @@ public function updateVerification(string $userId, string $secret): array * * @throws AppwriteException * @return array - */ public function createPhoneVerification(): array { - $apiPath = str_replace([], [], '/account/verification/phone'); + $apiPath = str_replace( + [], + [], + '/account/verification/phone' + ); $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_POST, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } /** - * Create phone verification (confirmation) + * 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 @@ -1536,32 +1548,27 @@ public function createPhoneVerification(): array * @param string $secret * @throws AppwriteException * @return array - */ public function updatePhoneVerification(string $userId, string $secret): array { - $apiPath = str_replace([], [], '/account/verification/phone'); + $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; - } + $apiParams['userId'] = $userId; + $apiParams['secret'] = $secret; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_PUT, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } -} +} \ No newline at end of file diff --git a/src/Appwrite/Services/Avatars.php b/src/Appwrite/Services/Avatars.php index 10b0ad3..73052e5 100644 --- a/src/Appwrite/Services/Avatars.php +++ b/src/Appwrite/Services/Avatars.php @@ -14,7 +14,7 @@ class Avatars extends Service { public function __construct(Client $client) { - $this->client = $client; + parent::__construct($client); } /** @@ -32,36 +32,42 @@ public function __construct(Client $client) * of image returned is 100x100px. * * @param Browser $code - * @param int $width - * @param int $height - * @param int $quality + * @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 + public function getBrowser(Browser $code, ?int $width = null, ?int $height = null, ?int $quality = null): string { - $apiPath = str_replace(['{code}'], [$code], '/avatars/browsers/{code}'); + $apiPath = str_replace( + ['{code}'], + [$code], + '/avatars/browsers/{code}' + ); $apiParams = []; - if (!isset($code)) { - throw new AppwriteException('Missing required parameter: "code"'); - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -80,36 +86,42 @@ public function getBrowser(Browser $code, int $width = null, int $height = null, * * * @param CreditCard $code - * @param int $width - * @param int $height - * @param int $quality + * @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 + public function getCreditCard(CreditCard $code, ?int $width = null, ?int $height = null, ?int $quality = null): string { - $apiPath = str_replace(['{code}'], [$code], '/avatars/credit-cards/{code}'); + $apiPath = str_replace( + ['{code}'], + [$code], + '/avatars/credit-cards/{code}' + ); $apiParams = []; - if (!isset($code)) { - throw new AppwriteException('Missing required parameter: "code"'); - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -120,29 +132,30 @@ public function getCreditCard(CreditCard $code, int $width = null, int $height = * 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'); + $apiPath = str_replace( + [], + [], + '/avatars/favicon' + ); $apiParams = []; - if (!isset($url)) { - throw new AppwriteException('Missing required parameter: "url"'); - } - if (!is_null($url)) { - $apiParams['url'] = $url; - } + $apiParams['url'] = $url; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -162,36 +175,42 @@ public function getFavicon(string $url): string * * * @param Flag $code - * @param int $width - * @param int $height - * @param int $quality + * @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 + public function getFlag(Flag $code, ?int $width = null, ?int $height = null, ?int $quality = null): string { - $apiPath = str_replace(['{code}'], [$code], '/avatars/flags/{code}'); + $apiPath = str_replace( + ['{code}'], + [$code], + '/avatars/flags/{code}' + ); $apiParams = []; - if (!isset($code)) { - throw new AppwriteException('Missing required parameter: "code"'); - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -209,37 +228,40 @@ public function getFlag(Flag $code, int $width = null, int $height = null, int $ * 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 + * @param ?int $width + * @param ?int $height * @throws AppwriteException * @return string - */ - public function getImage(string $url, int $width = null, int $height = null): string + public function getImage(string $url, ?int $width = null, ?int $height = null): string { - $apiPath = str_replace([], [], '/avatars/image'); + $apiPath = str_replace( + [], + [], + '/avatars/image' + ); $apiParams = []; - if (!isset($url)) { - throw new AppwriteException('Missing required parameter: "url"'); - } - if (!is_null($url)) { - $apiParams['url'] = $url; - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -264,37 +286,46 @@ public function getImage(string $url, int $width = null, int $height = null): st * of image returned is 100x100px. * * - * @param string $name - * @param int $width - * @param int $height - * @param string $background + * @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 + public function getInitials(?string $name = null, ?int $width = null, ?int $height = null, ?string $background = null): string { - $apiPath = str_replace([], [], '/avatars/initials'); + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -307,40 +338,43 @@ public function getInitials(string $name = null, int $width = null, int $height * * * @param string $text - * @param int $size - * @param int $margin - * @param bool $download + * @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 + public function getQR(string $text, ?int $size = null, ?int $margin = null, ?bool $download = null): string { - $apiPath = str_replace([], [], '/avatars/qr'); + $apiPath = str_replace( + [], + [], + '/avatars/qr' + ); $apiParams = []; - if (!isset($text)) { - throw new AppwriteException('Missing required parameter: "text"'); - } - if (!is_null($text)) { - $apiParams['text'] = $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; } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } -} +} \ No newline at end of file diff --git a/src/Appwrite/Services/Databases.php b/src/Appwrite/Services/Databases.php index 1975a33..6eb85cf 100644 --- a/src/Appwrite/Services/Databases.php +++ b/src/Appwrite/Services/Databases.php @@ -14,7 +14,7 @@ class Databases extends Service { public function __construct(Client $client) { - $this->client = $client; + parent::__construct($client); } /** @@ -23,29 +23,36 @@ public function __construct(Client $client) * 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 + * @param ?array $queries + * @param ?string $search * @throws AppwriteException * @return array - */ - public function list(array $queries = null, string $search = null): array + public function list(?array $queries = null, ?string $search = null): array { - $apiPath = str_replace([], [], '/databases'); + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -58,37 +65,33 @@ public function list(array $queries = null, string $search = null): array * * @param string $databaseId * @param string $name - * @param bool $enabled + * @param ?bool $enabled * @throws AppwriteException * @return array - */ - public function create(string $databaseId, string $name, bool $enabled = null): array + public function create(string $databaseId, string $name, ?bool $enabled = null): array { - $apiPath = str_replace([], [], '/databases'); + $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; - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -102,22 +105,25 @@ public function create(string $databaseId, string $name, bool $enabled = null): * @param string $databaseId * @throws AppwriteException * @return array - */ public function get(string $databaseId): array { - $apiPath = str_replace(['{databaseId}'], [$databaseId], '/databases/{databaseId}'); + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/databases/{databaseId}' + ); $apiParams = []; - if (!isset($databaseId)) { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } + $apiParams['databaseId'] = $databaseId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -129,34 +135,33 @@ public function get(string $databaseId): array * * @param string $databaseId * @param string $name - * @param bool $enabled + * @param ?bool $enabled * @throws AppwriteException * @return array - */ - public function update(string $databaseId, string $name, bool $enabled = null): array + public function update(string $databaseId, string $name, ?bool $enabled = null): array { - $apiPath = str_replace(['{databaseId}'], [$databaseId], '/databases/{databaseId}'); + $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; - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -170,22 +175,25 @@ public function update(string $databaseId, string $name, bool $enabled = null): * @param string $databaseId * @throws AppwriteException * @return string - */ public function delete(string $databaseId): string { - $apiPath = str_replace(['{databaseId}'], [$databaseId], '/databases/{databaseId}'); + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/databases/{databaseId}' + ); $apiParams = []; - if (!isset($databaseId)) { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } + $apiParams['databaseId'] = $databaseId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_DELETE, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -197,32 +205,37 @@ public function delete(string $databaseId): string * can use the search parameter to filter your results. * * @param string $databaseId - * @param array $queries - * @param string $search + * @param ?array $queries + * @param ?string $search * @throws AppwriteException * @return array - */ - public function listCollections(string $databaseId, array $queries = null, string $search = null): array + public function listCollections(string $databaseId, ?array $queries = null, ?string $search = null): array { - $apiPath = str_replace(['{databaseId}'], [$databaseId], '/databases/{databaseId}/collections'); + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/databases/{databaseId}/collections' + ); $apiParams = []; - if (!isset($databaseId)) { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -238,48 +251,44 @@ public function listCollections(string $databaseId, array $queries = null, strin * @param string $databaseId * @param string $collectionId * @param string $name - * @param array $permissions - * @param bool $documentSecurity - * @param bool $enabled + * @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 + 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'); + $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; - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -294,25 +303,26 @@ public function createCollection(string $databaseId, string $collectionId, strin * @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}'); + $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"'); - } + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -325,45 +335,44 @@ public function getCollection(string $databaseId, string $collectionId): array * @param string $databaseId * @param string $collectionId * @param string $name - * @param array $permissions - * @param bool $documentSecurity - * @param bool $enabled + * @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 + 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}'); + $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; - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -378,25 +387,26 @@ public function updateCollection(string $databaseId, string $collectionId, strin * @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}'); + $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"'); - } + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_DELETE, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -408,31 +418,33 @@ public function deleteCollection(string $databaseId, string $collectionId): stri * * @param string $databaseId * @param string $collectionId - * @param array $queries + * @param ?array $queries * @throws AppwriteException * @return array - */ - public function listAttributes(string $databaseId, string $collectionId, array $queries = null): array + public function listAttributes(string $databaseId, string $collectionId, ?array $queries = null): array { - $apiPath = str_replace(['{databaseId}', '{collectionId}'], [$databaseId, $collectionId], '/databases/{databaseId}/collections/{collectionId}/attributes'); + $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"'); - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -447,47 +459,40 @@ public function listAttributes(string $databaseId, string $collectionId, array $ * @param string $collectionId * @param string $key * @param bool $required - * @param bool $xdefault - * @param bool $xarray + * @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 + 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'); + $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; - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -502,40 +507,37 @@ public function createBooleanAttribute(string $databaseId, string $collectionId, * @param string $collectionId * @param string $key * @param bool $required - * @param bool $xdefault + * @param ?bool $xdefault + * @param ?string $newKey * @throws AppwriteException * @return array - */ - public function updateBooleanAttribute(string $databaseId, string $collectionId, string $key, bool $required, bool $xdefault): array + public function updateBooleanAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?bool $xdefault, ?string $newKey = null): array { - $apiPath = str_replace(['{databaseId}', '{collectionId}', '{key}'], [$databaseId, $collectionId, $key], '/databases/{databaseId}/collections/{collectionId}/attributes/boolean/{key}'); + $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; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + + if (!is_null($newKey)) { + $apiParams['newKey'] = $newKey; } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_PATCH, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -549,47 +551,40 @@ public function updateBooleanAttribute(string $databaseId, string $collectionId, * @param string $collectionId * @param string $key * @param bool $required - * @param string $xdefault - * @param bool $xarray + * @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 + 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'); + $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; - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -604,40 +599,37 @@ public function createDatetimeAttribute(string $databaseId, string $collectionId * @param string $collectionId * @param string $key * @param bool $required - * @param string $xdefault + * @param ?string $xdefault + * @param ?string $newKey * @throws AppwriteException * @return array - */ - public function updateDatetimeAttribute(string $databaseId, string $collectionId, string $key, bool $required, string $xdefault): array + public function updateDatetimeAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): array { - $apiPath = str_replace(['{databaseId}', '{collectionId}', '{key}'], [$databaseId, $collectionId, $key], '/databases/{databaseId}/collections/{collectionId}/attributes/datetime/{key}'); + $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; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + + if (!is_null($newKey)) { + $apiParams['newKey'] = $newKey; } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_PATCH, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -652,47 +644,40 @@ public function updateDatetimeAttribute(string $databaseId, string $collectionId * @param string $collectionId * @param string $key * @param bool $required - * @param string $xdefault - * @param bool $xarray + * @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 + 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'); + $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; - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -708,40 +693,37 @@ public function createEmailAttribute(string $databaseId, string $collectionId, s * @param string $collectionId * @param string $key * @param bool $required - * @param string $xdefault + * @param ?string $xdefault + * @param ?string $newKey * @throws AppwriteException * @return array - */ - public function updateEmailAttribute(string $databaseId, string $collectionId, string $key, bool $required, string $xdefault): array + public function updateEmailAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): array { - $apiPath = str_replace(['{databaseId}', '{collectionId}', '{key}'], [$databaseId, $collectionId, $key], '/databases/{databaseId}/collections/{collectionId}/attributes/email/{key}'); + $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; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + + if (!is_null($newKey)) { + $apiParams['newKey'] = $newKey; } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_PATCH, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -758,53 +740,41 @@ public function updateEmailAttribute(string $databaseId, string $collectionId, s * @param string $key * @param array $elements * @param bool $required - * @param string $xdefault - * @param bool $xarray + * @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 + 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'); + $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; - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -821,46 +791,38 @@ public function createEnumAttribute(string $databaseId, string $collectionId, st * @param string $key * @param array $elements * @param bool $required - * @param string $xdefault + * @param ?string $xdefault + * @param ?string $newKey * @throws AppwriteException * @return array - */ - public function updateEnumAttribute(string $databaseId, string $collectionId, string $key, array $elements, bool $required, string $xdefault): array + public function updateEnumAttribute(string $databaseId, string $collectionId, string $key, array $elements, bool $required, ?string $xdefault, ?string $newKey = null): array { - $apiPath = str_replace(['{databaseId}', '{collectionId}', '{key}'], [$databaseId, $collectionId, $key], '/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}'); + $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; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['elements'] = $elements; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + + if (!is_null($newKey)) { + $apiParams['newKey'] = $newKey; } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_PATCH, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -876,55 +838,50 @@ public function updateEnumAttribute(string $databaseId, string $collectionId, st * @param string $collectionId * @param string $key * @param bool $required - * @param float $min - * @param float $max - * @param float $xdefault - * @param bool $xarray + * @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 + 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'); + $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; - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -942,52 +899,39 @@ public function createFloatAttribute(string $databaseId, string $collectionId, s * @param bool $required * @param float $min * @param float $max - * @param float $xdefault + * @param ?float $xdefault + * @param ?string $newKey * @throws AppwriteException * @return array - */ - public function updateFloatAttribute(string $databaseId, string $collectionId, string $key, bool $required, float $min, float $max, float $xdefault): array + public function updateFloatAttribute(string $databaseId, string $collectionId, string $key, bool $required, float $min, float $max, ?float $xdefault, ?string $newKey = null): array { - $apiPath = str_replace(['{databaseId}', '{collectionId}', '{key}'], [$databaseId, $collectionId, $key], '/databases/{databaseId}/collections/{collectionId}/attributes/float/{key}'); + $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; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['min'] = $min; + $apiParams['max'] = $max; + $apiParams['default'] = $xdefault; + + if (!is_null($newKey)) { + $apiParams['newKey'] = $newKey; } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_PATCH, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1003,55 +947,50 @@ public function updateFloatAttribute(string $databaseId, string $collectionId, s * @param string $collectionId * @param string $key * @param bool $required - * @param int $min - * @param int $max - * @param int $xdefault - * @param bool $xarray + * @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 + 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'); + $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; - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1069,52 +1008,39 @@ public function createIntegerAttribute(string $databaseId, string $collectionId, * @param bool $required * @param int $min * @param int $max - * @param int $xdefault + * @param ?int $xdefault + * @param ?string $newKey * @throws AppwriteException * @return array - */ - public function updateIntegerAttribute(string $databaseId, string $collectionId, string $key, bool $required, int $min, int $max, int $xdefault): array + public function updateIntegerAttribute(string $databaseId, string $collectionId, string $key, bool $required, int $min, int $max, ?int $xdefault, ?string $newKey = null): array { - $apiPath = str_replace(['{databaseId}', '{collectionId}', '{key}'], [$databaseId, $collectionId, $key], '/databases/{databaseId}/collections/{collectionId}/attributes/integer/{key}'); + $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; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['min'] = $min; + $apiParams['max'] = $max; + $apiParams['default'] = $xdefault; + + if (!is_null($newKey)) { + $apiParams['newKey'] = $newKey; } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_PATCH, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1129,47 +1055,40 @@ public function updateIntegerAttribute(string $databaseId, string $collectionId, * @param string $collectionId * @param string $key * @param bool $required - * @param string $xdefault - * @param bool $xarray + * @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 + 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'); + $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; - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1185,40 +1104,37 @@ public function createIpAttribute(string $databaseId, string $collectionId, stri * @param string $collectionId * @param string $key * @param bool $required - * @param string $xdefault + * @param ?string $xdefault + * @param ?string $newKey * @throws AppwriteException * @return array - */ - public function updateIpAttribute(string $databaseId, string $collectionId, string $key, bool $required, string $xdefault): array + public function updateIpAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): array { - $apiPath = str_replace(['{databaseId}', '{collectionId}', '{key}'], [$databaseId, $collectionId, $key], '/databases/{databaseId}/collections/{collectionId}/attributes/ip/{key}'); + $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; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + + if (!is_null($newKey)) { + $apiParams['newKey'] = $newKey; } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_PATCH, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1234,55 +1150,50 @@ public function updateIpAttribute(string $databaseId, string $collectionId, stri * @param string $collectionId * @param string $relatedCollectionId * @param RelationshipType $type - * @param bool $twoWay - * @param string $key - * @param string $twoWayKey - * @param RelationMutate $onDelete + * @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 + 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'); + $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; - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1298,57 +1209,46 @@ public function createRelationshipAttribute(string $databaseId, string $collecti * @param string $key * @param int $size * @param bool $required - * @param string $xdefault - * @param bool $xarray - * @param bool $encrypt + * @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 + 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'); + $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; - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1364,40 +1264,42 @@ public function createStringAttribute(string $databaseId, string $collectionId, * @param string $collectionId * @param string $key * @param bool $required - * @param string $xdefault + * @param ?string $xdefault + * @param ?int $size + * @param ?string $newKey * @throws AppwriteException * @return array - */ - public function updateStringAttribute(string $databaseId, string $collectionId, string $key, bool $required, string $xdefault): array + public function updateStringAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault, ?int $size = null, ?string $newKey = null): array { - $apiPath = str_replace(['{databaseId}', '{collectionId}', '{key}'], [$databaseId, $collectionId, $key], '/databases/{databaseId}/collections/{collectionId}/attributes/string/{key}'); + $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; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + + if (!is_null($size)) { + $apiParams['size'] = $size; } - if (!is_null($xdefault)) { - $apiParams['default'] = $xdefault; + + if (!is_null($newKey)) { + $apiParams['newKey'] = $newKey; } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_PATCH, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1412,47 +1314,40 @@ public function updateStringAttribute(string $databaseId, string $collectionId, * @param string $collectionId * @param string $key * @param bool $required - * @param string $xdefault - * @param bool $xarray + * @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 + 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'); + $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; - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1468,40 +1363,37 @@ public function createUrlAttribute(string $databaseId, string $collectionId, str * @param string $collectionId * @param string $key * @param bool $required - * @param string $xdefault + * @param ?string $xdefault + * @param ?string $newKey * @throws AppwriteException * @return array - */ - public function updateUrlAttribute(string $databaseId, string $collectionId, string $key, bool $required, string $xdefault): array + public function updateUrlAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): array { - $apiPath = str_replace(['{databaseId}', '{collectionId}', '{key}'], [$databaseId, $collectionId, $key], '/databases/{databaseId}/collections/{collectionId}/attributes/url/{key}'); + $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; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + + if (!is_null($newKey)) { + $apiParams['newKey'] = $newKey; } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_PATCH, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1516,28 +1408,27 @@ public function updateUrlAttribute(string $databaseId, string $collectionId, str * @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}'); + $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"'); - } + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1552,28 +1443,27 @@ public function getAttribute(string $databaseId, string $collectionId, string $k * @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}'); + $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"'); - } + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_DELETE, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1588,34 +1478,39 @@ public function deleteAttribute(string $databaseId, string $collectionId, string * @param string $databaseId * @param string $collectionId * @param string $key - * @param RelationMutate $onDelete + * @param ?RelationMutate $onDelete + * @param ?string $newKey * @throws AppwriteException * @return array - */ - public function updateRelationshipAttribute(string $databaseId, string $collectionId, string $key, RelationMutate $onDelete = null): array + public function updateRelationshipAttribute(string $databaseId, string $collectionId, string $key, ?RelationMutate $onDelete = null, ?string $newKey = null): array { - $apiPath = str_replace(['{databaseId}', '{collectionId}', '{key}'], [$databaseId, $collectionId, $key], '/databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship'); + $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"'); - } + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + if (!is_null($onDelete)) { $apiParams['onDelete'] = $onDelete; } + + if (!is_null($newKey)) { + $apiParams['newKey'] = $newKey; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_PATCH, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1628,31 +1523,33 @@ public function updateRelationshipAttribute(string $databaseId, string $collecti * * @param string $databaseId * @param string $collectionId - * @param array $queries + * @param ?array $queries * @throws AppwriteException * @return array - */ - public function listDocuments(string $databaseId, string $collectionId, array $queries = null): array + public function listDocuments(string $databaseId, string $collectionId, ?array $queries = null): array { - $apiPath = str_replace(['{databaseId}', '{collectionId}'], [$databaseId, $collectionId], '/databases/{databaseId}/collections/{collectionId}/documents'); + $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"'); - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1669,43 +1566,35 @@ public function listDocuments(string $databaseId, string $collectionId, array $q * @param string $collectionId * @param string $documentId * @param array $data - * @param array $permissions + * @param ?array $permissions * @throws AppwriteException * @return array - */ - public function createDocument(string $databaseId, string $collectionId, string $documentId, array $data, array $permissions = null): 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'); + $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; - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1719,34 +1608,34 @@ public function createDocument(string $databaseId, string $collectionId, string * @param string $databaseId * @param string $collectionId * @param string $documentId - * @param array $queries + * @param ?array $queries * @throws AppwriteException * @return array - */ - public function getDocument(string $databaseId, string $collectionId, string $documentId, array $queries = null): 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}'); + $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"'); - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1760,38 +1649,39 @@ public function getDocument(string $databaseId, string $collectionId, string $do * @param string $databaseId * @param string $collectionId * @param string $documentId - * @param array $data - * @param array $permissions + * @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 + 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}'); + $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"'); - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1806,28 +1696,27 @@ public function updateDocument(string $databaseId, string $collectionId, string * @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}'); + $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"'); - } + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['documentId'] = $documentId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_DELETE, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1839,31 +1728,33 @@ public function deleteDocument(string $databaseId, string $collectionId, string * * @param string $databaseId * @param string $collectionId - * @param array $queries + * @param ?array $queries * @throws AppwriteException * @return array - */ - public function listIndexes(string $databaseId, string $collectionId, array $queries = null): array + public function listIndexes(string $databaseId, string $collectionId, ?array $queries = null): array { - $apiPath = str_replace(['{databaseId}', '{collectionId}'], [$databaseId, $collectionId], '/databases/{databaseId}/collections/{collectionId}/indexes'); + $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"'); - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1880,49 +1771,36 @@ public function listIndexes(string $databaseId, string $collectionId, array $que * @param string $key * @param IndexType $type * @param array $attributes - * @param array $orders + * @param ?array $orders * @throws AppwriteException * @return array - */ - public function createIndex(string $databaseId, string $collectionId, string $key, IndexType $type, array $attributes, array $orders = null): 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'); + $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; - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1937,28 +1815,27 @@ public function createIndex(string $databaseId, string $collectionId, string $ke * @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}'); + $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"'); - } + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1973,29 +1850,28 @@ public function getIndex(string $databaseId, string $collectionId, string $key): * @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}'); + $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"'); - } + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_DELETE, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } -} +} \ No newline at end of file diff --git a/src/Appwrite/Services/Functions.php b/src/Appwrite/Services/Functions.php index d9bb024..2e1d60f 100644 --- a/src/Appwrite/Services/Functions.php +++ b/src/Appwrite/Services/Functions.php @@ -13,7 +13,7 @@ class Functions extends Service { public function __construct(Client $client) { - $this->client = $client; + parent::__construct($client); } /** @@ -22,29 +22,36 @@ public function __construct(Client $client) * 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 + * @param ?array $queries + * @param ?string $search * @throws AppwriteException * @return array - */ - public function list(array $queries = null, string $search = null): array + public function list(?array $queries = null, ?string $search = null): array { - $apiPath = str_replace([], [], '/functions'); + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -60,107 +67,124 @@ public function list(array $queries = null, string $search = null): array * @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 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 + * @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 + * @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, 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 $templateVersion = null, ?string $specification = null): array { - $apiPath = str_replace([], [], '/functions'); + $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; - } + $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($templateBranch)) { - $apiParams['templateBranch'] = $templateBranch; + + if (!is_null($templateVersion)) { + $apiParams['templateVersion'] = $templateVersion; + } + + if (!is_null($specification)) { + $apiParams['specification'] = $specification; } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_POST, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -172,19 +196,54 @@ public function create(string $functionId, string $name, Runtime $runtime, array * * @throws AppwriteException * @return array - */ public function listRuntimes(): array { - $apiPath = str_replace([], [], '/functions/runtimes'); + $apiPath = str_replace( + [], + [], + '/functions/runtimes' + ); + + $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * 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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -197,22 +256,25 @@ public function listRuntimes(): array * @param string $functionId * @throws AppwriteException * @return array - */ public function get(string $functionId): array { - $apiPath = str_replace(['{functionId}'], [$functionId], '/functions/{functionId}'); + $apiPath = str_replace( + ['{functionId}'], + [$functionId], + '/functions/{functionId}' + ); $apiParams = []; - if (!isset($functionId)) { - throw new AppwriteException('Missing required parameter: "functionId"'); - } + $apiParams['functionId'] = $functionId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -224,86 +286,105 @@ public function get(string $functionId): array * * @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 string $installationId - * @param string $providerRepositoryId - * @param string $providerBranch - * @param bool $providerSilentMode - * @param string $providerRootDirectory + * @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 $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, 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}'], [$functionId], '/functions/{functionId}'); + $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; - } + $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; } - if (!is_null($providerRepositoryId)) { - $apiParams['providerRepositoryId'] = $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($specification)) { + $apiParams['specification'] = $specification; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_PUT, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -316,22 +397,25 @@ public function update(string $functionId, string $name, Runtime $runtime = null * @param string $functionId * @throws AppwriteException * @return string - */ public function delete(string $functionId): string { - $apiPath = str_replace(['{functionId}'], [$functionId], '/functions/{functionId}'); + $apiPath = str_replace( + ['{functionId}'], + [$functionId], + '/functions/{functionId}' + ); $apiParams = []; - if (!isset($functionId)) { - throw new AppwriteException('Missing required parameter: "functionId"'); - } + $apiParams['functionId'] = $functionId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_DELETE, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -343,32 +427,37 @@ public function delete(string $functionId): string * params to filter your results. * * @param string $functionId - * @param array $queries - * @param string $search + * @param ?array $queries + * @param ?string $search * @throws AppwriteException * @return array - */ - public function listDeployments(string $functionId, array $queries = null, string $search = null): array + public function listDeployments(string $functionId, ?array $queries = null, ?string $search = null): array { - $apiPath = str_replace(['{functionId}'], [$functionId], '/functions/{functionId}/deployments'); + $apiPath = str_replace( + ['{functionId}'], + [$functionId], + '/functions/{functionId}/deployments' + ); $apiParams = []; - if (!isset($functionId)) { - throw new AppwriteException('Missing required parameter: "functionId"'); - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -390,38 +479,34 @@ public function listDeployments(string $functionId, array $queries = null, strin * @param string $functionId * @param InputFile $code * @param bool $activate - * @param string $entrypoint - * @param string $commands + * @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 + 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'); + $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"'); - } + $apiParams['functionId'] = $functionId; + $apiParams['code'] = $code; + $apiParams['activate'] = $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; - } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'multipart/form-data'; $size = 0; $mimeType = null; $postedName = null; @@ -505,31 +590,32 @@ public function createDeployment(string $functionId, InputFile $code, bool $acti * @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}'); + $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"'); - } + $apiParams['functionId'] = $functionId; + $apiParams['deploymentId'] = $deploymentId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } /** - * Update function deployment + * 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 @@ -539,25 +625,26 @@ public function getDeployment(string $functionId, string $deploymentId): array * @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}'); + $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"'); - } + $apiParams['functionId'] = $functionId; + $apiParams['deploymentId'] = $deploymentId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_PATCH, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -571,68 +658,99 @@ public function updateDeployment(string $functionId, string $deploymentId): arra * @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}'); + $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"'); - } + $apiParams['functionId'] = $functionId; + $apiParams['deploymentId'] = $deploymentId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_DELETE, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } /** - * 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 - * @param string $buildId + * @param ?string $buildId * @throws AppwriteException * @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)) { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (!isset($deploymentId)) { - throw new AppwriteException('Missing required parameter: "deploymentId"'); - } - if (!isset($buildId)) { - throw new AppwriteException('Missing required parameter: "buildId"'); + $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, - [ - 'content-type' => 'application/json', - ], + $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 + * Download deployment * * Get a Deployment's contents by its unique ID. This endpoint supports range * requests for partial or streaming file download. @@ -641,25 +759,26 @@ public function createBuild(string $functionId, string $deploymentId, string $bu * @param string $deploymentId * @throws AppwriteException * @return string - */ - public function downloadDeployment(string $functionId, string $deploymentId): string + public function getDeploymentDownload(string $functionId, string $deploymentId): string { - $apiPath = str_replace(['{functionId}', '{deploymentId}'], [$functionId, $deploymentId], '/functions/{functionId}/deployments/{deploymentId}/download'); + $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"'); - } + $apiParams['functionId'] = $functionId; + $apiParams['deploymentId'] = $deploymentId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -671,32 +790,37 @@ public function downloadDeployment(string $functionId, string $deploymentId): st * query params to filter your results. * * @param string $functionId - * @param array $queries - * @param string $search + * @param ?array $queries + * @param ?string $search * @throws AppwriteException * @return array - */ - public function listExecutions(string $functionId, array $queries = null, string $search = null): array + public function listExecutions(string $functionId, ?array $queries = null, ?string $search = null): array { - $apiPath = str_replace(['{functionId}'], [$functionId], '/functions/{functionId}/executions'); + $apiPath = str_replace( + ['{functionId}'], + [$functionId], + '/functions/{functionId}/executions' + ); $apiParams = []; - if (!isset($functionId)) { - throw new AppwriteException('Missing required parameter: "functionId"'); - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -710,44 +834,57 @@ public function listExecutions(string $functionId, array $queries = null, string * 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 $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): 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'); + $apiPath = str_replace( + ['{functionId}'], + [$functionId], + '/functions/{functionId}/executions' + ); $apiParams = []; - if (!isset($functionId)) { - throw new AppwriteException('Missing required parameter: "functionId"'); - } + $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'] = 'application/json'; + return $this->client->call( Client::METHOD_POST, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -761,25 +898,60 @@ public function createExecution(string $functionId, string $body = null, bool $a * @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}'); + $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"'); - } + $apiParams['functionId'] = $functionId; + $apiParams['executionId'] = $executionId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $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 ); } @@ -792,22 +964,25 @@ public function getExecution(string $functionId, string $executionId): array * @param string $functionId * @throws AppwriteException * @return array - */ public function listVariables(string $functionId): array { - $apiPath = str_replace(['{functionId}'], [$functionId], '/functions/{functionId}/variables'); + $apiPath = str_replace( + ['{functionId}'], + [$functionId], + '/functions/{functionId}/variables' + ); $apiParams = []; - if (!isset($functionId)) { - throw new AppwriteException('Missing required parameter: "functionId"'); - } + $apiParams['functionId'] = $functionId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -823,34 +998,27 @@ public function listVariables(string $functionId): array * @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'); + $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; - } + $apiParams['functionId'] = $functionId; + $apiParams['key'] = $key; + $apiParams['value'] = $value; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_POST, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -864,25 +1032,26 @@ public function createVariable(string $functionId, string $key, string $value): * @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}'); + $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"'); - } + $apiParams['functionId'] = $functionId; + $apiParams['variableId'] = $variableId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -895,37 +1064,34 @@ public function getVariable(string $functionId, string $variableId): array * @param string $functionId * @param string $variableId * @param string $key - * @param string $value + * @param ?string $value * @throws AppwriteException * @return array - */ - public function updateVariable(string $functionId, string $variableId, string $key, string $value = null): 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}'); + $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; - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -939,26 +1105,27 @@ public function updateVariable(string $functionId, string $variableId, string $k * @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}'); + $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"'); - } + $apiParams['functionId'] = $functionId; + $apiParams['variableId'] = $variableId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_DELETE, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } -} +} \ No newline at end of file diff --git a/src/Appwrite/Services/Graphql.php b/src/Appwrite/Services/Graphql.php index 5dfdc0d..fcb161c 100644 --- a/src/Appwrite/Services/Graphql.php +++ b/src/Appwrite/Services/Graphql.php @@ -11,7 +11,7 @@ class Graphql extends Service { public function __construct(Client $client) { - $this->client = $client; + parent::__construct($client); } /** @@ -22,26 +22,26 @@ public function __construct(Client $client) * @param array $query * @throws AppwriteException * @return array - */ public function query(array $query): array { - $apiPath = str_replace([], [], '/graphql'); + $apiPath = str_replace( + [], + [], + '/graphql' + ); $apiParams = []; - if (!isset($query)) { - throw new AppwriteException('Missing required parameter: "query"'); - } - if (!is_null($query)) { - $apiParams['query'] = $query; - } + $apiParams['query'] = $query; + + $apiHeaders = []; + $apiHeaders['x-sdk-graphql'] = 'true'; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_POST, $apiPath, - [ - 'x-sdk-graphql' => 'true', - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -54,27 +54,27 @@ public function query(array $query): array * @param array $query * @throws AppwriteException * @return array - */ public function mutation(array $query): array { - $apiPath = str_replace([], [], '/graphql/mutation'); + $apiPath = str_replace( + [], + [], + '/graphql/mutation' + ); $apiParams = []; - if (!isset($query)) { - throw new AppwriteException('Missing required parameter: "query"'); - } - if (!is_null($query)) { - $apiParams['query'] = $query; - } + $apiParams['query'] = $query; + + $apiHeaders = []; + $apiHeaders['x-sdk-graphql'] = 'true'; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_POST, $apiPath, - [ - 'x-sdk-graphql' => 'true', - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } -} +} \ No newline at end of file diff --git a/src/Appwrite/Services/Health.php b/src/Appwrite/Services/Health.php index 79d3c5b..7ac5942 100644 --- a/src/Appwrite/Services/Health.php +++ b/src/Appwrite/Services/Health.php @@ -12,7 +12,7 @@ class Health extends Service { public function __construct(Client $client) { - $this->client = $client; + parent::__construct($client); } /** @@ -22,19 +22,24 @@ public function __construct(Client $client) * * @throws AppwriteException * @return array - */ public function get(): array { - $apiPath = str_replace([], [], '/health'); + $apiPath = str_replace( + [], + [], + '/health' + ); $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -46,19 +51,24 @@ public function get(): array * * @throws AppwriteException * @return array - */ public function getAntivirus(): array { - $apiPath = str_replace([], [], '/health/anti-virus'); + $apiPath = str_replace( + [], + [], + '/health/anti-virus' + ); $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -71,19 +81,24 @@ public function getAntivirus(): array * * @throws AppwriteException * @return array - */ public function getCache(): array { - $apiPath = str_replace([], [], '/health/cache'); + $apiPath = str_replace( + [], + [], + '/health/cache' + ); $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -93,25 +108,31 @@ public function getCache(): array * * Get the SSL certificate for a domain * - * @param string $domain + * @param ?string $domain * @throws AppwriteException * @return array - */ - public function getCertificate(string $domain = null): array + public function getCertificate(?string $domain = null): array { - $apiPath = str_replace([], [], '/health/certificate'); + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -123,19 +144,24 @@ public function getCertificate(string $domain = null): array * * @throws AppwriteException * @return array - */ public function getDB(): array { - $apiPath = str_replace([], [], '/health/db'); + $apiPath = str_replace( + [], + [], + '/health/db' + ); $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -147,19 +173,24 @@ public function getDB(): array * * @throws AppwriteException * @return array - */ public function getPubSub(): array { - $apiPath = str_replace([], [], '/health/pubsub'); + $apiPath = str_replace( + [], + [], + '/health/pubsub' + ); $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -172,19 +203,24 @@ public function getPubSub(): array * * @throws AppwriteException * @return array - */ public function getQueue(): array { - $apiPath = str_replace([], [], '/health/queue'); + $apiPath = str_replace( + [], + [], + '/health/queue' + ); $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -195,25 +231,31 @@ public function getQueue(): array * Get the number of builds that are waiting to be processed in the Appwrite * internal queue server. * - * @param int $threshold + * @param ?int $threshold * @throws AppwriteException * @return array - */ - public function getQueueBuilds(int $threshold = null): array + public function getQueueBuilds(?int $threshold = null): array { - $apiPath = str_replace([], [], '/health/queue/builds'); + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -225,25 +267,31 @@ public function getQueueBuilds(int $threshold = null): array * [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue * server. * - * @param int $threshold + * @param ?int $threshold * @throws AppwriteException * @return array - */ - public function getQueueCertificates(int $threshold = null): array + public function getQueueCertificates(?int $threshold = null): array { - $apiPath = str_replace([], [], '/health/queue/certificates'); + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -254,29 +302,36 @@ public function getQueueCertificates(int $threshold = null): array * Get the number of database changes that are waiting to be processed in the * Appwrite internal queue server. * - * @param string $name - * @param int $threshold + * @param ?string $name + * @param ?int $threshold * @throws AppwriteException * @return array - */ - public function getQueueDatabases(string $name = null, int $threshold = null): array + public function getQueueDatabases(?string $name = null, ?int $threshold = null): array { - $apiPath = str_replace([], [], '/health/queue/databases'); + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -287,25 +342,31 @@ public function getQueueDatabases(string $name = null, int $threshold = null): a * Get the number of background destructive changes that are waiting to be * processed in the Appwrite internal queue server. * - * @param int $threshold + * @param ?int $threshold * @throws AppwriteException * @return array - */ - public function getQueueDeletes(int $threshold = null): array + public function getQueueDeletes(?int $threshold = null): array { - $apiPath = str_replace([], [], '/health/queue/deletes'); + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -317,28 +378,32 @@ public function getQueueDeletes(int $threshold = null): array * * * @param Name $name - * @param int $threshold + * @param ?int $threshold * @throws AppwriteException * @return array - */ - public function getFailedJobs(Name $name, int $threshold = null): array + public function getFailedJobs(Name $name, ?int $threshold = null): array { - $apiPath = str_replace(['{name}'], [$name], '/health/queue/failed/{name}'); + $apiPath = str_replace( + ['{name}'], + [$name], + '/health/queue/failed/{name}' + ); $apiParams = []; - if (!isset($name)) { - throw new AppwriteException('Missing required parameter: "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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -349,25 +414,31 @@ public function getFailedJobs(Name $name, int $threshold = null): array * Get the number of function executions that are waiting to be processed in * the Appwrite internal queue server. * - * @param int $threshold + * @param ?int $threshold * @throws AppwriteException * @return array - */ - public function getQueueFunctions(int $threshold = null): array + public function getQueueFunctions(?int $threshold = null): array { - $apiPath = str_replace([], [], '/health/queue/functions'); + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -378,25 +449,31 @@ public function getQueueFunctions(int $threshold = null): array * Get the number of logs that are waiting to be processed in the Appwrite * internal queue server. * - * @param int $threshold + * @param ?int $threshold * @throws AppwriteException * @return array - */ - public function getQueueLogs(int $threshold = null): array + public function getQueueLogs(?int $threshold = null): array { - $apiPath = str_replace([], [], '/health/queue/logs'); + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -407,25 +484,31 @@ public function getQueueLogs(int $threshold = null): array * Get the number of mails that are waiting to be processed in the Appwrite * internal queue server. * - * @param int $threshold + * @param ?int $threshold * @throws AppwriteException * @return array - */ - public function getQueueMails(int $threshold = null): array + public function getQueueMails(?int $threshold = null): array { - $apiPath = str_replace([], [], '/health/queue/mails'); + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -436,25 +519,31 @@ public function getQueueMails(int $threshold = null): array * Get the number of messages that are waiting to be processed in the Appwrite * internal queue server. * - * @param int $threshold + * @param ?int $threshold * @throws AppwriteException * @return array - */ - public function getQueueMessaging(int $threshold = null): array + public function getQueueMessaging(?int $threshold = null): array { - $apiPath = str_replace([], [], '/health/queue/messaging'); + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -465,25 +554,31 @@ public function getQueueMessaging(int $threshold = null): array * Get the number of migrations that are waiting to be processed in the * Appwrite internal queue server. * - * @param int $threshold + * @param ?int $threshold * @throws AppwriteException * @return array - */ - public function getQueueMigrations(int $threshold = null): array + public function getQueueMigrations(?int $threshold = null): array { - $apiPath = str_replace([], [], '/health/queue/migrations'); + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -494,25 +589,31 @@ public function getQueueMigrations(int $threshold = null): array * Get the number of metrics that are waiting to be processed in the Appwrite * internal queue server. * - * @param int $threshold + * @param ?int $threshold * @throws AppwriteException * @return array - */ - public function getQueueUsage(int $threshold = null): array + public function getQueueUsage(?int $threshold = null): array { - $apiPath = str_replace([], [], '/health/queue/usage'); + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -523,25 +624,31 @@ public function getQueueUsage(int $threshold = null): array * Get the number of projects containing metrics that are waiting to be * processed in the Appwrite internal queue server. * - * @param int $threshold + * @param ?int $threshold * @throws AppwriteException * @return array - */ - public function getQueueUsageDump(int $threshold = null): array + public function getQueueUsageDump(?int $threshold = null): array { - $apiPath = str_replace([], [], '/health/queue/usage-dump'); + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -552,25 +659,31 @@ public function getQueueUsageDump(int $threshold = null): array * Get the number of webhooks that are waiting to be processed in the Appwrite * internal queue server. * - * @param int $threshold + * @param ?int $threshold * @throws AppwriteException * @return array - */ - public function getQueueWebhooks(int $threshold = null): array + public function getQueueWebhooks(?int $threshold = null): array { - $apiPath = str_replace([], [], '/health/queue/webhooks'); + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -582,19 +695,24 @@ public function getQueueWebhooks(int $threshold = null): array * * @throws AppwriteException * @return array - */ public function getStorage(): array { - $apiPath = str_replace([], [], '/health/storage'); + $apiPath = str_replace( + [], + [], + '/health/storage' + ); $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -606,19 +724,24 @@ public function getStorage(): array * * @throws AppwriteException * @return array - */ public function getStorageLocal(): array { - $apiPath = str_replace([], [], '/health/storage/local'); + $apiPath = str_replace( + [], + [], + '/health/storage/local' + ); $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -636,20 +759,25 @@ public function getStorageLocal(): array * * @throws AppwriteException * @return array - */ public function getTime(): array { - $apiPath = str_replace([], [], '/health/time'); + $apiPath = str_replace( + [], + [], + '/health/time' + ); $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } -} +} \ No newline at end of file diff --git a/src/Appwrite/Services/Locale.php b/src/Appwrite/Services/Locale.php index 0cb7ae7..6ea96d1 100644 --- a/src/Appwrite/Services/Locale.php +++ b/src/Appwrite/Services/Locale.php @@ -11,7 +11,7 @@ class Locale extends Service { public function __construct(Client $client) { - $this->client = $client; + parent::__construct($client); } /** @@ -26,19 +26,24 @@ public function __construct(Client $client) * * @throws AppwriteException * @return array - */ public function get(): array { - $apiPath = str_replace([], [], '/locale'); + $apiPath = str_replace( + [], + [], + '/locale' + ); $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -51,19 +56,24 @@ public function get(): array * * @throws AppwriteException * @return array - */ public function listCodes(): array { - $apiPath = str_replace([], [], '/locale/codes'); + $apiPath = str_replace( + [], + [], + '/locale/codes' + ); $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -76,19 +86,24 @@ public function listCodes(): array * * @throws AppwriteException * @return array - */ public function listContinents(): array { - $apiPath = str_replace([], [], '/locale/continents'); + $apiPath = str_replace( + [], + [], + '/locale/continents' + ); $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -101,19 +116,24 @@ public function listContinents(): array * * @throws AppwriteException * @return array - */ public function listCountries(): array { - $apiPath = str_replace([], [], '/locale/countries'); + $apiPath = str_replace( + [], + [], + '/locale/countries' + ); $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -126,19 +146,24 @@ public function listCountries(): array * * @throws AppwriteException * @return array - */ public function listCountriesEU(): array { - $apiPath = str_replace([], [], '/locale/countries/eu'); + $apiPath = str_replace( + [], + [], + '/locale/countries/eu' + ); $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -151,19 +176,24 @@ public function listCountriesEU(): array * * @throws AppwriteException * @return array - */ public function listCountriesPhones(): array { - $apiPath = str_replace([], [], '/locale/countries/phones'); + $apiPath = str_replace( + [], + [], + '/locale/countries/phones' + ); $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -177,19 +207,24 @@ public function listCountriesPhones(): array * * @throws AppwriteException * @return array - */ public function listCurrencies(): array { - $apiPath = str_replace([], [], '/locale/currencies'); + $apiPath = str_replace( + [], + [], + '/locale/currencies' + ); $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -202,20 +237,25 @@ public function listCurrencies(): array * * @throws AppwriteException * @return array - */ public function listLanguages(): array { - $apiPath = str_replace([], [], '/locale/languages'); + $apiPath = str_replace( + [], + [], + '/locale/languages' + ); $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } -} +} \ No newline at end of file diff --git a/src/Appwrite/Services/Messaging.php b/src/Appwrite/Services/Messaging.php index 5dbcece..dc3b41b 100644 --- a/src/Appwrite/Services/Messaging.php +++ b/src/Appwrite/Services/Messaging.php @@ -12,7 +12,7 @@ class Messaging extends Service { public function __construct(Client $client) { - $this->client = $client; + parent::__construct($client); } /** @@ -20,29 +20,36 @@ public function __construct(Client $client) * * Get a list of all messages from the current Appwrite project. * - * @param array $queries - * @param string $search + * @param ?array $queries + * @param ?string $search * @throws AppwriteException * @return array - */ - public function listMessages(array $queries = null, string $search = null): array + public function listMessages(?array $queries = null, ?string $search = null): array { - $apiPath = str_replace([], [], '/messaging/messages'); + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -55,75 +62,74 @@ public function listMessages(array $queries = null, string $search = null): arra * @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 + * @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 + 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'); + $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; - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -135,68 +141,82 @@ public function createEmail(string $messageId, string $subject, string $content, * * * @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 + * @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 + 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}'); + $apiPath = str_replace( + ['{messageId}'], + [$messageId], + '/messaging/messages/email/{messageId}' + ); $apiParams = []; - if (!isset($messageId)) { - throw new AppwriteException('Missing required parameter: "messageId"'); - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -209,91 +229,94 @@ public function updateEmail(string $messageId, array $topics = null, array $user * @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 + * @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 + 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'); + $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; - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -305,84 +328,102 @@ public function createPush(string $messageId, string $title, string $body, array * * * @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 + * @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 + 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}'); + $apiPath = str_replace( + ['{messageId}'], + [$messageId], + '/messaging/messages/push/{messageId}' + ); $apiParams = []; - if (!isset($messageId)) { - throw new AppwriteException('Missing required parameter: "messageId"'); - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -394,53 +435,53 @@ public function updatePush(string $messageId, array $topics = null, array $users * * @param string $messageId * @param string $content - * @param array $topics - * @param array $users - * @param array $targets - * @param bool $draft - * @param string $scheduledAt + * @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 + 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'); + $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; - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -452,48 +493,57 @@ public function createSms(string $messageId, string $content, array $topics = nu * * * @param string $messageId - * @param array $topics - * @param array $users - * @param array $targets - * @param string $content - * @param bool $draft - * @param string $scheduledAt + * @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 + 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}'); + $apiPath = str_replace( + ['{messageId}'], + [$messageId], + '/messaging/messages/sms/{messageId}' + ); $apiParams = []; - if (!isset($messageId)) { - throw new AppwriteException('Missing required parameter: "messageId"'); - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -507,22 +557,25 @@ public function updateSms(string $messageId, array $topics = null, array $users * @param string $messageId * @throws AppwriteException * @return array - */ public function getMessage(string $messageId): array { - $apiPath = str_replace(['{messageId}'], [$messageId], '/messaging/messages/{messageId}'); + $apiPath = str_replace( + ['{messageId}'], + [$messageId], + '/messaging/messages/{messageId}' + ); $apiParams = []; - if (!isset($messageId)) { - throw new AppwriteException('Missing required parameter: "messageId"'); - } + $apiParams['messageId'] = $messageId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -536,22 +589,25 @@ public function getMessage(string $messageId): array * @param string $messageId * @throws AppwriteException * @return string - */ public function delete(string $messageId): string { - $apiPath = str_replace(['{messageId}'], [$messageId], '/messaging/messages/{messageId}'); + $apiPath = str_replace( + ['{messageId}'], + [$messageId], + '/messaging/messages/{messageId}' + ); $apiParams = []; - if (!isset($messageId)) { - throw new AppwriteException('Missing required parameter: "messageId"'); - } + $apiParams['messageId'] = $messageId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_DELETE, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -562,28 +618,32 @@ public function delete(string $messageId): string * Get the message activity logs listed by its unique ID. * * @param string $messageId - * @param array $queries + * @param ?array $queries * @throws AppwriteException * @return array - */ - public function listMessageLogs(string $messageId, array $queries = null): array + public function listMessageLogs(string $messageId, ?array $queries = null): array { - $apiPath = str_replace(['{messageId}'], [$messageId], '/messaging/messages/{messageId}/logs'); + $apiPath = str_replace( + ['{messageId}'], + [$messageId], + '/messaging/messages/{messageId}/logs' + ); $apiParams = []; - if (!isset($messageId)) { - throw new AppwriteException('Missing required parameter: "messageId"'); - } + $apiParams['messageId'] = $messageId; + if (!is_null($queries)) { $apiParams['queries'] = $queries; } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -594,28 +654,32 @@ public function listMessageLogs(string $messageId, array $queries = null): array * Get a list of the targets associated with a message. * * @param string $messageId - * @param array $queries + * @param ?array $queries * @throws AppwriteException * @return array - */ - public function listTargets(string $messageId, array $queries = null): array + public function listTargets(string $messageId, ?array $queries = null): array { - $apiPath = str_replace(['{messageId}'], [$messageId], '/messaging/messages/{messageId}/targets'); + $apiPath = str_replace( + ['{messageId}'], + [$messageId], + '/messaging/messages/{messageId}/targets' + ); $apiParams = []; - if (!isset($messageId)) { - throw new AppwriteException('Missing required parameter: "messageId"'); - } + $apiParams['messageId'] = $messageId; + if (!is_null($queries)) { $apiParams['queries'] = $queries; } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -625,29 +689,36 @@ public function listTargets(string $messageId, array $queries = null): array * * Get a list of all providers from the current Appwrite project. * - * @param array $queries - * @param string $search + * @param ?array $queries + * @param ?string $search * @throws AppwriteException * @return array - */ - public function listProviders(array $queries = null, string $search = null): array + public function listProviders(?array $queries = null, ?string $search = null): array { - $apiPath = str_replace([], [], '/messaging/providers'); + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -659,57 +730,58 @@ public function listProviders(array $queries = null, string $search = null): arr * * @param string $providerId * @param string $name - * @param string $authKey - * @param string $authKeyId - * @param string $teamId - * @param string $bundleId - * @param bool $sandbox - * @param bool $enabled + * @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 + 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'); + $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; - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -720,52 +792,62 @@ public function createApnsProvider(string $providerId, string $name, string $aut * 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 + * @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 + 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}'); + $apiPath = str_replace( + ['{providerId}'], + [$providerId], + '/messaging/providers/apns/{providerId}' + ); $apiParams = []; - if (!isset($providerId)) { - throw new AppwriteException('Missing required parameter: "providerId"'); - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -777,41 +859,38 @@ public function updateApnsProvider(string $providerId, string $name = null, bool * * @param string $providerId * @param string $name - * @param array $serviceAccountJSON - * @param bool $enabled + * @param ?array $serviceAccountJSON + * @param ?bool $enabled * @throws AppwriteException * @return array - */ - public function createFcmProvider(string $providerId, string $name, array $serviceAccountJSON = null, bool $enabled = null): array + public function createFcmProvider(string $providerId, string $name, ?array $serviceAccountJSON = null, ?bool $enabled = null): array { - $apiPath = str_replace([], [], '/messaging/providers/fcm'); + $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; - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -822,36 +901,42 @@ public function createFcmProvider(string $providerId, string $name, array $servi * Update a Firebase Cloud Messaging provider by its unique ID. * * @param string $providerId - * @param string $name - * @param bool $enabled - * @param array $serviceAccountJSON + * @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 + public function updateFcmProvider(string $providerId, ?string $name = null, ?bool $enabled = null, ?array $serviceAccountJSON = null): array { - $apiPath = str_replace(['{providerId}'], [$providerId], '/messaging/providers/fcm/{providerId}'); + $apiPath = str_replace( + ['{providerId}'], + [$providerId], + '/messaging/providers/fcm/{providerId}' + ); $apiParams = []; - if (!isset($providerId)) { - throw new AppwriteException('Missing required parameter: "providerId"'); - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -863,65 +948,68 @@ public function updateFcmProvider(string $providerId, string $name = null, bool * * @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 + * @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 + 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'); + $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; - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -932,60 +1020,72 @@ public function createMailgunProvider(string $providerId, string $name, string $ * 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 + * @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 + 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}'); + $apiPath = str_replace( + ['{providerId}'], + [$providerId], + '/messaging/providers/mailgun/{providerId}' + ); $apiParams = []; - if (!isset($providerId)) { - throw new AppwriteException('Missing required parameter: "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($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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -997,49 +1097,48 @@ public function updateMailgunProvider(string $providerId, string $name = null, s * * @param string $providerId * @param string $name - * @param string $templateId - * @param string $senderId - * @param string $authKey - * @param bool $enabled + * @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 + 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'); + $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; - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1050,44 +1149,52 @@ public function createMsg91Provider(string $providerId, string $name, string $te * 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 + * @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 + 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}'); + $apiPath = str_replace( + ['{providerId}'], + [$providerId], + '/messaging/providers/msg91/{providerId}' + ); $apiParams = []; - if (!isset($providerId)) { - throw new AppwriteException('Missing required parameter: "providerId"'); - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1099,57 +1206,58 @@ public function updateMsg91Provider(string $providerId, string $name = null, boo * * @param string $providerId * @param string $name - * @param string $apiKey - * @param string $fromName - * @param string $fromEmail - * @param string $replyToName - * @param string $replyToEmail - * @param bool $enabled + * @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 + 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'); + $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; - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1160,52 +1268,62 @@ public function createSendgridProvider(string $providerId, string $name, string * 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 + * @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 + 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}'); + $apiPath = str_replace( + ['{providerId}'], + [$providerId], + '/messaging/providers/sendgrid/{providerId}' + ); $apiParams = []; - if (!isset($providerId)) { - throw new AppwriteException('Missing required parameter: "providerId"'); - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1218,83 +1336,84 @@ public function updateSendgridProvider(string $providerId, string $name = null, * @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 + * @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 + 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'); + $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; - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1305,76 +1424,92 @@ public function createSmtpProvider(string $providerId, string $name, string $hos * 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 + * @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 + 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}'); + $apiPath = str_replace( + ['{providerId}'], + [$providerId], + '/messaging/providers/smtp/{providerId}' + ); $apiParams = []; - if (!isset($providerId)) { - throw new AppwriteException('Missing required parameter: "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; } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_PATCH, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1386,49 +1521,48 @@ public function updateSmtpProvider(string $providerId, string $name = null, stri * * @param string $providerId * @param string $name - * @param string $from - * @param string $customerId - * @param string $apiKey - * @param bool $enabled + * @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 + 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'); + $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; - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1439,44 +1573,52 @@ public function createTelesignProvider(string $providerId, string $name, string * 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 + * @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 + 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}'); + $apiPath = str_replace( + ['{providerId}'], + [$providerId], + '/messaging/providers/telesign/{providerId}' + ); $apiParams = []; - if (!isset($providerId)) { - throw new AppwriteException('Missing required parameter: "providerId"'); - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1488,49 +1630,48 @@ public function updateTelesignProvider(string $providerId, string $name = null, * * @param string $providerId * @param string $name - * @param string $from - * @param string $username - * @param string $apiKey - * @param bool $enabled + * @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 + 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'); + $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; - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1541,44 +1682,52 @@ public function createTextmagicProvider(string $providerId, string $name, string * 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 + * @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 + 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}'); + $apiPath = str_replace( + ['{providerId}'], + [$providerId], + '/messaging/providers/textmagic/{providerId}' + ); $apiParams = []; - if (!isset($providerId)) { - throw new AppwriteException('Missing required parameter: "providerId"'); - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1590,49 +1739,48 @@ public function updateTextmagicProvider(string $providerId, string $name = null, * * @param string $providerId * @param string $name - * @param string $from - * @param string $accountSid - * @param string $authToken - * @param bool $enabled + * @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 + 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'); + $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; - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1643,44 +1791,52 @@ public function createTwilioProvider(string $providerId, string $name, string $f * 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 + * @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 + 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}'); + $apiPath = str_replace( + ['{providerId}'], + [$providerId], + '/messaging/providers/twilio/{providerId}' + ); $apiParams = []; - if (!isset($providerId)) { - throw new AppwriteException('Missing required parameter: "providerId"'); - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1692,49 +1848,48 @@ public function updateTwilioProvider(string $providerId, string $name = null, bo * * @param string $providerId * @param string $name - * @param string $from - * @param string $apiKey - * @param string $apiSecret - * @param bool $enabled + * @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 + 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'); + $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; - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1745,44 +1900,52 @@ public function createVonageProvider(string $providerId, string $name, string $f * 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 + * @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 + 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}'); + $apiPath = str_replace( + ['{providerId}'], + [$providerId], + '/messaging/providers/vonage/{providerId}' + ); $apiParams = []; - if (!isset($providerId)) { - throw new AppwriteException('Missing required parameter: "providerId"'); - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1796,22 +1959,25 @@ public function updateVonageProvider(string $providerId, string $name = null, bo * @param string $providerId * @throws AppwriteException * @return array - */ public function getProvider(string $providerId): array { - $apiPath = str_replace(['{providerId}'], [$providerId], '/messaging/providers/{providerId}'); + $apiPath = str_replace( + ['{providerId}'], + [$providerId], + '/messaging/providers/{providerId}' + ); $apiParams = []; - if (!isset($providerId)) { - throw new AppwriteException('Missing required parameter: "providerId"'); - } + $apiParams['providerId'] = $providerId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1824,22 +1990,25 @@ public function getProvider(string $providerId): array * @param string $providerId * @throws AppwriteException * @return string - */ public function deleteProvider(string $providerId): string { - $apiPath = str_replace(['{providerId}'], [$providerId], '/messaging/providers/{providerId}'); + $apiPath = str_replace( + ['{providerId}'], + [$providerId], + '/messaging/providers/{providerId}' + ); $apiParams = []; - if (!isset($providerId)) { - throw new AppwriteException('Missing required parameter: "providerId"'); - } + $apiParams['providerId'] = $providerId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_DELETE, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1850,28 +2019,32 @@ public function deleteProvider(string $providerId): string * Get the provider activity logs listed by its unique ID. * * @param string $providerId - * @param array $queries + * @param ?array $queries * @throws AppwriteException * @return array - */ - public function listProviderLogs(string $providerId, array $queries = null): array + public function listProviderLogs(string $providerId, ?array $queries = null): array { - $apiPath = str_replace(['{providerId}'], [$providerId], '/messaging/providers/{providerId}/logs'); + $apiPath = str_replace( + ['{providerId}'], + [$providerId], + '/messaging/providers/{providerId}/logs' + ); $apiParams = []; - if (!isset($providerId)) { - throw new AppwriteException('Missing required parameter: "providerId"'); - } + $apiParams['providerId'] = $providerId; + if (!is_null($queries)) { $apiParams['queries'] = $queries; } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1882,28 +2055,32 @@ public function listProviderLogs(string $providerId, array $queries = null): arr * Get the subscriber activity logs listed by its unique ID. * * @param string $subscriberId - * @param array $queries + * @param ?array $queries * @throws AppwriteException * @return array - */ - public function listSubscriberLogs(string $subscriberId, array $queries = null): array + public function listSubscriberLogs(string $subscriberId, ?array $queries = null): array { - $apiPath = str_replace(['{subscriberId}'], [$subscriberId], '/messaging/subscribers/{subscriberId}/logs'); + $apiPath = str_replace( + ['{subscriberId}'], + [$subscriberId], + '/messaging/subscribers/{subscriberId}/logs' + ); $apiParams = []; - if (!isset($subscriberId)) { - throw new AppwriteException('Missing required parameter: "subscriberId"'); - } + $apiParams['subscriberId'] = $subscriberId; + if (!is_null($queries)) { $apiParams['queries'] = $queries; } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1913,29 +2090,36 @@ public function listSubscriberLogs(string $subscriberId, array $queries = null): * * Get a list of all topics from the current Appwrite project. * - * @param array $queries - * @param string $search + * @param ?array $queries + * @param ?string $search * @throws AppwriteException * @return array - */ - public function listTopics(array $queries = null, string $search = null): array + public function listTopics(?array $queries = null, ?string $search = null): array { - $apiPath = str_replace([], [], '/messaging/topics'); + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1947,37 +2131,33 @@ public function listTopics(array $queries = null, string $search = null): array * * @param string $topicId * @param string $name - * @param array $subscribe + * @param ?array $subscribe * @throws AppwriteException * @return array - */ - public function createTopic(string $topicId, string $name, array $subscribe = null): array + public function createTopic(string $topicId, string $name, ?array $subscribe = null): array { - $apiPath = str_replace([], [], '/messaging/topics'); + $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; - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1991,22 +2171,25 @@ public function createTopic(string $topicId, string $name, array $subscribe = nu * @param string $topicId * @throws AppwriteException * @return array - */ public function getTopic(string $topicId): array { - $apiPath = str_replace(['{topicId}'], [$topicId], '/messaging/topics/{topicId}'); + $apiPath = str_replace( + ['{topicId}'], + [$topicId], + '/messaging/topics/{topicId}' + ); $apiParams = []; - if (!isset($topicId)) { - throw new AppwriteException('Missing required parameter: "topicId"'); - } + $apiParams['topicId'] = $topicId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -2018,32 +2201,37 @@ public function getTopic(string $topicId): array * * * @param string $topicId - * @param string $name - * @param array $subscribe + * @param ?string $name + * @param ?array $subscribe * @throws AppwriteException * @return array - */ - public function updateTopic(string $topicId, string $name = null, array $subscribe = null): array + public function updateTopic(string $topicId, ?string $name = null, ?array $subscribe = null): array { - $apiPath = str_replace(['{topicId}'], [$topicId], '/messaging/topics/{topicId}'); + $apiPath = str_replace( + ['{topicId}'], + [$topicId], + '/messaging/topics/{topicId}' + ); $apiParams = []; - if (!isset($topicId)) { - throw new AppwriteException('Missing required parameter: "topicId"'); - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -2056,22 +2244,25 @@ public function updateTopic(string $topicId, string $name = null, array $subscri * @param string $topicId * @throws AppwriteException * @return string - */ public function deleteTopic(string $topicId): string { - $apiPath = str_replace(['{topicId}'], [$topicId], '/messaging/topics/{topicId}'); + $apiPath = str_replace( + ['{topicId}'], + [$topicId], + '/messaging/topics/{topicId}' + ); $apiParams = []; - if (!isset($topicId)) { - throw new AppwriteException('Missing required parameter: "topicId"'); - } + $apiParams['topicId'] = $topicId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_DELETE, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -2082,28 +2273,32 @@ public function deleteTopic(string $topicId): string * Get the topic activity logs listed by its unique ID. * * @param string $topicId - * @param array $queries + * @param ?array $queries * @throws AppwriteException * @return array - */ - public function listTopicLogs(string $topicId, array $queries = null): array + public function listTopicLogs(string $topicId, ?array $queries = null): array { - $apiPath = str_replace(['{topicId}'], [$topicId], '/messaging/topics/{topicId}/logs'); + $apiPath = str_replace( + ['{topicId}'], + [$topicId], + '/messaging/topics/{topicId}/logs' + ); $apiParams = []; - if (!isset($topicId)) { - throw new AppwriteException('Missing required parameter: "topicId"'); - } + $apiParams['topicId'] = $topicId; + if (!is_null($queries)) { $apiParams['queries'] = $queries; } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -2114,32 +2309,37 @@ public function listTopicLogs(string $topicId, array $queries = null): array * Get a list of all subscribers from the current Appwrite project. * * @param string $topicId - * @param array $queries - * @param string $search + * @param ?array $queries + * @param ?string $search * @throws AppwriteException * @return array - */ - public function listSubscribers(string $topicId, array $queries = null, string $search = null): array + public function listSubscribers(string $topicId, ?array $queries = null, ?string $search = null): array { - $apiPath = str_replace(['{topicId}'], [$topicId], '/messaging/topics/{topicId}/subscribers'); + $apiPath = str_replace( + ['{topicId}'], + [$topicId], + '/messaging/topics/{topicId}/subscribers' + ); $apiParams = []; - if (!isset($topicId)) { - throw new AppwriteException('Missing required parameter: "topicId"'); - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -2154,34 +2354,27 @@ public function listSubscribers(string $topicId, array $queries = null, string $ * @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'); + $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; - } + $apiParams['topicId'] = $topicId; + $apiParams['subscriberId'] = $subscriberId; + $apiParams['targetId'] = $targetId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_POST, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -2196,25 +2389,26 @@ public function createSubscriber(string $topicId, string $subscriberId, string $ * @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}'); + $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"'); - } + $apiParams['topicId'] = $topicId; + $apiParams['subscriberId'] = $subscriberId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -2228,26 +2422,27 @@ public function getSubscriber(string $topicId, string $subscriberId): array * @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}'); + $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"'); - } + $apiParams['topicId'] = $topicId; + $apiParams['subscriberId'] = $subscriberId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_DELETE, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } -} +} \ No newline at end of file diff --git a/src/Appwrite/Services/Storage.php b/src/Appwrite/Services/Storage.php index 00c90f3..fd2ebf9 100644 --- a/src/Appwrite/Services/Storage.php +++ b/src/Appwrite/Services/Storage.php @@ -14,7 +14,7 @@ class Storage extends Service { public function __construct(Client $client) { - $this->client = $client; + parent::__construct($client); } /** @@ -23,29 +23,36 @@ public function __construct(Client $client) * Get a list of all the storage buckets. You can use the query params to * filter your results. * - * @param array $queries - * @param string $search + * @param ?array $queries + * @param ?string $search * @throws AppwriteException * @return array - */ - public function listBuckets(array $queries = null, string $search = null): array + public function listBuckets(?array $queries = null, ?string $search = null): array { - $apiPath = str_replace([], [], '/storage/buckets'); + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -57,65 +64,68 @@ public function listBuckets(array $queries = null, string $search = null): array * * @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 + * @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 + 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'); + $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; - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -129,22 +139,25 @@ public function createBucket(string $bucketId, string $name, array $permissions * @param string $bucketId * @throws AppwriteException * @return array - */ public function getBucket(string $bucketId): array { - $apiPath = str_replace(['{bucketId}'], [$bucketId], '/storage/buckets/{bucketId}'); + $apiPath = str_replace( + ['{bucketId}'], + [$bucketId], + '/storage/buckets/{bucketId}' + ); $apiParams = []; - if (!isset($bucketId)) { - throw new AppwriteException('Missing required parameter: "bucketId"'); - } + $apiParams['bucketId'] = $bucketId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -156,62 +169,68 @@ public function getBucket(string $bucketId): array * * @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 + * @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 + 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}'); + $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; - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -224,22 +243,25 @@ public function updateBucket(string $bucketId, string $name, array $permissions * @param string $bucketId * @throws AppwriteException * @return string - */ public function deleteBucket(string $bucketId): string { - $apiPath = str_replace(['{bucketId}'], [$bucketId], '/storage/buckets/{bucketId}'); + $apiPath = str_replace( + ['{bucketId}'], + [$bucketId], + '/storage/buckets/{bucketId}' + ); $apiParams = []; - if (!isset($bucketId)) { - throw new AppwriteException('Missing required parameter: "bucketId"'); - } + $apiParams['bucketId'] = $bucketId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_DELETE, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -251,32 +273,37 @@ public function deleteBucket(string $bucketId): string * your results. * * @param string $bucketId - * @param array $queries - * @param string $search + * @param ?array $queries + * @param ?string $search * @throws AppwriteException * @return array - */ - public function listFiles(string $bucketId, array $queries = null, string $search = null): array + public function listFiles(string $bucketId, ?array $queries = null, ?string $search = null): array { - $apiPath = str_replace(['{bucketId}'], [$bucketId], '/storage/buckets/{bucketId}/files'); + $apiPath = str_replace( + ['{bucketId}'], + [$bucketId], + '/storage/buckets/{bucketId}/files' + ); $apiParams = []; - if (!isset($bucketId)) { - throw new AppwriteException('Missing required parameter: "bucketId"'); - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -306,34 +333,29 @@ public function listFiles(string $bucketId, array $queries = null, string $searc * @param string $bucketId * @param string $fileId * @param InputFile $file - * @param array $permissions + * @param ?array $permissions * @throws AppwriteException * @return array - */ - public function createFile(string $bucketId, string $fileId, InputFile $file, array $permissions = null, callable $onProgress = null): 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'); + $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; - } + $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; @@ -425,25 +447,26 @@ public function createFile(string $bucketId, string $fileId, InputFile $file, ar * @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}'); + $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"'); - } + $apiParams['bucketId'] = $bucketId; + $apiParams['fileId'] = $fileId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -456,35 +479,38 @@ public function getFile(string $bucketId, string $fileId): array * * @param string $bucketId * @param string $fileId - * @param string $name - * @param array $permissions + * @param ?string $name + * @param ?array $permissions * @throws AppwriteException * @return array - */ - public function updateFile(string $bucketId, string $fileId, string $name = null, array $permissions = null): 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}'); + $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"'); - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -499,25 +525,26 @@ public function updateFile(string $bucketId, string $fileId, string $name = null * @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}'); + $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"'); - } + $apiParams['bucketId'] = $bucketId; + $apiParams['fileId'] = $fileId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_DELETE, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -533,25 +560,26 @@ public function deleteFile(string $bucketId, string $fileId): string * @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'); + $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"'); - } + $apiParams['bucketId'] = $bucketId; + $apiParams['fileId'] = $fileId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -567,71 +595,83 @@ public function getFileDownload(string $bucketId, string $fileId): string * * @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 + * @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 + 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'); + $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"'); - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -647,26 +687,27 @@ public function getFilePreview(string $bucketId, string $fileId, int $width = nu * @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'); + $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"'); - } + $apiParams['bucketId'] = $bucketId; + $apiParams['fileId'] = $fileId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } -} +} \ No newline at end of file diff --git a/src/Appwrite/Services/Teams.php b/src/Appwrite/Services/Teams.php index 8614621..53c35b1 100644 --- a/src/Appwrite/Services/Teams.php +++ b/src/Appwrite/Services/Teams.php @@ -11,7 +11,7 @@ class Teams extends Service { public function __construct(Client $client) { - $this->client = $client; + parent::__construct($client); } /** @@ -20,29 +20,36 @@ public function __construct(Client $client) * 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 + * @param ?array $queries + * @param ?string $search * @throws AppwriteException * @return array - */ - public function list(array $queries = null, string $search = null): array + public function list(?array $queries = null, ?string $search = null): array { - $apiPath = str_replace([], [], '/teams'); + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -56,37 +63,33 @@ public function list(array $queries = null, string $search = null): array * * @param string $teamId * @param string $name - * @param array $roles + * @param ?array $roles * @throws AppwriteException * @return array - */ - public function create(string $teamId, string $name, array $roles = null): array + public function create(string $teamId, string $name, ?array $roles = null): array { - $apiPath = str_replace([], [], '/teams'); + $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; - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -99,22 +102,25 @@ public function create(string $teamId, string $name, array $roles = null): array * @param string $teamId * @throws AppwriteException * @return array - */ public function get(string $teamId): array { - $apiPath = str_replace(['{teamId}'], [$teamId], '/teams/{teamId}'); + $apiPath = str_replace( + ['{teamId}'], + [$teamId], + '/teams/{teamId}' + ); $apiParams = []; - if (!isset($teamId)) { - throw new AppwriteException('Missing required parameter: "teamId"'); - } + $apiParams['teamId'] = $teamId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -128,28 +134,26 @@ public function get(string $teamId): array * @param string $name * @throws AppwriteException * @return array - */ public function updateName(string $teamId, string $name): array { - $apiPath = str_replace(['{teamId}'], [$teamId], '/teams/{teamId}'); + $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; - } + $apiParams['teamId'] = $teamId; + $apiParams['name'] = $name; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_PUT, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -163,22 +167,25 @@ public function updateName(string $teamId, string $name): array * @param string $teamId * @throws AppwriteException * @return string - */ public function delete(string $teamId): string { - $apiPath = str_replace(['{teamId}'], [$teamId], '/teams/{teamId}'); + $apiPath = str_replace( + ['{teamId}'], + [$teamId], + '/teams/{teamId}' + ); $apiParams = []; - if (!isset($teamId)) { - throw new AppwriteException('Missing required parameter: "teamId"'); - } + $apiParams['teamId'] = $teamId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_DELETE, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -190,32 +197,37 @@ public function delete(string $teamId): string * members have read access to this endpoint. * * @param string $teamId - * @param array $queries - * @param string $search + * @param ?array $queries + * @param ?string $search * @throws AppwriteException * @return array - */ - public function listMemberships(string $teamId, array $queries = null, string $search = null): array + public function listMemberships(string $teamId, ?array $queries = null, ?string $search = null): array { - $apiPath = str_replace(['{teamId}'], [$teamId], '/teams/{teamId}/memberships'); + $apiPath = str_replace( + ['{teamId}'], + [$teamId], + '/teams/{teamId}/memberships' + ); $apiParams = []; - if (!isset($teamId)) { - throw new AppwriteException('Missing required parameter: "teamId"'); - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -247,50 +259,53 @@ public function listMemberships(string $teamId, array $queries = null, string $s * * @param string $teamId * @param array $roles - * @param string $email - * @param string $userId - * @param string $phone - * @param string $url - * @param string $name + * @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 + 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'); + $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"'); - } + $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($roles)) { - $apiParams['roles'] = $roles; - } + 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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -305,25 +320,26 @@ public function createMembership(string $teamId, array $roles, string $email = n * @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}'); + $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"'); - } + $apiParams['teamId'] = $teamId; + $apiParams['membershipId'] = $membershipId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -341,31 +357,27 @@ public function getMembership(string $teamId, string $membershipId): array * @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}'); + $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; - } + $apiParams['teamId'] = $teamId; + $apiParams['membershipId'] = $membershipId; + $apiParams['roles'] = $roles; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_PATCH, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -381,25 +393,26 @@ public function updateMembership(string $teamId, string $membershipId, array $ro * @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}'); + $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"'); - } + $apiParams['teamId'] = $teamId; + $apiParams['membershipId'] = $membershipId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_DELETE, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -421,37 +434,28 @@ public function deleteMembership(string $teamId, string $membershipId): string * @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'); + $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; - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -466,22 +470,25 @@ public function updateMembershipStatus(string $teamId, string $membershipId, str * @param string $teamId * @throws AppwriteException * @return array - */ public function getPrefs(string $teamId): array { - $apiPath = str_replace(['{teamId}'], [$teamId], '/teams/{teamId}/prefs'); + $apiPath = str_replace( + ['{teamId}'], + [$teamId], + '/teams/{teamId}/prefs' + ); $apiParams = []; - if (!isset($teamId)) { - throw new AppwriteException('Missing required parameter: "teamId"'); - } + $apiParams['teamId'] = $teamId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -497,29 +504,27 @@ public function getPrefs(string $teamId): array * @param array $prefs * @throws AppwriteException * @return array - */ public function updatePrefs(string $teamId, array $prefs): array { - $apiPath = str_replace(['{teamId}'], [$teamId], '/teams/{teamId}/prefs'); + $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; - } + $apiParams['teamId'] = $teamId; + $apiParams['prefs'] = $prefs; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_PUT, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } -} +} \ No newline at end of file diff --git a/src/Appwrite/Services/Users.php b/src/Appwrite/Services/Users.php index fc7e732..3da6d52 100644 --- a/src/Appwrite/Services/Users.php +++ b/src/Appwrite/Services/Users.php @@ -14,7 +14,7 @@ class Users extends Service { public function __construct(Client $client) { - $this->client = $client; + parent::__construct($client); } /** @@ -23,29 +23,36 @@ public function __construct(Client $client) * 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 + * @param ?array $queries + * @param ?string $search * @throws AppwriteException * @return array - */ - public function list(array $queries = null, string $search = null): array + public function list(?array $queries = null, ?string $search = null): array { - $apiPath = str_replace([], [], '/users'); + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -56,43 +63,47 @@ public function list(array $queries = null, string $search = null): array * Create a new user. * * @param string $userId - * @param string $email - * @param string $phone - * @param string $password - * @param string $name + * @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 + public function create(string $userId, ?string $email = null, ?string $phone = null, ?string $password = null, ?string $name = null): array { - $apiPath = str_replace([], [], '/users'); + $apiPath = str_replace( + [], + [], + '/users' + ); $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (!is_null($userId)) { - $apiParams['userId'] = $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; } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_POST, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -108,43 +119,34 @@ public function create(string $userId, string $email = null, string $phone = nul * @param string $userId * @param string $email * @param string $password - * @param string $name + * @param ?string $name * @throws AppwriteException * @return array - */ - public function createArgon2User(string $userId, string $email, string $password, string $name = null): array + public function createArgon2User(string $userId, string $email, string $password, ?string $name = null): array { - $apiPath = str_replace([], [], '/users/argon2'); + $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; - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -160,43 +162,34 @@ public function createArgon2User(string $userId, string $email, string $password * @param string $userId * @param string $email * @param string $password - * @param string $name + * @param ?string $name * @throws AppwriteException * @return array - */ - public function createBcryptUser(string $userId, string $email, string $password, string $name = null): array + public function createBcryptUser(string $userId, string $email, string $password, ?string $name = null): array { - $apiPath = str_replace([], [], '/users/bcrypt'); + $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; - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -206,29 +199,36 @@ public function createBcryptUser(string $userId, string $email, string $password * * Get identities for all users. * - * @param array $queries - * @param string $search + * @param ?array $queries + * @param ?string $search * @throws AppwriteException * @return array - */ - public function listIdentities(array $queries = null, string $search = null): array + public function listIdentities(?array $queries = null, ?string $search = null): array { - $apiPath = str_replace([], [], '/users/identities'); + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -241,22 +241,25 @@ public function listIdentities(array $queries = null, string $search = null): ar * @param string $identityId * @throws AppwriteException * @return string - */ public function deleteIdentity(string $identityId): string { - $apiPath = str_replace(['{identityId}'], [$identityId], '/users/identities/{identityId}'); + $apiPath = str_replace( + ['{identityId}'], + [$identityId], + '/users/identities/{identityId}' + ); $apiParams = []; - if (!isset($identityId)) { - throw new AppwriteException('Missing required parameter: "identityId"'); - } + $apiParams['identityId'] = $identityId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_DELETE, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -272,43 +275,34 @@ public function deleteIdentity(string $identityId): string * @param string $userId * @param string $email * @param string $password - * @param string $name + * @param ?string $name * @throws AppwriteException * @return array - */ - public function createMD5User(string $userId, string $email, string $password, string $name = null): array + public function createMD5User(string $userId, string $email, string $password, ?string $name = null): array { - $apiPath = str_replace([], [], '/users/md5'); + $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; - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -324,43 +318,34 @@ public function createMD5User(string $userId, string $email, string $password, s * @param string $userId * @param string $email * @param string $password - * @param string $name + * @param ?string $name * @throws AppwriteException * @return array - */ - public function createPHPassUser(string $userId, string $email, string $password, string $name = null): array + public function createPHPassUser(string $userId, string $email, string $password, ?string $name = null): array { - $apiPath = str_replace([], [], '/users/phpass'); + $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; - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -381,73 +366,39 @@ public function createPHPassUser(string $userId, string $email, string $password * @param int $passwordMemory * @param int $passwordParallel * @param int $passwordLength - * @param string $name + * @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 + 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'); + $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; - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -467,61 +418,37 @@ public function createScryptUser(string $userId, string $email, string $password * @param string $passwordSalt * @param string $passwordSaltSeparator * @param string $passwordSignerKey - * @param string $name + * @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 + 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'); + $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; - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -537,47 +464,39 @@ public function createScryptModifiedUser(string $userId, string $email, string $ * @param string $userId * @param string $email * @param string $password - * @param PasswordHash $passwordVersion - * @param string $name + * @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 + public function createSHAUser(string $userId, string $email, string $password, ?PasswordHash $passwordVersion = null, ?string $name = null): array { - $apiPath = str_replace([], [], '/users/sha'); + $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; - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -590,22 +509,25 @@ public function createSHAUser(string $userId, string $email, string $password, P * @param string $userId * @throws AppwriteException * @return array - */ public function get(string $userId): array { - $apiPath = str_replace(['{userId}'], [$userId], '/users/{userId}'); + $apiPath = str_replace( + ['{userId}'], + [$userId], + '/users/{userId}' + ); $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } + $apiParams['userId'] = $userId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -623,22 +545,25 @@ public function get(string $userId): array * @param string $userId * @throws AppwriteException * @return string - */ public function delete(string $userId): string { - $apiPath = str_replace(['{userId}'], [$userId], '/users/{userId}'); + $apiPath = str_replace( + ['{userId}'], + [$userId], + '/users/{userId}' + ); $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } + $apiParams['userId'] = $userId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_DELETE, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -652,28 +577,69 @@ public function delete(string $userId): string * @param string $email * @throws AppwriteException * @return array - */ public function updateEmail(string $userId, string $email): array { - $apiPath = str_replace(['{userId}'], [$userId], '/users/{userId}/email'); + $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"'); + $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($email)) { - $apiParams['email'] = $email; + + if (!is_null($duration)) { + $apiParams['duration'] = $duration; } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( - Client::METHOD_PATCH, + Client::METHOD_POST, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -692,28 +658,26 @@ public function updateEmail(string $userId, string $email): array * @param array $labels * @throws AppwriteException * @return array - */ public function updateLabels(string $userId, array $labels): array { - $apiPath = str_replace(['{userId}'], [$userId], '/users/{userId}/labels'); + $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; - } + $apiParams['userId'] = $userId; + $apiParams['labels'] = $labels; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_PUT, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -724,28 +688,32 @@ public function updateLabels(string $userId, array $labels): array * Get the user activity logs list by its unique ID. * * @param string $userId - * @param array $queries + * @param ?array $queries * @throws AppwriteException * @return array - */ - public function listLogs(string $userId, array $queries = null): array + public function listLogs(string $userId, ?array $queries = null): array { - $apiPath = str_replace(['{userId}'], [$userId], '/users/{userId}/logs'); + $apiPath = str_replace( + ['{userId}'], + [$userId], + '/users/{userId}/logs' + ); $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } + $apiParams['userId'] = $userId; + if (!is_null($queries)) { $apiParams['queries'] = $queries; } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -758,22 +726,25 @@ public function listLogs(string $userId, array $queries = null): array * @param string $userId * @throws AppwriteException * @return array - */ public function listMemberships(string $userId): array { - $apiPath = str_replace(['{userId}'], [$userId], '/users/{userId}/memberships'); + $apiPath = str_replace( + ['{userId}'], + [$userId], + '/users/{userId}/memberships' + ); $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } + $apiParams['userId'] = $userId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -787,28 +758,26 @@ public function listMemberships(string $userId): array * @param bool $mfa * @throws AppwriteException * @return array - */ public function updateMfa(string $userId, bool $mfa): array { - $apiPath = str_replace(['{userId}'], [$userId], '/users/{userId}/mfa'); + $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; - } + $apiParams['userId'] = $userId; + $apiParams['mfa'] = $mfa; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_PATCH, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -822,25 +791,26 @@ public function updateMfa(string $userId, bool $mfa): array * @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}'); + $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"'); - } + $apiParams['userId'] = $userId; + $apiParams['type'] = $type; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_DELETE, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -853,22 +823,25 @@ public function deleteMfaAuthenticator(string $userId, AuthenticatorType $type): * @param string $userId * @throws AppwriteException * @return array - */ public function listMfaFactors(string $userId): array { - $apiPath = str_replace(['{userId}'], [$userId], '/users/{userId}/mfa/factors'); + $apiPath = str_replace( + ['{userId}'], + [$userId], + '/users/{userId}/mfa/factors' + ); $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } + $apiParams['userId'] = $userId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -884,22 +857,25 @@ public function listMfaFactors(string $userId): array * @param string $userId * @throws AppwriteException * @return array - */ public function getMfaRecoveryCodes(string $userId): array { - $apiPath = str_replace(['{userId}'], [$userId], '/users/{userId}/mfa/recovery-codes'); + $apiPath = str_replace( + ['{userId}'], + [$userId], + '/users/{userId}/mfa/recovery-codes' + ); $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } + $apiParams['userId'] = $userId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -915,22 +891,25 @@ public function getMfaRecoveryCodes(string $userId): array * @param string $userId * @throws AppwriteException * @return array - */ public function updateMfaRecoveryCodes(string $userId): array { - $apiPath = str_replace(['{userId}'], [$userId], '/users/{userId}/mfa/recovery-codes'); + $apiPath = str_replace( + ['{userId}'], + [$userId], + '/users/{userId}/mfa/recovery-codes' + ); $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } + $apiParams['userId'] = $userId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_PUT, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -946,22 +925,25 @@ public function updateMfaRecoveryCodes(string $userId): array * @param string $userId * @throws AppwriteException * @return array - */ public function createMfaRecoveryCodes(string $userId): array { - $apiPath = str_replace(['{userId}'], [$userId], '/users/{userId}/mfa/recovery-codes'); + $apiPath = str_replace( + ['{userId}'], + [$userId], + '/users/{userId}/mfa/recovery-codes' + ); $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } + $apiParams['userId'] = $userId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_PATCH, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -975,28 +957,26 @@ public function createMfaRecoveryCodes(string $userId): array * @param string $name * @throws AppwriteException * @return array - */ public function updateName(string $userId, string $name): array { - $apiPath = str_replace(['{userId}'], [$userId], '/users/{userId}/name'); + $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; - } + $apiParams['userId'] = $userId; + $apiParams['name'] = $name; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_PATCH, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1010,28 +990,26 @@ public function updateName(string $userId, string $name): array * @param string $password * @throws AppwriteException * @return array - */ public function updatePassword(string $userId, string $password): array { - $apiPath = str_replace(['{userId}'], [$userId], '/users/{userId}/password'); + $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; - } + $apiParams['userId'] = $userId; + $apiParams['password'] = $password; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_PATCH, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1045,28 +1023,26 @@ public function updatePassword(string $userId, string $password): array * @param string $number * @throws AppwriteException * @return array - */ public function updatePhone(string $userId, string $number): array { - $apiPath = str_replace(['{userId}'], [$userId], '/users/{userId}/phone'); + $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; - } + $apiParams['userId'] = $userId; + $apiParams['number'] = $number; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_PATCH, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1079,22 +1055,25 @@ public function updatePhone(string $userId, string $number): array * @param string $userId * @throws AppwriteException * @return array - */ public function getPrefs(string $userId): array { - $apiPath = str_replace(['{userId}'], [$userId], '/users/{userId}/prefs'); + $apiPath = str_replace( + ['{userId}'], + [$userId], + '/users/{userId}/prefs' + ); $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } + $apiParams['userId'] = $userId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1110,28 +1089,26 @@ public function getPrefs(string $userId): array * @param array $prefs * @throws AppwriteException * @return array - */ public function updatePrefs(string $userId, array $prefs): array { - $apiPath = str_replace(['{userId}'], [$userId], '/users/{userId}/prefs'); + $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; - } + $apiParams['userId'] = $userId; + $apiParams['prefs'] = $prefs; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_PATCH, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1144,22 +1121,25 @@ public function updatePrefs(string $userId, array $prefs): array * @param string $userId * @throws AppwriteException * @return array - */ public function listSessions(string $userId): array { - $apiPath = str_replace(['{userId}'], [$userId], '/users/{userId}/sessions'); + $apiPath = str_replace( + ['{userId}'], + [$userId], + '/users/{userId}/sessions' + ); $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } + $apiParams['userId'] = $userId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1177,22 +1157,25 @@ public function listSessions(string $userId): array * @param string $userId * @throws AppwriteException * @return array - */ public function createSession(string $userId): array { - $apiPath = str_replace(['{userId}'], [$userId], '/users/{userId}/sessions'); + $apiPath = str_replace( + ['{userId}'], + [$userId], + '/users/{userId}/sessions' + ); $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } + $apiParams['userId'] = $userId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_POST, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1205,22 +1188,25 @@ public function createSession(string $userId): array * @param string $userId * @throws AppwriteException * @return string - */ public function deleteSessions(string $userId): string { - $apiPath = str_replace(['{userId}'], [$userId], '/users/{userId}/sessions'); + $apiPath = str_replace( + ['{userId}'], + [$userId], + '/users/{userId}/sessions' + ); $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } + $apiParams['userId'] = $userId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_DELETE, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1234,25 +1220,26 @@ public function deleteSessions(string $userId): string * @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}'); + $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"'); - } + $apiParams['userId'] = $userId; + $apiParams['sessionId'] = $sessionId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_DELETE, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1267,28 +1254,26 @@ public function deleteSession(string $userId, string $sessionId): string * @param bool $status * @throws AppwriteException * @return array - */ public function updateStatus(string $userId, bool $status): array { - $apiPath = str_replace(['{userId}'], [$userId], '/users/{userId}/status'); + $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; - } + $apiParams['userId'] = $userId; + $apiParams['status'] = $status; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_PATCH, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1299,28 +1284,32 @@ public function updateStatus(string $userId, bool $status): array * List the messaging targets that are associated with a user. * * @param string $userId - * @param array $queries + * @param ?array $queries * @throws AppwriteException * @return array - */ - public function listTargets(string $userId, array $queries = null): array + public function listTargets(string $userId, ?array $queries = null): array { - $apiPath = str_replace(['{userId}'], [$userId], '/users/{userId}/targets'); + $apiPath = str_replace( + ['{userId}'], + [$userId], + '/users/{userId}/targets' + ); $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } + $apiParams['userId'] = $userId; + if (!is_null($queries)) { $apiParams['queries'] = $queries; } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1334,50 +1323,40 @@ public function listTargets(string $userId, array $queries = null): array * @param string $targetId * @param MessagingProviderType $providerType * @param string $identifier - * @param string $providerId - * @param string $name + * @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 + 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'); + $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; - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1391,25 +1370,26 @@ public function createTarget(string $userId, string $targetId, MessagingProvider * @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}'); + $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"'); - } + $apiParams['userId'] = $userId; + $apiParams['targetId'] = $targetId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_GET, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1421,39 +1401,43 @@ public function getTarget(string $userId, string $targetId): array * * @param string $userId * @param string $targetId - * @param string $identifier - * @param string $providerId - * @param string $name + * @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 + 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}'); + $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"'); - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1467,25 +1451,26 @@ public function updateTarget(string $userId, string $targetId, string $identifie * @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}'); + $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"'); - } + $apiParams['userId'] = $userId; + $apiParams['targetId'] = $targetId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_DELETE, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1500,32 +1485,37 @@ public function deleteTarget(string $userId, string $targetId): string * * * @param string $userId - * @param int $length - * @param int $expire + * @param ?int $length + * @param ?int $expire * @throws AppwriteException * @return array - */ - public function createToken(string $userId, int $length = null, int $expire = null): array + public function createToken(string $userId, ?int $length = null, ?int $expire = null): array { - $apiPath = str_replace(['{userId}'], [$userId], '/users/{userId}/tokens'); + $apiPath = str_replace( + ['{userId}'], + [$userId], + '/users/{userId}/tokens' + ); $apiParams = []; - if (!isset($userId)) { - throw new AppwriteException('Missing required parameter: "userId"'); - } + $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, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1539,28 +1529,26 @@ public function createToken(string $userId, int $length = null, int $expire = nu * @param bool $emailVerification * @throws AppwriteException * @return array - */ public function updateEmailVerification(string $userId, bool $emailVerification): array { - $apiPath = str_replace(['{userId}'], [$userId], '/users/{userId}/verification'); + $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; - } + $apiParams['userId'] = $userId; + $apiParams['emailVerification'] = $emailVerification; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_PATCH, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } @@ -1574,29 +1562,27 @@ public function updateEmailVerification(string $userId, bool $emailVerification) * @param bool $phoneVerification * @throws AppwriteException * @return array - */ public function updatePhoneVerification(string $userId, bool $phoneVerification): array { - $apiPath = str_replace(['{userId}'], [$userId], '/users/{userId}/verification/phone'); + $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; - } + $apiParams['userId'] = $userId; + $apiParams['phoneVerification'] = $phoneVerification; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + return $this->client->call( Client::METHOD_PATCH, $apiPath, - [ - 'content-type' => 'application/json', - ], + $apiHeaders, $apiParams ); } -} +} \ No newline at end of file diff --git a/tests/Appwrite/Services/AccountTest.php b/tests/Appwrite/Services/AccountTest.php index d974efd..9c518a5 100644 --- a/tests/Appwrite/Services/AccountTest.php +++ b/tests/Appwrite/Services/AccountTest.php @@ -273,8 +273,7 @@ public function testMethodDeleteMfaAuthenticator(): void { ->andReturn($data); $response = $this->account->deleteMfaAuthenticator( - "totp", - "" + "totp" ); $this->assertSame($data, $response); diff --git a/tests/Appwrite/Services/FunctionsTest.php b/tests/Appwrite/Services/FunctionsTest.php index 797b546..854f83b 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 * * *", @@ -57,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 @@ -90,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 testMethodGet(): void { $data = array( @@ -103,6 +122,7 @@ public function testMethodGet(): void { "logging" => true, "runtime" => "python-3.8", "deployment" => "5e5ea5c16897e", + "scopes" => array(), "vars" => array(), "events" => array(), "schedule" => "5 4 * * *", @@ -114,7 +134,8 @@ public function testMethodGet(): void { "providerRepositoryId" => "appwrite", "providerBranch" => "main", "providerRootDirectory" => "functions/helloWorld", - "providerSilentMode" => true,); + "providerSilentMode" => true, + "specification" => "s-0.5vcpu-512mb",); $this->client @@ -141,6 +162,7 @@ public function testMethodUpdate(): void { "logging" => true, "runtime" => "python-3.8", "deployment" => "5e5ea5c16897e", + "scopes" => array(), "vars" => array(), "events" => array(), "schedule" => "5 4 * * *", @@ -152,7 +174,8 @@ public function testMethodUpdate(): void { "providerRepositoryId" => "appwrite", "providerBranch" => "main", "providerRootDirectory" => "functions/helloWorld", - "providerSilentMode" => true,); + "providerSilentMode" => true, + "specification" => "s-0.5vcpu-512mb",); $this->client @@ -212,6 +235,7 @@ public function testMethodCreateDeployment(): void { "resourceType" => "functions", "entrypoint" => "index.js", "size" => 128, + "buildSize" => 128, "buildId" => "5e5ea5c16897e", "activate" => true, "status" => "ready", @@ -253,6 +277,7 @@ public function testMethodGetDeployment(): void { "resourceType" => "functions", "entrypoint" => "index.js", "size" => 128, + "buildSize" => 128, "buildId" => "5e5ea5c16897e", "activate" => true, "status" => "ready", @@ -295,6 +320,7 @@ public function testMethodUpdateDeployment(): void { "logging" => true, "runtime" => "python-3.8", "deployment" => "5e5ea5c16897e", + "scopes" => array(), "vars" => array(), "events" => array(), "schedule" => "5 4 * * *", @@ -306,7 +332,8 @@ public function testMethodUpdateDeployment(): void { "providerRepositoryId" => "appwrite", "providerBranch" => "main", "providerRootDirectory" => "functions/helloWorld", - "providerSilentMode" => true,); + "providerSilentMode" => true, + "specification" => "s-0.5vcpu-512mb",); $this->client @@ -349,14 +376,39 @@ public function testMethodCreateBuild(): void { $response = $this->functions->createBuild( "", - "", - "" + "" ); $this->assertSame($data, $response); } - public function testMethodDownloadDeployment(): void { + 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); + } + + public function testMethodGetDeploymentDownload(): void { $data = ''; @@ -365,7 +417,7 @@ public function testMethodDownloadDeployment(): void { ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->functions->downloadDeployment( + $response = $this->functions->getDeploymentDownload( "", "" ); @@ -456,6 +508,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(