From 6e231a60d83894408b382685f4c1dc1d4d13699f Mon Sep 17 00:00:00 2001 From: Darshan Date: Wed, 14 Jan 2026 07:28:50 +0000 Subject: [PATCH 1/7] updates: sync as per latest cloud specs --- .gitignore | 2 + CHANGELOG.md | 10 - LICENSE | 2 +- README.md | 6 +- composer.json | 6 +- docs/account.md | 8 +- docs/backups.md | 172 ++++++++ docs/examples/account/create-jwt.md | 4 +- docs/examples/avatars/get-screenshot.md | 4 +- docs/examples/backups/create-archive.md | 16 + docs/examples/backups/create-policy.md | 21 + docs/examples/backups/create-restoration.md | 18 + docs/examples/backups/delete-archive.md | 15 + docs/examples/backups/delete-policy.md | 15 + docs/examples/backups/get-archive.md | 15 + docs/examples/backups/get-policy.md | 15 + docs/examples/backups/get-restoration.md | 15 + docs/examples/backups/list-archives.md | 15 + docs/examples/backups/list-policies.md | 15 + docs/examples/backups/list-restorations.md | 15 + docs/examples/backups/update-policy.md | 19 + docs/examples/databases/update-document.md | 8 +- docs/examples/databases/update-documents.md | 8 +- docs/examples/databases/upsert-document.md | 8 +- .../get-queue-billing-project-aggregation.md | 15 + .../get-queue-billing-team-aggregation.md | 15 + .../health/get-queue-priority-builds.md | 15 + .../health/get-queue-region-manager.md | 15 + docs/examples/health/get-queue-threats.md | 15 + docs/examples/organizations/delete.md | 15 + .../estimation-delete-organization.md | 15 + docs/examples/tablesdb/update-row.md | 8 +- docs/examples/tablesdb/update-rows.md | 8 +- docs/examples/tablesdb/upsert-row.md | 8 +- docs/health.md | 65 +++ docs/organizations.md | 28 ++ docs/storage.md | 16 +- src/Appwrite/Client.php | 75 +++- src/Appwrite/Enums/BuildRuntime.php | 24 - src/Appwrite/Enums/Name.php | 8 + src/Appwrite/Enums/OAuthProvider.php | 24 + src/Appwrite/Enums/Output.php | 83 ---- src/Appwrite/Enums/Runtime.php | 24 - src/Appwrite/Services/Account.php | 7 +- src/Appwrite/Services/Avatars.php | 6 +- src/Appwrite/Services/Backups.php | 410 ++++++++++++++++++ src/Appwrite/Services/Databases.php | 9 +- src/Appwrite/Services/Functions.php | 4 +- src/Appwrite/Services/Health.php | 155 +++++++ src/Appwrite/Services/Organizations.php | 74 ++++ src/Appwrite/Services/Sites.php | 4 +- src/Appwrite/Services/Storage.php | 7 +- tests/Appwrite/IDTest.php | 3 +- tests/Appwrite/QueryTest.php | 195 ++++++--- tests/Appwrite/Services/AccountTest.php | 140 +++--- tests/Appwrite/Services/AvatarsTest.php | 20 +- tests/Appwrite/Services/BackupsTest.php | 275 ++++++++++++ tests/Appwrite/Services/DatabasesTest.php | 194 ++++----- tests/Appwrite/Services/FunctionsTest.php | 79 ++-- tests/Appwrite/Services/GraphqlTest.php | 2 - tests/Appwrite/Services/HealthTest.php | 144 ++++-- tests/Appwrite/Services/LocaleTest.php | 24 +- tests/Appwrite/Services/MessagingTest.php | 138 ++---- tests/Appwrite/Services/OrganizationsTest.php | 50 +++ tests/Appwrite/Services/SitesTest.php | 81 ++-- tests/Appwrite/Services/StorageTest.php | 35 +- tests/Appwrite/Services/TablesDBTest.php | 191 ++++---- tests/Appwrite/Services/TeamsTest.php | 31 +- tests/Appwrite/Services/TokensTest.php | 13 +- tests/Appwrite/Services/UsersTest.php | 117 ++--- 70 files changed, 2350 insertions(+), 966 deletions(-) create mode 100644 .gitignore create mode 100644 docs/backups.md create mode 100644 docs/examples/backups/create-archive.md create mode 100644 docs/examples/backups/create-policy.md create mode 100644 docs/examples/backups/create-restoration.md create mode 100644 docs/examples/backups/delete-archive.md create mode 100644 docs/examples/backups/delete-policy.md create mode 100644 docs/examples/backups/get-archive.md create mode 100644 docs/examples/backups/get-policy.md create mode 100644 docs/examples/backups/get-restoration.md create mode 100644 docs/examples/backups/list-archives.md create mode 100644 docs/examples/backups/list-policies.md create mode 100644 docs/examples/backups/list-restorations.md create mode 100644 docs/examples/backups/update-policy.md create mode 100644 docs/examples/health/get-queue-billing-project-aggregation.md create mode 100644 docs/examples/health/get-queue-billing-team-aggregation.md create mode 100644 docs/examples/health/get-queue-priority-builds.md create mode 100644 docs/examples/health/get-queue-region-manager.md create mode 100644 docs/examples/health/get-queue-threats.md create mode 100644 docs/examples/organizations/delete.md create mode 100644 docs/examples/organizations/estimation-delete-organization.md create mode 100644 docs/organizations.md delete mode 100644 src/Appwrite/Enums/Output.php create mode 100644 src/Appwrite/Services/Backups.php create mode 100644 src/Appwrite/Services/Organizations.php create mode 100644 tests/Appwrite/Services/BackupsTest.php create mode 100644 tests/Appwrite/Services/OrganizationsTest.php diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..d1502b08 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +vendor/ +composer.lock diff --git a/CHANGELOG.md b/CHANGELOG.md index b94ebcc7..14a26e44 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,15 +1,5 @@ # Change Log -## 19.1.0 - -* Added ability to create columns and indexes synchronously while creating a table - -## 19.0.0 - -* Rename `VCSDeploymentType` enum to `VCSReferenceType` -* Change `createTemplateDeployment` method signature: replace `version` parameter with `type` (TemplateReferenceType) and `reference` parameters -* Add `Theme`, `Timezone` and `Output` enums - ## 18.0.1 * Fix `TablesDB` service to use correct file name diff --git a/LICENSE b/LICENSE index c1602fcd..6f8702b5 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2025 Appwrite (https://appwrite.io) and individual contributors. +Copyright (c) 2026 Appwrite (https://appwrite.io) and individual contributors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/README.md b/README.md index 3fc61689..6f4db851 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,14 @@ # 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.8.0-blue.svg?style=flat-square&v=1) +![Version](https://img.shields.io/badge/api%20version-1.8.1-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.8.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-php/releases).** +**This SDK is compatible with Appwrite server version latest. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-php/releases).** -Appwrite is an open-source backend as a service server that 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) +Appwrite is an open-source backend as a service server that abstracts and simplifies complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the PHP SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) ![Appwrite](https://github.com/appwrite/appwrite/raw/main/public/images/github.png) diff --git a/composer.json b/composer.json index 83f2bc00..6d9446db 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "appwrite/appwrite", - "description": "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API", + "description": "Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API", "type": "library", "license": "BSD-3-Clause", "support": { @@ -16,13 +16,13 @@ } }, "require": { - "php": ">=7.1.0", + "php": ">=8.0.0", "ext-curl": "*", "ext-json": "*" }, "require-dev": { "phpunit/phpunit": "^10", - "mockery/mockery": "^1.6.12" + "mockery/mockery": "1.6.12" }, "minimum-stability": "dev" } \ No newline at end of file diff --git a/docs/account.md b/docs/account.md index f7c07243..aac068bf 100644 --- a/docs/account.md +++ b/docs/account.md @@ -73,6 +73,12 @@ 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. ** +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| duration | integer | Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds. | 900 | + ```http request GET https://cloud.appwrite.io/v1/account/logs @@ -559,7 +565,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about | Field Name | Type | Description | Default | | --- | --- | --- | --- | -| provider | string | **Required** OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom. | | +| provider | string | **Required** OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom, githubImagine, googleImagine. | | | success | string | URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. | | | failure | string | URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. | | | scopes | array | A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long. | [] | diff --git a/docs/backups.md b/docs/backups.md new file mode 100644 index 00000000..36a4ee91 --- /dev/null +++ b/docs/backups.md @@ -0,0 +1,172 @@ +# Backups Service + + +```http request +GET https://cloud.appwrite.io/v1/backups/archives +``` + +** List all archives for a project. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| queries | array | Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. | [] | + + +```http request +POST https://cloud.appwrite.io/v1/backups/archives +``` + +** Create a new archive asynchronously for a project. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| services | array | Array of services to backup | | +| resourceId | string | Resource ID. When set, only this single resource will be backed up. | | + + +```http request +GET https://cloud.appwrite.io/v1/backups/archives/{archiveId} +``` + +** Get a backup archive using it's ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| archiveId | string | **Required** Archive ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. | | + + +```http request +DELETE https://cloud.appwrite.io/v1/backups/archives/{archiveId} +``` + +** Delete an existing archive for a project. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| archiveId | string | **Required** Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. | | + + +```http request +GET https://cloud.appwrite.io/v1/backups/policies +``` + +** List all policies for a project. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| queries | array | Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. | [] | + + +```http request +POST https://cloud.appwrite.io/v1/backups/policies +``` + +** Create a new backup policy. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| policyId | string | Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. | | +| name | string | Policy name. Max length: 128 chars. | | +| services | array | Array of services to backup | | +| resourceId | string | Resource ID. When set, only this single resource will be backed up. | | +| enabled | boolean | Is policy enabled? When set to 'disabled', no backups will be taken | 1 | +| retention | integer | Days to keep backups before deletion | | +| schedule | string | Schedule CRON syntax. | | + + +```http request +GET https://cloud.appwrite.io/v1/backups/policies/{policyId} +``` + +** Get a backup policy using it's ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| policyId | string | **Required** Policy ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/backups/policies/{policyId} +``` + +** Update an existing policy using it's ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| policyId | string | **Required** Policy ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. | | +| name | string | Policy name. Max length: 128 chars. | | +| retention | integer | Days to keep backups before deletion | | +| schedule | string | Cron expression | | +| enabled | boolean | Is Backup enabled? When set to 'disabled', No backup will be taken | | + + +```http request +DELETE https://cloud.appwrite.io/v1/backups/policies/{policyId} +``` + +** Delete a policy using it's ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| policyId | string | **Required** Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. | | + + +```http request +POST https://cloud.appwrite.io/v1/backups/restoration +``` + +** Create and trigger a new restoration for a backup on a project. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| archiveId | string | Backup archive ID to restore | | +| services | array | Array of services to restore | | +| newResourceId | string | Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. | | +| newResourceName | string | Database name. Max length: 128 chars. | | + + +```http request +GET https://cloud.appwrite.io/v1/backups/restorations +``` + +** List all backup restorations for a project. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| queries | array | Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. | [] | + + +```http request +GET https://cloud.appwrite.io/v1/backups/restorations/{restorationId} +``` + +** Get the current status of a backup restoration. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| restorationId | string | **Required** Restoration ID. Choose a custom ID`. 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. | | + diff --git a/docs/examples/account/create-jwt.md b/docs/examples/account/create-jwt.md index 458405ed..4031c649 100644 --- a/docs/examples/account/create-jwt.md +++ b/docs/examples/account/create-jwt.md @@ -10,4 +10,6 @@ $client = (new Client()) $account = new Account($client); -$result = $account->createJWT(); +$result = $account->createJWT( + duration: 0 // optional +); \ No newline at end of file diff --git a/docs/examples/avatars/get-screenshot.md b/docs/examples/avatars/get-screenshot.md index 9f91a3fa..c936f5c5 100644 --- a/docs/examples/avatars/get-screenshot.md +++ b/docs/examples/avatars/get-screenshot.md @@ -4,7 +4,7 @@ use Appwrite\Client; use Appwrite\Services\Avatars; use Appwrite\Enums\Theme; use Appwrite\Enums\Timezone; -use Appwrite\Enums\Output; +use Appwrite\Enums\ImageFormat; $client = (new Client()) ->setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -36,5 +36,5 @@ $result = $avatars->getScreenshot( width: 800, // optional height: 600, // optional quality: 85, // optional - output: Output::JPG() // optional + output: ImageFormat::JPG() // optional ); \ No newline at end of file diff --git a/docs/examples/backups/create-archive.md b/docs/examples/backups/create-archive.md new file mode 100644 index 00000000..4744efe2 --- /dev/null +++ b/docs/examples/backups/create-archive.md @@ -0,0 +1,16 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$backups = new Backups($client); + +$result = $backups->createArchive( + services: [], + resourceId: '' // optional +); \ No newline at end of file diff --git a/docs/examples/backups/create-policy.md b/docs/examples/backups/create-policy.md new file mode 100644 index 00000000..4b9aecf6 --- /dev/null +++ b/docs/examples/backups/create-policy.md @@ -0,0 +1,21 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$backups = new Backups($client); + +$result = $backups->createPolicy( + policyId: '', + services: [], + retention: 1, + schedule: '', + name: '', // optional + resourceId: '', // optional + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/backups/create-restoration.md b/docs/examples/backups/create-restoration.md new file mode 100644 index 00000000..1eb34f38 --- /dev/null +++ b/docs/examples/backups/create-restoration.md @@ -0,0 +1,18 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$backups = new Backups($client); + +$result = $backups->createRestoration( + archiveId: '', + services: [], + newResourceId: '', // optional + newResourceName: '' // optional +); \ No newline at end of file diff --git a/docs/examples/backups/delete-archive.md b/docs/examples/backups/delete-archive.md new file mode 100644 index 00000000..3c000f75 --- /dev/null +++ b/docs/examples/backups/delete-archive.md @@ -0,0 +1,15 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$backups = new Backups($client); + +$result = $backups->deleteArchive( + archiveId: '' +); \ No newline at end of file diff --git a/docs/examples/backups/delete-policy.md b/docs/examples/backups/delete-policy.md new file mode 100644 index 00000000..6a20d405 --- /dev/null +++ b/docs/examples/backups/delete-policy.md @@ -0,0 +1,15 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$backups = new Backups($client); + +$result = $backups->deletePolicy( + policyId: '' +); \ No newline at end of file diff --git a/docs/examples/backups/get-archive.md b/docs/examples/backups/get-archive.md new file mode 100644 index 00000000..b689fc40 --- /dev/null +++ b/docs/examples/backups/get-archive.md @@ -0,0 +1,15 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$backups = new Backups($client); + +$result = $backups->getArchive( + archiveId: '' +); \ No newline at end of file diff --git a/docs/examples/backups/get-policy.md b/docs/examples/backups/get-policy.md new file mode 100644 index 00000000..934e4a84 --- /dev/null +++ b/docs/examples/backups/get-policy.md @@ -0,0 +1,15 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$backups = new Backups($client); + +$result = $backups->getPolicy( + policyId: '' +); \ No newline at end of file diff --git a/docs/examples/backups/get-restoration.md b/docs/examples/backups/get-restoration.md new file mode 100644 index 00000000..ae1b1357 --- /dev/null +++ b/docs/examples/backups/get-restoration.md @@ -0,0 +1,15 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$backups = new Backups($client); + +$result = $backups->getRestoration( + restorationId: '' +); \ No newline at end of file diff --git a/docs/examples/backups/list-archives.md b/docs/examples/backups/list-archives.md new file mode 100644 index 00000000..5810f6c9 --- /dev/null +++ b/docs/examples/backups/list-archives.md @@ -0,0 +1,15 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$backups = new Backups($client); + +$result = $backups->listArchives( + queries: [] // optional +); \ No newline at end of file diff --git a/docs/examples/backups/list-policies.md b/docs/examples/backups/list-policies.md new file mode 100644 index 00000000..df0cc414 --- /dev/null +++ b/docs/examples/backups/list-policies.md @@ -0,0 +1,15 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$backups = new Backups($client); + +$result = $backups->listPolicies( + queries: [] // optional +); \ No newline at end of file diff --git a/docs/examples/backups/list-restorations.md b/docs/examples/backups/list-restorations.md new file mode 100644 index 00000000..4d23414a --- /dev/null +++ b/docs/examples/backups/list-restorations.md @@ -0,0 +1,15 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$backups = new Backups($client); + +$result = $backups->listRestorations( + queries: [] // optional +); \ No newline at end of file diff --git a/docs/examples/backups/update-policy.md b/docs/examples/backups/update-policy.md new file mode 100644 index 00000000..0390d004 --- /dev/null +++ b/docs/examples/backups/update-policy.md @@ -0,0 +1,19 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$backups = new Backups($client); + +$result = $backups->updatePolicy( + policyId: '', + name: '', // optional + retention: 1, // optional + schedule: '', // optional + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/databases/update-document.md b/docs/examples/databases/update-document.md index 2aaada2b..5037d4bf 100644 --- a/docs/examples/databases/update-document.md +++ b/docs/examples/databases/update-document.md @@ -16,7 +16,13 @@ $result = $databases->updateDocument( databaseId: '', collectionId: '', documentId: '', - data: [], // optional + data: [ + 'username' => 'walter.obrien', + 'email' => 'walter.obrien@example.com', + 'fullName' => 'Walter O'Brien', + 'age' => 33, + 'isAdmin' => false + ], // optional permissions: [Permission::read(Role::any())], // optional transactionId: '' // optional ); \ No newline at end of file diff --git a/docs/examples/databases/update-documents.md b/docs/examples/databases/update-documents.md index 72632461..3a4aaad2 100644 --- a/docs/examples/databases/update-documents.md +++ b/docs/examples/databases/update-documents.md @@ -13,7 +13,13 @@ $databases = new Databases($client); $result = $databases->updateDocuments( databaseId: '', collectionId: '', - data: [], // optional + data: [ + 'username' => 'walter.obrien', + 'email' => 'walter.obrien@example.com', + 'fullName' => 'Walter O'Brien', + 'age' => 33, + 'isAdmin' => false + ], // optional queries: [], // optional transactionId: '' // optional ); \ No newline at end of file diff --git a/docs/examples/databases/upsert-document.md b/docs/examples/databases/upsert-document.md index 8e9d2c9c..c4cee07e 100644 --- a/docs/examples/databases/upsert-document.md +++ b/docs/examples/databases/upsert-document.md @@ -16,7 +16,13 @@ $result = $databases->upsertDocument( databaseId: '', collectionId: '', documentId: '', - data: [], + data: [ + 'username' => 'walter.obrien', + 'email' => 'walter.obrien@example.com', + 'fullName' => 'Walter O'Brien', + 'age' => 30, + 'isAdmin' => false + ], // optional permissions: [Permission::read(Role::any())], // optional transactionId: '' // optional ); \ No newline at end of file diff --git a/docs/examples/health/get-queue-billing-project-aggregation.md b/docs/examples/health/get-queue-billing-project-aggregation.md new file mode 100644 index 00000000..5a632609 --- /dev/null +++ b/docs/examples/health/get-queue-billing-project-aggregation.md @@ -0,0 +1,15 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$health = new Health($client); + +$result = $health->getQueueBillingProjectAggregation( + threshold: null // optional +); \ No newline at end of file diff --git a/docs/examples/health/get-queue-billing-team-aggregation.md b/docs/examples/health/get-queue-billing-team-aggregation.md new file mode 100644 index 00000000..7cb6fe3f --- /dev/null +++ b/docs/examples/health/get-queue-billing-team-aggregation.md @@ -0,0 +1,15 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$health = new Health($client); + +$result = $health->getQueueBillingTeamAggregation( + threshold: null // optional +); \ No newline at end of file diff --git a/docs/examples/health/get-queue-priority-builds.md b/docs/examples/health/get-queue-priority-builds.md new file mode 100644 index 00000000..a3daf32e --- /dev/null +++ b/docs/examples/health/get-queue-priority-builds.md @@ -0,0 +1,15 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$health = new Health($client); + +$result = $health->getQueuePriorityBuilds( + threshold: null // optional +); \ No newline at end of file diff --git a/docs/examples/health/get-queue-region-manager.md b/docs/examples/health/get-queue-region-manager.md new file mode 100644 index 00000000..e57b7bf2 --- /dev/null +++ b/docs/examples/health/get-queue-region-manager.md @@ -0,0 +1,15 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$health = new Health($client); + +$result = $health->getQueueRegionManager( + threshold: null // optional +); \ No newline at end of file diff --git a/docs/examples/health/get-queue-threats.md b/docs/examples/health/get-queue-threats.md new file mode 100644 index 00000000..694cb2dd --- /dev/null +++ b/docs/examples/health/get-queue-threats.md @@ -0,0 +1,15 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$health = new Health($client); + +$result = $health->getQueueThreats( + threshold: null // optional +); \ No newline at end of file diff --git a/docs/examples/organizations/delete.md b/docs/examples/organizations/delete.md new file mode 100644 index 00000000..256edef4 --- /dev/null +++ b/docs/examples/organizations/delete.md @@ -0,0 +1,15 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$organizations = new Organizations($client); + +$result = $organizations->delete( + organizationId: '' +); \ No newline at end of file diff --git a/docs/examples/organizations/estimation-delete-organization.md b/docs/examples/organizations/estimation-delete-organization.md new file mode 100644 index 00000000..33bbef10 --- /dev/null +++ b/docs/examples/organizations/estimation-delete-organization.md @@ -0,0 +1,15 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$organizations = new Organizations($client); + +$result = $organizations->estimationDeleteOrganization( + organizationId: '' +); \ No newline at end of file diff --git a/docs/examples/tablesdb/update-row.md b/docs/examples/tablesdb/update-row.md index d92ab789..71916cd6 100644 --- a/docs/examples/tablesdb/update-row.md +++ b/docs/examples/tablesdb/update-row.md @@ -16,7 +16,13 @@ $result = $tablesDB->updateRow( databaseId: '', tableId: '', rowId: '', - data: [], // optional + data: [ + 'username' => 'walter.obrien', + 'email' => 'walter.obrien@example.com', + 'fullName' => 'Walter O'Brien', + 'age' => 33, + 'isAdmin' => false + ], // optional permissions: [Permission::read(Role::any())], // optional transactionId: '' // optional ); \ No newline at end of file diff --git a/docs/examples/tablesdb/update-rows.md b/docs/examples/tablesdb/update-rows.md index 681a9f0d..a6892f81 100644 --- a/docs/examples/tablesdb/update-rows.md +++ b/docs/examples/tablesdb/update-rows.md @@ -13,7 +13,13 @@ $tablesDB = new TablesDB($client); $result = $tablesDB->updateRows( databaseId: '', tableId: '', - data: [], // optional + data: [ + 'username' => 'walter.obrien', + 'email' => 'walter.obrien@example.com', + 'fullName' => 'Walter O'Brien', + 'age' => 33, + 'isAdmin' => false + ], // optional queries: [], // optional transactionId: '' // optional ); \ No newline at end of file diff --git a/docs/examples/tablesdb/upsert-row.md b/docs/examples/tablesdb/upsert-row.md index 192463e9..e26c8255 100644 --- a/docs/examples/tablesdb/upsert-row.md +++ b/docs/examples/tablesdb/upsert-row.md @@ -16,7 +16,13 @@ $result = $tablesDB->upsertRow( databaseId: '', tableId: '', rowId: '', - data: [], // optional + data: [ + 'username' => 'walter.obrien', + 'email' => 'walter.obrien@example.com', + 'fullName' => 'Walter O'Brien', + 'age' => 33, + 'isAdmin' => false + ], // optional permissions: [Permission::read(Role::any())], // optional transactionId: '' // optional ); \ No newline at end of file diff --git a/docs/health.md b/docs/health.md index dc192949..799431af 100644 --- a/docs/health.md +++ b/docs/health.md @@ -49,6 +49,32 @@ GET https://cloud.appwrite.io/v1/health/pubsub ** Check the Appwrite pub-sub servers are up and connection is successful. ** +```http request +GET https://cloud.appwrite.io/v1/health/queue/billing-project-aggregation +``` + +** Get billing project aggregation queue. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 10000 | + + +```http request +GET https://cloud.appwrite.io/v1/health/queue/billing-team-aggregation +``` + +** Get billing team aggregation queue. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 10000 | + + ```http request GET https://cloud.appwrite.io/v1/health/queue/builds ``` @@ -62,6 +88,19 @@ GET https://cloud.appwrite.io/v1/health/queue/builds | threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 5000 | +```http request +GET https://cloud.appwrite.io/v1/health/queue/builds-priority +``` + +** Get the priority builds queue size. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 500. | 500 | + + ```http request GET https://cloud.appwrite.io/v1/health/queue/certificates ``` @@ -182,6 +221,19 @@ GET https://cloud.appwrite.io/v1/health/queue/migrations | threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 5000 | +```http request +GET https://cloud.appwrite.io/v1/health/queue/region-manager +``` + +** Get region manager queue. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 100. | 100 | + + ```http request GET https://cloud.appwrite.io/v1/health/queue/stats-resources ``` @@ -208,6 +260,19 @@ GET https://cloud.appwrite.io/v1/health/queue/stats-usage | threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 5000 | +```http request +GET https://cloud.appwrite.io/v1/health/queue/threats +``` + +** Get threats queue. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 100. | 100 | + + ```http request GET https://cloud.appwrite.io/v1/health/queue/webhooks ``` diff --git a/docs/organizations.md b/docs/organizations.md new file mode 100644 index 00000000..1b7105f4 --- /dev/null +++ b/docs/organizations.md @@ -0,0 +1,28 @@ +# Organizations Service + + +```http request +DELETE https://cloud.appwrite.io/v1/organizations/{organizationId} +``` + +** Delete an organization. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| organizationId | string | **Required** Team ID. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/organizations/{organizationId}/estimations/delete-organization +``` + +** Get estimation for deleting an organization. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| organizationId | string | **Required** Team ID. | | + diff --git a/docs/storage.md b/docs/storage.md index 86540293..c051c9b5 100644 --- a/docs/storage.md +++ b/docs/storage.md @@ -31,9 +31,9 @@ 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. | [] | +| maximumFileSize | integer | Maximum file size allowed in bytes. Maximum allowed value is 5GB. | [] | | 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 | +| compression | string | Compression algorithm chosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled | none | | encryption | boolean | Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled | 1 | | antivirus | boolean | Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled | 1 | | transformations | boolean | Are image transformations enabled? | 1 | @@ -67,9 +67,9 @@ 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 5GB. | [] | | 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 | +| compression | string | Compression algorithm chosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled | none | | encryption | boolean | Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled | 1 | | antivirus | boolean | Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled | 1 | | transformations | boolean | Are image transformations enabled? | 1 | @@ -151,10 +151,10 @@ PUT https://cloud.appwrite.io/v1/storage/buckets/{bucketId}/files/{fileId} | Field Name | Type | Description | Default | | --- | --- | --- | --- | -| bucketId | string | **Required** Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). | | -| fileId | string | **Required** File unique ID. | | -| name | string | Name of the file | | -| permissions | array | An array of permission string. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). | | +| bucketId | string | **Required** Bucket unique ID. | | +| fileId | string | **Required** File ID. | | +| name | string | File name. | | +| permissions | array | An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). | | ```http request diff --git a/src/Appwrite/Client.php b/src/Appwrite/Client.php index 9ade6122..8d8d89ed 100644 --- a/src/Appwrite/Client.php +++ b/src/Appwrite/Client.php @@ -37,13 +37,27 @@ class Client */ protected array $headers = [ 'content-type' => '', - 'user-agent' => 'AppwritePHPSDK/19.1.0 ()', + 'user-agent' => 'AppwritePHPSDK/20.0.0 ()', 'x-sdk-name'=> 'PHP', 'x-sdk-platform'=> 'server', 'x-sdk-language'=> 'php', - 'x-sdk-version'=> '19.1.0', + 'x-sdk-version'=> '20.0.0', ]; + /** + * Timeout in seconds + * + * @var int|null + */ + protected ?int $timeout = null; + + /** + * Connect timeout in seconds + * + * @var int|null + */ + protected ?int $connectTimeout = null; + /** * Client constructor. */ @@ -173,6 +187,30 @@ public function setEndpoint(string $endpoint): Client return $this; } + /** + * Set Timeout + * + * @param int $timeout Timeout in seconds + * @return Client + */ + public function setTimeout(int $timeout): Client + { + $this->timeout = $timeout; + return $this; + } + + /** + * Set Connect Timeout + * + * @param int $connectTimeout Connect timeout in seconds + * @return Client + */ + public function setConnectTimeout(int $connectTimeout): Client + { + $this->connectTimeout = $connectTimeout; + return $this; + } + /** * @param $key * @param $value @@ -180,7 +218,7 @@ public function setEndpoint(string $endpoint): Client public function addHeader(string $key, string $value): Client { $this->headers[strtolower($key)] = $value; - + return $this; } @@ -210,7 +248,7 @@ public function call( switch ($headers['content-type']) { case 'application/json': - $query = json_encode($params); + $query = json_encode($this->prepareParams($params)); break; case 'multipart/form-data': @@ -255,6 +293,16 @@ public function call( curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); } + // Set timeout if configured + if($this->timeout !== null) { + curl_setopt($ch, CURLOPT_TIMEOUT, $this->timeout); + } + + // Set connect timeout if configured + if($this->connectTimeout !== null) { + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->connectTimeout); + } + $responseBody = curl_exec($ch); $contentType = $responseHeaders['content-type'] ?? ''; $responseStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE); @@ -316,4 +364,23 @@ protected function flatten(array $data, string $prefix = ''): array { return $output; } + + /** + * Prepare params for JSON encoding by converting model objects to arrays + * + * @param mixed $data + * @return mixed + */ + protected function prepareParams($data) + { + if (is_array($data)) { + return array_map([$this, 'prepareParams'], $data); + } + + if (is_object($data) && method_exists($data, 'toArray')) { + return $data->toArray(); + } + + return $data; + } } diff --git a/src/Appwrite/Enums/BuildRuntime.php b/src/Appwrite/Enums/BuildRuntime.php index 08065137..32d94fa5 100644 --- a/src/Appwrite/Enums/BuildRuntime.php +++ b/src/Appwrite/Enums/BuildRuntime.php @@ -28,9 +28,6 @@ class BuildRuntime implements JsonSerializable private static BuildRuntime $PYTHON312; private static BuildRuntime $PYTHONML311; private static BuildRuntime $PYTHONML312; - private static BuildRuntime $DENO121; - private static BuildRuntime $DENO124; - private static BuildRuntime $DENO135; private static BuildRuntime $DENO140; private static BuildRuntime $DENO146; private static BuildRuntime $DENO20; @@ -245,27 +242,6 @@ public static function PYTHONML312(): BuildRuntime } return self::$PYTHONML312; } - public static function DENO121(): BuildRuntime - { - if (!isset(self::$DENO121)) { - self::$DENO121 = new BuildRuntime('deno-1.21'); - } - return self::$DENO121; - } - public static function DENO124(): BuildRuntime - { - if (!isset(self::$DENO124)) { - self::$DENO124 = new BuildRuntime('deno-1.24'); - } - return self::$DENO124; - } - public static function DENO135(): BuildRuntime - { - if (!isset(self::$DENO135)) { - self::$DENO135 = new BuildRuntime('deno-1.35'); - } - return self::$DENO135; - } public static function DENO140(): BuildRuntime { if (!isset(self::$DENO140)) { diff --git a/src/Appwrite/Enums/Name.php b/src/Appwrite/Enums/Name.php index bcf9dc5b..7407769c 100644 --- a/src/Appwrite/Enums/Name.php +++ b/src/Appwrite/Enums/Name.php @@ -16,6 +16,7 @@ class Name implements JsonSerializable private static Name $V1WEBHOOKS; private static Name $V1CERTIFICATES; private static Name $V1BUILDS; + private static Name $V1SCREENSHOTS; private static Name $V1MESSAGING; private static Name $V1MIGRATIONS; @@ -106,6 +107,13 @@ public static function V1BUILDS(): Name } return self::$V1BUILDS; } + public static function V1SCREENSHOTS(): Name + { + if (!isset(self::$V1SCREENSHOTS)) { + self::$V1SCREENSHOTS = new Name('v1-screenshots'); + } + return self::$V1SCREENSHOTS; + } public static function V1MESSAGING(): Name { if (!isset(self::$V1MESSAGING)) { diff --git a/src/Appwrite/Enums/OAuthProvider.php b/src/Appwrite/Enums/OAuthProvider.php index 4763c9ca..47f6a206 100644 --- a/src/Appwrite/Enums/OAuthProvider.php +++ b/src/Appwrite/Enums/OAuthProvider.php @@ -46,6 +46,9 @@ class OAuthProvider implements JsonSerializable private static OAuthProvider $ZOHO; private static OAuthProvider $ZOOM; private static OAuthProvider $MOCK; + private static OAuthProvider $MOCKUNVERIFIED; + private static OAuthProvider $GITHUBIMAGINE; + private static OAuthProvider $GOOGLEIMAGINE; private string $value; @@ -344,4 +347,25 @@ public static function MOCK(): OAuthProvider } return self::$MOCK; } + public static function MOCKUNVERIFIED(): OAuthProvider + { + if (!isset(self::$MOCKUNVERIFIED)) { + self::$MOCKUNVERIFIED = new OAuthProvider('mock-unverified'); + } + return self::$MOCKUNVERIFIED; + } + public static function GITHUBIMAGINE(): OAuthProvider + { + if (!isset(self::$GITHUBIMAGINE)) { + self::$GITHUBIMAGINE = new OAuthProvider('githubImagine'); + } + return self::$GITHUBIMAGINE; + } + public static function GOOGLEIMAGINE(): OAuthProvider + { + if (!isset(self::$GOOGLEIMAGINE)) { + self::$GOOGLEIMAGINE = new OAuthProvider('googleImagine'); + } + return self::$GOOGLEIMAGINE; + } } \ No newline at end of file diff --git a/src/Appwrite/Enums/Output.php b/src/Appwrite/Enums/Output.php deleted file mode 100644 index 45c0675c..00000000 --- a/src/Appwrite/Enums/Output.php +++ /dev/null @@ -1,83 +0,0 @@ -value = $value; - } - - public function __toString(): string - { - return $this->value; - } - - public function jsonSerialize(): string - { - return $this->value; - } - - public static function JPG(): Output - { - if (!isset(self::$JPG)) { - self::$JPG = new Output('jpg'); - } - return self::$JPG; - } - public static function JPEG(): Output - { - if (!isset(self::$JPEG)) { - self::$JPEG = new Output('jpeg'); - } - return self::$JPEG; - } - public static function PNG(): Output - { - if (!isset(self::$PNG)) { - self::$PNG = new Output('png'); - } - return self::$PNG; - } - public static function WEBP(): Output - { - if (!isset(self::$WEBP)) { - self::$WEBP = new Output('webp'); - } - return self::$WEBP; - } - public static function HEIC(): Output - { - if (!isset(self::$HEIC)) { - self::$HEIC = new Output('heic'); - } - return self::$HEIC; - } - public static function AVIF(): Output - { - if (!isset(self::$AVIF)) { - self::$AVIF = new Output('avif'); - } - return self::$AVIF; - } - public static function GIF(): Output - { - if (!isset(self::$GIF)) { - self::$GIF = new Output('gif'); - } - return self::$GIF; - } -} \ No newline at end of file diff --git a/src/Appwrite/Enums/Runtime.php b/src/Appwrite/Enums/Runtime.php index 75e78e51..498952b5 100644 --- a/src/Appwrite/Enums/Runtime.php +++ b/src/Appwrite/Enums/Runtime.php @@ -28,9 +28,6 @@ class Runtime implements JsonSerializable private static Runtime $PYTHON312; private static Runtime $PYTHONML311; private static Runtime $PYTHONML312; - private static Runtime $DENO121; - private static Runtime $DENO124; - private static Runtime $DENO135; private static Runtime $DENO140; private static Runtime $DENO146; private static Runtime $DENO20; @@ -245,27 +242,6 @@ public static function PYTHONML312(): Runtime } return self::$PYTHONML312; } - 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)) { diff --git a/src/Appwrite/Services/Account.php b/src/Appwrite/Services/Account.php index cfb1b344..c9d6b778 100644 --- a/src/Appwrite/Services/Account.php +++ b/src/Appwrite/Services/Account.php @@ -197,10 +197,11 @@ public function deleteIdentity(string $identityId): string * from its creation and will be invalid if the user will logout in that time * frame. * + * @param ?int $duration * @throws AppwriteException * @return array */ - public function createJWT(): array + public function createJWT(?int $duration = null): array { $apiPath = str_replace( [], @@ -210,6 +211,10 @@ public function createJWT(): array $apiParams = []; + if (!is_null($duration)) { + $apiParams['duration'] = $duration; + } + $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; diff --git a/src/Appwrite/Services/Avatars.php b/src/Appwrite/Services/Avatars.php index 4b5dfb70..7700148a 100644 --- a/src/Appwrite/Services/Avatars.php +++ b/src/Appwrite/Services/Avatars.php @@ -11,7 +11,7 @@ use Appwrite\Enums\Flag; use Appwrite\Enums\Theme; use Appwrite\Enums\Timezone; -use Appwrite\Enums\Output; +use Appwrite\Enums\ImageFormat; class Avatars extends Service { @@ -391,11 +391,11 @@ public function getQR(string $text, ?int $size = null, ?int $margin = null, ?boo * @param ?int $width * @param ?int $height * @param ?int $quality - * @param ?Output $output + * @param ?ImageFormat $output * @throws AppwriteException * @return string */ - public function getScreenshot(string $url, ?array $headers = null, ?int $viewportWidth = null, ?int $viewportHeight = null, ?float $scale = null, ?Theme $theme = null, ?string $userAgent = null, ?bool $fullpage = null, ?string $locale = null, ?Timezone $timezone = null, ?float $latitude = null, ?float $longitude = null, ?float $accuracy = null, ?bool $touch = null, ?array $permissions = null, ?int $sleep = null, ?int $width = null, ?int $height = null, ?int $quality = null, ?Output $output = null): string + public function getScreenshot(string $url, ?array $headers = null, ?int $viewportWidth = null, ?int $viewportHeight = null, ?float $scale = null, ?Theme $theme = null, ?string $userAgent = null, ?bool $fullpage = null, ?string $locale = null, ?Timezone $timezone = null, ?float $latitude = null, ?float $longitude = null, ?float $accuracy = null, ?bool $touch = null, ?array $permissions = null, ?int $sleep = null, ?int $width = null, ?int $height = null, ?int $quality = null, ?ImageFormat $output = null): string { $apiPath = str_replace( [], diff --git a/src/Appwrite/Services/Backups.php b/src/Appwrite/Services/Backups.php new file mode 100644 index 00000000..2815da63 --- /dev/null +++ b/src/Appwrite/Services/Backups.php @@ -0,0 +1,410 @@ +client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create a new archive asynchronously for a project. + * + * @param array $services + * @param ?string $resourceId + * @throws AppwriteException + * @return array + */ + public function createArchive(array $services, ?string $resourceId = null): array + { + $apiPath = str_replace( + [], + [], + '/backups/archives' + ); + + $apiParams = []; + $apiParams['services'] = $services; + $apiParams['resourceId'] = $resourceId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get a backup archive using it's ID. + * + * @param string $archiveId + * @throws AppwriteException + * @return array + */ + public function getArchive(string $archiveId): array + { + $apiPath = str_replace( + ['{archiveId}'], + [$archiveId], + '/backups/archives/{archiveId}' + ); + + $apiParams = []; + $apiParams['archiveId'] = $archiveId; + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Delete an existing archive for a project. + * + * @param string $archiveId + * @throws AppwriteException + * @return string + */ + public function deleteArchive(string $archiveId): string + { + $apiPath = str_replace( + ['{archiveId}'], + [$archiveId], + '/backups/archives/{archiveId}' + ); + + $apiParams = []; + $apiParams['archiveId'] = $archiveId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * List all policies for a project. + * + * @param ?array $queries + * @throws AppwriteException + * @return array + */ + public function listPolicies(?array $queries = null): array + { + $apiPath = str_replace( + [], + [], + '/backups/policies' + ); + + $apiParams = []; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create a new backup policy. + * + * @param string $policyId + * @param array $services + * @param int $retention + * @param string $schedule + * @param ?string $name + * @param ?string $resourceId + * @param ?bool $enabled + * @throws AppwriteException + * @return array + */ + public function createPolicy(string $policyId, array $services, int $retention, string $schedule, ?string $name = null, ?string $resourceId = null, ?bool $enabled = null): array + { + $apiPath = str_replace( + [], + [], + '/backups/policies' + ); + + $apiParams = []; + $apiParams['policyId'] = $policyId; + $apiParams['services'] = $services; + $apiParams['retention'] = $retention; + $apiParams['schedule'] = $schedule; + + if (!is_null($name)) { + $apiParams['name'] = $name; + } + $apiParams['resourceId'] = $resourceId; + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get a backup policy using it's ID. + * + * @param string $policyId + * @throws AppwriteException + * @return array + */ + public function getPolicy(string $policyId): array + { + $apiPath = str_replace( + ['{policyId}'], + [$policyId], + '/backups/policies/{policyId}' + ); + + $apiParams = []; + $apiParams['policyId'] = $policyId; + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update an existing policy using it's ID. + * + * @param string $policyId + * @param ?string $name + * @param ?int $retention + * @param ?string $schedule + * @param ?bool $enabled + * @throws AppwriteException + * @return array + */ + public function updatePolicy(string $policyId, ?string $name = null, ?int $retention = null, ?string $schedule = null, ?bool $enabled = null): array + { + $apiPath = str_replace( + ['{policyId}'], + [$policyId], + '/backups/policies/{policyId}' + ); + + $apiParams = []; + $apiParams['policyId'] = $policyId; + $apiParams['name'] = $name; + $apiParams['retention'] = $retention; + + if (!is_null($schedule)) { + $apiParams['schedule'] = $schedule; + } + $apiParams['enabled'] = $enabled; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Delete a policy using it's ID. + * + * @param string $policyId + * @throws AppwriteException + * @return string + */ + public function deletePolicy(string $policyId): string + { + $apiPath = str_replace( + ['{policyId}'], + [$policyId], + '/backups/policies/{policyId}' + ); + + $apiParams = []; + $apiParams['policyId'] = $policyId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create and trigger a new restoration for a backup on a project. + * + * @param string $archiveId + * @param array $services + * @param ?string $newResourceId + * @param ?string $newResourceName + * @throws AppwriteException + * @return array + */ + public function createRestoration(string $archiveId, array $services, ?string $newResourceId = null, ?string $newResourceName = null): array + { + $apiPath = str_replace( + [], + [], + '/backups/restoration' + ); + + $apiParams = []; + $apiParams['archiveId'] = $archiveId; + $apiParams['services'] = $services; + + if (!is_null($newResourceId)) { + $apiParams['newResourceId'] = $newResourceId; + } + + if (!is_null($newResourceName)) { + $apiParams['newResourceName'] = $newResourceName; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * List all backup restorations for a project. + * + * @param ?array $queries + * @throws AppwriteException + * @return array + */ + public function listRestorations(?array $queries = null): array + { + $apiPath = str_replace( + [], + [], + '/backups/restorations' + ); + + $apiParams = []; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get the current status of a backup restoration. + * + * @param string $restorationId + * @throws AppwriteException + * @return array + */ + public function getRestoration(string $restorationId): array + { + $apiPath = str_replace( + ['{restorationId}'], + [$restorationId], + '/backups/restorations/{restorationId}' + ); + + $apiParams = []; + $apiParams['restorationId'] = $restorationId; + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } +} \ No newline at end of file diff --git a/src/Appwrite/Services/Databases.php b/src/Appwrite/Services/Databases.php index e9796fa1..53a56a33 100644 --- a/src/Appwrite/Services/Databases.php +++ b/src/Appwrite/Services/Databases.php @@ -2244,7 +2244,7 @@ public function getDocument(string $databaseId, string $collectionId, string $do * @param string $databaseId * @param string $collectionId * @param string $documentId - * @param array $data + * @param ?array $data * @param ?array $permissions * @param ?string $transactionId * @throws AppwriteException @@ -2253,7 +2253,7 @@ public function getDocument(string $databaseId, string $collectionId, string $do * @deprecated This API has been deprecated since 1.8.0. Please use `upsertRow` instead. * @see TablesDB::upsertRow */ - public function upsertDocument(string $databaseId, string $collectionId, string $documentId, array $data, ?array $permissions = null, ?string $transactionId = null): array + public function upsertDocument(string $databaseId, string $collectionId, string $documentId, ?array $data = null, ?array $permissions = null, ?string $transactionId = null): array { $apiPath = str_replace( ['{databaseId}', '{collectionId}', '{documentId}'], @@ -2265,7 +2265,10 @@ public function upsertDocument(string $databaseId, string $collectionId, string $apiParams['databaseId'] = $databaseId; $apiParams['collectionId'] = $collectionId; $apiParams['documentId'] = $documentId; - $apiParams['data'] = $data; + + if (!is_null($data)) { + $apiParams['data'] = $data; + } $apiParams['permissions'] = $permissions; $apiParams['transactionId'] = $transactionId; diff --git a/src/Appwrite/Services/Functions.php b/src/Appwrite/Services/Functions.php index 0279cb7b..42e80d5a 100644 --- a/src/Appwrite/Services/Functions.php +++ b/src/Appwrite/Services/Functions.php @@ -485,7 +485,7 @@ public function listDeployments(string $functionId, ?array $queries = null, ?str * @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}'], @@ -552,7 +552,7 @@ public function createDeployment(string $functionId, InputFile $code, bool $acti fseek($handle, $start); $chunk = @fread($handle, Client::CHUNK_SIZE); } else { - $chunk = substr($file->getData(), $start, Client::CHUNK_SIZE); + $chunk = substr($code->getData(), $start, Client::CHUNK_SIZE); } $apiParams['code'] = new \CURLFile('data://' . $mimeType . ';base64,' . base64_encode($chunk), $mimeType, $postedName); $apiHeaders['content-range'] = 'bytes ' . ($counter * Client::CHUNK_SIZE) . '-' . min(((($counter * Client::CHUNK_SIZE) + Client::CHUNK_SIZE) - 1), $size - 1) . '/' . $size; diff --git a/src/Appwrite/Services/Health.php b/src/Appwrite/Services/Health.php index 86183b47..49552432 100644 --- a/src/Appwrite/Services/Health.php +++ b/src/Appwrite/Services/Health.php @@ -177,6 +177,68 @@ public function getPubSub(): array ); } + /** + * Get billing project aggregation queue. + * + * @param ?int $threshold + * @throws AppwriteException + * @return array + */ + public function getQueueBillingProjectAggregation(?int $threshold = null): array + { + $apiPath = str_replace( + [], + [], + '/health/queue/billing-project-aggregation' + ); + + $apiParams = []; + + if (!is_null($threshold)) { + $apiParams['threshold'] = $threshold; + } + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get billing team aggregation queue. + * + * @param ?int $threshold + * @throws AppwriteException + * @return array + */ + public function getQueueBillingTeamAggregation(?int $threshold = null): array + { + $apiPath = str_replace( + [], + [], + '/health/queue/billing-team-aggregation' + ); + + $apiParams = []; + + if (!is_null($threshold)) { + $apiParams['threshold'] = $threshold; + } + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * Get the number of builds that are waiting to be processed in the Appwrite * internal queue server. @@ -209,6 +271,37 @@ public function getQueueBuilds(?int $threshold = null): array ); } + /** + * Get the priority builds queue size. + * + * @param ?int $threshold + * @throws AppwriteException + * @return array + */ + public function getQueuePriorityBuilds(?int $threshold = null): array + { + $apiPath = str_replace( + [], + [], + '/health/queue/builds-priority' + ); + + $apiParams = []; + + if (!is_null($threshold)) { + $apiParams['threshold'] = $threshold; + } + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * Get the number of certificates that are waiting to be issued against * [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue @@ -505,6 +598,37 @@ public function getQueueMigrations(?int $threshold = null): array ); } + /** + * Get region manager queue. + * + * @param ?int $threshold + * @throws AppwriteException + * @return array + */ + public function getQueueRegionManager(?int $threshold = null): array + { + $apiPath = str_replace( + [], + [], + '/health/queue/region-manager' + ); + + $apiParams = []; + + if (!is_null($threshold)) { + $apiParams['threshold'] = $threshold; + } + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * Get the number of metrics that are waiting to be processed in the Appwrite * stats resources queue. @@ -569,6 +693,37 @@ public function getQueueUsage(?int $threshold = null): array ); } + /** + * Get threats queue. + * + * @param ?int $threshold + * @throws AppwriteException + * @return array + */ + public function getQueueThreats(?int $threshold = null): array + { + $apiPath = str_replace( + [], + [], + '/health/queue/threats' + ); + + $apiParams = []; + + if (!is_null($threshold)) { + $apiParams['threshold'] = $threshold; + } + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * Get the number of webhooks that are waiting to be processed in the Appwrite * internal queue server. diff --git a/src/Appwrite/Services/Organizations.php b/src/Appwrite/Services/Organizations.php new file mode 100644 index 00000000..9e340abd --- /dev/null +++ b/src/Appwrite/Services/Organizations.php @@ -0,0 +1,74 @@ +client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get estimation for deleting an organization. + * + * @param string $organizationId + * @throws AppwriteException + * @return array + */ + public function estimationDeleteOrganization(string $organizationId): array + { + $apiPath = str_replace( + ['{organizationId}'], + [$organizationId], + '/organizations/{organizationId}/estimations/delete-organization' + ); + + $apiParams = []; + $apiParams['organizationId'] = $organizationId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } +} \ No newline at end of file diff --git a/src/Appwrite/Services/Sites.php b/src/Appwrite/Services/Sites.php index cabd1a60..50788f96 100644 --- a/src/Appwrite/Services/Sites.php +++ b/src/Appwrite/Services/Sites.php @@ -475,7 +475,7 @@ public function listDeployments(string $siteId, ?array $queries = null, ?string * @throws AppwriteException * @return array */ - public function createDeployment(string $siteId, InputFile $code, bool $activate, ?string $installCommand = null, ?string $buildCommand = null, ?string $outputDirectory = null, callable $onProgress = null): array + public function createDeployment(string $siteId, InputFile $code, bool $activate, ?string $installCommand = null, ?string $buildCommand = null, ?string $outputDirectory = null, ?callable $onProgress = null): array { $apiPath = str_replace( ['{siteId}'], @@ -546,7 +546,7 @@ public function createDeployment(string $siteId, InputFile $code, bool $activate fseek($handle, $start); $chunk = @fread($handle, Client::CHUNK_SIZE); } else { - $chunk = substr($file->getData(), $start, Client::CHUNK_SIZE); + $chunk = substr($code->getData(), $start, Client::CHUNK_SIZE); } $apiParams['code'] = new \CURLFile('data://' . $mimeType . ';base64,' . base64_encode($chunk), $mimeType, $postedName); $apiHeaders['content-range'] = 'bytes ' . ($counter * Client::CHUNK_SIZE) . '-' . min(((($counter * Client::CHUNK_SIZE) + Client::CHUNK_SIZE) - 1), $size - 1) . '/' . $size; diff --git a/src/Appwrite/Services/Storage.php b/src/Appwrite/Services/Storage.php index 67a76116..199cd61c 100644 --- a/src/Appwrite/Services/Storage.php +++ b/src/Appwrite/Services/Storage.php @@ -334,7 +334,7 @@ public function listFiles(string $bucketId, ?array $queries = null, ?string $sea * @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}'], @@ -485,7 +485,10 @@ public function updateFile(string $bucketId, string $fileId, ?string $name = nul $apiParams = []; $apiParams['bucketId'] = $bucketId; $apiParams['fileId'] = $fileId; - $apiParams['name'] = $name; + + if (!is_null($name)) { + $apiParams['name'] = $name; + } $apiParams['permissions'] = $permissions; $apiHeaders = []; diff --git a/tests/Appwrite/IDTest.php b/tests/Appwrite/IDTest.php index 49143774..b12e8170 100644 --- a/tests/Appwrite/IDTest.php +++ b/tests/Appwrite/IDTest.php @@ -6,7 +6,8 @@ final class IDTest extends TestCase { public function testUnique(): void { - $this->assertSame('unique()', ID::unique()); + $id = ID::unique(); + $this->assertSame(20, strlen($id)); } public function testCustom(): void { diff --git a/tests/Appwrite/QueryTest.php b/tests/Appwrite/QueryTest.php index 283a867d..5f742936 100644 --- a/tests/Appwrite/QueryTest.php +++ b/tests/Appwrite/QueryTest.php @@ -37,169 +37,250 @@ function __construct(string $name) public function testBasicFilterEqual(): void { foreach($this->tests as $test) { - $this->assertSame( - "equal(\"attr\", $test->expectedValues)", - Query::equal('attr', $test->value), - $test->description, - ); + $query = json_decode(Query::equal('attr', $test->value), true); + $expected = json_decode($test->expectedValues, true); + $this->assertSame('attr', $query['attribute'], $test->description); + $this->assertSame($expected, $query['values'], $test->description); + $this->assertSame('equal', $query['method'], $test->description); } } public function testBasicFilterNotEqual(): void { foreach($this->tests as $test) { - $this->assertSame( - "notEqual(\"attr\", $test->expectedValues)", - Query::notEqual('attr', $test->value), - $test->description, - ); + $query = json_decode(Query::notEqual('attr', $test->value), true); + $expected = json_decode($test->expectedValues, true); + $this->assertSame('attr', $query['attribute'], $test->description); + $this->assertSame($expected, $query['values'], $test->description); + $this->assertSame('notEqual', $query['method'], $test->description); } } public function testBasicFilterLessThan(): void { foreach($this->tests as $test) { - $this->assertSame( - "lessThan(\"attr\", $test->expectedValues)", - Query::lessThan('attr', $test->value), - $test->description, - ); + $query = json_decode(Query::lessThan('attr', $test->value), true); + $expected = json_decode($test->expectedValues, true); + $this->assertSame('attr', $query['attribute'], $test->description); + $this->assertSame($expected, $query['values'], $test->description); + $this->assertSame('lessThan', $query['method'], $test->description); } } public function testBasicFilterLessThanEqual(): void { foreach($this->tests as $test) { - $this->assertSame( - "lessThanEqual(\"attr\", $test->expectedValues)", - Query::lessThanEqual('attr', $test->value), - $test->description, - ); + $query = json_decode(Query::lessThanEqual('attr', $test->value), true); + $expected = json_decode($test->expectedValues, true); + $this->assertSame('attr', $query['attribute'], $test->description); + $this->assertSame($expected, $query['values'], $test->description); + $this->assertSame('lessThanEqual', $query['method'], $test->description); } } public function testBasicFilterGreaterThan(): void { foreach($this->tests as $test) { - $this->assertSame( - "greaterThan(\"attr\", $test->expectedValues)", - Query::greaterThan('attr', $test->value), - $test->description, - ); + $query = json_decode(Query::greaterThan('attr', $test->value), true); + $expected = json_decode($test->expectedValues, true); + $this->assertSame('attr', $query['attribute'], $test->description); + $this->assertSame($expected, $query['values'], $test->description); + $this->assertSame('greaterThan', $query['method'], $test->description); } } public function testBasicFilterGreaterThanEqual(): void { foreach($this->tests as $test) { - $this->assertSame( - "greaterThanEqual(\"attr\", $test->expectedValues)", - Query::greaterThanEqual('attr', $test->value), - $test->description, - ); + $query = json_decode(Query::greaterThanEqual('attr', $test->value), true); + $expected = json_decode($test->expectedValues, true); + $this->assertSame('attr', $query['attribute'], $test->description); + $this->assertSame($expected, $query['values'], $test->description); + $this->assertSame('greaterThanEqual', $query['method'], $test->description); } } public function testSearch(): void { - $this->assertSame('search("attr", ["keyword1 keyword2"])', Query::search('attr', 'keyword1 keyword2')); + $query = json_decode(Query::search('attr', 'keyword1 keyword2'), true); + $this->assertSame('attr', $query['attribute']); + $this->assertSame(['keyword1 keyword2'], $query['values']); + $this->assertSame('search', $query['method']); } public function testIsNull(): void { - $this->assertSame('isNull("attr")', Query::isNull('attr')); + $query = json_decode(Query::isNull('attr'), true); + $this->assertSame('attr', $query['attribute']); + $this->assertNull($query['values'] ?? null); + $this->assertSame('isNull', $query['method']); } public function testIsNotNull(): void { - $this->assertSame('isNotNull("attr")', Query::isNotNull('attr')); + $query = json_decode(Query::isNotNull('attr'), true); + $this->assertSame('attr', $query['attribute']); + $this->assertNull($query['values'] ?? null); + $this->assertSame('isNotNull', $query['method']); } public function testBetweenWithIntegers(): void { - $this->assertSame('between("attr", 1, 2)', Query::between('attr', 1, 2)); + $query = json_decode(Query::between('attr', 1, 2), true); + $this->assertSame('attr', $query['attribute']); + $this->assertSame([1, 2], $query['values']); + $this->assertSame('between', $query['method']); } public function testBetweenWithDoubles(): void { - $this->assertSame('between("attr", 1, 2)', Query::between('attr', 1.0, 2.0)); + $query = json_decode(Query::between('attr', 1.0, 2.0), true); + $this->assertSame('attr', $query['attribute']); + $this->assertSame([1, 2], $query['values']); + $this->assertSame('between', $query['method']); } public function testBetweenWithStrings(): void { - $this->assertSame('between("attr", "a", "z")', Query::between('attr', 'a', 'z')); + $query = json_decode(Query::between('attr', 'a', 'z'), true); + $this->assertSame('attr', $query['attribute']); + $this->assertSame(['a', 'z'], $query['values']); + $this->assertSame('between', $query['method']); } public function testSelect(): void { - $this->assertSame('select(["attr1","attr2"])', Query::select(['attr1', 'attr2'])); + $query = json_decode(Query::select(['attr1', 'attr2']), true); + $this->assertNull($query['attribute'] ?? null); + $this->assertSame(['attr1', 'attr2'], $query['values']); + $this->assertSame('select', $query['method']); } public function testOrderAsc(): void { - $this->assertSame('orderAsc("attr")', Query::orderAsc('attr')); + $query = json_decode(Query::orderAsc('attr'), true); + $this->assertSame('attr', $query['attribute']); + $this->assertNull($query['values'] ?? null); + $this->assertSame('orderAsc', $query['method']); } public function testOrderDesc(): void { - $this->assertSame('orderDesc("attr")', Query::orderDesc('attr')); + $query = json_decode(Query::orderDesc('attr'), true); + $this->assertSame('attr', $query['attribute']); + $this->assertNull($query['values'] ?? null); + $this->assertSame('orderDesc', $query['method']); } public function testOrderRandom(): void { - $this->assertSame('{"method":"orderRandom"}', Query::orderRandom()); + $query = json_decode(Query::orderRandom(), true); + $this->assertNull($query['attribute'] ?? null); + $this->assertNull($query['values'] ?? null); + $this->assertSame('orderRandom', $query['method']); } public function testCursorBefore(): void { - $this->assertSame('cursorBefore("attr")', Query::cursorBefore('attr')); + $query = json_decode(Query::cursorBefore('attr'), true); + $this->assertNull($query['attribute'] ?? null); + $this->assertSame(['attr'], $query['values']); + $this->assertSame('cursorBefore', $query['method']); } public function testCursorAfter(): void { - $this->assertSame('cursorAfter("attr")', Query::cursorAfter('attr')); + $query = json_decode(Query::cursorAfter('attr'), true); + $this->assertNull($query['attribute'] ?? null); + $this->assertSame(['attr'], $query['values']); + $this->assertSame('cursorAfter', $query['method']); } public function testLimit(): void { - $this->assertSame('limit(1)', Query::limit(1)); + $query = json_decode(Query::limit(1), true); + $this->assertNull($query['attribute'] ?? null); + $this->assertSame([1], $query['values']); + $this->assertSame('limit', $query['method']); } public function testOffset(): void { - $this->assertSame('offset(1)', Query::offset(1)); + $query = json_decode(Query::offset(1), true); + $this->assertNull($query['attribute'] ?? null); + $this->assertSame([1], $query['values']); + $this->assertSame('offset', $query['method']); } public function testNotContains(): void { - $this->assertSame('notContains("attr", ["value"])', Query::notContains('attr', 'value')); + $query = json_decode(Query::notContains('attr', 'value'), true); + $this->assertSame('attr', $query['attribute']); + $this->assertSame(['value'], $query['values']); + $this->assertSame('notContains', $query['method']); } public function testNotSearch(): void { - $this->assertSame('notSearch("attr", ["keyword1 keyword2"])', Query::notSearch('attr', 'keyword1 keyword2')); + $query = json_decode(Query::notSearch('attr', 'keyword1 keyword2'), true); + $this->assertSame('attr', $query['attribute']); + $this->assertSame(['keyword1 keyword2'], $query['values']); + $this->assertSame('notSearch', $query['method']); } public function testNotBetweenWithIntegers(): void { - $this->assertSame('notBetween("attr", 1, 2)', Query::notBetween('attr', 1, 2)); + $query = json_decode(Query::notBetween('attr', 1, 2), true); + $this->assertSame('attr', $query['attribute']); + $this->assertSame([1, 2], $query['values']); + $this->assertSame('notBetween', $query['method']); } public function testNotBetweenWithDoubles(): void { - $this->assertSame('notBetween("attr", 1, 2)', Query::notBetween('attr', 1.0, 2.0)); + $query = json_decode(Query::notBetween('attr', 1.0, 2.0), true); + $this->assertSame('attr', $query['attribute']); + $this->assertSame([1, 2], $query['values']); + $this->assertSame('notBetween', $query['method']); } public function testNotBetweenWithStrings(): void { - $this->assertSame('notBetween("attr", "a", "z")', Query::notBetween('attr', 'a', 'z')); + $query = json_decode(Query::notBetween('attr', 'a', 'z'), true); + $this->assertSame('attr', $query['attribute']); + $this->assertSame(['a', 'z'], $query['values']); + $this->assertSame('notBetween', $query['method']); } public function testNotStartsWith(): void { - $this->assertSame('notStartsWith("attr", ["prefix"])', Query::notStartsWith('attr', 'prefix')); + $query = json_decode(Query::notStartsWith('attr', 'prefix'), true); + $this->assertSame('attr', $query['attribute']); + $this->assertSame(['prefix'], $query['values']); + $this->assertSame('notStartsWith', $query['method']); } public function testNotEndsWith(): void { - $this->assertSame('notEndsWith("attr", ["suffix"])', Query::notEndsWith('attr', 'suffix')); + $query = json_decode(Query::notEndsWith('attr', 'suffix'), true); + $this->assertSame('attr', $query['attribute']); + $this->assertSame(['suffix'], $query['values']); + $this->assertSame('notEndsWith', $query['method']); } public function testCreatedBefore(): void { - $this->assertSame('lessThan("$createdAt", ["2023-01-01"])', Query::createdBefore('2023-01-01')); + $query = json_decode(Query::createdBefore('2023-01-01'), true); + $this->assertSame('$createdAt', $query['attribute']); + $this->assertSame(['2023-01-01'], $query['values']); + $this->assertSame('lessThan', $query['method']); } public function testCreatedAfter(): void { - $this->assertSame('greaterThan("$createdAt", ["2023-01-01"])', Query::createdAfter('2023-01-01')); + $query = json_decode(Query::createdAfter('2023-01-01'), true); + $this->assertSame('$createdAt', $query['attribute']); + $this->assertSame(['2023-01-01'], $query['values']); + $this->assertSame('greaterThan', $query['method']); } public function testCreatedBetween(): void { - $this->assertSame('between("$createdAt", ["2023-01-01","2023-12-31"])', Query::createdBetween('2023-01-01', '2023-12-31')); + $query = json_decode(Query::createdBetween('2023-01-01', '2023-12-31'), true); + $this->assertSame('$createdAt', $query['attribute']); + $this->assertSame(['2023-01-01', '2023-12-31'], $query['values']); + $this->assertSame('between', $query['method']); } public function testUpdatedBefore(): void { - $this->assertSame('lessThan("$updatedAt", ["2023-01-01"])', Query::updatedBefore('2023-01-01')); + $query = json_decode(Query::updatedBefore('2023-01-01'), true); + $this->assertSame('$updatedAt', $query['attribute']); + $this->assertSame(['2023-01-01'], $query['values']); + $this->assertSame('lessThan', $query['method']); } public function testUpdatedAfter(): void { - $this->assertSame('greaterThan("$updatedAt", ["2023-01-01"])', Query::updatedAfter('2023-01-01')); + $query = json_decode(Query::updatedAfter('2023-01-01'), true); + $this->assertSame('$updatedAt', $query['attribute']); + $this->assertSame(['2023-01-01'], $query['values']); + $this->assertSame('greaterThan', $query['method']); } public function testUpdatedBetween(): void { - $this->assertSame('between("$updatedAt", ["2023-01-01","2023-12-31"])', Query::updatedBetween('2023-01-01', '2023-12-31')); + $query = json_decode(Query::updatedBetween('2023-01-01', '2023-12-31'), true); + $this->assertSame('$updatedAt', $query['attribute']); + $this->assertSame(['2023-01-01', '2023-12-31'], $query['values']); + $this->assertSame('between', $query['method']); } } diff --git a/tests/Appwrite/Services/AccountTest.php b/tests/Appwrite/Services/AccountTest.php index 28ced557..d38511b9 100644 --- a/tests/Appwrite/Services/AccountTest.php +++ b/tests/Appwrite/Services/AccountTest.php @@ -6,6 +6,9 @@ use Appwrite\InputFile; use Mockery; use PHPUnit\Framework\TestCase; +use Appwrite\Enums\AuthenticatorType; +use Appwrite\Enums\AuthenticationFactor; +use Appwrite\Enums\OAuthProvider; final class AccountTest extends TestCase { private $client; @@ -34,8 +37,7 @@ public function testMethodGet(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -65,8 +67,7 @@ public function testMethodCreate(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -99,8 +100,7 @@ public function testMethodUpdateEmail(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -118,8 +118,7 @@ public function testMethodListIdentities(): void { $data = array( "total" => 5, - "identities" => array(),); - + "identities" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -135,7 +134,6 @@ public function testMethodDeleteIdentity(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -150,8 +148,7 @@ public function testMethodDeleteIdentity(): void { public function testMethodCreateJWT(): void { $data = array( - "jwt" => "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",); - + "jwt" => "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -167,8 +164,7 @@ public function testMethodListLogs(): void { $data = array( "total" => 5, - "logs" => array(),); - + "logs" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -198,8 +194,7 @@ public function testMethodUpdateMFA(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -216,15 +211,14 @@ public function testMethodCreateMFAAuthenticator(): void { $data = array( "secret" => "1", - "uri" => "1",); - + "uri" => "1"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); $response = $this->account->createMFAAuthenticator( - "totp" + AuthenticatorType::TOTP() ); $this->assertSame($data, $response); @@ -248,15 +242,14 @@ public function testMethodUpdateMFAAuthenticator(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); $response = $this->account->updateMFAAuthenticator( - "totp", + AuthenticatorType::TOTP(), "" ); @@ -267,13 +260,12 @@ public function testMethodDeleteMFAAuthenticator(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); $response = $this->account->deleteMFAAuthenticator( - "totp" + AuthenticatorType::TOTP() ); $this->assertSame($data, $response); @@ -285,15 +277,14 @@ public function testMethodCreateMFAChallenge(): void { "\$id" => "bb8ea5c16897e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "userId" => "5e5ea5c168bb8", - "expire" => "2020-10-15T06:38:00.000+00:00",); - + "expire" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); $response = $this->account->createMFAChallenge( - "email" + AuthenticationFactor::EMAIL() ); $this->assertSame($data, $response); @@ -330,8 +321,7 @@ public function testMethodUpdateMFAChallenge(): void { "current" => true, "factors" => array(), "secret" => "5e5bb8c16897e", - "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -351,8 +341,7 @@ public function testMethodListMFAFactors(): void { "totp" => true, "phone" => true, "email" => true, - "recoveryCode" => true,); - + "recoveryCode" => true); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -367,8 +356,7 @@ public function testMethodListMFAFactors(): void { public function testMethodGetMFARecoveryCodes(): void { $data = array( - "recoveryCodes" => array(),); - + "recoveryCodes" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -383,8 +371,7 @@ public function testMethodGetMFARecoveryCodes(): void { public function testMethodCreateMFARecoveryCodes(): void { $data = array( - "recoveryCodes" => array(),); - + "recoveryCodes" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -399,8 +386,7 @@ public function testMethodCreateMFARecoveryCodes(): void { public function testMethodUpdateMFARecoveryCodes(): void { $data = array( - "recoveryCodes" => array(),); - + "recoveryCodes" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -430,8 +416,7 @@ public function testMethodUpdateName(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -462,8 +447,7 @@ public function testMethodUpdatePassword(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -494,8 +478,7 @@ public function testMethodUpdatePhone(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -513,7 +496,6 @@ public function testMethodGetPrefs(): void { $data = array(); - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -542,8 +524,7 @@ public function testMethodUpdatePrefs(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -564,8 +545,7 @@ public function testMethodCreateRecovery(): void { "userId" => "5e5ea5c168bb8", "secret" => "", "expire" => "2020-10-15T06:38:00.000+00:00", - "phrase" => "Golden Fox",); - + "phrase" => "Golden Fox"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -587,8 +567,7 @@ public function testMethodUpdateRecovery(): void { "userId" => "5e5ea5c168bb8", "secret" => "", "expire" => "2020-10-15T06:38:00.000+00:00", - "phrase" => "Golden Fox",); - + "phrase" => "Golden Fox"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -607,8 +586,7 @@ public function testMethodListSessions(): void { $data = array( "total" => 5, - "sessions" => array(),); - + "sessions" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -624,7 +602,6 @@ public function testMethodDeleteSessions(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -666,8 +643,7 @@ public function testMethodCreateAnonymousSession(): void { "current" => true, "factors" => array(), "secret" => "5e5bb8c16897e", - "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -710,8 +686,7 @@ public function testMethodCreateEmailPasswordSession(): void { "current" => true, "factors" => array(), "secret" => "5e5bb8c16897e", - "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -756,8 +731,7 @@ public function testMethodUpdateMagicURLSession(): void { "current" => true, "factors" => array(), "secret" => "5e5bb8c16897e", - "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -802,8 +776,7 @@ public function testMethodUpdatePhoneSession(): void { "current" => true, "factors" => array(), "secret" => "5e5bb8c16897e", - "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -848,8 +821,7 @@ public function testMethodCreateSession(): void { "current" => true, "factors" => array(), "secret" => "5e5bb8c16897e", - "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -894,8 +866,7 @@ public function testMethodGetSession(): void { "current" => true, "factors" => array(), "secret" => "5e5bb8c16897e", - "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -939,8 +910,7 @@ public function testMethodUpdateSession(): void { "current" => true, "factors" => array(), "secret" => "5e5bb8c16897e", - "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -957,7 +927,6 @@ public function testMethodDeleteSession(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -987,8 +956,7 @@ public function testMethodUpdateStatus(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1008,8 +976,7 @@ public function testMethodCreateEmailToken(): void { "userId" => "5e5ea5c168bb8", "secret" => "", "expire" => "2020-10-15T06:38:00.000+00:00", - "phrase" => "Golden Fox",); - + "phrase" => "Golden Fox"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1031,8 +998,7 @@ public function testMethodCreateMagicURLToken(): void { "userId" => "5e5ea5c168bb8", "secret" => "", "expire" => "2020-10-15T06:38:00.000+00:00", - "phrase" => "Golden Fox",); - + "phrase" => "Golden Fox"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1048,15 +1014,14 @@ public function testMethodCreateMagicURLToken(): void { public function testMethodCreateOAuth2Token(): void { - $data = array(); - + $data = ''; $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); $response = $this->account->createOAuth2Token( - "amazon" + OAuthProvider::AMAZON() ); $this->assertSame($data, $response); @@ -1070,8 +1035,7 @@ public function testMethodCreatePhoneToken(): void { "userId" => "5e5ea5c168bb8", "secret" => "", "expire" => "2020-10-15T06:38:00.000+00:00", - "phrase" => "Golden Fox",); - + "phrase" => "Golden Fox"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1093,8 +1057,7 @@ public function testMethodCreateEmailVerification(): void { "userId" => "5e5ea5c168bb8", "secret" => "", "expire" => "2020-10-15T06:38:00.000+00:00", - "phrase" => "Golden Fox",); - + "phrase" => "Golden Fox"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1115,8 +1078,7 @@ public function testMethodCreateVerification(): void { "userId" => "5e5ea5c168bb8", "secret" => "", "expire" => "2020-10-15T06:38:00.000+00:00", - "phrase" => "Golden Fox",); - + "phrase" => "Golden Fox"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1137,8 +1099,7 @@ public function testMethodUpdateEmailVerification(): void { "userId" => "5e5ea5c168bb8", "secret" => "", "expire" => "2020-10-15T06:38:00.000+00:00", - "phrase" => "Golden Fox",); - + "phrase" => "Golden Fox"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1160,8 +1121,7 @@ public function testMethodUpdateVerification(): void { "userId" => "5e5ea5c168bb8", "secret" => "", "expire" => "2020-10-15T06:38:00.000+00:00", - "phrase" => "Golden Fox",); - + "phrase" => "Golden Fox"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1183,8 +1143,7 @@ public function testMethodCreatePhoneVerification(): void { "userId" => "5e5ea5c168bb8", "secret" => "", "expire" => "2020-10-15T06:38:00.000+00:00", - "phrase" => "Golden Fox",); - + "phrase" => "Golden Fox"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1204,8 +1163,7 @@ public function testMethodUpdatePhoneVerification(): void { "userId" => "5e5ea5c168bb8", "secret" => "", "expire" => "2020-10-15T06:38:00.000+00:00", - "phrase" => "Golden Fox",); - + "phrase" => "Golden Fox"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) diff --git a/tests/Appwrite/Services/AvatarsTest.php b/tests/Appwrite/Services/AvatarsTest.php index ece3c24f..d0c630c6 100644 --- a/tests/Appwrite/Services/AvatarsTest.php +++ b/tests/Appwrite/Services/AvatarsTest.php @@ -6,6 +6,12 @@ use Appwrite\InputFile; use Mockery; use PHPUnit\Framework\TestCase; +use Appwrite\Enums\Browser; +use Appwrite\Enums\CreditCard; +use Appwrite\Enums\Flag; +use Appwrite\Enums\Theme; +use Appwrite\Enums\Timezone; +use Appwrite\Enums\ImageFormat; final class AvatarsTest extends TestCase { private $client; @@ -20,13 +26,12 @@ public function testMethodGetBrowser(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); $response = $this->avatars->getBrowser( - "aa" + Browser::AVANTBROWSER() ); $this->assertSame($data, $response); @@ -36,13 +41,12 @@ public function testMethodGetCreditCard(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); $response = $this->avatars->getCreditCard( - "amex" + CreditCard::AMERICANEXPRESS() ); $this->assertSame($data, $response); @@ -52,7 +56,6 @@ public function testMethodGetFavicon(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -68,13 +71,12 @@ public function testMethodGetFlag(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); $response = $this->avatars->getFlag( - "af" + Flag::AFGHANISTAN() ); $this->assertSame($data, $response); @@ -84,7 +86,6 @@ public function testMethodGetImage(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -100,7 +101,6 @@ public function testMethodGetInitials(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -115,7 +115,6 @@ public function testMethodGetQR(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -131,7 +130,6 @@ public function testMethodGetScreenshot(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); diff --git a/tests/Appwrite/Services/BackupsTest.php b/tests/Appwrite/Services/BackupsTest.php new file mode 100644 index 00000000..2c76ddf4 --- /dev/null +++ b/tests/Appwrite/Services/BackupsTest.php @@ -0,0 +1,275 @@ +client = Mockery::mock(Client::class); + $this->backups = new Backups($this->client); + } + + public function testMethodListArchives(): void { + + $data = array( + "total" => 5, + "archives" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->backups->listArchives( + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateArchive(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "policyId" => "did8jx6ws45jana098ab7", + "size" => 100000, + "status" => "completed", + "startedAt" => "2020-10-15T06:38:00.000+00:00", + "migrationId" => "did8jx6ws45jana098ab7", + "services" => array(), + "resources" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->backups->createArchive( + array() + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetArchive(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "policyId" => "did8jx6ws45jana098ab7", + "size" => 100000, + "status" => "completed", + "startedAt" => "2020-10-15T06:38:00.000+00:00", + "migrationId" => "did8jx6ws45jana098ab7", + "services" => array(), + "resources" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->backups->getArchive( + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodDeleteArchive(): void { + + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->backups->deleteArchive( + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodListPolicies(): void { + + $data = array( + "total" => 5, + "policies" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->backups->listPolicies( + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreatePolicy(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "name" => "Hourly backups", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "services" => array(), + "resources" => array(), + "retention" => 7, + "schedule" => "0 * * * *", + "enabled" => true); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->backups->createPolicy( + "", + array(), + 1, + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetPolicy(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "name" => "Hourly backups", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "services" => array(), + "resources" => array(), + "retention" => 7, + "schedule" => "0 * * * *", + "enabled" => true); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->backups->getPolicy( + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdatePolicy(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "name" => "Hourly backups", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "services" => array(), + "resources" => array(), + "retention" => 7, + "schedule" => "0 * * * *", + "enabled" => true); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->backups->updatePolicy( + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodDeletePolicy(): void { + + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->backups->deletePolicy( + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateRestoration(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "archiveId" => "did8jx6ws45jana098ab7", + "policyId" => "did8jx6ws45jana098ab7", + "status" => "completed", + "startedAt" => "2020-10-15T06:38:00.000+00:00", + "migrationId" => "did8jx6ws45jana098ab7", + "services" => array(), + "resources" => array(), + "options" => "{databases.database[{oldId, newId, newName}]}"); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->backups->createRestoration( + "", + array() + ); + + $this->assertSame($data, $response); + } + + public function testMethodListRestorations(): void { + + $data = array( + "total" => 5, + "restorations" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->backups->listRestorations( + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetRestoration(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "archiveId" => "did8jx6ws45jana098ab7", + "policyId" => "did8jx6ws45jana098ab7", + "status" => "completed", + "startedAt" => "2020-10-15T06:38:00.000+00:00", + "migrationId" => "did8jx6ws45jana098ab7", + "services" => array(), + "resources" => array(), + "options" => "{databases.database[{oldId, newId, newName}]}"); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->backups->getRestoration( + "" + ); + + $this->assertSame($data, $response); + } + +} diff --git a/tests/Appwrite/Services/DatabasesTest.php b/tests/Appwrite/Services/DatabasesTest.php index 8aa6a6b7..10b7960c 100644 --- a/tests/Appwrite/Services/DatabasesTest.php +++ b/tests/Appwrite/Services/DatabasesTest.php @@ -6,6 +6,9 @@ use Appwrite\InputFile; use Mockery; use PHPUnit\Framework\TestCase; +use Appwrite\Enums\RelationshipType; +use Appwrite\Enums\RelationMutate; +use Appwrite\Enums\IndexType; final class DatabasesTest extends TestCase { private $client; @@ -20,8 +23,7 @@ public function testMethodList(): void { $data = array( "total" => 5, - "databases" => array(),); - + "databases" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -41,8 +43,9 @@ public function testMethodCreate(): void { "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "enabled" => true, - "type" => "legacy",); - + "type" => "legacy", + "policies" => array(), + "archives" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -60,8 +63,7 @@ public function testMethodListTransactions(): void { $data = array( "total" => 5, - "transactions" => array(),); - + "transactions" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -81,8 +83,7 @@ public function testMethodCreateTransaction(): void { "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "status" => "pending", "operations" => 5, - "expiresAt" => "2020-10-15T06:38:00.000+00:00",); - + "expiresAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -102,8 +103,7 @@ public function testMethodGetTransaction(): void { "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "status" => "pending", "operations" => 5, - "expiresAt" => "2020-10-15T06:38:00.000+00:00",); - + "expiresAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -124,8 +124,7 @@ public function testMethodUpdateTransaction(): void { "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "status" => "pending", "operations" => 5, - "expiresAt" => "2020-10-15T06:38:00.000+00:00",); - + "expiresAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -142,7 +141,6 @@ public function testMethodDeleteTransaction(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -162,8 +160,7 @@ public function testMethodCreateOperations(): void { "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "status" => "pending", "operations" => 5, - "expiresAt" => "2020-10-15T06:38:00.000+00:00",); - + "expiresAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -184,8 +181,9 @@ public function testMethodGet(): void { "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "enabled" => true, - "type" => "legacy",); - + "type" => "legacy", + "policies" => array(), + "archives" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -206,8 +204,9 @@ public function testMethodUpdate(): void { "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "enabled" => true, - "type" => "legacy",); - + "type" => "legacy", + "policies" => array(), + "archives" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -225,7 +224,6 @@ public function testMethodDelete(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -241,8 +239,7 @@ public function testMethodListCollections(): void { $data = array( "total" => 5, - "collections" => array(),); - + "collections" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -267,8 +264,7 @@ public function testMethodCreateCollection(): void { "enabled" => true, "documentSecurity" => true, "attributes" => array(), - "indexes" => array(),); - + "indexes" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -295,8 +291,7 @@ public function testMethodGetCollection(): void { "enabled" => true, "documentSecurity" => true, "attributes" => array(), - "indexes" => array(),); - + "indexes" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -322,8 +317,7 @@ public function testMethodUpdateCollection(): void { "enabled" => true, "documentSecurity" => true, "attributes" => array(), - "indexes" => array(),); - + "indexes" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -342,7 +336,6 @@ public function testMethodDeleteCollection(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -359,8 +352,7 @@ public function testMethodListAttributes(): void { $data = array( "total" => 5, - "attributes" => array(),); - + "attributes" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -383,8 +375,7 @@ public function testMethodCreateBooleanAttribute(): void { "error" => "string", "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -409,8 +400,7 @@ public function testMethodUpdateBooleanAttribute(): void { "error" => "string", "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -437,8 +427,7 @@ public function testMethodCreateDatetimeAttribute(): void { "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "format" => "datetime",); - + "format" => "datetime"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -464,8 +453,7 @@ public function testMethodUpdateDatetimeAttribute(): void { "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "format" => "datetime",); - + "format" => "datetime"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -492,8 +480,7 @@ public function testMethodCreateEmailAttribute(): void { "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "format" => "email",); - + "format" => "email"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -519,8 +506,7 @@ public function testMethodUpdateEmailAttribute(): void { "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "format" => "email",); - + "format" => "email"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -548,8 +534,7 @@ public function testMethodCreateEnumAttribute(): void { "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "elements" => array(), - "format" => "enum",); - + "format" => "enum"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -577,8 +562,7 @@ public function testMethodUpdateEnumAttribute(): void { "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "elements" => array(), - "format" => "enum",); - + "format" => "enum"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -605,8 +589,7 @@ public function testMethodCreateFloatAttribute(): void { "error" => "string", "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -631,8 +614,7 @@ public function testMethodUpdateFloatAttribute(): void { "error" => "string", "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -658,8 +640,7 @@ public function testMethodCreateIntegerAttribute(): void { "error" => "string", "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -684,8 +665,7 @@ public function testMethodUpdateIntegerAttribute(): void { "error" => "string", "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -712,8 +692,7 @@ public function testMethodCreateIpAttribute(): void { "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "format" => "ip",); - + "format" => "ip"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -739,8 +718,7 @@ public function testMethodUpdateIpAttribute(): void { "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "format" => "ip",); - + "format" => "ip"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -766,8 +744,7 @@ public function testMethodCreateLineAttribute(): void { "error" => "string", "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -792,8 +769,7 @@ public function testMethodUpdateLineAttribute(): void { "error" => "string", "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -818,8 +794,7 @@ public function testMethodCreatePointAttribute(): void { "error" => "string", "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -844,8 +819,7 @@ public function testMethodUpdatePointAttribute(): void { "error" => "string", "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -870,8 +844,7 @@ public function testMethodCreatePolygonAttribute(): void { "error" => "string", "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -896,8 +869,7 @@ public function testMethodUpdatePolygonAttribute(): void { "error" => "string", "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -928,8 +900,7 @@ public function testMethodCreateRelationshipAttribute(): void { "twoWay" => true, "twoWayKey" => "string", "onDelete" => "restrict|cascade|setNull", - "side" => "parent|child",); - + "side" => "parent|child"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -939,7 +910,7 @@ public function testMethodCreateRelationshipAttribute(): void { "", "", "", - "oneToOne" + RelationshipType::ONETOONE() ); $this->assertSame($data, $response); @@ -955,8 +926,7 @@ public function testMethodCreateStringAttribute(): void { "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "size" => 128,); - + "size" => 128); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -983,8 +953,7 @@ public function testMethodUpdateStringAttribute(): void { "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "size" => 128,); - + "size" => 128); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1011,8 +980,7 @@ public function testMethodCreateUrlAttribute(): void { "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "format" => "url",); - + "format" => "url"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1038,8 +1006,7 @@ public function testMethodUpdateUrlAttribute(): void { "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "format" => "url",); - + "format" => "url"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1058,8 +1025,14 @@ public function testMethodUpdateUrlAttribute(): void { public function testMethodGetAttribute(): void { - $data = ''; - + $data = array( + "key" => "isEnabled", + "type" => "boolean", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1078,7 +1051,6 @@ public function testMethodDeleteAttribute(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -1107,8 +1079,7 @@ public function testMethodUpdateRelationshipAttribute(): void { "twoWay" => true, "twoWayKey" => "string", "onDelete" => "restrict|cascade|setNull", - "side" => "parent|child",); - + "side" => "parent|child"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1127,8 +1098,7 @@ public function testMethodListDocuments(): void { $data = array( "total" => 5, - "documents" => array(),); - + "documents" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1151,8 +1121,7 @@ public function testMethodCreateDocument(): void { "\$databaseId" => "5e5ea5c15117e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(),); - + "\$permissions" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1172,8 +1141,7 @@ public function testMethodCreateDocuments(): void { $data = array( "total" => 5, - "documents" => array(),); - + "documents" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1192,8 +1160,7 @@ public function testMethodUpsertDocuments(): void { $data = array( "total" => 5, - "documents" => array(),); - + "documents" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1212,8 +1179,7 @@ public function testMethodUpdateDocuments(): void { $data = array( "total" => 5, - "documents" => array(),); - + "documents" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1231,8 +1197,7 @@ public function testMethodDeleteDocuments(): void { $data = array( "total" => 5, - "documents" => array(),); - + "documents" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1255,8 +1220,7 @@ public function testMethodGetDocument(): void { "\$databaseId" => "5e5ea5c15117e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(),); - + "\$permissions" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1280,8 +1244,7 @@ public function testMethodUpsertDocument(): void { "\$databaseId" => "5e5ea5c15117e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(),); - + "\$permissions" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1290,8 +1253,7 @@ public function testMethodUpsertDocument(): void { $response = $this->databases->upsertDocument( "", "", - "", - array() + "" ); $this->assertSame($data, $response); @@ -1306,8 +1268,7 @@ public function testMethodUpdateDocument(): void { "\$databaseId" => "5e5ea5c15117e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(),); - + "\$permissions" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1326,7 +1287,6 @@ public function testMethodDeleteDocument(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -1349,8 +1309,7 @@ public function testMethodDecrementDocumentAttribute(): void { "\$databaseId" => "5e5ea5c15117e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(),); - + "\$permissions" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1375,8 +1334,7 @@ public function testMethodIncrementDocumentAttribute(): void { "\$databaseId" => "5e5ea5c15117e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(),); - + "\$permissions" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1396,8 +1354,7 @@ public function testMethodListIndexes(): void { $data = array( "total" => 5, - "indexes" => array(),); - + "indexes" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1422,8 +1379,7 @@ public function testMethodCreateIndex(): void { "status" => "available", "error" => "string", "attributes" => array(), - "lengths" => array(),); - + "lengths" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1433,7 +1389,7 @@ public function testMethodCreateIndex(): void { "", "", "", - "key", + IndexType::KEY(), array() ); @@ -1451,8 +1407,7 @@ public function testMethodGetIndex(): void { "status" => "available", "error" => "string", "attributes" => array(), - "lengths" => array(),); - + "lengths" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1471,7 +1426,6 @@ public function testMethodDeleteIndex(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); diff --git a/tests/Appwrite/Services/FunctionsTest.php b/tests/Appwrite/Services/FunctionsTest.php index 9d034cf4..d7916ada 100644 --- a/tests/Appwrite/Services/FunctionsTest.php +++ b/tests/Appwrite/Services/FunctionsTest.php @@ -6,6 +6,11 @@ use Appwrite\InputFile; use Mockery; use PHPUnit\Framework\TestCase; +use Appwrite\Enums\Runtime; +use Appwrite\Enums\TemplateReferenceType; +use Appwrite\Enums\VCSReferenceType; +use Appwrite\Enums\DeploymentDownloadType; +use Appwrite\Enums\ExecutionMethod; final class FunctionsTest extends TestCase { private $client; @@ -20,8 +25,7 @@ public function testMethodList(): void { $data = array( "total" => 5, - "functions" => array(),); - + "functions" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -63,8 +67,7 @@ public function testMethodCreate(): void { "providerBranch" => "main", "providerRootDirectory" => "functions/helloWorld", "providerSilentMode" => true, - "specification" => "s-1vcpu-512mb",); - + "specification" => "s-1vcpu-512mb"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -73,7 +76,7 @@ public function testMethodCreate(): void { $response = $this->functions->create( "", "", - "node-14.5" + Runtime::NODE145() ); $this->assertSame($data, $response); @@ -83,8 +86,7 @@ public function testMethodListRuntimes(): void { $data = array( "total" => 5, - "runtimes" => array(),); - + "runtimes" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -100,8 +102,7 @@ public function testMethodListSpecifications(): void { $data = array( "total" => 5, - "specifications" => array(),); - + "specifications" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -143,8 +144,7 @@ public function testMethodGet(): void { "providerBranch" => "main", "providerRootDirectory" => "functions/helloWorld", "providerSilentMode" => true, - "specification" => "s-1vcpu-512mb",); - + "specification" => "s-1vcpu-512mb"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -187,8 +187,7 @@ public function testMethodUpdate(): void { "providerBranch" => "main", "providerRootDirectory" => "functions/helloWorld", "providerSilentMode" => true, - "specification" => "s-1vcpu-512mb",); - + "specification" => "s-1vcpu-512mb"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -206,7 +205,6 @@ public function testMethodDelete(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -248,8 +246,7 @@ public function testMethodUpdateFunctionDeployment(): void { "providerBranch" => "main", "providerRootDirectory" => "functions/helloWorld", "providerSilentMode" => true, - "specification" => "s-1vcpu-512mb",); - + "specification" => "s-1vcpu-512mb"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -267,8 +264,7 @@ public function testMethodListDeployments(): void { $data = array( "total" => 5, - "deployments" => array(),); - + "deployments" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -310,8 +306,7 @@ public function testMethodCreateDeployment(): void { "providerCommitMessage" => "Update index.js", "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", "providerBranch" => "0.7.x", - "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x",); - + "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -355,8 +350,7 @@ public function testMethodCreateDuplicateDeployment(): void { "providerCommitMessage" => "Update index.js", "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", "providerBranch" => "0.7.x", - "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x",); - + "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -399,8 +393,7 @@ public function testMethodCreateTemplateDeployment(): void { "providerCommitMessage" => "Update index.js", "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", "providerBranch" => "0.7.x", - "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x",); - + "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -411,7 +404,7 @@ public function testMethodCreateTemplateDeployment(): void { "", "", "", - "commit", + TemplateReferenceType::COMMIT(), "" ); @@ -447,8 +440,7 @@ public function testMethodCreateVcsDeployment(): void { "providerCommitMessage" => "Update index.js", "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", "providerBranch" => "0.7.x", - "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x",); - + "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -456,7 +448,7 @@ public function testMethodCreateVcsDeployment(): void { $response = $this->functions->createVcsDeployment( "", - "branch", + VCSReferenceType::BRANCH(), "" ); @@ -492,8 +484,7 @@ public function testMethodGetDeployment(): void { "providerCommitMessage" => "Update index.js", "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", "providerBranch" => "0.7.x", - "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x",); - + "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -511,7 +502,6 @@ public function testMethodDeleteDeployment(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -528,7 +518,6 @@ public function testMethodGetDeploymentDownload(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -570,8 +559,7 @@ public function testMethodUpdateDeploymentStatus(): void { "providerCommitMessage" => "Update index.js", "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", "providerBranch" => "0.7.x", - "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x",); - + "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -589,8 +577,7 @@ public function testMethodListExecutions(): void { $data = array( "total" => 5, - "executions" => array(),); - + "executions" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -622,8 +609,7 @@ public function testMethodCreateExecution(): void { "responseHeaders" => array(), "logs" => "", "errors" => "", - "duration" => 0.4,); - + "duration" => 0.4); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -655,8 +641,7 @@ public function testMethodGetExecution(): void { "responseHeaders" => array(), "logs" => "", "errors" => "", - "duration" => 0.4,); - + "duration" => 0.4); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -674,7 +659,6 @@ public function testMethodDeleteExecution(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -691,8 +675,7 @@ public function testMethodListVariables(): void { $data = array( "total" => 5, - "variables" => array(),); - + "variables" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -715,8 +698,7 @@ public function testMethodCreateVariable(): void { "value" => "myPa\$\$word1", "secret" => true, "resourceType" => "function", - "resourceId" => "myAwesomeFunction",); - + "resourceId" => "myAwesomeFunction"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -741,8 +723,7 @@ public function testMethodGetVariable(): void { "value" => "myPa\$\$word1", "secret" => true, "resourceType" => "function", - "resourceId" => "myAwesomeFunction",); - + "resourceId" => "myAwesomeFunction"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -766,8 +747,7 @@ public function testMethodUpdateVariable(): void { "value" => "myPa\$\$word1", "secret" => true, "resourceType" => "function", - "resourceId" => "myAwesomeFunction",); - + "resourceId" => "myAwesomeFunction"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -786,7 +766,6 @@ public function testMethodDeleteVariable(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); diff --git a/tests/Appwrite/Services/GraphqlTest.php b/tests/Appwrite/Services/GraphqlTest.php index 6c587b86..669edf98 100644 --- a/tests/Appwrite/Services/GraphqlTest.php +++ b/tests/Appwrite/Services/GraphqlTest.php @@ -20,7 +20,6 @@ public function testMethodQuery(): void { $data = array(); - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -36,7 +35,6 @@ public function testMethodMutation(): void { $data = array(); - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); diff --git a/tests/Appwrite/Services/HealthTest.php b/tests/Appwrite/Services/HealthTest.php index cf0f7544..1f88b5b9 100644 --- a/tests/Appwrite/Services/HealthTest.php +++ b/tests/Appwrite/Services/HealthTest.php @@ -6,6 +6,7 @@ use Appwrite\InputFile; use Mockery; use PHPUnit\Framework\TestCase; +use Appwrite\Enums\Name; final class HealthTest extends TestCase { private $client; @@ -21,8 +22,7 @@ public function testMethodGet(): void { $data = array( "name" => "database", "ping" => 128, - "status" => "pass",); - + "status" => "pass"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -38,8 +38,7 @@ public function testMethodGetAntivirus(): void { $data = array( "version" => "1.0.0", - "status" => "online",); - + "status" => "online"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -56,8 +55,7 @@ public function testMethodGetCache(): void { $data = array( "name" => "database", "ping" => 128, - "status" => "pass",); - + "status" => "pass"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -77,8 +75,7 @@ public function testMethodGetCertificate(): void { "issuerOrganisation" => "", "validFrom" => "1704200998", "validTo" => "1711458597", - "signatureTypeSN" => "RSA-SHA256",); - + "signatureTypeSN" => "RSA-SHA256"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -95,8 +92,7 @@ public function testMethodGetDB(): void { $data = array( "name" => "database", "ping" => 128, - "status" => "pass",); - + "status" => "pass"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -113,8 +109,7 @@ public function testMethodGetPubSub(): void { $data = array( "name" => "database", "ping" => 128, - "status" => "pass",); - + "status" => "pass"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -126,11 +121,40 @@ public function testMethodGetPubSub(): void { $this->assertSame($data, $response); } - public function testMethodGetQueueBuilds(): void { + public function testMethodGetQueueBillingProjectAggregation(): void { $data = array( - "size" => 8,); + "size" => 8); + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->health->getQueueBillingProjectAggregation( + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetQueueBillingTeamAggregation(): void { + + $data = array( + "size" => 8); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->health->getQueueBillingTeamAggregation( + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetQueueBuilds(): void { + + $data = array( + "size" => 8); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -142,11 +166,25 @@ public function testMethodGetQueueBuilds(): void { $this->assertSame($data, $response); } - public function testMethodGetQueueCertificates(): void { + public function testMethodGetQueuePriorityBuilds(): void { $data = array( - "size" => 8,); + "size" => 8); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->health->getQueuePriorityBuilds( + ); + + $this->assertSame($data, $response); + } + public function testMethodGetQueueCertificates(): void { + + $data = array( + "size" => 8); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -161,8 +199,7 @@ public function testMethodGetQueueCertificates(): void { public function testMethodGetQueueDatabases(): void { $data = array( - "size" => 8,); - + "size" => 8); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -177,8 +214,7 @@ public function testMethodGetQueueDatabases(): void { public function testMethodGetQueueDeletes(): void { $data = array( - "size" => 8,); - + "size" => 8); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -193,15 +229,14 @@ public function testMethodGetQueueDeletes(): void { public function testMethodGetFailedJobs(): void { $data = array( - "size" => 8,); - + "size" => 8); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); $response = $this->health->getFailedJobs( - "v1-database" + Name::V1DATABASE() ); $this->assertSame($data, $response); @@ -210,8 +245,7 @@ public function testMethodGetFailedJobs(): void { public function testMethodGetQueueFunctions(): void { $data = array( - "size" => 8,); - + "size" => 8); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -226,8 +260,7 @@ public function testMethodGetQueueFunctions(): void { public function testMethodGetQueueLogs(): void { $data = array( - "size" => 8,); - + "size" => 8); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -242,8 +275,7 @@ public function testMethodGetQueueLogs(): void { public function testMethodGetQueueMails(): void { $data = array( - "size" => 8,); - + "size" => 8); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -258,8 +290,7 @@ public function testMethodGetQueueMails(): void { public function testMethodGetQueueMessaging(): void { $data = array( - "size" => 8,); - + "size" => 8); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -274,8 +305,7 @@ public function testMethodGetQueueMessaging(): void { public function testMethodGetQueueMigrations(): void { $data = array( - "size" => 8,); - + "size" => 8); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -287,11 +317,25 @@ public function testMethodGetQueueMigrations(): void { $this->assertSame($data, $response); } - public function testMethodGetQueueStatsResources(): void { + public function testMethodGetQueueRegionManager(): void { $data = array( - "size" => 8,); + "size" => 8); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $response = $this->health->getQueueRegionManager( + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetQueueStatsResources(): void { + + $data = array( + "size" => 8); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -306,8 +350,7 @@ public function testMethodGetQueueStatsResources(): void { public function testMethodGetQueueUsage(): void { $data = array( - "size" => 8,); - + "size" => 8); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -319,11 +362,25 @@ public function testMethodGetQueueUsage(): void { $this->assertSame($data, $response); } - public function testMethodGetQueueWebhooks(): void { + public function testMethodGetQueueThreats(): void { $data = array( - "size" => 8,); + "size" => 8); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->health->getQueueThreats( + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetQueueWebhooks(): void { + $data = array( + "size" => 8); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -340,8 +397,7 @@ public function testMethodGetStorage(): void { $data = array( "name" => "database", "ping" => 128, - "status" => "pass",); - + "status" => "pass"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -358,8 +414,7 @@ public function testMethodGetStorageLocal(): void { $data = array( "name" => "database", "ping" => 128, - "status" => "pass",); - + "status" => "pass"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -376,8 +431,7 @@ public function testMethodGetTime(): void { $data = array( "remoteTime" => 1639490751, "localTime" => 1639490844, - "diff" => 93,); - + "diff" => 93); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) diff --git a/tests/Appwrite/Services/LocaleTest.php b/tests/Appwrite/Services/LocaleTest.php index 6e8f9db8..88af7d52 100644 --- a/tests/Appwrite/Services/LocaleTest.php +++ b/tests/Appwrite/Services/LocaleTest.php @@ -25,8 +25,7 @@ public function testMethodGet(): void { "continentCode" => "NA", "continent" => "North America", "eu" => true, - "currency" => "USD",); - + "currency" => "USD"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -42,8 +41,7 @@ public function testMethodListCodes(): void { $data = array( "total" => 5, - "localeCodes" => array(),); - + "localeCodes" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -59,8 +57,7 @@ public function testMethodListContinents(): void { $data = array( "total" => 5, - "continents" => array(),); - + "continents" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -76,8 +73,7 @@ public function testMethodListCountries(): void { $data = array( "total" => 5, - "countries" => array(),); - + "countries" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -93,8 +89,7 @@ public function testMethodListCountriesEU(): void { $data = array( "total" => 5, - "countries" => array(),); - + "countries" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -110,8 +105,7 @@ public function testMethodListCountriesPhones(): void { $data = array( "total" => 5, - "phones" => array(),); - + "phones" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -127,8 +121,7 @@ public function testMethodListCurrencies(): void { $data = array( "total" => 5, - "currencies" => array(),); - + "currencies" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -144,8 +137,7 @@ public function testMethodListLanguages(): void { $data = array( "total" => 5, - "languages" => array(),); - + "languages" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) diff --git a/tests/Appwrite/Services/MessagingTest.php b/tests/Appwrite/Services/MessagingTest.php index ad2aab3d..3bc8e695 100644 --- a/tests/Appwrite/Services/MessagingTest.php +++ b/tests/Appwrite/Services/MessagingTest.php @@ -6,6 +6,8 @@ use Appwrite\InputFile; use Mockery; use PHPUnit\Framework\TestCase; +use Appwrite\Enums\MessagePriority; +use Appwrite\Enums\SmtpEncryption; final class MessagingTest extends TestCase { private $client; @@ -20,8 +22,7 @@ public function testMethodListMessages(): void { $data = array( "total" => 5, - "messages" => array(),); - + "messages" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -45,8 +46,7 @@ public function testMethodCreateEmail(): void { "targets" => array(), "deliveredTotal" => 1, "data" => array(), - "status" => "Message status can be one of the following: draft, processing, scheduled, sent, or failed.",); - + "status" => "processing"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -73,8 +73,7 @@ public function testMethodUpdateEmail(): void { "targets" => array(), "deliveredTotal" => 1, "data" => array(), - "status" => "Message status can be one of the following: draft, processing, scheduled, sent, or failed.",); - + "status" => "processing"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -99,8 +98,7 @@ public function testMethodCreatePush(): void { "targets" => array(), "deliveredTotal" => 1, "data" => array(), - "status" => "Message status can be one of the following: draft, processing, scheduled, sent, or failed.",); - + "status" => "processing"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -125,8 +123,7 @@ public function testMethodUpdatePush(): void { "targets" => array(), "deliveredTotal" => 1, "data" => array(), - "status" => "Message status can be one of the following: draft, processing, scheduled, sent, or failed.",); - + "status" => "processing"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -151,8 +148,7 @@ public function testMethodCreateSMS(): void { "targets" => array(), "deliveredTotal" => 1, "data" => array(), - "status" => "Message status can be one of the following: draft, processing, scheduled, sent, or failed.",); - + "status" => "processing"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -178,8 +174,7 @@ public function testMethodUpdateSMS(): void { "targets" => array(), "deliveredTotal" => 1, "data" => array(), - "status" => "Message status can be one of the following: draft, processing, scheduled, sent, or failed.",); - + "status" => "processing"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -204,8 +199,7 @@ public function testMethodGetMessage(): void { "targets" => array(), "deliveredTotal" => 1, "data" => array(), - "status" => "Message status can be one of the following: draft, processing, scheduled, sent, or failed.",); - + "status" => "processing"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -222,7 +216,6 @@ public function testMethodDelete(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -238,8 +231,7 @@ public function testMethodListMessageLogs(): void { $data = array( "total" => 5, - "logs" => array(),); - + "logs" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -256,8 +248,7 @@ public function testMethodListTargets(): void { $data = array( "total" => 5, - "targets" => array(),); - + "targets" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -274,8 +265,7 @@ public function testMethodListProviders(): void { $data = array( "total" => 5, - "providers" => array(),); - + "providers" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -297,8 +287,7 @@ public function testMethodCreateAPNSProvider(): void { "provider" => "mailgun", "enabled" => true, "type" => "sms", - "credentials" => array(),); - + "credentials" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -322,8 +311,7 @@ public function testMethodUpdateAPNSProvider(): void { "provider" => "mailgun", "enabled" => true, "type" => "sms", - "credentials" => array(),); - + "credentials" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -346,8 +334,7 @@ public function testMethodCreateFCMProvider(): void { "provider" => "mailgun", "enabled" => true, "type" => "sms", - "credentials" => array(),); - + "credentials" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -371,8 +358,7 @@ public function testMethodUpdateFCMProvider(): void { "provider" => "mailgun", "enabled" => true, "type" => "sms", - "credentials" => array(),); - + "credentials" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -395,8 +381,7 @@ public function testMethodCreateMailgunProvider(): void { "provider" => "mailgun", "enabled" => true, "type" => "sms", - "credentials" => array(),); - + "credentials" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -420,8 +405,7 @@ public function testMethodUpdateMailgunProvider(): void { "provider" => "mailgun", "enabled" => true, "type" => "sms", - "credentials" => array(),); - + "credentials" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -444,8 +428,7 @@ public function testMethodCreateMsg91Provider(): void { "provider" => "mailgun", "enabled" => true, "type" => "sms", - "credentials" => array(),); - + "credentials" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -469,8 +452,7 @@ public function testMethodUpdateMsg91Provider(): void { "provider" => "mailgun", "enabled" => true, "type" => "sms", - "credentials" => array(),); - + "credentials" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -493,8 +475,7 @@ public function testMethodCreateResendProvider(): void { "provider" => "mailgun", "enabled" => true, "type" => "sms", - "credentials" => array(),); - + "credentials" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -518,8 +499,7 @@ public function testMethodUpdateResendProvider(): void { "provider" => "mailgun", "enabled" => true, "type" => "sms", - "credentials" => array(),); - + "credentials" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -542,8 +522,7 @@ public function testMethodCreateSendgridProvider(): void { "provider" => "mailgun", "enabled" => true, "type" => "sms", - "credentials" => array(),); - + "credentials" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -567,8 +546,7 @@ public function testMethodUpdateSendgridProvider(): void { "provider" => "mailgun", "enabled" => true, "type" => "sms", - "credentials" => array(),); - + "credentials" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -591,8 +569,7 @@ public function testMethodCreateSMTPProvider(): void { "provider" => "mailgun", "enabled" => true, "type" => "sms", - "credentials" => array(),); - + "credentials" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -617,8 +594,7 @@ public function testMethodUpdateSMTPProvider(): void { "provider" => "mailgun", "enabled" => true, "type" => "sms", - "credentials" => array(),); - + "credentials" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -641,8 +617,7 @@ public function testMethodCreateTelesignProvider(): void { "provider" => "mailgun", "enabled" => true, "type" => "sms", - "credentials" => array(),); - + "credentials" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -666,8 +641,7 @@ public function testMethodUpdateTelesignProvider(): void { "provider" => "mailgun", "enabled" => true, "type" => "sms", - "credentials" => array(),); - + "credentials" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -690,8 +664,7 @@ public function testMethodCreateTextmagicProvider(): void { "provider" => "mailgun", "enabled" => true, "type" => "sms", - "credentials" => array(),); - + "credentials" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -715,8 +688,7 @@ public function testMethodUpdateTextmagicProvider(): void { "provider" => "mailgun", "enabled" => true, "type" => "sms", - "credentials" => array(),); - + "credentials" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -739,8 +711,7 @@ public function testMethodCreateTwilioProvider(): void { "provider" => "mailgun", "enabled" => true, "type" => "sms", - "credentials" => array(),); - + "credentials" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -764,8 +735,7 @@ public function testMethodUpdateTwilioProvider(): void { "provider" => "mailgun", "enabled" => true, "type" => "sms", - "credentials" => array(),); - + "credentials" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -788,8 +758,7 @@ public function testMethodCreateVonageProvider(): void { "provider" => "mailgun", "enabled" => true, "type" => "sms", - "credentials" => array(),); - + "credentials" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -813,8 +782,7 @@ public function testMethodUpdateVonageProvider(): void { "provider" => "mailgun", "enabled" => true, "type" => "sms", - "credentials" => array(),); - + "credentials" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -837,8 +805,7 @@ public function testMethodGetProvider(): void { "provider" => "mailgun", "enabled" => true, "type" => "sms", - "credentials" => array(),); - + "credentials" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -855,7 +822,6 @@ public function testMethodDeleteProvider(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -871,8 +837,7 @@ public function testMethodListProviderLogs(): void { $data = array( "total" => 5, - "logs" => array(),); - + "logs" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -889,8 +854,7 @@ public function testMethodListSubscriberLogs(): void { $data = array( "total" => 5, - "logs" => array(),); - + "logs" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -907,8 +871,7 @@ public function testMethodListTopics(): void { $data = array( "total" => 5, - "topics" => array(),); - + "topics" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -930,8 +893,7 @@ public function testMethodCreateTopic(): void { "emailTotal" => 100, "smsTotal" => 100, "pushTotal" => 100, - "subscribe" => array(),); - + "subscribe" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -955,8 +917,7 @@ public function testMethodGetTopic(): void { "emailTotal" => 100, "smsTotal" => 100, "pushTotal" => 100, - "subscribe" => array(),); - + "subscribe" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -979,8 +940,7 @@ public function testMethodUpdateTopic(): void { "emailTotal" => 100, "smsTotal" => 100, "pushTotal" => 100, - "subscribe" => array(),); - + "subscribe" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -997,7 +957,6 @@ public function testMethodDeleteTopic(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -1013,8 +972,7 @@ public function testMethodListTopicLogs(): void { $data = array( "total" => 5, - "logs" => array(),); - + "logs" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1031,8 +989,7 @@ public function testMethodListSubscribers(): void { $data = array( "total" => 5, - "subscribers" => array(),); - + "subscribers" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1056,8 +1013,7 @@ public function testMethodCreateSubscriber(): void { "userId" => "5e5ea5c16897e", "userName" => "Aegon Targaryen", "topicId" => "259125845563242502", - "providerType" => "email",); - + "providerType" => "email"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1083,8 +1039,7 @@ public function testMethodGetSubscriber(): void { "userId" => "5e5ea5c16897e", "userName" => "Aegon Targaryen", "topicId" => "259125845563242502", - "providerType" => "email",); - + "providerType" => "email"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1102,7 +1057,6 @@ public function testMethodDeleteSubscriber(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); diff --git a/tests/Appwrite/Services/OrganizationsTest.php b/tests/Appwrite/Services/OrganizationsTest.php new file mode 100644 index 00000000..ad96680b --- /dev/null +++ b/tests/Appwrite/Services/OrganizationsTest.php @@ -0,0 +1,50 @@ +client = Mockery::mock(Client::class); + $this->organizations = new Organizations($this->client); + } + + public function testMethodDelete(): void { + + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->organizations->delete( + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodEstimationDeleteOrganization(): void { + + $data = array( + "unpaidInvoices" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->organizations->estimationDeleteOrganization( + "" + ); + + $this->assertSame($data, $response); + } + +} diff --git a/tests/Appwrite/Services/SitesTest.php b/tests/Appwrite/Services/SitesTest.php index 831d7bb7..2d3a2bc5 100644 --- a/tests/Appwrite/Services/SitesTest.php +++ b/tests/Appwrite/Services/SitesTest.php @@ -6,6 +6,12 @@ use Appwrite\InputFile; use Mockery; use PHPUnit\Framework\TestCase; +use Appwrite\Enums\Framework; +use Appwrite\Enums\BuildRuntime; +use Appwrite\Enums\Adapter; +use Appwrite\Enums\TemplateReferenceType; +use Appwrite\Enums\VCSReferenceType; +use Appwrite\Enums\DeploymentDownloadType; final class SitesTest extends TestCase { private $client; @@ -20,8 +26,7 @@ public function testMethodList(): void { $data = array( "total" => 5, - "sites" => array(),); - + "sites" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -64,8 +69,7 @@ public function testMethodCreate(): void { "specification" => "s-1vcpu-512mb", "buildRuntime" => "node-22", "adapter" => "static", - "fallbackFile" => "index.html",); - + "fallbackFile" => "index.html"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -74,8 +78,8 @@ public function testMethodCreate(): void { $response = $this->sites->create( "", "", - "analog", - "node-14.5" + Framework::ANALOG(), + BuildRuntime::NODE145() ); $this->assertSame($data, $response); @@ -85,8 +89,7 @@ public function testMethodListFrameworks(): void { $data = array( "total" => 5, - "frameworks" => array(),); - + "frameworks" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -102,8 +105,7 @@ public function testMethodListSpecifications(): void { $data = array( "total" => 5, - "specifications" => array(),); - + "specifications" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -146,8 +148,7 @@ public function testMethodGet(): void { "specification" => "s-1vcpu-512mb", "buildRuntime" => "node-22", "adapter" => "static", - "fallbackFile" => "index.html",); - + "fallbackFile" => "index.html"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -191,8 +192,7 @@ public function testMethodUpdate(): void { "specification" => "s-1vcpu-512mb", "buildRuntime" => "node-22", "adapter" => "static", - "fallbackFile" => "index.html",); - + "fallbackFile" => "index.html"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -201,7 +201,7 @@ public function testMethodUpdate(): void { $response = $this->sites->update( "", "", - "analog" + Framework::ANALOG() ); $this->assertSame($data, $response); @@ -211,7 +211,6 @@ public function testMethodDelete(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -254,8 +253,7 @@ public function testMethodUpdateSiteDeployment(): void { "specification" => "s-1vcpu-512mb", "buildRuntime" => "node-22", "adapter" => "static", - "fallbackFile" => "index.html",); - + "fallbackFile" => "index.html"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -273,8 +271,7 @@ public function testMethodListDeployments(): void { $data = array( "total" => 5, - "deployments" => array(),); - + "deployments" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -316,8 +313,7 @@ public function testMethodCreateDeployment(): void { "providerCommitMessage" => "Update index.js", "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", "providerBranch" => "0.7.x", - "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x",); - + "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -361,8 +357,7 @@ public function testMethodCreateDuplicateDeployment(): void { "providerCommitMessage" => "Update index.js", "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", "providerBranch" => "0.7.x", - "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x",); - + "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -405,8 +400,7 @@ public function testMethodCreateTemplateDeployment(): void { "providerCommitMessage" => "Update index.js", "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", "providerBranch" => "0.7.x", - "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x",); - + "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -417,7 +411,7 @@ public function testMethodCreateTemplateDeployment(): void { "", "", "", - "branch", + TemplateReferenceType::BRANCH(), "" ); @@ -453,8 +447,7 @@ public function testMethodCreateVcsDeployment(): void { "providerCommitMessage" => "Update index.js", "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", "providerBranch" => "0.7.x", - "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x",); - + "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -462,7 +455,7 @@ public function testMethodCreateVcsDeployment(): void { $response = $this->sites->createVcsDeployment( "", - "branch", + VCSReferenceType::BRANCH(), "" ); @@ -498,8 +491,7 @@ public function testMethodGetDeployment(): void { "providerCommitMessage" => "Update index.js", "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", "providerBranch" => "0.7.x", - "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x",); - + "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -517,7 +509,6 @@ public function testMethodDeleteDeployment(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -534,7 +525,6 @@ public function testMethodGetDeploymentDownload(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -576,8 +566,7 @@ public function testMethodUpdateDeploymentStatus(): void { "providerCommitMessage" => "Update index.js", "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", "providerBranch" => "0.7.x", - "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x",); - + "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -595,8 +584,7 @@ public function testMethodListLogs(): void { $data = array( "total" => 5, - "executions" => array(),); - + "executions" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -628,8 +616,7 @@ public function testMethodGetLog(): void { "responseHeaders" => array(), "logs" => "", "errors" => "", - "duration" => 0.4,); - + "duration" => 0.4); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -647,7 +634,6 @@ public function testMethodDeleteLog(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -664,8 +650,7 @@ public function testMethodListVariables(): void { $data = array( "total" => 5, - "variables" => array(),); - + "variables" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -688,8 +673,7 @@ public function testMethodCreateVariable(): void { "value" => "myPa\$\$word1", "secret" => true, "resourceType" => "function", - "resourceId" => "myAwesomeFunction",); - + "resourceId" => "myAwesomeFunction"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -714,8 +698,7 @@ public function testMethodGetVariable(): void { "value" => "myPa\$\$word1", "secret" => true, "resourceType" => "function", - "resourceId" => "myAwesomeFunction",); - + "resourceId" => "myAwesomeFunction"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -739,8 +722,7 @@ public function testMethodUpdateVariable(): void { "value" => "myPa\$\$word1", "secret" => true, "resourceType" => "function", - "resourceId" => "myAwesomeFunction",); - + "resourceId" => "myAwesomeFunction"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -759,7 +741,6 @@ public function testMethodDeleteVariable(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); diff --git a/tests/Appwrite/Services/StorageTest.php b/tests/Appwrite/Services/StorageTest.php index 0f2ce534..9f22c719 100644 --- a/tests/Appwrite/Services/StorageTest.php +++ b/tests/Appwrite/Services/StorageTest.php @@ -6,6 +6,9 @@ use Appwrite\InputFile; use Mockery; use PHPUnit\Framework\TestCase; +use Appwrite\Enums\Compression; +use Appwrite\Enums\ImageGravity; +use Appwrite\Enums\ImageFormat; final class StorageTest extends TestCase { private $client; @@ -20,8 +23,7 @@ public function testMethodListBuckets(): void { $data = array( "total" => 5, - "buckets" => array(),); - + "buckets" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -48,8 +50,8 @@ public function testMethodCreateBucket(): void { "compression" => "gzip", "encryption" => true, "antivirus" => true, - "transformations" => true,); - + "transformations" => true, + "totalSize" => 128); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -78,8 +80,8 @@ public function testMethodGetBucket(): void { "compression" => "gzip", "encryption" => true, "antivirus" => true, - "transformations" => true,); - + "transformations" => true, + "totalSize" => 128); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -107,8 +109,8 @@ public function testMethodUpdateBucket(): void { "compression" => "gzip", "encryption" => true, "antivirus" => true, - "transformations" => true,); - + "transformations" => true, + "totalSize" => 128); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -126,7 +128,6 @@ public function testMethodDeleteBucket(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -142,8 +143,7 @@ public function testMethodListFiles(): void { $data = array( "total" => 5, - "files" => array(),); - + "files" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -169,8 +169,7 @@ public function testMethodCreateFile(): void { "mimeType" => "image/png", "sizeOriginal" => 17890, "chunksTotal" => 17890, - "chunksUploaded" => 17890,); - + "chunksUploaded" => 17890); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -198,8 +197,7 @@ public function testMethodGetFile(): void { "mimeType" => "image/png", "sizeOriginal" => 17890, "chunksTotal" => 17890, - "chunksUploaded" => 17890,); - + "chunksUploaded" => 17890); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -226,8 +224,7 @@ public function testMethodUpdateFile(): void { "mimeType" => "image/png", "sizeOriginal" => 17890, "chunksTotal" => 17890, - "chunksUploaded" => 17890,); - + "chunksUploaded" => 17890); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -245,7 +242,6 @@ public function testMethodDeleteFile(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -262,7 +258,6 @@ public function testMethodGetFileDownload(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -279,7 +274,6 @@ public function testMethodGetFilePreview(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -296,7 +290,6 @@ public function testMethodGetFileView(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); diff --git a/tests/Appwrite/Services/TablesDBTest.php b/tests/Appwrite/Services/TablesDBTest.php index 5b5d0083..42ed5267 100644 --- a/tests/Appwrite/Services/TablesDBTest.php +++ b/tests/Appwrite/Services/TablesDBTest.php @@ -6,6 +6,9 @@ use Appwrite\InputFile; use Mockery; use PHPUnit\Framework\TestCase; +use Appwrite\Enums\RelationshipType; +use Appwrite\Enums\RelationMutate; +use Appwrite\Enums\IndexType; final class TablesDBTest extends TestCase { private $client; @@ -20,8 +23,7 @@ public function testMethodList(): void { $data = array( "total" => 5, - "databases" => array(),); - + "databases" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -41,8 +43,9 @@ public function testMethodCreate(): void { "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "enabled" => true, - "type" => "legacy",); - + "type" => "legacy", + "policies" => array(), + "archives" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -60,8 +63,7 @@ public function testMethodListTransactions(): void { $data = array( "total" => 5, - "transactions" => array(),); - + "transactions" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -81,8 +83,7 @@ public function testMethodCreateTransaction(): void { "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "status" => "pending", "operations" => 5, - "expiresAt" => "2020-10-15T06:38:00.000+00:00",); - + "expiresAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -102,8 +103,7 @@ public function testMethodGetTransaction(): void { "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "status" => "pending", "operations" => 5, - "expiresAt" => "2020-10-15T06:38:00.000+00:00",); - + "expiresAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -124,8 +124,7 @@ public function testMethodUpdateTransaction(): void { "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "status" => "pending", "operations" => 5, - "expiresAt" => "2020-10-15T06:38:00.000+00:00",); - + "expiresAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -142,7 +141,6 @@ public function testMethodDeleteTransaction(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -162,8 +160,7 @@ public function testMethodCreateOperations(): void { "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "status" => "pending", "operations" => 5, - "expiresAt" => "2020-10-15T06:38:00.000+00:00",); - + "expiresAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -184,8 +181,9 @@ public function testMethodGet(): void { "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "enabled" => true, - "type" => "legacy",); - + "type" => "legacy", + "policies" => array(), + "archives" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -206,8 +204,9 @@ public function testMethodUpdate(): void { "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "enabled" => true, - "type" => "legacy",); - + "type" => "legacy", + "policies" => array(), + "archives" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -225,7 +224,6 @@ public function testMethodDelete(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -241,8 +239,7 @@ public function testMethodListTables(): void { $data = array( "total" => 5, - "tables" => array(),); - + "tables" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -267,8 +264,7 @@ public function testMethodCreateTable(): void { "enabled" => true, "rowSecurity" => true, "columns" => array(), - "indexes" => array(),); - + "indexes" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -295,8 +291,7 @@ public function testMethodGetTable(): void { "enabled" => true, "rowSecurity" => true, "columns" => array(), - "indexes" => array(),); - + "indexes" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -322,8 +317,7 @@ public function testMethodUpdateTable(): void { "enabled" => true, "rowSecurity" => true, "columns" => array(), - "indexes" => array(),); - + "indexes" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -342,7 +336,6 @@ public function testMethodDeleteTable(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -359,8 +352,7 @@ public function testMethodListColumns(): void { $data = array( "total" => 5, - "columns" => array(),); - + "columns" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -383,8 +375,7 @@ public function testMethodCreateBooleanColumn(): void { "error" => "string", "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -409,8 +400,7 @@ public function testMethodUpdateBooleanColumn(): void { "error" => "string", "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -437,8 +427,7 @@ public function testMethodCreateDatetimeColumn(): void { "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "format" => "datetime",); - + "format" => "datetime"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -464,8 +453,7 @@ public function testMethodUpdateDatetimeColumn(): void { "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "format" => "datetime",); - + "format" => "datetime"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -492,8 +480,7 @@ public function testMethodCreateEmailColumn(): void { "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "format" => "email",); - + "format" => "email"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -519,8 +506,7 @@ public function testMethodUpdateEmailColumn(): void { "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "format" => "email",); - + "format" => "email"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -548,8 +534,7 @@ public function testMethodCreateEnumColumn(): void { "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "elements" => array(), - "format" => "enum",); - + "format" => "enum"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -577,8 +562,7 @@ public function testMethodUpdateEnumColumn(): void { "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "elements" => array(), - "format" => "enum",); - + "format" => "enum"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -605,8 +589,7 @@ public function testMethodCreateFloatColumn(): void { "error" => "string", "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -631,8 +614,7 @@ public function testMethodUpdateFloatColumn(): void { "error" => "string", "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -658,8 +640,7 @@ public function testMethodCreateIntegerColumn(): void { "error" => "string", "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -684,8 +665,7 @@ public function testMethodUpdateIntegerColumn(): void { "error" => "string", "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -712,8 +692,7 @@ public function testMethodCreateIpColumn(): void { "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "format" => "ip",); - + "format" => "ip"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -739,8 +718,7 @@ public function testMethodUpdateIpColumn(): void { "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "format" => "ip",); - + "format" => "ip"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -766,8 +744,7 @@ public function testMethodCreateLineColumn(): void { "error" => "string", "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -792,8 +769,7 @@ public function testMethodUpdateLineColumn(): void { "error" => "string", "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -818,8 +794,7 @@ public function testMethodCreatePointColumn(): void { "error" => "string", "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -844,8 +819,7 @@ public function testMethodUpdatePointColumn(): void { "error" => "string", "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -870,8 +844,7 @@ public function testMethodCreatePolygonColumn(): void { "error" => "string", "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -896,8 +869,7 @@ public function testMethodUpdatePolygonColumn(): void { "error" => "string", "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -928,8 +900,7 @@ public function testMethodCreateRelationshipColumn(): void { "twoWay" => true, "twoWayKey" => "string", "onDelete" => "restrict|cascade|setNull", - "side" => "parent|child",); - + "side" => "parent|child"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -939,7 +910,7 @@ public function testMethodCreateRelationshipColumn(): void { "", "", "", - "oneToOne" + RelationshipType::ONETOONE() ); $this->assertSame($data, $response); @@ -955,8 +926,7 @@ public function testMethodCreateStringColumn(): void { "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "size" => 128,); - + "size" => 128); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -983,8 +953,7 @@ public function testMethodUpdateStringColumn(): void { "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "size" => 128,); - + "size" => 128); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1011,8 +980,7 @@ public function testMethodCreateUrlColumn(): void { "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "format" => "url",); - + "format" => "url"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1038,8 +1006,7 @@ public function testMethodUpdateUrlColumn(): void { "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "format" => "url",); - + "format" => "url"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1058,8 +1025,14 @@ public function testMethodUpdateUrlColumn(): void { public function testMethodGetColumn(): void { - $data = ''; - + $data = array( + "key" => "isEnabled", + "type" => "boolean", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1078,7 +1051,6 @@ public function testMethodDeleteColumn(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -1107,8 +1079,7 @@ public function testMethodUpdateRelationshipColumn(): void { "twoWay" => true, "twoWayKey" => "string", "onDelete" => "restrict|cascade|setNull", - "side" => "parent|child",); - + "side" => "parent|child"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1127,8 +1098,7 @@ public function testMethodListIndexes(): void { $data = array( "total" => 5, - "indexes" => array(),); - + "indexes" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1153,8 +1123,7 @@ public function testMethodCreateIndex(): void { "status" => "available", "error" => "string", "columns" => array(), - "lengths" => array(),); - + "lengths" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1164,7 +1133,7 @@ public function testMethodCreateIndex(): void { "", "", "", - "key", + IndexType::KEY(), array() ); @@ -1182,8 +1151,7 @@ public function testMethodGetIndex(): void { "status" => "available", "error" => "string", "columns" => array(), - "lengths" => array(),); - + "lengths" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1202,7 +1170,6 @@ public function testMethodDeleteIndex(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -1220,8 +1187,7 @@ public function testMethodListRows(): void { $data = array( "total" => 5, - "rows" => array(),); - + "rows" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1244,8 +1210,7 @@ public function testMethodCreateRow(): void { "\$databaseId" => "5e5ea5c15117e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(),); - + "\$permissions" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1265,8 +1230,7 @@ public function testMethodCreateRows(): void { $data = array( "total" => 5, - "rows" => array(),); - + "rows" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1285,8 +1249,7 @@ public function testMethodUpsertRows(): void { $data = array( "total" => 5, - "rows" => array(),); - + "rows" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1305,8 +1268,7 @@ public function testMethodUpdateRows(): void { $data = array( "total" => 5, - "rows" => array(),); - + "rows" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1324,8 +1286,7 @@ public function testMethodDeleteRows(): void { $data = array( "total" => 5, - "rows" => array(),); - + "rows" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1348,8 +1309,7 @@ public function testMethodGetRow(): void { "\$databaseId" => "5e5ea5c15117e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(),); - + "\$permissions" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1373,8 +1333,7 @@ public function testMethodUpsertRow(): void { "\$databaseId" => "5e5ea5c15117e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(),); - + "\$permissions" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1398,8 +1357,7 @@ public function testMethodUpdateRow(): void { "\$databaseId" => "5e5ea5c15117e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(),); - + "\$permissions" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1418,7 +1376,6 @@ public function testMethodDeleteRow(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -1441,8 +1398,7 @@ public function testMethodDecrementRowColumn(): void { "\$databaseId" => "5e5ea5c15117e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(),); - + "\$permissions" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1467,8 +1423,7 @@ public function testMethodIncrementRowColumn(): void { "\$databaseId" => "5e5ea5c15117e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(),); - + "\$permissions" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) diff --git a/tests/Appwrite/Services/TeamsTest.php b/tests/Appwrite/Services/TeamsTest.php index d77d0de0..d909af55 100644 --- a/tests/Appwrite/Services/TeamsTest.php +++ b/tests/Appwrite/Services/TeamsTest.php @@ -20,8 +20,7 @@ public function testMethodList(): void { $data = array( "total" => 5, - "teams" => array(),); - + "teams" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -41,8 +40,7 @@ public function testMethodCreate(): void { "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "name" => "VIP", "total" => 7, - "prefs" => array(),); - + "prefs" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -64,8 +62,7 @@ public function testMethodGet(): void { "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "name" => "VIP", "total" => 7, - "prefs" => array(),); - + "prefs" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -86,8 +83,7 @@ public function testMethodUpdateName(): void { "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "name" => "VIP", "total" => 7, - "prefs" => array(),); - + "prefs" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -105,7 +101,6 @@ public function testMethodDelete(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -121,8 +116,7 @@ public function testMethodListMemberships(): void { $data = array( "total" => 5, - "memberships" => array(),); - + "memberships" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -150,8 +144,7 @@ public function testMethodCreateMembership(): void { "joined" => "2020-10-15T06:38:00.000+00:00", "confirm" => true, "mfa" => true, - "roles" => array(),); - + "roles" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -180,8 +173,7 @@ public function testMethodGetMembership(): void { "joined" => "2020-10-15T06:38:00.000+00:00", "confirm" => true, "mfa" => true, - "roles" => array(),); - + "roles" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -210,8 +202,7 @@ public function testMethodUpdateMembership(): void { "joined" => "2020-10-15T06:38:00.000+00:00", "confirm" => true, "mfa" => true, - "roles" => array(),); - + "roles" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -230,7 +221,6 @@ public function testMethodDeleteMembership(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -258,8 +248,7 @@ public function testMethodUpdateMembershipStatus(): void { "joined" => "2020-10-15T06:38:00.000+00:00", "confirm" => true, "mfa" => true, - "roles" => array(),); - + "roles" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -279,7 +268,6 @@ public function testMethodGetPrefs(): void { $data = array(); - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -295,7 +283,6 @@ public function testMethodUpdatePrefs(): void { $data = array(); - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); diff --git a/tests/Appwrite/Services/TokensTest.php b/tests/Appwrite/Services/TokensTest.php index 550b6084..59dff5a1 100644 --- a/tests/Appwrite/Services/TokensTest.php +++ b/tests/Appwrite/Services/TokensTest.php @@ -20,8 +20,7 @@ public function testMethodList(): void { $data = array( "total" => 5, - "tokens" => array(),); - + "tokens" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -44,8 +43,7 @@ public function testMethodCreateFileToken(): void { "resourceType" => "files", "expire" => "2020-10-15T06:38:00.000+00:00", "secret" => "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c", - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -68,8 +66,7 @@ public function testMethodGet(): void { "resourceType" => "files", "expire" => "2020-10-15T06:38:00.000+00:00", "secret" => "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c", - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -91,8 +88,7 @@ public function testMethodUpdate(): void { "resourceType" => "files", "expire" => "2020-10-15T06:38:00.000+00:00", "secret" => "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c", - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -109,7 +105,6 @@ public function testMethodDelete(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); diff --git a/tests/Appwrite/Services/UsersTest.php b/tests/Appwrite/Services/UsersTest.php index 101d1af4..83d2bbc9 100644 --- a/tests/Appwrite/Services/UsersTest.php +++ b/tests/Appwrite/Services/UsersTest.php @@ -6,6 +6,9 @@ use Appwrite\InputFile; use Mockery; use PHPUnit\Framework\TestCase; +use Appwrite\Enums\PasswordHash; +use Appwrite\Enums\AuthenticatorType; +use Appwrite\Enums\MessagingProviderType; final class UsersTest extends TestCase { private $client; @@ -20,8 +23,7 @@ public function testMethodList(): void { $data = array( "total" => 5, - "users" => array(),); - + "users" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -51,8 +53,7 @@ public function testMethodCreate(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -83,8 +84,7 @@ public function testMethodCreateArgon2User(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -117,8 +117,7 @@ public function testMethodCreateBcryptUser(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -137,8 +136,7 @@ public function testMethodListIdentities(): void { $data = array( "total" => 5, - "identities" => array(),); - + "identities" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -154,7 +152,6 @@ public function testMethodDeleteIdentity(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -184,8 +181,7 @@ public function testMethodCreateMD5User(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -218,8 +214,7 @@ public function testMethodCreatePHPassUser(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -252,8 +247,7 @@ public function testMethodCreateScryptUser(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -291,8 +285,7 @@ public function testMethodCreateScryptModifiedUser(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -328,8 +321,7 @@ public function testMethodCreateSHAUser(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -362,8 +354,7 @@ public function testMethodGet(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -380,7 +371,6 @@ public function testMethodDelete(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -410,8 +400,7 @@ public function testMethodUpdateEmail(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -428,8 +417,7 @@ public function testMethodUpdateEmail(): void { public function testMethodCreateJWT(): void { $data = array( - "jwt" => "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",); - + "jwt" => "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -460,8 +448,7 @@ public function testMethodUpdateLabels(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -479,8 +466,7 @@ public function testMethodListLogs(): void { $data = array( "total" => 5, - "logs" => array(),); - + "logs" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -497,8 +483,7 @@ public function testMethodListMemberships(): void { $data = array( "total" => 5, - "memberships" => array(),); - + "memberships" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -529,8 +514,7 @@ public function testMethodUpdateMFA(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -548,14 +532,13 @@ public function testMethodDeleteMFAAuthenticator(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); $response = $this->users->deleteMFAAuthenticator( "", - "totp" + AuthenticatorType::TOTP() ); $this->assertSame($data, $response); @@ -567,8 +550,7 @@ public function testMethodListMFAFactors(): void { "totp" => true, "phone" => true, "email" => true, - "recoveryCode" => true,); - + "recoveryCode" => true); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -584,8 +566,7 @@ public function testMethodListMFAFactors(): void { public function testMethodGetMFARecoveryCodes(): void { $data = array( - "recoveryCodes" => array(),); - + "recoveryCodes" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -601,8 +582,7 @@ public function testMethodGetMFARecoveryCodes(): void { public function testMethodUpdateMFARecoveryCodes(): void { $data = array( - "recoveryCodes" => array(),); - + "recoveryCodes" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -618,8 +598,7 @@ public function testMethodUpdateMFARecoveryCodes(): void { public function testMethodCreateMFARecoveryCodes(): void { $data = array( - "recoveryCodes" => array(),); - + "recoveryCodes" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -650,8 +629,7 @@ public function testMethodUpdateName(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -683,8 +661,7 @@ public function testMethodUpdatePassword(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -716,8 +693,7 @@ public function testMethodUpdatePhone(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -735,7 +711,6 @@ public function testMethodGetPrefs(): void { $data = array(); - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -751,7 +726,6 @@ public function testMethodUpdatePrefs(): void { $data = array(); - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -768,8 +742,7 @@ public function testMethodListSessions(): void { $data = array( "total" => 5, - "sessions" => array(),); - + "sessions" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -813,8 +786,7 @@ public function testMethodCreateSession(): void { "current" => true, "factors" => array(), "secret" => "5e5bb8c16897e", - "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -831,7 +803,6 @@ public function testMethodDeleteSessions(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -847,7 +818,6 @@ public function testMethodDeleteSession(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -878,8 +848,7 @@ public function testMethodUpdateStatus(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -897,8 +866,7 @@ public function testMethodListTargets(): void { $data = array( "total" => 5, - "targets" => array(),); - + "targets" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -921,8 +889,7 @@ public function testMethodCreateTarget(): void { "userId" => "259125845563242502", "providerType" => "email", "identifier" => "token", - "expired" => true,); - + "expired" => true); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -931,7 +898,7 @@ public function testMethodCreateTarget(): void { $response = $this->users->createTarget( "", "", - "email", + MessagingProviderType::EMAIL(), "" ); @@ -948,8 +915,7 @@ public function testMethodGetTarget(): void { "userId" => "259125845563242502", "providerType" => "email", "identifier" => "token", - "expired" => true,); - + "expired" => true); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -973,8 +939,7 @@ public function testMethodUpdateTarget(): void { "userId" => "259125845563242502", "providerType" => "email", "identifier" => "token", - "expired" => true,); - + "expired" => true); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -992,7 +957,6 @@ public function testMethodDeleteTarget(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -1013,8 +977,7 @@ public function testMethodCreateToken(): void { "userId" => "5e5ea5c168bb8", "secret" => "", "expire" => "2020-10-15T06:38:00.000+00:00", - "phrase" => "Golden Fox",); - + "phrase" => "Golden Fox"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1045,8 +1008,7 @@ public function testMethodUpdateEmailVerification(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1078,8 +1040,7 @@ public function testMethodUpdatePhoneVerification(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) From 5a44d75714fc552bcee41e46ab1099642f59a687 Mon Sep 17 00:00:00 2001 From: Darshan Date: Wed, 14 Jan 2026 07:41:23 +0000 Subject: [PATCH 2/7] latest updates as per server specs. --- CHANGELOG.md | 4 ++++ src/Appwrite/Client.php | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 14a26e44..01a7e70f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## 19.1.1 + +* Update SDK as per latest server specs + ## 18.0.1 * Fix `TablesDB` service to use correct file name diff --git a/src/Appwrite/Client.php b/src/Appwrite/Client.php index 8d8d89ed..cbfc0f8f 100644 --- a/src/Appwrite/Client.php +++ b/src/Appwrite/Client.php @@ -37,11 +37,11 @@ class Client */ protected array $headers = [ 'content-type' => '', - 'user-agent' => 'AppwritePHPSDK/20.0.0 ()', + 'user-agent' => 'AppwritePHPSDK/19.1.1 ()', 'x-sdk-name'=> 'PHP', 'x-sdk-platform'=> 'server', 'x-sdk-language'=> 'php', - 'x-sdk-version'=> '20.0.0', + 'x-sdk-version'=> '19.1.1', ]; /** From e406b886fd64e26f3df43a6f70317e25c1cdd9c0 Mon Sep 17 00:00:00 2001 From: Darshan Date: Wed, 14 Jan 2026 07:54:06 +0000 Subject: [PATCH 3/7] misc-docs-update --- CHANGELOG.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 01a7e70f..555293c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,17 @@ * Update SDK as per latest server specs +## 19.1.0 + +* Added ability to create columns and indexes synchronously while creating a table + +## 19.0.0 + +* Rename `VCSDeploymentType` enum to `VCSReferenceType` +* Change `createTemplateDeployment` method signature: replace `version` parameter with `type` (TemplateReferenceType) + and `reference` parameters +* Add `Theme`, `Timezone` and `Output` enums + ## 18.0.1 * Fix `TablesDB` service to use correct file name From 62e6f1fbd102da34cb67648fe489a38866d6a433 Mon Sep 17 00:00:00 2001 From: Darshan Date: Wed, 14 Jan 2026 13:47:25 +0530 Subject: [PATCH 4/7] Apply suggestion from @ItzNotABug --- CHANGELOG.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 555293c9..e7c7d5b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,11 @@ ## 19.1.1 -* Update SDK as per latest server specs +* Update SDK as per latest server specs, these include - + * Updates to Runtime enums + * `Output` is now renamed to `ImageFormat` - Note that this is a breaking change + * Introduces Backups module for managing Database backups + * Introduces Organization module ## 19.1.0 From 91f96ea2c4eaef4a435893a73683cae08ff51905 Mon Sep 17 00:00:00 2001 From: Darshan Date: Thu, 15 Jan 2026 07:15:03 +0000 Subject: [PATCH 5/7] misc-fixes --- docs/account.md | 2 +- src/Appwrite/Enums/OAuthProvider.php | 32 ------------------------- tests/Appwrite/Services/StorageTest.php | 12 +++++++--- 3 files changed, 10 insertions(+), 36 deletions(-) diff --git a/docs/account.md b/docs/account.md index aac068bf..8c7314f3 100644 --- a/docs/account.md +++ b/docs/account.md @@ -565,7 +565,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about | Field Name | Type | Description | Default | | --- | --- | --- | --- | -| provider | string | **Required** OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom, githubImagine, googleImagine. | | +| provider | string | **Required** OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom. | | | success | string | URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. | | | failure | string | URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. | | | scopes | array | A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long. | [] | diff --git a/src/Appwrite/Enums/OAuthProvider.php b/src/Appwrite/Enums/OAuthProvider.php index 47f6a206..9e12b9a9 100644 --- a/src/Appwrite/Enums/OAuthProvider.php +++ b/src/Appwrite/Enums/OAuthProvider.php @@ -45,10 +45,6 @@ class OAuthProvider implements JsonSerializable private static OAuthProvider $YANDEX; private static OAuthProvider $ZOHO; private static OAuthProvider $ZOOM; - private static OAuthProvider $MOCK; - private static OAuthProvider $MOCKUNVERIFIED; - private static OAuthProvider $GITHUBIMAGINE; - private static OAuthProvider $GOOGLEIMAGINE; private string $value; @@ -340,32 +336,4 @@ public static function ZOOM(): OAuthProvider } return self::$ZOOM; } - public static function MOCK(): OAuthProvider - { - if (!isset(self::$MOCK)) { - self::$MOCK = new OAuthProvider('mock'); - } - return self::$MOCK; - } - public static function MOCKUNVERIFIED(): OAuthProvider - { - if (!isset(self::$MOCKUNVERIFIED)) { - self::$MOCKUNVERIFIED = new OAuthProvider('mock-unverified'); - } - return self::$MOCKUNVERIFIED; - } - public static function GITHUBIMAGINE(): OAuthProvider - { - if (!isset(self::$GITHUBIMAGINE)) { - self::$GITHUBIMAGINE = new OAuthProvider('githubImagine'); - } - return self::$GITHUBIMAGINE; - } - public static function GOOGLEIMAGINE(): OAuthProvider - { - if (!isset(self::$GOOGLEIMAGINE)) { - self::$GOOGLEIMAGINE = new OAuthProvider('googleImagine'); - } - return self::$GOOGLEIMAGINE; - } } \ No newline at end of file diff --git a/tests/Appwrite/Services/StorageTest.php b/tests/Appwrite/Services/StorageTest.php index 9f22c719..4d01dae8 100644 --- a/tests/Appwrite/Services/StorageTest.php +++ b/tests/Appwrite/Services/StorageTest.php @@ -169,7 +169,9 @@ public function testMethodCreateFile(): void { "mimeType" => "image/png", "sizeOriginal" => 17890, "chunksTotal" => 17890, - "chunksUploaded" => 17890); + "chunksUploaded" => 17890, + "encryption" => true, + "compression" => "gzip"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -197,7 +199,9 @@ public function testMethodGetFile(): void { "mimeType" => "image/png", "sizeOriginal" => 17890, "chunksTotal" => 17890, - "chunksUploaded" => 17890); + "chunksUploaded" => 17890, + "encryption" => true, + "compression" => "gzip"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -224,7 +228,9 @@ public function testMethodUpdateFile(): void { "mimeType" => "image/png", "sizeOriginal" => 17890, "chunksTotal" => 17890, - "chunksUploaded" => 17890); + "chunksUploaded" => 17890, + "encryption" => true, + "compression" => "gzip"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) From a90c24a2f372e96629f4e30c05d573d8478c96a2 Mon Sep 17 00:00:00 2001 From: Darshan Date: Thu, 15 Jan 2026 07:42:39 +0000 Subject: [PATCH 6/7] misc-fixes --- .../get-queue-billing-project-aggregation.md | 15 -- .../get-queue-billing-team-aggregation.md | 15 -- .../health/get-queue-priority-builds.md | 15 -- .../health/get-queue-region-manager.md | 15 -- docs/examples/health/get-queue-threats.md | 15 -- docs/health.md | 65 -------- src/Appwrite/Services/Health.php | 155 ------------------ tests/Appwrite/Services/HealthTest.php | 75 --------- 8 files changed, 370 deletions(-) delete mode 100644 docs/examples/health/get-queue-billing-project-aggregation.md delete mode 100644 docs/examples/health/get-queue-billing-team-aggregation.md delete mode 100644 docs/examples/health/get-queue-priority-builds.md delete mode 100644 docs/examples/health/get-queue-region-manager.md delete mode 100644 docs/examples/health/get-queue-threats.md diff --git a/docs/examples/health/get-queue-billing-project-aggregation.md b/docs/examples/health/get-queue-billing-project-aggregation.md deleted file mode 100644 index 5a632609..00000000 --- a/docs/examples/health/get-queue-billing-project-aggregation.md +++ /dev/null @@ -1,15 +0,0 @@ -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$health = new Health($client); - -$result = $health->getQueueBillingProjectAggregation( - threshold: null // optional -); \ No newline at end of file diff --git a/docs/examples/health/get-queue-billing-team-aggregation.md b/docs/examples/health/get-queue-billing-team-aggregation.md deleted file mode 100644 index 7cb6fe3f..00000000 --- a/docs/examples/health/get-queue-billing-team-aggregation.md +++ /dev/null @@ -1,15 +0,0 @@ -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$health = new Health($client); - -$result = $health->getQueueBillingTeamAggregation( - threshold: null // optional -); \ No newline at end of file diff --git a/docs/examples/health/get-queue-priority-builds.md b/docs/examples/health/get-queue-priority-builds.md deleted file mode 100644 index a3daf32e..00000000 --- a/docs/examples/health/get-queue-priority-builds.md +++ /dev/null @@ -1,15 +0,0 @@ -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$health = new Health($client); - -$result = $health->getQueuePriorityBuilds( - threshold: null // optional -); \ No newline at end of file diff --git a/docs/examples/health/get-queue-region-manager.md b/docs/examples/health/get-queue-region-manager.md deleted file mode 100644 index e57b7bf2..00000000 --- a/docs/examples/health/get-queue-region-manager.md +++ /dev/null @@ -1,15 +0,0 @@ -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$health = new Health($client); - -$result = $health->getQueueRegionManager( - threshold: null // optional -); \ No newline at end of file diff --git a/docs/examples/health/get-queue-threats.md b/docs/examples/health/get-queue-threats.md deleted file mode 100644 index 694cb2dd..00000000 --- a/docs/examples/health/get-queue-threats.md +++ /dev/null @@ -1,15 +0,0 @@ -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$health = new Health($client); - -$result = $health->getQueueThreats( - threshold: null // optional -); \ No newline at end of file diff --git a/docs/health.md b/docs/health.md index 799431af..dc192949 100644 --- a/docs/health.md +++ b/docs/health.md @@ -49,32 +49,6 @@ GET https://cloud.appwrite.io/v1/health/pubsub ** Check the Appwrite pub-sub servers are up and connection is successful. ** -```http request -GET https://cloud.appwrite.io/v1/health/queue/billing-project-aggregation -``` - -** Get billing project aggregation queue. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 10000 | - - -```http request -GET https://cloud.appwrite.io/v1/health/queue/billing-team-aggregation -``` - -** Get billing team aggregation queue. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 10000 | - - ```http request GET https://cloud.appwrite.io/v1/health/queue/builds ``` @@ -88,19 +62,6 @@ GET https://cloud.appwrite.io/v1/health/queue/builds | threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 5000 | -```http request -GET https://cloud.appwrite.io/v1/health/queue/builds-priority -``` - -** Get the priority builds queue size. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 500. | 500 | - - ```http request GET https://cloud.appwrite.io/v1/health/queue/certificates ``` @@ -221,19 +182,6 @@ GET https://cloud.appwrite.io/v1/health/queue/migrations | threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 5000 | -```http request -GET https://cloud.appwrite.io/v1/health/queue/region-manager -``` - -** Get region manager queue. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 100. | 100 | - - ```http request GET https://cloud.appwrite.io/v1/health/queue/stats-resources ``` @@ -260,19 +208,6 @@ GET https://cloud.appwrite.io/v1/health/queue/stats-usage | threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 5000 | -```http request -GET https://cloud.appwrite.io/v1/health/queue/threats -``` - -** Get threats queue. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 100. | 100 | - - ```http request GET https://cloud.appwrite.io/v1/health/queue/webhooks ``` diff --git a/src/Appwrite/Services/Health.php b/src/Appwrite/Services/Health.php index 49552432..86183b47 100644 --- a/src/Appwrite/Services/Health.php +++ b/src/Appwrite/Services/Health.php @@ -177,68 +177,6 @@ public function getPubSub(): array ); } - /** - * Get billing project aggregation queue. - * - * @param ?int $threshold - * @throws AppwriteException - * @return array - */ - public function getQueueBillingProjectAggregation(?int $threshold = null): array - { - $apiPath = str_replace( - [], - [], - '/health/queue/billing-project-aggregation' - ); - - $apiParams = []; - - if (!is_null($threshold)) { - $apiParams['threshold'] = $threshold; - } - - $apiHeaders = []; - - return $this->client->call( - Client::METHOD_GET, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * Get billing team aggregation queue. - * - * @param ?int $threshold - * @throws AppwriteException - * @return array - */ - public function getQueueBillingTeamAggregation(?int $threshold = null): array - { - $apiPath = str_replace( - [], - [], - '/health/queue/billing-team-aggregation' - ); - - $apiParams = []; - - if (!is_null($threshold)) { - $apiParams['threshold'] = $threshold; - } - - $apiHeaders = []; - - return $this->client->call( - Client::METHOD_GET, - $apiPath, - $apiHeaders, - $apiParams - ); - } - /** * Get the number of builds that are waiting to be processed in the Appwrite * internal queue server. @@ -271,37 +209,6 @@ public function getQueueBuilds(?int $threshold = null): array ); } - /** - * Get the priority builds queue size. - * - * @param ?int $threshold - * @throws AppwriteException - * @return array - */ - public function getQueuePriorityBuilds(?int $threshold = null): array - { - $apiPath = str_replace( - [], - [], - '/health/queue/builds-priority' - ); - - $apiParams = []; - - if (!is_null($threshold)) { - $apiParams['threshold'] = $threshold; - } - - $apiHeaders = []; - - return $this->client->call( - Client::METHOD_GET, - $apiPath, - $apiHeaders, - $apiParams - ); - } - /** * Get the number of certificates that are waiting to be issued against * [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue @@ -598,37 +505,6 @@ public function getQueueMigrations(?int $threshold = null): array ); } - /** - * Get region manager queue. - * - * @param ?int $threshold - * @throws AppwriteException - * @return array - */ - public function getQueueRegionManager(?int $threshold = null): array - { - $apiPath = str_replace( - [], - [], - '/health/queue/region-manager' - ); - - $apiParams = []; - - if (!is_null($threshold)) { - $apiParams['threshold'] = $threshold; - } - - $apiHeaders = []; - - return $this->client->call( - Client::METHOD_GET, - $apiPath, - $apiHeaders, - $apiParams - ); - } - /** * Get the number of metrics that are waiting to be processed in the Appwrite * stats resources queue. @@ -693,37 +569,6 @@ public function getQueueUsage(?int $threshold = null): array ); } - /** - * Get threats queue. - * - * @param ?int $threshold - * @throws AppwriteException - * @return array - */ - public function getQueueThreats(?int $threshold = null): array - { - $apiPath = str_replace( - [], - [], - '/health/queue/threats' - ); - - $apiParams = []; - - if (!is_null($threshold)) { - $apiParams['threshold'] = $threshold; - } - - $apiHeaders = []; - - return $this->client->call( - Client::METHOD_GET, - $apiPath, - $apiHeaders, - $apiParams - ); - } - /** * Get the number of webhooks that are waiting to be processed in the Appwrite * internal queue server. diff --git a/tests/Appwrite/Services/HealthTest.php b/tests/Appwrite/Services/HealthTest.php index 1f88b5b9..e3e58496 100644 --- a/tests/Appwrite/Services/HealthTest.php +++ b/tests/Appwrite/Services/HealthTest.php @@ -121,36 +121,6 @@ public function testMethodGetPubSub(): void { $this->assertSame($data, $response); } - public function testMethodGetQueueBillingProjectAggregation(): void { - - $data = array( - "size" => 8); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->health->getQueueBillingProjectAggregation( - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetQueueBillingTeamAggregation(): void { - - $data = array( - "size" => 8); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->health->getQueueBillingTeamAggregation( - ); - - $this->assertSame($data, $response); - } - public function testMethodGetQueueBuilds(): void { $data = array( @@ -166,21 +136,6 @@ public function testMethodGetQueueBuilds(): void { $this->assertSame($data, $response); } - public function testMethodGetQueuePriorityBuilds(): void { - - $data = array( - "size" => 8); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->health->getQueuePriorityBuilds( - ); - - $this->assertSame($data, $response); - } - public function testMethodGetQueueCertificates(): void { $data = array( @@ -317,21 +272,6 @@ public function testMethodGetQueueMigrations(): void { $this->assertSame($data, $response); } - public function testMethodGetQueueRegionManager(): void { - - $data = array( - "size" => 8); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->health->getQueueRegionManager( - ); - - $this->assertSame($data, $response); - } - public function testMethodGetQueueStatsResources(): void { $data = array( @@ -362,21 +302,6 @@ public function testMethodGetQueueUsage(): void { $this->assertSame($data, $response); } - public function testMethodGetQueueThreats(): void { - - $data = array( - "size" => 8); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->health->getQueueThreats( - ); - - $this->assertSame($data, $response); - } - public function testMethodGetQueueWebhooks(): void { $data = array( From a1e88b1d0628ab422f5a4ade47b367976563ea12 Mon Sep 17 00:00:00 2001 From: Darshan Date: Mon, 9 Feb 2026 06:48:23 +0000 Subject: [PATCH 7/7] regen-as-per-specs --- CHANGELOG.md | 19 - docs/account.md | 72 ++- docs/databases.md | 154 +++++ .../account/create-anonymous-session.md | 2 + .../account/create-email-password-session.md | 3 +- docs/examples/account/create-email-token.md | 3 +- .../account/create-email-verification.md | 3 +- docs/examples/account/create-jwt.md | 3 +- docs/examples/account/create-key.md | 19 + .../account/create-magic-url-token.md | 3 +- .../account/create-mfa-authenticator.md | 3 +- docs/examples/account/create-mfa-challenge.md | 3 +- .../account/create-mfa-recovery-codes.md | 2 + .../examples/account/create-o-auth-2-token.md | 3 +- docs/examples/account/create-phone-token.md | 3 +- .../account/create-phone-verification.md | 2 + docs/examples/account/create-recovery.md | 3 +- docs/examples/account/create-session.md | 3 +- docs/examples/account/create-verification.md | 3 +- docs/examples/account/create.md | 3 +- docs/examples/account/delete-identity.md | 3 +- docs/examples/account/delete-key.md | 16 + .../account/delete-mfa-authenticator.md | 3 +- docs/examples/account/delete-session.md | 3 +- docs/examples/account/delete-sessions.md | 2 + docs/examples/account/get-key.md | 16 + .../account/get-mfa-recovery-codes.md | 2 + docs/examples/account/get-prefs.md | 2 + docs/examples/account/get-session.md | 3 +- docs/examples/account/get.md | 2 + docs/examples/account/list-identities.md | 3 +- docs/examples/account/list-keys.md | 16 + docs/examples/account/list-logs.md | 3 +- docs/examples/account/list-mfa-factors.md | 2 + docs/examples/account/list-sessions.md | 2 + .../account/update-email-verification.md | 3 +- docs/examples/account/update-email.md | 3 +- docs/examples/account/update-key.md | 20 + .../account/update-magic-url-session.md | 3 +- .../account/update-mfa-authenticator.md | 3 +- docs/examples/account/update-mfa-challenge.md | 3 +- .../account/update-mfa-recovery-codes.md | 2 + docs/examples/account/update-mfa.md | 3 +- docs/examples/account/update-name.md | 3 +- docs/examples/account/update-password.md | 3 +- docs/examples/account/update-phone-session.md | 3 +- .../account/update-phone-verification.md | 3 +- docs/examples/account/update-phone.md | 3 +- docs/examples/account/update-prefs.md | 3 +- docs/examples/account/update-recovery.md | 3 +- docs/examples/account/update-session.md | 3 +- docs/examples/account/update-status.md | 2 + docs/examples/account/update-verification.md | 3 +- docs/examples/avatars/get-browser.md | 3 +- docs/examples/avatars/get-credit-card.md | 3 +- docs/examples/avatars/get-favicon.md | 3 +- docs/examples/avatars/get-flag.md | 3 +- docs/examples/avatars/get-image.md | 3 +- docs/examples/avatars/get-initials.md | 3 +- docs/examples/avatars/get-qr.md | 3 +- docs/examples/avatars/get-screenshot.md | 12 +- docs/examples/backups/create-archive.md | 6 +- docs/examples/backups/create-policy.md | 6 +- docs/examples/backups/create-restoration.md | 6 +- docs/examples/backups/delete-archive.md | 3 +- docs/examples/backups/delete-policy.md | 3 +- docs/examples/backups/get-archive.md | 3 +- docs/examples/backups/get-policy.md | 3 +- docs/examples/backups/get-restoration.md | 3 +- docs/examples/backups/list-archives.md | 3 +- docs/examples/backups/list-policies.md | 3 +- docs/examples/backups/list-restorations.md | 3 +- docs/examples/backups/update-policy.md | 3 +- .../databases/create-boolean-attribute.md | 3 +- docs/examples/databases/create-collection.md | 3 +- .../databases/create-datetime-attribute.md | 3 +- docs/examples/databases/create-document.md | 3 +- docs/examples/databases/create-documents.md | 3 +- .../databases/create-email-attribute.md | 3 +- .../databases/create-enum-attribute.md | 3 +- .../databases/create-float-attribute.md | 3 +- docs/examples/databases/create-index.md | 6 +- .../databases/create-integer-attribute.md | 3 +- .../examples/databases/create-ip-attribute.md | 3 +- .../databases/create-line-attribute.md | 3 +- .../databases/create-longtext-attribute.md | 21 + .../databases/create-mediumtext-attribute.md | 21 + docs/examples/databases/create-operations.md | 3 +- .../databases/create-point-attribute.md | 3 +- .../databases/create-polygon-attribute.md | 3 +- .../create-relationship-attribute.md | 3 +- .../databases/create-string-attribute.md | 3 +- .../databases/create-text-attribute.md | 21 + docs/examples/databases/create-transaction.md | 3 +- .../databases/create-url-attribute.md | 3 +- .../databases/create-varchar-attribute.md | 22 + docs/examples/databases/create.md | 3 +- .../databases/decrement-document-attribute.md | 3 +- docs/examples/databases/delete-attribute.md | 3 +- docs/examples/databases/delete-collection.md | 3 +- docs/examples/databases/delete-document.md | 3 +- docs/examples/databases/delete-documents.md | 3 +- docs/examples/databases/delete-index.md | 3 +- docs/examples/databases/delete-transaction.md | 3 +- docs/examples/databases/delete.md | 3 +- docs/examples/databases/get-attribute.md | 3 +- docs/examples/databases/get-collection.md | 3 +- docs/examples/databases/get-document.md | 3 +- docs/examples/databases/get-index.md | 3 +- docs/examples/databases/get-transaction.md | 3 +- docs/examples/databases/get.md | 3 +- .../databases/increment-document-attribute.md | 3 +- docs/examples/databases/list-attributes.md | 3 +- docs/examples/databases/list-collections.md | 3 +- docs/examples/databases/list-documents.md | 3 +- docs/examples/databases/list-indexes.md | 3 +- docs/examples/databases/list-transactions.md | 3 +- docs/examples/databases/list.md | 3 +- .../databases/update-boolean-attribute.md | 3 +- docs/examples/databases/update-collection.md | 5 +- .../databases/update-datetime-attribute.md | 3 +- docs/examples/databases/update-document.md | 3 +- docs/examples/databases/update-documents.md | 3 +- .../databases/update-email-attribute.md | 3 +- .../databases/update-enum-attribute.md | 3 +- .../databases/update-float-attribute.md | 3 +- .../databases/update-integer-attribute.md | 3 +- .../examples/databases/update-ip-attribute.md | 3 +- .../databases/update-line-attribute.md | 3 +- .../databases/update-longtext-attribute.md | 21 + .../databases/update-mediumtext-attribute.md | 21 + .../databases/update-point-attribute.md | 3 +- .../databases/update-polygon-attribute.md | 3 +- .../update-relationship-attribute.md | 3 +- .../databases/update-string-attribute.md | 3 +- .../databases/update-text-attribute.md | 21 + docs/examples/databases/update-transaction.md | 3 +- .../databases/update-url-attribute.md | 3 +- .../databases/update-varchar-attribute.md | 22 + docs/examples/databases/update.md | 5 +- docs/examples/databases/upsert-document.md | 3 +- docs/examples/databases/upsert-documents.md | 3 +- docs/examples/functions/create-deployment.md | 3 +- .../functions/create-duplicate-deployment.md | 3 +- docs/examples/functions/create-execution.md | 3 +- .../functions/create-template-deployment.md | 3 +- docs/examples/functions/create-variable.md | 3 +- .../functions/create-vcs-deployment.md | 3 +- docs/examples/functions/create.md | 6 +- docs/examples/functions/delete-deployment.md | 3 +- docs/examples/functions/delete-execution.md | 3 +- docs/examples/functions/delete-variable.md | 3 +- docs/examples/functions/delete.md | 3 +- .../functions/get-deployment-download.md | 3 +- docs/examples/functions/get-deployment.md | 3 +- docs/examples/functions/get-execution.md | 3 +- docs/examples/functions/get-variable.md | 3 +- docs/examples/functions/get.md | 3 +- docs/examples/functions/list-deployments.md | 3 +- docs/examples/functions/list-executions.md | 3 +- docs/examples/functions/list-runtimes.md | 2 + .../examples/functions/list-specifications.md | 2 + docs/examples/functions/list-variables.md | 3 +- docs/examples/functions/list.md | 3 +- .../functions/update-deployment-status.md | 3 +- .../functions/update-function-deployment.md | 3 +- docs/examples/functions/update-variable.md | 3 +- docs/examples/functions/update.md | 6 +- docs/examples/graphql/mutation.md | 3 +- docs/examples/graphql/query.md | 3 +- docs/examples/health/get-antivirus.md | 2 + docs/examples/health/get-cache.md | 2 + docs/examples/health/get-certificate.md | 3 +- docs/examples/health/get-db.md | 2 + docs/examples/health/get-failed-jobs.md | 3 +- docs/examples/health/get-pub-sub.md | 2 + docs/examples/health/get-queue-audits.md | 16 + .../get-queue-billing-project-aggregation.md | 16 + .../get-queue-billing-team-aggregation.md | 16 + docs/examples/health/get-queue-builds.md | 3 +- .../examples/health/get-queue-certificates.md | 3 +- docs/examples/health/get-queue-databases.md | 3 +- docs/examples/health/get-queue-deletes.md | 3 +- docs/examples/health/get-queue-functions.md | 3 +- docs/examples/health/get-queue-logs.md | 3 +- docs/examples/health/get-queue-mails.md | 3 +- docs/examples/health/get-queue-messaging.md | 3 +- docs/examples/health/get-queue-migrations.md | 3 +- .../health/get-queue-priority-builds.md | 16 + .../health/get-queue-region-manager.md | 16 + .../health/get-queue-stats-resources.md | 3 +- docs/examples/health/get-queue-threats.md | 16 + docs/examples/health/get-queue-usage.md | 3 +- docs/examples/health/get-queue-webhooks.md | 3 +- docs/examples/health/get-storage-local.md | 2 + docs/examples/health/get-storage.md | 2 + docs/examples/health/get-time.md | 2 + docs/examples/health/get.md | 2 + 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-eu.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 | 3 +- docs/examples/messaging/create-email.md | 3 +- .../examples/messaging/create-fcm-provider.md | 3 +- .../messaging/create-mailgun-provider.md | 3 +- .../messaging/create-msg-91-provider.md | 3 +- docs/examples/messaging/create-push.md | 3 +- .../messaging/create-resend-provider.md | 3 +- .../messaging/create-sendgrid-provider.md | 3 +- docs/examples/messaging/create-sms.md | 3 +- .../messaging/create-smtp-provider.md | 3 +- docs/examples/messaging/create-subscriber.md | 3 +- .../messaging/create-telesign-provider.md | 3 +- .../messaging/create-textmagic-provider.md | 3 +- docs/examples/messaging/create-topic.md | 3 +- .../messaging/create-twilio-provider.md | 3 +- .../messaging/create-vonage-provider.md | 3 +- docs/examples/messaging/delete-provider.md | 3 +- docs/examples/messaging/delete-subscriber.md | 3 +- docs/examples/messaging/delete-topic.md | 3 +- docs/examples/messaging/delete.md | 3 +- docs/examples/messaging/get-message.md | 3 +- docs/examples/messaging/get-provider.md | 3 +- docs/examples/messaging/get-subscriber.md | 3 +- docs/examples/messaging/get-topic.md | 3 +- docs/examples/messaging/list-message-logs.md | 3 +- docs/examples/messaging/list-messages.md | 3 +- docs/examples/messaging/list-provider-logs.md | 3 +- docs/examples/messaging/list-providers.md | 3 +- .../messaging/list-subscriber-logs.md | 3 +- docs/examples/messaging/list-subscribers.md | 3 +- docs/examples/messaging/list-targets.md | 3 +- docs/examples/messaging/list-topic-logs.md | 3 +- docs/examples/messaging/list-topics.md | 3 +- .../messaging/update-apns-provider.md | 3 +- docs/examples/messaging/update-email.md | 3 +- .../examples/messaging/update-fcm-provider.md | 3 +- .../messaging/update-mailgun-provider.md | 3 +- .../messaging/update-msg-91-provider.md | 3 +- docs/examples/messaging/update-push.md | 3 +- .../messaging/update-resend-provider.md | 3 +- .../messaging/update-sendgrid-provider.md | 3 +- docs/examples/messaging/update-sms.md | 3 +- .../messaging/update-smtp-provider.md | 3 +- .../messaging/update-telesign-provider.md | 3 +- .../messaging/update-textmagic-provider.md | 3 +- docs/examples/messaging/update-topic.md | 3 +- .../messaging/update-twilio-provider.md | 3 +- .../messaging/update-vonage-provider.md | 3 +- docs/examples/organizations/delete.md | 3 +- .../estimation-delete-organization.md | 3 +- docs/examples/sites/create-deployment.md | 3 +- .../sites/create-duplicate-deployment.md | 3 +- .../sites/create-template-deployment.md | 3 +- docs/examples/sites/create-variable.md | 3 +- docs/examples/sites/create-vcs-deployment.md | 3 +- docs/examples/sites/create.md | 3 +- docs/examples/sites/delete-deployment.md | 3 +- docs/examples/sites/delete-log.md | 3 +- docs/examples/sites/delete-variable.md | 3 +- docs/examples/sites/delete.md | 3 +- .../examples/sites/get-deployment-download.md | 3 +- docs/examples/sites/get-deployment.md | 3 +- docs/examples/sites/get-log.md | 3 +- docs/examples/sites/get-variable.md | 3 +- docs/examples/sites/get.md | 3 +- docs/examples/sites/list-deployments.md | 3 +- docs/examples/sites/list-frameworks.md | 2 + docs/examples/sites/list-logs.md | 3 +- docs/examples/sites/list-specifications.md | 2 + docs/examples/sites/list-variables.md | 3 +- docs/examples/sites/list.md | 3 +- .../sites/update-deployment-status.md | 3 +- docs/examples/sites/update-site-deployment.md | 3 +- docs/examples/sites/update-variable.md | 3 +- docs/examples/sites/update.md | 3 +- docs/examples/storage/create-bucket.md | 3 +- docs/examples/storage/create-file.md | 3 +- docs/examples/storage/delete-bucket.md | 3 +- docs/examples/storage/delete-file.md | 3 +- docs/examples/storage/get-bucket.md | 3 +- docs/examples/storage/get-file-download.md | 3 +- docs/examples/storage/get-file-preview.md | 3 +- docs/examples/storage/get-file-view.md | 3 +- docs/examples/storage/get-file.md | 3 +- docs/examples/storage/list-buckets.md | 3 +- docs/examples/storage/list-files.md | 3 +- docs/examples/storage/update-bucket.md | 3 +- docs/examples/storage/update-file.md | 3 +- .../tablesdb/create-boolean-column.md | 3 +- .../tablesdb/create-datetime-column.md | 3 +- docs/examples/tablesdb/create-email-column.md | 3 +- docs/examples/tablesdb/create-enum-column.md | 3 +- docs/examples/tablesdb/create-float-column.md | 3 +- docs/examples/tablesdb/create-index.md | 6 +- .../tablesdb/create-integer-column.md | 3 +- docs/examples/tablesdb/create-ip-column.md | 3 +- docs/examples/tablesdb/create-line-column.md | 3 +- .../tablesdb/create-longtext-column.md | 21 + .../tablesdb/create-mediumtext-column.md | 21 + docs/examples/tablesdb/create-operations.md | 3 +- docs/examples/tablesdb/create-point-column.md | 3 +- .../tablesdb/create-polygon-column.md | 3 +- .../tablesdb/create-relationship-column.md | 3 +- docs/examples/tablesdb/create-row.md | 3 +- docs/examples/tablesdb/create-rows.md | 3 +- .../examples/tablesdb/create-string-column.md | 3 +- docs/examples/tablesdb/create-table.md | 3 +- docs/examples/tablesdb/create-text-column.md | 21 + docs/examples/tablesdb/create-transaction.md | 3 +- docs/examples/tablesdb/create-url-column.md | 3 +- .../tablesdb/create-varchar-column.md | 22 + docs/examples/tablesdb/create.md | 3 +- .../examples/tablesdb/decrement-row-column.md | 3 +- docs/examples/tablesdb/delete-column.md | 3 +- docs/examples/tablesdb/delete-index.md | 3 +- docs/examples/tablesdb/delete-row.md | 3 +- docs/examples/tablesdb/delete-rows.md | 3 +- docs/examples/tablesdb/delete-table.md | 3 +- docs/examples/tablesdb/delete-transaction.md | 3 +- docs/examples/tablesdb/delete.md | 3 +- docs/examples/tablesdb/get-column.md | 3 +- docs/examples/tablesdb/get-index.md | 3 +- docs/examples/tablesdb/get-row.md | 3 +- docs/examples/tablesdb/get-table.md | 3 +- docs/examples/tablesdb/get-transaction.md | 3 +- docs/examples/tablesdb/get.md | 3 +- .../examples/tablesdb/increment-row-column.md | 3 +- docs/examples/tablesdb/list-columns.md | 3 +- docs/examples/tablesdb/list-indexes.md | 3 +- docs/examples/tablesdb/list-rows.md | 3 +- docs/examples/tablesdb/list-tables.md | 3 +- docs/examples/tablesdb/list-transactions.md | 3 +- docs/examples/tablesdb/list.md | 3 +- .../tablesdb/update-boolean-column.md | 3 +- .../tablesdb/update-datetime-column.md | 3 +- docs/examples/tablesdb/update-email-column.md | 3 +- docs/examples/tablesdb/update-enum-column.md | 3 +- docs/examples/tablesdb/update-float-column.md | 3 +- .../tablesdb/update-integer-column.md | 3 +- docs/examples/tablesdb/update-ip-column.md | 3 +- docs/examples/tablesdb/update-line-column.md | 3 +- .../tablesdb/update-longtext-column.md | 21 + .../tablesdb/update-mediumtext-column.md | 21 + docs/examples/tablesdb/update-point-column.md | 3 +- .../tablesdb/update-polygon-column.md | 3 +- .../tablesdb/update-relationship-column.md | 3 +- docs/examples/tablesdb/update-row.md | 3 +- docs/examples/tablesdb/update-rows.md | 3 +- .../examples/tablesdb/update-string-column.md | 3 +- docs/examples/tablesdb/update-table.md | 5 +- docs/examples/tablesdb/update-text-column.md | 21 + docs/examples/tablesdb/update-transaction.md | 3 +- docs/examples/tablesdb/update-url-column.md | 3 +- .../tablesdb/update-varchar-column.md | 22 + docs/examples/tablesdb/update.md | 5 +- docs/examples/tablesdb/upsert-row.md | 3 +- docs/examples/tablesdb/upsert-rows.md | 3 +- docs/examples/teams/create-membership.md | 3 +- docs/examples/teams/create.md | 3 +- docs/examples/teams/delete-membership.md | 3 +- docs/examples/teams/delete.md | 3 +- docs/examples/teams/get-membership.md | 3 +- docs/examples/teams/get-prefs.md | 3 +- docs/examples/teams/get.md | 3 +- docs/examples/teams/list-memberships.md | 3 +- docs/examples/teams/list.md | 3 +- .../teams/update-membership-status.md | 3 +- docs/examples/teams/update-membership.md | 3 +- docs/examples/teams/update-name.md | 3 +- docs/examples/teams/update-prefs.md | 3 +- docs/examples/tokens/create-file-token.md | 3 +- docs/examples/tokens/delete.md | 3 +- docs/examples/tokens/get.md | 3 +- docs/examples/tokens/list.md | 3 +- docs/examples/tokens/update.md | 3 +- docs/examples/users/create-argon-2-user.md | 3 +- docs/examples/users/create-bcrypt-user.md | 3 +- docs/examples/users/create-jwt.md | 3 +- docs/examples/users/create-md-5-user.md | 3 +- .../users/create-mfa-recovery-codes.md | 3 +- docs/examples/users/create-ph-pass-user.md | 3 +- .../users/create-scrypt-modified-user.md | 3 +- docs/examples/users/create-scrypt-user.md | 3 +- docs/examples/users/create-session.md | 3 +- docs/examples/users/create-sha-user.md | 3 +- docs/examples/users/create-target.md | 3 +- docs/examples/users/create-token.md | 3 +- docs/examples/users/create.md | 3 +- docs/examples/users/delete-identity.md | 3 +- .../users/delete-mfa-authenticator.md | 3 +- docs/examples/users/delete-session.md | 3 +- docs/examples/users/delete-sessions.md | 3 +- docs/examples/users/delete-target.md | 3 +- docs/examples/users/delete.md | 3 +- docs/examples/users/get-mfa-recovery-codes.md | 3 +- docs/examples/users/get-prefs.md | 3 +- docs/examples/users/get-target.md | 3 +- docs/examples/users/get.md | 3 +- docs/examples/users/list-identities.md | 3 +- docs/examples/users/list-logs.md | 3 +- docs/examples/users/list-memberships.md | 3 +- docs/examples/users/list-mfa-factors.md | 3 +- docs/examples/users/list-sessions.md | 3 +- docs/examples/users/list-targets.md | 3 +- docs/examples/users/list.md | 3 +- .../users/update-email-verification.md | 3 +- docs/examples/users/update-email.md | 3 +- docs/examples/users/update-labels.md | 3 +- .../users/update-mfa-recovery-codes.md | 3 +- docs/examples/users/update-mfa.md | 3 +- docs/examples/users/update-name.md | 3 +- docs/examples/users/update-password.md | 3 +- .../users/update-phone-verification.md | 3 +- docs/examples/users/update-phone.md | 3 +- docs/examples/users/update-prefs.md | 3 +- docs/examples/users/update-status.md | 3 +- docs/examples/users/update-target.md | 3 +- docs/health.md | 78 +++ docs/tablesdb.md | 154 +++++ src/Appwrite/Client.php | 4 +- src/Appwrite/Enums/BackupServices.php | 51 ++ src/Appwrite/Enums/BrowserPermission.php | 187 ++++++ src/Appwrite/Enums/BuildRuntime.php | 16 + src/Appwrite/Enums/DeploymentStatus.php | 8 + src/Appwrite/Enums/OAuthProvider.php | 16 + src/Appwrite/Enums/OrderBy.php | 43 ++ src/Appwrite/Enums/Runtime.php | 16 + src/Appwrite/Enums/Scopes.php | 531 ++++++++++++++++++ src/Appwrite/Query.php | 50 ++ src/Appwrite/Services/Account.php | 160 ++++++ src/Appwrite/Services/Avatars.php | 1 + src/Appwrite/Services/Backups.php | 1 + src/Appwrite/Services/Databases.php | 359 +++++++++++- src/Appwrite/Services/Functions.php | 1 + src/Appwrite/Services/Health.php | 187 ++++++ src/Appwrite/Services/TablesDB.php | 365 +++++++++++- tests/Appwrite/QueryTest.php | 40 ++ tests/Appwrite/Services/AccountTest.php | 107 ++++ tests/Appwrite/Services/AvatarsTest.php | 1 + tests/Appwrite/Services/BackupsTest.php | 7 +- tests/Appwrite/Services/DatabasesTest.php | 226 +++++++- tests/Appwrite/Services/FunctionsTest.php | 1 + tests/Appwrite/Services/HealthTest.php | 105 +++- tests/Appwrite/Services/TablesDBTest.php | 226 +++++++- 450 files changed, 4458 insertions(+), 437 deletions(-) create mode 100644 docs/examples/account/create-key.md create mode 100644 docs/examples/account/delete-key.md create mode 100644 docs/examples/account/get-key.md create mode 100644 docs/examples/account/list-keys.md create mode 100644 docs/examples/account/update-key.md create mode 100644 docs/examples/databases/create-longtext-attribute.md create mode 100644 docs/examples/databases/create-mediumtext-attribute.md create mode 100644 docs/examples/databases/create-text-attribute.md create mode 100644 docs/examples/databases/create-varchar-attribute.md create mode 100644 docs/examples/databases/update-longtext-attribute.md create mode 100644 docs/examples/databases/update-mediumtext-attribute.md create mode 100644 docs/examples/databases/update-text-attribute.md create mode 100644 docs/examples/databases/update-varchar-attribute.md create mode 100644 docs/examples/health/get-queue-audits.md create mode 100644 docs/examples/health/get-queue-billing-project-aggregation.md create mode 100644 docs/examples/health/get-queue-billing-team-aggregation.md create mode 100644 docs/examples/health/get-queue-priority-builds.md create mode 100644 docs/examples/health/get-queue-region-manager.md create mode 100644 docs/examples/health/get-queue-threats.md create mode 100644 docs/examples/tablesdb/create-longtext-column.md create mode 100644 docs/examples/tablesdb/create-mediumtext-column.md create mode 100644 docs/examples/tablesdb/create-text-column.md create mode 100644 docs/examples/tablesdb/create-varchar-column.md create mode 100644 docs/examples/tablesdb/update-longtext-column.md create mode 100644 docs/examples/tablesdb/update-mediumtext-column.md create mode 100644 docs/examples/tablesdb/update-text-column.md create mode 100644 docs/examples/tablesdb/update-varchar-column.md create mode 100644 src/Appwrite/Enums/BackupServices.php create mode 100644 src/Appwrite/Enums/BrowserPermission.php create mode 100644 src/Appwrite/Enums/OrderBy.php create mode 100644 src/Appwrite/Enums/Scopes.php diff --git a/CHANGELOG.md b/CHANGELOG.md index e7c7d5b3..14a26e44 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,24 +1,5 @@ # Change Log -## 19.1.1 - -* Update SDK as per latest server specs, these include - - * Updates to Runtime enums - * `Output` is now renamed to `ImageFormat` - Note that this is a breaking change - * Introduces Backups module for managing Database backups - * Introduces Organization module - -## 19.1.0 - -* Added ability to create columns and indexes synchronously while creating a table - -## 19.0.0 - -* Rename `VCSDeploymentType` enum to `VCSReferenceType` -* Change `createTemplateDeployment` method signature: replace `version` parameter with `type` (TemplateReferenceType) - and `reference` parameters -* Add `Theme`, `Timezone` and `Output` enums - ## 18.0.1 * Fix `TablesDB` service to use correct file name diff --git a/docs/account.md b/docs/account.md index 8c7314f3..1aef77c0 100644 --- a/docs/account.md +++ b/docs/account.md @@ -80,6 +80,76 @@ POST https://cloud.appwrite.io/v1/account/jwts | duration | integer | Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds. | 900 | +```http request +GET https://cloud.appwrite.io/v1/account/keys +``` + +** Get a list of all API keys from the current account. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | + + +```http request +POST https://cloud.appwrite.io/v1/account/keys +``` + +** Create a new account API key. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| name | string | Key name. Max length: 128 chars. | | +| scopes | array | Key scopes list. Maximum of 100 scopes are allowed. | | +| expire | string | Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration. | | + + +```http request +GET https://cloud.appwrite.io/v1/account/keys/{keyId} +``` + +** Get a key by its unique ID. This endpoint returns details about a specific API key in your account including it's scopes. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| keyId | string | **Required** Key unique ID. | | + + +```http request +PUT https://cloud.appwrite.io/v1/account/keys/{keyId} +``` + +** Update a key by its unique ID. Use this endpoint to update the name, scopes, or expiration time of an API key. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| keyId | string | **Required** Key unique ID. | | +| name | string | Key name. Max length: 128 chars. | | +| scopes | array | Key scopes list. Maximum of 100 scopes are allowed. | | +| expire | string | Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration. | | + + +```http request +DELETE https://cloud.appwrite.io/v1/account/keys/{keyId} +``` + +** Delete a key by its unique ID. Once deleted, the key can no longer be used to authenticate API calls. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| keyId | string | **Required** Key unique ID. | | + + ```http request GET https://cloud.appwrite.io/v1/account/logs ``` @@ -565,7 +635,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about | Field Name | Type | Description | Default | | --- | --- | --- | --- | -| provider | string | **Required** OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom. | | +| provider | string | **Required** OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom, githubImagine, googleImagine. | | | success | string | URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. | | | failure | string | URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. | | | scopes | array | A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long. | [] | diff --git a/docs/databases.md b/docs/databases.md index 25ccef6b..b719a18f 100644 --- a/docs/databases.md +++ b/docs/databases.md @@ -560,6 +560,82 @@ PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectio | newKey | string | New attribute key. | | +```http request +POST https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionId}/attributes/longtext +``` + +** Create a longtext attribute. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| 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 | Attribute Key. | | +| required | boolean | Is attribute required? | | +| default | string | Default value for attribute when not provided. Cannot be set when attribute is required. | | +| array | boolean | Is attribute an array? | | + + +```http request +PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionId}/attributes/longtext/{key} +``` + +** Update a longtext attribute. Changing the `default` value will not update already existing documents. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | +| 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. | | + + +```http request +POST https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionId}/attributes/mediumtext +``` + +** Create a mediumtext attribute. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| 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 | Attribute Key. | | +| required | boolean | Is attribute required? | | +| default | string | Default value for attribute when not provided. Cannot be set when attribute is required. | | +| array | boolean | Is attribute an array? | | + + +```http request +PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionId}/attributes/mediumtext/{key} +``` + +** Update a mediumtext attribute. Changing the `default` value will not update already existing documents. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | +| 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. | | + + ```http request POST https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionId}/attributes/point ``` @@ -692,6 +768,44 @@ PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectio | newKey | string | New Attribute Key. | | +```http request +POST https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionId}/attributes/text +``` + +** Create a text attribute. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| 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 | Attribute Key. | | +| required | boolean | Is attribute required? | | +| default | string | Default value for attribute when not provided. Cannot be set when attribute is required. | | +| array | boolean | Is attribute an array? | | + + +```http request +PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionId}/attributes/text/{key} +``` + +** Update a text attribute. Changing the `default` value will not update already existing documents. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | +| 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. | | + + ```http request POST https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionId}/attributes/url ``` @@ -730,6 +844,46 @@ PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectio | newKey | string | New Attribute Key. | | +```http request +POST https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionId}/attributes/varchar +``` + +** Create a varchar attribute. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| 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 | Attribute Key. | | +| size | integer | Attribute size for varchar attributes, in number of characters. Maximum size is 16381. | | +| required | boolean | Is attribute required? | | +| default | string | Default value for attribute when not provided. Cannot be set when attribute is required. | | +| array | boolean | Is attribute an array? | | + + +```http request +PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionId}/attributes/varchar/{key} +``` + +** Update a varchar attribute. Changing the `default` value will not update already existing documents. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | +| 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 varchar attribute. | | +| newKey | string | New Attribute Key. | | + + ```http request GET https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionId}/attributes/{key} ``` diff --git a/docs/examples/account/create-anonymous-session.md b/docs/examples/account/create-anonymous-session.md index 9959a3fe..90283cf3 100644 --- a/docs/examples/account/create-anonymous-session.md +++ b/docs/examples/account/create-anonymous-session.md @@ -1,3 +1,4 @@ +```php createAnonymousSession(); +``` diff --git a/docs/examples/account/create-email-password-session.md b/docs/examples/account/create-email-password-session.md index 3ffa5a5a..2a80ab61 100644 --- a/docs/examples/account/create-email-password-session.md +++ b/docs/examples/account/create-email-password-session.md @@ -1,3 +1,4 @@ +```php createEmailPasswordSession( email: 'email@example.com', password: 'password' -); \ No newline at end of file +);``` diff --git a/docs/examples/account/create-email-token.md b/docs/examples/account/create-email-token.md index f1405da5..9c20e746 100644 --- a/docs/examples/account/create-email-token.md +++ b/docs/examples/account/create-email-token.md @@ -1,3 +1,4 @@ +```php createEmailToken( userId: '', email: 'email@example.com', phrase: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/account/create-email-verification.md b/docs/examples/account/create-email-verification.md index 691d6fa3..650f5777 100644 --- a/docs/examples/account/create-email-verification.md +++ b/docs/examples/account/create-email-verification.md @@ -1,3 +1,4 @@ +```php createEmailVerification( url: 'https://example.com' -); \ No newline at end of file +);``` diff --git a/docs/examples/account/create-jwt.md b/docs/examples/account/create-jwt.md index 4031c649..3314407a 100644 --- a/docs/examples/account/create-jwt.md +++ b/docs/examples/account/create-jwt.md @@ -1,3 +1,4 @@ +```php createJWT( duration: 0 // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/account/create-key.md b/docs/examples/account/create-key.md new file mode 100644 index 00000000..cc00f17d --- /dev/null +++ b/docs/examples/account/create-key.md @@ -0,0 +1,19 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->createKey( + name: '', + scopes: [Scopes::ACCOUNT()], + expire: '' // optional +);``` diff --git a/docs/examples/account/create-magic-url-token.md b/docs/examples/account/create-magic-url-token.md index 6e738e64..a4dde3d7 100644 --- a/docs/examples/account/create-magic-url-token.md +++ b/docs/examples/account/create-magic-url-token.md @@ -1,3 +1,4 @@ +```php createMagicURLToken( email: 'email@example.com', url: 'https://example.com', // optional phrase: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/account/create-mfa-authenticator.md b/docs/examples/account/create-mfa-authenticator.md index 2eb50c3f..fbbc193f 100644 --- a/docs/examples/account/create-mfa-authenticator.md +++ b/docs/examples/account/create-mfa-authenticator.md @@ -1,3 +1,4 @@ +```php createMFAAuthenticator( type: AuthenticatorType::TOTP() -); \ No newline at end of file +);``` diff --git a/docs/examples/account/create-mfa-challenge.md b/docs/examples/account/create-mfa-challenge.md index 6f0ecf87..08bf57d8 100644 --- a/docs/examples/account/create-mfa-challenge.md +++ b/docs/examples/account/create-mfa-challenge.md @@ -1,3 +1,4 @@ +```php createMFAChallenge( factor: AuthenticationFactor::EMAIL() -); \ No newline at end of file +);``` diff --git a/docs/examples/account/create-mfa-recovery-codes.md b/docs/examples/account/create-mfa-recovery-codes.md index 031bc4df..655663f7 100644 --- a/docs/examples/account/create-mfa-recovery-codes.md +++ b/docs/examples/account/create-mfa-recovery-codes.md @@ -1,3 +1,4 @@ +```php createMFARecoveryCodes(); +``` diff --git a/docs/examples/account/create-o-auth-2-token.md b/docs/examples/account/create-o-auth-2-token.md index 721ed364..170192d6 100644 --- a/docs/examples/account/create-o-auth-2-token.md +++ b/docs/examples/account/create-o-auth-2-token.md @@ -1,3 +1,4 @@ +```php createOAuth2Token( success: 'https://example.com', // optional failure: 'https://example.com', // optional scopes: [] // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/account/create-phone-token.md b/docs/examples/account/create-phone-token.md index a2b45f76..f48754f5 100644 --- a/docs/examples/account/create-phone-token.md +++ b/docs/examples/account/create-phone-token.md @@ -1,3 +1,4 @@ +```php createPhoneToken( userId: '', phone: '+12065550100' -); \ No newline at end of file +);``` diff --git a/docs/examples/account/create-phone-verification.md b/docs/examples/account/create-phone-verification.md index a1526673..4cedfba4 100644 --- a/docs/examples/account/create-phone-verification.md +++ b/docs/examples/account/create-phone-verification.md @@ -1,3 +1,4 @@ +```php createPhoneVerification(); +``` diff --git a/docs/examples/account/create-recovery.md b/docs/examples/account/create-recovery.md index c15e41d5..c6eaadaf 100644 --- a/docs/examples/account/create-recovery.md +++ b/docs/examples/account/create-recovery.md @@ -1,3 +1,4 @@ +```php createRecovery( email: 'email@example.com', url: 'https://example.com' -); \ No newline at end of file +);``` diff --git a/docs/examples/account/create-session.md b/docs/examples/account/create-session.md index 02525f74..6e339b09 100644 --- a/docs/examples/account/create-session.md +++ b/docs/examples/account/create-session.md @@ -1,3 +1,4 @@ +```php createSession( userId: '', secret: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/account/create-verification.md b/docs/examples/account/create-verification.md index 4628175f..2266a0f1 100644 --- a/docs/examples/account/create-verification.md +++ b/docs/examples/account/create-verification.md @@ -1,3 +1,4 @@ +```php createVerification( url: 'https://example.com' -); \ No newline at end of file +);``` diff --git a/docs/examples/account/create.md b/docs/examples/account/create.md index 91684345..8975698b 100644 --- a/docs/examples/account/create.md +++ b/docs/examples/account/create.md @@ -1,3 +1,4 @@ +```php create( email: 'email@example.com', password: '', name: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/account/delete-identity.md b/docs/examples/account/delete-identity.md index fd66d3ae..56db56fd 100644 --- a/docs/examples/account/delete-identity.md +++ b/docs/examples/account/delete-identity.md @@ -1,3 +1,4 @@ +```php deleteIdentity( identityId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/account/delete-key.md b/docs/examples/account/delete-key.md new file mode 100644 index 00000000..f272ae1c --- /dev/null +++ b/docs/examples/account/delete-key.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->deleteKey( + keyId: '' +);``` diff --git a/docs/examples/account/delete-mfa-authenticator.md b/docs/examples/account/delete-mfa-authenticator.md index 524b9b3e..c171381d 100644 --- a/docs/examples/account/delete-mfa-authenticator.md +++ b/docs/examples/account/delete-mfa-authenticator.md @@ -1,3 +1,4 @@ +```php deleteMFAAuthenticator( type: AuthenticatorType::TOTP() -); \ No newline at end of file +);``` diff --git a/docs/examples/account/delete-session.md b/docs/examples/account/delete-session.md index 9233ae14..b200785f 100644 --- a/docs/examples/account/delete-session.md +++ b/docs/examples/account/delete-session.md @@ -1,3 +1,4 @@ +```php deleteSession( sessionId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/account/delete-sessions.md b/docs/examples/account/delete-sessions.md index 557fd6d3..7886fabf 100644 --- a/docs/examples/account/delete-sessions.md +++ b/docs/examples/account/delete-sessions.md @@ -1,3 +1,4 @@ +```php deleteSessions(); +``` diff --git a/docs/examples/account/get-key.md b/docs/examples/account/get-key.md new file mode 100644 index 00000000..576a9764 --- /dev/null +++ b/docs/examples/account/get-key.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->getKey( + keyId: '' +);``` diff --git a/docs/examples/account/get-mfa-recovery-codes.md b/docs/examples/account/get-mfa-recovery-codes.md index fc5aef27..9a99dac2 100644 --- a/docs/examples/account/get-mfa-recovery-codes.md +++ b/docs/examples/account/get-mfa-recovery-codes.md @@ -1,3 +1,4 @@ +```php getMFARecoveryCodes(); +``` diff --git a/docs/examples/account/get-prefs.md b/docs/examples/account/get-prefs.md index c7077aff..e1259176 100644 --- a/docs/examples/account/get-prefs.md +++ b/docs/examples/account/get-prefs.md @@ -1,3 +1,4 @@ +```php getPrefs(); +``` diff --git a/docs/examples/account/get-session.md b/docs/examples/account/get-session.md index be267134..7e79a07f 100644 --- a/docs/examples/account/get-session.md +++ b/docs/examples/account/get-session.md @@ -1,3 +1,4 @@ +```php getSession( sessionId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/account/get.md b/docs/examples/account/get.md index 30cb7b2a..d1fb255b 100644 --- a/docs/examples/account/get.md +++ b/docs/examples/account/get.md @@ -1,3 +1,4 @@ +```php get(); +``` diff --git a/docs/examples/account/list-identities.md b/docs/examples/account/list-identities.md index b75a64cf..1bd2ef02 100644 --- a/docs/examples/account/list-identities.md +++ b/docs/examples/account/list-identities.md @@ -1,3 +1,4 @@ +```php listIdentities( queries: [], // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/account/list-keys.md b/docs/examples/account/list-keys.md new file mode 100644 index 00000000..7b405d1d --- /dev/null +++ b/docs/examples/account/list-keys.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->listKeys( + total: false // optional +);``` diff --git a/docs/examples/account/list-logs.md b/docs/examples/account/list-logs.md index deddc9ec..763b7727 100644 --- a/docs/examples/account/list-logs.md +++ b/docs/examples/account/list-logs.md @@ -1,3 +1,4 @@ +```php listLogs( queries: [], // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/account/list-mfa-factors.md b/docs/examples/account/list-mfa-factors.md index f7b6e262..96b6021b 100644 --- a/docs/examples/account/list-mfa-factors.md +++ b/docs/examples/account/list-mfa-factors.md @@ -1,3 +1,4 @@ +```php listMFAFactors(); +``` diff --git a/docs/examples/account/list-sessions.md b/docs/examples/account/list-sessions.md index 7f9749f7..9c42f8ca 100644 --- a/docs/examples/account/list-sessions.md +++ b/docs/examples/account/list-sessions.md @@ -1,3 +1,4 @@ +```php listSessions(); +``` diff --git a/docs/examples/account/update-email-verification.md b/docs/examples/account/update-email-verification.md index 95cd1b5e..2fa17a54 100644 --- a/docs/examples/account/update-email-verification.md +++ b/docs/examples/account/update-email-verification.md @@ -1,3 +1,4 @@ +```php updateEmailVerification( userId: '', secret: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/account/update-email.md b/docs/examples/account/update-email.md index c7c0d485..8cdfc5f1 100644 --- a/docs/examples/account/update-email.md +++ b/docs/examples/account/update-email.md @@ -1,3 +1,4 @@ +```php updateEmail( email: 'email@example.com', password: 'password' -); \ No newline at end of file +);``` diff --git a/docs/examples/account/update-key.md b/docs/examples/account/update-key.md new file mode 100644 index 00000000..12736f6c --- /dev/null +++ b/docs/examples/account/update-key.md @@ -0,0 +1,20 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->updateKey( + keyId: '', + name: '', + scopes: [Scopes::ACCOUNT()], + expire: '' // optional +);``` diff --git a/docs/examples/account/update-magic-url-session.md b/docs/examples/account/update-magic-url-session.md index ef6b8cc0..055f0664 100644 --- a/docs/examples/account/update-magic-url-session.md +++ b/docs/examples/account/update-magic-url-session.md @@ -1,3 +1,4 @@ +```php updateMagicURLSession( userId: '', secret: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/account/update-mfa-authenticator.md b/docs/examples/account/update-mfa-authenticator.md index 8486e88c..c2f9dd66 100644 --- a/docs/examples/account/update-mfa-authenticator.md +++ b/docs/examples/account/update-mfa-authenticator.md @@ -1,3 +1,4 @@ +```php updateMFAAuthenticator( type: AuthenticatorType::TOTP(), otp: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/account/update-mfa-challenge.md b/docs/examples/account/update-mfa-challenge.md index e5821e55..effbb172 100644 --- a/docs/examples/account/update-mfa-challenge.md +++ b/docs/examples/account/update-mfa-challenge.md @@ -1,3 +1,4 @@ +```php updateMFAChallenge( challengeId: '', otp: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/account/update-mfa-recovery-codes.md b/docs/examples/account/update-mfa-recovery-codes.md index f57e490f..ee16a9c9 100644 --- a/docs/examples/account/update-mfa-recovery-codes.md +++ b/docs/examples/account/update-mfa-recovery-codes.md @@ -1,3 +1,4 @@ +```php updateMFARecoveryCodes(); +``` diff --git a/docs/examples/account/update-mfa.md b/docs/examples/account/update-mfa.md index a1978e63..3d2f9b62 100644 --- a/docs/examples/account/update-mfa.md +++ b/docs/examples/account/update-mfa.md @@ -1,3 +1,4 @@ +```php updateMFA( mfa: false -); \ No newline at end of file +);``` diff --git a/docs/examples/account/update-name.md b/docs/examples/account/update-name.md index 2603b6e6..4a34bc32 100644 --- a/docs/examples/account/update-name.md +++ b/docs/examples/account/update-name.md @@ -1,3 +1,4 @@ +```php updateName( name: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/account/update-password.md b/docs/examples/account/update-password.md index c5101381..ea1996a6 100644 --- a/docs/examples/account/update-password.md +++ b/docs/examples/account/update-password.md @@ -1,3 +1,4 @@ +```php updatePassword( password: '', oldPassword: 'password' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/account/update-phone-session.md b/docs/examples/account/update-phone-session.md index 42f7fb93..67b5816d 100644 --- a/docs/examples/account/update-phone-session.md +++ b/docs/examples/account/update-phone-session.md @@ -1,3 +1,4 @@ +```php updatePhoneSession( userId: '', secret: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/account/update-phone-verification.md b/docs/examples/account/update-phone-verification.md index df599229..877a0346 100644 --- a/docs/examples/account/update-phone-verification.md +++ b/docs/examples/account/update-phone-verification.md @@ -1,3 +1,4 @@ +```php updatePhoneVerification( userId: '', secret: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/account/update-phone.md b/docs/examples/account/update-phone.md index 853cb62f..6b5e9cad 100644 --- a/docs/examples/account/update-phone.md +++ b/docs/examples/account/update-phone.md @@ -1,3 +1,4 @@ +```php updatePhone( phone: '+12065550100', password: 'password' -); \ No newline at end of file +);``` diff --git a/docs/examples/account/update-prefs.md b/docs/examples/account/update-prefs.md index f6a10030..4709edd2 100644 --- a/docs/examples/account/update-prefs.md +++ b/docs/examples/account/update-prefs.md @@ -1,3 +1,4 @@ +```php updatePrefs( 'timezone' => 'UTC', 'darkTheme' => true ] -); \ No newline at end of file +);``` diff --git a/docs/examples/account/update-recovery.md b/docs/examples/account/update-recovery.md index 63518b00..7b5c1d0b 100644 --- a/docs/examples/account/update-recovery.md +++ b/docs/examples/account/update-recovery.md @@ -1,3 +1,4 @@ +```php updateRecovery( userId: '', secret: '', password: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/account/update-session.md b/docs/examples/account/update-session.md index 11cb4c7d..aecf2fe8 100644 --- a/docs/examples/account/update-session.md +++ b/docs/examples/account/update-session.md @@ -1,3 +1,4 @@ +```php updateSession( sessionId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/account/update-status.md b/docs/examples/account/update-status.md index 7c8075e5..7f0088a6 100644 --- a/docs/examples/account/update-status.md +++ b/docs/examples/account/update-status.md @@ -1,3 +1,4 @@ +```php updateStatus(); +``` diff --git a/docs/examples/account/update-verification.md b/docs/examples/account/update-verification.md index 60ec0b31..24bb3ff0 100644 --- a/docs/examples/account/update-verification.md +++ b/docs/examples/account/update-verification.md @@ -1,3 +1,4 @@ +```php updateVerification( userId: '', secret: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/avatars/get-browser.md b/docs/examples/avatars/get-browser.md index 2449c260..ec2a7599 100644 --- a/docs/examples/avatars/get-browser.md +++ b/docs/examples/avatars/get-browser.md @@ -1,3 +1,4 @@ +```php getBrowser( width: 0, // optional height: 0, // optional quality: -1 // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/avatars/get-credit-card.md b/docs/examples/avatars/get-credit-card.md index 123b345a..05ddc247 100644 --- a/docs/examples/avatars/get-credit-card.md +++ b/docs/examples/avatars/get-credit-card.md @@ -1,3 +1,4 @@ +```php getCreditCard( width: 0, // optional height: 0, // optional quality: -1 // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/avatars/get-favicon.md b/docs/examples/avatars/get-favicon.md index 1e671864..424cea84 100644 --- a/docs/examples/avatars/get-favicon.md +++ b/docs/examples/avatars/get-favicon.md @@ -1,3 +1,4 @@ +```php getFavicon( url: 'https://example.com' -); \ No newline at end of file +);``` diff --git a/docs/examples/avatars/get-flag.md b/docs/examples/avatars/get-flag.md index 5b7d8bab..1a4ef37a 100644 --- a/docs/examples/avatars/get-flag.md +++ b/docs/examples/avatars/get-flag.md @@ -1,3 +1,4 @@ +```php getFlag( width: 0, // optional height: 0, // optional quality: -1 // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/avatars/get-image.md b/docs/examples/avatars/get-image.md index e1555453..4ceb8d38 100644 --- a/docs/examples/avatars/get-image.md +++ b/docs/examples/avatars/get-image.md @@ -1,3 +1,4 @@ +```php getImage( url: 'https://example.com', width: 0, // optional height: 0 // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/avatars/get-initials.md b/docs/examples/avatars/get-initials.md index d84e23a1..2bd523b5 100644 --- a/docs/examples/avatars/get-initials.md +++ b/docs/examples/avatars/get-initials.md @@ -1,3 +1,4 @@ +```php getInitials( width: 0, // optional height: 0, // optional background: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/avatars/get-qr.md b/docs/examples/avatars/get-qr.md index 0d5936af..ad49bf9e 100644 --- a/docs/examples/avatars/get-qr.md +++ b/docs/examples/avatars/get-qr.md @@ -1,3 +1,4 @@ +```php getQR( size: 1, // optional margin: 0, // optional download: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/avatars/get-screenshot.md b/docs/examples/avatars/get-screenshot.md index c936f5c5..9db8b3cd 100644 --- a/docs/examples/avatars/get-screenshot.md +++ b/docs/examples/avatars/get-screenshot.md @@ -1,9 +1,11 @@ +```php getScreenshot( viewportWidth: 1920, // optional viewportHeight: 1080, // optional scale: 2, // optional - theme: Theme::LIGHT(), // optional + theme: Theme::DARK(), // optional userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15', // optional fullpage: true, // optional locale: 'en-US', // optional - timezone: Timezone::AFRICAABIDJAN(), // optional + timezone: Timezone::AMERICANEWYORK(), // optional latitude: 37.7749, // optional longitude: -122.4194, // optional accuracy: 100, // optional touch: true, // optional - permissions: ["geolocation","notifications"], // optional + permissions: [BrowserPermission::GEOLOCATION(), BrowserPermission::NOTIFICATIONS()], // optional sleep: 3, // optional width: 800, // optional height: 600, // optional quality: 85, // optional - output: ImageFormat::JPG() // optional -); \ No newline at end of file + output: ImageFormat::JPEG() // optional +);``` diff --git a/docs/examples/backups/create-archive.md b/docs/examples/backups/create-archive.md index 4744efe2..d73db2e2 100644 --- a/docs/examples/backups/create-archive.md +++ b/docs/examples/backups/create-archive.md @@ -1,7 +1,9 @@ +```php setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -11,6 +13,6 @@ $client = (new Client()) $backups = new Backups($client); $result = $backups->createArchive( - services: [], + services: [BackupServices::DATABASES()], resourceId: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/backups/create-policy.md b/docs/examples/backups/create-policy.md index 4b9aecf6..ea87f280 100644 --- a/docs/examples/backups/create-policy.md +++ b/docs/examples/backups/create-policy.md @@ -1,7 +1,9 @@ +```php setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -12,10 +14,10 @@ $backups = new Backups($client); $result = $backups->createPolicy( policyId: '', - services: [], + services: [BackupServices::DATABASES()], retention: 1, schedule: '', name: '', // optional resourceId: '', // optional enabled: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/backups/create-restoration.md b/docs/examples/backups/create-restoration.md index 1eb34f38..61d9e0b2 100644 --- a/docs/examples/backups/create-restoration.md +++ b/docs/examples/backups/create-restoration.md @@ -1,7 +1,9 @@ +```php setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -12,7 +14,7 @@ $backups = new Backups($client); $result = $backups->createRestoration( archiveId: '', - services: [], + services: [BackupServices::DATABASES()], newResourceId: '', // optional newResourceName: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/backups/delete-archive.md b/docs/examples/backups/delete-archive.md index 3c000f75..a6c3d332 100644 --- a/docs/examples/backups/delete-archive.md +++ b/docs/examples/backups/delete-archive.md @@ -1,3 +1,4 @@ +```php deleteArchive( archiveId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/backups/delete-policy.md b/docs/examples/backups/delete-policy.md index 6a20d405..3c6df8f4 100644 --- a/docs/examples/backups/delete-policy.md +++ b/docs/examples/backups/delete-policy.md @@ -1,3 +1,4 @@ +```php deletePolicy( policyId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/backups/get-archive.md b/docs/examples/backups/get-archive.md index b689fc40..6fa9ea93 100644 --- a/docs/examples/backups/get-archive.md +++ b/docs/examples/backups/get-archive.md @@ -1,3 +1,4 @@ +```php getArchive( archiveId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/backups/get-policy.md b/docs/examples/backups/get-policy.md index 934e4a84..e8ce5c8f 100644 --- a/docs/examples/backups/get-policy.md +++ b/docs/examples/backups/get-policy.md @@ -1,3 +1,4 @@ +```php getPolicy( policyId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/backups/get-restoration.md b/docs/examples/backups/get-restoration.md index ae1b1357..ed3e94ab 100644 --- a/docs/examples/backups/get-restoration.md +++ b/docs/examples/backups/get-restoration.md @@ -1,3 +1,4 @@ +```php getRestoration( restorationId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/backups/list-archives.md b/docs/examples/backups/list-archives.md index 5810f6c9..4060e3c0 100644 --- a/docs/examples/backups/list-archives.md +++ b/docs/examples/backups/list-archives.md @@ -1,3 +1,4 @@ +```php listArchives( queries: [] // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/backups/list-policies.md b/docs/examples/backups/list-policies.md index df0cc414..a8b03316 100644 --- a/docs/examples/backups/list-policies.md +++ b/docs/examples/backups/list-policies.md @@ -1,3 +1,4 @@ +```php listPolicies( queries: [] // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/backups/list-restorations.md b/docs/examples/backups/list-restorations.md index 4d23414a..2c7132b2 100644 --- a/docs/examples/backups/list-restorations.md +++ b/docs/examples/backups/list-restorations.md @@ -1,3 +1,4 @@ +```php listRestorations( queries: [] // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/backups/update-policy.md b/docs/examples/backups/update-policy.md index 0390d004..fe53fa2b 100644 --- a/docs/examples/backups/update-policy.md +++ b/docs/examples/backups/update-policy.md @@ -1,3 +1,4 @@ +```php updatePolicy( retention: 1, // optional schedule: '', // optional enabled: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/create-boolean-attribute.md b/docs/examples/databases/create-boolean-attribute.md index 805d0221..746db6be 100644 --- a/docs/examples/databases/create-boolean-attribute.md +++ b/docs/examples/databases/create-boolean-attribute.md @@ -1,3 +1,4 @@ +```php createBooleanAttribute( required: false, default: false, // optional array: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/create-collection.md b/docs/examples/databases/create-collection.md index aabfa033..a90e579b 100644 --- a/docs/examples/databases/create-collection.md +++ b/docs/examples/databases/create-collection.md @@ -1,3 +1,4 @@ +```php createCollection( enabled: false, // optional attributes: [], // optional indexes: [] // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/create-datetime-attribute.md b/docs/examples/databases/create-datetime-attribute.md index dd2fcecc..f7c38624 100644 --- a/docs/examples/databases/create-datetime-attribute.md +++ b/docs/examples/databases/create-datetime-attribute.md @@ -1,3 +1,4 @@ +```php createDatetimeAttribute( required: false, default: '', // optional array: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/create-document.md b/docs/examples/databases/create-document.md index 39fb26f8..f8e7e943 100644 --- a/docs/examples/databases/create-document.md +++ b/docs/examples/databases/create-document.md @@ -1,3 +1,4 @@ +```php createDocument( ], permissions: [Permission::read(Role::any())], // optional transactionId: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/create-documents.md b/docs/examples/databases/create-documents.md index ced7a5a8..f4f153ae 100644 --- a/docs/examples/databases/create-documents.md +++ b/docs/examples/databases/create-documents.md @@ -1,3 +1,4 @@ +```php createDocuments( collectionId: '', documents: [], transactionId: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/create-email-attribute.md b/docs/examples/databases/create-email-attribute.md index 1274a4b9..4f53b8ac 100644 --- a/docs/examples/databases/create-email-attribute.md +++ b/docs/examples/databases/create-email-attribute.md @@ -1,3 +1,4 @@ +```php createEmailAttribute( required: false, default: 'email@example.com', // optional array: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/create-enum-attribute.md b/docs/examples/databases/create-enum-attribute.md index 9abf2dfa..49eb90a5 100644 --- a/docs/examples/databases/create-enum-attribute.md +++ b/docs/examples/databases/create-enum-attribute.md @@ -1,3 +1,4 @@ +```php createEnumAttribute( required: false, default: '', // optional array: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/create-float-attribute.md b/docs/examples/databases/create-float-attribute.md index e6eecb52..60486bbb 100644 --- a/docs/examples/databases/create-float-attribute.md +++ b/docs/examples/databases/create-float-attribute.md @@ -1,3 +1,4 @@ +```php createFloatAttribute( max: null, // optional default: null, // optional array: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/create-index.md b/docs/examples/databases/create-index.md index 9e8a221e..39b3722e 100644 --- a/docs/examples/databases/create-index.md +++ b/docs/examples/databases/create-index.md @@ -1,8 +1,10 @@ +```php setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -17,6 +19,6 @@ $result = $databases->createIndex( key: '', type: IndexType::KEY(), attributes: [], - orders: [], // optional + orders: [OrderBy::ASC()], // optional lengths: [] // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/create-integer-attribute.md b/docs/examples/databases/create-integer-attribute.md index 1dbeefa5..e1c771fe 100644 --- a/docs/examples/databases/create-integer-attribute.md +++ b/docs/examples/databases/create-integer-attribute.md @@ -1,3 +1,4 @@ +```php createIntegerAttribute( max: null, // optional default: null, // optional array: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/create-ip-attribute.md b/docs/examples/databases/create-ip-attribute.md index f42717ca..b15fc386 100644 --- a/docs/examples/databases/create-ip-attribute.md +++ b/docs/examples/databases/create-ip-attribute.md @@ -1,3 +1,4 @@ +```php createIpAttribute( required: false, default: '', // optional array: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/create-line-attribute.md b/docs/examples/databases/create-line-attribute.md index 56d007c6..dd59e00b 100644 --- a/docs/examples/databases/create-line-attribute.md +++ b/docs/examples/databases/create-line-attribute.md @@ -1,3 +1,4 @@ +```php createLineAttribute( key: '', required: false, default: [[1, 2], [3, 4], [5, 6]] // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/create-longtext-attribute.md b/docs/examples/databases/create-longtext-attribute.md new file mode 100644 index 00000000..9c3b4a65 --- /dev/null +++ b/docs/examples/databases/create-longtext-attribute.md @@ -0,0 +1,21 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->createLongtextAttribute( + databaseId: '', + collectionId: '', + key: '', + required: false, + default: '', // optional + array: false // optional +);``` diff --git a/docs/examples/databases/create-mediumtext-attribute.md b/docs/examples/databases/create-mediumtext-attribute.md new file mode 100644 index 00000000..9c3a78f5 --- /dev/null +++ b/docs/examples/databases/create-mediumtext-attribute.md @@ -0,0 +1,21 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->createMediumtextAttribute( + databaseId: '', + collectionId: '', + key: '', + required: false, + default: '', // optional + array: false // optional +);``` diff --git a/docs/examples/databases/create-operations.md b/docs/examples/databases/create-operations.md index 05038cb6..10b2e6c5 100644 --- a/docs/examples/databases/create-operations.md +++ b/docs/examples/databases/create-operations.md @@ -1,3 +1,4 @@ +```php createOperations( } } ] // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/create-point-attribute.md b/docs/examples/databases/create-point-attribute.md index dee08011..14ced405 100644 --- a/docs/examples/databases/create-point-attribute.md +++ b/docs/examples/databases/create-point-attribute.md @@ -1,3 +1,4 @@ +```php createPointAttribute( key: '', required: false, default: [1, 2] // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/create-polygon-attribute.md b/docs/examples/databases/create-polygon-attribute.md index d7455893..5886cf2c 100644 --- a/docs/examples/databases/create-polygon-attribute.md +++ b/docs/examples/databases/create-polygon-attribute.md @@ -1,3 +1,4 @@ +```php createPolygonAttribute( key: '', required: false, default: [[[1, 2], [3, 4], [5, 6], [1, 2]]] // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/create-relationship-attribute.md b/docs/examples/databases/create-relationship-attribute.md index 551fe17a..739b27e2 100644 --- a/docs/examples/databases/create-relationship-attribute.md +++ b/docs/examples/databases/create-relationship-attribute.md @@ -1,3 +1,4 @@ +```php createRelationshipAttribute( key: '', // optional twoWayKey: '', // optional onDelete: RelationMutate::CASCADE() // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/create-string-attribute.md b/docs/examples/databases/create-string-attribute.md index 5a4f72b6..e6da9507 100644 --- a/docs/examples/databases/create-string-attribute.md +++ b/docs/examples/databases/create-string-attribute.md @@ -1,3 +1,4 @@ +```php createStringAttribute( default: '', // optional array: false, // optional encrypt: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/create-text-attribute.md b/docs/examples/databases/create-text-attribute.md new file mode 100644 index 00000000..b123b1bf --- /dev/null +++ b/docs/examples/databases/create-text-attribute.md @@ -0,0 +1,21 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->createTextAttribute( + databaseId: '', + collectionId: '', + key: '', + required: false, + default: '', // optional + array: false // optional +);``` diff --git a/docs/examples/databases/create-transaction.md b/docs/examples/databases/create-transaction.md index ea6faf73..9ca80288 100644 --- a/docs/examples/databases/create-transaction.md +++ b/docs/examples/databases/create-transaction.md @@ -1,3 +1,4 @@ +```php createTransaction( ttl: 60 // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/create-url-attribute.md b/docs/examples/databases/create-url-attribute.md index 6b9bc800..c1b432df 100644 --- a/docs/examples/databases/create-url-attribute.md +++ b/docs/examples/databases/create-url-attribute.md @@ -1,3 +1,4 @@ +```php createUrlAttribute( required: false, default: 'https://example.com', // optional array: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/create-varchar-attribute.md b/docs/examples/databases/create-varchar-attribute.md new file mode 100644 index 00000000..31a10287 --- /dev/null +++ b/docs/examples/databases/create-varchar-attribute.md @@ -0,0 +1,22 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->createVarcharAttribute( + databaseId: '', + collectionId: '', + key: '', + size: 1, + required: false, + default: '', // optional + array: false // optional +);``` diff --git a/docs/examples/databases/create.md b/docs/examples/databases/create.md index 73c61887..867c31c2 100644 --- a/docs/examples/databases/create.md +++ b/docs/examples/databases/create.md @@ -1,3 +1,4 @@ +```php create( databaseId: '', name: '', enabled: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/decrement-document-attribute.md b/docs/examples/databases/decrement-document-attribute.md index dfb1873c..2c00e787 100644 --- a/docs/examples/databases/decrement-document-attribute.md +++ b/docs/examples/databases/decrement-document-attribute.md @@ -1,3 +1,4 @@ +```php decrementDocumentAttribute( value: null, // optional min: null, // optional transactionId: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/delete-attribute.md b/docs/examples/databases/delete-attribute.md index 71b71626..cc777436 100644 --- a/docs/examples/databases/delete-attribute.md +++ b/docs/examples/databases/delete-attribute.md @@ -1,3 +1,4 @@ +```php deleteAttribute( databaseId: '', collectionId: '', key: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/delete-collection.md b/docs/examples/databases/delete-collection.md index 4e98dfdb..8419bc41 100644 --- a/docs/examples/databases/delete-collection.md +++ b/docs/examples/databases/delete-collection.md @@ -1,3 +1,4 @@ +```php deleteCollection( databaseId: '', collectionId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/delete-document.md b/docs/examples/databases/delete-document.md index 6e4d7aa2..c0c620bc 100644 --- a/docs/examples/databases/delete-document.md +++ b/docs/examples/databases/delete-document.md @@ -1,3 +1,4 @@ +```php deleteDocument( collectionId: '', documentId: '', transactionId: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/delete-documents.md b/docs/examples/databases/delete-documents.md index 3b2b0c79..124294dc 100644 --- a/docs/examples/databases/delete-documents.md +++ b/docs/examples/databases/delete-documents.md @@ -1,3 +1,4 @@ +```php deleteDocuments( collectionId: '', queries: [], // optional transactionId: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/delete-index.md b/docs/examples/databases/delete-index.md index 79e476b6..d8106099 100644 --- a/docs/examples/databases/delete-index.md +++ b/docs/examples/databases/delete-index.md @@ -1,3 +1,4 @@ +```php deleteIndex( databaseId: '', collectionId: '', key: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/delete-transaction.md b/docs/examples/databases/delete-transaction.md index 0559aace..3e2db81e 100644 --- a/docs/examples/databases/delete-transaction.md +++ b/docs/examples/databases/delete-transaction.md @@ -1,3 +1,4 @@ +```php deleteTransaction( transactionId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/delete.md b/docs/examples/databases/delete.md index c796b7c4..9d89cfbc 100644 --- a/docs/examples/databases/delete.md +++ b/docs/examples/databases/delete.md @@ -1,3 +1,4 @@ +```php delete( databaseId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/get-attribute.md b/docs/examples/databases/get-attribute.md index ba82db40..4f3f7f77 100644 --- a/docs/examples/databases/get-attribute.md +++ b/docs/examples/databases/get-attribute.md @@ -1,3 +1,4 @@ +```php getAttribute( databaseId: '', collectionId: '', key: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/get-collection.md b/docs/examples/databases/get-collection.md index ecddab05..e3cccdf3 100644 --- a/docs/examples/databases/get-collection.md +++ b/docs/examples/databases/get-collection.md @@ -1,3 +1,4 @@ +```php getCollection( databaseId: '', collectionId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/get-document.md b/docs/examples/databases/get-document.md index 834602d8..90f8760e 100644 --- a/docs/examples/databases/get-document.md +++ b/docs/examples/databases/get-document.md @@ -1,3 +1,4 @@ +```php getDocument( documentId: '', queries: [], // optional transactionId: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/get-index.md b/docs/examples/databases/get-index.md index e9c63076..001fc6ed 100644 --- a/docs/examples/databases/get-index.md +++ b/docs/examples/databases/get-index.md @@ -1,3 +1,4 @@ +```php getIndex( databaseId: '', collectionId: '', key: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/get-transaction.md b/docs/examples/databases/get-transaction.md index 16ca28da..82b34ae6 100644 --- a/docs/examples/databases/get-transaction.md +++ b/docs/examples/databases/get-transaction.md @@ -1,3 +1,4 @@ +```php getTransaction( transactionId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/get.md b/docs/examples/databases/get.md index 9aa63955..59a83bf9 100644 --- a/docs/examples/databases/get.md +++ b/docs/examples/databases/get.md @@ -1,3 +1,4 @@ +```php get( databaseId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/increment-document-attribute.md b/docs/examples/databases/increment-document-attribute.md index 63162d32..8782cf7d 100644 --- a/docs/examples/databases/increment-document-attribute.md +++ b/docs/examples/databases/increment-document-attribute.md @@ -1,3 +1,4 @@ +```php incrementDocumentAttribute( value: null, // optional max: null, // optional transactionId: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/list-attributes.md b/docs/examples/databases/list-attributes.md index e770292a..dac753db 100644 --- a/docs/examples/databases/list-attributes.md +++ b/docs/examples/databases/list-attributes.md @@ -1,3 +1,4 @@ +```php listAttributes( collectionId: '', queries: [], // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/list-collections.md b/docs/examples/databases/list-collections.md index c71866be..7f994e1d 100644 --- a/docs/examples/databases/list-collections.md +++ b/docs/examples/databases/list-collections.md @@ -1,3 +1,4 @@ +```php listCollections( queries: [], // optional search: '', // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/list-documents.md b/docs/examples/databases/list-documents.md index 8713327f..1ff26925 100644 --- a/docs/examples/databases/list-documents.md +++ b/docs/examples/databases/list-documents.md @@ -1,3 +1,4 @@ +```php listDocuments( queries: [], // optional transactionId: '', // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/list-indexes.md b/docs/examples/databases/list-indexes.md index a26ff7cf..1ebd2692 100644 --- a/docs/examples/databases/list-indexes.md +++ b/docs/examples/databases/list-indexes.md @@ -1,3 +1,4 @@ +```php listIndexes( collectionId: '', queries: [], // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/list-transactions.md b/docs/examples/databases/list-transactions.md index 858e905b..8990c74e 100644 --- a/docs/examples/databases/list-transactions.md +++ b/docs/examples/databases/list-transactions.md @@ -1,3 +1,4 @@ +```php listTransactions( queries: [] // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/list.md b/docs/examples/databases/list.md index f5baccc6..d439184a 100644 --- a/docs/examples/databases/list.md +++ b/docs/examples/databases/list.md @@ -1,3 +1,4 @@ +```php list( queries: [], // optional search: '', // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/update-boolean-attribute.md b/docs/examples/databases/update-boolean-attribute.md index 2e4bee72..f63e5f3f 100644 --- a/docs/examples/databases/update-boolean-attribute.md +++ b/docs/examples/databases/update-boolean-attribute.md @@ -1,3 +1,4 @@ +```php updateBooleanAttribute( required: 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 d37f6e24..79271f6d 100644 --- a/docs/examples/databases/update-collection.md +++ b/docs/examples/databases/update-collection.md @@ -1,3 +1,4 @@ +```php updateCollection( databaseId: '', collectionId: '', - name: '', + name: '', // optional permissions: [Permission::read(Role::any())], // optional documentSecurity: false, // optional enabled: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/update-datetime-attribute.md b/docs/examples/databases/update-datetime-attribute.md index b1a03ec0..a1fb43f6 100644 --- a/docs/examples/databases/update-datetime-attribute.md +++ b/docs/examples/databases/update-datetime-attribute.md @@ -1,3 +1,4 @@ +```php updateDatetimeAttribute( required: false, 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 5037d4bf..7a185451 100644 --- a/docs/examples/databases/update-document.md +++ b/docs/examples/databases/update-document.md @@ -1,3 +1,4 @@ +```php updateDocument( ], // optional permissions: [Permission::read(Role::any())], // optional transactionId: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/update-documents.md b/docs/examples/databases/update-documents.md index 3a4aaad2..c29a467d 100644 --- a/docs/examples/databases/update-documents.md +++ b/docs/examples/databases/update-documents.md @@ -1,3 +1,4 @@ +```php updateDocuments( ], // optional queries: [], // optional transactionId: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/update-email-attribute.md b/docs/examples/databases/update-email-attribute.md index dc9865f8..b4421d5e 100644 --- a/docs/examples/databases/update-email-attribute.md +++ b/docs/examples/databases/update-email-attribute.md @@ -1,3 +1,4 @@ +```php updateEmailAttribute( required: false, 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 f7cd0b7b..c2880f29 100644 --- a/docs/examples/databases/update-enum-attribute.md +++ b/docs/examples/databases/update-enum-attribute.md @@ -1,3 +1,4 @@ +```php updateEnumAttribute( required: false, 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 51f6ec92..3ea48188 100644 --- a/docs/examples/databases/update-float-attribute.md +++ b/docs/examples/databases/update-float-attribute.md @@ -1,3 +1,4 @@ +```php updateFloatAttribute( min: null, // optional max: null, // optional 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 bdbd96ca..29b7ac6b 100644 --- a/docs/examples/databases/update-integer-attribute.md +++ b/docs/examples/databases/update-integer-attribute.md @@ -1,3 +1,4 @@ +```php updateIntegerAttribute( min: null, // optional max: null, // optional 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 130cd0cc..c7490c5f 100644 --- a/docs/examples/databases/update-ip-attribute.md +++ b/docs/examples/databases/update-ip-attribute.md @@ -1,3 +1,4 @@ +```php updateIpAttribute( required: false, default: '', newKey: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/update-line-attribute.md b/docs/examples/databases/update-line-attribute.md index 86b8f646..7cb7dabb 100644 --- a/docs/examples/databases/update-line-attribute.md +++ b/docs/examples/databases/update-line-attribute.md @@ -1,3 +1,4 @@ +```php updateLineAttribute( required: false, default: [[1, 2], [3, 4], [5, 6]], // optional newKey: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/update-longtext-attribute.md b/docs/examples/databases/update-longtext-attribute.md new file mode 100644 index 00000000..d9a217d2 --- /dev/null +++ b/docs/examples/databases/update-longtext-attribute.md @@ -0,0 +1,21 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->updateLongtextAttribute( + databaseId: '', + collectionId: '', + key: '', + required: false, + default: '', + newKey: '' // optional +);``` diff --git a/docs/examples/databases/update-mediumtext-attribute.md b/docs/examples/databases/update-mediumtext-attribute.md new file mode 100644 index 00000000..bae03412 --- /dev/null +++ b/docs/examples/databases/update-mediumtext-attribute.md @@ -0,0 +1,21 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->updateMediumtextAttribute( + databaseId: '', + collectionId: '', + key: '', + required: false, + default: '', + newKey: '' // optional +);``` diff --git a/docs/examples/databases/update-point-attribute.md b/docs/examples/databases/update-point-attribute.md index cdff2265..1359ec90 100644 --- a/docs/examples/databases/update-point-attribute.md +++ b/docs/examples/databases/update-point-attribute.md @@ -1,3 +1,4 @@ +```php updatePointAttribute( required: false, default: [1, 2], // optional newKey: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/update-polygon-attribute.md b/docs/examples/databases/update-polygon-attribute.md index c2736bd4..cf799969 100644 --- a/docs/examples/databases/update-polygon-attribute.md +++ b/docs/examples/databases/update-polygon-attribute.md @@ -1,3 +1,4 @@ +```php updatePolygonAttribute( required: false, default: [[[1, 2], [3, 4], [5, 6], [1, 2]]], // optional 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 a4d68887..824f1f71 100644 --- a/docs/examples/databases/update-relationship-attribute.md +++ b/docs/examples/databases/update-relationship-attribute.md @@ -1,3 +1,4 @@ +```php updateRelationshipAttribute( key: '', 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 e0c8f992..828dda47 100644 --- a/docs/examples/databases/update-string-attribute.md +++ b/docs/examples/databases/update-string-attribute.md @@ -1,3 +1,4 @@ +```php updateStringAttribute( default: '', size: 1, // optional newKey: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/update-text-attribute.md b/docs/examples/databases/update-text-attribute.md new file mode 100644 index 00000000..8de8c78c --- /dev/null +++ b/docs/examples/databases/update-text-attribute.md @@ -0,0 +1,21 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->updateTextAttribute( + databaseId: '', + collectionId: '', + key: '', + required: false, + default: '', + newKey: '' // optional +);``` diff --git a/docs/examples/databases/update-transaction.md b/docs/examples/databases/update-transaction.md index 750eb861..13137b6b 100644 --- a/docs/examples/databases/update-transaction.md +++ b/docs/examples/databases/update-transaction.md @@ -1,3 +1,4 @@ +```php updateTransaction( transactionId: '', commit: false, // optional rollback: false // 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 c2004638..461abf55 100644 --- a/docs/examples/databases/update-url-attribute.md +++ b/docs/examples/databases/update-url-attribute.md @@ -1,3 +1,4 @@ +```php updateUrlAttribute( required: false, default: 'https://example.com', newKey: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/update-varchar-attribute.md b/docs/examples/databases/update-varchar-attribute.md new file mode 100644 index 00000000..0c5dbbe8 --- /dev/null +++ b/docs/examples/databases/update-varchar-attribute.md @@ -0,0 +1,22 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->updateVarcharAttribute( + databaseId: '', + collectionId: '', + key: '', + required: false, + default: '', + size: 1, // optional + newKey: '' // optional +);``` diff --git a/docs/examples/databases/update.md b/docs/examples/databases/update.md index 9b0b0789..67af71aa 100644 --- a/docs/examples/databases/update.md +++ b/docs/examples/databases/update.md @@ -1,3 +1,4 @@ +```php update( databaseId: '', - name: '', + name: '', // optional enabled: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/upsert-document.md b/docs/examples/databases/upsert-document.md index c4cee07e..9b01b8c2 100644 --- a/docs/examples/databases/upsert-document.md +++ b/docs/examples/databases/upsert-document.md @@ -1,3 +1,4 @@ +```php upsertDocument( ], // optional permissions: [Permission::read(Role::any())], // optional transactionId: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/upsert-documents.md b/docs/examples/databases/upsert-documents.md index 06d3a319..5bc04d78 100644 --- a/docs/examples/databases/upsert-documents.md +++ b/docs/examples/databases/upsert-documents.md @@ -1,3 +1,4 @@ +```php upsertDocuments( collectionId: '', documents: [], transactionId: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/functions/create-deployment.md b/docs/examples/functions/create-deployment.md index 7e48b89c..cdee0ff9 100644 --- a/docs/examples/functions/create-deployment.md +++ b/docs/examples/functions/create-deployment.md @@ -1,3 +1,4 @@ +```php createDeployment( activate: false, entrypoint: '', // optional commands: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/functions/create-duplicate-deployment.md b/docs/examples/functions/create-duplicate-deployment.md index a898762c..0cf3a831 100644 --- a/docs/examples/functions/create-duplicate-deployment.md +++ b/docs/examples/functions/create-duplicate-deployment.md @@ -1,3 +1,4 @@ +```php createDuplicateDeployment( functionId: '', deploymentId: '', buildId: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/functions/create-execution.md b/docs/examples/functions/create-execution.md index 9c12e873..70a8fc06 100644 --- a/docs/examples/functions/create-execution.md +++ b/docs/examples/functions/create-execution.md @@ -1,3 +1,4 @@ +```php createExecution( method: ExecutionMethod::GET(), // optional headers: [], // optional scheduledAt: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/functions/create-template-deployment.md b/docs/examples/functions/create-template-deployment.md index a1272523..c6dae9a9 100644 --- a/docs/examples/functions/create-template-deployment.md +++ b/docs/examples/functions/create-template-deployment.md @@ -1,3 +1,4 @@ +```php createTemplateDeployment( type: TemplateReferenceType::COMMIT(), reference: '', activate: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/functions/create-variable.md b/docs/examples/functions/create-variable.md index ec470d54..d860cb32 100644 --- a/docs/examples/functions/create-variable.md +++ b/docs/examples/functions/create-variable.md @@ -1,3 +1,4 @@ +```php createVariable( key: '', value: '', secret: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/functions/create-vcs-deployment.md b/docs/examples/functions/create-vcs-deployment.md index f0442195..5ccab950 100644 --- a/docs/examples/functions/create-vcs-deployment.md +++ b/docs/examples/functions/create-vcs-deployment.md @@ -1,3 +1,4 @@ +```php createVcsDeployment( type: VCSReferenceType::BRANCH(), reference: '', activate: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/functions/create.md b/docs/examples/functions/create.md index f7176871..e921e999 100644 --- a/docs/examples/functions/create.md +++ b/docs/examples/functions/create.md @@ -1,8 +1,10 @@ +```php setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -23,11 +25,11 @@ $result = $functions->create( logging: false, // optional entrypoint: '', // optional commands: '', // optional - scopes: [], // optional + scopes: [Scopes::SESSIONSWRITE()], // optional installationId: '', // optional providerRepositoryId: '', // optional providerBranch: '', // optional providerSilentMode: false, // optional providerRootDirectory: '', // 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 20285d76..96e78e3b 100644 --- a/docs/examples/functions/delete-deployment.md +++ b/docs/examples/functions/delete-deployment.md @@ -1,3 +1,4 @@ +```php deleteDeployment( functionId: '', deploymentId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/functions/delete-execution.md b/docs/examples/functions/delete-execution.md index e55a8b18..e95d2f70 100644 --- a/docs/examples/functions/delete-execution.md +++ b/docs/examples/functions/delete-execution.md @@ -1,3 +1,4 @@ +```php 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 e1fb391d..9be2e174 100644 --- a/docs/examples/functions/delete-variable.md +++ b/docs/examples/functions/delete-variable.md @@ -1,3 +1,4 @@ +```php deleteVariable( functionId: '', variableId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/functions/delete.md b/docs/examples/functions/delete.md index 9f87f5c9..d718bfbf 100644 --- a/docs/examples/functions/delete.md +++ b/docs/examples/functions/delete.md @@ -1,3 +1,4 @@ +```php delete( functionId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/functions/get-deployment-download.md b/docs/examples/functions/get-deployment-download.md index a06f97b6..73842f54 100644 --- a/docs/examples/functions/get-deployment-download.md +++ b/docs/examples/functions/get-deployment-download.md @@ -1,3 +1,4 @@ +```php getDeploymentDownload( functionId: '', deploymentId: '', type: DeploymentDownloadType::SOURCE() // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/functions/get-deployment.md b/docs/examples/functions/get-deployment.md index 945933b2..f8d4a26e 100644 --- a/docs/examples/functions/get-deployment.md +++ b/docs/examples/functions/get-deployment.md @@ -1,3 +1,4 @@ +```php getDeployment( functionId: '', deploymentId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/functions/get-execution.md b/docs/examples/functions/get-execution.md index 7dfeeed0..f647a7fd 100644 --- a/docs/examples/functions/get-execution.md +++ b/docs/examples/functions/get-execution.md @@ -1,3 +1,4 @@ +```php getExecution( functionId: '', executionId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/functions/get-variable.md b/docs/examples/functions/get-variable.md index 4c8d3d6b..8d408643 100644 --- a/docs/examples/functions/get-variable.md +++ b/docs/examples/functions/get-variable.md @@ -1,3 +1,4 @@ +```php getVariable( functionId: '', variableId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/functions/get.md b/docs/examples/functions/get.md index ca2160f6..e5997ee2 100644 --- a/docs/examples/functions/get.md +++ b/docs/examples/functions/get.md @@ -1,3 +1,4 @@ +```php get( functionId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/functions/list-deployments.md b/docs/examples/functions/list-deployments.md index bf903185..bc46662a 100644 --- a/docs/examples/functions/list-deployments.md +++ b/docs/examples/functions/list-deployments.md @@ -1,3 +1,4 @@ +```php listDeployments( queries: [], // optional search: '', // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/functions/list-executions.md b/docs/examples/functions/list-executions.md index 4a7c79cc..9948e862 100644 --- a/docs/examples/functions/list-executions.md +++ b/docs/examples/functions/list-executions.md @@ -1,3 +1,4 @@ +```php listExecutions( functionId: '', queries: [], // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/functions/list-runtimes.md b/docs/examples/functions/list-runtimes.md index 6c77c426..320a9dc6 100644 --- a/docs/examples/functions/list-runtimes.md +++ b/docs/examples/functions/list-runtimes.md @@ -1,3 +1,4 @@ +```php listRuntimes(); +``` diff --git a/docs/examples/functions/list-specifications.md b/docs/examples/functions/list-specifications.md index eec5c33c..f5afe80b 100644 --- a/docs/examples/functions/list-specifications.md +++ b/docs/examples/functions/list-specifications.md @@ -1,3 +1,4 @@ +```php listSpecifications(); +``` diff --git a/docs/examples/functions/list-variables.md b/docs/examples/functions/list-variables.md index f85e8549..8867ad6c 100644 --- a/docs/examples/functions/list-variables.md +++ b/docs/examples/functions/list-variables.md @@ -1,3 +1,4 @@ +```php listVariables( functionId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/functions/list.md b/docs/examples/functions/list.md index 1646a06b..2dc45db0 100644 --- a/docs/examples/functions/list.md +++ b/docs/examples/functions/list.md @@ -1,3 +1,4 @@ +```php list( queries: [], // optional search: '', // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/functions/update-deployment-status.md b/docs/examples/functions/update-deployment-status.md index de36d4e8..311645e5 100644 --- a/docs/examples/functions/update-deployment-status.md +++ b/docs/examples/functions/update-deployment-status.md @@ -1,3 +1,4 @@ +```php updateDeploymentStatus( functionId: '', deploymentId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/functions/update-function-deployment.md b/docs/examples/functions/update-function-deployment.md index 38ba026b..b1c0edb7 100644 --- a/docs/examples/functions/update-function-deployment.md +++ b/docs/examples/functions/update-function-deployment.md @@ -1,3 +1,4 @@ +```php updateFunctionDeployment( functionId: '', deploymentId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/functions/update-variable.md b/docs/examples/functions/update-variable.md index b15597a6..3a280697 100644 --- a/docs/examples/functions/update-variable.md +++ b/docs/examples/functions/update-variable.md @@ -1,3 +1,4 @@ +```php updateVariable( key: '', value: '', // optional secret: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/functions/update.md b/docs/examples/functions/update.md index da5ee889..f9bdac11 100644 --- a/docs/examples/functions/update.md +++ b/docs/examples/functions/update.md @@ -1,8 +1,10 @@ +```php setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -23,11 +25,11 @@ $result = $functions->update( logging: false, // optional entrypoint: '', // optional commands: '', // optional - scopes: [], // optional + scopes: [Scopes::SESSIONSWRITE()], // optional installationId: '', // optional providerRepositoryId: '', // optional providerBranch: '', // optional providerSilentMode: false, // 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 c349bc2d..1e25bf73 100644 --- a/docs/examples/graphql/mutation.md +++ b/docs/examples/graphql/mutation.md @@ -1,3 +1,4 @@ +```php mutation( query: [] -); \ No newline at end of file +);``` diff --git a/docs/examples/graphql/query.md b/docs/examples/graphql/query.md index e6e277c2..90979942 100644 --- a/docs/examples/graphql/query.md +++ b/docs/examples/graphql/query.md @@ -1,3 +1,4 @@ +```php query( query: [] -); \ No newline at end of file +);``` diff --git a/docs/examples/health/get-antivirus.md b/docs/examples/health/get-antivirus.md index 47210646..7f57d8aa 100644 --- a/docs/examples/health/get-antivirus.md +++ b/docs/examples/health/get-antivirus.md @@ -1,3 +1,4 @@ +```php getAntivirus(); +``` diff --git a/docs/examples/health/get-cache.md b/docs/examples/health/get-cache.md index 2e81dae3..8443c64f 100644 --- a/docs/examples/health/get-cache.md +++ b/docs/examples/health/get-cache.md @@ -1,3 +1,4 @@ +```php getCache(); +``` diff --git a/docs/examples/health/get-certificate.md b/docs/examples/health/get-certificate.md index 408581be..d1d1fd1e 100644 --- a/docs/examples/health/get-certificate.md +++ b/docs/examples/health/get-certificate.md @@ -1,3 +1,4 @@ +```php getCertificate( domain: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/health/get-db.md b/docs/examples/health/get-db.md index cfec70e6..1682bcf3 100644 --- a/docs/examples/health/get-db.md +++ b/docs/examples/health/get-db.md @@ -1,3 +1,4 @@ +```php getDB(); +``` diff --git a/docs/examples/health/get-failed-jobs.md b/docs/examples/health/get-failed-jobs.md index 63bc1c83..85867635 100644 --- a/docs/examples/health/get-failed-jobs.md +++ b/docs/examples/health/get-failed-jobs.md @@ -1,3 +1,4 @@ +```php getFailedJobs( name: Name::V1DATABASE(), threshold: null // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/health/get-pub-sub.md b/docs/examples/health/get-pub-sub.md index 1c346caa..97dc4b6f 100644 --- a/docs/examples/health/get-pub-sub.md +++ b/docs/examples/health/get-pub-sub.md @@ -1,3 +1,4 @@ +```php getPubSub(); +``` diff --git a/docs/examples/health/get-queue-audits.md b/docs/examples/health/get-queue-audits.md new file mode 100644 index 00000000..2bfc32e8 --- /dev/null +++ b/docs/examples/health/get-queue-audits.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$health = new Health($client); + +$result = $health->getQueueAudits( + threshold: null // optional +);``` diff --git a/docs/examples/health/get-queue-billing-project-aggregation.md b/docs/examples/health/get-queue-billing-project-aggregation.md new file mode 100644 index 00000000..e04fc2e5 --- /dev/null +++ b/docs/examples/health/get-queue-billing-project-aggregation.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$health = new Health($client); + +$result = $health->getQueueBillingProjectAggregation( + threshold: null // optional +);``` diff --git a/docs/examples/health/get-queue-billing-team-aggregation.md b/docs/examples/health/get-queue-billing-team-aggregation.md new file mode 100644 index 00000000..37fa4d2c --- /dev/null +++ b/docs/examples/health/get-queue-billing-team-aggregation.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$health = new Health($client); + +$result = $health->getQueueBillingTeamAggregation( + threshold: null // optional +);``` diff --git a/docs/examples/health/get-queue-builds.md b/docs/examples/health/get-queue-builds.md index 8c1f7743..607acb20 100644 --- a/docs/examples/health/get-queue-builds.md +++ b/docs/examples/health/get-queue-builds.md @@ -1,3 +1,4 @@ +```php getQueueBuilds( threshold: null // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/health/get-queue-certificates.md b/docs/examples/health/get-queue-certificates.md index 92fb79a9..d70b6574 100644 --- a/docs/examples/health/get-queue-certificates.md +++ b/docs/examples/health/get-queue-certificates.md @@ -1,3 +1,4 @@ +```php getQueueCertificates( threshold: null // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/health/get-queue-databases.md b/docs/examples/health/get-queue-databases.md index 745b4694..96bfb6fd 100644 --- a/docs/examples/health/get-queue-databases.md +++ b/docs/examples/health/get-queue-databases.md @@ -1,3 +1,4 @@ +```php getQueueDatabases( name: '', // optional threshold: null // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/health/get-queue-deletes.md b/docs/examples/health/get-queue-deletes.md index d3952685..2b147f42 100644 --- a/docs/examples/health/get-queue-deletes.md +++ b/docs/examples/health/get-queue-deletes.md @@ -1,3 +1,4 @@ +```php getQueueDeletes( threshold: null // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/health/get-queue-functions.md b/docs/examples/health/get-queue-functions.md index 1a5bea2b..d5b58442 100644 --- a/docs/examples/health/get-queue-functions.md +++ b/docs/examples/health/get-queue-functions.md @@ -1,3 +1,4 @@ +```php getQueueFunctions( threshold: null // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/health/get-queue-logs.md b/docs/examples/health/get-queue-logs.md index cf5e3b9d..cb0125cb 100644 --- a/docs/examples/health/get-queue-logs.md +++ b/docs/examples/health/get-queue-logs.md @@ -1,3 +1,4 @@ +```php getQueueLogs( threshold: null // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/health/get-queue-mails.md b/docs/examples/health/get-queue-mails.md index 132dfa68..56babd6c 100644 --- a/docs/examples/health/get-queue-mails.md +++ b/docs/examples/health/get-queue-mails.md @@ -1,3 +1,4 @@ +```php getQueueMails( threshold: null // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/health/get-queue-messaging.md b/docs/examples/health/get-queue-messaging.md index fd5fdb1e..4539c5d9 100644 --- a/docs/examples/health/get-queue-messaging.md +++ b/docs/examples/health/get-queue-messaging.md @@ -1,3 +1,4 @@ +```php getQueueMessaging( threshold: null // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/health/get-queue-migrations.md b/docs/examples/health/get-queue-migrations.md index 68110189..36b8d4b4 100644 --- a/docs/examples/health/get-queue-migrations.md +++ b/docs/examples/health/get-queue-migrations.md @@ -1,3 +1,4 @@ +```php getQueueMigrations( threshold: null // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/health/get-queue-priority-builds.md b/docs/examples/health/get-queue-priority-builds.md new file mode 100644 index 00000000..b7a97a53 --- /dev/null +++ b/docs/examples/health/get-queue-priority-builds.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$health = new Health($client); + +$result = $health->getQueuePriorityBuilds( + threshold: null // optional +);``` diff --git a/docs/examples/health/get-queue-region-manager.md b/docs/examples/health/get-queue-region-manager.md new file mode 100644 index 00000000..11b63f70 --- /dev/null +++ b/docs/examples/health/get-queue-region-manager.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$health = new Health($client); + +$result = $health->getQueueRegionManager( + threshold: null // optional +);``` diff --git a/docs/examples/health/get-queue-stats-resources.md b/docs/examples/health/get-queue-stats-resources.md index d0bd6c05..da4cee7a 100644 --- a/docs/examples/health/get-queue-stats-resources.md +++ b/docs/examples/health/get-queue-stats-resources.md @@ -1,3 +1,4 @@ +```php getQueueStatsResources( threshold: null // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/health/get-queue-threats.md b/docs/examples/health/get-queue-threats.md new file mode 100644 index 00000000..8ccfb0d6 --- /dev/null +++ b/docs/examples/health/get-queue-threats.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$health = new Health($client); + +$result = $health->getQueueThreats( + threshold: null // optional +);``` diff --git a/docs/examples/health/get-queue-usage.md b/docs/examples/health/get-queue-usage.md index 627a85c8..dd35802b 100644 --- a/docs/examples/health/get-queue-usage.md +++ b/docs/examples/health/get-queue-usage.md @@ -1,3 +1,4 @@ +```php getQueueUsage( threshold: null // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/health/get-queue-webhooks.md b/docs/examples/health/get-queue-webhooks.md index d6ccd7cd..d2877ce6 100644 --- a/docs/examples/health/get-queue-webhooks.md +++ b/docs/examples/health/get-queue-webhooks.md @@ -1,3 +1,4 @@ +```php getQueueWebhooks( threshold: null // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/health/get-storage-local.md b/docs/examples/health/get-storage-local.md index 041d2495..d7524bad 100644 --- a/docs/examples/health/get-storage-local.md +++ b/docs/examples/health/get-storage-local.md @@ -1,3 +1,4 @@ +```php getStorageLocal(); +``` diff --git a/docs/examples/health/get-storage.md b/docs/examples/health/get-storage.md index 377416ed..2a109dec 100644 --- a/docs/examples/health/get-storage.md +++ b/docs/examples/health/get-storage.md @@ -1,3 +1,4 @@ +```php getStorage(); +``` diff --git a/docs/examples/health/get-time.md b/docs/examples/health/get-time.md index aa269934..559b1797 100644 --- a/docs/examples/health/get-time.md +++ b/docs/examples/health/get-time.md @@ -1,3 +1,4 @@ +```php getTime(); +``` diff --git a/docs/examples/health/get.md b/docs/examples/health/get.md index fec3e3f4..4b46ac2c 100644 --- a/docs/examples/health/get.md +++ b/docs/examples/health/get.md @@ -1,3 +1,4 @@ +```php get(); +``` diff --git a/docs/examples/locale/get.md b/docs/examples/locale/get.md index ef4c0432..8b204573 100644 --- a/docs/examples/locale/get.md +++ b/docs/examples/locale/get.md @@ -1,3 +1,4 @@ +```php get(); +``` diff --git a/docs/examples/locale/list-codes.md b/docs/examples/locale/list-codes.md index 273fad08..5c99bbf2 100644 --- a/docs/examples/locale/list-codes.md +++ b/docs/examples/locale/list-codes.md @@ -1,3 +1,4 @@ +```php listCodes(); +``` diff --git a/docs/examples/locale/list-continents.md b/docs/examples/locale/list-continents.md index e8c7ca46..1245b2ec 100644 --- a/docs/examples/locale/list-continents.md +++ b/docs/examples/locale/list-continents.md @@ -1,3 +1,4 @@ +```php listContinents(); +``` diff --git a/docs/examples/locale/list-countries-eu.md b/docs/examples/locale/list-countries-eu.md index c5dd1d2a..9744c8ea 100644 --- a/docs/examples/locale/list-countries-eu.md +++ b/docs/examples/locale/list-countries-eu.md @@ -1,3 +1,4 @@ +```php listCountriesEU(); +``` diff --git a/docs/examples/locale/list-countries-phones.md b/docs/examples/locale/list-countries-phones.md index 7585c107..df66061f 100644 --- a/docs/examples/locale/list-countries-phones.md +++ b/docs/examples/locale/list-countries-phones.md @@ -1,3 +1,4 @@ +```php listCountriesPhones(); +``` diff --git a/docs/examples/locale/list-countries.md b/docs/examples/locale/list-countries.md index 63a2e0b5..f4f96262 100644 --- a/docs/examples/locale/list-countries.md +++ b/docs/examples/locale/list-countries.md @@ -1,3 +1,4 @@ +```php listCountries(); +``` diff --git a/docs/examples/locale/list-currencies.md b/docs/examples/locale/list-currencies.md index d385018e..f4f1125a 100644 --- a/docs/examples/locale/list-currencies.md +++ b/docs/examples/locale/list-currencies.md @@ -1,3 +1,4 @@ +```php listCurrencies(); +``` diff --git a/docs/examples/locale/list-languages.md b/docs/examples/locale/list-languages.md index f0ca4d4f..b25fab64 100644 --- a/docs/examples/locale/list-languages.md +++ b/docs/examples/locale/list-languages.md @@ -1,3 +1,4 @@ +```php listLanguages(); +``` diff --git a/docs/examples/messaging/create-apns-provider.md b/docs/examples/messaging/create-apns-provider.md index 2ce4b7f9..768878ac 100644 --- a/docs/examples/messaging/create-apns-provider.md +++ b/docs/examples/messaging/create-apns-provider.md @@ -1,3 +1,4 @@ +```php createAPNSProvider( bundleId: '', // optional sandbox: false, // optional enabled: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/create-email.md b/docs/examples/messaging/create-email.md index 9de24873..68f46f9e 100644 --- a/docs/examples/messaging/create-email.md +++ b/docs/examples/messaging/create-email.md @@ -1,3 +1,4 @@ +```php createEmail( draft: false, // optional html: false, // optional scheduledAt: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/create-fcm-provider.md b/docs/examples/messaging/create-fcm-provider.md index 8037c231..1ab3e983 100644 --- a/docs/examples/messaging/create-fcm-provider.md +++ b/docs/examples/messaging/create-fcm-provider.md @@ -1,3 +1,4 @@ +```php createFCMProvider( name: '', serviceAccountJSON: [], // optional enabled: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/create-mailgun-provider.md b/docs/examples/messaging/create-mailgun-provider.md index 6c62ee88..ca0a3cb1 100644 --- a/docs/examples/messaging/create-mailgun-provider.md +++ b/docs/examples/messaging/create-mailgun-provider.md @@ -1,3 +1,4 @@ +```php createMailgunProvider( replyToName: '', // optional replyToEmail: 'email@example.com', // optional enabled: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/create-msg-91-provider.md b/docs/examples/messaging/create-msg-91-provider.md index 1eb954a2..78998cf5 100644 --- a/docs/examples/messaging/create-msg-91-provider.md +++ b/docs/examples/messaging/create-msg-91-provider.md @@ -1,3 +1,4 @@ +```php createMsg91Provider( senderId: '', // optional authKey: '', // optional enabled: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/create-push.md b/docs/examples/messaging/create-push.md index 614c758c..2673d48b 100644 --- a/docs/examples/messaging/create-push.md +++ b/docs/examples/messaging/create-push.md @@ -1,3 +1,4 @@ +```php createPush( contentAvailable: false, // optional critical: false, // optional priority: MessagePriority::NORMAL() // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/create-resend-provider.md b/docs/examples/messaging/create-resend-provider.md index e66b0b82..e32ad9fc 100644 --- a/docs/examples/messaging/create-resend-provider.md +++ b/docs/examples/messaging/create-resend-provider.md @@ -1,3 +1,4 @@ +```php createResendProvider( replyToName: '', // optional replyToEmail: 'email@example.com', // optional enabled: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/create-sendgrid-provider.md b/docs/examples/messaging/create-sendgrid-provider.md index 892d8563..38f213c4 100644 --- a/docs/examples/messaging/create-sendgrid-provider.md +++ b/docs/examples/messaging/create-sendgrid-provider.md @@ -1,3 +1,4 @@ +```php createSendgridProvider( replyToName: '', // optional replyToEmail: 'email@example.com', // optional enabled: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/create-sms.md b/docs/examples/messaging/create-sms.md index 50623b5b..5f946dbc 100644 --- a/docs/examples/messaging/create-sms.md +++ b/docs/examples/messaging/create-sms.md @@ -1,3 +1,4 @@ +```php createSMS( targets: [], // optional draft: false, // optional scheduledAt: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/create-smtp-provider.md b/docs/examples/messaging/create-smtp-provider.md index 953bbcf4..05386125 100644 --- a/docs/examples/messaging/create-smtp-provider.md +++ b/docs/examples/messaging/create-smtp-provider.md @@ -1,3 +1,4 @@ +```php createSMTPProvider( replyToName: '', // optional replyToEmail: 'email@example.com', // optional enabled: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/create-subscriber.md b/docs/examples/messaging/create-subscriber.md index 3516fa3d..f0d27831 100644 --- a/docs/examples/messaging/create-subscriber.md +++ b/docs/examples/messaging/create-subscriber.md @@ -1,3 +1,4 @@ +```php createSubscriber( topicId: '', subscriberId: '', targetId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/create-telesign-provider.md b/docs/examples/messaging/create-telesign-provider.md index 90069180..005e6d03 100644 --- a/docs/examples/messaging/create-telesign-provider.md +++ b/docs/examples/messaging/create-telesign-provider.md @@ -1,3 +1,4 @@ +```php createTelesignProvider( customerId: '', // optional apiKey: '', // optional enabled: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/create-textmagic-provider.md b/docs/examples/messaging/create-textmagic-provider.md index 5215d526..262a9e2a 100644 --- a/docs/examples/messaging/create-textmagic-provider.md +++ b/docs/examples/messaging/create-textmagic-provider.md @@ -1,3 +1,4 @@ +```php createTextmagicProvider( username: '', // optional apiKey: '', // optional enabled: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/create-topic.md b/docs/examples/messaging/create-topic.md index e94141cc..460168e4 100644 --- a/docs/examples/messaging/create-topic.md +++ b/docs/examples/messaging/create-topic.md @@ -1,3 +1,4 @@ +```php createTopic( topicId: '', name: '', subscribe: ["any"] // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/create-twilio-provider.md b/docs/examples/messaging/create-twilio-provider.md index c3568286..f8ee4175 100644 --- a/docs/examples/messaging/create-twilio-provider.md +++ b/docs/examples/messaging/create-twilio-provider.md @@ -1,3 +1,4 @@ +```php createTwilioProvider( accountSid: '', // optional authToken: '', // optional enabled: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/create-vonage-provider.md b/docs/examples/messaging/create-vonage-provider.md index adeacbc4..450cf9c5 100644 --- a/docs/examples/messaging/create-vonage-provider.md +++ b/docs/examples/messaging/create-vonage-provider.md @@ -1,3 +1,4 @@ +```php createVonageProvider( apiKey: '', // optional apiSecret: '', // optional enabled: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/delete-provider.md b/docs/examples/messaging/delete-provider.md index f37d18b4..e0a63c15 100644 --- a/docs/examples/messaging/delete-provider.md +++ b/docs/examples/messaging/delete-provider.md @@ -1,3 +1,4 @@ +```php deleteProvider( providerId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/delete-subscriber.md b/docs/examples/messaging/delete-subscriber.md index f7a84259..9720ad07 100644 --- a/docs/examples/messaging/delete-subscriber.md +++ b/docs/examples/messaging/delete-subscriber.md @@ -1,3 +1,4 @@ +```php deleteSubscriber( topicId: '', subscriberId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/delete-topic.md b/docs/examples/messaging/delete-topic.md index 2ec899b1..90614515 100644 --- a/docs/examples/messaging/delete-topic.md +++ b/docs/examples/messaging/delete-topic.md @@ -1,3 +1,4 @@ +```php deleteTopic( topicId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/delete.md b/docs/examples/messaging/delete.md index 5781838b..15489058 100644 --- a/docs/examples/messaging/delete.md +++ b/docs/examples/messaging/delete.md @@ -1,3 +1,4 @@ +```php delete( messageId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/get-message.md b/docs/examples/messaging/get-message.md index cf922219..a1d2f026 100644 --- a/docs/examples/messaging/get-message.md +++ b/docs/examples/messaging/get-message.md @@ -1,3 +1,4 @@ +```php getMessage( messageId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/get-provider.md b/docs/examples/messaging/get-provider.md index d19f5c65..6353e54f 100644 --- a/docs/examples/messaging/get-provider.md +++ b/docs/examples/messaging/get-provider.md @@ -1,3 +1,4 @@ +```php getProvider( providerId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/get-subscriber.md b/docs/examples/messaging/get-subscriber.md index e2a0d7ef..d3a20e95 100644 --- a/docs/examples/messaging/get-subscriber.md +++ b/docs/examples/messaging/get-subscriber.md @@ -1,3 +1,4 @@ +```php getSubscriber( topicId: '', subscriberId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/get-topic.md b/docs/examples/messaging/get-topic.md index fc06cbbc..95ff3ff7 100644 --- a/docs/examples/messaging/get-topic.md +++ b/docs/examples/messaging/get-topic.md @@ -1,3 +1,4 @@ +```php getTopic( topicId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/list-message-logs.md b/docs/examples/messaging/list-message-logs.md index 4e0ab3ea..8bc5631c 100644 --- a/docs/examples/messaging/list-message-logs.md +++ b/docs/examples/messaging/list-message-logs.md @@ -1,3 +1,4 @@ +```php listMessageLogs( messageId: '', queries: [], // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/list-messages.md b/docs/examples/messaging/list-messages.md index d66c64f5..fa6d57c3 100644 --- a/docs/examples/messaging/list-messages.md +++ b/docs/examples/messaging/list-messages.md @@ -1,3 +1,4 @@ +```php listMessages( queries: [], // optional search: '', // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/list-provider-logs.md b/docs/examples/messaging/list-provider-logs.md index 8c8d7f1f..afc3df91 100644 --- a/docs/examples/messaging/list-provider-logs.md +++ b/docs/examples/messaging/list-provider-logs.md @@ -1,3 +1,4 @@ +```php listProviderLogs( providerId: '', queries: [], // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/list-providers.md b/docs/examples/messaging/list-providers.md index da0910ec..281a5220 100644 --- a/docs/examples/messaging/list-providers.md +++ b/docs/examples/messaging/list-providers.md @@ -1,3 +1,4 @@ +```php listProviders( queries: [], // optional search: '', // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/list-subscriber-logs.md b/docs/examples/messaging/list-subscriber-logs.md index 9e453a24..7a0e5ad7 100644 --- a/docs/examples/messaging/list-subscriber-logs.md +++ b/docs/examples/messaging/list-subscriber-logs.md @@ -1,3 +1,4 @@ +```php listSubscriberLogs( subscriberId: '', queries: [], // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/list-subscribers.md b/docs/examples/messaging/list-subscribers.md index f21c788e..096a8f2e 100644 --- a/docs/examples/messaging/list-subscribers.md +++ b/docs/examples/messaging/list-subscribers.md @@ -1,3 +1,4 @@ +```php listSubscribers( queries: [], // optional search: '', // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/list-targets.md b/docs/examples/messaging/list-targets.md index 03ffdbb2..0615d820 100644 --- a/docs/examples/messaging/list-targets.md +++ b/docs/examples/messaging/list-targets.md @@ -1,3 +1,4 @@ +```php listTargets( messageId: '', queries: [], // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/list-topic-logs.md b/docs/examples/messaging/list-topic-logs.md index fae8eec9..d32d27ae 100644 --- a/docs/examples/messaging/list-topic-logs.md +++ b/docs/examples/messaging/list-topic-logs.md @@ -1,3 +1,4 @@ +```php listTopicLogs( topicId: '', queries: [], // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/list-topics.md b/docs/examples/messaging/list-topics.md index b5d4c540..6386df17 100644 --- a/docs/examples/messaging/list-topics.md +++ b/docs/examples/messaging/list-topics.md @@ -1,3 +1,4 @@ +```php listTopics( queries: [], // optional search: '', // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/update-apns-provider.md b/docs/examples/messaging/update-apns-provider.md index 161a1485..aa0e78f0 100644 --- a/docs/examples/messaging/update-apns-provider.md +++ b/docs/examples/messaging/update-apns-provider.md @@ -1,3 +1,4 @@ +```php updateAPNSProvider( teamId: '', // optional bundleId: '', // optional sandbox: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/update-email.md b/docs/examples/messaging/update-email.md index dd0f645a..347f0306 100644 --- a/docs/examples/messaging/update-email.md +++ b/docs/examples/messaging/update-email.md @@ -1,3 +1,4 @@ +```php updateEmail( bcc: [], // optional scheduledAt: '', // optional attachments: [] // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/update-fcm-provider.md b/docs/examples/messaging/update-fcm-provider.md index 0df2b93a..a9a54d1c 100644 --- a/docs/examples/messaging/update-fcm-provider.md +++ b/docs/examples/messaging/update-fcm-provider.md @@ -1,3 +1,4 @@ +```php updateFCMProvider( name: '', // optional enabled: false, // optional serviceAccountJSON: [] // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/update-mailgun-provider.md b/docs/examples/messaging/update-mailgun-provider.md index c99ebc7d..6392e78b 100644 --- a/docs/examples/messaging/update-mailgun-provider.md +++ b/docs/examples/messaging/update-mailgun-provider.md @@ -1,3 +1,4 @@ +```php updateMailgunProvider( fromEmail: 'email@example.com', // optional replyToName: '', // optional replyToEmail: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/update-msg-91-provider.md b/docs/examples/messaging/update-msg-91-provider.md index f6f557cc..67b689c9 100644 --- a/docs/examples/messaging/update-msg-91-provider.md +++ b/docs/examples/messaging/update-msg-91-provider.md @@ -1,3 +1,4 @@ +```php updateMsg91Provider( templateId: '', // optional senderId: '', // optional authKey: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/update-push.md b/docs/examples/messaging/update-push.md index 0fea9a13..0b3f1bcb 100644 --- a/docs/examples/messaging/update-push.md +++ b/docs/examples/messaging/update-push.md @@ -1,3 +1,4 @@ +```php updatePush( contentAvailable: false, // optional critical: false, // optional priority: MessagePriority::NORMAL() // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/update-resend-provider.md b/docs/examples/messaging/update-resend-provider.md index b3f1d1fd..ab60aaf3 100644 --- a/docs/examples/messaging/update-resend-provider.md +++ b/docs/examples/messaging/update-resend-provider.md @@ -1,3 +1,4 @@ +```php updateResendProvider( fromEmail: 'email@example.com', // optional replyToName: '', // optional replyToEmail: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/update-sendgrid-provider.md b/docs/examples/messaging/update-sendgrid-provider.md index b8473c16..e6e0391a 100644 --- a/docs/examples/messaging/update-sendgrid-provider.md +++ b/docs/examples/messaging/update-sendgrid-provider.md @@ -1,3 +1,4 @@ +```php updateSendgridProvider( fromEmail: 'email@example.com', // optional replyToName: '', // optional replyToEmail: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/update-sms.md b/docs/examples/messaging/update-sms.md index 92d3ebbe..3dc932ae 100644 --- a/docs/examples/messaging/update-sms.md +++ b/docs/examples/messaging/update-sms.md @@ -1,3 +1,4 @@ +```php updateSMS( content: '', // optional draft: false, // optional scheduledAt: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/update-smtp-provider.md b/docs/examples/messaging/update-smtp-provider.md index 495f3321..5701b3c2 100644 --- a/docs/examples/messaging/update-smtp-provider.md +++ b/docs/examples/messaging/update-smtp-provider.md @@ -1,3 +1,4 @@ +```php updateSMTPProvider( replyToName: '', // optional replyToEmail: '', // optional enabled: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/update-telesign-provider.md b/docs/examples/messaging/update-telesign-provider.md index 29a54bfa..33fcbb30 100644 --- a/docs/examples/messaging/update-telesign-provider.md +++ b/docs/examples/messaging/update-telesign-provider.md @@ -1,3 +1,4 @@ +```php updateTelesignProvider( customerId: '', // optional apiKey: '', // optional from: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/update-textmagic-provider.md b/docs/examples/messaging/update-textmagic-provider.md index e6a1ed1a..96564c70 100644 --- a/docs/examples/messaging/update-textmagic-provider.md +++ b/docs/examples/messaging/update-textmagic-provider.md @@ -1,3 +1,4 @@ +```php updateTextmagicProvider( username: '', // optional apiKey: '', // optional from: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/update-topic.md b/docs/examples/messaging/update-topic.md index b1f9a32e..257e7544 100644 --- a/docs/examples/messaging/update-topic.md +++ b/docs/examples/messaging/update-topic.md @@ -1,3 +1,4 @@ +```php updateTopic( topicId: '', name: '', // optional subscribe: ["any"] // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/update-twilio-provider.md b/docs/examples/messaging/update-twilio-provider.md index def821ad..c9bcfa9b 100644 --- a/docs/examples/messaging/update-twilio-provider.md +++ b/docs/examples/messaging/update-twilio-provider.md @@ -1,3 +1,4 @@ +```php updateTwilioProvider( accountSid: '', // optional authToken: '', // optional from: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/update-vonage-provider.md b/docs/examples/messaging/update-vonage-provider.md index 0841e284..112745e7 100644 --- a/docs/examples/messaging/update-vonage-provider.md +++ b/docs/examples/messaging/update-vonage-provider.md @@ -1,3 +1,4 @@ +```php updateVonageProvider( apiKey: '', // optional apiSecret: '', // optional from: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/organizations/delete.md b/docs/examples/organizations/delete.md index 256edef4..887b0bef 100644 --- a/docs/examples/organizations/delete.md +++ b/docs/examples/organizations/delete.md @@ -1,3 +1,4 @@ +```php delete( organizationId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/organizations/estimation-delete-organization.md b/docs/examples/organizations/estimation-delete-organization.md index 33bbef10..770e6e73 100644 --- a/docs/examples/organizations/estimation-delete-organization.md +++ b/docs/examples/organizations/estimation-delete-organization.md @@ -1,3 +1,4 @@ +```php estimationDeleteOrganization( organizationId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/sites/create-deployment.md b/docs/examples/sites/create-deployment.md index 30770b78..c890f118 100644 --- a/docs/examples/sites/create-deployment.md +++ b/docs/examples/sites/create-deployment.md @@ -1,3 +1,4 @@ +```php createDeployment( installCommand: '', // optional buildCommand: '', // optional outputDirectory: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/sites/create-duplicate-deployment.md b/docs/examples/sites/create-duplicate-deployment.md index 84f65cd0..97fb1f5d 100644 --- a/docs/examples/sites/create-duplicate-deployment.md +++ b/docs/examples/sites/create-duplicate-deployment.md @@ -1,3 +1,4 @@ +```php createDuplicateDeployment( siteId: '', deploymentId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/sites/create-template-deployment.md b/docs/examples/sites/create-template-deployment.md index 1661bbb4..05f039e7 100644 --- a/docs/examples/sites/create-template-deployment.md +++ b/docs/examples/sites/create-template-deployment.md @@ -1,3 +1,4 @@ +```php createTemplateDeployment( type: TemplateReferenceType::BRANCH(), reference: '', activate: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/sites/create-variable.md b/docs/examples/sites/create-variable.md index 3097e193..fee3ae9d 100644 --- a/docs/examples/sites/create-variable.md +++ b/docs/examples/sites/create-variable.md @@ -1,3 +1,4 @@ +```php createVariable( key: '', value: '', secret: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/sites/create-vcs-deployment.md b/docs/examples/sites/create-vcs-deployment.md index 015bf09d..d01747bc 100644 --- a/docs/examples/sites/create-vcs-deployment.md +++ b/docs/examples/sites/create-vcs-deployment.md @@ -1,3 +1,4 @@ +```php createVcsDeployment( type: VCSReferenceType::BRANCH(), reference: '', activate: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/sites/create.md b/docs/examples/sites/create.md index 6f1fc5ac..9191261f 100644 --- a/docs/examples/sites/create.md +++ b/docs/examples/sites/create.md @@ -1,3 +1,4 @@ +```php create( providerSilentMode: false, // optional providerRootDirectory: '', // optional specification: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/sites/delete-deployment.md b/docs/examples/sites/delete-deployment.md index 4e24748c..97bb976e 100644 --- a/docs/examples/sites/delete-deployment.md +++ b/docs/examples/sites/delete-deployment.md @@ -1,3 +1,4 @@ +```php deleteDeployment( siteId: '', deploymentId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/sites/delete-log.md b/docs/examples/sites/delete-log.md index b6e30643..ed5b3c5b 100644 --- a/docs/examples/sites/delete-log.md +++ b/docs/examples/sites/delete-log.md @@ -1,3 +1,4 @@ +```php deleteLog( siteId: '', logId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/sites/delete-variable.md b/docs/examples/sites/delete-variable.md index 66325430..bdb2fbf5 100644 --- a/docs/examples/sites/delete-variable.md +++ b/docs/examples/sites/delete-variable.md @@ -1,3 +1,4 @@ +```php deleteVariable( siteId: '', variableId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/sites/delete.md b/docs/examples/sites/delete.md index 8e6363aa..c2965d4e 100644 --- a/docs/examples/sites/delete.md +++ b/docs/examples/sites/delete.md @@ -1,3 +1,4 @@ +```php delete( siteId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/sites/get-deployment-download.md b/docs/examples/sites/get-deployment-download.md index 61fad0bd..5582e964 100644 --- a/docs/examples/sites/get-deployment-download.md +++ b/docs/examples/sites/get-deployment-download.md @@ -1,3 +1,4 @@ +```php getDeploymentDownload( siteId: '', deploymentId: '', type: DeploymentDownloadType::SOURCE() // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/sites/get-deployment.md b/docs/examples/sites/get-deployment.md index 19525d92..91f83678 100644 --- a/docs/examples/sites/get-deployment.md +++ b/docs/examples/sites/get-deployment.md @@ -1,3 +1,4 @@ +```php getDeployment( siteId: '', deploymentId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/sites/get-log.md b/docs/examples/sites/get-log.md index 5ceb2b91..a781d20f 100644 --- a/docs/examples/sites/get-log.md +++ b/docs/examples/sites/get-log.md @@ -1,3 +1,4 @@ +```php getLog( siteId: '', logId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/sites/get-variable.md b/docs/examples/sites/get-variable.md index 0cab412b..80b61eca 100644 --- a/docs/examples/sites/get-variable.md +++ b/docs/examples/sites/get-variable.md @@ -1,3 +1,4 @@ +```php getVariable( siteId: '', variableId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/sites/get.md b/docs/examples/sites/get.md index e5ec061b..c8f8c8e2 100644 --- a/docs/examples/sites/get.md +++ b/docs/examples/sites/get.md @@ -1,3 +1,4 @@ +```php get( siteId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/sites/list-deployments.md b/docs/examples/sites/list-deployments.md index bb49a5a9..82cee298 100644 --- a/docs/examples/sites/list-deployments.md +++ b/docs/examples/sites/list-deployments.md @@ -1,3 +1,4 @@ +```php listDeployments( queries: [], // optional search: '', // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/sites/list-frameworks.md b/docs/examples/sites/list-frameworks.md index 87df92d9..74ea8821 100644 --- a/docs/examples/sites/list-frameworks.md +++ b/docs/examples/sites/list-frameworks.md @@ -1,3 +1,4 @@ +```php listFrameworks(); +``` diff --git a/docs/examples/sites/list-logs.md b/docs/examples/sites/list-logs.md index 3bc45408..5626bbb1 100644 --- a/docs/examples/sites/list-logs.md +++ b/docs/examples/sites/list-logs.md @@ -1,3 +1,4 @@ +```php listLogs( siteId: '', queries: [], // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/sites/list-specifications.md b/docs/examples/sites/list-specifications.md index 42dae1b7..1a732b6a 100644 --- a/docs/examples/sites/list-specifications.md +++ b/docs/examples/sites/list-specifications.md @@ -1,3 +1,4 @@ +```php listSpecifications(); +``` diff --git a/docs/examples/sites/list-variables.md b/docs/examples/sites/list-variables.md index 36aad640..7b7ab117 100644 --- a/docs/examples/sites/list-variables.md +++ b/docs/examples/sites/list-variables.md @@ -1,3 +1,4 @@ +```php listVariables( siteId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/sites/list.md b/docs/examples/sites/list.md index d056e8d9..08c13146 100644 --- a/docs/examples/sites/list.md +++ b/docs/examples/sites/list.md @@ -1,3 +1,4 @@ +```php list( queries: [], // optional search: '', // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/sites/update-deployment-status.md b/docs/examples/sites/update-deployment-status.md index 2714b357..06ffc751 100644 --- a/docs/examples/sites/update-deployment-status.md +++ b/docs/examples/sites/update-deployment-status.md @@ -1,3 +1,4 @@ +```php updateDeploymentStatus( siteId: '', deploymentId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/sites/update-site-deployment.md b/docs/examples/sites/update-site-deployment.md index 6e2614cb..bdac54d4 100644 --- a/docs/examples/sites/update-site-deployment.md +++ b/docs/examples/sites/update-site-deployment.md @@ -1,3 +1,4 @@ +```php updateSiteDeployment( siteId: '', deploymentId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/sites/update-variable.md b/docs/examples/sites/update-variable.md index 84bafe28..96518754 100644 --- a/docs/examples/sites/update-variable.md +++ b/docs/examples/sites/update-variable.md @@ -1,3 +1,4 @@ +```php updateVariable( key: '', value: '', // optional secret: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/sites/update.md b/docs/examples/sites/update.md index d2a6c9d2..42d24fb1 100644 --- a/docs/examples/sites/update.md +++ b/docs/examples/sites/update.md @@ -1,3 +1,4 @@ +```php update( providerSilentMode: false, // optional providerRootDirectory: '', // optional specification: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/storage/create-bucket.md b/docs/examples/storage/create-bucket.md index 31840957..f00c2c7f 100644 --- a/docs/examples/storage/create-bucket.md +++ b/docs/examples/storage/create-bucket.md @@ -1,3 +1,4 @@ +```php createBucket( encryption: false, // optional antivirus: false, // optional transformations: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/storage/create-file.md b/docs/examples/storage/create-file.md index 33bef045..62301b10 100644 --- a/docs/examples/storage/create-file.md +++ b/docs/examples/storage/create-file.md @@ -1,3 +1,4 @@ +```php createFile( fileId: '', file: InputFile::withPath('file.png'), permissions: [Permission::read(Role::any())] // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/storage/delete-bucket.md b/docs/examples/storage/delete-bucket.md index 50adf35b..737f4e1d 100644 --- a/docs/examples/storage/delete-bucket.md +++ b/docs/examples/storage/delete-bucket.md @@ -1,3 +1,4 @@ +```php deleteBucket( bucketId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/storage/delete-file.md b/docs/examples/storage/delete-file.md index d4c45eb6..dd2c3a70 100644 --- a/docs/examples/storage/delete-file.md +++ b/docs/examples/storage/delete-file.md @@ -1,3 +1,4 @@ +```php deleteFile( bucketId: '', fileId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/storage/get-bucket.md b/docs/examples/storage/get-bucket.md index e62c43d2..f6449aec 100644 --- a/docs/examples/storage/get-bucket.md +++ b/docs/examples/storage/get-bucket.md @@ -1,3 +1,4 @@ +```php getBucket( bucketId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/storage/get-file-download.md b/docs/examples/storage/get-file-download.md index defefa59..f55376f0 100644 --- a/docs/examples/storage/get-file-download.md +++ b/docs/examples/storage/get-file-download.md @@ -1,3 +1,4 @@ +```php getFileDownload( bucketId: '', fileId: '', token: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/storage/get-file-preview.md b/docs/examples/storage/get-file-preview.md index aaa15a22..8964011b 100644 --- a/docs/examples/storage/get-file-preview.md +++ b/docs/examples/storage/get-file-preview.md @@ -1,3 +1,4 @@ +```php getFilePreview( background: '', // optional output: ImageFormat::JPG(), // optional token: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/storage/get-file-view.md b/docs/examples/storage/get-file-view.md index dfc84ca1..6a729dc8 100644 --- a/docs/examples/storage/get-file-view.md +++ b/docs/examples/storage/get-file-view.md @@ -1,3 +1,4 @@ +```php getFileView( bucketId: '', fileId: '', token: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/storage/get-file.md b/docs/examples/storage/get-file.md index 69641448..b498b604 100644 --- a/docs/examples/storage/get-file.md +++ b/docs/examples/storage/get-file.md @@ -1,3 +1,4 @@ +```php getFile( bucketId: '', fileId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/storage/list-buckets.md b/docs/examples/storage/list-buckets.md index 8b84a8bf..3b0d79d7 100644 --- a/docs/examples/storage/list-buckets.md +++ b/docs/examples/storage/list-buckets.md @@ -1,3 +1,4 @@ +```php listBuckets( queries: [], // optional search: '', // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/storage/list-files.md b/docs/examples/storage/list-files.md index 309c87c1..77e78cde 100644 --- a/docs/examples/storage/list-files.md +++ b/docs/examples/storage/list-files.md @@ -1,3 +1,4 @@ +```php listFiles( queries: [], // optional search: '', // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/storage/update-bucket.md b/docs/examples/storage/update-bucket.md index 15562578..c14e75c3 100644 --- a/docs/examples/storage/update-bucket.md +++ b/docs/examples/storage/update-bucket.md @@ -1,3 +1,4 @@ +```php updateBucket( encryption: false, // optional antivirus: false, // optional transformations: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/storage/update-file.md b/docs/examples/storage/update-file.md index fc84f590..1e40a492 100644 --- a/docs/examples/storage/update-file.md +++ b/docs/examples/storage/update-file.md @@ -1,3 +1,4 @@ +```php updateFile( fileId: '', name: '', // optional permissions: [Permission::read(Role::any())] // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/create-boolean-column.md b/docs/examples/tablesdb/create-boolean-column.md index 5f0a2de3..b6032a39 100644 --- a/docs/examples/tablesdb/create-boolean-column.md +++ b/docs/examples/tablesdb/create-boolean-column.md @@ -1,3 +1,4 @@ +```php createBooleanColumn( required: false, default: false, // optional array: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/create-datetime-column.md b/docs/examples/tablesdb/create-datetime-column.md index 9ea8e8f4..9e9ad843 100644 --- a/docs/examples/tablesdb/create-datetime-column.md +++ b/docs/examples/tablesdb/create-datetime-column.md @@ -1,3 +1,4 @@ +```php createDatetimeColumn( required: false, default: '', // optional array: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/create-email-column.md b/docs/examples/tablesdb/create-email-column.md index 64f3a082..f24aa050 100644 --- a/docs/examples/tablesdb/create-email-column.md +++ b/docs/examples/tablesdb/create-email-column.md @@ -1,3 +1,4 @@ +```php createEmailColumn( required: false, default: 'email@example.com', // optional array: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/create-enum-column.md b/docs/examples/tablesdb/create-enum-column.md index 0506a336..95157424 100644 --- a/docs/examples/tablesdb/create-enum-column.md +++ b/docs/examples/tablesdb/create-enum-column.md @@ -1,3 +1,4 @@ +```php createEnumColumn( required: false, default: '', // optional array: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/create-float-column.md b/docs/examples/tablesdb/create-float-column.md index 65a7f00f..c83abba7 100644 --- a/docs/examples/tablesdb/create-float-column.md +++ b/docs/examples/tablesdb/create-float-column.md @@ -1,3 +1,4 @@ +```php createFloatColumn( max: null, // optional default: null, // optional array: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/create-index.md b/docs/examples/tablesdb/create-index.md index 1a3fd130..c91356f2 100644 --- a/docs/examples/tablesdb/create-index.md +++ b/docs/examples/tablesdb/create-index.md @@ -1,8 +1,10 @@ +```php setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -17,6 +19,6 @@ $result = $tablesDB->createIndex( key: '', type: IndexType::KEY(), columns: [], - orders: [], // optional + orders: [OrderBy::ASC()], // optional lengths: [] // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/create-integer-column.md b/docs/examples/tablesdb/create-integer-column.md index 4bf96e8b..a42c8710 100644 --- a/docs/examples/tablesdb/create-integer-column.md +++ b/docs/examples/tablesdb/create-integer-column.md @@ -1,3 +1,4 @@ +```php createIntegerColumn( max: null, // optional default: null, // optional array: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/create-ip-column.md b/docs/examples/tablesdb/create-ip-column.md index ab0032e4..f40fe61d 100644 --- a/docs/examples/tablesdb/create-ip-column.md +++ b/docs/examples/tablesdb/create-ip-column.md @@ -1,3 +1,4 @@ +```php createIpColumn( required: false, default: '', // optional array: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/create-line-column.md b/docs/examples/tablesdb/create-line-column.md index 69f2e667..c1d17b82 100644 --- a/docs/examples/tablesdb/create-line-column.md +++ b/docs/examples/tablesdb/create-line-column.md @@ -1,3 +1,4 @@ +```php createLineColumn( key: '', required: false, default: [[1, 2], [3, 4], [5, 6]] // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/create-longtext-column.md b/docs/examples/tablesdb/create-longtext-column.md new file mode 100644 index 00000000..cb2bd85d --- /dev/null +++ b/docs/examples/tablesdb/create-longtext-column.md @@ -0,0 +1,21 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDB = new TablesDB($client); + +$result = $tablesDB->createLongtextColumn( + databaseId: '', + tableId: '', + key: '', + required: false, + default: '', // optional + array: false // optional +);``` diff --git a/docs/examples/tablesdb/create-mediumtext-column.md b/docs/examples/tablesdb/create-mediumtext-column.md new file mode 100644 index 00000000..b17328c8 --- /dev/null +++ b/docs/examples/tablesdb/create-mediumtext-column.md @@ -0,0 +1,21 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDB = new TablesDB($client); + +$result = $tablesDB->createMediumtextColumn( + databaseId: '', + tableId: '', + key: '', + required: false, + default: '', // optional + array: false // optional +);``` diff --git a/docs/examples/tablesdb/create-operations.md b/docs/examples/tablesdb/create-operations.md index 429a0bb5..45ea4c92 100644 --- a/docs/examples/tablesdb/create-operations.md +++ b/docs/examples/tablesdb/create-operations.md @@ -1,3 +1,4 @@ +```php createOperations( } } ] // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/create-point-column.md b/docs/examples/tablesdb/create-point-column.md index 006c9e00..bde57bc3 100644 --- a/docs/examples/tablesdb/create-point-column.md +++ b/docs/examples/tablesdb/create-point-column.md @@ -1,3 +1,4 @@ +```php createPointColumn( key: '', required: false, default: [1, 2] // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/create-polygon-column.md b/docs/examples/tablesdb/create-polygon-column.md index 20fb2716..ee340f34 100644 --- a/docs/examples/tablesdb/create-polygon-column.md +++ b/docs/examples/tablesdb/create-polygon-column.md @@ -1,3 +1,4 @@ +```php createPolygonColumn( key: '', required: false, default: [[[1, 2], [3, 4], [5, 6], [1, 2]]] // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/create-relationship-column.md b/docs/examples/tablesdb/create-relationship-column.md index 7f9a06cc..06dd6c0d 100644 --- a/docs/examples/tablesdb/create-relationship-column.md +++ b/docs/examples/tablesdb/create-relationship-column.md @@ -1,3 +1,4 @@ +```php createRelationshipColumn( key: '', // optional twoWayKey: '', // optional onDelete: RelationMutate::CASCADE() // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/create-row.md b/docs/examples/tablesdb/create-row.md index 70666d52..fc253f2b 100644 --- a/docs/examples/tablesdb/create-row.md +++ b/docs/examples/tablesdb/create-row.md @@ -1,3 +1,4 @@ +```php createRow( ], permissions: [Permission::read(Role::any())], // optional transactionId: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/create-rows.md b/docs/examples/tablesdb/create-rows.md index 44c9c7d1..8c08fa57 100644 --- a/docs/examples/tablesdb/create-rows.md +++ b/docs/examples/tablesdb/create-rows.md @@ -1,3 +1,4 @@ +```php createRows( tableId: '', rows: [], transactionId: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/create-string-column.md b/docs/examples/tablesdb/create-string-column.md index 22fc7ccf..a4dd4dac 100644 --- a/docs/examples/tablesdb/create-string-column.md +++ b/docs/examples/tablesdb/create-string-column.md @@ -1,3 +1,4 @@ +```php createStringColumn( default: '', // optional array: false, // optional encrypt: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/create-table.md b/docs/examples/tablesdb/create-table.md index aef39e54..fbe44767 100644 --- a/docs/examples/tablesdb/create-table.md +++ b/docs/examples/tablesdb/create-table.md @@ -1,3 +1,4 @@ +```php createTable( enabled: false, // optional columns: [], // optional indexes: [] // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/create-text-column.md b/docs/examples/tablesdb/create-text-column.md new file mode 100644 index 00000000..833aa90a --- /dev/null +++ b/docs/examples/tablesdb/create-text-column.md @@ -0,0 +1,21 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDB = new TablesDB($client); + +$result = $tablesDB->createTextColumn( + databaseId: '', + tableId: '', + key: '', + required: false, + default: '', // optional + array: false // optional +);``` diff --git a/docs/examples/tablesdb/create-transaction.md b/docs/examples/tablesdb/create-transaction.md index 32488185..6664c084 100644 --- a/docs/examples/tablesdb/create-transaction.md +++ b/docs/examples/tablesdb/create-transaction.md @@ -1,3 +1,4 @@ +```php createTransaction( ttl: 60 // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/create-url-column.md b/docs/examples/tablesdb/create-url-column.md index fe25988a..ceb1dae6 100644 --- a/docs/examples/tablesdb/create-url-column.md +++ b/docs/examples/tablesdb/create-url-column.md @@ -1,3 +1,4 @@ +```php createUrlColumn( required: false, default: 'https://example.com', // optional array: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/create-varchar-column.md b/docs/examples/tablesdb/create-varchar-column.md new file mode 100644 index 00000000..25aa354e --- /dev/null +++ b/docs/examples/tablesdb/create-varchar-column.md @@ -0,0 +1,22 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDB = new TablesDB($client); + +$result = $tablesDB->createVarcharColumn( + databaseId: '', + tableId: '', + key: '', + size: 1, + required: false, + default: '', // optional + array: false // optional +);``` diff --git a/docs/examples/tablesdb/create.md b/docs/examples/tablesdb/create.md index c3c4faaf..2265fc9b 100644 --- a/docs/examples/tablesdb/create.md +++ b/docs/examples/tablesdb/create.md @@ -1,3 +1,4 @@ +```php create( databaseId: '', name: '', enabled: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/decrement-row-column.md b/docs/examples/tablesdb/decrement-row-column.md index ede258e8..0d01314a 100644 --- a/docs/examples/tablesdb/decrement-row-column.md +++ b/docs/examples/tablesdb/decrement-row-column.md @@ -1,3 +1,4 @@ +```php decrementRowColumn( value: null, // optional min: null, // optional transactionId: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/delete-column.md b/docs/examples/tablesdb/delete-column.md index dd99fabc..97cafced 100644 --- a/docs/examples/tablesdb/delete-column.md +++ b/docs/examples/tablesdb/delete-column.md @@ -1,3 +1,4 @@ +```php deleteColumn( databaseId: '', tableId: '', key: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/delete-index.md b/docs/examples/tablesdb/delete-index.md index 1ef346fe..abad8248 100644 --- a/docs/examples/tablesdb/delete-index.md +++ b/docs/examples/tablesdb/delete-index.md @@ -1,3 +1,4 @@ +```php deleteIndex( databaseId: '', tableId: '', key: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/delete-row.md b/docs/examples/tablesdb/delete-row.md index df87c507..05722a0c 100644 --- a/docs/examples/tablesdb/delete-row.md +++ b/docs/examples/tablesdb/delete-row.md @@ -1,3 +1,4 @@ +```php deleteRow( tableId: '', rowId: '', transactionId: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/delete-rows.md b/docs/examples/tablesdb/delete-rows.md index 79ed607c..934ea6b7 100644 --- a/docs/examples/tablesdb/delete-rows.md +++ b/docs/examples/tablesdb/delete-rows.md @@ -1,3 +1,4 @@ +```php deleteRows( tableId: '', queries: [], // optional transactionId: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/delete-table.md b/docs/examples/tablesdb/delete-table.md index 3cbb35de..acc711db 100644 --- a/docs/examples/tablesdb/delete-table.md +++ b/docs/examples/tablesdb/delete-table.md @@ -1,3 +1,4 @@ +```php deleteTable( databaseId: '', tableId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/delete-transaction.md b/docs/examples/tablesdb/delete-transaction.md index d1650158..2b0c7ff8 100644 --- a/docs/examples/tablesdb/delete-transaction.md +++ b/docs/examples/tablesdb/delete-transaction.md @@ -1,3 +1,4 @@ +```php deleteTransaction( transactionId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/delete.md b/docs/examples/tablesdb/delete.md index ea996e9b..1b2cc93a 100644 --- a/docs/examples/tablesdb/delete.md +++ b/docs/examples/tablesdb/delete.md @@ -1,3 +1,4 @@ +```php delete( databaseId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/get-column.md b/docs/examples/tablesdb/get-column.md index d1705a41..0be374fc 100644 --- a/docs/examples/tablesdb/get-column.md +++ b/docs/examples/tablesdb/get-column.md @@ -1,3 +1,4 @@ +```php getColumn( databaseId: '', tableId: '', key: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/get-index.md b/docs/examples/tablesdb/get-index.md index 0d676481..5e79e708 100644 --- a/docs/examples/tablesdb/get-index.md +++ b/docs/examples/tablesdb/get-index.md @@ -1,3 +1,4 @@ +```php getIndex( databaseId: '', tableId: '', key: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/get-row.md b/docs/examples/tablesdb/get-row.md index 4bbea559..f8871ffa 100644 --- a/docs/examples/tablesdb/get-row.md +++ b/docs/examples/tablesdb/get-row.md @@ -1,3 +1,4 @@ +```php getRow( rowId: '', queries: [], // optional transactionId: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/get-table.md b/docs/examples/tablesdb/get-table.md index ee8812f6..1bc01662 100644 --- a/docs/examples/tablesdb/get-table.md +++ b/docs/examples/tablesdb/get-table.md @@ -1,3 +1,4 @@ +```php getTable( databaseId: '', tableId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/get-transaction.md b/docs/examples/tablesdb/get-transaction.md index 146e7d19..fc4030f5 100644 --- a/docs/examples/tablesdb/get-transaction.md +++ b/docs/examples/tablesdb/get-transaction.md @@ -1,3 +1,4 @@ +```php getTransaction( transactionId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/get.md b/docs/examples/tablesdb/get.md index 07f70987..5dde28d8 100644 --- a/docs/examples/tablesdb/get.md +++ b/docs/examples/tablesdb/get.md @@ -1,3 +1,4 @@ +```php get( databaseId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/increment-row-column.md b/docs/examples/tablesdb/increment-row-column.md index 66bf2e84..5c6176ee 100644 --- a/docs/examples/tablesdb/increment-row-column.md +++ b/docs/examples/tablesdb/increment-row-column.md @@ -1,3 +1,4 @@ +```php incrementRowColumn( value: null, // optional max: null, // optional transactionId: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/list-columns.md b/docs/examples/tablesdb/list-columns.md index 49b4eba9..2ecf6542 100644 --- a/docs/examples/tablesdb/list-columns.md +++ b/docs/examples/tablesdb/list-columns.md @@ -1,3 +1,4 @@ +```php listColumns( tableId: '', queries: [], // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/list-indexes.md b/docs/examples/tablesdb/list-indexes.md index ac466c74..17428fe1 100644 --- a/docs/examples/tablesdb/list-indexes.md +++ b/docs/examples/tablesdb/list-indexes.md @@ -1,3 +1,4 @@ +```php listIndexes( tableId: '', queries: [], // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/list-rows.md b/docs/examples/tablesdb/list-rows.md index cdcc7964..710c7919 100644 --- a/docs/examples/tablesdb/list-rows.md +++ b/docs/examples/tablesdb/list-rows.md @@ -1,3 +1,4 @@ +```php listRows( queries: [], // optional transactionId: '', // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/list-tables.md b/docs/examples/tablesdb/list-tables.md index b14e28c1..c74d5a15 100644 --- a/docs/examples/tablesdb/list-tables.md +++ b/docs/examples/tablesdb/list-tables.md @@ -1,3 +1,4 @@ +```php listTables( queries: [], // optional search: '', // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/list-transactions.md b/docs/examples/tablesdb/list-transactions.md index 15095d6f..58b31a64 100644 --- a/docs/examples/tablesdb/list-transactions.md +++ b/docs/examples/tablesdb/list-transactions.md @@ -1,3 +1,4 @@ +```php listTransactions( queries: [] // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/list.md b/docs/examples/tablesdb/list.md index 3d74dded..77da5528 100644 --- a/docs/examples/tablesdb/list.md +++ b/docs/examples/tablesdb/list.md @@ -1,3 +1,4 @@ +```php list( queries: [], // optional search: '', // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/update-boolean-column.md b/docs/examples/tablesdb/update-boolean-column.md index 0c735167..8a7850fc 100644 --- a/docs/examples/tablesdb/update-boolean-column.md +++ b/docs/examples/tablesdb/update-boolean-column.md @@ -1,3 +1,4 @@ +```php updateBooleanColumn( required: false, default: false, newKey: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/update-datetime-column.md b/docs/examples/tablesdb/update-datetime-column.md index 52213c6e..4f994a5b 100644 --- a/docs/examples/tablesdb/update-datetime-column.md +++ b/docs/examples/tablesdb/update-datetime-column.md @@ -1,3 +1,4 @@ +```php updateDatetimeColumn( required: false, default: '', newKey: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/update-email-column.md b/docs/examples/tablesdb/update-email-column.md index d13de56b..8cd10d41 100644 --- a/docs/examples/tablesdb/update-email-column.md +++ b/docs/examples/tablesdb/update-email-column.md @@ -1,3 +1,4 @@ +```php updateEmailColumn( required: false, default: 'email@example.com', newKey: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/update-enum-column.md b/docs/examples/tablesdb/update-enum-column.md index d54c0b38..0dcf5747 100644 --- a/docs/examples/tablesdb/update-enum-column.md +++ b/docs/examples/tablesdb/update-enum-column.md @@ -1,3 +1,4 @@ +```php updateEnumColumn( required: false, default: '', newKey: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/update-float-column.md b/docs/examples/tablesdb/update-float-column.md index bb091abf..68a90df3 100644 --- a/docs/examples/tablesdb/update-float-column.md +++ b/docs/examples/tablesdb/update-float-column.md @@ -1,3 +1,4 @@ +```php updateFloatColumn( min: null, // optional max: null, // optional newKey: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/update-integer-column.md b/docs/examples/tablesdb/update-integer-column.md index 2436bc2c..ba7a781f 100644 --- a/docs/examples/tablesdb/update-integer-column.md +++ b/docs/examples/tablesdb/update-integer-column.md @@ -1,3 +1,4 @@ +```php updateIntegerColumn( min: null, // optional max: null, // optional newKey: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/update-ip-column.md b/docs/examples/tablesdb/update-ip-column.md index aa97752a..25a71601 100644 --- a/docs/examples/tablesdb/update-ip-column.md +++ b/docs/examples/tablesdb/update-ip-column.md @@ -1,3 +1,4 @@ +```php updateIpColumn( required: false, default: '', newKey: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/update-line-column.md b/docs/examples/tablesdb/update-line-column.md index 56a557cb..a7126a39 100644 --- a/docs/examples/tablesdb/update-line-column.md +++ b/docs/examples/tablesdb/update-line-column.md @@ -1,3 +1,4 @@ +```php updateLineColumn( required: false, default: [[1, 2], [3, 4], [5, 6]], // optional newKey: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/update-longtext-column.md b/docs/examples/tablesdb/update-longtext-column.md new file mode 100644 index 00000000..aaccf927 --- /dev/null +++ b/docs/examples/tablesdb/update-longtext-column.md @@ -0,0 +1,21 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDB = new TablesDB($client); + +$result = $tablesDB->updateLongtextColumn( + databaseId: '', + tableId: '', + key: '', + required: false, + default: '', + newKey: '' // optional +);``` diff --git a/docs/examples/tablesdb/update-mediumtext-column.md b/docs/examples/tablesdb/update-mediumtext-column.md new file mode 100644 index 00000000..2b06e8d3 --- /dev/null +++ b/docs/examples/tablesdb/update-mediumtext-column.md @@ -0,0 +1,21 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDB = new TablesDB($client); + +$result = $tablesDB->updateMediumtextColumn( + databaseId: '', + tableId: '', + key: '', + required: false, + default: '', + newKey: '' // optional +);``` diff --git a/docs/examples/tablesdb/update-point-column.md b/docs/examples/tablesdb/update-point-column.md index abe8b737..0d137cea 100644 --- a/docs/examples/tablesdb/update-point-column.md +++ b/docs/examples/tablesdb/update-point-column.md @@ -1,3 +1,4 @@ +```php updatePointColumn( required: false, default: [1, 2], // optional newKey: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/update-polygon-column.md b/docs/examples/tablesdb/update-polygon-column.md index 2ff40115..5341610c 100644 --- a/docs/examples/tablesdb/update-polygon-column.md +++ b/docs/examples/tablesdb/update-polygon-column.md @@ -1,3 +1,4 @@ +```php updatePolygonColumn( required: false, default: [[[1, 2], [3, 4], [5, 6], [1, 2]]], // optional newKey: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/update-relationship-column.md b/docs/examples/tablesdb/update-relationship-column.md index cc2e2cca..4b153851 100644 --- a/docs/examples/tablesdb/update-relationship-column.md +++ b/docs/examples/tablesdb/update-relationship-column.md @@ -1,3 +1,4 @@ +```php updateRelationshipColumn( key: '', onDelete: RelationMutate::CASCADE(), // optional newKey: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/update-row.md b/docs/examples/tablesdb/update-row.md index 71916cd6..f0fd37d6 100644 --- a/docs/examples/tablesdb/update-row.md +++ b/docs/examples/tablesdb/update-row.md @@ -1,3 +1,4 @@ +```php updateRow( ], // optional permissions: [Permission::read(Role::any())], // optional transactionId: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/update-rows.md b/docs/examples/tablesdb/update-rows.md index a6892f81..baf98ecf 100644 --- a/docs/examples/tablesdb/update-rows.md +++ b/docs/examples/tablesdb/update-rows.md @@ -1,3 +1,4 @@ +```php updateRows( ], // optional queries: [], // optional transactionId: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/update-string-column.md b/docs/examples/tablesdb/update-string-column.md index eb1acc15..ff01707d 100644 --- a/docs/examples/tablesdb/update-string-column.md +++ b/docs/examples/tablesdb/update-string-column.md @@ -1,3 +1,4 @@ +```php updateStringColumn( default: '', size: 1, // optional newKey: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/update-table.md b/docs/examples/tablesdb/update-table.md index 22f1523b..4409db26 100644 --- a/docs/examples/tablesdb/update-table.md +++ b/docs/examples/tablesdb/update-table.md @@ -1,3 +1,4 @@ +```php updateTable( databaseId: '', tableId: '', - name: '', + name: '', // optional permissions: [Permission::read(Role::any())], // optional rowSecurity: false, // optional enabled: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/update-text-column.md b/docs/examples/tablesdb/update-text-column.md new file mode 100644 index 00000000..81fa0fec --- /dev/null +++ b/docs/examples/tablesdb/update-text-column.md @@ -0,0 +1,21 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDB = new TablesDB($client); + +$result = $tablesDB->updateTextColumn( + databaseId: '', + tableId: '', + key: '', + required: false, + default: '', + newKey: '' // optional +);``` diff --git a/docs/examples/tablesdb/update-transaction.md b/docs/examples/tablesdb/update-transaction.md index fed3810b..512760bf 100644 --- a/docs/examples/tablesdb/update-transaction.md +++ b/docs/examples/tablesdb/update-transaction.md @@ -1,3 +1,4 @@ +```php updateTransaction( transactionId: '', commit: false, // optional rollback: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/update-url-column.md b/docs/examples/tablesdb/update-url-column.md index b64b3024..6c055168 100644 --- a/docs/examples/tablesdb/update-url-column.md +++ b/docs/examples/tablesdb/update-url-column.md @@ -1,3 +1,4 @@ +```php updateUrlColumn( required: false, default: 'https://example.com', newKey: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/update-varchar-column.md b/docs/examples/tablesdb/update-varchar-column.md new file mode 100644 index 00000000..ca4ba824 --- /dev/null +++ b/docs/examples/tablesdb/update-varchar-column.md @@ -0,0 +1,22 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDB = new TablesDB($client); + +$result = $tablesDB->updateVarcharColumn( + databaseId: '', + tableId: '', + key: '', + required: false, + default: '', + size: 1, // optional + newKey: '' // optional +);``` diff --git a/docs/examples/tablesdb/update.md b/docs/examples/tablesdb/update.md index 106b75e2..126b3caf 100644 --- a/docs/examples/tablesdb/update.md +++ b/docs/examples/tablesdb/update.md @@ -1,3 +1,4 @@ +```php update( databaseId: '', - name: '', + name: '', // optional enabled: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/upsert-row.md b/docs/examples/tablesdb/upsert-row.md index e26c8255..5c4645ba 100644 --- a/docs/examples/tablesdb/upsert-row.md +++ b/docs/examples/tablesdb/upsert-row.md @@ -1,3 +1,4 @@ +```php upsertRow( ], // optional permissions: [Permission::read(Role::any())], // optional transactionId: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/upsert-rows.md b/docs/examples/tablesdb/upsert-rows.md index fb93df8b..6d9d6154 100644 --- a/docs/examples/tablesdb/upsert-rows.md +++ b/docs/examples/tablesdb/upsert-rows.md @@ -1,3 +1,4 @@ +```php upsertRows( tableId: '', rows: [], transactionId: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/teams/create-membership.md b/docs/examples/teams/create-membership.md index 285368f9..ddbddc38 100644 --- a/docs/examples/teams/create-membership.md +++ b/docs/examples/teams/create-membership.md @@ -1,3 +1,4 @@ +```php createMembership( phone: '+12065550100', // optional url: 'https://example.com', // optional name: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/teams/create.md b/docs/examples/teams/create.md index 643fa0eb..e0eef909 100644 --- a/docs/examples/teams/create.md +++ b/docs/examples/teams/create.md @@ -1,3 +1,4 @@ +```php create( teamId: '', name: '', roles: [] // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/teams/delete-membership.md b/docs/examples/teams/delete-membership.md index 579b790c..096d69eb 100644 --- a/docs/examples/teams/delete-membership.md +++ b/docs/examples/teams/delete-membership.md @@ -1,3 +1,4 @@ +```php deleteMembership( teamId: '', membershipId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/teams/delete.md b/docs/examples/teams/delete.md index 9db4e7e9..e982d579 100644 --- a/docs/examples/teams/delete.md +++ b/docs/examples/teams/delete.md @@ -1,3 +1,4 @@ +```php delete( teamId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/teams/get-membership.md b/docs/examples/teams/get-membership.md index bd6cbe8b..c696fd0d 100644 --- a/docs/examples/teams/get-membership.md +++ b/docs/examples/teams/get-membership.md @@ -1,3 +1,4 @@ +```php getMembership( teamId: '', membershipId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/teams/get-prefs.md b/docs/examples/teams/get-prefs.md index fbade4fc..ea621f3a 100644 --- a/docs/examples/teams/get-prefs.md +++ b/docs/examples/teams/get-prefs.md @@ -1,3 +1,4 @@ +```php getPrefs( teamId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/teams/get.md b/docs/examples/teams/get.md index 0dafa8a5..b0a71242 100644 --- a/docs/examples/teams/get.md +++ b/docs/examples/teams/get.md @@ -1,3 +1,4 @@ +```php get( teamId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/teams/list-memberships.md b/docs/examples/teams/list-memberships.md index 5ff4736d..0b4fd915 100644 --- a/docs/examples/teams/list-memberships.md +++ b/docs/examples/teams/list-memberships.md @@ -1,3 +1,4 @@ +```php listMemberships( queries: [], // optional search: '', // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/teams/list.md b/docs/examples/teams/list.md index 144b50d0..04fdc4fc 100644 --- a/docs/examples/teams/list.md +++ b/docs/examples/teams/list.md @@ -1,3 +1,4 @@ +```php list( queries: [], // optional search: '', // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/teams/update-membership-status.md b/docs/examples/teams/update-membership-status.md index 5dbfd4cb..33f891c1 100644 --- a/docs/examples/teams/update-membership-status.md +++ b/docs/examples/teams/update-membership-status.md @@ -1,3 +1,4 @@ +```php updateMembershipStatus( membershipId: '', userId: '', secret: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/teams/update-membership.md b/docs/examples/teams/update-membership.md index 10f135b0..0a251890 100644 --- a/docs/examples/teams/update-membership.md +++ b/docs/examples/teams/update-membership.md @@ -1,3 +1,4 @@ +```php updateMembership( teamId: '', membershipId: '', roles: [] -); \ No newline at end of file +);``` diff --git a/docs/examples/teams/update-name.md b/docs/examples/teams/update-name.md index bc13d924..eae3a3bf 100644 --- a/docs/examples/teams/update-name.md +++ b/docs/examples/teams/update-name.md @@ -1,3 +1,4 @@ +```php updateName( teamId: '', name: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/teams/update-prefs.md b/docs/examples/teams/update-prefs.md index bd8d9de3..785f7ba9 100644 --- a/docs/examples/teams/update-prefs.md +++ b/docs/examples/teams/update-prefs.md @@ -1,3 +1,4 @@ +```php updatePrefs( teamId: '', prefs: [] -); \ No newline at end of file +);``` diff --git a/docs/examples/tokens/create-file-token.md b/docs/examples/tokens/create-file-token.md index e4f23021..d172c15e 100644 --- a/docs/examples/tokens/create-file-token.md +++ b/docs/examples/tokens/create-file-token.md @@ -1,3 +1,4 @@ +```php createFileToken( bucketId: '', fileId: '', expire: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tokens/delete.md b/docs/examples/tokens/delete.md index 278be90b..d298ed3a 100644 --- a/docs/examples/tokens/delete.md +++ b/docs/examples/tokens/delete.md @@ -1,3 +1,4 @@ +```php delete( tokenId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/tokens/get.md b/docs/examples/tokens/get.md index e7b4e108..db117e6a 100644 --- a/docs/examples/tokens/get.md +++ b/docs/examples/tokens/get.md @@ -1,3 +1,4 @@ +```php get( tokenId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/tokens/list.md b/docs/examples/tokens/list.md index 212a443c..35512617 100644 --- a/docs/examples/tokens/list.md +++ b/docs/examples/tokens/list.md @@ -1,3 +1,4 @@ +```php list( fileId: '', queries: [], // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tokens/update.md b/docs/examples/tokens/update.md index ea95322a..07c37e36 100644 --- a/docs/examples/tokens/update.md +++ b/docs/examples/tokens/update.md @@ -1,3 +1,4 @@ +```php update( tokenId: '', expire: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/users/create-argon-2-user.md b/docs/examples/users/create-argon-2-user.md index a9166ef3..4813cd8b 100644 --- a/docs/examples/users/create-argon-2-user.md +++ b/docs/examples/users/create-argon-2-user.md @@ -1,3 +1,4 @@ +```php createArgon2User( email: 'email@example.com', password: 'password', name: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/users/create-bcrypt-user.md b/docs/examples/users/create-bcrypt-user.md index c9fd81e4..17a3c7ec 100644 --- a/docs/examples/users/create-bcrypt-user.md +++ b/docs/examples/users/create-bcrypt-user.md @@ -1,3 +1,4 @@ +```php createBcryptUser( email: 'email@example.com', password: 'password', name: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/users/create-jwt.md b/docs/examples/users/create-jwt.md index 1c1c6d40..9a22a606 100644 --- a/docs/examples/users/create-jwt.md +++ b/docs/examples/users/create-jwt.md @@ -1,3 +1,4 @@ +```php createJWT( userId: '', sessionId: '', // optional duration: 0 // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/users/create-md-5-user.md b/docs/examples/users/create-md-5-user.md index 696cbbeb..85e97f75 100644 --- a/docs/examples/users/create-md-5-user.md +++ b/docs/examples/users/create-md-5-user.md @@ -1,3 +1,4 @@ +```php createMD5User( email: 'email@example.com', password: 'password', name: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/users/create-mfa-recovery-codes.md b/docs/examples/users/create-mfa-recovery-codes.md index ee96d2e2..23295475 100644 --- a/docs/examples/users/create-mfa-recovery-codes.md +++ b/docs/examples/users/create-mfa-recovery-codes.md @@ -1,3 +1,4 @@ +```php createMFARecoveryCodes( userId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/users/create-ph-pass-user.md b/docs/examples/users/create-ph-pass-user.md index d56c4651..0e9a62ff 100644 --- a/docs/examples/users/create-ph-pass-user.md +++ b/docs/examples/users/create-ph-pass-user.md @@ -1,3 +1,4 @@ +```php createPHPassUser( email: 'email@example.com', password: 'password', name: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/users/create-scrypt-modified-user.md b/docs/examples/users/create-scrypt-modified-user.md index f579efb5..22c18b1e 100644 --- a/docs/examples/users/create-scrypt-modified-user.md +++ b/docs/examples/users/create-scrypt-modified-user.md @@ -1,3 +1,4 @@ +```php createScryptModifiedUser( passwordSaltSeparator: '', passwordSignerKey: '', name: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/users/create-scrypt-user.md b/docs/examples/users/create-scrypt-user.md index b406b940..8ebc44dd 100644 --- a/docs/examples/users/create-scrypt-user.md +++ b/docs/examples/users/create-scrypt-user.md @@ -1,3 +1,4 @@ +```php createScryptUser( passwordParallel: null, passwordLength: null, name: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/users/create-session.md b/docs/examples/users/create-session.md index 1589315f..0279835a 100644 --- a/docs/examples/users/create-session.md +++ b/docs/examples/users/create-session.md @@ -1,3 +1,4 @@ +```php createSession( userId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/users/create-sha-user.md b/docs/examples/users/create-sha-user.md index 812bcd5e..924224bc 100644 --- a/docs/examples/users/create-sha-user.md +++ b/docs/examples/users/create-sha-user.md @@ -1,3 +1,4 @@ +```php createSHAUser( password: 'password', passwordVersion: PasswordHash::SHA1(), // optional name: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/users/create-target.md b/docs/examples/users/create-target.md index 57946a44..1000574f 100644 --- a/docs/examples/users/create-target.md +++ b/docs/examples/users/create-target.md @@ -1,3 +1,4 @@ +```php createTarget( identifier: '', providerId: '', // optional name: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/users/create-token.md b/docs/examples/users/create-token.md index 1b92f517..4519995f 100644 --- a/docs/examples/users/create-token.md +++ b/docs/examples/users/create-token.md @@ -1,3 +1,4 @@ +```php createToken( userId: '', length: 4, // optional expire: 60 // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/users/create.md b/docs/examples/users/create.md index 595f24fb..ec9b6839 100644 --- a/docs/examples/users/create.md +++ b/docs/examples/users/create.md @@ -1,3 +1,4 @@ +```php create( phone: '+12065550100', // optional password: '', // optional name: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/users/delete-identity.md b/docs/examples/users/delete-identity.md index 26b71eea..b364358d 100644 --- a/docs/examples/users/delete-identity.md +++ b/docs/examples/users/delete-identity.md @@ -1,3 +1,4 @@ +```php deleteIdentity( identityId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/users/delete-mfa-authenticator.md b/docs/examples/users/delete-mfa-authenticator.md index f2f08ec1..15ca8e29 100644 --- a/docs/examples/users/delete-mfa-authenticator.md +++ b/docs/examples/users/delete-mfa-authenticator.md @@ -1,3 +1,4 @@ +```php deleteMFAAuthenticator( userId: '', type: AuthenticatorType::TOTP() -); \ No newline at end of file +);``` diff --git a/docs/examples/users/delete-session.md b/docs/examples/users/delete-session.md index 493cf53d..9786bde4 100644 --- a/docs/examples/users/delete-session.md +++ b/docs/examples/users/delete-session.md @@ -1,3 +1,4 @@ +```php deleteSession( userId: '', sessionId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/users/delete-sessions.md b/docs/examples/users/delete-sessions.md index cd6d11e1..236aeffe 100644 --- a/docs/examples/users/delete-sessions.md +++ b/docs/examples/users/delete-sessions.md @@ -1,3 +1,4 @@ +```php deleteSessions( userId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/users/delete-target.md b/docs/examples/users/delete-target.md index 0d85d3e4..6d915dbe 100644 --- a/docs/examples/users/delete-target.md +++ b/docs/examples/users/delete-target.md @@ -1,3 +1,4 @@ +```php deleteTarget( userId: '', targetId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/users/delete.md b/docs/examples/users/delete.md index 883156ec..faea96cf 100644 --- a/docs/examples/users/delete.md +++ b/docs/examples/users/delete.md @@ -1,3 +1,4 @@ +```php delete( userId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/users/get-mfa-recovery-codes.md b/docs/examples/users/get-mfa-recovery-codes.md index 7937e6ad..90aa08dd 100644 --- a/docs/examples/users/get-mfa-recovery-codes.md +++ b/docs/examples/users/get-mfa-recovery-codes.md @@ -1,3 +1,4 @@ +```php getMFARecoveryCodes( userId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/users/get-prefs.md b/docs/examples/users/get-prefs.md index 5e99e14b..931c5be8 100644 --- a/docs/examples/users/get-prefs.md +++ b/docs/examples/users/get-prefs.md @@ -1,3 +1,4 @@ +```php getPrefs( userId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/users/get-target.md b/docs/examples/users/get-target.md index 31baf3c8..1f3c0028 100644 --- a/docs/examples/users/get-target.md +++ b/docs/examples/users/get-target.md @@ -1,3 +1,4 @@ +```php getTarget( userId: '', targetId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/users/get.md b/docs/examples/users/get.md index 0ce39ae6..a777b73b 100644 --- a/docs/examples/users/get.md +++ b/docs/examples/users/get.md @@ -1,3 +1,4 @@ +```php get( userId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/users/list-identities.md b/docs/examples/users/list-identities.md index 9cdc5bce..37074100 100644 --- a/docs/examples/users/list-identities.md +++ b/docs/examples/users/list-identities.md @@ -1,3 +1,4 @@ +```php listIdentities( queries: [], // optional search: '', // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/users/list-logs.md b/docs/examples/users/list-logs.md index 70155262..0d0464e2 100644 --- a/docs/examples/users/list-logs.md +++ b/docs/examples/users/list-logs.md @@ -1,3 +1,4 @@ +```php listLogs( userId: '', queries: [], // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/users/list-memberships.md b/docs/examples/users/list-memberships.md index 9a37fea3..c9b3fb54 100644 --- a/docs/examples/users/list-memberships.md +++ b/docs/examples/users/list-memberships.md @@ -1,3 +1,4 @@ +```php listMemberships( queries: [], // optional search: '', // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/users/list-mfa-factors.md b/docs/examples/users/list-mfa-factors.md index 5dae790c..c3cd0453 100644 --- a/docs/examples/users/list-mfa-factors.md +++ b/docs/examples/users/list-mfa-factors.md @@ -1,3 +1,4 @@ +```php listMFAFactors( userId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/users/list-sessions.md b/docs/examples/users/list-sessions.md index e657aa24..e4baa40c 100644 --- a/docs/examples/users/list-sessions.md +++ b/docs/examples/users/list-sessions.md @@ -1,3 +1,4 @@ +```php listSessions( userId: '', total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/users/list-targets.md b/docs/examples/users/list-targets.md index 435dbde0..3e33f9f4 100644 --- a/docs/examples/users/list-targets.md +++ b/docs/examples/users/list-targets.md @@ -1,3 +1,4 @@ +```php listTargets( userId: '', queries: [], // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/users/list.md b/docs/examples/users/list.md index 6494f076..39d3189c 100644 --- a/docs/examples/users/list.md +++ b/docs/examples/users/list.md @@ -1,3 +1,4 @@ +```php list( queries: [], // optional search: '', // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/users/update-email-verification.md b/docs/examples/users/update-email-verification.md index 636f1d24..b7a3a912 100644 --- a/docs/examples/users/update-email-verification.md +++ b/docs/examples/users/update-email-verification.md @@ -1,3 +1,4 @@ +```php updateEmailVerification( userId: '', emailVerification: false -); \ No newline at end of file +);``` diff --git a/docs/examples/users/update-email.md b/docs/examples/users/update-email.md index 21ec88b3..2710f496 100644 --- a/docs/examples/users/update-email.md +++ b/docs/examples/users/update-email.md @@ -1,3 +1,4 @@ +```php updateEmail( userId: '', email: 'email@example.com' -); \ No newline at end of file +);``` diff --git a/docs/examples/users/update-labels.md b/docs/examples/users/update-labels.md index 7d4ae5de..56be4fbc 100644 --- a/docs/examples/users/update-labels.md +++ b/docs/examples/users/update-labels.md @@ -1,3 +1,4 @@ +```php updateLabels( userId: '', labels: [] -); \ No newline at end of file +);``` diff --git a/docs/examples/users/update-mfa-recovery-codes.md b/docs/examples/users/update-mfa-recovery-codes.md index 8474755f..bee4d183 100644 --- a/docs/examples/users/update-mfa-recovery-codes.md +++ b/docs/examples/users/update-mfa-recovery-codes.md @@ -1,3 +1,4 @@ +```php updateMFARecoveryCodes( userId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/users/update-mfa.md b/docs/examples/users/update-mfa.md index c24916a6..9cac2ff9 100644 --- a/docs/examples/users/update-mfa.md +++ b/docs/examples/users/update-mfa.md @@ -1,3 +1,4 @@ +```php updateMFA( userId: '', mfa: false -); \ No newline at end of file +);``` diff --git a/docs/examples/users/update-name.md b/docs/examples/users/update-name.md index 09bb07cd..bce3d8c7 100644 --- a/docs/examples/users/update-name.md +++ b/docs/examples/users/update-name.md @@ -1,3 +1,4 @@ +```php updateName( userId: '', name: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/users/update-password.md b/docs/examples/users/update-password.md index 6d58605d..69d93300 100644 --- a/docs/examples/users/update-password.md +++ b/docs/examples/users/update-password.md @@ -1,3 +1,4 @@ +```php updatePassword( userId: '', password: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/users/update-phone-verification.md b/docs/examples/users/update-phone-verification.md index 019fb3f1..f94b1f84 100644 --- a/docs/examples/users/update-phone-verification.md +++ b/docs/examples/users/update-phone-verification.md @@ -1,3 +1,4 @@ +```php updatePhoneVerification( userId: '', phoneVerification: false -); \ No newline at end of file +);``` diff --git a/docs/examples/users/update-phone.md b/docs/examples/users/update-phone.md index 13bd41bf..c975eaf1 100644 --- a/docs/examples/users/update-phone.md +++ b/docs/examples/users/update-phone.md @@ -1,3 +1,4 @@ +```php updatePhone( userId: '', number: '+12065550100' -); \ No newline at end of file +);``` diff --git a/docs/examples/users/update-prefs.md b/docs/examples/users/update-prefs.md index 94912392..b276922c 100644 --- a/docs/examples/users/update-prefs.md +++ b/docs/examples/users/update-prefs.md @@ -1,3 +1,4 @@ +```php updatePrefs( userId: '', prefs: [] -); \ No newline at end of file +);``` diff --git a/docs/examples/users/update-status.md b/docs/examples/users/update-status.md index f29dc95e..1a8346c0 100644 --- a/docs/examples/users/update-status.md +++ b/docs/examples/users/update-status.md @@ -1,3 +1,4 @@ +```php updateStatus( userId: '', status: false -); \ No newline at end of file +);``` diff --git a/docs/examples/users/update-target.md b/docs/examples/users/update-target.md index 00ad27b9..89635691 100644 --- a/docs/examples/users/update-target.md +++ b/docs/examples/users/update-target.md @@ -1,3 +1,4 @@ +```php updateTarget( identifier: '', // optional providerId: '', // optional name: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/health.md b/docs/health.md index dc192949..4532a8c1 100644 --- a/docs/health.md +++ b/docs/health.md @@ -49,6 +49,45 @@ GET https://cloud.appwrite.io/v1/health/pubsub ** Check the Appwrite pub-sub servers are up and connection is successful. ** +```http request +GET https://cloud.appwrite.io/v1/health/queue/audits +``` + +** Get the number of audit logs that are waiting to be processed in the Appwrite internal queue server. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 5000 | + + +```http request +GET https://cloud.appwrite.io/v1/health/queue/billing-project-aggregation +``` + +** Get billing project aggregation queue. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 10000 | + + +```http request +GET https://cloud.appwrite.io/v1/health/queue/billing-team-aggregation +``` + +** Get billing team aggregation queue. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 10000 | + + ```http request GET https://cloud.appwrite.io/v1/health/queue/builds ``` @@ -62,6 +101,19 @@ GET https://cloud.appwrite.io/v1/health/queue/builds | threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 5000 | +```http request +GET https://cloud.appwrite.io/v1/health/queue/builds-priority +``` + +** Get the priority builds queue size. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 500. | 500 | + + ```http request GET https://cloud.appwrite.io/v1/health/queue/certificates ``` @@ -182,6 +234,19 @@ GET https://cloud.appwrite.io/v1/health/queue/migrations | threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 5000 | +```http request +GET https://cloud.appwrite.io/v1/health/queue/region-manager +``` + +** Get region manager queue. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 100. | 100 | + + ```http request GET https://cloud.appwrite.io/v1/health/queue/stats-resources ``` @@ -208,6 +273,19 @@ GET https://cloud.appwrite.io/v1/health/queue/stats-usage | threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 5000 | +```http request +GET https://cloud.appwrite.io/v1/health/queue/threats +``` + +** Get threats queue. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 100. | 100 | + + ```http request GET https://cloud.appwrite.io/v1/health/queue/webhooks ``` diff --git a/docs/tablesdb.md b/docs/tablesdb.md index e92f32b8..863408d0 100644 --- a/docs/tablesdb.md +++ b/docs/tablesdb.md @@ -559,6 +559,82 @@ PATCH https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/column | newKey | string | New Column Key. | | +```http request +POST https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns/longtext +``` + +** Create a longtext column. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). | | +| key | string | Column Key. | | +| required | boolean | Is column required? | | +| default | string | Default value for column when not provided. Cannot be set when column is required. | | +| array | boolean | Is column an array? | | + + +```http request +PATCH https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns/longtext/{key} +``` + +** Update a longtext column. Changing the `default` value will not update already existing rows. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). | | +| key | string | **Required** Column Key. | | +| required | boolean | Is column required? | | +| default | string | Default value for column when not provided. Cannot be set when column is required. | | +| newKey | string | New Column Key. | | + + +```http request +POST https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns/mediumtext +``` + +** Create a mediumtext column. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). | | +| key | string | Column Key. | | +| required | boolean | Is column required? | | +| default | string | Default value for column when not provided. Cannot be set when column is required. | | +| array | boolean | Is column an array? | | + + +```http request +PATCH https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns/mediumtext/{key} +``` + +** Update a mediumtext column. Changing the `default` value will not update already existing rows. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). | | +| key | string | **Required** Column Key. | | +| required | boolean | Is column required? | | +| default | string | Default value for column when not provided. Cannot be set when column is required. | | +| newKey | string | New Column Key. | | + + ```http request POST https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns/point ``` @@ -691,6 +767,44 @@ PATCH https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/column | newKey | string | New Column Key. | | +```http request +POST https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns/text +``` + +** Create a text column. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). | | +| key | string | Column Key. | | +| required | boolean | Is column required? | | +| default | string | Default value for column when not provided. Cannot be set when column is required. | | +| array | boolean | Is column an array? | | + + +```http request +PATCH https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns/text/{key} +``` + +** Update a text column. Changing the `default` value will not update already existing rows. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). | | +| key | string | **Required** Column Key. | | +| required | boolean | Is column required? | | +| default | string | Default value for column when not provided. Cannot be set when column is required. | | +| newKey | string | New Column Key. | | + + ```http request POST https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns/url ``` @@ -729,6 +843,46 @@ PATCH https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/column | newKey | string | New Column Key. | | +```http request +POST https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns/varchar +``` + +** Create a varchar column. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). | | +| key | string | Column Key. | | +| size | integer | Column size for varchar columns, in number of characters. Maximum size is 16381. | | +| required | boolean | Is column required? | | +| default | string | Default value for column when not provided. Cannot be set when column is required. | | +| array | boolean | Is column an array? | | + + +```http request +PATCH https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns/varchar/{key} +``` + +** Update a varchar column. Changing the `default` value will not update already existing rows. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). | | +| key | string | **Required** Column Key. | | +| required | boolean | Is column required? | | +| default | string | Default value for column when not provided. Cannot be set when column is required. | | +| size | integer | Maximum size of the varchar column. | | +| newKey | string | New Column Key. | | + + ```http request GET https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns/{key} ``` diff --git a/src/Appwrite/Client.php b/src/Appwrite/Client.php index cbfc0f8f..8d8d89ed 100644 --- a/src/Appwrite/Client.php +++ b/src/Appwrite/Client.php @@ -37,11 +37,11 @@ class Client */ protected array $headers = [ 'content-type' => '', - 'user-agent' => 'AppwritePHPSDK/19.1.1 ()', + 'user-agent' => 'AppwritePHPSDK/20.0.0 ()', 'x-sdk-name'=> 'PHP', 'x-sdk-platform'=> 'server', 'x-sdk-language'=> 'php', - 'x-sdk-version'=> '19.1.1', + 'x-sdk-version'=> '20.0.0', ]; /** diff --git a/src/Appwrite/Enums/BackupServices.php b/src/Appwrite/Enums/BackupServices.php new file mode 100644 index 00000000..8eb096d1 --- /dev/null +++ b/src/Appwrite/Enums/BackupServices.php @@ -0,0 +1,51 @@ +value = $value; + } + + public function __toString(): string + { + return $this->value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function DATABASES(): BackupServices + { + if (!isset(self::$DATABASES)) { + self::$DATABASES = new BackupServices('databases'); + } + return self::$DATABASES; + } + public static function FUNCTIONS(): BackupServices + { + if (!isset(self::$FUNCTIONS)) { + self::$FUNCTIONS = new BackupServices('functions'); + } + return self::$FUNCTIONS; + } + public static function STORAGE(): BackupServices + { + if (!isset(self::$STORAGE)) { + self::$STORAGE = new BackupServices('storage'); + } + return self::$STORAGE; + } +} \ No newline at end of file diff --git a/src/Appwrite/Enums/BrowserPermission.php b/src/Appwrite/Enums/BrowserPermission.php new file mode 100644 index 00000000..30a13a13 --- /dev/null +++ b/src/Appwrite/Enums/BrowserPermission.php @@ -0,0 +1,187 @@ +value = $value; + } + + public function __toString(): string + { + return $this->value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function GEOLOCATION(): BrowserPermission + { + if (!isset(self::$GEOLOCATION)) { + self::$GEOLOCATION = new BrowserPermission('geolocation'); + } + return self::$GEOLOCATION; + } + public static function CAMERA(): BrowserPermission + { + if (!isset(self::$CAMERA)) { + self::$CAMERA = new BrowserPermission('camera'); + } + return self::$CAMERA; + } + public static function MICROPHONE(): BrowserPermission + { + if (!isset(self::$MICROPHONE)) { + self::$MICROPHONE = new BrowserPermission('microphone'); + } + return self::$MICROPHONE; + } + public static function NOTIFICATIONS(): BrowserPermission + { + if (!isset(self::$NOTIFICATIONS)) { + self::$NOTIFICATIONS = new BrowserPermission('notifications'); + } + return self::$NOTIFICATIONS; + } + public static function MIDI(): BrowserPermission + { + if (!isset(self::$MIDI)) { + self::$MIDI = new BrowserPermission('midi'); + } + return self::$MIDI; + } + public static function PUSH(): BrowserPermission + { + if (!isset(self::$PUSH)) { + self::$PUSH = new BrowserPermission('push'); + } + return self::$PUSH; + } + public static function CLIPBOARDREAD(): BrowserPermission + { + if (!isset(self::$CLIPBOARDREAD)) { + self::$CLIPBOARDREAD = new BrowserPermission('clipboard-read'); + } + return self::$CLIPBOARDREAD; + } + public static function CLIPBOARDWRITE(): BrowserPermission + { + if (!isset(self::$CLIPBOARDWRITE)) { + self::$CLIPBOARDWRITE = new BrowserPermission('clipboard-write'); + } + return self::$CLIPBOARDWRITE; + } + public static function PAYMENTHANDLER(): BrowserPermission + { + if (!isset(self::$PAYMENTHANDLER)) { + self::$PAYMENTHANDLER = new BrowserPermission('payment-handler'); + } + return self::$PAYMENTHANDLER; + } + public static function USB(): BrowserPermission + { + if (!isset(self::$USB)) { + self::$USB = new BrowserPermission('usb'); + } + return self::$USB; + } + public static function BLUETOOTH(): BrowserPermission + { + if (!isset(self::$BLUETOOTH)) { + self::$BLUETOOTH = new BrowserPermission('bluetooth'); + } + return self::$BLUETOOTH; + } + public static function ACCELEROMETER(): BrowserPermission + { + if (!isset(self::$ACCELEROMETER)) { + self::$ACCELEROMETER = new BrowserPermission('accelerometer'); + } + return self::$ACCELEROMETER; + } + public static function GYROSCOPE(): BrowserPermission + { + if (!isset(self::$GYROSCOPE)) { + self::$GYROSCOPE = new BrowserPermission('gyroscope'); + } + return self::$GYROSCOPE; + } + public static function MAGNETOMETER(): BrowserPermission + { + if (!isset(self::$MAGNETOMETER)) { + self::$MAGNETOMETER = new BrowserPermission('magnetometer'); + } + return self::$MAGNETOMETER; + } + public static function AMBIENTLIGHTSENSOR(): BrowserPermission + { + if (!isset(self::$AMBIENTLIGHTSENSOR)) { + self::$AMBIENTLIGHTSENSOR = new BrowserPermission('ambient-light-sensor'); + } + return self::$AMBIENTLIGHTSENSOR; + } + public static function BACKGROUNDSYNC(): BrowserPermission + { + if (!isset(self::$BACKGROUNDSYNC)) { + self::$BACKGROUNDSYNC = new BrowserPermission('background-sync'); + } + return self::$BACKGROUNDSYNC; + } + public static function PERSISTENTSTORAGE(): BrowserPermission + { + if (!isset(self::$PERSISTENTSTORAGE)) { + self::$PERSISTENTSTORAGE = new BrowserPermission('persistent-storage'); + } + return self::$PERSISTENTSTORAGE; + } + public static function SCREENWAKELOCK(): BrowserPermission + { + if (!isset(self::$SCREENWAKELOCK)) { + self::$SCREENWAKELOCK = new BrowserPermission('screen-wake-lock'); + } + return self::$SCREENWAKELOCK; + } + public static function WEBSHARE(): BrowserPermission + { + if (!isset(self::$WEBSHARE)) { + self::$WEBSHARE = new BrowserPermission('web-share'); + } + return self::$WEBSHARE; + } + public static function XRSPATIALTRACKING(): BrowserPermission + { + if (!isset(self::$XRSPATIALTRACKING)) { + self::$XRSPATIALTRACKING = new BrowserPermission('xr-spatial-tracking'); + } + return self::$XRSPATIALTRACKING; + } +} \ No newline at end of file diff --git a/src/Appwrite/Enums/BuildRuntime.php b/src/Appwrite/Enums/BuildRuntime.php index 32d94fa5..a7fe12a5 100644 --- a/src/Appwrite/Enums/BuildRuntime.php +++ b/src/Appwrite/Enums/BuildRuntime.php @@ -42,6 +42,7 @@ class BuildRuntime implements JsonSerializable private static BuildRuntime $DART35; private static BuildRuntime $DART38; private static BuildRuntime $DART39; + private static BuildRuntime $DART310; private static BuildRuntime $DOTNET60; private static BuildRuntime $DOTNET70; private static BuildRuntime $DOTNET80; @@ -70,6 +71,7 @@ class BuildRuntime implements JsonSerializable private static BuildRuntime $FLUTTER329; private static BuildRuntime $FLUTTER332; private static BuildRuntime $FLUTTER335; + private static BuildRuntime $FLUTTER338; private string $value; @@ -340,6 +342,13 @@ public static function DART39(): BuildRuntime } return self::$DART39; } + public static function DART310(): BuildRuntime + { + if (!isset(self::$DART310)) { + self::$DART310 = new BuildRuntime('dart-3.10'); + } + return self::$DART310; + } public static function DOTNET60(): BuildRuntime { if (!isset(self::$DOTNET60)) { @@ -536,4 +545,11 @@ public static function FLUTTER335(): BuildRuntime } return self::$FLUTTER335; } + public static function FLUTTER338(): BuildRuntime + { + if (!isset(self::$FLUTTER338)) { + self::$FLUTTER338 = new BuildRuntime('flutter-3.38'); + } + return self::$FLUTTER338; + } } \ No newline at end of file diff --git a/src/Appwrite/Enums/DeploymentStatus.php b/src/Appwrite/Enums/DeploymentStatus.php index 7d53c889..1cc26b6f 100644 --- a/src/Appwrite/Enums/DeploymentStatus.php +++ b/src/Appwrite/Enums/DeploymentStatus.php @@ -10,6 +10,7 @@ class DeploymentStatus implements JsonSerializable private static DeploymentStatus $PROCESSING; private static DeploymentStatus $BUILDING; private static DeploymentStatus $READY; + private static DeploymentStatus $CANCELED; private static DeploymentStatus $FAILED; private string $value; @@ -57,6 +58,13 @@ public static function READY(): DeploymentStatus } return self::$READY; } + public static function CANCELED(): DeploymentStatus + { + if (!isset(self::$CANCELED)) { + self::$CANCELED = new DeploymentStatus('canceled'); + } + return self::$CANCELED; + } public static function FAILED(): DeploymentStatus { if (!isset(self::$FAILED)) { diff --git a/src/Appwrite/Enums/OAuthProvider.php b/src/Appwrite/Enums/OAuthProvider.php index 9e12b9a9..29bcd730 100644 --- a/src/Appwrite/Enums/OAuthProvider.php +++ b/src/Appwrite/Enums/OAuthProvider.php @@ -45,6 +45,8 @@ class OAuthProvider implements JsonSerializable private static OAuthProvider $YANDEX; private static OAuthProvider $ZOHO; private static OAuthProvider $ZOOM; + private static OAuthProvider $GITHUBIMAGINE; + private static OAuthProvider $GOOGLEIMAGINE; private string $value; @@ -336,4 +338,18 @@ public static function ZOOM(): OAuthProvider } return self::$ZOOM; } + public static function GITHUBIMAGINE(): OAuthProvider + { + if (!isset(self::$GITHUBIMAGINE)) { + self::$GITHUBIMAGINE = new OAuthProvider('githubImagine'); + } + return self::$GITHUBIMAGINE; + } + public static function GOOGLEIMAGINE(): OAuthProvider + { + if (!isset(self::$GOOGLEIMAGINE)) { + self::$GOOGLEIMAGINE = new OAuthProvider('googleImagine'); + } + return self::$GOOGLEIMAGINE; + } } \ No newline at end of file diff --git a/src/Appwrite/Enums/OrderBy.php b/src/Appwrite/Enums/OrderBy.php new file mode 100644 index 00000000..457dd7a1 --- /dev/null +++ b/src/Appwrite/Enums/OrderBy.php @@ -0,0 +1,43 @@ +value = $value; + } + + public function __toString(): string + { + return $this->value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function ASC(): OrderBy + { + if (!isset(self::$ASC)) { + self::$ASC = new OrderBy('asc'); + } + return self::$ASC; + } + public static function DESC(): OrderBy + { + if (!isset(self::$DESC)) { + self::$DESC = new OrderBy('desc'); + } + return self::$DESC; + } +} \ No newline at end of file diff --git a/src/Appwrite/Enums/Runtime.php b/src/Appwrite/Enums/Runtime.php index 498952b5..0c5eeab7 100644 --- a/src/Appwrite/Enums/Runtime.php +++ b/src/Appwrite/Enums/Runtime.php @@ -42,6 +42,7 @@ class Runtime implements JsonSerializable private static Runtime $DART35; private static Runtime $DART38; private static Runtime $DART39; + private static Runtime $DART310; private static Runtime $DOTNET60; private static Runtime $DOTNET70; private static Runtime $DOTNET80; @@ -70,6 +71,7 @@ class Runtime implements JsonSerializable private static Runtime $FLUTTER329; private static Runtime $FLUTTER332; private static Runtime $FLUTTER335; + private static Runtime $FLUTTER338; private string $value; @@ -340,6 +342,13 @@ public static function DART39(): Runtime } return self::$DART39; } + public static function DART310(): Runtime + { + if (!isset(self::$DART310)) { + self::$DART310 = new Runtime('dart-3.10'); + } + return self::$DART310; + } public static function DOTNET60(): Runtime { if (!isset(self::$DOTNET60)) { @@ -536,4 +545,11 @@ public static function FLUTTER335(): Runtime } return self::$FLUTTER335; } + public static function FLUTTER338(): Runtime + { + if (!isset(self::$FLUTTER338)) { + self::$FLUTTER338 = new Runtime('flutter-3.38'); + } + return self::$FLUTTER338; + } } \ No newline at end of file diff --git a/src/Appwrite/Enums/Scopes.php b/src/Appwrite/Enums/Scopes.php new file mode 100644 index 00000000..9634724c --- /dev/null +++ b/src/Appwrite/Enums/Scopes.php @@ -0,0 +1,531 @@ +value = $value; + } + + public function __toString(): string + { + return $this->value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function SESSIONSWRITE(): Scopes + { + if (!isset(self::$SESSIONSWRITE)) { + self::$SESSIONSWRITE = new Scopes('sessions.write'); + } + return self::$SESSIONSWRITE; + } + public static function USERSREAD(): Scopes + { + if (!isset(self::$USERSREAD)) { + self::$USERSREAD = new Scopes('users.read'); + } + return self::$USERSREAD; + } + public static function USERSWRITE(): Scopes + { + if (!isset(self::$USERSWRITE)) { + self::$USERSWRITE = new Scopes('users.write'); + } + return self::$USERSWRITE; + } + public static function TEAMSREAD(): Scopes + { + if (!isset(self::$TEAMSREAD)) { + self::$TEAMSREAD = new Scopes('teams.read'); + } + return self::$TEAMSREAD; + } + public static function TEAMSWRITE(): Scopes + { + if (!isset(self::$TEAMSWRITE)) { + self::$TEAMSWRITE = new Scopes('teams.write'); + } + return self::$TEAMSWRITE; + } + public static function DATABASESREAD(): Scopes + { + if (!isset(self::$DATABASESREAD)) { + self::$DATABASESREAD = new Scopes('databases.read'); + } + return self::$DATABASESREAD; + } + public static function DATABASESWRITE(): Scopes + { + if (!isset(self::$DATABASESWRITE)) { + self::$DATABASESWRITE = new Scopes('databases.write'); + } + return self::$DATABASESWRITE; + } + public static function COLLECTIONSREAD(): Scopes + { + if (!isset(self::$COLLECTIONSREAD)) { + self::$COLLECTIONSREAD = new Scopes('collections.read'); + } + return self::$COLLECTIONSREAD; + } + public static function COLLECTIONSWRITE(): Scopes + { + if (!isset(self::$COLLECTIONSWRITE)) { + self::$COLLECTIONSWRITE = new Scopes('collections.write'); + } + return self::$COLLECTIONSWRITE; + } + public static function TABLESREAD(): Scopes + { + if (!isset(self::$TABLESREAD)) { + self::$TABLESREAD = new Scopes('tables.read'); + } + return self::$TABLESREAD; + } + public static function TABLESWRITE(): Scopes + { + if (!isset(self::$TABLESWRITE)) { + self::$TABLESWRITE = new Scopes('tables.write'); + } + return self::$TABLESWRITE; + } + public static function ATTRIBUTESREAD(): Scopes + { + if (!isset(self::$ATTRIBUTESREAD)) { + self::$ATTRIBUTESREAD = new Scopes('attributes.read'); + } + return self::$ATTRIBUTESREAD; + } + public static function ATTRIBUTESWRITE(): Scopes + { + if (!isset(self::$ATTRIBUTESWRITE)) { + self::$ATTRIBUTESWRITE = new Scopes('attributes.write'); + } + return self::$ATTRIBUTESWRITE; + } + public static function COLUMNSREAD(): Scopes + { + if (!isset(self::$COLUMNSREAD)) { + self::$COLUMNSREAD = new Scopes('columns.read'); + } + return self::$COLUMNSREAD; + } + public static function COLUMNSWRITE(): Scopes + { + if (!isset(self::$COLUMNSWRITE)) { + self::$COLUMNSWRITE = new Scopes('columns.write'); + } + return self::$COLUMNSWRITE; + } + public static function INDEXESREAD(): Scopes + { + if (!isset(self::$INDEXESREAD)) { + self::$INDEXESREAD = new Scopes('indexes.read'); + } + return self::$INDEXESREAD; + } + public static function INDEXESWRITE(): Scopes + { + if (!isset(self::$INDEXESWRITE)) { + self::$INDEXESWRITE = new Scopes('indexes.write'); + } + return self::$INDEXESWRITE; + } + public static function DOCUMENTSREAD(): Scopes + { + if (!isset(self::$DOCUMENTSREAD)) { + self::$DOCUMENTSREAD = new Scopes('documents.read'); + } + return self::$DOCUMENTSREAD; + } + public static function DOCUMENTSWRITE(): Scopes + { + if (!isset(self::$DOCUMENTSWRITE)) { + self::$DOCUMENTSWRITE = new Scopes('documents.write'); + } + return self::$DOCUMENTSWRITE; + } + public static function ROWSREAD(): Scopes + { + if (!isset(self::$ROWSREAD)) { + self::$ROWSREAD = new Scopes('rows.read'); + } + return self::$ROWSREAD; + } + public static function ROWSWRITE(): Scopes + { + if (!isset(self::$ROWSWRITE)) { + self::$ROWSWRITE = new Scopes('rows.write'); + } + return self::$ROWSWRITE; + } + public static function FILESREAD(): Scopes + { + if (!isset(self::$FILESREAD)) { + self::$FILESREAD = new Scopes('files.read'); + } + return self::$FILESREAD; + } + public static function FILESWRITE(): Scopes + { + if (!isset(self::$FILESWRITE)) { + self::$FILESWRITE = new Scopes('files.write'); + } + return self::$FILESWRITE; + } + public static function BUCKETSREAD(): Scopes + { + if (!isset(self::$BUCKETSREAD)) { + self::$BUCKETSREAD = new Scopes('buckets.read'); + } + return self::$BUCKETSREAD; + } + public static function BUCKETSWRITE(): Scopes + { + if (!isset(self::$BUCKETSWRITE)) { + self::$BUCKETSWRITE = new Scopes('buckets.write'); + } + return self::$BUCKETSWRITE; + } + public static function FUNCTIONSREAD(): Scopes + { + if (!isset(self::$FUNCTIONSREAD)) { + self::$FUNCTIONSREAD = new Scopes('functions.read'); + } + return self::$FUNCTIONSREAD; + } + public static function FUNCTIONSWRITE(): Scopes + { + if (!isset(self::$FUNCTIONSWRITE)) { + self::$FUNCTIONSWRITE = new Scopes('functions.write'); + } + return self::$FUNCTIONSWRITE; + } + public static function SITESREAD(): Scopes + { + if (!isset(self::$SITESREAD)) { + self::$SITESREAD = new Scopes('sites.read'); + } + return self::$SITESREAD; + } + public static function SITESWRITE(): Scopes + { + if (!isset(self::$SITESWRITE)) { + self::$SITESWRITE = new Scopes('sites.write'); + } + return self::$SITESWRITE; + } + public static function LOGREAD(): Scopes + { + if (!isset(self::$LOGREAD)) { + self::$LOGREAD = new Scopes('log.read'); + } + return self::$LOGREAD; + } + public static function LOGWRITE(): Scopes + { + if (!isset(self::$LOGWRITE)) { + self::$LOGWRITE = new Scopes('log.write'); + } + return self::$LOGWRITE; + } + public static function EXECUTIONREAD(): Scopes + { + if (!isset(self::$EXECUTIONREAD)) { + self::$EXECUTIONREAD = new Scopes('execution.read'); + } + return self::$EXECUTIONREAD; + } + public static function EXECUTIONWRITE(): Scopes + { + if (!isset(self::$EXECUTIONWRITE)) { + self::$EXECUTIONWRITE = new Scopes('execution.write'); + } + return self::$EXECUTIONWRITE; + } + public static function LOCALEREAD(): Scopes + { + if (!isset(self::$LOCALEREAD)) { + self::$LOCALEREAD = new Scopes('locale.read'); + } + return self::$LOCALEREAD; + } + public static function AVATARSREAD(): Scopes + { + if (!isset(self::$AVATARSREAD)) { + self::$AVATARSREAD = new Scopes('avatars.read'); + } + return self::$AVATARSREAD; + } + public static function HEALTHREAD(): Scopes + { + if (!isset(self::$HEALTHREAD)) { + self::$HEALTHREAD = new Scopes('health.read'); + } + return self::$HEALTHREAD; + } + public static function PROVIDERSREAD(): Scopes + { + if (!isset(self::$PROVIDERSREAD)) { + self::$PROVIDERSREAD = new Scopes('providers.read'); + } + return self::$PROVIDERSREAD; + } + public static function PROVIDERSWRITE(): Scopes + { + if (!isset(self::$PROVIDERSWRITE)) { + self::$PROVIDERSWRITE = new Scopes('providers.write'); + } + return self::$PROVIDERSWRITE; + } + public static function MESSAGESREAD(): Scopes + { + if (!isset(self::$MESSAGESREAD)) { + self::$MESSAGESREAD = new Scopes('messages.read'); + } + return self::$MESSAGESREAD; + } + public static function MESSAGESWRITE(): Scopes + { + if (!isset(self::$MESSAGESWRITE)) { + self::$MESSAGESWRITE = new Scopes('messages.write'); + } + return self::$MESSAGESWRITE; + } + public static function TOPICSREAD(): Scopes + { + if (!isset(self::$TOPICSREAD)) { + self::$TOPICSREAD = new Scopes('topics.read'); + } + return self::$TOPICSREAD; + } + public static function TOPICSWRITE(): Scopes + { + if (!isset(self::$TOPICSWRITE)) { + self::$TOPICSWRITE = new Scopes('topics.write'); + } + return self::$TOPICSWRITE; + } + public static function SUBSCRIBERSREAD(): Scopes + { + if (!isset(self::$SUBSCRIBERSREAD)) { + self::$SUBSCRIBERSREAD = new Scopes('subscribers.read'); + } + return self::$SUBSCRIBERSREAD; + } + public static function SUBSCRIBERSWRITE(): Scopes + { + if (!isset(self::$SUBSCRIBERSWRITE)) { + self::$SUBSCRIBERSWRITE = new Scopes('subscribers.write'); + } + return self::$SUBSCRIBERSWRITE; + } + public static function TARGETSREAD(): Scopes + { + if (!isset(self::$TARGETSREAD)) { + self::$TARGETSREAD = new Scopes('targets.read'); + } + return self::$TARGETSREAD; + } + public static function TARGETSWRITE(): Scopes + { + if (!isset(self::$TARGETSWRITE)) { + self::$TARGETSWRITE = new Scopes('targets.write'); + } + return self::$TARGETSWRITE; + } + public static function RULESREAD(): Scopes + { + if (!isset(self::$RULESREAD)) { + self::$RULESREAD = new Scopes('rules.read'); + } + return self::$RULESREAD; + } + public static function RULESWRITE(): Scopes + { + if (!isset(self::$RULESWRITE)) { + self::$RULESWRITE = new Scopes('rules.write'); + } + return self::$RULESWRITE; + } + public static function MIGRATIONSREAD(): Scopes + { + if (!isset(self::$MIGRATIONSREAD)) { + self::$MIGRATIONSREAD = new Scopes('migrations.read'); + } + return self::$MIGRATIONSREAD; + } + public static function MIGRATIONSWRITE(): Scopes + { + if (!isset(self::$MIGRATIONSWRITE)) { + self::$MIGRATIONSWRITE = new Scopes('migrations.write'); + } + return self::$MIGRATIONSWRITE; + } + public static function VCSREAD(): Scopes + { + if (!isset(self::$VCSREAD)) { + self::$VCSREAD = new Scopes('vcs.read'); + } + return self::$VCSREAD; + } + public static function VCSWRITE(): Scopes + { + if (!isset(self::$VCSWRITE)) { + self::$VCSWRITE = new Scopes('vcs.write'); + } + return self::$VCSWRITE; + } + public static function ASSISTANTREAD(): Scopes + { + if (!isset(self::$ASSISTANTREAD)) { + self::$ASSISTANTREAD = new Scopes('assistant.read'); + } + return self::$ASSISTANTREAD; + } + public static function TOKENSREAD(): Scopes + { + if (!isset(self::$TOKENSREAD)) { + self::$TOKENSREAD = new Scopes('tokens.read'); + } + return self::$TOKENSREAD; + } + public static function TOKENSWRITE(): Scopes + { + if (!isset(self::$TOKENSWRITE)) { + self::$TOKENSWRITE = new Scopes('tokens.write'); + } + return self::$TOKENSWRITE; + } + public static function POLICIESWRITE(): Scopes + { + if (!isset(self::$POLICIESWRITE)) { + self::$POLICIESWRITE = new Scopes('policies.write'); + } + return self::$POLICIESWRITE; + } + public static function POLICIESREAD(): Scopes + { + if (!isset(self::$POLICIESREAD)) { + self::$POLICIESREAD = new Scopes('policies.read'); + } + return self::$POLICIESREAD; + } + public static function ARCHIVESREAD(): Scopes + { + if (!isset(self::$ARCHIVESREAD)) { + self::$ARCHIVESREAD = new Scopes('archives.read'); + } + return self::$ARCHIVESREAD; + } + public static function ARCHIVESWRITE(): Scopes + { + if (!isset(self::$ARCHIVESWRITE)) { + self::$ARCHIVESWRITE = new Scopes('archives.write'); + } + return self::$ARCHIVESWRITE; + } + public static function RESTORATIONSREAD(): Scopes + { + if (!isset(self::$RESTORATIONSREAD)) { + self::$RESTORATIONSREAD = new Scopes('restorations.read'); + } + return self::$RESTORATIONSREAD; + } + public static function RESTORATIONSWRITE(): Scopes + { + if (!isset(self::$RESTORATIONSWRITE)) { + self::$RESTORATIONSWRITE = new Scopes('restorations.write'); + } + return self::$RESTORATIONSWRITE; + } + public static function DOMAINSREAD(): Scopes + { + if (!isset(self::$DOMAINSREAD)) { + self::$DOMAINSREAD = new Scopes('domains.read'); + } + return self::$DOMAINSREAD; + } + public static function DOMAINSWRITE(): Scopes + { + if (!isset(self::$DOMAINSWRITE)) { + self::$DOMAINSWRITE = new Scopes('domains.write'); + } + return self::$DOMAINSWRITE; + } +} \ No newline at end of file diff --git a/src/Appwrite/Query.php b/src/Appwrite/Query.php index cb1b8385..75586e6a 100644 --- a/src/Appwrite/Query.php +++ b/src/Appwrite/Query.php @@ -338,6 +338,40 @@ public static function notEndsWith(string $attribute, string $value): string return (new Query('notEndsWith', $attribute, $value))->__toString(); } + /** + * Filter resources where attribute matches a regular expression pattern. + * + * @param string $attribute The attribute to filter on. + * @param string $pattern The regular expression pattern to match. + * @return string + */ + public static function regex(string $attribute, string $pattern): string + { + return (new Query('regex', $attribute, $pattern))->__toString(); + } + + /** + * Filter resources where the specified attributes exist. + * + * @param array $attributes The list of attributes that must exist. + * @return string + */ + public static function exists(array $attributes): string + { + return (new Query('exists', null, $attributes))->__toString(); + } + + /** + * Filter resources where the specified attributes do not exist. + * + * @param array $attributes The list of attributes that must not exist. + * @return string + */ + public static function notExists(array $attributes): string + { + return (new Query('notExists', null, $attributes))->__toString(); + } + /** * Created Before * @@ -434,6 +468,22 @@ public static function and(array $queries): string return (new Query('and', null, $queries))->__toString(); } + /** + * Filter array elements where at least one element matches all the specified queries. + * + * @param string $attribute The attribute containing the array to filter on. + * @param array $queries The list of query strings to match against array elements. + * @return string + */ + public static function elemMatch(string $attribute, array $queries): string + { + foreach ($queries as &$query) { + $query = \json_decode($query, true); + } + + return (new Query('elemMatch', $attribute, $queries))->__toString(); + } + /** * Distance Equal * diff --git a/src/Appwrite/Services/Account.php b/src/Appwrite/Services/Account.php index c9d6b778..0460a231 100644 --- a/src/Appwrite/Services/Account.php +++ b/src/Appwrite/Services/Account.php @@ -6,6 +6,7 @@ use Appwrite\Client; use Appwrite\Service; use Appwrite\InputFile; +use Appwrite\Enums\Scopes; use Appwrite\Enums\AuthenticatorType; use Appwrite\Enums\AuthenticationFactor; use Appwrite\Enums\OAuthProvider; @@ -226,6 +227,165 @@ public function createJWT(?int $duration = null): array ); } + /** + * Get a list of all API keys from the current account. + * + * @param ?bool $total + * @throws AppwriteException + * @return array + */ + public function listKeys(?bool $total = null): array + { + $apiPath = str_replace( + [], + [], + '/account/keys' + ); + + $apiParams = []; + + if (!is_null($total)) { + $apiParams['total'] = $total; + } + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create a new account API key. + * + * @param string $name + * @param array $scopes + * @param ?string $expire + * @throws AppwriteException + * @return array + */ + public function createKey(string $name, array $scopes, ?string $expire = null): array + { + $apiPath = str_replace( + [], + [], + '/account/keys' + ); + + $apiParams = []; + $apiParams['name'] = $name; + $apiParams['scopes'] = $scopes; + $apiParams['expire'] = $expire; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get a key by its unique ID. This endpoint returns details about a specific + * API key in your account including it's scopes. + * + * @param string $keyId + * @throws AppwriteException + * @return array + */ + public function getKey(string $keyId): array + { + $apiPath = str_replace( + ['{keyId}'], + [$keyId], + '/account/keys/{keyId}' + ); + + $apiParams = []; + $apiParams['keyId'] = $keyId; + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update a key by its unique ID. Use this endpoint to update the name, + * scopes, or expiration time of an API key. + * + * @param string $keyId + * @param string $name + * @param array $scopes + * @param ?string $expire + * @throws AppwriteException + * @return array + */ + public function updateKey(string $keyId, string $name, array $scopes, ?string $expire = null): array + { + $apiPath = str_replace( + ['{keyId}'], + [$keyId], + '/account/keys/{keyId}' + ); + + $apiParams = []; + $apiParams['keyId'] = $keyId; + $apiParams['name'] = $name; + $apiParams['scopes'] = $scopes; + $apiParams['expire'] = $expire; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PUT, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Delete a key by its unique ID. Once deleted, the key can no longer be used + * to authenticate API calls. + * + * @param string $keyId + * @throws AppwriteException + * @return string + */ + public function deleteKey(string $keyId): string + { + $apiPath = str_replace( + ['{keyId}'], + [$keyId], + '/account/keys/{keyId}' + ); + + $apiParams = []; + $apiParams['keyId'] = $keyId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * 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. diff --git a/src/Appwrite/Services/Avatars.php b/src/Appwrite/Services/Avatars.php index 7700148a..86e29d9d 100644 --- a/src/Appwrite/Services/Avatars.php +++ b/src/Appwrite/Services/Avatars.php @@ -11,6 +11,7 @@ use Appwrite\Enums\Flag; use Appwrite\Enums\Theme; use Appwrite\Enums\Timezone; +use Appwrite\Enums\BrowserPermission; use Appwrite\Enums\ImageFormat; class Avatars extends Service diff --git a/src/Appwrite/Services/Backups.php b/src/Appwrite/Services/Backups.php index 2815da63..bca41ac4 100644 --- a/src/Appwrite/Services/Backups.php +++ b/src/Appwrite/Services/Backups.php @@ -6,6 +6,7 @@ use Appwrite\Client; use Appwrite\Service; use Appwrite\InputFile; +use Appwrite\Enums\BackupServices; class Backups extends Service { diff --git a/src/Appwrite/Services/Databases.php b/src/Appwrite/Services/Databases.php index 53a56a33..b4aa42c0 100644 --- a/src/Appwrite/Services/Databases.php +++ b/src/Appwrite/Services/Databases.php @@ -9,6 +9,7 @@ use Appwrite\Enums\RelationshipType; use Appwrite\Enums\RelationMutate; use Appwrite\Enums\IndexType; +use Appwrite\Enums\OrderBy; class Databases extends Service { @@ -331,7 +332,7 @@ public function get(string $databaseId): array * Update a database by its unique ID. * * @param string $databaseId - * @param string $name + * @param ?string $name * @param ?bool $enabled * @throws AppwriteException * @return array @@ -339,7 +340,7 @@ public function get(string $databaseId): array * @deprecated This API has been deprecated since 1.8.0. Please use `update` instead. * @see TablesDB::update */ - public function update(string $databaseId, string $name, ?bool $enabled = null): array + public function update(string $databaseId, ?string $name = null, ?bool $enabled = null): array { $apiPath = str_replace( ['{databaseId}'], @@ -349,7 +350,10 @@ public function update(string $databaseId, string $name, ?bool $enabled = null): $apiParams = []; $apiParams['databaseId'] = $databaseId; - $apiParams['name'] = $name; + + if (!is_null($name)) { + $apiParams['name'] = $name; + } if (!is_null($enabled)) { $apiParams['enabled'] = $enabled; @@ -546,7 +550,7 @@ public function getCollection(string $databaseId, string $collectionId): array * * @param string $databaseId * @param string $collectionId - * @param string $name + * @param ?string $name * @param ?array $permissions * @param ?bool $documentSecurity * @param ?bool $enabled @@ -556,7 +560,7 @@ public function getCollection(string $databaseId, string $collectionId): array * @deprecated This API has been deprecated since 1.8.0. Please use `updateTable` instead. * @see TablesDB::updateTable */ - 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 = null, ?array $permissions = null, ?bool $documentSecurity = null, ?bool $enabled = null): array { $apiPath = str_replace( ['{databaseId}', '{collectionId}'], @@ -567,7 +571,10 @@ public function updateCollection(string $databaseId, string $collectionId, strin $apiParams = []; $apiParams['databaseId'] = $databaseId; $apiParams['collectionId'] = $collectionId; - $apiParams['name'] = $name; + + if (!is_null($name)) { + $apiParams['name'] = $name; + } $apiParams['permissions'] = $permissions; if (!is_null($documentSecurity)) { @@ -1400,6 +1407,174 @@ public function updateLineAttribute(string $databaseId, string $collectionId, st ); } + /** + * Create a longtext attribute. + * + * + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @param bool $required + * @param ?string $xdefault + * @param ?bool $xarray + * @throws AppwriteException + * @return array + */ + public function createLongtextAttribute(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/longtext' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + + if (!is_null($xarray)) { + $apiParams['array'] = $xarray; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update a longtext attribute. Changing the `default` value will not update + * already existing documents. + * + * + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @param bool $required + * @param ?string $xdefault + * @param ?string $newKey + * @throws AppwriteException + * @return array + */ + public function updateLongtextAttribute(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/longtext/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + $apiParams['newKey'] = $newKey; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create a mediumtext attribute. + * + * + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @param bool $required + * @param ?string $xdefault + * @param ?bool $xarray + * @throws AppwriteException + * @return array + */ + public function createMediumtextAttribute(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/mediumtext' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + + if (!is_null($xarray)) { + $apiParams['array'] = $xarray; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update a mediumtext attribute. Changing the `default` value will not update + * already existing documents. + * + * + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @param bool $required + * @param ?string $xdefault + * @param ?string $newKey + * @throws AppwriteException + * @return array + */ + public function updateMediumtextAttribute(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/mediumtext/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + $apiParams['newKey'] = $newKey; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * Create a geometric point attribute. * @@ -1719,6 +1894,90 @@ public function updateStringAttribute(string $databaseId, string $collectionId, ); } + /** + * Create a text attribute. + * + * + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @param bool $required + * @param ?string $xdefault + * @param ?bool $xarray + * @throws AppwriteException + * @return array + */ + public function createTextAttribute(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/text' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + + if (!is_null($xarray)) { + $apiParams['array'] = $xarray; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update a text attribute. Changing the `default` value will not update + * already existing documents. + * + * + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @param bool $required + * @param ?string $xdefault + * @param ?string $newKey + * @throws AppwriteException + * @return array + */ + public function updateTextAttribute(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/text/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + $apiParams['newKey'] = $newKey; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * Create a URL attribute. * @@ -1809,6 +2068,94 @@ public function updateUrlAttribute(string $databaseId, string $collectionId, str ); } + /** + * Create a varchar attribute. + * + * + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @param int $size + * @param bool $required + * @param ?string $xdefault + * @param ?bool $xarray + * @throws AppwriteException + * @return array + */ + public function createVarcharAttribute(string $databaseId, string $collectionId, string $key, int $size, bool $required, ?string $xdefault = null, ?bool $xarray = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/databases/{databaseId}/collections/{collectionId}/attributes/varchar' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['size'] = $size; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + + if (!is_null($xarray)) { + $apiParams['array'] = $xarray; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update a varchar attribute. Changing the `default` value will not update + * already existing documents. + * + * + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @param bool $required + * @param ?string $xdefault + * @param ?int $size + * @param ?string $newKey + * @throws AppwriteException + * @return array + */ + public function updateVarcharAttribute(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/varchar/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + $apiParams['size'] = $size; + $apiParams['newKey'] = $newKey; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * Get attribute by ID. * diff --git a/src/Appwrite/Services/Functions.php b/src/Appwrite/Services/Functions.php index 42e80d5a..561adab6 100644 --- a/src/Appwrite/Services/Functions.php +++ b/src/Appwrite/Services/Functions.php @@ -7,6 +7,7 @@ use Appwrite\Service; use Appwrite\InputFile; use Appwrite\Enums\Runtime; +use Appwrite\Enums\Scopes; use Appwrite\Enums\TemplateReferenceType; use Appwrite\Enums\VCSReferenceType; use Appwrite\Enums\DeploymentDownloadType; diff --git a/src/Appwrite/Services/Health.php b/src/Appwrite/Services/Health.php index 86183b47..0644a0f6 100644 --- a/src/Appwrite/Services/Health.php +++ b/src/Appwrite/Services/Health.php @@ -177,6 +177,100 @@ public function getPubSub(): array ); } + /** + * Get the number of audit logs that are waiting to be processed in the + * Appwrite internal queue server. + * + * @param ?int $threshold + * @throws AppwriteException + * @return array + */ + public function getQueueAudits(?int $threshold = null): array + { + $apiPath = str_replace( + [], + [], + '/health/queue/audits' + ); + + $apiParams = []; + + if (!is_null($threshold)) { + $apiParams['threshold'] = $threshold; + } + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get billing project aggregation queue. + * + * @param ?int $threshold + * @throws AppwriteException + * @return array + */ + public function getQueueBillingProjectAggregation(?int $threshold = null): array + { + $apiPath = str_replace( + [], + [], + '/health/queue/billing-project-aggregation' + ); + + $apiParams = []; + + if (!is_null($threshold)) { + $apiParams['threshold'] = $threshold; + } + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get billing team aggregation queue. + * + * @param ?int $threshold + * @throws AppwriteException + * @return array + */ + public function getQueueBillingTeamAggregation(?int $threshold = null): array + { + $apiPath = str_replace( + [], + [], + '/health/queue/billing-team-aggregation' + ); + + $apiParams = []; + + if (!is_null($threshold)) { + $apiParams['threshold'] = $threshold; + } + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * Get the number of builds that are waiting to be processed in the Appwrite * internal queue server. @@ -209,6 +303,37 @@ public function getQueueBuilds(?int $threshold = null): array ); } + /** + * Get the priority builds queue size. + * + * @param ?int $threshold + * @throws AppwriteException + * @return array + */ + public function getQueuePriorityBuilds(?int $threshold = null): array + { + $apiPath = str_replace( + [], + [], + '/health/queue/builds-priority' + ); + + $apiParams = []; + + if (!is_null($threshold)) { + $apiParams['threshold'] = $threshold; + } + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * Get the number of certificates that are waiting to be issued against * [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue @@ -505,6 +630,37 @@ public function getQueueMigrations(?int $threshold = null): array ); } + /** + * Get region manager queue. + * + * @param ?int $threshold + * @throws AppwriteException + * @return array + */ + public function getQueueRegionManager(?int $threshold = null): array + { + $apiPath = str_replace( + [], + [], + '/health/queue/region-manager' + ); + + $apiParams = []; + + if (!is_null($threshold)) { + $apiParams['threshold'] = $threshold; + } + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * Get the number of metrics that are waiting to be processed in the Appwrite * stats resources queue. @@ -569,6 +725,37 @@ public function getQueueUsage(?int $threshold = null): array ); } + /** + * Get threats queue. + * + * @param ?int $threshold + * @throws AppwriteException + * @return array + */ + public function getQueueThreats(?int $threshold = null): array + { + $apiPath = str_replace( + [], + [], + '/health/queue/threats' + ); + + $apiParams = []; + + if (!is_null($threshold)) { + $apiParams['threshold'] = $threshold; + } + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * Get the number of webhooks that are waiting to be processed in the Appwrite * internal queue server. diff --git a/src/Appwrite/Services/TablesDB.php b/src/Appwrite/Services/TablesDB.php index a7fd576a..685378f9 100644 --- a/src/Appwrite/Services/TablesDB.php +++ b/src/Appwrite/Services/TablesDB.php @@ -9,6 +9,7 @@ use Appwrite\Enums\RelationshipType; use Appwrite\Enums\RelationMutate; use Appwrite\Enums\IndexType; +use Appwrite\Enums\OrderBy; class TablesDB extends Service { @@ -322,12 +323,12 @@ public function get(string $databaseId): array * Update a database by its unique ID. * * @param string $databaseId - * @param string $name + * @param ?string $name * @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 = null, ?bool $enabled = null): array { $apiPath = str_replace( ['{databaseId}'], @@ -337,7 +338,10 @@ public function update(string $databaseId, string $name, ?bool $enabled = null): $apiParams = []; $apiParams['databaseId'] = $databaseId; - $apiParams['name'] = $name; + + if (!is_null($name)) { + $apiParams['name'] = $name; + } if (!is_null($enabled)) { $apiParams['enabled'] = $enabled; @@ -522,14 +526,14 @@ public function getTable(string $databaseId, string $tableId): array * * @param string $databaseId * @param string $tableId - * @param string $name + * @param ?string $name * @param ?array $permissions * @param ?bool $rowSecurity * @param ?bool $enabled * @throws AppwriteException * @return array */ - public function updateTable(string $databaseId, string $tableId, string $name, ?array $permissions = null, ?bool $rowSecurity = null, ?bool $enabled = null): array + public function updateTable(string $databaseId, string $tableId, ?string $name = null, ?array $permissions = null, ?bool $rowSecurity = null, ?bool $enabled = null): array { $apiPath = str_replace( ['{databaseId}', '{tableId}'], @@ -540,7 +544,10 @@ public function updateTable(string $databaseId, string $tableId, string $name, ? $apiParams = []; $apiParams['databaseId'] = $databaseId; $apiParams['tableId'] = $tableId; - $apiParams['name'] = $name; + + if (!is_null($name)) { + $apiParams['name'] = $name; + } $apiParams['permissions'] = $permissions; if (!is_null($rowSecurity)) { @@ -1318,6 +1325,174 @@ public function updateLineColumn(string $databaseId, string $tableId, string $ke ); } + /** + * Create a longtext column. + * + * + * @param string $databaseId + * @param string $tableId + * @param string $key + * @param bool $required + * @param ?string $xdefault + * @param ?bool $xarray + * @throws AppwriteException + * @return array + */ + public function createLongtextColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}'], + [$databaseId, $tableId], + '/tablesdb/{databaseId}/tables/{tableId}/columns/longtext' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + + if (!is_null($xarray)) { + $apiParams['array'] = $xarray; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update a longtext column. Changing the `default` value will not update + * already existing rows. + * + * + * @param string $databaseId + * @param string $tableId + * @param string $key + * @param bool $required + * @param ?string $xdefault + * @param ?string $newKey + * @throws AppwriteException + * @return array + */ + public function updateLongtextColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}', '{key}'], + [$databaseId, $tableId, $key], + '/tablesdb/{databaseId}/tables/{tableId}/columns/longtext/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + $apiParams['newKey'] = $newKey; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create a mediumtext column. + * + * + * @param string $databaseId + * @param string $tableId + * @param string $key + * @param bool $required + * @param ?string $xdefault + * @param ?bool $xarray + * @throws AppwriteException + * @return array + */ + public function createMediumtextColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}'], + [$databaseId, $tableId], + '/tablesdb/{databaseId}/tables/{tableId}/columns/mediumtext' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + + if (!is_null($xarray)) { + $apiParams['array'] = $xarray; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update a mediumtext column. Changing the `default` value will not update + * already existing rows. + * + * + * @param string $databaseId + * @param string $tableId + * @param string $key + * @param bool $required + * @param ?string $xdefault + * @param ?string $newKey + * @throws AppwriteException + * @return array + */ + public function updateMediumtextColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}', '{key}'], + [$databaseId, $tableId, $key], + '/tablesdb/{databaseId}/tables/{tableId}/columns/mediumtext/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + $apiParams['newKey'] = $newKey; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * Create a geometric point column. * @@ -1537,6 +1712,9 @@ public function createRelationshipColumn(string $databaseId, string $tableId, st * @param ?bool $encrypt * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.9.0. Please use `createTextColumn` instead. + * @see TablesDB::createTextColumn */ public function createStringColumn(string $databaseId, string $tableId, string $key, int $size, bool $required, ?string $xdefault = null, ?bool $xarray = null, ?bool $encrypt = null): array { @@ -1587,6 +1765,9 @@ public function createStringColumn(string $databaseId, string $tableId, string $ * @param ?string $newKey * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `updateTextColumn` instead. + * @see TablesDB::updateTextColumn */ public function updateStringColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault, ?int $size = null, ?string $newKey = null): array { @@ -1616,6 +1797,90 @@ public function updateStringColumn(string $databaseId, string $tableId, string $ ); } + /** + * Create a text column. + * + * + * @param string $databaseId + * @param string $tableId + * @param string $key + * @param bool $required + * @param ?string $xdefault + * @param ?bool $xarray + * @throws AppwriteException + * @return array + */ + public function createTextColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}'], + [$databaseId, $tableId], + '/tablesdb/{databaseId}/tables/{tableId}/columns/text' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + + if (!is_null($xarray)) { + $apiParams['array'] = $xarray; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update a text column. Changing the `default` value will not update already + * existing rows. + * + * + * @param string $databaseId + * @param string $tableId + * @param string $key + * @param bool $required + * @param ?string $xdefault + * @param ?string $newKey + * @throws AppwriteException + * @return array + */ + public function updateTextColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}', '{key}'], + [$databaseId, $tableId, $key], + '/tablesdb/{databaseId}/tables/{tableId}/columns/text/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + $apiParams['newKey'] = $newKey; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * Create a URL column. * @@ -1700,6 +1965,94 @@ public function updateUrlColumn(string $databaseId, string $tableId, string $key ); } + /** + * Create a varchar column. + * + * + * @param string $databaseId + * @param string $tableId + * @param string $key + * @param int $size + * @param bool $required + * @param ?string $xdefault + * @param ?bool $xarray + * @throws AppwriteException + * @return array + */ + public function createVarcharColumn(string $databaseId, string $tableId, string $key, int $size, bool $required, ?string $xdefault = null, ?bool $xarray = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}'], + [$databaseId, $tableId], + '/tablesdb/{databaseId}/tables/{tableId}/columns/varchar' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['key'] = $key; + $apiParams['size'] = $size; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + + if (!is_null($xarray)) { + $apiParams['array'] = $xarray; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update a varchar column. Changing the `default` value will not update + * already existing rows. + * + * + * @param string $databaseId + * @param string $tableId + * @param string $key + * @param bool $required + * @param ?string $xdefault + * @param ?int $size + * @param ?string $newKey + * @throws AppwriteException + * @return array + */ + public function updateVarcharColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault, ?int $size = null, ?string $newKey = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}', '{key}'], + [$databaseId, $tableId, $key], + '/tablesdb/{databaseId}/tables/{tableId}/columns/varchar/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + $apiParams['size'] = $size; + $apiParams['newKey'] = $newKey; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * Get column by ID. * diff --git a/tests/Appwrite/QueryTest.php b/tests/Appwrite/QueryTest.php index 5f742936..6b4cd6c2 100644 --- a/tests/Appwrite/QueryTest.php +++ b/tests/Appwrite/QueryTest.php @@ -242,6 +242,46 @@ public function testNotEndsWith(): void { $this->assertSame('notEndsWith', $query['method']); } + public function testRegex(): void { + $query = json_decode(Query::regex('attr', 'pattern.*'), true); + $this->assertSame('attr', $query['attribute']); + $this->assertSame(['pattern.*'], $query['values']); + $this->assertSame('regex', $query['method']); + } + + public function testExists(): void { + $query = json_decode(Query::exists(['attr1', 'attr2']), true); + $this->assertNull($query['attribute'] ?? null); + $this->assertSame(['attr1', 'attr2'], $query['values']); + $this->assertSame('exists', $query['method']); + } + + public function testNotExists(): void { + $query = json_decode(Query::notExists(['attr1', 'attr2']), true); + $this->assertNull($query['attribute'] ?? null); + $this->assertSame(['attr1', 'attr2'], $query['values']); + $this->assertSame('notExists', $query['method']); + } + + public function testElemMatch(): void { + $inner1 = Query::equal('name', 'Alice'); + $inner2 = Query::greaterThan('age', 18); + + $query = json_decode(Query::elemMatch('friends', [$inner1, $inner2]), true); + + $this->assertSame('friends', $query['attribute']); + $this->assertSame('elemMatch', $query['method']); + $this->assertCount(2, $query['values']); + + $this->assertSame('equal', $query['values'][0]['method']); + $this->assertSame('name', $query['values'][0]['attribute']); + $this->assertSame(['Alice'], $query['values'][0]['values']); + + $this->assertSame('greaterThan', $query['values'][1]['method']); + $this->assertSame('age', $query['values'][1]['attribute']); + $this->assertSame([18], $query['values'][1]['values']); + } + public function testCreatedBefore(): void { $query = json_decode(Query::createdBefore('2023-01-01'), true); $this->assertSame('$createdAt', $query['attribute']); diff --git a/tests/Appwrite/Services/AccountTest.php b/tests/Appwrite/Services/AccountTest.php index d38511b9..0f539798 100644 --- a/tests/Appwrite/Services/AccountTest.php +++ b/tests/Appwrite/Services/AccountTest.php @@ -6,6 +6,7 @@ use Appwrite\InputFile; use Mockery; use PHPUnit\Framework\TestCase; +use Appwrite\Enums\Scopes; use Appwrite\Enums\AuthenticatorType; use Appwrite\Enums\AuthenticationFactor; use Appwrite\Enums\OAuthProvider; @@ -160,6 +161,112 @@ public function testMethodCreateJWT(): void { $this->assertSame($data, $response); } + public function testMethodListKeys(): void { + + $data = array( + "total" => 5, + "keys" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->account->listKeys( + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateKey(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "My API Key", + "expire" => "2020-10-15T06:38:00.000+00:00", + "scopes" => array(), + "secret" => "919c2d18fb5d4...a2ae413da83346ad2", + "accessedAt" => "2020-10-15T06:38:00.000+00:00", + "sdks" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->account->createKey( + "", + array(Scopes::ACCOUNT()) + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetKey(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "My API Key", + "expire" => "2020-10-15T06:38:00.000+00:00", + "scopes" => array(), + "secret" => "919c2d18fb5d4...a2ae413da83346ad2", + "accessedAt" => "2020-10-15T06:38:00.000+00:00", + "sdks" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->account->getKey( + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateKey(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "My API Key", + "expire" => "2020-10-15T06:38:00.000+00:00", + "scopes" => array(), + "secret" => "919c2d18fb5d4...a2ae413da83346ad2", + "accessedAt" => "2020-10-15T06:38:00.000+00:00", + "sdks" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->account->updateKey( + "", + "", + array(Scopes::ACCOUNT()) + ); + + $this->assertSame($data, $response); + } + + public function testMethodDeleteKey(): void { + + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->account->deleteKey( + "" + ); + + $this->assertSame($data, $response); + } + public function testMethodListLogs(): void { $data = array( diff --git a/tests/Appwrite/Services/AvatarsTest.php b/tests/Appwrite/Services/AvatarsTest.php index d0c630c6..4b75f42d 100644 --- a/tests/Appwrite/Services/AvatarsTest.php +++ b/tests/Appwrite/Services/AvatarsTest.php @@ -11,6 +11,7 @@ use Appwrite\Enums\Flag; use Appwrite\Enums\Theme; use Appwrite\Enums\Timezone; +use Appwrite\Enums\BrowserPermission; use Appwrite\Enums\ImageFormat; final class AvatarsTest extends TestCase { diff --git a/tests/Appwrite/Services/BackupsTest.php b/tests/Appwrite/Services/BackupsTest.php index 2c76ddf4..c485ef76 100644 --- a/tests/Appwrite/Services/BackupsTest.php +++ b/tests/Appwrite/Services/BackupsTest.php @@ -6,6 +6,7 @@ use Appwrite\InputFile; use Mockery; use PHPUnit\Framework\TestCase; +use Appwrite\Enums\BackupServices; final class BackupsTest extends TestCase { private $client; @@ -51,7 +52,7 @@ public function testMethodCreateArchive(): void { ->andReturn($data); $response = $this->backups->createArchive( - array() + array(BackupServices::DATABASES()) ); $this->assertSame($data, $response); @@ -132,7 +133,7 @@ public function testMethodCreatePolicy(): void { $response = $this->backups->createPolicy( "", - array(), + array(BackupServices::DATABASES()), 1, "" ); @@ -224,7 +225,7 @@ public function testMethodCreateRestoration(): void { $response = $this->backups->createRestoration( "", - array() + array(BackupServices::DATABASES()) ); $this->assertSame($data, $response); diff --git a/tests/Appwrite/Services/DatabasesTest.php b/tests/Appwrite/Services/DatabasesTest.php index 10b7960c..551944cb 100644 --- a/tests/Appwrite/Services/DatabasesTest.php +++ b/tests/Appwrite/Services/DatabasesTest.php @@ -9,6 +9,7 @@ use Appwrite\Enums\RelationshipType; use Appwrite\Enums\RelationMutate; use Appwrite\Enums\IndexType; +use Appwrite\Enums\OrderBy; final class DatabasesTest extends TestCase { private $client; @@ -213,8 +214,7 @@ public function testMethodUpdate(): void { ->andReturn($data); $response = $this->databases->update( - "", - "" + "" ); $this->assertSame($data, $response); @@ -264,7 +264,9 @@ public function testMethodCreateCollection(): void { "enabled" => true, "documentSecurity" => true, "attributes" => array(), - "indexes" => array()); + "indexes" => array(), + "bytesMax" => 65535, + "bytesUsed" => 1500); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -291,7 +293,9 @@ public function testMethodGetCollection(): void { "enabled" => true, "documentSecurity" => true, "attributes" => array(), - "indexes" => array()); + "indexes" => array(), + "bytesMax" => 65535, + "bytesUsed" => 1500); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -317,7 +321,9 @@ public function testMethodUpdateCollection(): void { "enabled" => true, "documentSecurity" => true, "attributes" => array(), - "indexes" => array()); + "indexes" => array(), + "bytesMax" => 65535, + "bytesUsed" => 1500); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -325,8 +331,7 @@ public function testMethodUpdateCollection(): void { $response = $this->databases->updateCollection( "", - "", - "" + "" ); $this->assertSame($data, $response); @@ -785,6 +790,108 @@ public function testMethodUpdateLineAttribute(): void { $this->assertSame($data, $response); } + public function testMethodCreateLongtextAttribute(): void { + + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->createLongtextAttribute( + "", + "", + "", + true + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateLongtextAttribute(): void { + + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->updateLongtextAttribute( + "", + "", + "", + true, + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateMediumtextAttribute(): void { + + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->createMediumtextAttribute( + "", + "", + "", + true + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateMediumtextAttribute(): void { + + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->updateMediumtextAttribute( + "", + "", + "", + true, + "" + ); + + $this->assertSame($data, $response); + } + public function testMethodCreatePointAttribute(): void { $data = array( @@ -970,6 +1077,57 @@ public function testMethodUpdateStringAttribute(): void { $this->assertSame($data, $response); } + public function testMethodCreateTextAttribute(): void { + + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->createTextAttribute( + "", + "", + "", + true + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateTextAttribute(): void { + + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->updateTextAttribute( + "", + "", + "", + true, + "" + ); + + $this->assertSame($data, $response); + } + public function testMethodCreateUrlAttribute(): void { $data = array( @@ -1023,6 +1181,60 @@ public function testMethodUpdateUrlAttribute(): void { $this->assertSame($data, $response); } + public function testMethodCreateVarcharAttribute(): void { + + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "size" => 128); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->createVarcharAttribute( + "", + "", + "", + 1, + true + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateVarcharAttribute(): void { + + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "size" => 128); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->updateVarcharAttribute( + "", + "", + "", + true, + "" + ); + + $this->assertSame($data, $response); + } + public function testMethodGetAttribute(): void { $data = array( diff --git a/tests/Appwrite/Services/FunctionsTest.php b/tests/Appwrite/Services/FunctionsTest.php index d7916ada..9d468cd3 100644 --- a/tests/Appwrite/Services/FunctionsTest.php +++ b/tests/Appwrite/Services/FunctionsTest.php @@ -7,6 +7,7 @@ use Mockery; use PHPUnit\Framework\TestCase; use Appwrite\Enums\Runtime; +use Appwrite\Enums\Scopes; use Appwrite\Enums\TemplateReferenceType; use Appwrite\Enums\VCSReferenceType; use Appwrite\Enums\DeploymentDownloadType; diff --git a/tests/Appwrite/Services/HealthTest.php b/tests/Appwrite/Services/HealthTest.php index e3e58496..bf501d92 100644 --- a/tests/Appwrite/Services/HealthTest.php +++ b/tests/Appwrite/Services/HealthTest.php @@ -53,9 +53,8 @@ public function testMethodGetAntivirus(): void { public function testMethodGetCache(): void { $data = array( - "name" => "database", - "ping" => 128, - "status" => "pass"); + "total" => 5, + "statuses" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -90,9 +89,8 @@ public function testMethodGetCertificate(): void { public function testMethodGetDB(): void { $data = array( - "name" => "database", - "ping" => 128, - "status" => "pass"); + "total" => 5, + "statuses" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -107,9 +105,8 @@ public function testMethodGetDB(): void { public function testMethodGetPubSub(): void { $data = array( - "name" => "database", - "ping" => 128, - "status" => "pass"); + "total" => 5, + "statuses" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -121,6 +118,51 @@ public function testMethodGetPubSub(): void { $this->assertSame($data, $response); } + public function testMethodGetQueueAudits(): void { + + $data = array( + "size" => 8); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->health->getQueueAudits( + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetQueueBillingProjectAggregation(): void { + + $data = array( + "size" => 8); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->health->getQueueBillingProjectAggregation( + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetQueueBillingTeamAggregation(): void { + + $data = array( + "size" => 8); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->health->getQueueBillingTeamAggregation( + ); + + $this->assertSame($data, $response); + } + public function testMethodGetQueueBuilds(): void { $data = array( @@ -136,6 +178,21 @@ public function testMethodGetQueueBuilds(): void { $this->assertSame($data, $response); } + public function testMethodGetQueuePriorityBuilds(): void { + + $data = array( + "size" => 8); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->health->getQueuePriorityBuilds( + ); + + $this->assertSame($data, $response); + } + public function testMethodGetQueueCertificates(): void { $data = array( @@ -272,6 +329,21 @@ public function testMethodGetQueueMigrations(): void { $this->assertSame($data, $response); } + public function testMethodGetQueueRegionManager(): void { + + $data = array( + "size" => 8); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->health->getQueueRegionManager( + ); + + $this->assertSame($data, $response); + } + public function testMethodGetQueueStatsResources(): void { $data = array( @@ -302,6 +374,21 @@ public function testMethodGetQueueUsage(): void { $this->assertSame($data, $response); } + public function testMethodGetQueueThreats(): void { + + $data = array( + "size" => 8); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->health->getQueueThreats( + ); + + $this->assertSame($data, $response); + } + public function testMethodGetQueueWebhooks(): void { $data = array( diff --git a/tests/Appwrite/Services/TablesDBTest.php b/tests/Appwrite/Services/TablesDBTest.php index 42ed5267..fb91185a 100644 --- a/tests/Appwrite/Services/TablesDBTest.php +++ b/tests/Appwrite/Services/TablesDBTest.php @@ -9,6 +9,7 @@ use Appwrite\Enums\RelationshipType; use Appwrite\Enums\RelationMutate; use Appwrite\Enums\IndexType; +use Appwrite\Enums\OrderBy; final class TablesDBTest extends TestCase { private $client; @@ -213,8 +214,7 @@ public function testMethodUpdate(): void { ->andReturn($data); $response = $this->tablesDB->update( - "", - "" + "" ); $this->assertSame($data, $response); @@ -264,7 +264,9 @@ public function testMethodCreateTable(): void { "enabled" => true, "rowSecurity" => true, "columns" => array(), - "indexes" => array()); + "indexes" => array(), + "bytesMax" => 65535, + "bytesUsed" => 1500); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -291,7 +293,9 @@ public function testMethodGetTable(): void { "enabled" => true, "rowSecurity" => true, "columns" => array(), - "indexes" => array()); + "indexes" => array(), + "bytesMax" => 65535, + "bytesUsed" => 1500); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -317,7 +321,9 @@ public function testMethodUpdateTable(): void { "enabled" => true, "rowSecurity" => true, "columns" => array(), - "indexes" => array()); + "indexes" => array(), + "bytesMax" => 65535, + "bytesUsed" => 1500); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -325,8 +331,7 @@ public function testMethodUpdateTable(): void { $response = $this->tablesDB->updateTable( "", - "", - "" + "" ); $this->assertSame($data, $response); @@ -785,6 +790,108 @@ public function testMethodUpdateLineColumn(): void { $this->assertSame($data, $response); } + public function testMethodCreateLongtextColumn(): void { + + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDB->createLongtextColumn( + "", + "", + "", + true + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateLongtextColumn(): void { + + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDB->updateLongtextColumn( + "", + "", + "", + true, + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateMediumtextColumn(): void { + + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDB->createMediumtextColumn( + "", + "", + "", + true + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateMediumtextColumn(): void { + + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDB->updateMediumtextColumn( + "", + "", + "", + true, + "" + ); + + $this->assertSame($data, $response); + } + public function testMethodCreatePointColumn(): void { $data = array( @@ -970,6 +1077,57 @@ public function testMethodUpdateStringColumn(): void { $this->assertSame($data, $response); } + public function testMethodCreateTextColumn(): void { + + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDB->createTextColumn( + "", + "", + "", + true + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateTextColumn(): void { + + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDB->updateTextColumn( + "", + "", + "", + true, + "" + ); + + $this->assertSame($data, $response); + } + public function testMethodCreateUrlColumn(): void { $data = array( @@ -1023,6 +1181,60 @@ public function testMethodUpdateUrlColumn(): void { $this->assertSame($data, $response); } + public function testMethodCreateVarcharColumn(): void { + + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "size" => 128); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDB->createVarcharColumn( + "", + "", + "", + 1, + true + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateVarcharColumn(): void { + + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "size" => 128); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDB->updateVarcharColumn( + "", + "", + "", + true, + "" + ); + + $this->assertSame($data, $response); + } + public function testMethodGetColumn(): void { $data = array(