diff --git a/.env b/.env index 64fc7ef10f..1947ddff1a 100644 --- a/.env +++ b/.env @@ -2,6 +2,7 @@ _APP_ENV=development _APP_EDITION=self-hosted _APP_LOCALE=en _APP_WORKER_PER_CORE=6 +_APP_COMPRESSION_ENABLED=enabled _APP_COMPRESSION_MIN_SIZE_BYTES=1024 _APP_CONSOLE_WHITELIST_ROOT=disabled _APP_CONSOLE_WHITELIST_EMAILS= @@ -69,8 +70,8 @@ _APP_STORAGE_ANTIVIRUS_PORT=3310 _APP_SMTP_HOST=maildev _APP_SMTP_PORT=1025 _APP_SMTP_SECURE= -_APP_SMTP_USERNAME= -_APP_SMTP_PASSWORD= +_APP_SMTP_USERNAME=user +_APP_SMTP_PASSWORD=password _APP_SMS_PROVIDER=sms://username:password@mock _APP_SMS_FROM=+123456789 _APP_SMS_PROJECTS_DENY_LIST= @@ -101,9 +102,12 @@ _APP_USAGE_AGGREGATION_INTERVAL=30 _APP_STATS_RESOURCES_INTERVAL=30 _APP_MAINTENANCE_RETENTION_USAGE_HOURLY=8640000 _APP_MAINTENANCE_RETENTION_SCHEDULES=86400 +_APP_INTERVAL_DOMAIN_VERIFICATION=60 +_APP_INTERVAL_CLEANUP_STALE_EXECUTIONS=300 _APP_USAGE_STATS=enabled _APP_LOGGING_CONFIG= _APP_LOGGING_CONFIG_REALTIME= +_APP_GRAPHQL_INTROSPECTION=enabled _APP_GRAPHQL_MAX_BATCH_SIZE=10 _APP_GRAPHQL_MAX_COMPLEXITY=250 _APP_GRAPHQL_MAX_DEPTH=4 @@ -125,4 +129,4 @@ _APP_WEBHOOK_MAX_FAILED_ATTEMPTS=10 _APP_PROJECT_REGIONS=default _APP_FUNCTIONS_CREATION_ABUSE_LIMIT=5000 _APP_STATS_USAGE_DUAL_WRITING_DBS=database_db_main -_APP_TRUSTED_HEADERS=x-forwarded-for \ No newline at end of file +_APP_TRUSTED_HEADERS=x-forwarded-for diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index cebdc02163..509e1f5b29 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -223,7 +223,7 @@ jobs: -e _APP_DATABASE_SHARED_TABLES \ -e _APP_DATABASE_SHARED_TABLES_V1 \ -e _APP_E2E_RESPONSE_FORMAT="${{ github.event.inputs.response_format }}" \ - appwrite test /usr/src/code/tests/e2e/Services/${{ matrix.service }} --debug --exclude-group devKeys,screenshots + appwrite test /usr/src/code/tests/e2e/Services/${{ matrix.service }} --debug --exclude-group abuseEnabled,screenshots - name: Failure Logs if: failure() @@ -312,7 +312,7 @@ jobs: -e _APP_DATABASE_SHARED_TABLES \ -e _APP_DATABASE_SHARED_TABLES_V1 \ -e _APP_E2E_RESPONSE_FORMAT="${{ github.event.inputs.response_format }}" \ - appwrite test /usr/src/code/tests/e2e/Services/${{ matrix.service }} --debug --exclude-group devKeys,screenshots + appwrite test /usr/src/code/tests/e2e/Services/${{ matrix.service }} --debug --exclude-group abuseEnabled,screenshots - name: Failure Logs if: failure() @@ -322,8 +322,8 @@ jobs: echo "=== OpenRuntimes Executor Logs ===" docker compose logs openruntimes-executor - e2e_dev_keys: - name: E2E Service Test (Dev Keys) + e2e_abuse_enabled: + name: E2E Service Test (Abuse enabled) runs-on: ubuntu-latest needs: setup steps: @@ -344,7 +344,7 @@ jobs: docker compose up -d sleep 30 - - name: Run Projects tests with dev keys in dedicated table mode + - name: Run Projects tests in dedicated table mode run: | echo "Using project tables" export _APP_DATABASE_SHARED_TABLES= @@ -354,7 +354,7 @@ jobs: -e _APP_DATABASE_SHARED_TABLES \ -e _APP_DATABASE_SHARED_TABLES_V1 \ -e _APP_E2E_RESPONSE_FORMAT="${{ github.event.inputs.response_format }}" \ - appwrite test /usr/src/code/tests/e2e/Services/Projects --debug --group=devKeys + appwrite test /usr/src/code/tests/e2e/Services/Projects --debug --group=abuseEnabled - name: Failure Logs if: failure() @@ -364,8 +364,8 @@ jobs: echo "=== OpenRuntimes Executor Logs ===" docker compose logs openruntimes-executor - e2e_dev_keys_shared_mode: - name: E2E Shared Mode Service Test (Dev Keys) + e2e_abuse_enabled_shared_mode: + name: E2E Shared Mode Service Test (Abuse enabled) runs-on: ubuntu-latest needs: [ setup, check_database_changes ] if: needs.check_database_changes.outputs.database_changed == 'true' @@ -394,7 +394,7 @@ jobs: docker compose up -d sleep 30 - - name: Run Projects tests with dev keys in ${{ matrix.tables-mode }} table mode + - name: Run Projects tests in ${{ matrix.tables-mode }} table mode run: | if [ "${{ matrix.tables-mode }}" == "Shared V1" ]; then echo "Using shared tables V1" @@ -410,7 +410,7 @@ jobs: -e _APP_DATABASE_SHARED_TABLES \ -e _APP_DATABASE_SHARED_TABLES_V1 \ -e _APP_E2E_RESPONSE_FORMAT="${{ github.event.inputs.response_format }}" \ - appwrite test /usr/src/code/tests/e2e/Services/Projects --debug --group=devKeys + appwrite test /usr/src/code/tests/e2e/Services/Projects --debug --group=abuseEnabled - name: Failure Logs if: failure() @@ -420,7 +420,7 @@ jobs: echo "=== OpenRuntimes Executor Logs ===" docker compose logs openruntimes-executor - e2e_screenshots_keys: + e2e_screenshots: name: E2E Service Test (Site Screenshots) runs-on: ubuntu-latest needs: setup diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000000..993b0b5ad0 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,77 @@ +# AGENTS.md + +Appwrite is an end-to-end backend server for web, mobile, native, and backend apps. This guide provides context and instructions for AI coding agents working on the Appwrite codebase. + +## Project Overview + +Appwrite is a self-hosted Backend-as-a-Service (BaaS) platform that provides developers with a set of APIs and tools to build secure, scalable applications. The project uses a hybrid monolithic-microservice architecture built with PHP, running on Swoole for high performance. + +**Key Technologies:** +- **Backend:** PHP 8.3+, Swoole +- **Libraries:** Utopia PHP +- **Database:** MariaDB, Redis +- **Cache:** Redis +- **Queue:** Redis +- **Containers:** Docker + +## Development Commands + +```bash +# Run Appwrite +docker compose up -d --force-recreate --build + +# Run specific test +docker compose exec appwrite test /usr/src/code/tests/e2e/Services/[ServiceName] --filter=[FunctionName] + +# Format code +composer format +``` + +## Code Style Guidelines + +- Follow [PSR-12](https://www.php-fig.org/psr/psr-12/) coding standard +- Use PSR-4 autoloading +- Strict type declarations where applicable +- Comprehensive PHPDoc comments + +### Naming Conventions + +#### `resourceType` Naming Rule + +When a collection has a combination of `resourceType`, `resourceId`, and/or `resourceInternalId`, the value of `resourceType` MUST always be **plural** - for example: `functions`, `sites`, `deployments`. + +Examples: +```php +'resourceType' => 'functions' +'resourceType' => 'sites' +'resourceType' => 'deployments' +``` + +## Security Considerations + +### Critical Security Practices + +- **Never hardcode credentials** - Use environment variables +- **Rate limiting** - Respect abuse prevention mechanisms + +## Dependencies + +Avoid introducing new dependencies other than utopia-php. + +## Adding new endpoints + +When adding new endpoints, make sure to use modules and follow its patterns. Find instruction in [Modules AGENTS.md](src/Appwrite/Platform/AGENTS.md) file. + +## Pull Request Guidelines +### Before Submitting + +- Run `composer format` +- Update documentation if adding features +- Add/update tests for your changes +- Check that Docker build succeeds +`docs/specs/authentication.drawio.svg` + +## Known Issues and Gotchas + +- **Hot Reload:** Code changes require container restart in some cases +- **Logging:** There is no central place for logs, so when debugging, ensure to check all possibly relevant containers diff --git a/CHANGES.md b/CHANGES.md index 74b46b7edc..e6dd04b556 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,101 @@ +# Version 1.8.1 + +## What's Changed + +### Notable changes + +* Add branch deployments support in [#10486](https://github.com/appwrite/appwrite/pull/10486) +* Add TanStack Start sites support in [#10681](https://github.com/appwrite/appwrite/pull/10681) +* Add Next.js standalone support in [#10747](https://github.com/appwrite/appwrite/pull/10747) +* Add Resend integration in [#10690](https://github.com/appwrite/appwrite/pull/10690) +* Add option to enable/disable image transformations per-bucket in [#10722](https://github.com/appwrite/appwrite/pull/10722) +* Add operators support in [#10735](https://github.com/appwrite/appwrite/pull/10735) and [#10800](https://github.com/appwrite/appwrite/pull/10800) +* Add function and sites stats in [#10786](https://github.com/appwrite/appwrite/pull/10786) +* Add disable count feature in [#10668](https://github.com/appwrite/appwrite/pull/10668) +* Add ElevenLabs site template in [#10782](https://github.com/appwrite/appwrite/pull/10782) +* Add suggested environment variables in [#10795](https://github.com/appwrite/appwrite/pull/10795) +* Update GeoDB database in [#10890](https://github.com/appwrite/appwrite/pull/10890) +* Update Flutter default build runtime in [#10807](https://github.com/appwrite/appwrite/pull/10807) +* Upgrade runtimes in [#10804](https://github.com/appwrite/appwrite/pull/10804) + +### Fixes + +* Fix duplicate document error while creating file in [#10891](https://github.com/appwrite/appwrite/pull/10891) +* Fix "Update external deployment (authorize)" throwing 500 error due to invalid query in [#10888](https://github.com/appwrite/appwrite/pull/10888) +* Fix error setting user password in [#10889](https://github.com/appwrite/appwrite/pull/10889) +* Fix error generating email MFA challenges in [#10884](https://github.com/appwrite/appwrite/pull/10884) +* Fix file token expiry in [#10877](https://github.com/appwrite/appwrite/pull/10877) +* Fix TanStack Nitro default in [#10860](https://github.com/appwrite/appwrite/pull/10860) +* Fix TanStack builds in [#10767](https://github.com/appwrite/appwrite/pull/10767) +* Fix nullable validation in [#10819](https://github.com/appwrite/appwrite/pull/10819) and [#10778](https://github.com/appwrite/appwrite/pull/10778) +* Fix WebP library in [#10738](https://github.com/appwrite/appwrite/pull/10738) +* Fix batch writes in [#10812](https://github.com/appwrite/appwrite/pull/10812) +* Fix error handler error in [#10719](https://github.com/appwrite/appwrite/pull/10719) +* Fix Next 16 compatibility in [#10713](https://github.com/appwrite/appwrite/pull/10713) +* Fix stats usage memory leak in [#10683](https://github.com/appwrite/appwrite/pull/10683) +* Fix author URL in template deployments in [#10535](https://github.com/appwrite/appwrite/pull/10535) +* Fix VCS lock deletion in [#10691](https://github.com/appwrite/appwrite/pull/10691) + +### Miscellaneous + +* Add CSV export functionality in [#10546](https://github.com/appwrite/appwrite/pull/10546), [#10750](https://github.com/appwrite/appwrite/pull/10750), [#10813](https://github.com/appwrite/appwrite/pull/10813), and [#10847](https://github.com/appwrite/appwrite/pull/10847) +* Add JWT disposition in [#10867](https://github.com/appwrite/appwrite/pull/10867) +* Add screenshots endpoint in [#10675](https://github.com/appwrite/appwrite/pull/10675) +* Add screenshot endpoint stats in [#10706](https://github.com/appwrite/appwrite/pull/10706) +* Add users attributes in [#10688](https://github.com/appwrite/appwrite/pull/10688) +* Add max build duration environment variable in [#10674](https://github.com/appwrite/appwrite/pull/10674) +* Add custom realtime logger in [#10871](https://github.com/appwrite/appwrite/pull/10871) +* Add logs in [#10869](https://github.com/appwrite/appwrite/pull/10869) +* Improve MFA docs endpoint order in [#10793](https://github.com/appwrite/appwrite/pull/10793) +* Auth refactor in [#10758](https://github.com/appwrite/appwrite/pull/10758), [#10837](https://github.com/appwrite/appwrite/pull/10837), [#10682](https://github.com/appwrite/appwrite/pull/10682), and [#10667](https://github.com/appwrite/appwrite/pull/10667) +* Bump assistant to 0.8.4 in [#10887](https://github.com/appwrite/appwrite/pull/10887) +* Bump database to 3.1.5 in [#10766](https://github.com/appwrite/appwrite/pull/10766) +* Bump Utopia DNS in [#10761](https://github.com/appwrite/appwrite/pull/10761) +* Update domains to 0.8.3 in [#10658](https://github.com/appwrite/appwrite/pull/10658) +* Update domains to 0.9.1 in [#10678](https://github.com/appwrite/appwrite/pull/10678) +* Update Apple Swift to 13.3.0 in [#10679](https://github.com/appwrite/appwrite/pull/10679) +* Update Apple Swift in [#10663](https://github.com/appwrite/appwrite/pull/10663) +* Update CLI to 10.2.2 in [#10672](https://github.com/appwrite/appwrite/pull/10672) +* Update to CLI 12.0.0 in [#10853](https://github.com/appwrite/appwrite/pull/10853) +* Update docs examples to use Permission class in [#10707](https://github.com/appwrite/appwrite/pull/10707) +* Update SDK examples docs in [#10855](https://github.com/appwrite/appwrite/pull/10855) +* Release Python SDK in [#10762](https://github.com/appwrite/appwrite/pull/10762) +* Release Flutter 20.3.2 in [#10838](https://github.com/appwrite/appwrite/pull/10838) +* Release Flutter/Dart add screenshot examples in [#10811](https://github.com/appwrite/appwrite/pull/10811) +* Release PHP CLI in [#10791](https://github.com/appwrite/appwrite/pull/10791) +* Release SDKs in [#10817](https://github.com/appwrite/appwrite/pull/10817) +* Update SDKs in [#10694](https://github.com/appwrite/appwrite/pull/10694), [#10729](https://github.com/appwrite/appwrite/pull/10729), and [#10744](https://github.com/appwrite/appwrite/pull/10744) +* Update SDK generator in [#10743](https://github.com/appwrite/appwrite/pull/10743) +* Update database in [#10664](https://github.com/appwrite/appwrite/pull/10664) +* Update README file in [#10763](https://github.com/appwrite/appwrite/pull/10763) +* SDK release documentation in [#10745](https://github.com/appwrite/appwrite/pull/10745) +* SDK release runtime config in [#10765](https://github.com/appwrite/appwrite/pull/10765) +* Sync specs in [#10789](https://github.com/appwrite/appwrite/pull/10789) +* Sync 1.8.0 in [#10677](https://github.com/appwrite/appwrite/pull/10677) +* Add workflow for issue triage in [#10718](https://github.com/appwrite/appwrite/pull/10718) +* Add issue auto-labeler in [#10700](https://github.com/appwrite/appwrite/pull/10700) +* Add AI moderator repo in [#10717](https://github.com/appwrite/appwrite/pull/10717) +* Browser bump in [#10850](https://github.com/appwrite/appwrite/pull/10850) +* Template type enum override in [#10848](https://github.com/appwrite/appwrite/pull/10848) +* VCS reference type in [#10852](https://github.com/appwrite/appwrite/pull/10852) +* Index scope description in [#10851](https://github.com/appwrite/appwrite/pull/10851) +* Config for environment in [#10833](https://github.com/appwrite/appwrite/pull/10833) +* Format instance in [#10830](https://github.com/appwrite/appwrite/pull/10830) +* Replace sleep in webhooks service in [#10656](https://github.com/appwrite/appwrite/pull/10656) +* Update email composer in [#10720](https://github.com/appwrite/appwrite/pull/10720) +* Update facts on GitHub sites and functions in [#10593](https://github.com/appwrite/appwrite/pull/10593) and [#10771](https://github.com/appwrite/appwrite/pull/10771) +* Fix wrong user type in [#10875](https://github.com/appwrite/appwrite/pull/10875) +* Fix limit and offset computation in [#10880](https://github.com/appwrite/appwrite/pull/10880) +* Fix enum examples in [#10828](https://github.com/appwrite/appwrite/pull/10828) +* Fix response models multi-methods in [#10815](https://github.com/appwrite/appwrite/pull/10815) +* Fix undefined variable in [#10654](https://github.com/appwrite/appwrite/pull/10654) +* Fix undefined sequence in [#10652](https://github.com/appwrite/appwrite/pull/10652) +* Fix description in [#10702](https://github.com/appwrite/appwrite/pull/10702) +* Fix warning in builds worker in [#10705](https://github.com/appwrite/appwrite/pull/10705) +* Fix sites create deployment docs in [#10566](https://github.com/appwrite/appwrite/pull/10566) +* Fix test dependencies projects in [#10655](https://github.com/appwrite/appwrite/pull/10655) +* Fix list sites test in [#10726](https://github.com/appwrite/appwrite/pull/10726) + # Version 1.8.0 ## What's Changed diff --git a/Dockerfile b/Dockerfile index e146008222..ac8cff0884 100755 --- a/Dockerfile +++ b/Dockerfile @@ -57,6 +57,7 @@ RUN mkdir -p /storage/uploads && \ # Executables RUN chmod +x /usr/local/bin/doctor && \ chmod +x /usr/local/bin/install && \ + chmod +x /usr/local/bin/interval && \ chmod +x /usr/local/bin/maintenance && \ chmod +x /usr/local/bin/migrate && \ chmod +x /usr/local/bin/realtime && \ @@ -76,6 +77,7 @@ RUN chmod +x /usr/local/bin/doctor && \ chmod +x /usr/local/bin/queue-count-success && \ chmod +x /usr/local/bin/worker-audits && \ chmod +x /usr/local/bin/worker-builds && \ + chmod +x /usr/local/bin/worker-screenshots && \ chmod +x /usr/local/bin/worker-certificates && \ chmod +x /usr/local/bin/worker-databases && \ chmod +x /usr/local/bin/worker-deletes && \ diff --git a/README-CN.md b/README-CN.md index c087b16201..afd7eca289 100644 --- a/README-CN.md +++ b/README-CN.md @@ -72,7 +72,7 @@ docker run -it --rm \ --volume /var/run/docker.sock:/var/run/docker.sock \ --volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \ --entrypoint="install" \ - appwrite/appwrite:1.8.0 + appwrite/appwrite:1.8.1 ``` ### Windows @@ -84,7 +84,7 @@ docker run -it --rm ^ --volume //var/run/docker.sock:/var/run/docker.sock ^ --volume "%cd%"/appwrite:/usr/src/code/appwrite:rw ^ --entrypoint="install" ^ - appwrite/appwrite:1.8.0 + appwrite/appwrite:1.8.1 ``` #### PowerShell @@ -94,7 +94,7 @@ docker run -it --rm ` --volume /var/run/docker.sock:/var/run/docker.sock ` --volume ${pwd}/appwrite:/usr/src/code/appwrite:rw ` --entrypoint="install" ` - appwrite/appwrite:1.8.0 + appwrite/appwrite:1.8.1 ``` 运行后,可以在浏览器上访问 http://localhost 找到 Appwrite 控制台。在非 Linux 的本机主机上完成安装后,服务器可能需要几分钟才能启动。 diff --git a/README.md b/README.md index 0743234954..4a71579207 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ docker run -it --rm \ --volume /var/run/docker.sock:/var/run/docker.sock \ --volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \ --entrypoint="install" \ - appwrite/appwrite:1.8.0 + appwrite/appwrite:1.8.1 ``` ### Windows @@ -87,7 +87,7 @@ docker run -it --rm ^ --volume //var/run/docker.sock:/var/run/docker.sock ^ --volume "%cd%"/appwrite:/usr/src/code/appwrite:rw ^ --entrypoint="install" ^ - appwrite/appwrite:1.8.0 + appwrite/appwrite:1.8.1 ``` #### PowerShell @@ -97,7 +97,7 @@ docker run -it --rm ` --volume /var/run/docker.sock:/var/run/docker.sock ` --volume ${pwd}/appwrite:/usr/src/code/appwrite:rw ` --entrypoint="install" ` - appwrite/appwrite:1.8.0 + appwrite/appwrite:1.8.1 ``` Once the Docker installation is complete, go to http://localhost to access the Appwrite console from your browser. Please note that on non-Linux native hosts, the server might take a few minutes to start after completing the installation. diff --git a/app/cli.php b/app/cli.php index 7b65ab8fa5..4b85ba35c6 100644 --- a/app/cli.php +++ b/app/cli.php @@ -78,6 +78,7 @@ CLI::setResource('dbForPlatform', function ($pools, $cache, $authorization) { $dbForPlatform = new Database($adapter, $cache); $dbForPlatform + ->setDatabase(APP_DATABASE) ->setAuthorization($authorization) ->setNamespace('_console') ->setMetadata('host', \gethostname()) @@ -168,6 +169,7 @@ CLI::setResource('getProjectDB', function (Group $pools, Database $dbForPlatform } $database + ->setDatabase(APP_DATABASE) ->setAuthorization($authorization) ->setMetadata('host', \gethostname()) ->setMetadata('project', $project->getId()); @@ -189,6 +191,7 @@ CLI::setResource('getLogsDB', function (Group $pools, Cache $cache, Authorizatio $database = new Database($adapter, $cache); $database + ->setDatabase(APP_DATABASE) ->setAuthorization($authorization) ->setSharedTables(true) ->setNamespace('logsV1') @@ -265,6 +268,14 @@ CLI::setResource('logError', function (Registry $register) { $log->addExtra('trace', $error->getTraceAsString()); $log->addExtra('detailedTrace', $error->getTrace()); + if ($error->getPrevious() !== null) { + if ($error->getPrevious()->getMessage() != $error->getMessage()) { + $log->addExtra('previousMessage', $error->getPrevious()->getMessage()); + } + $log->addExtra('previousFile', $error->getPrevious()->getFile()); + $log->addExtra('previousLine', $error->getPrevious()->getLine()); + } + $log->setAction($action); $isProduction = System::getEnv('_APP_ENV', 'development') === 'production'; diff --git a/app/config/collections/common.php b/app/config/collections/common.php index a364a0a866..2328cd5b88 100644 --- a/app/config/collections/common.php +++ b/app/config/collections/common.php @@ -1288,6 +1288,17 @@ return [ 'array' => false, 'filters' => ['json'], ], + [ + '$id' => ID::custom('labels'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 128, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => true, + 'filters' => [], + ], ], 'indexes' => [ [ diff --git a/app/config/collections/platform.php b/app/config/collections/platform.php index d44d9b725c..8e214e7999 100644 --- a/app/config/collections/platform.php +++ b/app/config/collections/platform.php @@ -6,7 +6,7 @@ use Utopia\Database\Helpers\ID; $providers = Config::getParam('oAuthProviders', []); -return [ +$platformCollections = [ 'projects' => [ '$collection' => ID::custom(Database::METADATA), '$id' => ID::custom('projects'), @@ -330,7 +330,18 @@ return [ 'default' => null, 'array' => false, 'filters' => ['datetime'], - ] + ], + [ + '$id' => ID::custom('labels'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 128, + 'signed' => true, + 'required' => false, + 'default' => [], + 'array' => true, + 'filters' => [], + ], ], 'indexes' => [ [ @@ -643,6 +654,39 @@ return [ 'array' => false, 'filters' => [], ], + [ + '$id' => 'resourceType', + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => 'resourceId', + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => 'resourceInternalId', + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => [], + ], [ '$id' => ID::custom('name'), 'type' => Database::VAR_STRING, @@ -718,6 +762,13 @@ return [ 'lengths' => [Database::LENGTH_KEY], 'orders' => [Database::ORDER_ASC], ], + [ + '$id' => '_key_resource', + 'type' => Database::INDEX_KEY, + 'attributes' => ['resourceType', 'resourceInternalId'], + 'lengths' => [Database::LENGTH_KEY], + 'orders' => [Database::ORDER_ASC], + ], [ '$id' => '_key_accessedAt', 'type' => Database::INDEX_KEY, @@ -1362,21 +1413,21 @@ return [ '$id' => '_key_type', 'type' => Database::INDEX_KEY, 'attributes' => ['type'], - 'lengths' => [32], + 'lengths' => [], 'orders' => [Database::ORDER_ASC], ], [ '$id' => '_key_trigger', 'type' => Database::INDEX_KEY, 'attributes' => ['trigger'], - 'lengths' => [32], + 'lengths' => [], 'orders' => [Database::ORDER_ASC], ], [ '$id' => '_key_deploymentResourceType', 'type' => Database::INDEX_KEY, 'attributes' => ['deploymentResourceType'], - 'lengths' => [32], + 'lengths' => [], 'orders' => [Database::ORDER_ASC], ], [ @@ -1418,23 +1469,23 @@ return [ '$id' => ID::custom('_key_owner'), 'type' => Database::INDEX_KEY, 'attributes' => ['owner'], - 'lengths' => [16], + 'lengths' => [], 'orders' => [Database::ORDER_ASC], ], [ - '$id' => ID::custom('_key_region'), - 'type' => Database::INDEX_KEY, - 'attributes' => ['region'], - 'lengths' => [16], - 'orders' => [Database::ORDER_ASC], - ], - [ - '$id' => ID::custom('_key_piid_riid_rt'), + '$id' => ID::custom('_key_piid_diid_drt'), 'type' => Database::INDEX_KEY, 'attributes' => ['projectInternalId', 'deploymentInternalId', 'deploymentResourceType'], 'lengths' => [], 'orders' => [], ], + [ + '$id' => '_key_region_status_createdAt', + 'type' => Database::INDEX_KEY, + 'attributes' => ['region', 'status', '$createdAt'], + 'lengths' => [], + 'orders' => [], + ], ], ], @@ -1903,3 +1954,31 @@ return [ 'indexes' => [] ], ]; + +// Organization API keys subquery +$platformCollections['teams']['attributes'][] = [ + '$id' => ID::custom('keys'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 16384, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => ['subQueryOrganizationKeys'], +]; + +// Account API keys subquery +$platformCollections['users']['attributes'][] = [ + '$id' => ID::custom('keys'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 16384, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => ['subQueryAccountKeys'], +]; + +return $platformCollections; diff --git a/app/config/collections/projects.php b/app/config/collections/projects.php index dae0337dc9..ecd3db1733 100644 --- a/app/config/collections/projects.php +++ b/app/config/collections/projects.php @@ -567,6 +567,17 @@ return [ 'array' => false, 'filters' => [], ], + [ + '$id' => ID::custom('deploymentRetention'), + 'type' => Database::VAR_INTEGER, + 'format' => '', + 'size' => 0, + 'signed' => true, + 'required' => false, + 'default' => 0, + 'array' => false, + 'filters' => [], + ], [ '$id' => ID::custom('deploymentInternalId'), 'type' => Database::VAR_STRING, @@ -765,6 +776,17 @@ return [ 'default' => null, 'filters' => [], ], + [ + 'array' => false, + '$id' => ID::custom('startCommand'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 20000, + 'signed' => true, + 'required' => false, + 'default' => null, + 'filters' => [], + ], [ 'array' => false, '$id' => ID::custom('specification'), @@ -776,6 +798,28 @@ return [ 'default' => APP_COMPUTE_SPECIFICATION_DEFAULT, 'filters' => [], ], + [ + 'array' => false, + '$id' => ID::custom('buildSpecification'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 128, + 'signed' => false, + 'required' => false, + 'default' => APP_COMPUTE_SPECIFICATION_DEFAULT, + 'filters' => [], + ], + [ + 'array' => false, + '$id' => ID::custom('runtimeSpecification'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 128, + 'signed' => false, + 'required' => false, + 'default' => APP_COMPUTE_SPECIFICATION_DEFAULT, + 'filters' => [], + ], [ '$id' => ID::custom('scopes'), 'type' => Database::VAR_STRING, @@ -1035,6 +1079,17 @@ return [ 'default' => null, 'filters' => [], ], + [ + 'array' => false, + '$id' => ID::custom('startCommand'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 20000, + 'signed' => true, + 'required' => false, + 'default' => null, + 'filters' => [], + ], [ '$id' => ID::custom('fallbackFile'), 'type' => Database::VAR_STRING, @@ -1046,6 +1101,17 @@ return [ 'array' => false, 'filters' => [], ], + [ + '$id' => ID::custom('deploymentRetention'), + 'type' => Database::VAR_INTEGER, + 'format' => '', + 'size' => 0, + 'signed' => true, + 'required' => false, + 'default' => 0, + 'array' => false, + 'filters' => [], + ], [ '$id' => ID::custom('deploymentInternalId'), 'type' => Database::VAR_STRING, @@ -1200,6 +1266,28 @@ return [ 'default' => APP_COMPUTE_SPECIFICATION_DEFAULT, 'filters' => [], ], + [ + 'array' => false, + '$id' => ID::custom('buildSpecification'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 128, + 'signed' => false, + 'required' => false, + 'default' => APP_COMPUTE_SPECIFICATION_DEFAULT, + 'filters' => [], + ], + [ + 'array' => false, + '$id' => ID::custom('runtimeSpecification'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 128, + 'signed' => false, + 'required' => false, + 'default' => APP_COMPUTE_SPECIFICATION_DEFAULT, + 'filters' => [], + ], [ '$id' => ID::custom('buildRuntime'), 'type' => Database::VAR_STRING, @@ -1357,6 +1445,17 @@ return [ 'default' => null, 'filters' => [], ], + [ + 'array' => false, + '$id' => ID::custom('startCommand'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 20000, + 'signed' => true, + 'required' => false, + 'default' => null, + 'filters' => [], + ], [ 'array' => false, '$id' => ID::custom('buildOutput'), @@ -2098,6 +2197,13 @@ return [ 'lengths' => [], 'orders' => [], ], + [ + '$id' => ID::custom('_key_resourceType'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['resourceType'], + 'lengths' => [], + 'orders' => [Database::ORDER_ASC], + ], ], ], diff --git a/app/config/errors.php b/app/config/errors.php index 6d747e4eb1..e01d9064bf 100644 --- a/app/config/errors.php +++ b/app/config/errors.php @@ -1103,7 +1103,6 @@ return [ 'name' => Exception::RULE_VERIFICATION_FAILED, 'description' => 'Domain verification failed. Please check if your DNS records are correct and try again.', 'code' => 400, - 'publish' => true ], Exception::PROJECT_SMTP_CONFIG_INVALID => [ 'name' => Exception::PROJECT_SMTP_CONFIG_INVALID, diff --git a/app/config/sdks.php b/app/config/sdks.php index 78209cc5dd..bada949903 100644 --- a/app/config/sdks.php +++ b/app/config/sdks.php @@ -60,7 +60,7 @@ return [ [ 'key' => 'flutter', 'name' => 'Flutter', - 'version' => '20.3.2', + 'version' => '20.3.3', 'url' => 'https://github.com/appwrite/sdk-for-flutter', 'package' => 'https://pub.dev/packages/appwrite', 'enabled' => true, @@ -116,6 +116,7 @@ return [ [ 'key' => 'android', 'name' => 'Android', + 'namespace' => 'io.appwrite', 'version' => '11.4.0', 'url' => 'https://github.com/appwrite/sdk-for-android', 'package' => 'https://search.maven.org/artifact/io.appwrite/sdk-for-android', @@ -226,7 +227,7 @@ return [ [ 'key' => 'cli', 'name' => 'Command Line', - 'version' => '12.0.1', + 'version' => '13.1.0', 'url' => 'https://github.com/appwrite/sdk-for-cli', 'package' => 'https://www.npmjs.com/package/appwrite-cli', 'enabled' => true, @@ -249,6 +250,26 @@ return [ ], ], ], + [ + 'key' => 'markdown', + 'name' => 'Markdown', + 'version' => '0.1.0', + 'url' => 'https://github.com/appwrite/sdk-for-md.git', + 'package' => 'https://www.npmjs.com/package/@appwrite.io/docs', + 'enabled' => true, + 'beta' => false, + 'dev' => false, + 'hidden' => false, + 'family' => APP_SDK_PLATFORM_CONSOLE, + 'prism' => 'markdown', + 'source' => \realpath(__DIR__ . '/../sdks/console-md'), + 'gitUrl' => 'git@github.com:appwrite/sdk-for-md.git', + 'gitRepoName' => 'sdk-for-md', + 'gitUserName' => 'appwrite', + 'gitBranch' => 'dev', + 'repoBranch' => 'main', + 'changelog' => \realpath(__DIR__ . '/../../docs/sdks/md/CHANGELOG.md'), + ], ], ], @@ -376,7 +397,7 @@ return [ [ 'key' => 'dart', 'name' => 'Dart', - 'version' => '20.1.0', + 'version' => '20.1.1', 'url' => 'https://github.com/appwrite/sdk-for-dart', 'package' => 'https://pub.dev/packages/dart_appwrite', 'enabled' => true, @@ -395,6 +416,7 @@ return [ [ 'key' => 'kotlin', 'name' => 'Kotlin', + 'namespace' => 'io.appwrite', 'version' => '13.1.0', 'url' => 'https://github.com/appwrite/sdk-for-kotlin', 'package' => 'https://search.maven.org/artifact/io.appwrite/sdk-for-kotlin', diff --git a/app/config/services.php b/app/config/services.php index 840ee294e9..5d503b0099 100644 --- a/app/config/services.php +++ b/app/config/services.php @@ -20,7 +20,7 @@ return [ 'name' => 'Console', 'subtitle' => '', 'description' => '', - 'controller' => 'web/console.php', + 'controller' => '', // Uses modules 'sdk' => false, 'docs' => false, 'docsUrl' => '', @@ -48,7 +48,7 @@ return [ 'name' => 'Avatars', 'subtitle' => 'The Avatars service aims to help you complete everyday tasks related to your app image, icons, and avatars.', 'description' => '/docs/services/avatars.md', - 'controller' => 'api/avatars.php', + 'controller' => '', // Uses modules 'sdk' => true, 'docs' => true, 'docsUrl' => 'https://appwrite.io/docs/client/avatars', @@ -104,7 +104,7 @@ return [ 'name' => 'Health', 'subtitle' => 'The Health service allows you to both validate and monitor your Appwrite server\'s health.', 'description' => '/docs/services/health.md', - 'controller' => 'api/health.php', + 'controller' => '', // Uses modules 'sdk' => true, 'docs' => true, 'docsUrl' => 'https://appwrite.io/docs/server/health', @@ -146,7 +146,7 @@ return [ 'name' => 'Storage', 'subtitle' => 'The Storage service allows you to manage your project files.', 'description' => '/docs/services/storage.md', - 'controller' => 'api/storage.php', + 'controller' => '', // Uses modules 'sdk' => true, 'docs' => true, 'docsUrl' => 'https://appwrite.io/docs/client/storage', @@ -270,9 +270,9 @@ return [ 'console' => [ 'key' => 'console', 'name' => 'Console', - 'subtitle' => 'The Console service allows you to interact with console relevant informations.', + 'subtitle' => 'The Console service allows you to interact with console relevant information.', 'description' => '', - 'controller' => 'api/console.php', + 'controller' => '', // Uses modules 'sdk' => true, 'docs' => true, 'docsUrl' => '', diff --git a/app/config/specs/open-api3-1.8.x-client.json b/app/config/specs/open-api3-1.8.x-client.json index 7724b1644a..44caa47679 100644 --- a/app/config/specs/open-api3-1.8.x-client.json +++ b/app/config/specs/open-api3-1.8.x-client.json @@ -1,7 +1,7 @@ { "openapi": "3.0.0", "info": { - "version": "1.8.0", + "version": "1.8.1", "title": "Appwrite", "description": "Appwrite backend as a service cuts up to 70% of the time and costs required for building a modern application. We abstract and simplify common development tasks behind a REST APIs, to help you develop your app in a fast and secure way. For full API documentation and tutorials go to [https:\/\/appwrite.io\/docs](https:\/\/appwrite.io\/docs)", "termsOfService": "https:\/\/appwrite.io\/policy\/terms", @@ -48,7 +48,7 @@ "x-appwrite": { "method": "get", "group": "account", - "weight": 10, + "weight": 9, "cookies": false, "type": "", "demo": "account\/get.md", @@ -99,7 +99,7 @@ "x-appwrite": { "method": "create", "group": "account", - "weight": 9, + "weight": 8, "cookies": false, "type": "", "demo": "account\/create.md", @@ -140,7 +140,8 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", @@ -188,7 +189,7 @@ "x-appwrite": { "method": "updateEmail", "group": "account", - "weight": 35, + "weight": 34, "cookies": false, "type": "", "demo": "account\/update-email.md", @@ -224,12 +225,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password. Must be at least 8 chars.", - "x-example": "password" + "x-example": "password", + "format": "password" } }, "required": [ @@ -266,7 +269,7 @@ "x-appwrite": { "method": "listIdentities", "group": "identities", - "weight": 48, + "weight": 47, "cookies": false, "type": "", "demo": "account\/list-identities.md", @@ -338,7 +341,7 @@ "x-appwrite": { "method": "deleteIdentity", "group": "identities", - "weight": 49, + "weight": 48, "cookies": false, "type": "", "demo": "account\/delete-identity.md", @@ -403,12 +406,12 @@ "x-appwrite": { "method": "createJWT", "group": "tokens", - "weight": 30, + "weight": 29, "cookies": false, "type": "", "demo": "account\/create-jwt.md", - "rate-limit": 100, - "rate-time": 3600, + "rate-limit": 120, + "rate-time": 60, "rate-key": "url:{url},userId:{userId}", "scope": "account", "platforms": [ @@ -429,7 +432,24 @@ "Session": [], "JWT": [] } - ] + ], + "requestBody": { + "content": { + "application\/json": { + "schema": { + "type": "object", + "properties": { + "duration": { + "type": "integer", + "description": "Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds.", + "x-example": 0, + "format": "int32" + } + } + } + } + } + } } }, "\/account\/logs": { @@ -456,7 +476,7 @@ "x-appwrite": { "method": "listLogs", "group": "logs", - "weight": 32, + "weight": 31, "cookies": false, "type": "", "demo": "account\/list-logs.md", @@ -535,7 +555,7 @@ "x-appwrite": { "method": "updateMFA", "group": "mfa", - "weight": 306, + "weight": 253, "cookies": false, "type": "", "demo": "account\/update-mfa.md", @@ -607,7 +627,7 @@ "x-appwrite": { "method": "createMfaAuthenticator", "group": "mfa", - "weight": 308, + "weight": 255, "cookies": false, "type": "", "demo": "account\/create-mfa-authenticator.md", @@ -731,7 +751,7 @@ "x-appwrite": { "method": "updateMfaAuthenticator", "group": "mfa", - "weight": 309, + "weight": 256, "cookies": false, "type": "", "demo": "account\/update-mfa-authenticator.md", @@ -871,7 +891,7 @@ "x-appwrite": { "method": "deleteMfaAuthenticator", "group": "mfa", - "weight": 310, + "weight": 257, "cookies": false, "type": "", "demo": "account\/delete-mfa-authenticator.md", @@ -995,7 +1015,7 @@ "x-appwrite": { "method": "createMfaChallenge", "group": "mfa", - "weight": 314, + "weight": 261, "cookies": false, "type": "", "demo": "account\/create-mfa-challenge.md", @@ -1129,7 +1149,7 @@ "x-appwrite": { "method": "updateMfaChallenge", "group": "mfa", - "weight": 315, + "weight": 262, "cookies": false, "type": "", "demo": "account\/update-mfa-challenge.md", @@ -1267,7 +1287,7 @@ "x-appwrite": { "method": "listMfaFactors", "group": "mfa", - "weight": 307, + "weight": 254, "cookies": false, "type": "", "demo": "account\/list-mfa-factors.md", @@ -1368,7 +1388,7 @@ "x-appwrite": { "method": "getMfaRecoveryCodes", "group": "mfa", - "weight": 313, + "weight": 260, "cookies": false, "type": "", "demo": "account\/get-mfa-recovery-codes.md", @@ -1467,7 +1487,7 @@ "x-appwrite": { "method": "createMfaRecoveryCodes", "group": "mfa", - "weight": 311, + "weight": 258, "cookies": false, "type": "", "demo": "account\/create-mfa-recovery-codes.md", @@ -1566,7 +1586,7 @@ "x-appwrite": { "method": "updateMfaRecoveryCodes", "group": "mfa", - "weight": 312, + "weight": 259, "cookies": false, "type": "", "demo": "account\/update-mfa-recovery-codes.md", @@ -1667,7 +1687,7 @@ "x-appwrite": { "method": "updateName", "group": "account", - "weight": 33, + "weight": 32, "cookies": false, "type": "", "demo": "account\/update-name.md", @@ -1739,7 +1759,7 @@ "x-appwrite": { "method": "updatePassword", "group": "account", - "weight": 34, + "weight": 33, "cookies": false, "type": "", "demo": "account\/update-password.md", @@ -1780,7 +1800,8 @@ "oldPassword": { "type": "string", "description": "Current user password. Must be at least 8 chars.", - "x-example": "password" + "x-example": "password", + "format": "password" } }, "required": [ @@ -1816,7 +1837,7 @@ "x-appwrite": { "method": "updatePhone", "group": "account", - "weight": 36, + "weight": 35, "cookies": false, "type": "", "demo": "account\/update-phone.md", @@ -1852,12 +1873,14 @@ "phone": { "type": "string", "description": "Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "password": { "type": "string", "description": "User password. Must be at least 8 chars.", - "x-example": "password" + "x-example": "password", + "format": "password" } }, "required": [ @@ -1894,7 +1917,7 @@ "x-appwrite": { "method": "getPrefs", "group": "account", - "weight": 31, + "weight": 30, "cookies": false, "type": "", "demo": "account\/get-prefs.md", @@ -1945,7 +1968,7 @@ "x-appwrite": { "method": "updatePrefs", "group": "account", - "weight": 37, + "weight": 36, "cookies": false, "type": "", "demo": "account\/update-prefs.md", @@ -2017,7 +2040,7 @@ "x-appwrite": { "method": "createRecovery", "group": "recovery", - "weight": 39, + "weight": 38, "cookies": false, "type": "", "demo": "account\/create-recovery.md", @@ -2056,12 +2079,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "url": { "type": "string", "description": "URL to redirect the user back to your app from the recovery email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.", - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" } }, "required": [ @@ -2096,7 +2121,7 @@ "x-appwrite": { "method": "updateRecovery", "group": "recovery", - "weight": 40, + "weight": 39, "cookies": false, "type": "", "demo": "account\/update-recovery.md", @@ -2180,7 +2205,7 @@ "x-appwrite": { "method": "listSessions", "group": "sessions", - "weight": 12, + "weight": 11, "cookies": false, "type": "", "demo": "account\/list-sessions.md", @@ -2224,7 +2249,7 @@ "x-appwrite": { "method": "deleteSessions", "group": "sessions", - "weight": 13, + "weight": 12, "cookies": false, "type": "", "demo": "account\/delete-sessions.md", @@ -2277,7 +2302,7 @@ "x-appwrite": { "method": "createAnonymousSession", "group": "sessions", - "weight": 18, + "weight": 17, "cookies": false, "type": "", "demo": "account\/create-anonymous-session.md", @@ -2330,7 +2355,7 @@ "x-appwrite": { "method": "createEmailPasswordSession", "group": "sessions", - "weight": 17, + "weight": 16, "cookies": false, "type": "", "demo": "account\/create-email-password-session.md", @@ -2366,12 +2391,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password. Must be at least 8 chars.", - "x-example": "password" + "x-example": "password", + "format": "password" } }, "required": [ @@ -2408,7 +2435,7 @@ "x-appwrite": { "method": "updateMagicURLSession", "group": "sessions", - "weight": 27, + "weight": 26, "cookies": false, "type": "", "demo": "account\/update-magic-url-session.md", @@ -2483,7 +2510,7 @@ "x-appwrite": { "method": "createOAuth2Session", "group": "sessions", - "weight": 20, + "weight": 19, "cookies": false, "type": "webAuth", "demo": "account\/create-o-auth-2-session.md", @@ -2557,8 +2584,7 @@ "yammer", "yandex", "zoho", - "zoom", - "mock" + "zoom" ], "x-enum-name": "OAuthProvider", "x-enum-keys": [] @@ -2629,7 +2655,7 @@ "x-appwrite": { "method": "updatePhoneSession", "group": "sessions", - "weight": 28, + "weight": 27, "cookies": false, "type": "", "demo": "account\/update-phone-session.md", @@ -2711,7 +2737,7 @@ "x-appwrite": { "method": "createSession", "group": "sessions", - "weight": 19, + "weight": 18, "cookies": false, "type": "", "demo": "account\/create-session.md", @@ -2789,7 +2815,7 @@ "x-appwrite": { "method": "getSession", "group": "sessions", - "weight": 14, + "weight": 13, "cookies": false, "type": "", "demo": "account\/get-session.md", @@ -2852,7 +2878,7 @@ "x-appwrite": { "method": "updateSession", "group": "sessions", - "weight": 16, + "weight": 15, "cookies": false, "type": "", "demo": "account\/update-session.md", @@ -2908,7 +2934,7 @@ "x-appwrite": { "method": "deleteSession", "group": "sessions", - "weight": 15, + "weight": 14, "cookies": false, "type": "", "demo": "account\/delete-session.md", @@ -2973,7 +2999,7 @@ "x-appwrite": { "method": "updateStatus", "group": "account", - "weight": 38, + "weight": 37, "cookies": false, "type": "", "demo": "account\/update-status.md", @@ -3026,7 +3052,7 @@ "x-appwrite": { "method": "createPushTarget", "group": "pushTargets", - "weight": 45, + "weight": 44, "cookies": false, "type": "", "demo": "account\/create-push-target.md", @@ -3107,7 +3133,7 @@ "x-appwrite": { "method": "updatePushTarget", "group": "pushTargets", - "weight": 46, + "weight": 45, "cookies": false, "type": "", "demo": "account\/update-push-target.md", @@ -3180,7 +3206,7 @@ "x-appwrite": { "method": "deletePushTarget", "group": "pushTargets", - "weight": 47, + "weight": 46, "cookies": false, "type": "", "demo": "account\/delete-push-target.md", @@ -3243,7 +3269,7 @@ "x-appwrite": { "method": "createEmailToken", "group": "tokens", - "weight": 26, + "weight": 25, "cookies": false, "type": "", "demo": "account\/create-email-token.md", @@ -3287,7 +3313,8 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "phrase": { "type": "boolean", @@ -3329,7 +3356,7 @@ "x-appwrite": { "method": "createMagicURLToken", "group": "tokens", - "weight": 25, + "weight": 24, "cookies": false, "type": "", "demo": "account\/create-magic-url-token.md", @@ -3373,12 +3400,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "url": { "type": "string", "description": "URL to redirect the user back to your app from the magic URL login. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.", - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" }, "phrase": { "type": "boolean", @@ -3413,7 +3442,7 @@ "x-appwrite": { "method": "createOAuth2Token", "group": "tokens", - "weight": 24, + "weight": 23, "cookies": false, "type": "webAuth", "demo": "account\/create-o-auth-2-token.md", @@ -3487,8 +3516,7 @@ "yammer", "yandex", "zoho", - "zoom", - "mock" + "zoom" ], "x-enum-name": "OAuthProvider", "x-enum-keys": [] @@ -3559,7 +3587,7 @@ "x-appwrite": { "method": "createPhoneToken", "group": "tokens", - "weight": 29, + "weight": 28, "cookies": false, "type": "", "demo": "account\/create-phone-token.md", @@ -3603,7 +3631,8 @@ "phone": { "type": "string", "description": "Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" } }, "required": [ @@ -3640,7 +3669,7 @@ "x-appwrite": { "method": "createEmailVerification", "group": "verification", - "weight": 41, + "weight": 40, "cookies": false, "type": "", "demo": "account\/create-email-verification.md", @@ -3728,7 +3757,8 @@ "url": { "type": "string", "description": "URL to redirect the user back to your app from the verification email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.", - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" } }, "required": [ @@ -3762,7 +3792,7 @@ "x-appwrite": { "method": "updateEmailVerification", "group": "verification", - "weight": 42, + "weight": 41, "cookies": false, "type": "", "demo": "account\/update-email-verification.md", @@ -3896,7 +3926,7 @@ "x-appwrite": { "method": "createPhoneVerification", "group": "verification", - "weight": 43, + "weight": 42, "cookies": false, "type": "", "demo": "account\/create-phone-verification.md", @@ -3950,7 +3980,7 @@ "x-appwrite": { "method": "updatePhoneVerification", "group": "verification", - "weight": 44, + "weight": 43, "cookies": false, "type": "", "demo": "account\/update-phone-verification.md", @@ -4021,7 +4051,7 @@ "x-appwrite": { "method": "getBrowser", "group": null, - "weight": 51, + "weight": 264, "cookies": false, "type": "location", "demo": "avatars\/get-browser.md", @@ -4149,7 +4179,7 @@ "x-appwrite": { "method": "getCreditCard", "group": null, - "weight": 50, + "weight": 263, "cookies": false, "type": "location", "demo": "avatars\/get-credit-card.md", @@ -4283,7 +4313,7 @@ "x-appwrite": { "method": "getFavicon", "group": null, - "weight": 54, + "weight": 267, "cookies": false, "type": "location", "demo": "avatars\/get-favicon.md", @@ -4343,7 +4373,7 @@ "x-appwrite": { "method": "getFlag", "group": null, - "weight": 52, + "weight": 265, "cookies": false, "type": "location", "demo": "avatars\/get-flag.md", @@ -4833,7 +4863,7 @@ "x-appwrite": { "method": "getImage", "group": null, - "weight": 53, + "weight": 266, "cookies": false, "type": "location", "demo": "avatars\/get-image.md", @@ -4917,7 +4947,7 @@ "x-appwrite": { "method": "getInitials", "group": null, - "weight": 56, + "weight": 269, "cookies": false, "type": "location", "demo": "avatars\/get-initials.md", @@ -5011,7 +5041,7 @@ "x-appwrite": { "method": "getQR", "group": null, - "weight": 55, + "weight": 268, "cookies": false, "type": "location", "demo": "avatars\/get-qr.md", @@ -5105,7 +5135,7 @@ "x-appwrite": { "method": "getScreenshot", "group": null, - "weight": 57, + "weight": 270, "cookies": false, "type": "location", "demo": "avatars\/get-screenshot.md", @@ -5825,7 +5855,7 @@ "avif", "gif" ], - "x-enum-name": null, + "x-enum-name": "ImageFormat", "x-enum-keys": [], "default": "" }, @@ -5858,7 +5888,7 @@ "x-appwrite": { "method": "listTransactions", "group": "transactions", - "weight": 380, + "weight": 338, "cookies": false, "type": "", "demo": "databases\/list-transactions.md", @@ -5925,7 +5955,7 @@ "x-appwrite": { "method": "createTransaction", "group": "transactions", - "weight": 376, + "weight": 334, "cookies": false, "type": "", "demo": "databases\/create-transaction.md", @@ -5962,7 +5992,8 @@ "ttl": { "type": "integer", "description": "Seconds before the transaction expires.", - "x-example": 60 + "x-example": 60, + "format": "int32" } } } @@ -5995,7 +6026,7 @@ "x-appwrite": { "method": "getTransaction", "group": "transactions", - "weight": 377, + "weight": 335, "cookies": false, "type": "", "demo": "databases\/get-transaction.md", @@ -6059,7 +6090,7 @@ "x-appwrite": { "method": "updateTransaction", "group": "transactions", - "weight": 378, + "weight": 336, "cookies": false, "type": "", "demo": "databases\/update-transaction.md", @@ -6137,7 +6168,7 @@ "x-appwrite": { "method": "deleteTransaction", "group": "transactions", - "weight": 379, + "weight": 337, "cookies": false, "type": "", "demo": "databases\/delete-transaction.md", @@ -6203,7 +6234,7 @@ "x-appwrite": { "method": "createOperations", "group": "transactions", - "weight": 381, + "weight": 339, "cookies": false, "type": "", "demo": "databases\/create-operations.md", @@ -6288,7 +6319,7 @@ "x-appwrite": { "method": "listDocuments", "group": "documents", - "weight": 339, + "weight": 297, "cookies": false, "type": "", "demo": "databases\/list-documents.md", @@ -6400,7 +6431,7 @@ "x-appwrite": { "method": "createDocument", "group": "documents", - "weight": 331, + "weight": 289, "cookies": false, "type": "", "demo": "databases\/create-document.md", @@ -6561,7 +6592,7 @@ "x-appwrite": { "method": "getDocument", "group": "documents", - "weight": 332, + "weight": 290, "cookies": false, "type": "", "demo": "databases\/get-document.md", @@ -6672,7 +6703,7 @@ "x-appwrite": { "method": "upsertDocument", "group": "documents", - "weight": 335, + "weight": 293, "cookies": false, "type": "", "demo": "databases\/upsert-document.md", @@ -6827,7 +6858,7 @@ "x-appwrite": { "method": "updateDocument", "group": "documents", - "weight": 333, + "weight": 291, "cookies": false, "type": "", "demo": "databases\/update-document.md", @@ -6939,7 +6970,7 @@ "x-appwrite": { "method": "deleteDocument", "group": "documents", - "weight": 337, + "weight": 295, "cookies": false, "type": "", "demo": "databases\/delete-document.md", @@ -7046,7 +7077,7 @@ "x-appwrite": { "method": "decrementDocumentAttribute", "group": "documents", - "weight": 342, + "weight": 300, "cookies": false, "type": "", "demo": "databases\/decrement-document-attribute.md", @@ -7128,12 +7159,14 @@ "value": { "type": "number", "description": "Value to increment the attribute by. The value must be a number.", - "x-example": null + "x-example": null, + "format": "float" }, "min": { "type": "number", "description": "Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown.", "x-example": null, + "format": "float", "x-nullable": true }, "transactionId": { @@ -7173,7 +7206,7 @@ "x-appwrite": { "method": "incrementDocumentAttribute", "group": "documents", - "weight": 341, + "weight": 299, "cookies": false, "type": "", "demo": "databases\/increment-document-attribute.md", @@ -7255,12 +7288,14 @@ "value": { "type": "number", "description": "Value to increment the attribute by. The value must be a number.", - "x-example": null + "x-example": null, + "format": "float" }, "max": { "type": "number", "description": "Maximum value for the attribute. If the current value is greater than this value, an error will be thrown.", "x-example": null, + "format": "float", "x-nullable": true }, "transactionId": { @@ -7300,7 +7335,7 @@ "x-appwrite": { "method": "listExecutions", "group": "executions", - "weight": 472, + "weight": 431, "cookies": false, "type": "", "demo": "functions\/list-executions.md", @@ -7387,7 +7422,7 @@ "x-appwrite": { "method": "createExecution", "group": "executions", - "weight": 470, + "weight": 429, "cookies": false, "type": "", "demo": "functions\/create-execution.md", @@ -7505,7 +7540,7 @@ "x-appwrite": { "method": "getExecution", "group": "executions", - "weight": 471, + "weight": 430, "cookies": false, "type": "", "demo": "functions\/get-execution.md", @@ -7580,7 +7615,7 @@ "x-appwrite": { "method": "query", "group": "graphql", - "weight": 241, + "weight": 190, "cookies": false, "type": "graphql", "demo": "graphql\/query.md", @@ -7634,7 +7669,7 @@ "x-appwrite": { "method": "mutation", "group": "graphql", - "weight": 240, + "weight": 189, "cookies": false, "type": "graphql", "demo": "graphql\/mutation.md", @@ -7688,7 +7723,7 @@ "x-appwrite": { "method": "get", "group": null, - "weight": 61, + "weight": 49, "cookies": false, "type": "", "demo": "locale\/get.md", @@ -7742,7 +7777,7 @@ "x-appwrite": { "method": "listCodes", "group": null, - "weight": 62, + "weight": 50, "cookies": false, "type": "", "demo": "locale\/list-codes.md", @@ -7796,7 +7831,7 @@ "x-appwrite": { "method": "listContinents", "group": null, - "weight": 66, + "weight": 54, "cookies": false, "type": "", "demo": "locale\/list-continents.md", @@ -7850,7 +7885,7 @@ "x-appwrite": { "method": "listCountries", "group": null, - "weight": 63, + "weight": 51, "cookies": false, "type": "", "demo": "locale\/list-countries.md", @@ -7904,7 +7939,7 @@ "x-appwrite": { "method": "listCountriesEU", "group": null, - "weight": 64, + "weight": 52, "cookies": false, "type": "", "demo": "locale\/list-countries-eu.md", @@ -7958,7 +7993,7 @@ "x-appwrite": { "method": "listCountriesPhones", "group": null, - "weight": 65, + "weight": 53, "cookies": false, "type": "", "demo": "locale\/list-countries-phones.md", @@ -8012,7 +8047,7 @@ "x-appwrite": { "method": "listCurrencies", "group": null, - "weight": 67, + "weight": 55, "cookies": false, "type": "", "demo": "locale\/list-currencies.md", @@ -8066,7 +8101,7 @@ "x-appwrite": { "method": "listLanguages", "group": null, - "weight": 68, + "weight": 56, "cookies": false, "type": "", "demo": "locale\/list-languages.md", @@ -8120,7 +8155,7 @@ "x-appwrite": { "method": "createSubscriber", "group": "subscribers", - "weight": 290, + "weight": 237, "cookies": false, "type": "", "demo": "messaging\/create-subscriber.md", @@ -8204,7 +8239,7 @@ "x-appwrite": { "method": "deleteSubscriber", "group": "subscribers", - "weight": 294, + "weight": 241, "cookies": false, "type": "", "demo": "messaging\/delete-subscriber.md", @@ -8280,7 +8315,7 @@ "x-appwrite": { "method": "listFiles", "group": "files", - "weight": 151, + "weight": 527, "cookies": false, "type": "", "demo": "storage\/list-files.md", @@ -8379,7 +8414,7 @@ "x-appwrite": { "method": "createFile", "group": "files", - "weight": 150, + "weight": 525, "cookies": false, "type": "upload", "demo": "storage\/create-file.md", @@ -8434,7 +8469,8 @@ "file": { "type": "string", "description": "Binary file. Appwrite SDKs provide helpers to handle file input. [Learn about file input](https:\/\/appwrite.io\/docs\/products\/storage\/upload-download#input-file).", - "x-example": null + "x-example": null, + "format": "binary" }, "permissions": { "type": "array", @@ -8480,7 +8516,7 @@ "x-appwrite": { "method": "getFile", "group": "files", - "weight": 152, + "weight": 526, "cookies": false, "type": "", "demo": "storage\/get-file.md", @@ -8554,13 +8590,13 @@ "x-appwrite": { "method": "updateFile", "group": "files", - "weight": 157, + "weight": 528, "cookies": false, "type": "", "demo": "storage\/update-file.md", - "rate-limit": 60, - "rate-time": 60, - "rate-key": "ip:{ip},method:{method},url:{url},userId:{userId}", + "rate-limit": 0, + "rate-time": 3600, + "rate-key": "url:{url},ip:{ip}", "scope": "files.write", "platforms": [ "console", @@ -8585,7 +8621,7 @@ "parameters": [ { "name": "bucketId", - "description": "Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https:\/\/appwrite.io\/docs\/server\/storage#createBucket).", + "description": "Bucket unique ID.", "required": true, "schema": { "type": "string", @@ -8595,7 +8631,7 @@ }, { "name": "fileId", - "description": "File unique ID.", + "description": "File ID.", "required": true, "schema": { "type": "string", @@ -8612,13 +8648,12 @@ "properties": { "name": { "type": "string", - "description": "Name of the file", - "x-example": "", - "x-nullable": true + "description": "File name.", + "x-example": "" }, "permissions": { "type": "array", - "description": "An array of permission string. By default, the current permissions are inherited. [Learn more about permissions](https:\/\/appwrite.io\/docs\/permissions).", + "description": "An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https:\/\/appwrite.io\/docs\/permissions).", "x-example": "[\"read(\"any\")\"]", "items": { "type": "string" @@ -8647,7 +8682,7 @@ "x-appwrite": { "method": "deleteFile", "group": "files", - "weight": 158, + "weight": 529, "cookies": false, "type": "", "demo": "storage\/delete-file.md", @@ -8716,7 +8751,7 @@ "x-appwrite": { "method": "getFileDownload", "group": "files", - "weight": 154, + "weight": 531, "cookies": false, "type": "location", "demo": "storage\/get-file-download.md", @@ -8796,7 +8831,7 @@ "x-appwrite": { "method": "getFilePreview", "group": "files", - "weight": 153, + "weight": 530, "cookies": false, "type": "location", "demo": "storage\/get-file-preview.md", @@ -9026,7 +9061,7 @@ "x-appwrite": { "method": "getFileView", "group": "files", - "weight": 155, + "weight": 532, "cookies": false, "type": "location", "demo": "storage\/get-file-view.md", @@ -9113,7 +9148,7 @@ "x-appwrite": { "method": "listTransactions", "group": "transactions", - "weight": 445, + "weight": 403, "cookies": false, "type": "", "demo": "tablesdb\/list-transactions.md", @@ -9183,7 +9218,7 @@ "x-appwrite": { "method": "createTransaction", "group": "transactions", - "weight": 441, + "weight": 399, "cookies": false, "type": "", "demo": "tablesdb\/create-transaction.md", @@ -9223,7 +9258,8 @@ "ttl": { "type": "integer", "description": "Seconds before the transaction expires.", - "x-example": 60 + "x-example": 60, + "format": "int32" } } } @@ -9256,7 +9292,7 @@ "x-appwrite": { "method": "getTransaction", "group": "transactions", - "weight": 442, + "weight": 400, "cookies": false, "type": "", "demo": "tablesdb\/get-transaction.md", @@ -9323,7 +9359,7 @@ "x-appwrite": { "method": "updateTransaction", "group": "transactions", - "weight": 443, + "weight": 401, "cookies": false, "type": "", "demo": "tablesdb\/update-transaction.md", @@ -9404,7 +9440,7 @@ "x-appwrite": { "method": "deleteTransaction", "group": "transactions", - "weight": 444, + "weight": 402, "cookies": false, "type": "", "demo": "tablesdb\/delete-transaction.md", @@ -9473,7 +9509,7 @@ "x-appwrite": { "method": "createOperations", "group": "transactions", - "weight": 446, + "weight": 404, "cookies": false, "type": "", "demo": "tablesdb\/create-operations.md", @@ -9561,7 +9597,7 @@ "x-appwrite": { "method": "listRows", "group": "rows", - "weight": 437, + "weight": 395, "cookies": false, "type": "", "demo": "tablesdb\/list-rows.md", @@ -9672,7 +9708,7 @@ "x-appwrite": { "method": "createRow", "group": "rows", - "weight": 429, + "weight": 387, "cookies": false, "type": "", "demo": "tablesdb\/create-row.md", @@ -9828,7 +9864,7 @@ "x-appwrite": { "method": "getRow", "group": "rows", - "weight": 430, + "weight": 388, "cookies": false, "type": "", "demo": "tablesdb\/get-row.md", @@ -9938,7 +9974,7 @@ "x-appwrite": { "method": "upsertRow", "group": "rows", - "weight": 433, + "weight": 391, "cookies": false, "type": "", "demo": "tablesdb\/upsert-row.md", @@ -10088,7 +10124,7 @@ "x-appwrite": { "method": "updateRow", "group": "rows", - "weight": 431, + "weight": 389, "cookies": false, "type": "", "demo": "tablesdb\/update-row.md", @@ -10199,7 +10235,7 @@ "x-appwrite": { "method": "deleteRow", "group": "rows", - "weight": 435, + "weight": 393, "cookies": false, "type": "", "demo": "tablesdb\/delete-row.md", @@ -10305,7 +10341,7 @@ "x-appwrite": { "method": "decrementRowColumn", "group": "rows", - "weight": 440, + "weight": 398, "cookies": false, "type": "", "demo": "tablesdb\/decrement-row-column.md", @@ -10386,12 +10422,14 @@ "value": { "type": "number", "description": "Value to increment the column by. The value must be a number.", - "x-example": null + "x-example": null, + "format": "float" }, "min": { "type": "number", "description": "Minimum value for the column. If the current value is lesser than this value, an exception will be thrown.", "x-example": null, + "format": "float", "x-nullable": true }, "transactionId": { @@ -10431,7 +10469,7 @@ "x-appwrite": { "method": "incrementRowColumn", "group": "rows", - "weight": 439, + "weight": 397, "cookies": false, "type": "", "demo": "tablesdb\/increment-row-column.md", @@ -10512,12 +10550,14 @@ "value": { "type": "number", "description": "Value to increment the column by. The value must be a number.", - "x-example": null + "x-example": null, + "format": "float" }, "max": { "type": "number", "description": "Maximum value for the column. If the current value is greater than this value, an error will be thrown.", "x-example": null, + "format": "float", "x-nullable": true }, "transactionId": { @@ -10557,7 +10597,7 @@ "x-appwrite": { "method": "list", "group": "teams", - "weight": 162, + "weight": 110, "cookies": false, "type": "", "demo": "teams\/list.md", @@ -10646,7 +10686,7 @@ "x-appwrite": { "method": "create", "group": "teams", - "weight": 161, + "weight": 109, "cookies": false, "type": "", "demo": "teams\/create.md", @@ -10733,7 +10773,7 @@ "x-appwrite": { "method": "get", "group": "teams", - "weight": 163, + "weight": 111, "cookies": false, "type": "", "demo": "teams\/get.md", @@ -10797,7 +10837,7 @@ "x-appwrite": { "method": "updateName", "group": "teams", - "weight": 165, + "weight": 113, "cookies": false, "type": "", "demo": "teams\/update-name.md", @@ -10873,7 +10913,7 @@ "x-appwrite": { "method": "delete", "group": "teams", - "weight": 167, + "weight": 115, "cookies": false, "type": "", "demo": "teams\/delete.md", @@ -10939,7 +10979,7 @@ "x-appwrite": { "method": "listMemberships", "group": "memberships", - "weight": 169, + "weight": 117, "cookies": false, "type": "", "demo": "teams\/list-memberships.md", @@ -11038,7 +11078,7 @@ "x-appwrite": { "method": "createMembership", "group": "memberships", - "weight": 168, + "weight": 116, "cookies": false, "type": "", "demo": "teams\/create-membership.md", @@ -11087,7 +11127,8 @@ "email": { "type": "string", "description": "Email of the new team member.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "userId": { "type": "string", @@ -11097,7 +11138,8 @@ "phone": { "type": "string", "description": "Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "roles": { "type": "array", @@ -11117,7 +11159,8 @@ "url": { "type": "string", "description": "URL to redirect the user back to your app from the invitation email. This parameter is not required when an API key is supplied. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.", - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" }, "name": { "type": "string", @@ -11158,7 +11201,7 @@ "x-appwrite": { "method": "getMembership", "group": "memberships", - "weight": 170, + "weight": 118, "cookies": false, "type": "", "demo": "teams\/get-membership.md", @@ -11232,7 +11275,7 @@ "x-appwrite": { "method": "updateMembership", "group": "memberships", - "weight": 171, + "weight": 119, "cookies": false, "type": "", "demo": "teams\/update-membership.md", @@ -11328,7 +11371,7 @@ "x-appwrite": { "method": "deleteMembership", "group": "memberships", - "weight": 173, + "weight": 121, "cookies": false, "type": "", "demo": "teams\/delete-membership.md", @@ -11404,7 +11447,7 @@ "x-appwrite": { "method": "updateMembershipStatus", "group": "memberships", - "weight": 172, + "weight": 120, "cookies": false, "type": "", "demo": "teams\/update-membership-status.md", @@ -11504,7 +11547,7 @@ "x-appwrite": { "method": "getPrefs", "group": "teams", - "weight": 164, + "weight": 112, "cookies": false, "type": "", "demo": "teams\/get-prefs.md", @@ -11567,7 +11610,7 @@ "x-appwrite": { "method": "updatePrefs", "group": "teams", - "weight": 166, + "weight": 114, "cookies": false, "type": "", "demo": "teams\/update-prefs.md", @@ -11691,7 +11734,7 @@ }, { "name": "console", - "description": "The Console service allows you to interact with console relevant informations." + "description": "The Console service allows you to interact with console relevant information." }, { "name": "migrations", @@ -13411,6 +13454,16 @@ "description": "Total number of chunks uploaded", "x-example": 17890, "format": "int32" + }, + "encryption": { + "type": "boolean", + "description": "Whether file contents are encrypted at rest.", + "x-example": true + }, + "compression": { + "type": "string", + "description": "Compression algorithm used for the file. Will be one of none, [gzip](https:\/\/en.wikipedia.org\/wiki\/Gzip), or [zstd](https:\/\/en.wikipedia.org\/wiki\/Zstd).", + "x-example": "gzip" } }, "required": [ @@ -13424,7 +13477,9 @@ "mimeType", "sizeOriginal", "chunksTotal", - "chunksUploaded" + "chunksUploaded", + "encryption", + "compression" ], "example": { "$id": "5e5ea5c16897e", @@ -13439,7 +13494,9 @@ "mimeType": "image\/png", "sizeOriginal": 17890, "chunksTotal": 17890, - "chunksUploaded": 17890 + "chunksUploaded": 17890, + "encryption": true, + "compression": "gzip" } }, "team": { diff --git a/app/config/specs/open-api3-1.8.x-console.json b/app/config/specs/open-api3-1.8.x-console.json index 2819a6c9a6..d83d7c20ba 100644 --- a/app/config/specs/open-api3-1.8.x-console.json +++ b/app/config/specs/open-api3-1.8.x-console.json @@ -1,7 +1,7 @@ { "openapi": "3.0.0", "info": { - "version": "1.8.0", + "version": "1.8.1", "title": "Appwrite", "description": "Appwrite backend as a service cuts up to 70% of the time and costs required for building a modern application. We abstract and simplify common development tasks behind a REST APIs, to help you develop your app in a fast and secure way. For full API documentation and tutorials go to [https:\/\/appwrite.io\/docs](https:\/\/appwrite.io\/docs)", "termsOfService": "https:\/\/appwrite.io\/policy\/terms", @@ -48,7 +48,7 @@ "x-appwrite": { "method": "get", "group": "account", - "weight": 10, + "weight": 9, "cookies": false, "type": "", "demo": "account\/get.md", @@ -98,7 +98,7 @@ "x-appwrite": { "method": "create", "group": "account", - "weight": 9, + "weight": 8, "cookies": false, "type": "", "demo": "account\/create.md", @@ -138,7 +138,8 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", @@ -177,7 +178,7 @@ "x-appwrite": { "method": "delete", "group": "account", - "weight": 11, + "weight": 10, "cookies": false, "type": "", "demo": "account\/delete.md", @@ -226,7 +227,7 @@ "x-appwrite": { "method": "updateEmail", "group": "account", - "weight": 35, + "weight": 34, "cookies": false, "type": "", "demo": "account\/update-email.md", @@ -261,12 +262,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password. Must be at least 8 chars.", - "x-example": "password" + "x-example": "password", + "format": "password" } }, "required": [ @@ -303,7 +306,7 @@ "x-appwrite": { "method": "listIdentities", "group": "identities", - "weight": 48, + "weight": 47, "cookies": false, "type": "", "demo": "account\/list-identities.md", @@ -374,7 +377,7 @@ "x-appwrite": { "method": "deleteIdentity", "group": "identities", - "weight": 49, + "weight": 48, "cookies": false, "type": "", "demo": "account\/delete-identity.md", @@ -438,12 +441,12 @@ "x-appwrite": { "method": "createJWT", "group": "tokens", - "weight": 30, + "weight": 29, "cookies": false, "type": "", "demo": "account\/create-jwt.md", - "rate-limit": 100, - "rate-time": 3600, + "rate-limit": 120, + "rate-time": 60, "rate-key": "url:{url},userId:{userId}", "scope": "account", "platforms": [ @@ -463,7 +466,24 @@ "Project": [], "JWT": [] } - ] + ], + "requestBody": { + "content": { + "application\/json": { + "schema": { + "type": "object", + "properties": { + "duration": { + "type": "integer", + "description": "Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds.", + "x-example": 0, + "format": "int32" + } + } + } + } + } + } } }, "\/account\/logs": { @@ -490,7 +510,7 @@ "x-appwrite": { "method": "listLogs", "group": "logs", - "weight": 32, + "weight": 31, "cookies": false, "type": "", "demo": "account\/list-logs.md", @@ -568,7 +588,7 @@ "x-appwrite": { "method": "updateMFA", "group": "mfa", - "weight": 306, + "weight": 253, "cookies": false, "type": "", "demo": "account\/update-mfa.md", @@ -639,7 +659,7 @@ "x-appwrite": { "method": "createMfaAuthenticator", "group": "mfa", - "weight": 308, + "weight": 255, "cookies": false, "type": "", "demo": "account\/create-mfa-authenticator.md", @@ -762,7 +782,7 @@ "x-appwrite": { "method": "updateMfaAuthenticator", "group": "mfa", - "weight": 309, + "weight": 256, "cookies": false, "type": "", "demo": "account\/update-mfa-authenticator.md", @@ -901,7 +921,7 @@ "x-appwrite": { "method": "deleteMfaAuthenticator", "group": "mfa", - "weight": 310, + "weight": 257, "cookies": false, "type": "", "demo": "account\/delete-mfa-authenticator.md", @@ -1024,7 +1044,7 @@ "x-appwrite": { "method": "createMfaChallenge", "group": "mfa", - "weight": 314, + "weight": 261, "cookies": false, "type": "", "demo": "account\/create-mfa-challenge.md", @@ -1157,7 +1177,7 @@ "x-appwrite": { "method": "updateMfaChallenge", "group": "mfa", - "weight": 315, + "weight": 262, "cookies": false, "type": "", "demo": "account\/update-mfa-challenge.md", @@ -1294,7 +1314,7 @@ "x-appwrite": { "method": "listMfaFactors", "group": "mfa", - "weight": 307, + "weight": 254, "cookies": false, "type": "", "demo": "account\/list-mfa-factors.md", @@ -1394,7 +1414,7 @@ "x-appwrite": { "method": "getMfaRecoveryCodes", "group": "mfa", - "weight": 313, + "weight": 260, "cookies": false, "type": "", "demo": "account\/get-mfa-recovery-codes.md", @@ -1492,7 +1512,7 @@ "x-appwrite": { "method": "createMfaRecoveryCodes", "group": "mfa", - "weight": 311, + "weight": 258, "cookies": false, "type": "", "demo": "account\/create-mfa-recovery-codes.md", @@ -1590,7 +1610,7 @@ "x-appwrite": { "method": "updateMfaRecoveryCodes", "group": "mfa", - "weight": 312, + "weight": 259, "cookies": false, "type": "", "demo": "account\/update-mfa-recovery-codes.md", @@ -1690,7 +1710,7 @@ "x-appwrite": { "method": "updateName", "group": "account", - "weight": 33, + "weight": 32, "cookies": false, "type": "", "demo": "account\/update-name.md", @@ -1761,7 +1781,7 @@ "x-appwrite": { "method": "updatePassword", "group": "account", - "weight": 34, + "weight": 33, "cookies": false, "type": "", "demo": "account\/update-password.md", @@ -1801,7 +1821,8 @@ "oldPassword": { "type": "string", "description": "Current user password. Must be at least 8 chars.", - "x-example": "password" + "x-example": "password", + "format": "password" } }, "required": [ @@ -1837,7 +1858,7 @@ "x-appwrite": { "method": "updatePhone", "group": "account", - "weight": 36, + "weight": 35, "cookies": false, "type": "", "demo": "account\/update-phone.md", @@ -1872,12 +1893,14 @@ "phone": { "type": "string", "description": "Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "password": { "type": "string", "description": "User password. Must be at least 8 chars.", - "x-example": "password" + "x-example": "password", + "format": "password" } }, "required": [ @@ -1914,7 +1937,7 @@ "x-appwrite": { "method": "getPrefs", "group": "account", - "weight": 31, + "weight": 30, "cookies": false, "type": "", "demo": "account\/get-prefs.md", @@ -1964,7 +1987,7 @@ "x-appwrite": { "method": "updatePrefs", "group": "account", - "weight": 37, + "weight": 36, "cookies": false, "type": "", "demo": "account\/update-prefs.md", @@ -2035,7 +2058,7 @@ "x-appwrite": { "method": "createRecovery", "group": "recovery", - "weight": 39, + "weight": 38, "cookies": false, "type": "", "demo": "account\/create-recovery.md", @@ -2073,12 +2096,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "url": { "type": "string", "description": "URL to redirect the user back to your app from the recovery email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.", - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" } }, "required": [ @@ -2113,7 +2138,7 @@ "x-appwrite": { "method": "updateRecovery", "group": "recovery", - "weight": 40, + "weight": 39, "cookies": false, "type": "", "demo": "account\/update-recovery.md", @@ -2196,7 +2221,7 @@ "x-appwrite": { "method": "listSessions", "group": "sessions", - "weight": 12, + "weight": 11, "cookies": false, "type": "", "demo": "account\/list-sessions.md", @@ -2239,7 +2264,7 @@ "x-appwrite": { "method": "deleteSessions", "group": "sessions", - "weight": 13, + "weight": 12, "cookies": false, "type": "", "demo": "account\/delete-sessions.md", @@ -2291,7 +2316,7 @@ "x-appwrite": { "method": "createAnonymousSession", "group": "sessions", - "weight": 18, + "weight": 17, "cookies": false, "type": "", "demo": "account\/create-anonymous-session.md", @@ -2343,7 +2368,7 @@ "x-appwrite": { "method": "createEmailPasswordSession", "group": "sessions", - "weight": 17, + "weight": 16, "cookies": false, "type": "", "demo": "account\/create-email-password-session.md", @@ -2378,12 +2403,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password. Must be at least 8 chars.", - "x-example": "password" + "x-example": "password", + "format": "password" } }, "required": [ @@ -2420,7 +2447,7 @@ "x-appwrite": { "method": "updateMagicURLSession", "group": "sessions", - "weight": 27, + "weight": 26, "cookies": false, "type": "", "demo": "account\/update-magic-url-session.md", @@ -2494,7 +2521,7 @@ "x-appwrite": { "method": "createOAuth2Session", "group": "sessions", - "weight": 20, + "weight": 19, "cookies": false, "type": "webAuth", "demo": "account\/create-o-auth-2-session.md", @@ -2567,8 +2594,7 @@ "yammer", "yandex", "zoho", - "zoom", - "mock" + "zoom" ], "x-enum-name": "OAuthProvider", "x-enum-keys": [] @@ -2639,7 +2665,7 @@ "x-appwrite": { "method": "updatePhoneSession", "group": "sessions", - "weight": 28, + "weight": 27, "cookies": false, "type": "", "demo": "account\/update-phone-session.md", @@ -2720,7 +2746,7 @@ "x-appwrite": { "method": "createSession", "group": "sessions", - "weight": 19, + "weight": 18, "cookies": false, "type": "", "demo": "account\/create-session.md", @@ -2797,7 +2823,7 @@ "x-appwrite": { "method": "getSession", "group": "sessions", - "weight": 14, + "weight": 13, "cookies": false, "type": "", "demo": "account\/get-session.md", @@ -2859,7 +2885,7 @@ "x-appwrite": { "method": "updateSession", "group": "sessions", - "weight": 16, + "weight": 15, "cookies": false, "type": "", "demo": "account\/update-session.md", @@ -2914,7 +2940,7 @@ "x-appwrite": { "method": "deleteSession", "group": "sessions", - "weight": 15, + "weight": 14, "cookies": false, "type": "", "demo": "account\/delete-session.md", @@ -2978,7 +3004,7 @@ "x-appwrite": { "method": "updateStatus", "group": "account", - "weight": 38, + "weight": 37, "cookies": false, "type": "", "demo": "account\/update-status.md", @@ -3030,7 +3056,7 @@ "x-appwrite": { "method": "createPushTarget", "group": "pushTargets", - "weight": 45, + "weight": 44, "cookies": false, "type": "", "demo": "account\/create-push-target.md", @@ -3110,7 +3136,7 @@ "x-appwrite": { "method": "updatePushTarget", "group": "pushTargets", - "weight": 46, + "weight": 45, "cookies": false, "type": "", "demo": "account\/update-push-target.md", @@ -3182,7 +3208,7 @@ "x-appwrite": { "method": "deletePushTarget", "group": "pushTargets", - "weight": 47, + "weight": 46, "cookies": false, "type": "", "demo": "account\/delete-push-target.md", @@ -3244,7 +3270,7 @@ "x-appwrite": { "method": "createEmailToken", "group": "tokens", - "weight": 26, + "weight": 25, "cookies": false, "type": "", "demo": "account\/create-email-token.md", @@ -3287,7 +3313,8 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "phrase": { "type": "boolean", @@ -3329,7 +3356,7 @@ "x-appwrite": { "method": "createMagicURLToken", "group": "tokens", - "weight": 25, + "weight": 24, "cookies": false, "type": "", "demo": "account\/create-magic-url-token.md", @@ -3372,12 +3399,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "url": { "type": "string", "description": "URL to redirect the user back to your app from the magic URL login. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.", - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" }, "phrase": { "type": "boolean", @@ -3412,7 +3441,7 @@ "x-appwrite": { "method": "createOAuth2Token", "group": "tokens", - "weight": 24, + "weight": 23, "cookies": false, "type": "webAuth", "demo": "account\/create-o-auth-2-token.md", @@ -3485,8 +3514,7 @@ "yammer", "yandex", "zoho", - "zoom", - "mock" + "zoom" ], "x-enum-name": "OAuthProvider", "x-enum-keys": [] @@ -3557,7 +3585,7 @@ "x-appwrite": { "method": "createPhoneToken", "group": "tokens", - "weight": 29, + "weight": 28, "cookies": false, "type": "", "demo": "account\/create-phone-token.md", @@ -3600,7 +3628,8 @@ "phone": { "type": "string", "description": "Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" } }, "required": [ @@ -3637,7 +3666,7 @@ "x-appwrite": { "method": "createEmailVerification", "group": "verification", - "weight": 41, + "weight": 40, "cookies": false, "type": "", "demo": "account\/create-email-verification.md", @@ -3724,7 +3753,8 @@ "url": { "type": "string", "description": "URL to redirect the user back to your app from the verification email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.", - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" } }, "required": [ @@ -3758,7 +3788,7 @@ "x-appwrite": { "method": "updateEmailVerification", "group": "verification", - "weight": 42, + "weight": 41, "cookies": false, "type": "", "demo": "account\/update-email-verification.md", @@ -3891,7 +3921,7 @@ "x-appwrite": { "method": "createPhoneVerification", "group": "verification", - "weight": 43, + "weight": 42, "cookies": false, "type": "", "demo": "account\/create-phone-verification.md", @@ -3944,7 +3974,7 @@ "x-appwrite": { "method": "updatePhoneVerification", "group": "verification", - "weight": 44, + "weight": 43, "cookies": false, "type": "", "demo": "account\/update-phone-verification.md", @@ -4014,7 +4044,7 @@ "x-appwrite": { "method": "getBrowser", "group": null, - "weight": 51, + "weight": 264, "cookies": false, "type": "location", "demo": "avatars\/get-browser.md", @@ -4142,7 +4172,7 @@ "x-appwrite": { "method": "getCreditCard", "group": null, - "weight": 50, + "weight": 263, "cookies": false, "type": "location", "demo": "avatars\/get-credit-card.md", @@ -4276,7 +4306,7 @@ "x-appwrite": { "method": "getFavicon", "group": null, - "weight": 54, + "weight": 267, "cookies": false, "type": "location", "demo": "avatars\/get-favicon.md", @@ -4336,7 +4366,7 @@ "x-appwrite": { "method": "getFlag", "group": null, - "weight": 52, + "weight": 265, "cookies": false, "type": "location", "demo": "avatars\/get-flag.md", @@ -4826,7 +4856,7 @@ "x-appwrite": { "method": "getImage", "group": null, - "weight": 53, + "weight": 266, "cookies": false, "type": "location", "demo": "avatars\/get-image.md", @@ -4910,7 +4940,7 @@ "x-appwrite": { "method": "getInitials", "group": null, - "weight": 56, + "weight": 269, "cookies": false, "type": "location", "demo": "avatars\/get-initials.md", @@ -5004,7 +5034,7 @@ "x-appwrite": { "method": "getQR", "group": null, - "weight": 55, + "weight": 268, "cookies": false, "type": "location", "demo": "avatars\/get-qr.md", @@ -5098,7 +5128,7 @@ "x-appwrite": { "method": "getScreenshot", "group": null, - "weight": 57, + "weight": 270, "cookies": false, "type": "location", "demo": "avatars\/get-screenshot.md", @@ -5818,7 +5848,7 @@ "avif", "gif" ], - "x-enum-name": null, + "x-enum-name": "ImageFormat", "x-enum-keys": [], "default": "" }, @@ -5844,7 +5874,7 @@ "x-appwrite": { "method": "chat", "group": "console", - "weight": 243, + "weight": 497, "cookies": false, "type": "", "demo": "assistant\/chat.md", @@ -5905,7 +5935,7 @@ "x-appwrite": { "method": "getResource", "group": null, - "weight": 512, + "weight": 498, "cookies": false, "type": "", "demo": "console\/get-resource.md", @@ -5980,7 +6010,7 @@ "x-appwrite": { "method": "variables", "group": "console", - "weight": 242, + "weight": 496, "cookies": false, "type": "", "demo": "console\/variables.md", @@ -6029,7 +6059,7 @@ "x-appwrite": { "method": "list", "group": "databases", - "weight": 320, + "weight": 278, "cookies": false, "type": "", "demo": "databases\/list.md", @@ -6148,7 +6178,7 @@ "x-appwrite": { "method": "create", "group": "databases", - "weight": 316, + "weight": 274, "cookies": false, "type": "", "demo": "databases\/create.md", @@ -6265,7 +6295,7 @@ "x-appwrite": { "method": "listTransactions", "group": "transactions", - "weight": 380, + "weight": 338, "cookies": false, "type": "", "demo": "databases\/list-transactions.md", @@ -6332,7 +6362,7 @@ "x-appwrite": { "method": "createTransaction", "group": "transactions", - "weight": 376, + "weight": 334, "cookies": false, "type": "", "demo": "databases\/create-transaction.md", @@ -6369,7 +6399,8 @@ "ttl": { "type": "integer", "description": "Seconds before the transaction expires.", - "x-example": 60 + "x-example": 60, + "format": "int32" } } } @@ -6402,7 +6433,7 @@ "x-appwrite": { "method": "getTransaction", "group": "transactions", - "weight": 377, + "weight": 335, "cookies": false, "type": "", "demo": "databases\/get-transaction.md", @@ -6466,7 +6497,7 @@ "x-appwrite": { "method": "updateTransaction", "group": "transactions", - "weight": 378, + "weight": 336, "cookies": false, "type": "", "demo": "databases\/update-transaction.md", @@ -6544,7 +6575,7 @@ "x-appwrite": { "method": "deleteTransaction", "group": "transactions", - "weight": 379, + "weight": 337, "cookies": false, "type": "", "demo": "databases\/delete-transaction.md", @@ -6610,7 +6641,7 @@ "x-appwrite": { "method": "createOperations", "group": "transactions", - "weight": 381, + "weight": 339, "cookies": false, "type": "", "demo": "databases\/create-operations.md", @@ -6695,7 +6726,7 @@ "x-appwrite": { "method": "listUsage", "group": null, - "weight": 323, + "weight": 281, "cookies": false, "type": "", "demo": "databases\/list-usage.md", @@ -6799,7 +6830,7 @@ "x-appwrite": { "method": "get", "group": "databases", - "weight": 317, + "weight": 275, "cookies": false, "type": "", "demo": "databases\/get.md", @@ -6893,7 +6924,7 @@ "x-appwrite": { "method": "update", "group": "databases", - "weight": 318, + "weight": 276, "cookies": false, "type": "", "demo": "databases\/update.md", @@ -6926,8 +6957,7 @@ "enabled" ], "required": [ - "databaseId", - "name" + "databaseId" ], "responses": [ { @@ -6982,10 +7012,7 @@ "description": "Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled.", "x-example": false } - }, - "required": [ - "name" - ] + } } } } @@ -7007,7 +7034,7 @@ "x-appwrite": { "method": "delete", "group": "databases", - "weight": 319, + "weight": 277, "cookies": false, "type": "", "demo": "databases\/delete.md", @@ -7102,7 +7129,7 @@ "x-appwrite": { "method": "listCollections", "group": "collections", - "weight": 328, + "weight": 286, "cookies": false, "type": "", "demo": "databases\/list-collections.md", @@ -7202,7 +7229,7 @@ "x-appwrite": { "method": "createCollection", "group": "collections", - "weight": 324, + "weight": 282, "cookies": false, "type": "", "demo": "databases\/create-collection.md", @@ -7329,7 +7356,7 @@ "x-appwrite": { "method": "getCollection", "group": "collections", - "weight": 325, + "weight": 283, "cookies": false, "type": "", "demo": "databases\/get-collection.md", @@ -7404,7 +7431,7 @@ "x-appwrite": { "method": "updateCollection", "group": "collections", - "weight": 326, + "weight": 284, "cookies": false, "type": "", "demo": "databases\/update-collection.md", @@ -7485,10 +7512,7 @@ "description": "Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled.", "x-example": false } - }, - "required": [ - "name" - ] + } } } } @@ -7510,7 +7534,7 @@ "x-appwrite": { "method": "deleteCollection", "group": "collections", - "weight": 327, + "weight": 285, "cookies": false, "type": "", "demo": "databases\/delete-collection.md", @@ -7587,7 +7611,7 @@ "x-appwrite": { "method": "listAttributes", "group": "attributes", - "weight": 345, + "weight": 303, "cookies": false, "type": "", "demo": "databases\/list-attributes.md", @@ -7688,7 +7712,7 @@ "x-appwrite": { "method": "createBooleanAttribute", "group": "attributes", - "weight": 346, + "weight": 304, "cookies": false, "type": "", "demo": "databases\/create-boolean-attribute.md", @@ -7801,7 +7825,7 @@ "x-appwrite": { "method": "updateBooleanAttribute", "group": "attributes", - "weight": 347, + "weight": 305, "cookies": false, "type": "", "demo": "databases\/update-boolean-attribute.md", @@ -7919,7 +7943,7 @@ "x-appwrite": { "method": "createDatetimeAttribute", "group": "attributes", - "weight": 348, + "weight": 306, "cookies": false, "type": "", "demo": "databases\/create-datetime-attribute.md", @@ -8032,7 +8056,7 @@ "x-appwrite": { "method": "updateDatetimeAttribute", "group": "attributes", - "weight": 349, + "weight": 307, "cookies": false, "type": "", "demo": "databases\/update-datetime-attribute.md", @@ -8150,7 +8174,7 @@ "x-appwrite": { "method": "createEmailAttribute", "group": "attributes", - "weight": 350, + "weight": 308, "cookies": false, "type": "", "demo": "databases\/create-email-attribute.md", @@ -8221,6 +8245,7 @@ "type": "string", "description": "Default value for attribute when not provided. Cannot be set when attribute is required.", "x-example": "email@example.com", + "format": "email", "x-nullable": true }, "array": { @@ -8263,7 +8288,7 @@ "x-appwrite": { "method": "updateEmailAttribute", "group": "attributes", - "weight": 351, + "weight": 309, "cookies": false, "type": "", "demo": "databases\/update-email-attribute.md", @@ -8338,6 +8363,7 @@ "type": "string", "description": "Default value for attribute when not provided. Cannot be set when attribute is required.", "x-example": "email@example.com", + "format": "email", "x-nullable": true }, "newKey": { @@ -8381,7 +8407,7 @@ "x-appwrite": { "method": "createEnumAttribute", "group": "attributes", - "weight": 352, + "weight": 310, "cookies": false, "type": "", "demo": "databases\/create-enum-attribute.md", @@ -8503,7 +8529,7 @@ "x-appwrite": { "method": "updateEnumAttribute", "group": "attributes", - "weight": 353, + "weight": 311, "cookies": false, "type": "", "demo": "databases\/update-enum-attribute.md", @@ -8630,7 +8656,7 @@ "x-appwrite": { "method": "createFloatAttribute", "group": "attributes", - "weight": 354, + "weight": 312, "cookies": false, "type": "", "demo": "databases\/create-float-attribute.md", @@ -8701,18 +8727,21 @@ "type": "number", "description": "Minimum value.", "x-example": null, + "format": "float", "x-nullable": true }, "max": { "type": "number", "description": "Maximum value.", "x-example": null, + "format": "float", "x-nullable": true }, "default": { "type": "number", "description": "Default value. Cannot be set when required.", "x-example": null, + "format": "float", "x-nullable": true }, "array": { @@ -8755,7 +8784,7 @@ "x-appwrite": { "method": "updateFloatAttribute", "group": "attributes", - "weight": 355, + "weight": 313, "cookies": false, "type": "", "demo": "databases\/update-float-attribute.md", @@ -8830,18 +8859,21 @@ "type": "number", "description": "Minimum value.", "x-example": null, + "format": "float", "x-nullable": true }, "max": { "type": "number", "description": "Maximum value.", "x-example": null, + "format": "float", "x-nullable": true }, "default": { "type": "number", "description": "Default value. Cannot be set when required.", "x-example": null, + "format": "float", "x-nullable": true }, "newKey": { @@ -8885,7 +8917,7 @@ "x-appwrite": { "method": "createIntegerAttribute", "group": "attributes", - "weight": 356, + "weight": 314, "cookies": false, "type": "", "demo": "databases\/create-integer-attribute.md", @@ -8956,18 +8988,21 @@ "type": "integer", "description": "Minimum value", "x-example": null, + "format": "int64", "x-nullable": true }, "max": { "type": "integer", "description": "Maximum value", "x-example": null, + "format": "int64", "x-nullable": true }, "default": { "type": "integer", "description": "Default value. Cannot be set when attribute is required.", "x-example": null, + "format": "int64", "x-nullable": true }, "array": { @@ -9010,7 +9045,7 @@ "x-appwrite": { "method": "updateIntegerAttribute", "group": "attributes", - "weight": 357, + "weight": 315, "cookies": false, "type": "", "demo": "databases\/update-integer-attribute.md", @@ -9085,18 +9120,21 @@ "type": "integer", "description": "Minimum value", "x-example": null, + "format": "int64", "x-nullable": true }, "max": { "type": "integer", "description": "Maximum value", "x-example": null, + "format": "int64", "x-nullable": true }, "default": { "type": "integer", "description": "Default value. Cannot be set when attribute is required.", "x-example": null, + "format": "int64", "x-nullable": true }, "newKey": { @@ -9140,7 +9178,7 @@ "x-appwrite": { "method": "createIpAttribute", "group": "attributes", - "weight": 358, + "weight": 316, "cookies": false, "type": "", "demo": "databases\/create-ip-attribute.md", @@ -9253,7 +9291,7 @@ "x-appwrite": { "method": "updateIpAttribute", "group": "attributes", - "weight": 359, + "weight": 317, "cookies": false, "type": "", "demo": "databases\/update-ip-attribute.md", @@ -9371,7 +9409,7 @@ "x-appwrite": { "method": "createLineAttribute", "group": "attributes", - "weight": 360, + "weight": 318, "cookies": false, "type": "", "demo": "databases\/create-line-attribute.md", @@ -9486,7 +9524,7 @@ "x-appwrite": { "method": "updateLineAttribute", "group": "attributes", - "weight": 361, + "weight": 319, "cookies": false, "type": "", "demo": "databases\/update-line-attribute.md", @@ -9610,7 +9648,7 @@ "x-appwrite": { "method": "createPointAttribute", "group": "attributes", - "weight": 362, + "weight": 320, "cookies": false, "type": "", "demo": "databases\/create-point-attribute.md", @@ -9725,7 +9763,7 @@ "x-appwrite": { "method": "updatePointAttribute", "group": "attributes", - "weight": 363, + "weight": 321, "cookies": false, "type": "", "demo": "databases\/update-point-attribute.md", @@ -9849,7 +9887,7 @@ "x-appwrite": { "method": "createPolygonAttribute", "group": "attributes", - "weight": 364, + "weight": 322, "cookies": false, "type": "", "demo": "databases\/create-polygon-attribute.md", @@ -9964,7 +10002,7 @@ "x-appwrite": { "method": "updatePolygonAttribute", "group": "attributes", - "weight": 365, + "weight": 323, "cookies": false, "type": "", "demo": "databases\/update-polygon-attribute.md", @@ -10088,7 +10126,7 @@ "x-appwrite": { "method": "createRelationshipAttribute", "group": "attributes", - "weight": 366, + "weight": 324, "cookies": false, "type": "", "demo": "databases\/create-relationship-attribute.md", @@ -10227,7 +10265,7 @@ "x-appwrite": { "method": "createStringAttribute", "group": "attributes", - "weight": 368, + "weight": 326, "cookies": false, "type": "", "demo": "databases\/create-string-attribute.md", @@ -10292,7 +10330,8 @@ "size": { "type": "integer", "description": "Attribute size for text attributes, in number of characters.", - "x-example": 1 + "x-example": 1, + "format": "int32" }, "required": { "type": "boolean", @@ -10351,7 +10390,7 @@ "x-appwrite": { "method": "updateStringAttribute", "group": "attributes", - "weight": 369, + "weight": 327, "cookies": false, "type": "", "demo": "databases\/update-string-attribute.md", @@ -10432,6 +10471,7 @@ "type": "integer", "description": "Maximum size of the string attribute.", "x-example": 1, + "format": "int32", "x-nullable": true }, "newKey": { @@ -10475,7 +10515,7 @@ "x-appwrite": { "method": "createUrlAttribute", "group": "attributes", - "weight": 370, + "weight": 328, "cookies": false, "type": "", "demo": "databases\/create-url-attribute.md", @@ -10546,6 +10586,7 @@ "type": "string", "description": "Default value for attribute when not provided. Cannot be set when attribute is required.", "x-example": "https:\/\/example.com", + "format": "url", "x-nullable": true }, "array": { @@ -10588,7 +10629,7 @@ "x-appwrite": { "method": "updateUrlAttribute", "group": "attributes", - "weight": 371, + "weight": 329, "cookies": false, "type": "", "demo": "databases\/update-url-attribute.md", @@ -10663,6 +10704,7 @@ "type": "string", "description": "Default value for attribute when not provided. Cannot be set when attribute is required.", "x-example": "https:\/\/example.com", + "format": "url", "x-nullable": true }, "newKey": { @@ -10737,7 +10779,7 @@ "x-appwrite": { "method": "getAttribute", "group": "attributes", - "weight": 343, + "weight": 301, "cookies": false, "type": "", "demo": "databases\/get-attribute.md", @@ -10814,7 +10856,7 @@ "x-appwrite": { "method": "deleteAttribute", "group": "attributes", - "weight": 344, + "weight": 302, "cookies": false, "type": "", "demo": "databases\/delete-attribute.md", @@ -10900,7 +10942,7 @@ "x-appwrite": { "method": "updateRelationshipAttribute", "group": "attributes", - "weight": 367, + "weight": 325, "cookies": false, "type": "", "demo": "databases\/update-relationship-attribute.md", @@ -11016,7 +11058,7 @@ "x-appwrite": { "method": "listDocuments", "group": "documents", - "weight": 339, + "weight": 297, "cookies": false, "type": "", "demo": "databases\/list-documents.md", @@ -11128,7 +11170,7 @@ "x-appwrite": { "method": "createDocument", "group": "documents", - "weight": 331, + "weight": 289, "cookies": false, "type": "", "demo": "databases\/create-document.md", @@ -11319,7 +11361,7 @@ "x-appwrite": { "method": "upsertDocuments", "group": "documents", - "weight": 336, + "weight": 294, "cookies": false, "type": "", "demo": "databases\/upsert-documents.md", @@ -11456,7 +11498,7 @@ "x-appwrite": { "method": "updateDocuments", "group": "documents", - "weight": 334, + "weight": 292, "cookies": false, "type": "", "demo": "databases\/update-documents.md", @@ -11561,7 +11603,7 @@ "x-appwrite": { "method": "deleteDocuments", "group": "documents", - "weight": 338, + "weight": 296, "cookies": false, "type": "", "demo": "databases\/delete-documents.md", @@ -11663,7 +11705,7 @@ "x-appwrite": { "method": "getDocument", "group": "documents", - "weight": 332, + "weight": 290, "cookies": false, "type": "", "demo": "databases\/get-document.md", @@ -11774,7 +11816,7 @@ "x-appwrite": { "method": "upsertDocument", "group": "documents", - "weight": 335, + "weight": 293, "cookies": false, "type": "", "demo": "databases\/upsert-document.md", @@ -11929,7 +11971,7 @@ "x-appwrite": { "method": "updateDocument", "group": "documents", - "weight": 333, + "weight": 291, "cookies": false, "type": "", "demo": "databases\/update-document.md", @@ -12041,7 +12083,7 @@ "x-appwrite": { "method": "deleteDocument", "group": "documents", - "weight": 337, + "weight": 295, "cookies": false, "type": "", "demo": "databases\/delete-document.md", @@ -12148,7 +12190,7 @@ "x-appwrite": { "method": "listDocumentLogs", "group": "logs", - "weight": 340, + "weight": 298, "cookies": false, "type": "", "demo": "databases\/list-document-logs.md", @@ -12246,7 +12288,7 @@ "x-appwrite": { "method": "decrementDocumentAttribute", "group": "documents", - "weight": 342, + "weight": 300, "cookies": false, "type": "", "demo": "databases\/decrement-document-attribute.md", @@ -12328,12 +12370,14 @@ "value": { "type": "number", "description": "Value to increment the attribute by. The value must be a number.", - "x-example": null + "x-example": null, + "format": "float" }, "min": { "type": "number", "description": "Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown.", "x-example": null, + "format": "float", "x-nullable": true }, "transactionId": { @@ -12373,7 +12417,7 @@ "x-appwrite": { "method": "incrementDocumentAttribute", "group": "documents", - "weight": 341, + "weight": 299, "cookies": false, "type": "", "demo": "databases\/increment-document-attribute.md", @@ -12455,12 +12499,14 @@ "value": { "type": "number", "description": "Value to increment the attribute by. The value must be a number.", - "x-example": null + "x-example": null, + "format": "float" }, "max": { "type": "number", "description": "Maximum value for the attribute. If the current value is greater than this value, an error will be thrown.", "x-example": null, + "format": "float", "x-nullable": true }, "transactionId": { @@ -12500,7 +12546,7 @@ "x-appwrite": { "method": "listIndexes", "group": "indexes", - "weight": 375, + "weight": 333, "cookies": false, "type": "", "demo": "databases\/list-indexes.md", @@ -12599,7 +12645,7 @@ "x-appwrite": { "method": "createIndex", "group": "indexes", - "weight": 372, + "weight": 330, "cookies": false, "type": "", "demo": "databases\/create-index.md", @@ -12740,7 +12786,7 @@ "x-appwrite": { "method": "getIndex", "group": "indexes", - "weight": 373, + "weight": 331, "cookies": false, "type": "", "demo": "databases\/get-index.md", @@ -12817,7 +12863,7 @@ "x-appwrite": { "method": "deleteIndex", "group": "indexes", - "weight": 374, + "weight": 332, "cookies": false, "type": "", "demo": "databases\/delete-index.md", @@ -12903,7 +12949,7 @@ "x-appwrite": { "method": "listCollectionLogs", "group": "collections", - "weight": 329, + "weight": 287, "cookies": false, "type": "", "demo": "databases\/list-collection-logs.md", @@ -12991,7 +13037,7 @@ "x-appwrite": { "method": "getCollectionUsage", "group": null, - "weight": 330, + "weight": 288, "cookies": false, "type": "", "demo": "databases\/get-collection-usage.md", @@ -13088,7 +13134,7 @@ "x-appwrite": { "method": "listLogs", "group": "logs", - "weight": 321, + "weight": 279, "cookies": false, "type": "", "demo": "databases\/list-logs.md", @@ -13196,7 +13242,7 @@ "x-appwrite": { "method": "getUsage", "group": null, - "weight": 322, + "weight": 280, "cookies": false, "type": "", "demo": "databases\/get-usage.md", @@ -13313,7 +13359,7 @@ "x-appwrite": { "method": "list", "group": "functions", - "weight": 456, + "weight": 415, "cookies": false, "type": "", "demo": "functions\/list.md", @@ -13398,7 +13444,7 @@ "x-appwrite": { "method": "create", "group": "functions", - "weight": 453, + "weight": 412, "cookies": false, "type": "", "demo": "functions\/create.md", @@ -13538,7 +13584,8 @@ "timeout": { "type": "integer", "description": "Function maximum execution time in seconds.", - "x-example": 1 + "x-example": 1, + "format": "int32" }, "enabled": { "type": "boolean", @@ -13693,7 +13740,7 @@ "x-appwrite": { "method": "listRuntimes", "group": "runtimes", - "weight": 458, + "weight": 417, "cookies": false, "type": "", "demo": "functions\/list-runtimes.md", @@ -13743,7 +13790,7 @@ "x-appwrite": { "method": "listSpecifications", "group": "runtimes", - "weight": 459, + "weight": 418, "cookies": false, "type": "", "demo": "functions\/list-specifications.md", @@ -13793,7 +13840,7 @@ "x-appwrite": { "method": "listTemplates", "group": "templates", - "weight": 482, + "weight": 441, "cookies": false, "type": "", "demo": "functions\/list-templates.md", @@ -13985,7 +14032,7 @@ "x-appwrite": { "method": "getTemplate", "group": "templates", - "weight": 481, + "weight": 440, "cookies": false, "type": "", "demo": "functions\/get-template.md", @@ -14045,7 +14092,7 @@ "x-appwrite": { "method": "listUsage", "group": null, - "weight": 475, + "weight": 434, "cookies": false, "type": "", "demo": "functions\/list-usage.md", @@ -14117,7 +14164,7 @@ "x-appwrite": { "method": "get", "group": "functions", - "weight": 454, + "weight": 413, "cookies": false, "type": "", "demo": "functions\/get.md", @@ -14177,7 +14224,7 @@ "x-appwrite": { "method": "update", "group": "functions", - "weight": 455, + "weight": 414, "cookies": false, "type": "", "demo": "functions\/update.md", @@ -14324,7 +14371,8 @@ "timeout": { "type": "integer", "description": "Maximum execution time in seconds.", - "x-example": 1 + "x-example": 1, + "format": "int32" }, "enabled": { "type": "boolean", @@ -14469,7 +14517,7 @@ "x-appwrite": { "method": "delete", "group": "functions", - "weight": 457, + "weight": 416, "cookies": false, "type": "", "demo": "functions\/delete.md", @@ -14531,7 +14579,7 @@ "x-appwrite": { "method": "updateFunctionDeployment", "group": "functions", - "weight": 462, + "weight": 421, "cookies": false, "type": "", "demo": "functions\/update-function-deployment.md", @@ -14612,7 +14660,7 @@ "x-appwrite": { "method": "listDeployments", "group": "deployments", - "weight": 463, + "weight": 422, "cookies": false, "type": "", "demo": "functions\/list-deployments.md", @@ -14707,7 +14755,7 @@ "x-appwrite": { "method": "createDeployment", "group": "deployments", - "weight": 460, + "weight": 419, "cookies": false, "type": "upload", "demo": "functions\/create-deployment.md", @@ -14764,7 +14812,8 @@ "code": { "type": "string", "description": "Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory.", - "x-example": null + "x-example": null, + "format": "binary" }, "activate": { "type": "boolean", @@ -14806,7 +14855,7 @@ "x-appwrite": { "method": "createDuplicateDeployment", "group": "deployments", - "weight": 468, + "weight": 427, "cookies": false, "type": "", "demo": "functions\/create-duplicate-deployment.md", @@ -14892,7 +14941,7 @@ "x-appwrite": { "method": "createTemplateDeployment", "group": "deployments", - "weight": 465, + "weight": 424, "cookies": false, "type": "", "demo": "functions\/create-template-deployment.md", @@ -15009,7 +15058,7 @@ "x-appwrite": { "method": "createVcsDeployment", "group": "deployments", - "weight": 466, + "weight": 425, "cookies": false, "type": "", "demo": "functions\/create-vcs-deployment.md", @@ -15107,7 +15156,7 @@ "x-appwrite": { "method": "getDeployment", "group": "deployments", - "weight": 461, + "weight": 420, "cookies": false, "type": "", "demo": "functions\/get-deployment.md", @@ -15170,7 +15219,7 @@ "x-appwrite": { "method": "deleteDeployment", "group": "deployments", - "weight": 464, + "weight": 423, "cookies": false, "type": "", "demo": "functions\/delete-deployment.md", @@ -15235,7 +15284,7 @@ "x-appwrite": { "method": "getDeploymentDownload", "group": "deployments", - "weight": 467, + "weight": 426, "cookies": false, "type": "location", "demo": "functions\/get-deployment-download.md", @@ -15326,7 +15375,7 @@ "x-appwrite": { "method": "updateDeploymentStatus", "group": "deployments", - "weight": 469, + "weight": 428, "cookies": false, "type": "", "demo": "functions\/update-deployment-status.md", @@ -15398,7 +15447,7 @@ "x-appwrite": { "method": "listExecutions", "group": "executions", - "weight": 472, + "weight": 431, "cookies": false, "type": "", "demo": "functions\/list-executions.md", @@ -15485,7 +15534,7 @@ "x-appwrite": { "method": "createExecution", "group": "executions", - "weight": 470, + "weight": 429, "cookies": false, "type": "", "demo": "functions\/create-execution.md", @@ -15603,7 +15652,7 @@ "x-appwrite": { "method": "getExecution", "group": "executions", - "weight": 471, + "weight": 430, "cookies": false, "type": "", "demo": "functions\/get-execution.md", @@ -15669,7 +15718,7 @@ "x-appwrite": { "method": "deleteExecution", "group": "executions", - "weight": 473, + "weight": 432, "cookies": false, "type": "", "demo": "functions\/delete-execution.md", @@ -15741,7 +15790,7 @@ "x-appwrite": { "method": "getUsage", "group": null, - "weight": 474, + "weight": 433, "cookies": false, "type": "", "demo": "functions\/get-usage.md", @@ -15823,7 +15872,7 @@ "x-appwrite": { "method": "listVariables", "group": "variables", - "weight": 478, + "weight": 437, "cookies": false, "type": "", "demo": "functions\/list-variables.md", @@ -15883,7 +15932,7 @@ "x-appwrite": { "method": "createVariable", "group": "variables", - "weight": 476, + "weight": 435, "cookies": false, "type": "", "demo": "functions\/create-variable.md", @@ -15975,7 +16024,7 @@ "x-appwrite": { "method": "getVariable", "group": "variables", - "weight": 477, + "weight": 436, "cookies": false, "type": "", "demo": "functions\/get-variable.md", @@ -16045,7 +16094,7 @@ "x-appwrite": { "method": "updateVariable", "group": "variables", - "weight": 479, + "weight": 438, "cookies": false, "type": "", "demo": "functions\/update-variable.md", @@ -16139,7 +16188,7 @@ "x-appwrite": { "method": "deleteVariable", "group": "variables", - "weight": 480, + "weight": 439, "cookies": false, "type": "", "demo": "functions\/delete-variable.md", @@ -16211,7 +16260,7 @@ "x-appwrite": { "method": "query", "group": "graphql", - "weight": 241, + "weight": 190, "cookies": false, "type": "graphql", "demo": "graphql\/query.md", @@ -16265,7 +16314,7 @@ "x-appwrite": { "method": "mutation", "group": "graphql", - "weight": 240, + "weight": 189, "cookies": false, "type": "graphql", "demo": "graphql\/mutation.md", @@ -16319,7 +16368,7 @@ "x-appwrite": { "method": "get", "group": "health", - "weight": 69, + "weight": 442, "cookies": false, "type": "", "demo": "health\/get.md", @@ -16370,7 +16419,7 @@ "x-appwrite": { "method": "getAntivirus", "group": "health", - "weight": 90, + "weight": 451, "cookies": false, "type": "", "demo": "health\/get-antivirus.md", @@ -16407,11 +16456,11 @@ "description": "Check the Appwrite in-memory cache servers are up and connection is successful.", "responses": { "200": { - "description": "Health Status", + "description": "Status List", "content": { "application\/json": { "schema": { - "$ref": "#\/components\/schemas\/healthStatus" + "$ref": "#\/components\/schemas\/healthStatusList" } } } @@ -16421,7 +16470,7 @@ "x-appwrite": { "method": "getCache", "group": "health", - "weight": 72, + "weight": 445, "cookies": false, "type": "", "demo": "health\/get-cache.md", @@ -16472,7 +16521,7 @@ "x-appwrite": { "method": "getCertificate", "group": "health", - "weight": 77, + "weight": 448, "cookies": false, "type": "", "demo": "health\/get-certificate.md", @@ -16520,11 +16569,11 @@ "description": "Check the Appwrite database servers are up and connection is successful.", "responses": { "200": { - "description": "Health Status", + "description": "Status List", "content": { "application\/json": { "schema": { - "$ref": "#\/components\/schemas\/healthStatus" + "$ref": "#\/components\/schemas\/healthStatusList" } } } @@ -16534,7 +16583,7 @@ "x-appwrite": { "method": "getDB", "group": "health", - "weight": 71, + "weight": 444, "cookies": false, "type": "", "demo": "health\/get-db.md", @@ -16571,11 +16620,11 @@ "description": "Check the Appwrite pub-sub servers are up and connection is successful.", "responses": { "200": { - "description": "Health Status", + "description": "Status List", "content": { "application\/json": { "schema": { - "$ref": "#\/components\/schemas\/healthStatus" + "$ref": "#\/components\/schemas\/healthStatusList" } } } @@ -16585,7 +16634,7 @@ "x-appwrite": { "method": "getPubSub", "group": "health", - "weight": 73, + "weight": 446, "cookies": false, "type": "", "demo": "health\/get-pub-sub.md", @@ -16612,6 +16661,70 @@ ] } }, + "\/health\/queue\/audits": { + "get": { + "summary": "Get audits queue", + "operationId": "healthGetQueueAudits", + "tags": [ + "health" + ], + "description": "Get the number of audit logs that are waiting to be processed in the Appwrite internal queue server.", + "responses": { + "200": { + "description": "Health Queue", + "content": { + "application\/json": { + "schema": { + "$ref": "#\/components\/schemas\/healthQueue" + } + } + } + } + }, + "deprecated": false, + "x-appwrite": { + "method": "getQueueAudits", + "group": "queue", + "weight": 452, + "cookies": false, + "type": "", + "demo": "health\/get-queue-audits.md", + "rate-limit": 0, + "rate-time": 3600, + "rate-key": "url:{url},ip:{ip}", + "scope": "health.read", + "platforms": [ + "console", + "server" + ], + "packaging": false, + "public": true, + "edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-audits.md", + "auth": { + "Project": [] + } + }, + "security": [ + { + "Project": [], + "Key": [] + } + ], + "parameters": [ + { + "name": "threshold", + "description": "Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.", + "required": false, + "schema": { + "type": "integer", + "format": "int32", + "default": 5000 + }, + "in": "query" + } + ] + } + }, "\/health\/queue\/builds": { "get": { "summary": "Get builds queue", @@ -16636,7 +16749,7 @@ "x-appwrite": { "method": "getQueueBuilds", "group": "queue", - "weight": 79, + "weight": 456, "cookies": false, "type": "", "demo": "health\/get-queue-builds.md", @@ -16700,7 +16813,7 @@ "x-appwrite": { "method": "getQueueCertificates", "group": "queue", - "weight": 78, + "weight": 455, "cookies": false, "type": "", "demo": "health\/get-queue-certificates.md", @@ -16764,7 +16877,7 @@ "x-appwrite": { "method": "getQueueDatabases", "group": "queue", - "weight": 80, + "weight": 457, "cookies": false, "type": "", "demo": "health\/get-queue-databases.md", @@ -16839,7 +16952,7 @@ "x-appwrite": { "method": "getQueueDeletes", "group": "queue", - "weight": 81, + "weight": 458, "cookies": false, "type": "", "demo": "health\/get-queue-deletes.md", @@ -16903,7 +17016,7 @@ "x-appwrite": { "method": "getFailedJobs", "group": "queue", - "weight": 91, + "weight": 465, "cookies": false, "type": "", "demo": "health\/get-failed-jobs.md", @@ -16947,6 +17060,7 @@ "v1-webhooks", "v1-certificates", "v1-builds", + "v1-screenshots", "v1-messaging", "v1-migrations" ], @@ -16993,7 +17107,7 @@ "x-appwrite": { "method": "getQueueFunctions", "group": "queue", - "weight": 85, + "weight": 462, "cookies": false, "type": "", "demo": "health\/get-queue-functions.md", @@ -17057,7 +17171,7 @@ "x-appwrite": { "method": "getQueueLogs", "group": "queue", - "weight": 76, + "weight": 454, "cookies": false, "type": "", "demo": "health\/get-queue-logs.md", @@ -17121,7 +17235,7 @@ "x-appwrite": { "method": "getQueueMails", "group": "queue", - "weight": 82, + "weight": 459, "cookies": false, "type": "", "demo": "health\/get-queue-mails.md", @@ -17185,7 +17299,7 @@ "x-appwrite": { "method": "getQueueMessaging", "group": "queue", - "weight": 83, + "weight": 460, "cookies": false, "type": "", "demo": "health\/get-queue-messaging.md", @@ -17249,7 +17363,7 @@ "x-appwrite": { "method": "getQueueMigrations", "group": "queue", - "weight": 84, + "weight": 461, "cookies": false, "type": "", "demo": "health\/get-queue-migrations.md", @@ -17313,7 +17427,7 @@ "x-appwrite": { "method": "getQueueStatsResources", "group": "queue", - "weight": 86, + "weight": 463, "cookies": false, "type": "", "demo": "health\/get-queue-stats-resources.md", @@ -17377,7 +17491,7 @@ "x-appwrite": { "method": "getQueueUsage", "group": "queue", - "weight": 87, + "weight": 464, "cookies": false, "type": "", "demo": "health\/get-queue-usage.md", @@ -17441,7 +17555,7 @@ "x-appwrite": { "method": "getQueueWebhooks", "group": "queue", - "weight": 75, + "weight": 453, "cookies": false, "type": "", "demo": "health\/get-queue-webhooks.md", @@ -17505,7 +17619,7 @@ "x-appwrite": { "method": "getStorage", "group": "storage", - "weight": 89, + "weight": 450, "cookies": false, "type": "", "demo": "health\/get-storage.md", @@ -17556,7 +17670,7 @@ "x-appwrite": { "method": "getStorageLocal", "group": "storage", - "weight": 88, + "weight": 449, "cookies": false, "type": "", "demo": "health\/get-storage-local.md", @@ -17607,7 +17721,7 @@ "x-appwrite": { "method": "getTime", "group": "health", - "weight": 74, + "weight": 447, "cookies": false, "type": "", "demo": "health\/get-time.md", @@ -17658,7 +17772,7 @@ "x-appwrite": { "method": "get", "group": null, - "weight": 61, + "weight": 49, "cookies": false, "type": "", "demo": "locale\/get.md", @@ -17712,7 +17826,7 @@ "x-appwrite": { "method": "listCodes", "group": null, - "weight": 62, + "weight": 50, "cookies": false, "type": "", "demo": "locale\/list-codes.md", @@ -17766,7 +17880,7 @@ "x-appwrite": { "method": "listContinents", "group": null, - "weight": 66, + "weight": 54, "cookies": false, "type": "", "demo": "locale\/list-continents.md", @@ -17820,7 +17934,7 @@ "x-appwrite": { "method": "listCountries", "group": null, - "weight": 63, + "weight": 51, "cookies": false, "type": "", "demo": "locale\/list-countries.md", @@ -17874,7 +17988,7 @@ "x-appwrite": { "method": "listCountriesEU", "group": null, - "weight": 64, + "weight": 52, "cookies": false, "type": "", "demo": "locale\/list-countries-eu.md", @@ -17928,7 +18042,7 @@ "x-appwrite": { "method": "listCountriesPhones", "group": null, - "weight": 65, + "weight": 53, "cookies": false, "type": "", "demo": "locale\/list-countries-phones.md", @@ -17982,7 +18096,7 @@ "x-appwrite": { "method": "listCurrencies", "group": null, - "weight": 67, + "weight": 55, "cookies": false, "type": "", "demo": "locale\/list-currencies.md", @@ -18036,7 +18150,7 @@ "x-appwrite": { "method": "listLanguages", "group": null, - "weight": 68, + "weight": 56, "cookies": false, "type": "", "demo": "locale\/list-languages.md", @@ -18090,7 +18204,7 @@ "x-appwrite": { "method": "listMessages", "group": "messages", - "weight": 298, + "weight": 245, "cookies": false, "type": "", "demo": "messaging\/list-messages.md", @@ -18178,7 +18292,7 @@ "x-appwrite": { "method": "createEmail", "group": "messages", - "weight": 295, + "weight": 242, "cookies": false, "type": "", "demo": "messaging\/create-email.md", @@ -18324,7 +18438,7 @@ "x-appwrite": { "method": "updateEmail", "group": "messages", - "weight": 302, + "weight": 249, "cookies": false, "type": "", "demo": "messaging\/update-email.md", @@ -18482,7 +18596,7 @@ "x-appwrite": { "method": "createPush", "group": "messages", - "weight": 297, + "weight": 244, "cookies": false, "type": "", "demo": "messaging\/create-push.md", @@ -18591,7 +18705,8 @@ "badge": { "type": "integer", "description": "Badge for push notification. Available only for iOS Platform.", - "x-example": null + "x-example": null, + "format": "int32" }, "draft": { "type": "boolean", @@ -18659,7 +18774,7 @@ "x-appwrite": { "method": "updatePush", "group": "messages", - "weight": 304, + "weight": 251, "cookies": false, "type": "", "demo": "messaging\/update-push.md", @@ -18787,6 +18902,7 @@ "type": "integer", "description": "Badge for push notification. Available only for iOS platforms.", "x-example": null, + "format": "int32", "x-nullable": true }, "draft": { @@ -18856,7 +18972,7 @@ "x-appwrite": { "method": "createSms", "group": "messages", - "weight": 296, + "weight": 243, "cookies": false, "type": "", "demo": "messaging\/create-sms.md", @@ -19037,7 +19153,7 @@ "x-appwrite": { "method": "updateSms", "group": "messages", - "weight": 303, + "weight": 250, "cookies": false, "type": "", "demo": "messaging\/update-sms.md", @@ -19224,7 +19340,7 @@ "x-appwrite": { "method": "getMessage", "group": "messages", - "weight": 301, + "weight": 248, "cookies": false, "type": "", "demo": "messaging\/get-message.md", @@ -19278,7 +19394,7 @@ "x-appwrite": { "method": "delete", "group": "messages", - "weight": 305, + "weight": 252, "cookies": false, "type": "", "demo": "messaging\/delete.md", @@ -19341,7 +19457,7 @@ "x-appwrite": { "method": "listMessageLogs", "group": "logs", - "weight": 299, + "weight": 246, "cookies": false, "type": "", "demo": "messaging\/list-message-logs.md", @@ -19428,7 +19544,7 @@ "x-appwrite": { "method": "listTargets", "group": "messages", - "weight": 300, + "weight": 247, "cookies": false, "type": "", "demo": "messaging\/list-targets.md", @@ -19515,7 +19631,7 @@ "x-appwrite": { "method": "listProviders", "group": "providers", - "weight": 269, + "weight": 216, "cookies": false, "type": "", "demo": "messaging\/list-providers.md", @@ -19603,7 +19719,7 @@ "x-appwrite": { "method": "createApnsProvider", "group": "providers", - "weight": 268, + "weight": 215, "cookies": false, "type": "", "demo": "messaging\/create-apns-provider.md", @@ -19782,7 +19898,7 @@ "x-appwrite": { "method": "updateApnsProvider", "group": "providers", - "weight": 282, + "weight": 229, "cookies": false, "type": "", "demo": "messaging\/update-apns-provider.md", @@ -19963,7 +20079,7 @@ "x-appwrite": { "method": "createFcmProvider", "group": "providers", - "weight": 267, + "weight": 214, "cookies": false, "type": "", "demo": "messaging\/create-fcm-provider.md", @@ -20115,7 +20231,7 @@ "x-appwrite": { "method": "updateFcmProvider", "group": "providers", - "weight": 281, + "weight": 228, "cookies": false, "type": "", "demo": "messaging\/update-fcm-provider.md", @@ -20268,7 +20384,7 @@ "x-appwrite": { "method": "createMailgunProvider", "group": "providers", - "weight": 258, + "weight": 205, "cookies": false, "type": "", "demo": "messaging\/create-mailgun-provider.md", @@ -20333,7 +20449,8 @@ "fromEmail": { "type": "string", "description": "Sender email address.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -20343,7 +20460,8 @@ "replyToEmail": { "type": "string", "description": "Email set in the reply to field for the mail. Default value is sender email. Reply to email must have reply to name as well.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "enabled": { "type": "boolean", @@ -20386,7 +20504,7 @@ "x-appwrite": { "method": "updateMailgunProvider", "group": "providers", - "weight": 272, + "weight": 219, "cookies": false, "type": "", "demo": "messaging\/update-mailgun-provider.md", @@ -20464,7 +20582,8 @@ "fromEmail": { "type": "string", "description": "Sender email address.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -20507,7 +20626,7 @@ "x-appwrite": { "method": "createMsg91Provider", "group": "providers", - "weight": 262, + "weight": 209, "cookies": false, "type": "", "demo": "messaging\/create-msg-91-provider.md", @@ -20604,7 +20723,7 @@ "x-appwrite": { "method": "updateMsg91Provider", "group": "providers", - "weight": 276, + "weight": 223, "cookies": false, "type": "", "demo": "messaging\/update-msg-91-provider.md", @@ -20704,7 +20823,7 @@ "x-appwrite": { "method": "createResendProvider", "group": "providers", - "weight": 260, + "weight": 207, "cookies": false, "type": "", "demo": "messaging\/create-resend-provider.md", @@ -20758,7 +20877,8 @@ "fromEmail": { "type": "string", "description": "Sender email address.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -20768,7 +20888,8 @@ "replyToEmail": { "type": "string", "description": "Email set in the reply to field for the mail. Default value is sender email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "enabled": { "type": "boolean", @@ -20811,7 +20932,7 @@ "x-appwrite": { "method": "updateResendProvider", "group": "providers", - "weight": 274, + "weight": 221, "cookies": false, "type": "", "demo": "messaging\/update-resend-provider.md", @@ -20878,7 +20999,8 @@ "fromEmail": { "type": "string", "description": "Sender email address.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -20921,7 +21043,7 @@ "x-appwrite": { "method": "createSendgridProvider", "group": "providers", - "weight": 259, + "weight": 206, "cookies": false, "type": "", "demo": "messaging\/create-sendgrid-provider.md", @@ -20975,7 +21097,8 @@ "fromEmail": { "type": "string", "description": "Sender email address.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -20985,7 +21108,8 @@ "replyToEmail": { "type": "string", "description": "Email set in the reply to field for the mail. Default value is sender email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "enabled": { "type": "boolean", @@ -21028,7 +21152,7 @@ "x-appwrite": { "method": "updateSendgridProvider", "group": "providers", - "weight": 273, + "weight": 220, "cookies": false, "type": "", "demo": "messaging\/update-sendgrid-provider.md", @@ -21095,7 +21219,8 @@ "fromEmail": { "type": "string", "description": "Sender email address.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -21138,7 +21263,7 @@ "x-appwrite": { "method": "createSmtpProvider", "group": "providers", - "weight": 261, + "weight": 208, "cookies": false, "type": "", "demo": "messaging\/create-smtp-provider.md", @@ -21273,7 +21398,8 @@ "port": { "type": "integer", "description": "The default SMTP server port.", - "x-example": 1 + "x-example": 1, + "format": "int32" }, "username": { "type": "string", @@ -21315,7 +21441,8 @@ "fromEmail": { "type": "string", "description": "Sender email address.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -21325,7 +21452,8 @@ "replyToEmail": { "type": "string", "description": "Email set in the reply to field for the mail. Default value is sender email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "enabled": { "type": "boolean", @@ -21369,7 +21497,7 @@ "x-appwrite": { "method": "updateSmtpProvider", "group": "providers", - "weight": 275, + "weight": 222, "cookies": false, "type": "", "demo": "messaging\/update-smtp-provider.md", @@ -21508,6 +21636,7 @@ "type": "integer", "description": "SMTP port.", "x-example": 1, + "format": "int32", "x-nullable": true }, "username": { @@ -21551,7 +21680,8 @@ "fromEmail": { "type": "string", "description": "Sender email address.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -21600,7 +21730,7 @@ "x-appwrite": { "method": "createTelesignProvider", "group": "providers", - "weight": 263, + "weight": 210, "cookies": false, "type": "", "demo": "messaging\/create-telesign-provider.md", @@ -21644,7 +21774,8 @@ "from": { "type": "string", "description": "Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "customerId": { "type": "string", @@ -21697,7 +21828,7 @@ "x-appwrite": { "method": "updateTelesignProvider", "group": "providers", - "weight": 277, + "weight": 224, "cookies": false, "type": "", "demo": "messaging\/update-telesign-provider.md", @@ -21797,7 +21928,7 @@ "x-appwrite": { "method": "createTextmagicProvider", "group": "providers", - "weight": 264, + "weight": 211, "cookies": false, "type": "", "demo": "messaging\/create-textmagic-provider.md", @@ -21841,7 +21972,8 @@ "from": { "type": "string", "description": "Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "username": { "type": "string", @@ -21894,7 +22026,7 @@ "x-appwrite": { "method": "updateTextmagicProvider", "group": "providers", - "weight": 278, + "weight": 225, "cookies": false, "type": "", "demo": "messaging\/update-textmagic-provider.md", @@ -21994,7 +22126,7 @@ "x-appwrite": { "method": "createTwilioProvider", "group": "providers", - "weight": 265, + "weight": 212, "cookies": false, "type": "", "demo": "messaging\/create-twilio-provider.md", @@ -22038,7 +22170,8 @@ "from": { "type": "string", "description": "Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "accountSid": { "type": "string", @@ -22091,7 +22224,7 @@ "x-appwrite": { "method": "updateTwilioProvider", "group": "providers", - "weight": 279, + "weight": 226, "cookies": false, "type": "", "demo": "messaging\/update-twilio-provider.md", @@ -22191,7 +22324,7 @@ "x-appwrite": { "method": "createVonageProvider", "group": "providers", - "weight": 266, + "weight": 213, "cookies": false, "type": "", "demo": "messaging\/create-vonage-provider.md", @@ -22235,7 +22368,8 @@ "from": { "type": "string", "description": "Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "apiKey": { "type": "string", @@ -22288,7 +22422,7 @@ "x-appwrite": { "method": "updateVonageProvider", "group": "providers", - "weight": 280, + "weight": 227, "cookies": false, "type": "", "demo": "messaging\/update-vonage-provider.md", @@ -22388,7 +22522,7 @@ "x-appwrite": { "method": "getProvider", "group": "providers", - "weight": 271, + "weight": 218, "cookies": false, "type": "", "demo": "messaging\/get-provider.md", @@ -22442,7 +22576,7 @@ "x-appwrite": { "method": "deleteProvider", "group": "providers", - "weight": 283, + "weight": 230, "cookies": false, "type": "", "demo": "messaging\/delete-provider.md", @@ -22505,7 +22639,7 @@ "x-appwrite": { "method": "listProviderLogs", "group": "providers", - "weight": 270, + "weight": 217, "cookies": false, "type": "", "demo": "messaging\/list-provider-logs.md", @@ -22592,7 +22726,7 @@ "x-appwrite": { "method": "listSubscriberLogs", "group": "subscribers", - "weight": 292, + "weight": 239, "cookies": false, "type": "", "demo": "messaging\/list-subscriber-logs.md", @@ -22679,7 +22813,7 @@ "x-appwrite": { "method": "listTopics", "group": "topics", - "weight": 285, + "weight": 232, "cookies": false, "type": "", "demo": "messaging\/list-topics.md", @@ -22765,7 +22899,7 @@ "x-appwrite": { "method": "createTopic", "group": "topics", - "weight": 284, + "weight": 231, "cookies": false, "type": "", "demo": "messaging\/create-topic.md", @@ -22849,7 +22983,7 @@ "x-appwrite": { "method": "getTopic", "group": "topics", - "weight": 287, + "weight": 234, "cookies": false, "type": "", "demo": "messaging\/get-topic.md", @@ -22910,7 +23044,7 @@ "x-appwrite": { "method": "updateTopic", "group": "topics", - "weight": 288, + "weight": 235, "cookies": false, "type": "", "demo": "messaging\/update-topic.md", @@ -22990,7 +23124,7 @@ "x-appwrite": { "method": "deleteTopic", "group": "topics", - "weight": 289, + "weight": 236, "cookies": false, "type": "", "demo": "messaging\/delete-topic.md", @@ -23053,7 +23187,7 @@ "x-appwrite": { "method": "listTopicLogs", "group": "topics", - "weight": 286, + "weight": 233, "cookies": false, "type": "", "demo": "messaging\/list-topic-logs.md", @@ -23140,7 +23274,7 @@ "x-appwrite": { "method": "listSubscribers", "group": "subscribers", - "weight": 291, + "weight": 238, "cookies": false, "type": "", "demo": "messaging\/list-subscribers.md", @@ -23236,7 +23370,7 @@ "x-appwrite": { "method": "createSubscriber", "group": "subscribers", - "weight": 290, + "weight": 237, "cookies": false, "type": "", "demo": "messaging\/create-subscriber.md", @@ -23327,7 +23461,7 @@ "x-appwrite": { "method": "getSubscriber", "group": "subscribers", - "weight": 293, + "weight": 240, "cookies": false, "type": "", "demo": "messaging\/get-subscriber.md", @@ -23391,7 +23525,7 @@ "x-appwrite": { "method": "deleteSubscriber", "group": "subscribers", - "weight": 294, + "weight": 241, "cookies": false, "type": "", "demo": "messaging\/delete-subscriber.md", @@ -23467,7 +23601,7 @@ "x-appwrite": { "method": "list", "group": null, - "weight": 250, + "weight": 197, "cookies": false, "type": "", "demo": "migrations\/list.md", @@ -23553,7 +23687,7 @@ "x-appwrite": { "method": "createAppwriteMigration", "group": null, - "weight": 244, + "weight": 191, "cookies": false, "type": "", "demo": "migrations\/create-appwrite-migration.md", @@ -23613,7 +23747,8 @@ "endpoint": { "type": "string", "description": "Source Appwrite endpoint", - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" }, "projectId": { "type": "string", @@ -23662,7 +23797,7 @@ "x-appwrite": { "method": "getAppwriteReport", "group": null, - "weight": 252, + "weight": 199, "cookies": false, "type": "", "demo": "migrations\/get-appwrite-report.md", @@ -23776,7 +23911,7 @@ "x-appwrite": { "method": "createCSVExport", "group": null, - "weight": 249, + "weight": 196, "cookies": false, "type": "", "demo": "migrations\/create-csv-export.md", @@ -23891,7 +24026,7 @@ "x-appwrite": { "method": "createCSVImport", "group": null, - "weight": 248, + "weight": 195, "cookies": false, "type": "", "demo": "migrations\/create-csv-import.md", @@ -23976,7 +24111,7 @@ "x-appwrite": { "method": "createFirebaseMigration", "group": null, - "weight": 245, + "weight": 192, "cookies": false, "type": "", "demo": "migrations\/create-firebase-migration.md", @@ -24067,7 +24202,7 @@ "x-appwrite": { "method": "getFirebaseReport", "group": null, - "weight": 253, + "weight": 200, "cookies": false, "type": "", "demo": "migrations\/get-firebase-report.md", @@ -24154,7 +24289,7 @@ "x-appwrite": { "method": "createNHostMigration", "group": null, - "weight": 247, + "weight": 194, "cookies": false, "type": "", "demo": "migrations\/create-n-host-migration.md", @@ -24239,7 +24374,8 @@ "port": { "type": "integer", "description": "Source's Database Port", - "x-example": null + "x-example": null, + "format": "int32" } }, "required": [ @@ -24281,7 +24417,7 @@ "x-appwrite": { "method": "getNHostReport", "group": null, - "weight": 255, + "weight": 202, "cookies": false, "type": "", "demo": "migrations\/get-n-host-report.md", @@ -24430,7 +24566,7 @@ "x-appwrite": { "method": "createSupabaseMigration", "group": null, - "weight": 246, + "weight": 193, "cookies": false, "type": "", "demo": "migrations\/create-supabase-migration.md", @@ -24485,7 +24621,8 @@ "endpoint": { "type": "string", "description": "Source's Supabase Endpoint", - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" }, "apiKey": { "type": "string", @@ -24510,7 +24647,8 @@ "port": { "type": "integer", "description": "Source's Database Port", - "x-example": null + "x-example": null, + "format": "int32" } }, "required": [ @@ -24551,7 +24689,7 @@ "x-appwrite": { "method": "getSupabaseReport", "group": null, - "weight": 254, + "weight": 201, "cookies": false, "type": "", "demo": "migrations\/get-supabase-report.md", @@ -24691,7 +24829,7 @@ "x-appwrite": { "method": "get", "group": null, - "weight": 251, + "weight": 198, "cookies": false, "type": "", "demo": "migrations\/get.md", @@ -24750,7 +24888,7 @@ "x-appwrite": { "method": "retry", "group": null, - "weight": 256, + "weight": 203, "cookies": false, "type": "", "demo": "migrations\/retry.md", @@ -24802,7 +24940,7 @@ "x-appwrite": { "method": "delete", "group": null, - "weight": 257, + "weight": 204, "cookies": false, "type": "", "demo": "migrations\/delete.md", @@ -24863,7 +25001,7 @@ "x-appwrite": { "method": "getUsage", "group": null, - "weight": 139, + "weight": 103, "cookies": false, "type": "", "demo": "project\/get-usage.md", @@ -24952,7 +25090,7 @@ "x-appwrite": { "method": "listVariables", "group": null, - "weight": 141, + "weight": 105, "cookies": false, "type": "", "demo": "project\/list-variables.md", @@ -24999,7 +25137,7 @@ "x-appwrite": { "method": "createVariable", "group": null, - "weight": 140, + "weight": 104, "cookies": false, "type": "", "demo": "project\/create-variable.md", @@ -25078,7 +25216,7 @@ "x-appwrite": { "method": "getVariable", "group": null, - "weight": 142, + "weight": 106, "cookies": false, "type": "", "demo": "project\/get-variable.md", @@ -25137,7 +25275,7 @@ "x-appwrite": { "method": "updateVariable", "group": null, - "weight": 143, + "weight": 107, "cookies": false, "type": "", "demo": "project\/update-variable.md", @@ -25220,7 +25358,7 @@ "x-appwrite": { "method": "deleteVariable", "group": null, - "weight": 144, + "weight": 108, "cookies": false, "type": "", "demo": "project\/delete-variable.md", @@ -25281,7 +25419,7 @@ "x-appwrite": { "method": "list", "group": "projects", - "weight": 452, + "weight": 410, "cookies": false, "type": "", "demo": "projects\/list.md", @@ -25306,7 +25444,7 @@ "parameters": [ { "name": "queries", - "description": "Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https:\/\/appwrite.io\/docs\/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, teamId", + "description": "Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https:\/\/appwrite.io\/docs\/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, teamId, labels, search", "required": false, "schema": { "type": "array", @@ -25364,7 +25502,7 @@ "x-appwrite": { "method": "create", "group": "projects", - "weight": 93, + "weight": 57, "cookies": false, "type": "", "demo": "projects\/create.md", @@ -25431,7 +25569,8 @@ "url": { "type": "string", "description": "Project URL.", - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" }, "legalName": { "type": "string", @@ -25499,7 +25638,7 @@ "x-appwrite": { "method": "get", "group": "projects", - "weight": 94, + "weight": 58, "cookies": false, "type": "", "demo": "projects\/get.md", @@ -25558,7 +25697,7 @@ "x-appwrite": { "method": "update", "group": "projects", - "weight": 95, + "weight": 59, "cookies": false, "type": "", "demo": "projects\/update.md", @@ -25617,7 +25756,8 @@ "url": { "type": "string", "description": "Project URL.", - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" }, "legalName": { "type": "string", @@ -25674,7 +25814,7 @@ "x-appwrite": { "method": "delete", "group": "projects", - "weight": 112, + "weight": 76, "cookies": false, "type": "", "demo": "projects\/delete.md", @@ -25735,7 +25875,7 @@ "x-appwrite": { "method": "updateApiStatus", "group": "projects", - "weight": 99, + "weight": 63, "cookies": false, "type": "", "demo": "projects\/update-api-status.md", @@ -25892,7 +26032,7 @@ "x-appwrite": { "method": "updateApiStatusAll", "group": "projects", - "weight": 100, + "weight": 64, "cookies": false, "type": "", "demo": "projects\/update-api-status-all.md", @@ -26032,7 +26172,7 @@ "x-appwrite": { "method": "updateAuthDuration", "group": "auth", - "weight": 105, + "weight": 69, "cookies": false, "type": "", "demo": "projects\/update-auth-duration.md", @@ -26076,7 +26216,8 @@ "duration": { "type": "integer", "description": "Project session length in seconds. Max length: 31536000 seconds.", - "x-example": 0 + "x-example": 0, + "format": "int32" } }, "required": [ @@ -26112,7 +26253,7 @@ "x-appwrite": { "method": "updateAuthLimit", "group": "auth", - "weight": 104, + "weight": 68, "cookies": false, "type": "", "demo": "projects\/update-auth-limit.md", @@ -26156,7 +26297,8 @@ "limit": { "type": "integer", "description": "Set the max number of users allowed in this project. Use 0 for unlimited.", - "x-example": 0 + "x-example": 0, + "format": "int32" } }, "required": [ @@ -26192,7 +26334,7 @@ "x-appwrite": { "method": "updateAuthSessionsLimit", "group": "auth", - "weight": 110, + "weight": 74, "cookies": false, "type": "", "demo": "projects\/update-auth-sessions-limit.md", @@ -26236,7 +26378,8 @@ "limit": { "type": "integer", "description": "Set the max number of users allowed in this project. Value allowed is between 1-100. Default is 10", - "x-example": 1 + "x-example": 1, + "format": "int32" } }, "required": [ @@ -26272,7 +26415,7 @@ "x-appwrite": { "method": "updateMembershipsPrivacy", "group": "auth", - "weight": 103, + "weight": 67, "cookies": false, "type": "", "demo": "projects\/update-memberships-privacy.md", @@ -26364,7 +26507,7 @@ "x-appwrite": { "method": "updateMockNumbers", "group": "auth", - "weight": 111, + "weight": 75, "cookies": false, "type": "", "demo": "projects\/update-mock-numbers.md", @@ -26447,7 +26590,7 @@ "x-appwrite": { "method": "updateAuthPasswordDictionary", "group": "auth", - "weight": 108, + "weight": 72, "cookies": false, "type": "", "demo": "projects\/update-auth-password-dictionary.md", @@ -26527,7 +26670,7 @@ "x-appwrite": { "method": "updateAuthPasswordHistory", "group": "auth", - "weight": 107, + "weight": 71, "cookies": false, "type": "", "demo": "projects\/update-auth-password-history.md", @@ -26571,7 +26714,8 @@ "limit": { "type": "integer", "description": "Set the max number of passwords to store in user history. User can't choose a new password that is already stored in the password history list. Max number of passwords allowed in history is20. Default value is 0", - "x-example": 0 + "x-example": 0, + "format": "int32" } }, "required": [ @@ -26607,7 +26751,7 @@ "x-appwrite": { "method": "updatePersonalDataCheck", "group": "auth", - "weight": 109, + "weight": 73, "cookies": false, "type": "", "demo": "projects\/update-personal-data-check.md", @@ -26687,7 +26831,7 @@ "x-appwrite": { "method": "updateSessionAlerts", "group": "auth", - "weight": 102, + "weight": 66, "cookies": false, "type": "", "demo": "projects\/update-session-alerts.md", @@ -26767,7 +26911,7 @@ "x-appwrite": { "method": "updateSessionInvalidation", "group": "auth", - "weight": 138, + "weight": 102, "cookies": false, "type": "", "demo": "projects\/update-session-invalidation.md", @@ -26847,7 +26991,7 @@ "x-appwrite": { "method": "updateAuthStatus", "group": "auth", - "weight": 106, + "weight": 70, "cookies": false, "type": "", "demo": "projects\/update-auth-status.md", @@ -26948,14 +27092,14 @@ "x-appwrite": { "method": "listDevKeys", "group": "devKeys", - "weight": 450, + "weight": 408, "cookies": false, "type": "", "demo": "projects\/list-dev-keys.md", "rate-limit": 0, "rate-time": 3600, "rate-key": "url:{url},ip:{ip}", - "scope": "projects.read", + "scope": "devKeys.read", "platforms": [ "console" ], @@ -27019,14 +27163,14 @@ "x-appwrite": { "method": "createDevKey", "group": "devKeys", - "weight": 447, + "weight": 405, "cookies": false, "type": "", "demo": "projects\/create-dev-key.md", "rate-limit": 0, "rate-time": 3600, "rate-key": "url:{url},ip:{ip}", - "scope": "projects.write", + "scope": "devKeys.write", "platforms": [ "console" ], @@ -27104,14 +27248,14 @@ "x-appwrite": { "method": "getDevKey", "group": "devKeys", - "weight": 449, + "weight": 407, "cookies": false, "type": "", "demo": "projects\/get-dev-key.md", "rate-limit": 0, "rate-time": 3600, "rate-key": "url:{url},ip:{ip}", - "scope": "projects.read", + "scope": "devKeys.read", "platforms": [ "console" ], @@ -27172,14 +27316,14 @@ "x-appwrite": { "method": "updateDevKey", "group": "devKeys", - "weight": 448, + "weight": 406, "cookies": false, "type": "", "demo": "projects\/update-dev-key.md", "rate-limit": 0, "rate-time": 3600, "rate-key": "url:{url},ip:{ip}", - "scope": "projects.write", + "scope": "devKeys.write", "platforms": [ "console" ], @@ -27258,14 +27402,14 @@ "x-appwrite": { "method": "deleteDevKey", "group": "devKeys", - "weight": 451, + "weight": 409, "cookies": false, "type": "", "demo": "projects\/delete-dev-key.md", "rate-limit": 0, "rate-time": 3600, "rate-key": "url:{url},ip:{ip}", - "scope": "projects.write", + "scope": "devKeys.write", "platforms": [ "console" ], @@ -27328,7 +27472,7 @@ "x-appwrite": { "method": "createJWT", "group": "auth", - "weight": 124, + "weight": 88, "cookies": false, "type": "", "demo": "projects\/create-jwt.md", @@ -27439,7 +27583,8 @@ "duration": { "type": "integer", "description": "Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds.", - "x-example": 0 + "x-example": 0, + "format": "int32" } }, "required": [ @@ -27475,7 +27620,7 @@ "x-appwrite": { "method": "listKeys", "group": "keys", - "weight": 120, + "weight": 84, "cookies": false, "type": "", "demo": "projects\/list-keys.md", @@ -27545,7 +27690,7 @@ "x-appwrite": { "method": "createKey", "group": "keys", - "weight": 119, + "weight": 83, "cookies": false, "type": "", "demo": "projects\/create-key.md", @@ -27700,7 +27845,7 @@ "x-appwrite": { "method": "getKey", "group": "keys", - "weight": 121, + "weight": 85, "cookies": false, "type": "", "demo": "projects\/get-key.md", @@ -27769,7 +27914,7 @@ "x-appwrite": { "method": "updateKey", "group": "keys", - "weight": 122, + "weight": 86, "cookies": false, "type": "", "demo": "projects\/update-key.md", @@ -27925,7 +28070,7 @@ "x-appwrite": { "method": "deleteKey", "group": "keys", - "weight": 123, + "weight": 87, "cookies": false, "type": "", "demo": "projects\/delete-key.md", @@ -27972,6 +28117,88 @@ ] } }, + "\/projects\/{projectId}\/labels": { + "put": { + "summary": "Update project labels", + "operationId": "projectsUpdateLabels", + "tags": [ + "projects" + ], + "description": "Update the project labels by its unique ID. Labels can be used to easily filter projects in an organization.", + "responses": { + "200": { + "description": "Project", + "content": { + "application\/json": { + "schema": { + "$ref": "#\/components\/schemas\/project" + } + } + } + } + }, + "deprecated": false, + "x-appwrite": { + "method": "updateLabels", + "group": "projects", + "weight": 411, + "cookies": false, + "type": "", + "demo": "projects\/update-labels.md", + "rate-limit": 0, + "rate-time": 3600, + "rate-key": "url:{url},ip:{ip}", + "scope": "projects.write", + "platforms": [ + "console" + ], + "packaging": false, + "public": true, + "auth": { + "Project": [] + } + }, + "security": [ + { + "Project": [] + } + ], + "parameters": [ + { + "name": "projectId", + "description": "Project unique ID.", + "required": true, + "schema": { + "type": "string", + "x-example": "" + }, + "in": "path" + } + ], + "requestBody": { + "content": { + "application\/json": { + "schema": { + "type": "object", + "properties": { + "labels": { + "type": "array", + "description": "Array of project labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long.", + "x-example": null, + "items": { + "type": "string" + } + } + }, + "required": [ + "labels" + ] + } + } + } + } + } + }, "\/projects\/{projectId}\/oauth2": { "patch": { "summary": "Update project OAuth2", @@ -27996,7 +28223,7 @@ "x-appwrite": { "method": "updateOAuth2", "group": "auth", - "weight": 101, + "weight": 65, "cookies": false, "type": "", "demo": "projects\/update-o-auth-2.md", @@ -28080,8 +28307,7 @@ "yammer", "yandex", "zoho", - "zoom", - "mock" + "zoom" ], "x-enum-name": "OAuthProvider", "x-enum-keys": [] @@ -28138,7 +28364,7 @@ "x-appwrite": { "method": "listPlatforms", "group": "platforms", - "weight": 126, + "weight": 90, "cookies": false, "type": "", "demo": "projects\/list-platforms.md", @@ -28208,7 +28434,7 @@ "x-appwrite": { "method": "createPlatform", "group": "platforms", - "weight": 125, + "weight": 89, "cookies": false, "type": "", "demo": "projects\/create-platform.md", @@ -28328,7 +28554,7 @@ "x-appwrite": { "method": "getPlatform", "group": "platforms", - "weight": 127, + "weight": 91, "cookies": false, "type": "", "demo": "projects\/get-platform.md", @@ -28397,7 +28623,7 @@ "x-appwrite": { "method": "updatePlatform", "group": "platforms", - "weight": 128, + "weight": 92, "cookies": false, "type": "", "demo": "projects\/update-platform.md", @@ -28493,7 +28719,7 @@ "x-appwrite": { "method": "deletePlatform", "group": "platforms", - "weight": 129, + "weight": 93, "cookies": false, "type": "", "demo": "projects\/delete-platform.md", @@ -28564,7 +28790,7 @@ "x-appwrite": { "method": "updateServiceStatus", "group": "projects", - "weight": 97, + "weight": 61, "cookies": false, "type": "", "demo": "projects\/update-service-status.md", @@ -28667,7 +28893,7 @@ "x-appwrite": { "method": "updateServiceStatusAll", "group": "projects", - "weight": 98, + "weight": 62, "cookies": false, "type": "", "demo": "projects\/update-service-status-all.md", @@ -28747,7 +28973,7 @@ "x-appwrite": { "method": "updateSmtp", "group": "templates", - "weight": 130, + "weight": 94, "cookies": false, "type": "", "demo": "projects\/update-smtp.md", @@ -28877,12 +29103,14 @@ "senderEmail": { "type": "string", "description": "Email of the sender", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyTo": { "type": "string", "description": "Reply to email", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "host": { "type": "string", @@ -28892,7 +29120,8 @@ "port": { "type": "integer", "description": "SMTP server port", - "x-example": null + "x-example": null, + "format": "int32" }, "username": { "type": "string", @@ -28942,7 +29171,7 @@ "x-appwrite": { "method": "createSmtpTest", "group": "templates", - "weight": 131, + "weight": 95, "cookies": false, "type": "", "demo": "projects\/create-smtp-test.md", @@ -29079,12 +29308,14 @@ "senderEmail": { "type": "string", "description": "Email of the sender", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyTo": { "type": "string", "description": "Reply to email", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "host": { "type": "string", @@ -29094,7 +29325,8 @@ "port": { "type": "integer", "description": "SMTP server port", - "x-example": null + "x-example": null, + "format": "int32" }, "username": { "type": "string", @@ -29154,7 +29386,7 @@ "x-appwrite": { "method": "updateTeam", "group": "projects", - "weight": 96, + "weight": 60, "cookies": false, "type": "", "demo": "projects\/update-team.md", @@ -29234,7 +29466,7 @@ "x-appwrite": { "method": "getEmailTemplate", "group": "templates", - "weight": 133, + "weight": 97, "cookies": false, "type": "", "demo": "projects\/get-email-template.md", @@ -29459,7 +29691,7 @@ "x-appwrite": { "method": "updateEmailTemplate", "group": "templates", - "weight": 135, + "weight": 99, "cookies": false, "type": "", "demo": "projects\/update-email-template.md", @@ -29684,12 +29916,14 @@ "senderEmail": { "type": "string", "description": "Email of the sender", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyTo": { "type": "string", "description": "Reply to email", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" } }, "required": [ @@ -29724,7 +29958,7 @@ "x-appwrite": { "method": "deleteEmailTemplate", "group": "templates", - "weight": 137, + "weight": 101, "cookies": false, "type": "", "demo": "projects\/delete-email-template.md", @@ -29951,7 +30185,7 @@ "x-appwrite": { "method": "getSmsTemplate", "group": "templates", - "weight": 132, + "weight": 96, "cookies": false, "type": "", "demo": "projects\/get-sms-template.md", @@ -30237,7 +30471,7 @@ "x-appwrite": { "method": "updateSmsTemplate", "group": "templates", - "weight": 134, + "weight": 98, "cookies": false, "type": "", "demo": "projects\/update-sms-template.md", @@ -30546,7 +30780,7 @@ "x-appwrite": { "method": "deleteSmsTemplate", "group": "templates", - "weight": 136, + "weight": 100, "cookies": false, "type": "", "demo": "projects\/delete-sms-template.md", @@ -30834,7 +31068,7 @@ "x-appwrite": { "method": "listWebhooks", "group": "webhooks", - "weight": 114, + "weight": 78, "cookies": false, "type": "", "demo": "projects\/list-webhooks.md", @@ -30904,7 +31138,7 @@ "x-appwrite": { "method": "createWebhook", "group": "webhooks", - "weight": 113, + "weight": 77, "cookies": false, "type": "", "demo": "projects\/create-webhook.md", @@ -31020,7 +31254,7 @@ "x-appwrite": { "method": "getWebhook", "group": "webhooks", - "weight": 115, + "weight": 79, "cookies": false, "type": "", "demo": "projects\/get-webhook.md", @@ -31089,7 +31323,7 @@ "x-appwrite": { "method": "updateWebhook", "group": "webhooks", - "weight": 116, + "weight": 80, "cookies": false, "type": "", "demo": "projects\/update-webhook.md", @@ -31206,7 +31440,7 @@ "x-appwrite": { "method": "deleteWebhook", "group": "webhooks", - "weight": 118, + "weight": 82, "cookies": false, "type": "", "demo": "projects\/delete-webhook.md", @@ -31277,7 +31511,7 @@ "x-appwrite": { "method": "updateWebhookSignature", "group": "webhooks", - "weight": 117, + "weight": 81, "cookies": false, "type": "", "demo": "projects\/update-webhook-signature.md", @@ -31348,7 +31582,7 @@ "x-appwrite": { "method": "listRules", "group": null, - "weight": 518, + "weight": 512, "cookies": false, "type": "", "demo": "proxy\/list-rules.md", @@ -31433,7 +31667,7 @@ "x-appwrite": { "method": "createAPIRule", "group": null, - "weight": 513, + "weight": 507, "cookies": false, "type": "", "demo": "proxy\/create-api-rule.md", @@ -31500,7 +31734,7 @@ "x-appwrite": { "method": "createFunctionRule", "group": null, - "weight": 515, + "weight": 509, "cookies": false, "type": "", "demo": "proxy\/create-function-rule.md", @@ -31578,7 +31812,7 @@ "x-appwrite": { "method": "createRedirectRule", "group": null, - "weight": 516, + "weight": 510, "cookies": false, "type": "", "demo": "proxy\/create-redirect-rule.md", @@ -31614,7 +31848,8 @@ "url": { "type": "string", "description": "Target URL of redirection", - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" }, "statusCode": { "type": "string", @@ -31691,7 +31926,7 @@ "x-appwrite": { "method": "createSiteRule", "group": null, - "weight": 514, + "weight": 508, "cookies": false, "type": "", "demo": "proxy\/create-site-rule.md", @@ -31769,7 +32004,7 @@ "x-appwrite": { "method": "getRule", "group": null, - "weight": 517, + "weight": 511, "cookies": false, "type": "", "demo": "proxy\/get-rule.md", @@ -31820,7 +32055,7 @@ "x-appwrite": { "method": "deleteRule", "group": null, - "weight": 519, + "weight": 513, "cookies": false, "type": "", "demo": "proxy\/delete-rule.md", @@ -31880,7 +32115,7 @@ "x-appwrite": { "method": "updateRuleVerification", "group": null, - "weight": 520, + "weight": 514, "cookies": false, "type": "", "demo": "proxy\/update-rule-verification.md", @@ -31940,7 +32175,7 @@ "x-appwrite": { "method": "list", "group": "sites", - "weight": 485, + "weight": 469, "cookies": false, "type": "", "demo": "sites\/list.md", @@ -32025,7 +32260,7 @@ "x-appwrite": { "method": "create", "group": "sites", - "weight": 483, + "weight": 467, "cookies": false, "type": "", "demo": "sites\/create.md", @@ -32102,7 +32337,8 @@ "timeout": { "type": "integer", "description": "Maximum request time in seconds.", - "x-example": 1 + "x-example": 1, + "format": "int32" }, "installCommand": { "type": "string", @@ -32278,7 +32514,7 @@ "x-appwrite": { "method": "listFrameworks", "group": "frameworks", - "weight": 488, + "weight": 472, "cookies": false, "type": "", "demo": "sites\/list-frameworks.md", @@ -32328,7 +32564,7 @@ "x-appwrite": { "method": "listSpecifications", "group": "frameworks", - "weight": 511, + "weight": 495, "cookies": false, "type": "", "demo": "sites\/list-specifications.md", @@ -32378,7 +32614,7 @@ "x-appwrite": { "method": "listTemplates", "group": "templates", - "weight": 507, + "weight": 491, "cookies": false, "type": "", "demo": "sites\/list-templates.md", @@ -32507,7 +32743,7 @@ "x-appwrite": { "method": "getTemplate", "group": "templates", - "weight": 508, + "weight": 492, "cookies": false, "type": "", "demo": "sites\/get-template.md", @@ -32567,7 +32803,7 @@ "x-appwrite": { "method": "listUsage", "group": null, - "weight": 509, + "weight": 493, "cookies": false, "type": "", "demo": "sites\/list-usage.md", @@ -32639,7 +32875,7 @@ "x-appwrite": { "method": "get", "group": "sites", - "weight": 484, + "weight": 468, "cookies": false, "type": "", "demo": "sites\/get.md", @@ -32699,7 +32935,7 @@ "x-appwrite": { "method": "update", "group": "sites", - "weight": 486, + "weight": 470, "cookies": false, "type": "", "demo": "sites\/update.md", @@ -32783,7 +33019,8 @@ "timeout": { "type": "integer", "description": "Maximum request time in seconds.", - "x-example": 1 + "x-example": 1, + "format": "int32" }, "installCommand": { "type": "string", @@ -32948,7 +33185,7 @@ "x-appwrite": { "method": "delete", "group": "sites", - "weight": 487, + "weight": 471, "cookies": false, "type": "", "demo": "sites\/delete.md", @@ -33010,7 +33247,7 @@ "x-appwrite": { "method": "updateSiteDeployment", "group": "sites", - "weight": 494, + "weight": 478, "cookies": false, "type": "", "demo": "sites\/update-site-deployment.md", @@ -33091,7 +33328,7 @@ "x-appwrite": { "method": "listDeployments", "group": "deployments", - "weight": 493, + "weight": 477, "cookies": false, "type": "", "demo": "sites\/list-deployments.md", @@ -33186,7 +33423,7 @@ "x-appwrite": { "method": "createDeployment", "group": "deployments", - "weight": 489, + "weight": 473, "cookies": false, "type": "upload", "demo": "sites\/create-deployment.md", @@ -33249,7 +33486,8 @@ "code": { "type": "string", "description": "Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory.", - "x-example": null + "x-example": null, + "format": "binary" }, "activate": { "type": "boolean", @@ -33291,7 +33529,7 @@ "x-appwrite": { "method": "createDuplicateDeployment", "group": "deployments", - "weight": 497, + "weight": 481, "cookies": false, "type": "", "demo": "sites\/create-duplicate-deployment.md", @@ -33372,7 +33610,7 @@ "x-appwrite": { "method": "createTemplateDeployment", "group": "deployments", - "weight": 490, + "weight": 474, "cookies": false, "type": "", "demo": "sites\/create-template-deployment.md", @@ -33489,7 +33727,7 @@ "x-appwrite": { "method": "createVcsDeployment", "group": "deployments", - "weight": 491, + "weight": 475, "cookies": false, "type": "", "demo": "sites\/create-vcs-deployment.md", @@ -33588,7 +33826,7 @@ "x-appwrite": { "method": "getDeployment", "group": "deployments", - "weight": 492, + "weight": 476, "cookies": false, "type": "", "demo": "sites\/get-deployment.md", @@ -33651,7 +33889,7 @@ "x-appwrite": { "method": "deleteDeployment", "group": "deployments", - "weight": 495, + "weight": 479, "cookies": false, "type": "", "demo": "sites\/delete-deployment.md", @@ -33716,7 +33954,7 @@ "x-appwrite": { "method": "getDeploymentDownload", "group": "deployments", - "weight": 496, + "weight": 480, "cookies": false, "type": "location", "demo": "sites\/get-deployment-download.md", @@ -33807,7 +34045,7 @@ "x-appwrite": { "method": "updateDeploymentStatus", "group": "deployments", - "weight": 498, + "weight": 482, "cookies": false, "type": "", "demo": "sites\/update-deployment-status.md", @@ -33879,7 +34117,7 @@ "x-appwrite": { "method": "listLogs", "group": "logs", - "weight": 500, + "weight": 484, "cookies": false, "type": "", "demo": "sites\/list-logs.md", @@ -33965,7 +34203,7 @@ "x-appwrite": { "method": "getLog", "group": "logs", - "weight": 499, + "weight": 483, "cookies": false, "type": "", "demo": "sites\/get-log.md", @@ -34028,7 +34266,7 @@ "x-appwrite": { "method": "deleteLog", "group": "logs", - "weight": 501, + "weight": 485, "cookies": false, "type": "", "demo": "sites\/delete-log.md", @@ -34100,7 +34338,7 @@ "x-appwrite": { "method": "getUsage", "group": null, - "weight": 510, + "weight": 494, "cookies": false, "type": "", "demo": "sites\/get-usage.md", @@ -34182,7 +34420,7 @@ "x-appwrite": { "method": "listVariables", "group": "variables", - "weight": 504, + "weight": 488, "cookies": false, "type": "", "demo": "sites\/list-variables.md", @@ -34242,7 +34480,7 @@ "x-appwrite": { "method": "createVariable", "group": "variables", - "weight": 502, + "weight": 486, "cookies": false, "type": "", "demo": "sites\/create-variable.md", @@ -34334,7 +34572,7 @@ "x-appwrite": { "method": "getVariable", "group": "variables", - "weight": 503, + "weight": 487, "cookies": false, "type": "", "demo": "sites\/get-variable.md", @@ -34404,7 +34642,7 @@ "x-appwrite": { "method": "updateVariable", "group": "variables", - "weight": 505, + "weight": 489, "cookies": false, "type": "", "demo": "sites\/update-variable.md", @@ -34498,7 +34736,7 @@ "x-appwrite": { "method": "deleteVariable", "group": "variables", - "weight": 506, + "weight": 490, "cookies": false, "type": "", "demo": "sites\/delete-variable.md", @@ -34570,7 +34808,7 @@ "x-appwrite": { "method": "listBuckets", "group": "buckets", - "weight": 146, + "weight": 522, "cookies": false, "type": "", "demo": "storage\/list-buckets.md", @@ -34656,7 +34894,7 @@ "x-appwrite": { "method": "createBucket", "group": "buckets", - "weight": 145, + "weight": 520, "cookies": false, "type": "", "demo": "storage\/create-bucket.md", @@ -34719,7 +34957,8 @@ "maximumFileSize": { "type": "integer", "description": "Maximum file size allowed in bytes. Maximum allowed value is 30MB.", - "x-example": 1 + "x-example": 1, + "format": "int32" }, "allowedFileExtensions": { "type": "array", @@ -34731,7 +34970,7 @@ }, "compression": { "type": "string", - "description": "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", + "description": "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", "x-example": "none", "enum": [ "none", @@ -34791,7 +35030,7 @@ "x-appwrite": { "method": "getBucket", "group": "buckets", - "weight": 147, + "weight": 521, "cookies": false, "type": "", "demo": "storage\/get-bucket.md", @@ -34852,7 +35091,7 @@ "x-appwrite": { "method": "updateBucket", "group": "buckets", - "weight": 148, + "weight": 523, "cookies": false, "type": "", "demo": "storage\/update-bucket.md", @@ -34922,7 +35161,8 @@ "maximumFileSize": { "type": "integer", "description": "Maximum file size allowed in bytes. Maximum allowed value is 30MB.", - "x-example": 1 + "x-example": 1, + "format": "int32" }, "allowedFileExtensions": { "type": "array", @@ -34934,7 +35174,7 @@ }, "compression": { "type": "string", - "description": "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", + "description": "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", "x-example": "none", "enum": [ "none", @@ -34984,7 +35224,7 @@ "x-appwrite": { "method": "deleteBucket", "group": "buckets", - "weight": 149, + "weight": 524, "cookies": false, "type": "", "demo": "storage\/delete-bucket.md", @@ -35047,7 +35287,7 @@ "x-appwrite": { "method": "listFiles", "group": "files", - "weight": 151, + "weight": 527, "cookies": false, "type": "", "demo": "storage\/list-files.md", @@ -35146,7 +35386,7 @@ "x-appwrite": { "method": "createFile", "group": "files", - "weight": 150, + "weight": 525, "cookies": false, "type": "upload", "demo": "storage\/create-file.md", @@ -35201,7 +35441,8 @@ "file": { "type": "string", "description": "Binary file. Appwrite SDKs provide helpers to handle file input. [Learn about file input](https:\/\/appwrite.io\/docs\/products\/storage\/upload-download#input-file).", - "x-example": null + "x-example": null, + "format": "binary" }, "permissions": { "type": "array", @@ -35247,7 +35488,7 @@ "x-appwrite": { "method": "getFile", "group": "files", - "weight": 152, + "weight": 526, "cookies": false, "type": "", "demo": "storage\/get-file.md", @@ -35321,13 +35562,13 @@ "x-appwrite": { "method": "updateFile", "group": "files", - "weight": 157, + "weight": 528, "cookies": false, "type": "", "demo": "storage\/update-file.md", - "rate-limit": 60, - "rate-time": 60, - "rate-key": "ip:{ip},method:{method},url:{url},userId:{userId}", + "rate-limit": 0, + "rate-time": 3600, + "rate-key": "url:{url},ip:{ip}", "scope": "files.write", "platforms": [ "console", @@ -35352,7 +35593,7 @@ "parameters": [ { "name": "bucketId", - "description": "Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https:\/\/appwrite.io\/docs\/server\/storage#createBucket).", + "description": "Bucket unique ID.", "required": true, "schema": { "type": "string", @@ -35362,7 +35603,7 @@ }, { "name": "fileId", - "description": "File unique ID.", + "description": "File ID.", "required": true, "schema": { "type": "string", @@ -35379,13 +35620,12 @@ "properties": { "name": { "type": "string", - "description": "Name of the file", - "x-example": "", - "x-nullable": true + "description": "File name.", + "x-example": "" }, "permissions": { "type": "array", - "description": "An array of permission string. By default, the current permissions are inherited. [Learn more about permissions](https:\/\/appwrite.io\/docs\/permissions).", + "description": "An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https:\/\/appwrite.io\/docs\/permissions).", "x-example": "[\"read(\"any\")\"]", "items": { "type": "string" @@ -35414,7 +35654,7 @@ "x-appwrite": { "method": "deleteFile", "group": "files", - "weight": 158, + "weight": 529, "cookies": false, "type": "", "demo": "storage\/delete-file.md", @@ -35483,7 +35723,7 @@ "x-appwrite": { "method": "getFileDownload", "group": "files", - "weight": 154, + "weight": 531, "cookies": false, "type": "location", "demo": "storage\/get-file-download.md", @@ -35563,7 +35803,7 @@ "x-appwrite": { "method": "getFilePreview", "group": "files", - "weight": 153, + "weight": 530, "cookies": false, "type": "location", "demo": "storage\/get-file-preview.md", @@ -35793,7 +36033,7 @@ "x-appwrite": { "method": "getFileView", "group": "files", - "weight": 155, + "weight": 532, "cookies": false, "type": "location", "demo": "storage\/get-file-view.md", @@ -35880,7 +36120,7 @@ "x-appwrite": { "method": "getUsage", "group": null, - "weight": 159, + "weight": 534, "cookies": false, "type": "", "demo": "storage\/get-usage.md", @@ -35953,7 +36193,7 @@ "x-appwrite": { "method": "getBucketUsage", "group": null, - "weight": 160, + "weight": 535, "cookies": false, "type": "", "demo": "storage\/get-bucket-usage.md", @@ -36036,7 +36276,7 @@ "x-appwrite": { "method": "list", "group": "tablesdb", - "weight": 386, + "weight": 344, "cookies": false, "type": "", "demo": "tablesdb\/list.md", @@ -36122,7 +36362,7 @@ "x-appwrite": { "method": "create", "group": "tablesdb", - "weight": 382, + "weight": 340, "cookies": false, "type": "", "demo": "tablesdb\/create.md", @@ -36203,7 +36443,7 @@ "x-appwrite": { "method": "listTransactions", "group": "transactions", - "weight": 445, + "weight": 403, "cookies": false, "type": "", "demo": "tablesdb\/list-transactions.md", @@ -36273,7 +36513,7 @@ "x-appwrite": { "method": "createTransaction", "group": "transactions", - "weight": 441, + "weight": 399, "cookies": false, "type": "", "demo": "tablesdb\/create-transaction.md", @@ -36313,7 +36553,8 @@ "ttl": { "type": "integer", "description": "Seconds before the transaction expires.", - "x-example": 60 + "x-example": 60, + "format": "int32" } } } @@ -36346,7 +36587,7 @@ "x-appwrite": { "method": "getTransaction", "group": "transactions", - "weight": 442, + "weight": 400, "cookies": false, "type": "", "demo": "tablesdb\/get-transaction.md", @@ -36413,7 +36654,7 @@ "x-appwrite": { "method": "updateTransaction", "group": "transactions", - "weight": 443, + "weight": 401, "cookies": false, "type": "", "demo": "tablesdb\/update-transaction.md", @@ -36494,7 +36735,7 @@ "x-appwrite": { "method": "deleteTransaction", "group": "transactions", - "weight": 444, + "weight": 402, "cookies": false, "type": "", "demo": "tablesdb\/delete-transaction.md", @@ -36563,7 +36804,7 @@ "x-appwrite": { "method": "createOperations", "group": "transactions", - "weight": 446, + "weight": 404, "cookies": false, "type": "", "demo": "tablesdb\/create-operations.md", @@ -36651,7 +36892,7 @@ "x-appwrite": { "method": "listUsage", "group": null, - "weight": 388, + "weight": 346, "cookies": false, "type": "", "demo": "tablesdb\/list-usage.md", @@ -36750,7 +36991,7 @@ "x-appwrite": { "method": "get", "group": "tablesdb", - "weight": 383, + "weight": 341, "cookies": false, "type": "", "demo": "tablesdb\/get.md", @@ -36811,7 +37052,7 @@ "x-appwrite": { "method": "update", "group": "tablesdb", - "weight": 384, + "weight": 342, "cookies": false, "type": "", "demo": "tablesdb\/update.md", @@ -36864,10 +37105,7 @@ "description": "Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled.", "x-example": false } - }, - "required": [ - "name" - ] + } } } } @@ -36889,7 +37127,7 @@ "x-appwrite": { "method": "delete", "group": "tablesdb", - "weight": 385, + "weight": 343, "cookies": false, "type": "", "demo": "tablesdb\/delete.md", @@ -36952,7 +37190,7 @@ "x-appwrite": { "method": "listTables", "group": "tables", - "weight": 393, + "weight": 351, "cookies": false, "type": "", "demo": "tablesdb\/list-tables.md", @@ -37051,7 +37289,7 @@ "x-appwrite": { "method": "createTable", "group": "tables", - "weight": 389, + "weight": 347, "cookies": false, "type": "", "demo": "tablesdb\/create-table.md", @@ -37177,7 +37415,7 @@ "x-appwrite": { "method": "getTable", "group": "tables", - "weight": 390, + "weight": 348, "cookies": false, "type": "", "demo": "tablesdb\/get-table.md", @@ -37251,7 +37489,7 @@ "x-appwrite": { "method": "updateTable", "group": "tables", - "weight": 391, + "weight": 349, "cookies": false, "type": "", "demo": "tablesdb\/update-table.md", @@ -37331,10 +37569,7 @@ "description": "Is table enabled? When set to 'disabled', users cannot access the table but Server SDKs with and API key can still read and write to the table. No data is lost when this is toggled.", "x-example": false } - }, - "required": [ - "name" - ] + } } } } @@ -37356,7 +37591,7 @@ "x-appwrite": { "method": "deleteTable", "group": "tables", - "weight": 392, + "weight": 350, "cookies": false, "type": "", "demo": "tablesdb\/delete-table.md", @@ -37432,7 +37667,7 @@ "x-appwrite": { "method": "listColumns", "group": "columns", - "weight": 398, + "weight": 356, "cookies": false, "type": "", "demo": "tablesdb\/list-columns.md", @@ -37532,7 +37767,7 @@ "x-appwrite": { "method": "createBooleanColumn", "group": "columns", - "weight": 399, + "weight": 357, "cookies": false, "type": "", "demo": "tablesdb\/create-boolean-column.md", @@ -37644,7 +37879,7 @@ "x-appwrite": { "method": "updateBooleanColumn", "group": "columns", - "weight": 400, + "weight": 358, "cookies": false, "type": "", "demo": "tablesdb\/update-boolean-column.md", @@ -37761,7 +37996,7 @@ "x-appwrite": { "method": "createDatetimeColumn", "group": "columns", - "weight": 401, + "weight": 359, "cookies": false, "type": "", "demo": "tablesdb\/create-datetime-column.md", @@ -37873,7 +38108,7 @@ "x-appwrite": { "method": "updateDatetimeColumn", "group": "columns", - "weight": 402, + "weight": 360, "cookies": false, "type": "", "demo": "tablesdb\/update-datetime-column.md", @@ -37990,7 +38225,7 @@ "x-appwrite": { "method": "createEmailColumn", "group": "columns", - "weight": 403, + "weight": 361, "cookies": false, "type": "", "demo": "tablesdb\/create-email-column.md", @@ -38060,6 +38295,7 @@ "type": "string", "description": "Default value for column when not provided. Cannot be set when column is required.", "x-example": "email@example.com", + "format": "email", "x-nullable": true }, "array": { @@ -38102,7 +38338,7 @@ "x-appwrite": { "method": "updateEmailColumn", "group": "columns", - "weight": 404, + "weight": 362, "cookies": false, "type": "", "demo": "tablesdb\/update-email-column.md", @@ -38176,6 +38412,7 @@ "type": "string", "description": "Default value for column when not provided. Cannot be set when column is required.", "x-example": "email@example.com", + "format": "email", "x-nullable": true }, "newKey": { @@ -38219,7 +38456,7 @@ "x-appwrite": { "method": "createEnumColumn", "group": "columns", - "weight": 405, + "weight": 363, "cookies": false, "type": "", "demo": "tablesdb\/create-enum-column.md", @@ -38340,7 +38577,7 @@ "x-appwrite": { "method": "updateEnumColumn", "group": "columns", - "weight": 406, + "weight": 364, "cookies": false, "type": "", "demo": "tablesdb\/update-enum-column.md", @@ -38466,7 +38703,7 @@ "x-appwrite": { "method": "createFloatColumn", "group": "columns", - "weight": 407, + "weight": 365, "cookies": false, "type": "", "demo": "tablesdb\/create-float-column.md", @@ -38536,18 +38773,21 @@ "type": "number", "description": "Minimum value", "x-example": null, + "format": "float", "x-nullable": true }, "max": { "type": "number", "description": "Maximum value", "x-example": null, + "format": "float", "x-nullable": true }, "default": { "type": "number", "description": "Default value. Cannot be set when required.", "x-example": null, + "format": "float", "x-nullable": true }, "array": { @@ -38590,7 +38830,7 @@ "x-appwrite": { "method": "updateFloatColumn", "group": "columns", - "weight": 408, + "weight": 366, "cookies": false, "type": "", "demo": "tablesdb\/update-float-column.md", @@ -38664,18 +38904,21 @@ "type": "number", "description": "Minimum value", "x-example": null, + "format": "float", "x-nullable": true }, "max": { "type": "number", "description": "Maximum value", "x-example": null, + "format": "float", "x-nullable": true }, "default": { "type": "number", "description": "Default value. Cannot be set when required.", "x-example": null, + "format": "float", "x-nullable": true }, "newKey": { @@ -38719,7 +38962,7 @@ "x-appwrite": { "method": "createIntegerColumn", "group": "columns", - "weight": 409, + "weight": 367, "cookies": false, "type": "", "demo": "tablesdb\/create-integer-column.md", @@ -38789,18 +39032,21 @@ "type": "integer", "description": "Minimum value", "x-example": null, + "format": "int64", "x-nullable": true }, "max": { "type": "integer", "description": "Maximum value", "x-example": null, + "format": "int64", "x-nullable": true }, "default": { "type": "integer", "description": "Default value. Cannot be set when column is required.", "x-example": null, + "format": "int64", "x-nullable": true }, "array": { @@ -38843,7 +39089,7 @@ "x-appwrite": { "method": "updateIntegerColumn", "group": "columns", - "weight": 410, + "weight": 368, "cookies": false, "type": "", "demo": "tablesdb\/update-integer-column.md", @@ -38917,18 +39163,21 @@ "type": "integer", "description": "Minimum value", "x-example": null, + "format": "int64", "x-nullable": true }, "max": { "type": "integer", "description": "Maximum value", "x-example": null, + "format": "int64", "x-nullable": true }, "default": { "type": "integer", "description": "Default value. Cannot be set when column is required.", "x-example": null, + "format": "int64", "x-nullable": true }, "newKey": { @@ -38972,7 +39221,7 @@ "x-appwrite": { "method": "createIpColumn", "group": "columns", - "weight": 411, + "weight": 369, "cookies": false, "type": "", "demo": "tablesdb\/create-ip-column.md", @@ -39084,7 +39333,7 @@ "x-appwrite": { "method": "updateIpColumn", "group": "columns", - "weight": 412, + "weight": 370, "cookies": false, "type": "", "demo": "tablesdb\/update-ip-column.md", @@ -39201,7 +39450,7 @@ "x-appwrite": { "method": "createLineColumn", "group": "columns", - "weight": 413, + "weight": 371, "cookies": false, "type": "", "demo": "tablesdb\/create-line-column.md", @@ -39315,7 +39564,7 @@ "x-appwrite": { "method": "updateLineColumn", "group": "columns", - "weight": 414, + "weight": 372, "cookies": false, "type": "", "demo": "tablesdb\/update-line-column.md", @@ -39438,7 +39687,7 @@ "x-appwrite": { "method": "createPointColumn", "group": "columns", - "weight": 415, + "weight": 373, "cookies": false, "type": "", "demo": "tablesdb\/create-point-column.md", @@ -39552,7 +39801,7 @@ "x-appwrite": { "method": "updatePointColumn", "group": "columns", - "weight": 416, + "weight": 374, "cookies": false, "type": "", "demo": "tablesdb\/update-point-column.md", @@ -39675,7 +39924,7 @@ "x-appwrite": { "method": "createPolygonColumn", "group": "columns", - "weight": 417, + "weight": 375, "cookies": false, "type": "", "demo": "tablesdb\/create-polygon-column.md", @@ -39789,7 +40038,7 @@ "x-appwrite": { "method": "updatePolygonColumn", "group": "columns", - "weight": 418, + "weight": 376, "cookies": false, "type": "", "demo": "tablesdb\/update-polygon-column.md", @@ -39912,7 +40161,7 @@ "x-appwrite": { "method": "createRelationshipColumn", "group": "columns", - "weight": 419, + "weight": 377, "cookies": false, "type": "", "demo": "tablesdb\/create-relationship-column.md", @@ -40050,7 +40299,7 @@ "x-appwrite": { "method": "createStringColumn", "group": "columns", - "weight": 421, + "weight": 379, "cookies": false, "type": "", "demo": "tablesdb\/create-string-column.md", @@ -40114,7 +40363,8 @@ "size": { "type": "integer", "description": "Column size for text columns, in number of characters.", - "x-example": 1 + "x-example": 1, + "format": "int32" }, "required": { "type": "boolean", @@ -40173,7 +40423,7 @@ "x-appwrite": { "method": "updateStringColumn", "group": "columns", - "weight": 422, + "weight": 380, "cookies": false, "type": "", "demo": "tablesdb\/update-string-column.md", @@ -40253,6 +40503,7 @@ "type": "integer", "description": "Maximum size of the string column.", "x-example": 1, + "format": "int32", "x-nullable": true }, "newKey": { @@ -40296,7 +40547,7 @@ "x-appwrite": { "method": "createUrlColumn", "group": "columns", - "weight": 423, + "weight": 381, "cookies": false, "type": "", "demo": "tablesdb\/create-url-column.md", @@ -40366,6 +40617,7 @@ "type": "string", "description": "Default value for column when not provided. Cannot be set when column is required.", "x-example": "https:\/\/example.com", + "format": "url", "x-nullable": true }, "array": { @@ -40408,7 +40660,7 @@ "x-appwrite": { "method": "updateUrlColumn", "group": "columns", - "weight": 424, + "weight": 382, "cookies": false, "type": "", "demo": "tablesdb\/update-url-column.md", @@ -40482,6 +40734,7 @@ "type": "string", "description": "Default value for column when not provided. Cannot be set when column is required.", "x-example": "https:\/\/example.com", + "format": "url", "x-nullable": true }, "newKey": { @@ -40556,7 +40809,7 @@ "x-appwrite": { "method": "getColumn", "group": "columns", - "weight": 396, + "weight": 354, "cookies": false, "type": "", "demo": "tablesdb\/get-column.md", @@ -40632,7 +40885,7 @@ "x-appwrite": { "method": "deleteColumn", "group": "columns", - "weight": 397, + "weight": 355, "cookies": false, "type": "", "demo": "tablesdb\/delete-column.md", @@ -40717,7 +40970,7 @@ "x-appwrite": { "method": "updateRelationshipColumn", "group": "columns", - "weight": 420, + "weight": 378, "cookies": false, "type": "", "demo": "tablesdb\/update-relationship-column.md", @@ -40832,7 +41085,7 @@ "x-appwrite": { "method": "listIndexes", "group": "indexes", - "weight": 428, + "weight": 386, "cookies": false, "type": "", "demo": "tablesdb\/list-indexes.md", @@ -40930,7 +41183,7 @@ "x-appwrite": { "method": "createIndex", "group": "indexes", - "weight": 425, + "weight": 383, "cookies": false, "type": "", "demo": "tablesdb\/create-index.md", @@ -41070,7 +41323,7 @@ "x-appwrite": { "method": "getIndex", "group": "indexes", - "weight": 426, + "weight": 384, "cookies": false, "type": "", "demo": "tablesdb\/get-index.md", @@ -41146,7 +41399,7 @@ "x-appwrite": { "method": "deleteIndex", "group": "indexes", - "weight": 427, + "weight": 385, "cookies": false, "type": "", "demo": "tablesdb\/delete-index.md", @@ -41231,7 +41484,7 @@ "x-appwrite": { "method": "listTableLogs", "group": "tables", - "weight": 394, + "weight": 352, "cookies": false, "type": "", "demo": "tablesdb\/list-table-logs.md", @@ -41318,7 +41571,7 @@ "x-appwrite": { "method": "listRows", "group": "rows", - "weight": 437, + "weight": 395, "cookies": false, "type": "", "demo": "tablesdb\/list-rows.md", @@ -41429,7 +41682,7 @@ "x-appwrite": { "method": "createRow", "group": "rows", - "weight": 429, + "weight": 387, "cookies": false, "type": "", "demo": "tablesdb\/create-row.md", @@ -41611,7 +41864,7 @@ "x-appwrite": { "method": "upsertRows", "group": "rows", - "weight": 434, + "weight": 392, "cookies": false, "type": "", "demo": "tablesdb\/upsert-rows.md", @@ -41743,7 +41996,7 @@ "x-appwrite": { "method": "updateRows", "group": "rows", - "weight": 432, + "weight": 390, "cookies": false, "type": "", "demo": "tablesdb\/update-rows.md", @@ -41847,7 +42100,7 @@ "x-appwrite": { "method": "deleteRows", "group": "rows", - "weight": 436, + "weight": 394, "cookies": false, "type": "", "demo": "tablesdb\/delete-rows.md", @@ -41948,7 +42201,7 @@ "x-appwrite": { "method": "getRow", "group": "rows", - "weight": 430, + "weight": 388, "cookies": false, "type": "", "demo": "tablesdb\/get-row.md", @@ -42058,7 +42311,7 @@ "x-appwrite": { "method": "upsertRow", "group": "rows", - "weight": 433, + "weight": 391, "cookies": false, "type": "", "demo": "tablesdb\/upsert-row.md", @@ -42208,7 +42461,7 @@ "x-appwrite": { "method": "updateRow", "group": "rows", - "weight": 431, + "weight": 389, "cookies": false, "type": "", "demo": "tablesdb\/update-row.md", @@ -42319,7 +42572,7 @@ "x-appwrite": { "method": "deleteRow", "group": "rows", - "weight": 435, + "weight": 393, "cookies": false, "type": "", "demo": "tablesdb\/delete-row.md", @@ -42425,7 +42678,7 @@ "x-appwrite": { "method": "listRowLogs", "group": "logs", - "weight": 438, + "weight": 396, "cookies": false, "type": "", "demo": "tablesdb\/list-row-logs.md", @@ -42522,7 +42775,7 @@ "x-appwrite": { "method": "decrementRowColumn", "group": "rows", - "weight": 440, + "weight": 398, "cookies": false, "type": "", "demo": "tablesdb\/decrement-row-column.md", @@ -42603,12 +42856,14 @@ "value": { "type": "number", "description": "Value to increment the column by. The value must be a number.", - "x-example": null + "x-example": null, + "format": "float" }, "min": { "type": "number", "description": "Minimum value for the column. If the current value is lesser than this value, an exception will be thrown.", "x-example": null, + "format": "float", "x-nullable": true }, "transactionId": { @@ -42648,7 +42903,7 @@ "x-appwrite": { "method": "incrementRowColumn", "group": "rows", - "weight": 439, + "weight": 397, "cookies": false, "type": "", "demo": "tablesdb\/increment-row-column.md", @@ -42729,12 +42984,14 @@ "value": { "type": "number", "description": "Value to increment the column by. The value must be a number.", - "x-example": null + "x-example": null, + "format": "float" }, "max": { "type": "number", "description": "Maximum value for the column. If the current value is greater than this value, an error will be thrown.", "x-example": null, + "format": "float", "x-nullable": true }, "transactionId": { @@ -42774,7 +43031,7 @@ "x-appwrite": { "method": "getTableUsage", "group": null, - "weight": 395, + "weight": 353, "cookies": false, "type": "", "demo": "tablesdb\/get-table-usage.md", @@ -42870,7 +43127,7 @@ "x-appwrite": { "method": "getUsage", "group": null, - "weight": 387, + "weight": 345, "cookies": false, "type": "", "demo": "tablesdb\/get-usage.md", @@ -42982,7 +43239,7 @@ "x-appwrite": { "method": "list", "group": "teams", - "weight": 162, + "weight": 110, "cookies": false, "type": "", "demo": "teams\/list.md", @@ -43071,7 +43328,7 @@ "x-appwrite": { "method": "create", "group": "teams", - "weight": 161, + "weight": 109, "cookies": false, "type": "", "demo": "teams\/create.md", @@ -43158,7 +43415,7 @@ "x-appwrite": { "method": "get", "group": "teams", - "weight": 163, + "weight": 111, "cookies": false, "type": "", "demo": "teams\/get.md", @@ -43222,7 +43479,7 @@ "x-appwrite": { "method": "updateName", "group": "teams", - "weight": 165, + "weight": 113, "cookies": false, "type": "", "demo": "teams\/update-name.md", @@ -43298,7 +43555,7 @@ "x-appwrite": { "method": "delete", "group": "teams", - "weight": 167, + "weight": 115, "cookies": false, "type": "", "demo": "teams\/delete.md", @@ -43364,7 +43621,7 @@ "x-appwrite": { "method": "listLogs", "group": "logs", - "weight": 174, + "weight": 122, "cookies": false, "type": "", "demo": "teams\/list-logs.md", @@ -43449,7 +43706,7 @@ "x-appwrite": { "method": "listMemberships", "group": "memberships", - "weight": 169, + "weight": 117, "cookies": false, "type": "", "demo": "teams\/list-memberships.md", @@ -43548,7 +43805,7 @@ "x-appwrite": { "method": "createMembership", "group": "memberships", - "weight": 168, + "weight": 116, "cookies": false, "type": "", "demo": "teams\/create-membership.md", @@ -43597,7 +43854,8 @@ "email": { "type": "string", "description": "Email of the new team member.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "userId": { "type": "string", @@ -43607,7 +43865,8 @@ "phone": { "type": "string", "description": "Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "roles": { "type": "array", @@ -43627,7 +43886,8 @@ "url": { "type": "string", "description": "URL to redirect the user back to your app from the invitation email. This parameter is not required when an API key is supplied. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.", - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" }, "name": { "type": "string", @@ -43668,7 +43928,7 @@ "x-appwrite": { "method": "getMembership", "group": "memberships", - "weight": 170, + "weight": 118, "cookies": false, "type": "", "demo": "teams\/get-membership.md", @@ -43742,7 +44002,7 @@ "x-appwrite": { "method": "updateMembership", "group": "memberships", - "weight": 171, + "weight": 119, "cookies": false, "type": "", "demo": "teams\/update-membership.md", @@ -43838,7 +44098,7 @@ "x-appwrite": { "method": "deleteMembership", "group": "memberships", - "weight": 173, + "weight": 121, "cookies": false, "type": "", "demo": "teams\/delete-membership.md", @@ -43914,7 +44174,7 @@ "x-appwrite": { "method": "updateMembershipStatus", "group": "memberships", - "weight": 172, + "weight": 120, "cookies": false, "type": "", "demo": "teams\/update-membership-status.md", @@ -44013,7 +44273,7 @@ "x-appwrite": { "method": "getPrefs", "group": "teams", - "weight": 164, + "weight": 112, "cookies": false, "type": "", "demo": "teams\/get-prefs.md", @@ -44075,7 +44335,7 @@ "x-appwrite": { "method": "updatePrefs", "group": "teams", - "weight": 166, + "weight": 114, "cookies": false, "type": "", "demo": "teams\/update-prefs.md", @@ -44158,7 +44418,7 @@ "x-appwrite": { "method": "list", "group": "files", - "weight": 523, + "weight": 517, "cookies": false, "type": "", "demo": "tokens\/list.md", @@ -44252,7 +44512,7 @@ "x-appwrite": { "method": "createFileToken", "group": "files", - "weight": 521, + "weight": 515, "cookies": false, "type": "", "demo": "tokens\/create-file-token.md", @@ -44341,7 +44601,7 @@ "x-appwrite": { "method": "get", "group": "tokens", - "weight": 522, + "weight": 516, "cookies": false, "type": "", "demo": "tokens\/get.md", @@ -44401,7 +44661,7 @@ "x-appwrite": { "method": "update", "group": "tokens", - "weight": 524, + "weight": 518, "cookies": false, "type": "", "demo": "tokens\/update.md", @@ -44471,7 +44731,7 @@ "x-appwrite": { "method": "delete", "group": "tokens", - "weight": 525, + "weight": 519, "cookies": false, "type": "", "demo": "tokens\/delete.md", @@ -44533,7 +44793,7 @@ "x-appwrite": { "method": "list", "group": "users", - "weight": 184, + "weight": 132, "cookies": false, "type": "", "demo": "users\/list.md", @@ -44619,7 +44879,7 @@ "x-appwrite": { "method": "create", "group": "users", - "weight": 175, + "weight": 123, "cookies": false, "type": "", "demo": "users\/create.md", @@ -44659,12 +44919,14 @@ "type": "string", "description": "User email.", "x-example": "email@example.com", + "format": "email", "x-nullable": true }, "phone": { "type": "string", "description": "Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", "x-example": "+12065550100", + "format": "phone", "x-nullable": true }, "password": { @@ -44711,7 +44973,7 @@ "x-appwrite": { "method": "createArgon2User", "group": "users", - "weight": 178, + "weight": 126, "cookies": false, "type": "", "demo": "users\/create-argon-2-user.md", @@ -44750,12 +45012,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using Argon2.", - "x-example": "password" + "x-example": "password", + "format": "password" }, "name": { "type": "string", @@ -44798,7 +45062,7 @@ "x-appwrite": { "method": "createBcryptUser", "group": "users", - "weight": 176, + "weight": 124, "cookies": false, "type": "", "demo": "users\/create-bcrypt-user.md", @@ -44837,12 +45101,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using Bcrypt.", - "x-example": "password" + "x-example": "password", + "format": "password" }, "name": { "type": "string", @@ -44885,7 +45151,7 @@ "x-appwrite": { "method": "listIdentities", "group": "identities", - "weight": 192, + "weight": 140, "cookies": false, "type": "", "demo": "users\/list-identities.md", @@ -44966,7 +45232,7 @@ "x-appwrite": { "method": "deleteIdentity", "group": "identities", - "weight": 215, + "weight": 163, "cookies": false, "type": "", "demo": "users\/delete-identity.md", @@ -45029,7 +45295,7 @@ "x-appwrite": { "method": "createMD5User", "group": "users", - "weight": 177, + "weight": 125, "cookies": false, "type": "", "demo": "users\/create-md-5-user.md", @@ -45068,12 +45334,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using MD5.", - "x-example": "password" + "x-example": "password", + "format": "password" }, "name": { "type": "string", @@ -45116,7 +45384,7 @@ "x-appwrite": { "method": "createPHPassUser", "group": "users", - "weight": 180, + "weight": 128, "cookies": false, "type": "", "demo": "users\/create-ph-pass-user.md", @@ -45155,12 +45423,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using PHPass.", - "x-example": "password" + "x-example": "password", + "format": "password" }, "name": { "type": "string", @@ -45203,7 +45473,7 @@ "x-appwrite": { "method": "createScryptUser", "group": "users", - "weight": 181, + "weight": 129, "cookies": false, "type": "", "demo": "users\/create-scrypt-user.md", @@ -45242,12 +45512,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using Scrypt.", - "x-example": "password" + "x-example": "password", + "format": "password" }, "passwordSalt": { "type": "string", @@ -45257,22 +45529,26 @@ "passwordCpu": { "type": "integer", "description": "Optional CPU cost used to hash password.", - "x-example": null + "x-example": null, + "format": "int32" }, "passwordMemory": { "type": "integer", "description": "Optional memory cost used to hash password.", - "x-example": null + "x-example": null, + "format": "int32" }, "passwordParallel": { "type": "integer", "description": "Optional parallelization cost used to hash password.", - "x-example": null + "x-example": null, + "format": "int32" }, "passwordLength": { "type": "integer", "description": "Optional hash length used to hash password.", - "x-example": null + "x-example": null, + "format": "int32" }, "name": { "type": "string", @@ -45320,7 +45596,7 @@ "x-appwrite": { "method": "createScryptModifiedUser", "group": "users", - "weight": 182, + "weight": 130, "cookies": false, "type": "", "demo": "users\/create-scrypt-modified-user.md", @@ -45359,12 +45635,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using Scrypt Modified.", - "x-example": "password" + "x-example": "password", + "format": "password" }, "passwordSalt": { "type": "string", @@ -45425,7 +45703,7 @@ "x-appwrite": { "method": "createSHAUser", "group": "users", - "weight": 179, + "weight": 127, "cookies": false, "type": "", "demo": "users\/create-sha-user.md", @@ -45464,12 +45742,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using SHA.", - "x-example": "password" + "x-example": "password", + "format": "password" }, "passwordVersion": { "type": "string", @@ -45532,7 +45812,7 @@ "x-appwrite": { "method": "getUsage", "group": null, - "weight": 217, + "weight": 165, "cookies": false, "type": "", "demo": "users\/get-usage.md", @@ -45605,7 +45885,7 @@ "x-appwrite": { "method": "get", "group": "users", - "weight": 185, + "weight": 133, "cookies": false, "type": "", "demo": "users\/get.md", @@ -45659,7 +45939,7 @@ "x-appwrite": { "method": "delete", "group": "users", - "weight": 213, + "weight": 161, "cookies": false, "type": "", "demo": "users\/delete.md", @@ -45722,7 +46002,7 @@ "x-appwrite": { "method": "updateEmail", "group": "users", - "weight": 198, + "weight": 146, "cookies": false, "type": "", "demo": "users\/update-email.md", @@ -45768,7 +46048,8 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" } }, "required": [ @@ -45804,7 +46085,7 @@ "x-appwrite": { "method": "createJWT", "group": "sessions", - "weight": 216, + "weight": 164, "cookies": false, "type": "", "demo": "users\/create-jwt.md", @@ -45855,7 +46136,8 @@ "duration": { "type": "integer", "description": "Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds.", - "x-example": 0 + "x-example": 0, + "format": "int32" } } } @@ -45888,7 +46170,7 @@ "x-appwrite": { "method": "updateLabels", "group": "users", - "weight": 194, + "weight": 142, "cookies": false, "type": "", "demo": "users\/update-labels.md", @@ -45973,7 +46255,7 @@ "x-appwrite": { "method": "listLogs", "group": "logs", - "weight": 190, + "weight": 138, "cookies": false, "type": "", "demo": "users\/list-logs.md", @@ -46060,7 +46342,7 @@ "x-appwrite": { "method": "listMemberships", "group": "memberships", - "weight": 189, + "weight": 137, "cookies": false, "type": "", "demo": "users\/list-memberships.md", @@ -46158,7 +46440,7 @@ "x-appwrite": { "method": "updateMfa", "group": "users", - "weight": 203, + "weight": 151, "cookies": false, "type": "", "demo": "users\/update-mfa.md", @@ -46293,7 +46575,7 @@ "x-appwrite": { "method": "deleteMfaAuthenticator", "group": "mfa", - "weight": 208, + "weight": 156, "cookies": false, "type": "", "demo": "users\/delete-mfa-authenticator.md", @@ -46429,7 +46711,7 @@ "x-appwrite": { "method": "listMfaFactors", "group": "mfa", - "weight": 204, + "weight": 152, "cookies": false, "type": "", "demo": "users\/list-mfa-factors.md", @@ -46548,7 +46830,7 @@ "x-appwrite": { "method": "getMfaRecoveryCodes", "group": "mfa", - "weight": 205, + "weight": 153, "cookies": false, "type": "", "demo": "users\/get-mfa-recovery-codes.md", @@ -46665,7 +46947,7 @@ "x-appwrite": { "method": "updateMfaRecoveryCodes", "group": "mfa", - "weight": 207, + "weight": 155, "cookies": false, "type": "", "demo": "users\/update-mfa-recovery-codes.md", @@ -46782,7 +47064,7 @@ "x-appwrite": { "method": "createMfaRecoveryCodes", "group": "mfa", - "weight": 206, + "weight": 154, "cookies": false, "type": "", "demo": "users\/create-mfa-recovery-codes.md", @@ -46901,7 +47183,7 @@ "x-appwrite": { "method": "updateName", "group": "users", - "weight": 196, + "weight": 144, "cookies": false, "type": "", "demo": "users\/update-name.md", @@ -46983,7 +47265,7 @@ "x-appwrite": { "method": "updatePassword", "group": "users", - "weight": 197, + "weight": 145, "cookies": false, "type": "", "demo": "users\/update-password.md", @@ -47065,7 +47347,7 @@ "x-appwrite": { "method": "updatePhone", "group": "users", - "weight": 199, + "weight": 147, "cookies": false, "type": "", "demo": "users\/update-phone.md", @@ -47111,7 +47393,8 @@ "number": { "type": "string", "description": "User phone number.", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" } }, "required": [ @@ -47147,7 +47430,7 @@ "x-appwrite": { "method": "getPrefs", "group": "users", - "weight": 186, + "weight": 134, "cookies": false, "type": "", "demo": "users\/get-prefs.md", @@ -47208,7 +47491,7 @@ "x-appwrite": { "method": "updatePrefs", "group": "users", - "weight": 201, + "weight": 149, "cookies": false, "type": "", "demo": "users\/update-prefs.md", @@ -47290,7 +47573,7 @@ "x-appwrite": { "method": "listSessions", "group": "sessions", - "weight": 188, + "weight": 136, "cookies": false, "type": "", "demo": "users\/list-sessions.md", @@ -47362,7 +47645,7 @@ "x-appwrite": { "method": "createSession", "group": "sessions", - "weight": 209, + "weight": 157, "cookies": false, "type": "", "demo": "users\/create-session.md", @@ -47416,7 +47699,7 @@ "x-appwrite": { "method": "deleteSessions", "group": "sessions", - "weight": 212, + "weight": 160, "cookies": false, "type": "", "demo": "users\/delete-sessions.md", @@ -47472,7 +47755,7 @@ "x-appwrite": { "method": "deleteSession", "group": "sessions", - "weight": 211, + "weight": 159, "cookies": false, "type": "", "demo": "users\/delete-session.md", @@ -47545,7 +47828,7 @@ "x-appwrite": { "method": "updateStatus", "group": "users", - "weight": 193, + "weight": 141, "cookies": false, "type": "", "demo": "users\/update-status.md", @@ -47627,7 +47910,7 @@ "x-appwrite": { "method": "listTargets", "group": "targets", - "weight": 191, + "weight": 139, "cookies": false, "type": "", "demo": "users\/list-targets.md", @@ -47712,7 +47995,7 @@ "x-appwrite": { "method": "createTarget", "group": "targets", - "weight": 183, + "weight": 131, "cookies": false, "type": "", "demo": "users\/create-target.md", @@ -47823,7 +48106,7 @@ "x-appwrite": { "method": "getTarget", "group": "targets", - "weight": 187, + "weight": 135, "cookies": false, "type": "", "demo": "users\/get-target.md", @@ -47894,7 +48177,7 @@ "x-appwrite": { "method": "updateTarget", "group": "targets", - "weight": 202, + "weight": 150, "cookies": false, "type": "", "demo": "users\/update-target.md", @@ -47984,7 +48267,7 @@ "x-appwrite": { "method": "deleteTarget", "group": "targets", - "weight": 214, + "weight": 162, "cookies": false, "type": "", "demo": "users\/delete-target.md", @@ -48057,7 +48340,7 @@ "x-appwrite": { "method": "createToken", "group": "sessions", - "weight": 210, + "weight": 158, "cookies": false, "type": "", "demo": "users\/create-token.md", @@ -48103,12 +48386,14 @@ "length": { "type": "integer", "description": "Token length in characters. The default length is 6 characters", - "x-example": 4 + "x-example": 4, + "format": "int32" }, "expire": { "type": "integer", "description": "Token expiration period in seconds. The default expiration is 15 minutes.", - "x-example": 60 + "x-example": 60, + "format": "int32" } } } @@ -48141,7 +48426,7 @@ "x-appwrite": { "method": "updateEmailVerification", "group": "users", - "weight": 200, + "weight": 148, "cookies": false, "type": "", "demo": "users\/update-email-verification.md", @@ -48223,7 +48508,7 @@ "x-appwrite": { "method": "updatePhoneVerification", "group": "users", - "weight": 195, + "weight": 143, "cookies": false, "type": "", "demo": "users\/update-phone-verification.md", @@ -48305,7 +48590,7 @@ "x-appwrite": { "method": "createRepositoryDetection", "group": "repositories", - "weight": 221, + "weight": 169, "cookies": false, "type": "", "demo": "vcs\/create-repository-detection.md", @@ -48402,7 +48687,7 @@ "x-appwrite": { "method": "listRepositories", "group": "repositories", - "weight": 222, + "weight": 170, "cookies": false, "type": "", "demo": "vcs\/list-repositories.md", @@ -48501,7 +48786,7 @@ "x-appwrite": { "method": "createRepository", "group": "repositories", - "weight": 223, + "weight": 171, "cookies": false, "type": "", "demo": "vcs\/create-repository.md", @@ -48587,7 +48872,7 @@ "x-appwrite": { "method": "getRepository", "group": "repositories", - "weight": 224, + "weight": 172, "cookies": false, "type": "", "demo": "vcs\/get-repository.md", @@ -48658,7 +48943,7 @@ "x-appwrite": { "method": "listRepositoryBranches", "group": "repositories", - "weight": 225, + "weight": 173, "cookies": false, "type": "", "demo": "vcs\/list-repository-branches.md", @@ -48729,7 +49014,7 @@ "x-appwrite": { "method": "getRepositoryContents", "group": "repositories", - "weight": 220, + "weight": 168, "cookies": false, "type": "", "demo": "vcs\/get-repository-contents.md", @@ -48815,7 +49100,7 @@ "x-appwrite": { "method": "updateExternalDeployments", "group": "repositories", - "weight": 230, + "weight": 178, "cookies": false, "type": "", "demo": "vcs\/update-external-deployments.md", @@ -48905,7 +49190,7 @@ "x-appwrite": { "method": "listInstallations", "group": "installations", - "weight": 227, + "weight": 175, "cookies": false, "type": "", "demo": "vcs\/list-installations.md", @@ -48991,7 +49276,7 @@ "x-appwrite": { "method": "getInstallation", "group": "installations", - "weight": 228, + "weight": 176, "cookies": false, "type": "", "demo": "vcs\/get-installation.md", @@ -49043,7 +49328,7 @@ "x-appwrite": { "method": "deleteInstallation", "group": "installations", - "weight": 229, + "weight": 177, "cookies": false, "type": "", "demo": "vcs\/delete-installation.md", @@ -49144,7 +49429,7 @@ }, { "name": "console", - "description": "The Console service allows you to interact with console relevant informations." + "description": "The Console service allows you to interact with console relevant information." }, { "name": "migrations", @@ -50293,6 +50578,34 @@ "variables": "" } }, + "healthStatusList": { + "description": "Status List", + "type": "object", + "properties": { + "total": { + "type": "integer", + "description": "Total number of statuses that matched your query.", + "x-example": 5, + "format": "int32" + }, + "statuses": { + "type": "array", + "description": "List of statuses.", + "items": { + "$ref": "#\/components\/schemas\/healthStatus" + }, + "x-example": "" + } + }, + "required": [ + "total", + "statuses" + ], + "example": { + "total": 5, + "statuses": "" + } + }, "proxyRuleList": { "description": "Rule List", "type": "object", @@ -51011,14 +51324,14 @@ "type": "integer", "description": "Minimum value to enforce for new documents.", "x-example": 1, - "format": "int32", + "format": "int64", "nullable": true }, "max": { "type": "integer", "description": "Maximum value to enforce for new documents.", "x-example": 10, - "format": "int32", + "format": "int64", "nullable": true }, "default": { @@ -52460,14 +52773,14 @@ "type": "integer", "description": "Minimum value to enforce for new documents.", "x-example": 1, - "format": "int32", + "format": "int64", "nullable": true }, "max": { "type": "integer", "description": "Maximum value to enforce for new documents.", "x-example": 10, - "format": "int32", + "format": "int64", "nullable": true }, "default": { @@ -54957,6 +55270,16 @@ "description": "Total number of chunks uploaded", "x-example": 17890, "format": "int32" + }, + "encryption": { + "type": "boolean", + "description": "Whether file contents are encrypted at rest.", + "x-example": true + }, + "compression": { + "type": "string", + "description": "Compression algorithm used for the file. Will be one of none, [gzip](https:\/\/en.wikipedia.org\/wiki\/Gzip), or [zstd](https:\/\/en.wikipedia.org\/wiki\/Zstd).", + "x-example": "gzip" } }, "required": [ @@ -54970,7 +55293,9 @@ "mimeType", "sizeOriginal", "chunksTotal", - "chunksUploaded" + "chunksUploaded", + "encryption", + "compression" ], "example": { "$id": "5e5ea5c16897e", @@ -54985,7 +55310,9 @@ "mimeType": "image\/png", "sizeOriginal": 17890, "chunksTotal": 17890, - "chunksUploaded": 17890 + "chunksUploaded": 17890, + "encryption": true, + "compression": "gzip" } }, "bucket": { @@ -55051,7 +55378,7 @@ }, "compression": { "type": "string", - "description": "Compression algorithm choosen for compression. Will be one of none, [gzip](https:\/\/en.wikipedia.org\/wiki\/Gzip), or [zstd](https:\/\/en.wikipedia.org\/wiki\/Zstd).", + "description": "Compression algorithm chosen for compression. Will be one of none, [gzip](https:\/\/en.wikipedia.org\/wiki\/Gzip), or [zstd](https:\/\/en.wikipedia.org\/wiki\/Zstd).", "x-example": "gzip" }, "encryption": { @@ -55068,6 +55395,12 @@ "type": "boolean", "description": "Image transformations are enabled.", "x-example": false + }, + "totalSize": { + "type": "integer", + "description": "Total size of this bucket in bytes.", + "x-example": 128, + "format": "int32" } }, "required": [ @@ -55083,7 +55416,8 @@ "compression", "encryption", "antivirus", - "transformations" + "transformations", + "totalSize" ], "example": { "$id": "5e5ea5c16897e", @@ -55103,7 +55437,8 @@ "compression": "gzip", "encryption": false, "antivirus": false, - "transformations": false + "transformations": false, + "totalSize": 128 } }, "resourceToken": { @@ -56918,13 +57253,14 @@ }, "status": { "type": "string", - "description": "The deployment status. Possible values are \"waiting\", \"processing\", \"building\", \"ready\", and \"failed\".", + "description": "The deployment status. Possible values are \"waiting\", \"processing\", \"building\", \"ready\", \"canceled\" and \"failed\".", "x-example": "ready", "enum": [ "waiting", "processing", "building", "ready", + "canceled", "failed" ] }, @@ -57470,6 +57806,16 @@ "description": "Last ping datetime in ISO 8601 format.", "x-example": "2020-10-15T06:38:00.000+00:00" }, + "labels": { + "type": "array", + "description": "Labels for the project.", + "items": { + "type": "string" + }, + "x-example": [ + "vip" + ] + }, "authEmailPassword": { "type": "boolean", "description": "Email\/Password auth method status", @@ -57614,6 +57960,7 @@ "smtpSecure", "pingCount", "pingedAt", + "labels", "authEmailPassword", "authUsersAuthMagicURL", "authEmailOtp", @@ -57682,6 +58029,9 @@ "smtpSecure": "tls", "pingCount": 1, "pingedAt": "2020-10-15T06:38:00.000+00:00", + "labels": [ + "vip" + ], "authEmailPassword": true, "authUsersAuthMagicURL": true, "authEmailOtp": true, @@ -59635,160 +59985,6 @@ "description": "Time range of the usage stats.", "x-example": "30d" }, - "deploymentsTotal": { - "type": "integer", - "description": "Total aggregated number of functions deployments.", - "x-example": 0, - "format": "int32" - }, - "deploymentsStorageTotal": { - "type": "integer", - "description": "Total aggregated sum of functions deployment storage.", - "x-example": 0, - "format": "int32" - }, - "buildsTotal": { - "type": "integer", - "description": "Total aggregated number of functions build.", - "x-example": 0, - "format": "int32" - }, - "buildsStorageTotal": { - "type": "integer", - "description": "total aggregated sum of functions build storage.", - "x-example": 0, - "format": "int32" - }, - "buildsTimeTotal": { - "type": "integer", - "description": "Total aggregated sum of functions build compute time.", - "x-example": 0, - "format": "int32" - }, - "buildsMbSecondsTotal": { - "type": "integer", - "description": "Total aggregated sum of functions build mbSeconds.", - "x-example": 0, - "format": "int32" - }, - "executionsTotal": { - "type": "integer", - "description": "Total aggregated number of functions execution.", - "x-example": 0, - "format": "int32" - }, - "executionsTimeTotal": { - "type": "integer", - "description": "Total aggregated sum of functions execution compute time.", - "x-example": 0, - "format": "int32" - }, - "executionsMbSecondsTotal": { - "type": "integer", - "description": "Total aggregated sum of functions execution mbSeconds.", - "x-example": 0, - "format": "int32" - }, - "deployments": { - "type": "array", - "description": "Aggregated number of functions deployment per period.", - "items": { - "$ref": "#\/components\/schemas\/metric" - }, - "x-example": [] - }, - "deploymentsStorage": { - "type": "array", - "description": "Aggregated number of functions deployment storage per period.", - "items": { - "$ref": "#\/components\/schemas\/metric" - }, - "x-example": [] - }, - "buildsSuccessTotal": { - "type": "integer", - "description": "Total aggregated number of successful function builds.", - "x-example": 0, - "format": "int32" - }, - "buildsFailedTotal": { - "type": "integer", - "description": "Total aggregated number of failed function builds.", - "x-example": 0, - "format": "int32" - }, - "builds": { - "type": "array", - "description": "Aggregated number of functions build per period.", - "items": { - "$ref": "#\/components\/schemas\/metric" - }, - "x-example": [] - }, - "buildsStorage": { - "type": "array", - "description": "Aggregated sum of functions build storage per period.", - "items": { - "$ref": "#\/components\/schemas\/metric" - }, - "x-example": [] - }, - "buildsTime": { - "type": "array", - "description": "Aggregated sum of functions build compute time per period.", - "items": { - "$ref": "#\/components\/schemas\/metric" - }, - "x-example": [] - }, - "buildsMbSeconds": { - "type": "array", - "description": "Aggregated sum of functions build mbSeconds per period.", - "items": { - "$ref": "#\/components\/schemas\/metric" - }, - "x-example": [] - }, - "executions": { - "type": "array", - "description": "Aggregated number of functions execution per period.", - "items": { - "$ref": "#\/components\/schemas\/metric" - }, - "x-example": [] - }, - "executionsTime": { - "type": "array", - "description": "Aggregated number of functions execution compute time per period.", - "items": { - "$ref": "#\/components\/schemas\/metric" - }, - "x-example": [] - }, - "executionsMbSeconds": { - "type": "array", - "description": "Aggregated number of functions mbSeconds per period.", - "items": { - "$ref": "#\/components\/schemas\/metric" - }, - "x-example": [] - }, - "buildsSuccess": { - "type": "array", - "description": "Aggregated number of successful function builds per period.", - "items": { - "$ref": "#\/components\/schemas\/metric" - }, - "x-example": [] - }, - "buildsFailed": { - "type": "array", - "description": "Aggregated number of failed function builds per period.", - "items": { - "$ref": "#\/components\/schemas\/metric" - }, - "x-example": [] - }, "sitesTotal": { "type": "integer", "description": "Total aggregated number of sites.", @@ -59803,6 +59999,60 @@ }, "x-example": [] }, + "deploymentsTotal": { + "type": "integer", + "description": "Total aggregated number of sites deployments.", + "x-example": 0, + "format": "int32" + }, + "deploymentsStorageTotal": { + "type": "integer", + "description": "Total aggregated sum of sites deployment storage.", + "x-example": 0, + "format": "int32" + }, + "buildsTotal": { + "type": "integer", + "description": "Total aggregated number of sites build.", + "x-example": 0, + "format": "int32" + }, + "buildsStorageTotal": { + "type": "integer", + "description": "total aggregated sum of sites build storage.", + "x-example": 0, + "format": "int32" + }, + "buildsTimeTotal": { + "type": "integer", + "description": "Total aggregated sum of sites build compute time.", + "x-example": 0, + "format": "int32" + }, + "buildsMbSecondsTotal": { + "type": "integer", + "description": "Total aggregated sum of sites build mbSeconds.", + "x-example": 0, + "format": "int32" + }, + "executionsTotal": { + "type": "integer", + "description": "Total aggregated number of sites execution.", + "x-example": 0, + "format": "int32" + }, + "executionsTimeTotal": { + "type": "integer", + "description": "Total aggregated sum of sites execution compute time.", + "x-example": 0, + "format": "int32" + }, + "executionsMbSecondsTotal": { + "type": "integer", + "description": "Total aggregated sum of sites execution mbSeconds.", + "x-example": 0, + "format": "int32" + }, "requestsTotal": { "type": "integer", "description": "Total aggregated number of requests.", @@ -59844,10 +60094,112 @@ "$ref": "#\/components\/schemas\/metric" }, "x-example": [] + }, + "deployments": { + "type": "array", + "description": "Aggregated number of sites deployment per period.", + "items": { + "$ref": "#\/components\/schemas\/metric" + }, + "x-example": [] + }, + "deploymentsStorage": { + "type": "array", + "description": "Aggregated number of sites deployment storage per period.", + "items": { + "$ref": "#\/components\/schemas\/metric" + }, + "x-example": [] + }, + "buildsSuccessTotal": { + "type": "integer", + "description": "Total aggregated number of successful site builds.", + "x-example": 0, + "format": "int32" + }, + "buildsFailedTotal": { + "type": "integer", + "description": "Total aggregated number of failed site builds.", + "x-example": 0, + "format": "int32" + }, + "builds": { + "type": "array", + "description": "Aggregated number of sites build per period.", + "items": { + "$ref": "#\/components\/schemas\/metric" + }, + "x-example": [] + }, + "buildsStorage": { + "type": "array", + "description": "Aggregated sum of sites build storage per period.", + "items": { + "$ref": "#\/components\/schemas\/metric" + }, + "x-example": [] + }, + "buildsTime": { + "type": "array", + "description": "Aggregated sum of sites build compute time per period.", + "items": { + "$ref": "#\/components\/schemas\/metric" + }, + "x-example": [] + }, + "buildsMbSeconds": { + "type": "array", + "description": "Aggregated sum of sites build mbSeconds per period.", + "items": { + "$ref": "#\/components\/schemas\/metric" + }, + "x-example": [] + }, + "executions": { + "type": "array", + "description": "Aggregated number of sites execution per period.", + "items": { + "$ref": "#\/components\/schemas\/metric" + }, + "x-example": [] + }, + "executionsTime": { + "type": "array", + "description": "Aggregated number of sites execution compute time per period.", + "items": { + "$ref": "#\/components\/schemas\/metric" + }, + "x-example": [] + }, + "executionsMbSeconds": { + "type": "array", + "description": "Aggregated number of sites mbSeconds per period.", + "items": { + "$ref": "#\/components\/schemas\/metric" + }, + "x-example": [] + }, + "buildsSuccess": { + "type": "array", + "description": "Aggregated number of successful site builds per period.", + "items": { + "$ref": "#\/components\/schemas\/metric" + }, + "x-example": [] + }, + "buildsFailed": { + "type": "array", + "description": "Aggregated number of failed site builds per period.", + "items": { + "$ref": "#\/components\/schemas\/metric" + }, + "x-example": [] } }, "required": [ "range", + "sitesTotal", + "sites", "deploymentsTotal", "deploymentsStorageTotal", "buildsTotal", @@ -59857,6 +60209,12 @@ "executionsTotal", "executionsTimeTotal", "executionsMbSecondsTotal", + "requestsTotal", + "requests", + "inboundTotal", + "inbound", + "outboundTotal", + "outbound", "deployments", "deploymentsStorage", "buildsSuccessTotal", @@ -59869,18 +60227,12 @@ "executionsTime", "executionsMbSeconds", "buildsSuccess", - "buildsFailed", - "sitesTotal", - "sites", - "requestsTotal", - "requests", - "inboundTotal", - "inbound", - "outboundTotal", - "outbound" + "buildsFailed" ], "example": { "range": "30d", + "sitesTotal": 0, + "sites": [], "deploymentsTotal": 0, "deploymentsStorageTotal": 0, "buildsTotal": 0, @@ -59890,6 +60242,12 @@ "executionsTotal": 0, "executionsTimeTotal": 0, "executionsMbSecondsTotal": 0, + "requestsTotal": 0, + "requests": [], + "inboundTotal": 0, + "inbound": [], + "outboundTotal": 0, + "outbound": [], "deployments": [], "deploymentsStorage": [], "buildsSuccessTotal": 0, @@ -59902,15 +60260,7 @@ "executionsTime": [], "executionsMbSeconds": [], "buildsSuccess": [], - "buildsFailed": [], - "sitesTotal": 0, - "sites": [], - "requestsTotal": 0, - "requests": [], - "inboundTotal": 0, - "inbound": [], - "outboundTotal": 0, - "outbound": [] + "buildsFailed": [] } }, "usageSite": { @@ -61183,7 +61533,7 @@ "status": { "type": "string", "description": "Status of delivery.", - "x-example": "Message status can be one of the following: draft, processing, scheduled, sent, or failed.", + "x-example": "processing", "enum": [ "draft", "processing", @@ -61229,7 +61579,7 @@ "subject": "Welcome to Appwrite", "content": "Hi there, welcome to Appwrite family." }, - "status": "Message status can be one of the following: draft, processing, scheduled, sent, or failed." + "status": "processing" } }, "topic": { @@ -61759,6 +62109,12 @@ "x-appwrite": { "demo": "" } + }, + "Cookie": { + "type": "apiKey", + "name": "Cookie", + "description": "The user cookie to authenticate with", + "in": "header" } } }, diff --git a/app/config/specs/open-api3-1.8.x-server.json b/app/config/specs/open-api3-1.8.x-server.json index 45a67ef9aa..6b4e836a43 100644 --- a/app/config/specs/open-api3-1.8.x-server.json +++ b/app/config/specs/open-api3-1.8.x-server.json @@ -1,7 +1,7 @@ { "openapi": "3.0.0", "info": { - "version": "1.8.0", + "version": "1.8.1", "title": "Appwrite", "description": "Appwrite backend as a service cuts up to 70% of the time and costs required for building a modern application. We abstract and simplify common development tasks behind a REST APIs, to help you develop your app in a fast and secure way. For full API documentation and tutorials go to [https:\/\/appwrite.io\/docs](https:\/\/appwrite.io\/docs)", "termsOfService": "https:\/\/appwrite.io\/policy\/terms", @@ -48,7 +48,7 @@ "x-appwrite": { "method": "get", "group": "account", - "weight": 10, + "weight": 9, "cookies": false, "type": "", "demo": "account\/get.md", @@ -100,7 +100,7 @@ "x-appwrite": { "method": "create", "group": "account", - "weight": 9, + "weight": 8, "cookies": false, "type": "", "demo": "account\/create.md", @@ -142,7 +142,8 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", @@ -190,7 +191,7 @@ "x-appwrite": { "method": "updateEmail", "group": "account", - "weight": 35, + "weight": 34, "cookies": false, "type": "", "demo": "account\/update-email.md", @@ -227,12 +228,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password. Must be at least 8 chars.", - "x-example": "password" + "x-example": "password", + "format": "password" } }, "required": [ @@ -269,7 +272,7 @@ "x-appwrite": { "method": "listIdentities", "group": "identities", - "weight": 48, + "weight": 47, "cookies": false, "type": "", "demo": "account\/list-identities.md", @@ -342,7 +345,7 @@ "x-appwrite": { "method": "deleteIdentity", "group": "identities", - "weight": 49, + "weight": 48, "cookies": false, "type": "", "demo": "account\/delete-identity.md", @@ -408,12 +411,12 @@ "x-appwrite": { "method": "createJWT", "group": "tokens", - "weight": 30, + "weight": 29, "cookies": false, "type": "", "demo": "account\/create-jwt.md", - "rate-limit": 100, - "rate-time": 3600, + "rate-limit": 120, + "rate-time": 60, "rate-key": "url:{url},userId:{userId}", "scope": "account", "platforms": [ @@ -435,7 +438,24 @@ "Session": [], "JWT": [] } - ] + ], + "requestBody": { + "content": { + "application\/json": { + "schema": { + "type": "object", + "properties": { + "duration": { + "type": "integer", + "description": "Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds.", + "x-example": 0, + "format": "int32" + } + } + } + } + } + } } }, "\/account\/logs": { @@ -462,7 +482,7 @@ "x-appwrite": { "method": "listLogs", "group": "logs", - "weight": 32, + "weight": 31, "cookies": false, "type": "", "demo": "account\/list-logs.md", @@ -542,7 +562,7 @@ "x-appwrite": { "method": "updateMFA", "group": "mfa", - "weight": 306, + "weight": 253, "cookies": false, "type": "", "demo": "account\/update-mfa.md", @@ -615,7 +635,7 @@ "x-appwrite": { "method": "createMfaAuthenticator", "group": "mfa", - "weight": 308, + "weight": 255, "cookies": false, "type": "", "demo": "account\/create-mfa-authenticator.md", @@ -742,7 +762,7 @@ "x-appwrite": { "method": "updateMfaAuthenticator", "group": "mfa", - "weight": 309, + "weight": 256, "cookies": false, "type": "", "demo": "account\/update-mfa-authenticator.md", @@ -885,7 +905,7 @@ "x-appwrite": { "method": "deleteMfaAuthenticator", "group": "mfa", - "weight": 310, + "weight": 257, "cookies": false, "type": "", "demo": "account\/delete-mfa-authenticator.md", @@ -1012,7 +1032,7 @@ "x-appwrite": { "method": "createMfaChallenge", "group": "mfa", - "weight": 314, + "weight": 261, "cookies": false, "type": "", "demo": "account\/create-mfa-challenge.md", @@ -1149,7 +1169,7 @@ "x-appwrite": { "method": "updateMfaChallenge", "group": "mfa", - "weight": 315, + "weight": 262, "cookies": false, "type": "", "demo": "account\/update-mfa-challenge.md", @@ -1290,7 +1310,7 @@ "x-appwrite": { "method": "listMfaFactors", "group": "mfa", - "weight": 307, + "weight": 254, "cookies": false, "type": "", "demo": "account\/list-mfa-factors.md", @@ -1394,7 +1414,7 @@ "x-appwrite": { "method": "getMfaRecoveryCodes", "group": "mfa", - "weight": 313, + "weight": 260, "cookies": false, "type": "", "demo": "account\/get-mfa-recovery-codes.md", @@ -1496,7 +1516,7 @@ "x-appwrite": { "method": "createMfaRecoveryCodes", "group": "mfa", - "weight": 311, + "weight": 258, "cookies": false, "type": "", "demo": "account\/create-mfa-recovery-codes.md", @@ -1598,7 +1618,7 @@ "x-appwrite": { "method": "updateMfaRecoveryCodes", "group": "mfa", - "weight": 312, + "weight": 259, "cookies": false, "type": "", "demo": "account\/update-mfa-recovery-codes.md", @@ -1702,7 +1722,7 @@ "x-appwrite": { "method": "updateName", "group": "account", - "weight": 33, + "weight": 32, "cookies": false, "type": "", "demo": "account\/update-name.md", @@ -1775,7 +1795,7 @@ "x-appwrite": { "method": "updatePassword", "group": "account", - "weight": 34, + "weight": 33, "cookies": false, "type": "", "demo": "account\/update-password.md", @@ -1817,7 +1837,8 @@ "oldPassword": { "type": "string", "description": "Current user password. Must be at least 8 chars.", - "x-example": "password" + "x-example": "password", + "format": "password" } }, "required": [ @@ -1853,7 +1874,7 @@ "x-appwrite": { "method": "updatePhone", "group": "account", - "weight": 36, + "weight": 35, "cookies": false, "type": "", "demo": "account\/update-phone.md", @@ -1890,12 +1911,14 @@ "phone": { "type": "string", "description": "Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "password": { "type": "string", "description": "User password. Must be at least 8 chars.", - "x-example": "password" + "x-example": "password", + "format": "password" } }, "required": [ @@ -1932,7 +1955,7 @@ "x-appwrite": { "method": "getPrefs", "group": "account", - "weight": 31, + "weight": 30, "cookies": false, "type": "", "demo": "account\/get-prefs.md", @@ -1984,7 +2007,7 @@ "x-appwrite": { "method": "updatePrefs", "group": "account", - "weight": 37, + "weight": 36, "cookies": false, "type": "", "demo": "account\/update-prefs.md", @@ -2057,7 +2080,7 @@ "x-appwrite": { "method": "createRecovery", "group": "recovery", - "weight": 39, + "weight": 38, "cookies": false, "type": "", "demo": "account\/create-recovery.md", @@ -2097,12 +2120,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "url": { "type": "string", "description": "URL to redirect the user back to your app from the recovery email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.", - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" } }, "required": [ @@ -2137,7 +2162,7 @@ "x-appwrite": { "method": "updateRecovery", "group": "recovery", - "weight": 40, + "weight": 39, "cookies": false, "type": "", "demo": "account\/update-recovery.md", @@ -2222,7 +2247,7 @@ "x-appwrite": { "method": "listSessions", "group": "sessions", - "weight": 12, + "weight": 11, "cookies": false, "type": "", "demo": "account\/list-sessions.md", @@ -2267,7 +2292,7 @@ "x-appwrite": { "method": "deleteSessions", "group": "sessions", - "weight": 13, + "weight": 12, "cookies": false, "type": "", "demo": "account\/delete-sessions.md", @@ -2321,7 +2346,7 @@ "x-appwrite": { "method": "createAnonymousSession", "group": "sessions", - "weight": 18, + "weight": 17, "cookies": false, "type": "", "demo": "account\/create-anonymous-session.md", @@ -2375,7 +2400,7 @@ "x-appwrite": { "method": "createEmailPasswordSession", "group": "sessions", - "weight": 17, + "weight": 16, "cookies": false, "type": "", "demo": "account\/create-email-password-session.md", @@ -2412,12 +2437,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password. Must be at least 8 chars.", - "x-example": "password" + "x-example": "password", + "format": "password" } }, "required": [ @@ -2454,7 +2481,7 @@ "x-appwrite": { "method": "updateMagicURLSession", "group": "sessions", - "weight": 27, + "weight": 26, "cookies": false, "type": "", "demo": "account\/update-magic-url-session.md", @@ -2537,7 +2564,7 @@ "x-appwrite": { "method": "updatePhoneSession", "group": "sessions", - "weight": 28, + "weight": 27, "cookies": false, "type": "", "demo": "account\/update-phone-session.md", @@ -2620,7 +2647,7 @@ "x-appwrite": { "method": "createSession", "group": "sessions", - "weight": 19, + "weight": 18, "cookies": false, "type": "", "demo": "account\/create-session.md", @@ -2699,7 +2726,7 @@ "x-appwrite": { "method": "getSession", "group": "sessions", - "weight": 14, + "weight": 13, "cookies": false, "type": "", "demo": "account\/get-session.md", @@ -2763,7 +2790,7 @@ "x-appwrite": { "method": "updateSession", "group": "sessions", - "weight": 16, + "weight": 15, "cookies": false, "type": "", "demo": "account\/update-session.md", @@ -2820,7 +2847,7 @@ "x-appwrite": { "method": "deleteSession", "group": "sessions", - "weight": 15, + "weight": 14, "cookies": false, "type": "", "demo": "account\/delete-session.md", @@ -2886,7 +2913,7 @@ "x-appwrite": { "method": "updateStatus", "group": "account", - "weight": 38, + "weight": 37, "cookies": false, "type": "", "demo": "account\/update-status.md", @@ -2940,7 +2967,7 @@ "x-appwrite": { "method": "createEmailToken", "group": "tokens", - "weight": 26, + "weight": 25, "cookies": false, "type": "", "demo": "account\/create-email-token.md", @@ -2985,7 +3012,8 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "phrase": { "type": "boolean", @@ -3027,7 +3055,7 @@ "x-appwrite": { "method": "createMagicURLToken", "group": "tokens", - "weight": 25, + "weight": 24, "cookies": false, "type": "", "demo": "account\/create-magic-url-token.md", @@ -3072,12 +3100,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "url": { "type": "string", "description": "URL to redirect the user back to your app from the magic URL login. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.", - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" }, "phrase": { "type": "boolean", @@ -3112,7 +3142,7 @@ "x-appwrite": { "method": "createOAuth2Token", "group": "tokens", - "weight": 24, + "weight": 23, "cookies": false, "type": "webAuth", "demo": "account\/create-o-auth-2-token.md", @@ -3187,8 +3217,7 @@ "yammer", "yandex", "zoho", - "zoom", - "mock" + "zoom" ], "x-enum-name": "OAuthProvider", "x-enum-keys": [] @@ -3259,7 +3288,7 @@ "x-appwrite": { "method": "createPhoneToken", "group": "tokens", - "weight": 29, + "weight": 28, "cookies": false, "type": "", "demo": "account\/create-phone-token.md", @@ -3304,7 +3333,8 @@ "phone": { "type": "string", "description": "Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" } }, "required": [ @@ -3341,7 +3371,7 @@ "x-appwrite": { "method": "createEmailVerification", "group": "verification", - "weight": 41, + "weight": 40, "cookies": false, "type": "", "demo": "account\/create-email-verification.md", @@ -3432,7 +3462,8 @@ "url": { "type": "string", "description": "URL to redirect the user back to your app from the verification email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.", - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" } }, "required": [ @@ -3466,7 +3497,7 @@ "x-appwrite": { "method": "updateEmailVerification", "group": "verification", - "weight": 42, + "weight": 41, "cookies": false, "type": "", "demo": "account\/update-email-verification.md", @@ -3603,7 +3634,7 @@ "x-appwrite": { "method": "createPhoneVerification", "group": "verification", - "weight": 43, + "weight": 42, "cookies": false, "type": "", "demo": "account\/create-phone-verification.md", @@ -3658,7 +3689,7 @@ "x-appwrite": { "method": "updatePhoneVerification", "group": "verification", - "weight": 44, + "weight": 43, "cookies": false, "type": "", "demo": "account\/update-phone-verification.md", @@ -3730,7 +3761,7 @@ "x-appwrite": { "method": "getBrowser", "group": null, - "weight": 51, + "weight": 264, "cookies": false, "type": "location", "demo": "avatars\/get-browser.md", @@ -3860,7 +3891,7 @@ "x-appwrite": { "method": "getCreditCard", "group": null, - "weight": 50, + "weight": 263, "cookies": false, "type": "location", "demo": "avatars\/get-credit-card.md", @@ -3996,7 +4027,7 @@ "x-appwrite": { "method": "getFavicon", "group": null, - "weight": 54, + "weight": 267, "cookies": false, "type": "location", "demo": "avatars\/get-favicon.md", @@ -4058,7 +4089,7 @@ "x-appwrite": { "method": "getFlag", "group": null, - "weight": 52, + "weight": 265, "cookies": false, "type": "location", "demo": "avatars\/get-flag.md", @@ -4550,7 +4581,7 @@ "x-appwrite": { "method": "getImage", "group": null, - "weight": 53, + "weight": 266, "cookies": false, "type": "location", "demo": "avatars\/get-image.md", @@ -4636,7 +4667,7 @@ "x-appwrite": { "method": "getInitials", "group": null, - "weight": 56, + "weight": 269, "cookies": false, "type": "location", "demo": "avatars\/get-initials.md", @@ -4732,7 +4763,7 @@ "x-appwrite": { "method": "getQR", "group": null, - "weight": 55, + "weight": 268, "cookies": false, "type": "location", "demo": "avatars\/get-qr.md", @@ -4828,7 +4859,7 @@ "x-appwrite": { "method": "getScreenshot", "group": null, - "weight": 57, + "weight": 270, "cookies": false, "type": "location", "demo": "avatars\/get-screenshot.md", @@ -5550,7 +5581,7 @@ "avif", "gif" ], - "x-enum-name": null, + "x-enum-name": "ImageFormat", "x-enum-keys": [], "default": "" }, @@ -5583,7 +5614,7 @@ "x-appwrite": { "method": "list", "group": "databases", - "weight": 320, + "weight": 278, "cookies": false, "type": "", "demo": "databases\/list.md", @@ -5704,7 +5735,7 @@ "x-appwrite": { "method": "create", "group": "databases", - "weight": 316, + "weight": 274, "cookies": false, "type": "", "demo": "databases\/create.md", @@ -5823,7 +5854,7 @@ "x-appwrite": { "method": "listTransactions", "group": "transactions", - "weight": 380, + "weight": 338, "cookies": false, "type": "", "demo": "databases\/list-transactions.md", @@ -5892,7 +5923,7 @@ "x-appwrite": { "method": "createTransaction", "group": "transactions", - "weight": 376, + "weight": 334, "cookies": false, "type": "", "demo": "databases\/create-transaction.md", @@ -5931,7 +5962,8 @@ "ttl": { "type": "integer", "description": "Seconds before the transaction expires.", - "x-example": 60 + "x-example": 60, + "format": "int32" } } } @@ -5964,7 +5996,7 @@ "x-appwrite": { "method": "getTransaction", "group": "transactions", - "weight": 377, + "weight": 335, "cookies": false, "type": "", "demo": "databases\/get-transaction.md", @@ -6030,7 +6062,7 @@ "x-appwrite": { "method": "updateTransaction", "group": "transactions", - "weight": 378, + "weight": 336, "cookies": false, "type": "", "demo": "databases\/update-transaction.md", @@ -6110,7 +6142,7 @@ "x-appwrite": { "method": "deleteTransaction", "group": "transactions", - "weight": 379, + "weight": 337, "cookies": false, "type": "", "demo": "databases\/delete-transaction.md", @@ -6178,7 +6210,7 @@ "x-appwrite": { "method": "createOperations", "group": "transactions", - "weight": 381, + "weight": 339, "cookies": false, "type": "", "demo": "databases\/create-operations.md", @@ -6265,7 +6297,7 @@ "x-appwrite": { "method": "get", "group": "databases", - "weight": 317, + "weight": 275, "cookies": false, "type": "", "demo": "databases\/get.md", @@ -6361,7 +6393,7 @@ "x-appwrite": { "method": "update", "group": "databases", - "weight": 318, + "weight": 276, "cookies": false, "type": "", "demo": "databases\/update.md", @@ -6395,8 +6427,7 @@ "enabled" ], "required": [ - "databaseId", - "name" + "databaseId" ], "responses": [ { @@ -6452,10 +6483,7 @@ "description": "Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled.", "x-example": false } - }, - "required": [ - "name" - ] + } } } } @@ -6477,7 +6505,7 @@ "x-appwrite": { "method": "delete", "group": "databases", - "weight": 319, + "weight": 277, "cookies": false, "type": "", "demo": "databases\/delete.md", @@ -6574,7 +6602,7 @@ "x-appwrite": { "method": "listCollections", "group": "collections", - "weight": 328, + "weight": 286, "cookies": false, "type": "", "demo": "databases\/list-collections.md", @@ -6675,7 +6703,7 @@ "x-appwrite": { "method": "createCollection", "group": "collections", - "weight": 324, + "weight": 282, "cookies": false, "type": "", "demo": "databases\/create-collection.md", @@ -6803,7 +6831,7 @@ "x-appwrite": { "method": "getCollection", "group": "collections", - "weight": 325, + "weight": 283, "cookies": false, "type": "", "demo": "databases\/get-collection.md", @@ -6879,7 +6907,7 @@ "x-appwrite": { "method": "updateCollection", "group": "collections", - "weight": 326, + "weight": 284, "cookies": false, "type": "", "demo": "databases\/update-collection.md", @@ -6961,10 +6989,7 @@ "description": "Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled.", "x-example": false } - }, - "required": [ - "name" - ] + } } } } @@ -6986,7 +7011,7 @@ "x-appwrite": { "method": "deleteCollection", "group": "collections", - "weight": 327, + "weight": 285, "cookies": false, "type": "", "demo": "databases\/delete-collection.md", @@ -7064,7 +7089,7 @@ "x-appwrite": { "method": "listAttributes", "group": "attributes", - "weight": 345, + "weight": 303, "cookies": false, "type": "", "demo": "databases\/list-attributes.md", @@ -7166,7 +7191,7 @@ "x-appwrite": { "method": "createBooleanAttribute", "group": "attributes", - "weight": 346, + "weight": 304, "cookies": false, "type": "", "demo": "databases\/create-boolean-attribute.md", @@ -7280,7 +7305,7 @@ "x-appwrite": { "method": "updateBooleanAttribute", "group": "attributes", - "weight": 347, + "weight": 305, "cookies": false, "type": "", "demo": "databases\/update-boolean-attribute.md", @@ -7399,7 +7424,7 @@ "x-appwrite": { "method": "createDatetimeAttribute", "group": "attributes", - "weight": 348, + "weight": 306, "cookies": false, "type": "", "demo": "databases\/create-datetime-attribute.md", @@ -7513,7 +7538,7 @@ "x-appwrite": { "method": "updateDatetimeAttribute", "group": "attributes", - "weight": 349, + "weight": 307, "cookies": false, "type": "", "demo": "databases\/update-datetime-attribute.md", @@ -7632,7 +7657,7 @@ "x-appwrite": { "method": "createEmailAttribute", "group": "attributes", - "weight": 350, + "weight": 308, "cookies": false, "type": "", "demo": "databases\/create-email-attribute.md", @@ -7704,6 +7729,7 @@ "type": "string", "description": "Default value for attribute when not provided. Cannot be set when attribute is required.", "x-example": "email@example.com", + "format": "email", "x-nullable": true }, "array": { @@ -7746,7 +7772,7 @@ "x-appwrite": { "method": "updateEmailAttribute", "group": "attributes", - "weight": 351, + "weight": 309, "cookies": false, "type": "", "demo": "databases\/update-email-attribute.md", @@ -7822,6 +7848,7 @@ "type": "string", "description": "Default value for attribute when not provided. Cannot be set when attribute is required.", "x-example": "email@example.com", + "format": "email", "x-nullable": true }, "newKey": { @@ -7865,7 +7892,7 @@ "x-appwrite": { "method": "createEnumAttribute", "group": "attributes", - "weight": 352, + "weight": 310, "cookies": false, "type": "", "demo": "databases\/create-enum-attribute.md", @@ -7988,7 +8015,7 @@ "x-appwrite": { "method": "updateEnumAttribute", "group": "attributes", - "weight": 353, + "weight": 311, "cookies": false, "type": "", "demo": "databases\/update-enum-attribute.md", @@ -8116,7 +8143,7 @@ "x-appwrite": { "method": "createFloatAttribute", "group": "attributes", - "weight": 354, + "weight": 312, "cookies": false, "type": "", "demo": "databases\/create-float-attribute.md", @@ -8188,18 +8215,21 @@ "type": "number", "description": "Minimum value.", "x-example": null, + "format": "float", "x-nullable": true }, "max": { "type": "number", "description": "Maximum value.", "x-example": null, + "format": "float", "x-nullable": true }, "default": { "type": "number", "description": "Default value. Cannot be set when required.", "x-example": null, + "format": "float", "x-nullable": true }, "array": { @@ -8242,7 +8272,7 @@ "x-appwrite": { "method": "updateFloatAttribute", "group": "attributes", - "weight": 355, + "weight": 313, "cookies": false, "type": "", "demo": "databases\/update-float-attribute.md", @@ -8318,18 +8348,21 @@ "type": "number", "description": "Minimum value.", "x-example": null, + "format": "float", "x-nullable": true }, "max": { "type": "number", "description": "Maximum value.", "x-example": null, + "format": "float", "x-nullable": true }, "default": { "type": "number", "description": "Default value. Cannot be set when required.", "x-example": null, + "format": "float", "x-nullable": true }, "newKey": { @@ -8373,7 +8406,7 @@ "x-appwrite": { "method": "createIntegerAttribute", "group": "attributes", - "weight": 356, + "weight": 314, "cookies": false, "type": "", "demo": "databases\/create-integer-attribute.md", @@ -8445,18 +8478,21 @@ "type": "integer", "description": "Minimum value", "x-example": null, + "format": "int64", "x-nullable": true }, "max": { "type": "integer", "description": "Maximum value", "x-example": null, + "format": "int64", "x-nullable": true }, "default": { "type": "integer", "description": "Default value. Cannot be set when attribute is required.", "x-example": null, + "format": "int64", "x-nullable": true }, "array": { @@ -8499,7 +8535,7 @@ "x-appwrite": { "method": "updateIntegerAttribute", "group": "attributes", - "weight": 357, + "weight": 315, "cookies": false, "type": "", "demo": "databases\/update-integer-attribute.md", @@ -8575,18 +8611,21 @@ "type": "integer", "description": "Minimum value", "x-example": null, + "format": "int64", "x-nullable": true }, "max": { "type": "integer", "description": "Maximum value", "x-example": null, + "format": "int64", "x-nullable": true }, "default": { "type": "integer", "description": "Default value. Cannot be set when attribute is required.", "x-example": null, + "format": "int64", "x-nullable": true }, "newKey": { @@ -8630,7 +8669,7 @@ "x-appwrite": { "method": "createIpAttribute", "group": "attributes", - "weight": 358, + "weight": 316, "cookies": false, "type": "", "demo": "databases\/create-ip-attribute.md", @@ -8744,7 +8783,7 @@ "x-appwrite": { "method": "updateIpAttribute", "group": "attributes", - "weight": 359, + "weight": 317, "cookies": false, "type": "", "demo": "databases\/update-ip-attribute.md", @@ -8863,7 +8902,7 @@ "x-appwrite": { "method": "createLineAttribute", "group": "attributes", - "weight": 360, + "weight": 318, "cookies": false, "type": "", "demo": "databases\/create-line-attribute.md", @@ -8979,7 +9018,7 @@ "x-appwrite": { "method": "updateLineAttribute", "group": "attributes", - "weight": 361, + "weight": 319, "cookies": false, "type": "", "demo": "databases\/update-line-attribute.md", @@ -9104,7 +9143,7 @@ "x-appwrite": { "method": "createPointAttribute", "group": "attributes", - "weight": 362, + "weight": 320, "cookies": false, "type": "", "demo": "databases\/create-point-attribute.md", @@ -9220,7 +9259,7 @@ "x-appwrite": { "method": "updatePointAttribute", "group": "attributes", - "weight": 363, + "weight": 321, "cookies": false, "type": "", "demo": "databases\/update-point-attribute.md", @@ -9345,7 +9384,7 @@ "x-appwrite": { "method": "createPolygonAttribute", "group": "attributes", - "weight": 364, + "weight": 322, "cookies": false, "type": "", "demo": "databases\/create-polygon-attribute.md", @@ -9461,7 +9500,7 @@ "x-appwrite": { "method": "updatePolygonAttribute", "group": "attributes", - "weight": 365, + "weight": 323, "cookies": false, "type": "", "demo": "databases\/update-polygon-attribute.md", @@ -9586,7 +9625,7 @@ "x-appwrite": { "method": "createRelationshipAttribute", "group": "attributes", - "weight": 366, + "weight": 324, "cookies": false, "type": "", "demo": "databases\/create-relationship-attribute.md", @@ -9726,7 +9765,7 @@ "x-appwrite": { "method": "createStringAttribute", "group": "attributes", - "weight": 368, + "weight": 326, "cookies": false, "type": "", "demo": "databases\/create-string-attribute.md", @@ -9792,7 +9831,8 @@ "size": { "type": "integer", "description": "Attribute size for text attributes, in number of characters.", - "x-example": 1 + "x-example": 1, + "format": "int32" }, "required": { "type": "boolean", @@ -9851,7 +9891,7 @@ "x-appwrite": { "method": "updateStringAttribute", "group": "attributes", - "weight": 369, + "weight": 327, "cookies": false, "type": "", "demo": "databases\/update-string-attribute.md", @@ -9933,6 +9973,7 @@ "type": "integer", "description": "Maximum size of the string attribute.", "x-example": 1, + "format": "int32", "x-nullable": true }, "newKey": { @@ -9976,7 +10017,7 @@ "x-appwrite": { "method": "createUrlAttribute", "group": "attributes", - "weight": 370, + "weight": 328, "cookies": false, "type": "", "demo": "databases\/create-url-attribute.md", @@ -10048,6 +10089,7 @@ "type": "string", "description": "Default value for attribute when not provided. Cannot be set when attribute is required.", "x-example": "https:\/\/example.com", + "format": "url", "x-nullable": true }, "array": { @@ -10090,7 +10132,7 @@ "x-appwrite": { "method": "updateUrlAttribute", "group": "attributes", - "weight": 371, + "weight": 329, "cookies": false, "type": "", "demo": "databases\/update-url-attribute.md", @@ -10166,6 +10208,7 @@ "type": "string", "description": "Default value for attribute when not provided. Cannot be set when attribute is required.", "x-example": "https:\/\/example.com", + "format": "url", "x-nullable": true }, "newKey": { @@ -10240,7 +10283,7 @@ "x-appwrite": { "method": "getAttribute", "group": "attributes", - "weight": 343, + "weight": 301, "cookies": false, "type": "", "demo": "databases\/get-attribute.md", @@ -10318,7 +10361,7 @@ "x-appwrite": { "method": "deleteAttribute", "group": "attributes", - "weight": 344, + "weight": 302, "cookies": false, "type": "", "demo": "databases\/delete-attribute.md", @@ -10405,7 +10448,7 @@ "x-appwrite": { "method": "updateRelationshipAttribute", "group": "attributes", - "weight": 367, + "weight": 325, "cookies": false, "type": "", "demo": "databases\/update-relationship-attribute.md", @@ -10522,7 +10565,7 @@ "x-appwrite": { "method": "listDocuments", "group": "documents", - "weight": 339, + "weight": 297, "cookies": false, "type": "", "demo": "databases\/list-documents.md", @@ -10636,7 +10679,7 @@ "x-appwrite": { "method": "createDocument", "group": "documents", - "weight": 331, + "weight": 289, "cookies": false, "type": "", "demo": "databases\/create-document.md", @@ -10831,7 +10874,7 @@ "x-appwrite": { "method": "upsertDocuments", "group": "documents", - "weight": 336, + "weight": 294, "cookies": false, "type": "", "demo": "databases\/upsert-documents.md", @@ -10970,7 +11013,7 @@ "x-appwrite": { "method": "updateDocuments", "group": "documents", - "weight": 334, + "weight": 292, "cookies": false, "type": "", "demo": "databases\/update-documents.md", @@ -11076,7 +11119,7 @@ "x-appwrite": { "method": "deleteDocuments", "group": "documents", - "weight": 338, + "weight": 296, "cookies": false, "type": "", "demo": "databases\/delete-documents.md", @@ -11179,7 +11222,7 @@ "x-appwrite": { "method": "getDocument", "group": "documents", - "weight": 332, + "weight": 290, "cookies": false, "type": "", "demo": "databases\/get-document.md", @@ -11292,7 +11335,7 @@ "x-appwrite": { "method": "upsertDocument", "group": "documents", - "weight": 335, + "weight": 293, "cookies": false, "type": "", "demo": "databases\/upsert-document.md", @@ -11450,7 +11493,7 @@ "x-appwrite": { "method": "updateDocument", "group": "documents", - "weight": 333, + "weight": 291, "cookies": false, "type": "", "demo": "databases\/update-document.md", @@ -11564,7 +11607,7 @@ "x-appwrite": { "method": "deleteDocument", "group": "documents", - "weight": 337, + "weight": 295, "cookies": false, "type": "", "demo": "databases\/delete-document.md", @@ -11673,7 +11716,7 @@ "x-appwrite": { "method": "decrementDocumentAttribute", "group": "documents", - "weight": 342, + "weight": 300, "cookies": false, "type": "", "demo": "databases\/decrement-document-attribute.md", @@ -11757,12 +11800,14 @@ "value": { "type": "number", "description": "Value to increment the attribute by. The value must be a number.", - "x-example": null + "x-example": null, + "format": "float" }, "min": { "type": "number", "description": "Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown.", "x-example": null, + "format": "float", "x-nullable": true }, "transactionId": { @@ -11802,7 +11847,7 @@ "x-appwrite": { "method": "incrementDocumentAttribute", "group": "documents", - "weight": 341, + "weight": 299, "cookies": false, "type": "", "demo": "databases\/increment-document-attribute.md", @@ -11886,12 +11931,14 @@ "value": { "type": "number", "description": "Value to increment the attribute by. The value must be a number.", - "x-example": null + "x-example": null, + "format": "float" }, "max": { "type": "number", "description": "Maximum value for the attribute. If the current value is greater than this value, an error will be thrown.", "x-example": null, + "format": "float", "x-nullable": true }, "transactionId": { @@ -11931,7 +11978,7 @@ "x-appwrite": { "method": "listIndexes", "group": "indexes", - "weight": 375, + "weight": 333, "cookies": false, "type": "", "demo": "databases\/list-indexes.md", @@ -12031,7 +12078,7 @@ "x-appwrite": { "method": "createIndex", "group": "indexes", - "weight": 372, + "weight": 330, "cookies": false, "type": "", "demo": "databases\/create-index.md", @@ -12173,7 +12220,7 @@ "x-appwrite": { "method": "getIndex", "group": "indexes", - "weight": 373, + "weight": 331, "cookies": false, "type": "", "demo": "databases\/get-index.md", @@ -12251,7 +12298,7 @@ "x-appwrite": { "method": "deleteIndex", "group": "indexes", - "weight": 374, + "weight": 332, "cookies": false, "type": "", "demo": "databases\/delete-index.md", @@ -12338,7 +12385,7 @@ "x-appwrite": { "method": "list", "group": "functions", - "weight": 456, + "weight": 415, "cookies": false, "type": "", "demo": "functions\/list.md", @@ -12424,7 +12471,7 @@ "x-appwrite": { "method": "create", "group": "functions", - "weight": 453, + "weight": 412, "cookies": false, "type": "", "demo": "functions\/create.md", @@ -12565,7 +12612,8 @@ "timeout": { "type": "integer", "description": "Function maximum execution time in seconds.", - "x-example": 1 + "x-example": 1, + "format": "int32" }, "enabled": { "type": "boolean", @@ -12720,7 +12768,7 @@ "x-appwrite": { "method": "listRuntimes", "group": "runtimes", - "weight": 458, + "weight": 417, "cookies": false, "type": "", "demo": "functions\/list-runtimes.md", @@ -12771,7 +12819,7 @@ "x-appwrite": { "method": "listSpecifications", "group": "runtimes", - "weight": 459, + "weight": 418, "cookies": false, "type": "", "demo": "functions\/list-specifications.md", @@ -12822,7 +12870,7 @@ "x-appwrite": { "method": "get", "group": "functions", - "weight": 454, + "weight": 413, "cookies": false, "type": "", "demo": "functions\/get.md", @@ -12883,7 +12931,7 @@ "x-appwrite": { "method": "update", "group": "functions", - "weight": 455, + "weight": 414, "cookies": false, "type": "", "demo": "functions\/update.md", @@ -13031,7 +13079,8 @@ "timeout": { "type": "integer", "description": "Maximum execution time in seconds.", - "x-example": 1 + "x-example": 1, + "format": "int32" }, "enabled": { "type": "boolean", @@ -13176,7 +13225,7 @@ "x-appwrite": { "method": "delete", "group": "functions", - "weight": 457, + "weight": 416, "cookies": false, "type": "", "demo": "functions\/delete.md", @@ -13239,7 +13288,7 @@ "x-appwrite": { "method": "updateFunctionDeployment", "group": "functions", - "weight": 462, + "weight": 421, "cookies": false, "type": "", "demo": "functions\/update-function-deployment.md", @@ -13321,7 +13370,7 @@ "x-appwrite": { "method": "listDeployments", "group": "deployments", - "weight": 463, + "weight": 422, "cookies": false, "type": "", "demo": "functions\/list-deployments.md", @@ -13417,7 +13466,7 @@ "x-appwrite": { "method": "createDeployment", "group": "deployments", - "weight": 460, + "weight": 419, "cookies": false, "type": "upload", "demo": "functions\/create-deployment.md", @@ -13475,7 +13524,8 @@ "code": { "type": "string", "description": "Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory.", - "x-example": null + "x-example": null, + "format": "binary" }, "activate": { "type": "boolean", @@ -13517,7 +13567,7 @@ "x-appwrite": { "method": "createDuplicateDeployment", "group": "deployments", - "weight": 468, + "weight": 427, "cookies": false, "type": "", "demo": "functions\/create-duplicate-deployment.md", @@ -13604,7 +13654,7 @@ "x-appwrite": { "method": "createTemplateDeployment", "group": "deployments", - "weight": 465, + "weight": 424, "cookies": false, "type": "", "demo": "functions\/create-template-deployment.md", @@ -13722,7 +13772,7 @@ "x-appwrite": { "method": "createVcsDeployment", "group": "deployments", - "weight": 466, + "weight": 425, "cookies": false, "type": "", "demo": "functions\/create-vcs-deployment.md", @@ -13821,7 +13871,7 @@ "x-appwrite": { "method": "getDeployment", "group": "deployments", - "weight": 461, + "weight": 420, "cookies": false, "type": "", "demo": "functions\/get-deployment.md", @@ -13885,7 +13935,7 @@ "x-appwrite": { "method": "deleteDeployment", "group": "deployments", - "weight": 464, + "weight": 423, "cookies": false, "type": "", "demo": "functions\/delete-deployment.md", @@ -13951,7 +14001,7 @@ "x-appwrite": { "method": "getDeploymentDownload", "group": "deployments", - "weight": 467, + "weight": 426, "cookies": false, "type": "location", "demo": "functions\/get-deployment-download.md", @@ -14043,7 +14093,7 @@ "x-appwrite": { "method": "updateDeploymentStatus", "group": "deployments", - "weight": 469, + "weight": 428, "cookies": false, "type": "", "demo": "functions\/update-deployment-status.md", @@ -14116,7 +14166,7 @@ "x-appwrite": { "method": "listExecutions", "group": "executions", - "weight": 472, + "weight": 431, "cookies": false, "type": "", "demo": "functions\/list-executions.md", @@ -14205,7 +14255,7 @@ "x-appwrite": { "method": "createExecution", "group": "executions", - "weight": 470, + "weight": 429, "cookies": false, "type": "", "demo": "functions\/create-execution.md", @@ -14325,7 +14375,7 @@ "x-appwrite": { "method": "getExecution", "group": "executions", - "weight": 471, + "weight": 430, "cookies": false, "type": "", "demo": "functions\/get-execution.md", @@ -14393,7 +14443,7 @@ "x-appwrite": { "method": "deleteExecution", "group": "executions", - "weight": 473, + "weight": 432, "cookies": false, "type": "", "demo": "functions\/delete-execution.md", @@ -14466,7 +14516,7 @@ "x-appwrite": { "method": "listVariables", "group": "variables", - "weight": 478, + "weight": 437, "cookies": false, "type": "", "demo": "functions\/list-variables.md", @@ -14527,7 +14577,7 @@ "x-appwrite": { "method": "createVariable", "group": "variables", - "weight": 476, + "weight": 435, "cookies": false, "type": "", "demo": "functions\/create-variable.md", @@ -14620,7 +14670,7 @@ "x-appwrite": { "method": "getVariable", "group": "variables", - "weight": 477, + "weight": 436, "cookies": false, "type": "", "demo": "functions\/get-variable.md", @@ -14691,7 +14741,7 @@ "x-appwrite": { "method": "updateVariable", "group": "variables", - "weight": 479, + "weight": 438, "cookies": false, "type": "", "demo": "functions\/update-variable.md", @@ -14786,7 +14836,7 @@ "x-appwrite": { "method": "deleteVariable", "group": "variables", - "weight": 480, + "weight": 439, "cookies": false, "type": "", "demo": "functions\/delete-variable.md", @@ -14859,7 +14909,7 @@ "x-appwrite": { "method": "query", "group": "graphql", - "weight": 241, + "weight": 190, "cookies": false, "type": "graphql", "demo": "graphql\/query.md", @@ -14915,7 +14965,7 @@ "x-appwrite": { "method": "mutation", "group": "graphql", - "weight": 240, + "weight": 189, "cookies": false, "type": "graphql", "demo": "graphql\/mutation.md", @@ -14971,7 +15021,7 @@ "x-appwrite": { "method": "get", "group": "health", - "weight": 69, + "weight": 442, "cookies": false, "type": "", "demo": "health\/get.md", @@ -15023,7 +15073,7 @@ "x-appwrite": { "method": "getAntivirus", "group": "health", - "weight": 90, + "weight": 451, "cookies": false, "type": "", "demo": "health\/get-antivirus.md", @@ -15061,11 +15111,11 @@ "description": "Check the Appwrite in-memory cache servers are up and connection is successful.", "responses": { "200": { - "description": "Health Status", + "description": "Status List", "content": { "application\/json": { "schema": { - "$ref": "#\/components\/schemas\/healthStatus" + "$ref": "#\/components\/schemas\/healthStatusList" } } } @@ -15075,7 +15125,7 @@ "x-appwrite": { "method": "getCache", "group": "health", - "weight": 72, + "weight": 445, "cookies": false, "type": "", "demo": "health\/get-cache.md", @@ -15127,7 +15177,7 @@ "x-appwrite": { "method": "getCertificate", "group": "health", - "weight": 77, + "weight": 448, "cookies": false, "type": "", "demo": "health\/get-certificate.md", @@ -15176,11 +15226,11 @@ "description": "Check the Appwrite database servers are up and connection is successful.", "responses": { "200": { - "description": "Health Status", + "description": "Status List", "content": { "application\/json": { "schema": { - "$ref": "#\/components\/schemas\/healthStatus" + "$ref": "#\/components\/schemas\/healthStatusList" } } } @@ -15190,7 +15240,7 @@ "x-appwrite": { "method": "getDB", "group": "health", - "weight": 71, + "weight": 444, "cookies": false, "type": "", "demo": "health\/get-db.md", @@ -15228,11 +15278,11 @@ "description": "Check the Appwrite pub-sub servers are up and connection is successful.", "responses": { "200": { - "description": "Health Status", + "description": "Status List", "content": { "application\/json": { "schema": { - "$ref": "#\/components\/schemas\/healthStatus" + "$ref": "#\/components\/schemas\/healthStatusList" } } } @@ -15242,7 +15292,7 @@ "x-appwrite": { "method": "getPubSub", "group": "health", - "weight": 73, + "weight": 446, "cookies": false, "type": "", "demo": "health\/get-pub-sub.md", @@ -15270,6 +15320,71 @@ ] } }, + "\/health\/queue\/audits": { + "get": { + "summary": "Get audits queue", + "operationId": "healthGetQueueAudits", + "tags": [ + "health" + ], + "description": "Get the number of audit logs that are waiting to be processed in the Appwrite internal queue server.", + "responses": { + "200": { + "description": "Health Queue", + "content": { + "application\/json": { + "schema": { + "$ref": "#\/components\/schemas\/healthQueue" + } + } + } + } + }, + "deprecated": false, + "x-appwrite": { + "method": "getQueueAudits", + "group": "queue", + "weight": 452, + "cookies": false, + "type": "", + "demo": "health\/get-queue-audits.md", + "rate-limit": 0, + "rate-time": 3600, + "rate-key": "url:{url},ip:{ip}", + "scope": "health.read", + "platforms": [ + "console", + "server" + ], + "packaging": false, + "public": true, + "edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-audits.md", + "auth": { + "Project": [], + "Key": [] + } + }, + "security": [ + { + "Project": [], + "Key": [] + } + ], + "parameters": [ + { + "name": "threshold", + "description": "Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.", + "required": false, + "schema": { + "type": "integer", + "format": "int32", + "default": 5000 + }, + "in": "query" + } + ] + } + }, "\/health\/queue\/builds": { "get": { "summary": "Get builds queue", @@ -15294,7 +15409,7 @@ "x-appwrite": { "method": "getQueueBuilds", "group": "queue", - "weight": 79, + "weight": 456, "cookies": false, "type": "", "demo": "health\/get-queue-builds.md", @@ -15359,7 +15474,7 @@ "x-appwrite": { "method": "getQueueCertificates", "group": "queue", - "weight": 78, + "weight": 455, "cookies": false, "type": "", "demo": "health\/get-queue-certificates.md", @@ -15424,7 +15539,7 @@ "x-appwrite": { "method": "getQueueDatabases", "group": "queue", - "weight": 80, + "weight": 457, "cookies": false, "type": "", "demo": "health\/get-queue-databases.md", @@ -15500,7 +15615,7 @@ "x-appwrite": { "method": "getQueueDeletes", "group": "queue", - "weight": 81, + "weight": 458, "cookies": false, "type": "", "demo": "health\/get-queue-deletes.md", @@ -15565,7 +15680,7 @@ "x-appwrite": { "method": "getFailedJobs", "group": "queue", - "weight": 91, + "weight": 465, "cookies": false, "type": "", "demo": "health\/get-failed-jobs.md", @@ -15610,6 +15725,7 @@ "v1-webhooks", "v1-certificates", "v1-builds", + "v1-screenshots", "v1-messaging", "v1-migrations" ], @@ -15656,7 +15772,7 @@ "x-appwrite": { "method": "getQueueFunctions", "group": "queue", - "weight": 85, + "weight": 462, "cookies": false, "type": "", "demo": "health\/get-queue-functions.md", @@ -15721,7 +15837,7 @@ "x-appwrite": { "method": "getQueueLogs", "group": "queue", - "weight": 76, + "weight": 454, "cookies": false, "type": "", "demo": "health\/get-queue-logs.md", @@ -15786,7 +15902,7 @@ "x-appwrite": { "method": "getQueueMails", "group": "queue", - "weight": 82, + "weight": 459, "cookies": false, "type": "", "demo": "health\/get-queue-mails.md", @@ -15851,7 +15967,7 @@ "x-appwrite": { "method": "getQueueMessaging", "group": "queue", - "weight": 83, + "weight": 460, "cookies": false, "type": "", "demo": "health\/get-queue-messaging.md", @@ -15916,7 +16032,7 @@ "x-appwrite": { "method": "getQueueMigrations", "group": "queue", - "weight": 84, + "weight": 461, "cookies": false, "type": "", "demo": "health\/get-queue-migrations.md", @@ -15981,7 +16097,7 @@ "x-appwrite": { "method": "getQueueStatsResources", "group": "queue", - "weight": 86, + "weight": 463, "cookies": false, "type": "", "demo": "health\/get-queue-stats-resources.md", @@ -16046,7 +16162,7 @@ "x-appwrite": { "method": "getQueueUsage", "group": "queue", - "weight": 87, + "weight": 464, "cookies": false, "type": "", "demo": "health\/get-queue-usage.md", @@ -16111,7 +16227,7 @@ "x-appwrite": { "method": "getQueueWebhooks", "group": "queue", - "weight": 75, + "weight": 453, "cookies": false, "type": "", "demo": "health\/get-queue-webhooks.md", @@ -16176,7 +16292,7 @@ "x-appwrite": { "method": "getStorage", "group": "storage", - "weight": 89, + "weight": 450, "cookies": false, "type": "", "demo": "health\/get-storage.md", @@ -16228,7 +16344,7 @@ "x-appwrite": { "method": "getStorageLocal", "group": "storage", - "weight": 88, + "weight": 449, "cookies": false, "type": "", "demo": "health\/get-storage-local.md", @@ -16280,7 +16396,7 @@ "x-appwrite": { "method": "getTime", "group": "health", - "weight": 74, + "weight": 447, "cookies": false, "type": "", "demo": "health\/get-time.md", @@ -16332,7 +16448,7 @@ "x-appwrite": { "method": "get", "group": null, - "weight": 61, + "weight": 49, "cookies": false, "type": "", "demo": "locale\/get.md", @@ -16388,7 +16504,7 @@ "x-appwrite": { "method": "listCodes", "group": null, - "weight": 62, + "weight": 50, "cookies": false, "type": "", "demo": "locale\/list-codes.md", @@ -16444,7 +16560,7 @@ "x-appwrite": { "method": "listContinents", "group": null, - "weight": 66, + "weight": 54, "cookies": false, "type": "", "demo": "locale\/list-continents.md", @@ -16500,7 +16616,7 @@ "x-appwrite": { "method": "listCountries", "group": null, - "weight": 63, + "weight": 51, "cookies": false, "type": "", "demo": "locale\/list-countries.md", @@ -16556,7 +16672,7 @@ "x-appwrite": { "method": "listCountriesEU", "group": null, - "weight": 64, + "weight": 52, "cookies": false, "type": "", "demo": "locale\/list-countries-eu.md", @@ -16612,7 +16728,7 @@ "x-appwrite": { "method": "listCountriesPhones", "group": null, - "weight": 65, + "weight": 53, "cookies": false, "type": "", "demo": "locale\/list-countries-phones.md", @@ -16668,7 +16784,7 @@ "x-appwrite": { "method": "listCurrencies", "group": null, - "weight": 67, + "weight": 55, "cookies": false, "type": "", "demo": "locale\/list-currencies.md", @@ -16724,7 +16840,7 @@ "x-appwrite": { "method": "listLanguages", "group": null, - "weight": 68, + "weight": 56, "cookies": false, "type": "", "demo": "locale\/list-languages.md", @@ -16780,7 +16896,7 @@ "x-appwrite": { "method": "listMessages", "group": "messages", - "weight": 298, + "weight": 245, "cookies": false, "type": "", "demo": "messaging\/list-messages.md", @@ -16869,7 +16985,7 @@ "x-appwrite": { "method": "createEmail", "group": "messages", - "weight": 295, + "weight": 242, "cookies": false, "type": "", "demo": "messaging\/create-email.md", @@ -17016,7 +17132,7 @@ "x-appwrite": { "method": "updateEmail", "group": "messages", - "weight": 302, + "weight": 249, "cookies": false, "type": "", "demo": "messaging\/update-email.md", @@ -17175,7 +17291,7 @@ "x-appwrite": { "method": "createPush", "group": "messages", - "weight": 297, + "weight": 244, "cookies": false, "type": "", "demo": "messaging\/create-push.md", @@ -17285,7 +17401,8 @@ "badge": { "type": "integer", "description": "Badge for push notification. Available only for iOS Platform.", - "x-example": null + "x-example": null, + "format": "int32" }, "draft": { "type": "boolean", @@ -17353,7 +17470,7 @@ "x-appwrite": { "method": "updatePush", "group": "messages", - "weight": 304, + "weight": 251, "cookies": false, "type": "", "demo": "messaging\/update-push.md", @@ -17482,6 +17599,7 @@ "type": "integer", "description": "Badge for push notification. Available only for iOS platforms.", "x-example": null, + "format": "int32", "x-nullable": true }, "draft": { @@ -17551,7 +17669,7 @@ "x-appwrite": { "method": "createSms", "group": "messages", - "weight": 296, + "weight": 243, "cookies": false, "type": "", "demo": "messaging\/create-sms.md", @@ -17735,7 +17853,7 @@ "x-appwrite": { "method": "updateSms", "group": "messages", - "weight": 303, + "weight": 250, "cookies": false, "type": "", "demo": "messaging\/update-sms.md", @@ -17925,7 +18043,7 @@ "x-appwrite": { "method": "getMessage", "group": "messages", - "weight": 301, + "weight": 248, "cookies": false, "type": "", "demo": "messaging\/get-message.md", @@ -17980,7 +18098,7 @@ "x-appwrite": { "method": "delete", "group": "messages", - "weight": 305, + "weight": 252, "cookies": false, "type": "", "demo": "messaging\/delete.md", @@ -18044,7 +18162,7 @@ "x-appwrite": { "method": "listMessageLogs", "group": "logs", - "weight": 299, + "weight": 246, "cookies": false, "type": "", "demo": "messaging\/list-message-logs.md", @@ -18132,7 +18250,7 @@ "x-appwrite": { "method": "listTargets", "group": "messages", - "weight": 300, + "weight": 247, "cookies": false, "type": "", "demo": "messaging\/list-targets.md", @@ -18220,7 +18338,7 @@ "x-appwrite": { "method": "listProviders", "group": "providers", - "weight": 269, + "weight": 216, "cookies": false, "type": "", "demo": "messaging\/list-providers.md", @@ -18309,7 +18427,7 @@ "x-appwrite": { "method": "createApnsProvider", "group": "providers", - "weight": 268, + "weight": 215, "cookies": false, "type": "", "demo": "messaging\/create-apns-provider.md", @@ -18491,7 +18609,7 @@ "x-appwrite": { "method": "updateApnsProvider", "group": "providers", - "weight": 282, + "weight": 229, "cookies": false, "type": "", "demo": "messaging\/update-apns-provider.md", @@ -18675,7 +18793,7 @@ "x-appwrite": { "method": "createFcmProvider", "group": "providers", - "weight": 267, + "weight": 214, "cookies": false, "type": "", "demo": "messaging\/create-fcm-provider.md", @@ -18830,7 +18948,7 @@ "x-appwrite": { "method": "updateFcmProvider", "group": "providers", - "weight": 281, + "weight": 228, "cookies": false, "type": "", "demo": "messaging\/update-fcm-provider.md", @@ -18986,7 +19104,7 @@ "x-appwrite": { "method": "createMailgunProvider", "group": "providers", - "weight": 258, + "weight": 205, "cookies": false, "type": "", "demo": "messaging\/create-mailgun-provider.md", @@ -19052,7 +19170,8 @@ "fromEmail": { "type": "string", "description": "Sender email address.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -19062,7 +19181,8 @@ "replyToEmail": { "type": "string", "description": "Email set in the reply to field for the mail. Default value is sender email. Reply to email must have reply to name as well.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "enabled": { "type": "boolean", @@ -19105,7 +19225,7 @@ "x-appwrite": { "method": "updateMailgunProvider", "group": "providers", - "weight": 272, + "weight": 219, "cookies": false, "type": "", "demo": "messaging\/update-mailgun-provider.md", @@ -19184,7 +19304,8 @@ "fromEmail": { "type": "string", "description": "Sender email address.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -19227,7 +19348,7 @@ "x-appwrite": { "method": "createMsg91Provider", "group": "providers", - "weight": 262, + "weight": 209, "cookies": false, "type": "", "demo": "messaging\/create-msg-91-provider.md", @@ -19325,7 +19446,7 @@ "x-appwrite": { "method": "updateMsg91Provider", "group": "providers", - "weight": 276, + "weight": 223, "cookies": false, "type": "", "demo": "messaging\/update-msg-91-provider.md", @@ -19426,7 +19547,7 @@ "x-appwrite": { "method": "createResendProvider", "group": "providers", - "weight": 260, + "weight": 207, "cookies": false, "type": "", "demo": "messaging\/create-resend-provider.md", @@ -19481,7 +19602,8 @@ "fromEmail": { "type": "string", "description": "Sender email address.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -19491,7 +19613,8 @@ "replyToEmail": { "type": "string", "description": "Email set in the reply to field for the mail. Default value is sender email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "enabled": { "type": "boolean", @@ -19534,7 +19657,7 @@ "x-appwrite": { "method": "updateResendProvider", "group": "providers", - "weight": 274, + "weight": 221, "cookies": false, "type": "", "demo": "messaging\/update-resend-provider.md", @@ -19602,7 +19725,8 @@ "fromEmail": { "type": "string", "description": "Sender email address.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -19645,7 +19769,7 @@ "x-appwrite": { "method": "createSendgridProvider", "group": "providers", - "weight": 259, + "weight": 206, "cookies": false, "type": "", "demo": "messaging\/create-sendgrid-provider.md", @@ -19700,7 +19824,8 @@ "fromEmail": { "type": "string", "description": "Sender email address.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -19710,7 +19835,8 @@ "replyToEmail": { "type": "string", "description": "Email set in the reply to field for the mail. Default value is sender email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "enabled": { "type": "boolean", @@ -19753,7 +19879,7 @@ "x-appwrite": { "method": "updateSendgridProvider", "group": "providers", - "weight": 273, + "weight": 220, "cookies": false, "type": "", "demo": "messaging\/update-sendgrid-provider.md", @@ -19821,7 +19947,8 @@ "fromEmail": { "type": "string", "description": "Sender email address.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -19864,7 +19991,7 @@ "x-appwrite": { "method": "createSmtpProvider", "group": "providers", - "weight": 261, + "weight": 208, "cookies": false, "type": "", "demo": "messaging\/create-smtp-provider.md", @@ -20002,7 +20129,8 @@ "port": { "type": "integer", "description": "The default SMTP server port.", - "x-example": 1 + "x-example": 1, + "format": "int32" }, "username": { "type": "string", @@ -20044,7 +20172,8 @@ "fromEmail": { "type": "string", "description": "Sender email address.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -20054,7 +20183,8 @@ "replyToEmail": { "type": "string", "description": "Email set in the reply to field for the mail. Default value is sender email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "enabled": { "type": "boolean", @@ -20098,7 +20228,7 @@ "x-appwrite": { "method": "updateSmtpProvider", "group": "providers", - "weight": 275, + "weight": 222, "cookies": false, "type": "", "demo": "messaging\/update-smtp-provider.md", @@ -20240,6 +20370,7 @@ "type": "integer", "description": "SMTP port.", "x-example": 1, + "format": "int32", "x-nullable": true }, "username": { @@ -20283,7 +20414,8 @@ "fromEmail": { "type": "string", "description": "Sender email address.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -20332,7 +20464,7 @@ "x-appwrite": { "method": "createTelesignProvider", "group": "providers", - "weight": 263, + "weight": 210, "cookies": false, "type": "", "demo": "messaging\/create-telesign-provider.md", @@ -20377,7 +20509,8 @@ "from": { "type": "string", "description": "Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "customerId": { "type": "string", @@ -20430,7 +20563,7 @@ "x-appwrite": { "method": "updateTelesignProvider", "group": "providers", - "weight": 277, + "weight": 224, "cookies": false, "type": "", "demo": "messaging\/update-telesign-provider.md", @@ -20531,7 +20664,7 @@ "x-appwrite": { "method": "createTextmagicProvider", "group": "providers", - "weight": 264, + "weight": 211, "cookies": false, "type": "", "demo": "messaging\/create-textmagic-provider.md", @@ -20576,7 +20709,8 @@ "from": { "type": "string", "description": "Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "username": { "type": "string", @@ -20629,7 +20763,7 @@ "x-appwrite": { "method": "updateTextmagicProvider", "group": "providers", - "weight": 278, + "weight": 225, "cookies": false, "type": "", "demo": "messaging\/update-textmagic-provider.md", @@ -20730,7 +20864,7 @@ "x-appwrite": { "method": "createTwilioProvider", "group": "providers", - "weight": 265, + "weight": 212, "cookies": false, "type": "", "demo": "messaging\/create-twilio-provider.md", @@ -20775,7 +20909,8 @@ "from": { "type": "string", "description": "Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "accountSid": { "type": "string", @@ -20828,7 +20963,7 @@ "x-appwrite": { "method": "updateTwilioProvider", "group": "providers", - "weight": 279, + "weight": 226, "cookies": false, "type": "", "demo": "messaging\/update-twilio-provider.md", @@ -20929,7 +21064,7 @@ "x-appwrite": { "method": "createVonageProvider", "group": "providers", - "weight": 266, + "weight": 213, "cookies": false, "type": "", "demo": "messaging\/create-vonage-provider.md", @@ -20974,7 +21109,8 @@ "from": { "type": "string", "description": "Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "apiKey": { "type": "string", @@ -21027,7 +21163,7 @@ "x-appwrite": { "method": "updateVonageProvider", "group": "providers", - "weight": 280, + "weight": 227, "cookies": false, "type": "", "demo": "messaging\/update-vonage-provider.md", @@ -21128,7 +21264,7 @@ "x-appwrite": { "method": "getProvider", "group": "providers", - "weight": 271, + "weight": 218, "cookies": false, "type": "", "demo": "messaging\/get-provider.md", @@ -21183,7 +21319,7 @@ "x-appwrite": { "method": "deleteProvider", "group": "providers", - "weight": 283, + "weight": 230, "cookies": false, "type": "", "demo": "messaging\/delete-provider.md", @@ -21247,7 +21383,7 @@ "x-appwrite": { "method": "listProviderLogs", "group": "providers", - "weight": 270, + "weight": 217, "cookies": false, "type": "", "demo": "messaging\/list-provider-logs.md", @@ -21335,7 +21471,7 @@ "x-appwrite": { "method": "listSubscriberLogs", "group": "subscribers", - "weight": 292, + "weight": 239, "cookies": false, "type": "", "demo": "messaging\/list-subscriber-logs.md", @@ -21423,7 +21559,7 @@ "x-appwrite": { "method": "listTopics", "group": "topics", - "weight": 285, + "weight": 232, "cookies": false, "type": "", "demo": "messaging\/list-topics.md", @@ -21510,7 +21646,7 @@ "x-appwrite": { "method": "createTopic", "group": "topics", - "weight": 284, + "weight": 231, "cookies": false, "type": "", "demo": "messaging\/create-topic.md", @@ -21595,7 +21731,7 @@ "x-appwrite": { "method": "getTopic", "group": "topics", - "weight": 287, + "weight": 234, "cookies": false, "type": "", "demo": "messaging\/get-topic.md", @@ -21657,7 +21793,7 @@ "x-appwrite": { "method": "updateTopic", "group": "topics", - "weight": 288, + "weight": 235, "cookies": false, "type": "", "demo": "messaging\/update-topic.md", @@ -21738,7 +21874,7 @@ "x-appwrite": { "method": "deleteTopic", "group": "topics", - "weight": 289, + "weight": 236, "cookies": false, "type": "", "demo": "messaging\/delete-topic.md", @@ -21802,7 +21938,7 @@ "x-appwrite": { "method": "listTopicLogs", "group": "topics", - "weight": 286, + "weight": 233, "cookies": false, "type": "", "demo": "messaging\/list-topic-logs.md", @@ -21890,7 +22026,7 @@ "x-appwrite": { "method": "listSubscribers", "group": "subscribers", - "weight": 291, + "weight": 238, "cookies": false, "type": "", "demo": "messaging\/list-subscribers.md", @@ -21987,7 +22123,7 @@ "x-appwrite": { "method": "createSubscriber", "group": "subscribers", - "weight": 290, + "weight": 237, "cookies": false, "type": "", "demo": "messaging\/create-subscriber.md", @@ -22080,7 +22216,7 @@ "x-appwrite": { "method": "getSubscriber", "group": "subscribers", - "weight": 293, + "weight": 240, "cookies": false, "type": "", "demo": "messaging\/get-subscriber.md", @@ -22145,7 +22281,7 @@ "x-appwrite": { "method": "deleteSubscriber", "group": "subscribers", - "weight": 294, + "weight": 241, "cookies": false, "type": "", "demo": "messaging\/delete-subscriber.md", @@ -22223,7 +22359,7 @@ "x-appwrite": { "method": "list", "group": "sites", - "weight": 485, + "weight": 469, "cookies": false, "type": "", "demo": "sites\/list.md", @@ -22309,7 +22445,7 @@ "x-appwrite": { "method": "create", "group": "sites", - "weight": 483, + "weight": 467, "cookies": false, "type": "", "demo": "sites\/create.md", @@ -22387,7 +22523,8 @@ "timeout": { "type": "integer", "description": "Maximum request time in seconds.", - "x-example": 1 + "x-example": 1, + "format": "int32" }, "installCommand": { "type": "string", @@ -22563,7 +22700,7 @@ "x-appwrite": { "method": "listFrameworks", "group": "frameworks", - "weight": 488, + "weight": 472, "cookies": false, "type": "", "demo": "sites\/list-frameworks.md", @@ -22614,7 +22751,7 @@ "x-appwrite": { "method": "listSpecifications", "group": "frameworks", - "weight": 511, + "weight": 495, "cookies": false, "type": "", "demo": "sites\/list-specifications.md", @@ -22665,7 +22802,7 @@ "x-appwrite": { "method": "get", "group": "sites", - "weight": 484, + "weight": 468, "cookies": false, "type": "", "demo": "sites\/get.md", @@ -22726,7 +22863,7 @@ "x-appwrite": { "method": "update", "group": "sites", - "weight": 486, + "weight": 470, "cookies": false, "type": "", "demo": "sites\/update.md", @@ -22811,7 +22948,8 @@ "timeout": { "type": "integer", "description": "Maximum request time in seconds.", - "x-example": 1 + "x-example": 1, + "format": "int32" }, "installCommand": { "type": "string", @@ -22976,7 +23114,7 @@ "x-appwrite": { "method": "delete", "group": "sites", - "weight": 487, + "weight": 471, "cookies": false, "type": "", "demo": "sites\/delete.md", @@ -23039,7 +23177,7 @@ "x-appwrite": { "method": "updateSiteDeployment", "group": "sites", - "weight": 494, + "weight": 478, "cookies": false, "type": "", "demo": "sites\/update-site-deployment.md", @@ -23121,7 +23259,7 @@ "x-appwrite": { "method": "listDeployments", "group": "deployments", - "weight": 493, + "weight": 477, "cookies": false, "type": "", "demo": "sites\/list-deployments.md", @@ -23217,7 +23355,7 @@ "x-appwrite": { "method": "createDeployment", "group": "deployments", - "weight": 489, + "weight": 473, "cookies": false, "type": "upload", "demo": "sites\/create-deployment.md", @@ -23281,7 +23419,8 @@ "code": { "type": "string", "description": "Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory.", - "x-example": null + "x-example": null, + "format": "binary" }, "activate": { "type": "boolean", @@ -23323,7 +23462,7 @@ "x-appwrite": { "method": "createDuplicateDeployment", "group": "deployments", - "weight": 497, + "weight": 481, "cookies": false, "type": "", "demo": "sites\/create-duplicate-deployment.md", @@ -23405,7 +23544,7 @@ "x-appwrite": { "method": "createTemplateDeployment", "group": "deployments", - "weight": 490, + "weight": 474, "cookies": false, "type": "", "demo": "sites\/create-template-deployment.md", @@ -23523,7 +23662,7 @@ "x-appwrite": { "method": "createVcsDeployment", "group": "deployments", - "weight": 491, + "weight": 475, "cookies": false, "type": "", "demo": "sites\/create-vcs-deployment.md", @@ -23623,7 +23762,7 @@ "x-appwrite": { "method": "getDeployment", "group": "deployments", - "weight": 492, + "weight": 476, "cookies": false, "type": "", "demo": "sites\/get-deployment.md", @@ -23687,7 +23826,7 @@ "x-appwrite": { "method": "deleteDeployment", "group": "deployments", - "weight": 495, + "weight": 479, "cookies": false, "type": "", "demo": "sites\/delete-deployment.md", @@ -23753,7 +23892,7 @@ "x-appwrite": { "method": "getDeploymentDownload", "group": "deployments", - "weight": 496, + "weight": 480, "cookies": false, "type": "location", "demo": "sites\/get-deployment-download.md", @@ -23845,7 +23984,7 @@ "x-appwrite": { "method": "updateDeploymentStatus", "group": "deployments", - "weight": 498, + "weight": 482, "cookies": false, "type": "", "demo": "sites\/update-deployment-status.md", @@ -23918,7 +24057,7 @@ "x-appwrite": { "method": "listLogs", "group": "logs", - "weight": 500, + "weight": 484, "cookies": false, "type": "", "demo": "sites\/list-logs.md", @@ -24005,7 +24144,7 @@ "x-appwrite": { "method": "getLog", "group": "logs", - "weight": 499, + "weight": 483, "cookies": false, "type": "", "demo": "sites\/get-log.md", @@ -24069,7 +24208,7 @@ "x-appwrite": { "method": "deleteLog", "group": "logs", - "weight": 501, + "weight": 485, "cookies": false, "type": "", "demo": "sites\/delete-log.md", @@ -24142,7 +24281,7 @@ "x-appwrite": { "method": "listVariables", "group": "variables", - "weight": 504, + "weight": 488, "cookies": false, "type": "", "demo": "sites\/list-variables.md", @@ -24203,7 +24342,7 @@ "x-appwrite": { "method": "createVariable", "group": "variables", - "weight": 502, + "weight": 486, "cookies": false, "type": "", "demo": "sites\/create-variable.md", @@ -24296,7 +24435,7 @@ "x-appwrite": { "method": "getVariable", "group": "variables", - "weight": 503, + "weight": 487, "cookies": false, "type": "", "demo": "sites\/get-variable.md", @@ -24367,7 +24506,7 @@ "x-appwrite": { "method": "updateVariable", "group": "variables", - "weight": 505, + "weight": 489, "cookies": false, "type": "", "demo": "sites\/update-variable.md", @@ -24462,7 +24601,7 @@ "x-appwrite": { "method": "deleteVariable", "group": "variables", - "weight": 506, + "weight": 490, "cookies": false, "type": "", "demo": "sites\/delete-variable.md", @@ -24535,7 +24674,7 @@ "x-appwrite": { "method": "listBuckets", "group": "buckets", - "weight": 146, + "weight": 522, "cookies": false, "type": "", "demo": "storage\/list-buckets.md", @@ -24622,7 +24761,7 @@ "x-appwrite": { "method": "createBucket", "group": "buckets", - "weight": 145, + "weight": 520, "cookies": false, "type": "", "demo": "storage\/create-bucket.md", @@ -24686,7 +24825,8 @@ "maximumFileSize": { "type": "integer", "description": "Maximum file size allowed in bytes. Maximum allowed value is 30MB.", - "x-example": 1 + "x-example": 1, + "format": "int32" }, "allowedFileExtensions": { "type": "array", @@ -24698,7 +24838,7 @@ }, "compression": { "type": "string", - "description": "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", + "description": "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", "x-example": "none", "enum": [ "none", @@ -24758,7 +24898,7 @@ "x-appwrite": { "method": "getBucket", "group": "buckets", - "weight": 147, + "weight": 521, "cookies": false, "type": "", "demo": "storage\/get-bucket.md", @@ -24820,7 +24960,7 @@ "x-appwrite": { "method": "updateBucket", "group": "buckets", - "weight": 148, + "weight": 523, "cookies": false, "type": "", "demo": "storage\/update-bucket.md", @@ -24891,7 +25031,8 @@ "maximumFileSize": { "type": "integer", "description": "Maximum file size allowed in bytes. Maximum allowed value is 30MB.", - "x-example": 1 + "x-example": 1, + "format": "int32" }, "allowedFileExtensions": { "type": "array", @@ -24903,7 +25044,7 @@ }, "compression": { "type": "string", - "description": "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", + "description": "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", "x-example": "none", "enum": [ "none", @@ -24953,7 +25094,7 @@ "x-appwrite": { "method": "deleteBucket", "group": "buckets", - "weight": 149, + "weight": 524, "cookies": false, "type": "", "demo": "storage\/delete-bucket.md", @@ -25017,7 +25158,7 @@ "x-appwrite": { "method": "listFiles", "group": "files", - "weight": 151, + "weight": 527, "cookies": false, "type": "", "demo": "storage\/list-files.md", @@ -25118,7 +25259,7 @@ "x-appwrite": { "method": "createFile", "group": "files", - "weight": 150, + "weight": 525, "cookies": false, "type": "upload", "demo": "storage\/create-file.md", @@ -25175,7 +25316,8 @@ "file": { "type": "string", "description": "Binary file. Appwrite SDKs provide helpers to handle file input. [Learn about file input](https:\/\/appwrite.io\/docs\/products\/storage\/upload-download#input-file).", - "x-example": null + "x-example": null, + "format": "binary" }, "permissions": { "type": "array", @@ -25221,7 +25363,7 @@ "x-appwrite": { "method": "getFile", "group": "files", - "weight": 152, + "weight": 526, "cookies": false, "type": "", "demo": "storage\/get-file.md", @@ -25297,13 +25439,13 @@ "x-appwrite": { "method": "updateFile", "group": "files", - "weight": 157, + "weight": 528, "cookies": false, "type": "", "demo": "storage\/update-file.md", - "rate-limit": 60, - "rate-time": 60, - "rate-key": "ip:{ip},method:{method},url:{url},userId:{userId}", + "rate-limit": 0, + "rate-time": 3600, + "rate-key": "url:{url},ip:{ip}", "scope": "files.write", "platforms": [ "console", @@ -25330,7 +25472,7 @@ "parameters": [ { "name": "bucketId", - "description": "Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https:\/\/appwrite.io\/docs\/server\/storage#createBucket).", + "description": "Bucket unique ID.", "required": true, "schema": { "type": "string", @@ -25340,7 +25482,7 @@ }, { "name": "fileId", - "description": "File unique ID.", + "description": "File ID.", "required": true, "schema": { "type": "string", @@ -25357,13 +25499,12 @@ "properties": { "name": { "type": "string", - "description": "Name of the file", - "x-example": "", - "x-nullable": true + "description": "File name.", + "x-example": "" }, "permissions": { "type": "array", - "description": "An array of permission string. By default, the current permissions are inherited. [Learn more about permissions](https:\/\/appwrite.io\/docs\/permissions).", + "description": "An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https:\/\/appwrite.io\/docs\/permissions).", "x-example": "[\"read(\"any\")\"]", "items": { "type": "string" @@ -25392,7 +25533,7 @@ "x-appwrite": { "method": "deleteFile", "group": "files", - "weight": 158, + "weight": 529, "cookies": false, "type": "", "demo": "storage\/delete-file.md", @@ -25463,7 +25604,7 @@ "x-appwrite": { "method": "getFileDownload", "group": "files", - "weight": 154, + "weight": 531, "cookies": false, "type": "location", "demo": "storage\/get-file-download.md", @@ -25545,7 +25686,7 @@ "x-appwrite": { "method": "getFilePreview", "group": "files", - "weight": 153, + "weight": 530, "cookies": false, "type": "location", "demo": "storage\/get-file-preview.md", @@ -25777,7 +25918,7 @@ "x-appwrite": { "method": "getFileView", "group": "files", - "weight": 155, + "weight": 532, "cookies": false, "type": "location", "demo": "storage\/get-file-view.md", @@ -25866,7 +26007,7 @@ "x-appwrite": { "method": "list", "group": "tablesdb", - "weight": 386, + "weight": 344, "cookies": false, "type": "", "demo": "tablesdb\/list.md", @@ -25953,7 +26094,7 @@ "x-appwrite": { "method": "create", "group": "tablesdb", - "weight": 382, + "weight": 340, "cookies": false, "type": "", "demo": "tablesdb\/create.md", @@ -26035,7 +26176,7 @@ "x-appwrite": { "method": "listTransactions", "group": "transactions", - "weight": 445, + "weight": 403, "cookies": false, "type": "", "demo": "tablesdb\/list-transactions.md", @@ -26107,7 +26248,7 @@ "x-appwrite": { "method": "createTransaction", "group": "transactions", - "weight": 441, + "weight": 399, "cookies": false, "type": "", "demo": "tablesdb\/create-transaction.md", @@ -26149,7 +26290,8 @@ "ttl": { "type": "integer", "description": "Seconds before the transaction expires.", - "x-example": 60 + "x-example": 60, + "format": "int32" } } } @@ -26182,7 +26324,7 @@ "x-appwrite": { "method": "getTransaction", "group": "transactions", - "weight": 442, + "weight": 400, "cookies": false, "type": "", "demo": "tablesdb\/get-transaction.md", @@ -26251,7 +26393,7 @@ "x-appwrite": { "method": "updateTransaction", "group": "transactions", - "weight": 443, + "weight": 401, "cookies": false, "type": "", "demo": "tablesdb\/update-transaction.md", @@ -26334,7 +26476,7 @@ "x-appwrite": { "method": "deleteTransaction", "group": "transactions", - "weight": 444, + "weight": 402, "cookies": false, "type": "", "demo": "tablesdb\/delete-transaction.md", @@ -26405,7 +26547,7 @@ "x-appwrite": { "method": "createOperations", "group": "transactions", - "weight": 446, + "weight": 404, "cookies": false, "type": "", "demo": "tablesdb\/create-operations.md", @@ -26495,7 +26637,7 @@ "x-appwrite": { "method": "get", "group": "tablesdb", - "weight": 383, + "weight": 341, "cookies": false, "type": "", "demo": "tablesdb\/get.md", @@ -26557,7 +26699,7 @@ "x-appwrite": { "method": "update", "group": "tablesdb", - "weight": 384, + "weight": 342, "cookies": false, "type": "", "demo": "tablesdb\/update.md", @@ -26611,10 +26753,7 @@ "description": "Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled.", "x-example": false } - }, - "required": [ - "name" - ] + } } } } @@ -26636,7 +26775,7 @@ "x-appwrite": { "method": "delete", "group": "tablesdb", - "weight": 385, + "weight": 343, "cookies": false, "type": "", "demo": "tablesdb\/delete.md", @@ -26700,7 +26839,7 @@ "x-appwrite": { "method": "listTables", "group": "tables", - "weight": 393, + "weight": 351, "cookies": false, "type": "", "demo": "tablesdb\/list-tables.md", @@ -26800,7 +26939,7 @@ "x-appwrite": { "method": "createTable", "group": "tables", - "weight": 389, + "weight": 347, "cookies": false, "type": "", "demo": "tablesdb\/create-table.md", @@ -26927,7 +27066,7 @@ "x-appwrite": { "method": "getTable", "group": "tables", - "weight": 390, + "weight": 348, "cookies": false, "type": "", "demo": "tablesdb\/get-table.md", @@ -27002,7 +27141,7 @@ "x-appwrite": { "method": "updateTable", "group": "tables", - "weight": 391, + "weight": 349, "cookies": false, "type": "", "demo": "tablesdb\/update-table.md", @@ -27083,10 +27222,7 @@ "description": "Is table enabled? When set to 'disabled', users cannot access the table but Server SDKs with and API key can still read and write to the table. No data is lost when this is toggled.", "x-example": false } - }, - "required": [ - "name" - ] + } } } } @@ -27108,7 +27244,7 @@ "x-appwrite": { "method": "deleteTable", "group": "tables", - "weight": 392, + "weight": 350, "cookies": false, "type": "", "demo": "tablesdb\/delete-table.md", @@ -27185,7 +27321,7 @@ "x-appwrite": { "method": "listColumns", "group": "columns", - "weight": 398, + "weight": 356, "cookies": false, "type": "", "demo": "tablesdb\/list-columns.md", @@ -27286,7 +27422,7 @@ "x-appwrite": { "method": "createBooleanColumn", "group": "columns", - "weight": 399, + "weight": 357, "cookies": false, "type": "", "demo": "tablesdb\/create-boolean-column.md", @@ -27399,7 +27535,7 @@ "x-appwrite": { "method": "updateBooleanColumn", "group": "columns", - "weight": 400, + "weight": 358, "cookies": false, "type": "", "demo": "tablesdb\/update-boolean-column.md", @@ -27517,7 +27653,7 @@ "x-appwrite": { "method": "createDatetimeColumn", "group": "columns", - "weight": 401, + "weight": 359, "cookies": false, "type": "", "demo": "tablesdb\/create-datetime-column.md", @@ -27630,7 +27766,7 @@ "x-appwrite": { "method": "updateDatetimeColumn", "group": "columns", - "weight": 402, + "weight": 360, "cookies": false, "type": "", "demo": "tablesdb\/update-datetime-column.md", @@ -27748,7 +27884,7 @@ "x-appwrite": { "method": "createEmailColumn", "group": "columns", - "weight": 403, + "weight": 361, "cookies": false, "type": "", "demo": "tablesdb\/create-email-column.md", @@ -27819,6 +27955,7 @@ "type": "string", "description": "Default value for column when not provided. Cannot be set when column is required.", "x-example": "email@example.com", + "format": "email", "x-nullable": true }, "array": { @@ -27861,7 +27998,7 @@ "x-appwrite": { "method": "updateEmailColumn", "group": "columns", - "weight": 404, + "weight": 362, "cookies": false, "type": "", "demo": "tablesdb\/update-email-column.md", @@ -27936,6 +28073,7 @@ "type": "string", "description": "Default value for column when not provided. Cannot be set when column is required.", "x-example": "email@example.com", + "format": "email", "x-nullable": true }, "newKey": { @@ -27979,7 +28117,7 @@ "x-appwrite": { "method": "createEnumColumn", "group": "columns", - "weight": 405, + "weight": 363, "cookies": false, "type": "", "demo": "tablesdb\/create-enum-column.md", @@ -28101,7 +28239,7 @@ "x-appwrite": { "method": "updateEnumColumn", "group": "columns", - "weight": 406, + "weight": 364, "cookies": false, "type": "", "demo": "tablesdb\/update-enum-column.md", @@ -28228,7 +28366,7 @@ "x-appwrite": { "method": "createFloatColumn", "group": "columns", - "weight": 407, + "weight": 365, "cookies": false, "type": "", "demo": "tablesdb\/create-float-column.md", @@ -28299,18 +28437,21 @@ "type": "number", "description": "Minimum value", "x-example": null, + "format": "float", "x-nullable": true }, "max": { "type": "number", "description": "Maximum value", "x-example": null, + "format": "float", "x-nullable": true }, "default": { "type": "number", "description": "Default value. Cannot be set when required.", "x-example": null, + "format": "float", "x-nullable": true }, "array": { @@ -28353,7 +28494,7 @@ "x-appwrite": { "method": "updateFloatColumn", "group": "columns", - "weight": 408, + "weight": 366, "cookies": false, "type": "", "demo": "tablesdb\/update-float-column.md", @@ -28428,18 +28569,21 @@ "type": "number", "description": "Minimum value", "x-example": null, + "format": "float", "x-nullable": true }, "max": { "type": "number", "description": "Maximum value", "x-example": null, + "format": "float", "x-nullable": true }, "default": { "type": "number", "description": "Default value. Cannot be set when required.", "x-example": null, + "format": "float", "x-nullable": true }, "newKey": { @@ -28483,7 +28627,7 @@ "x-appwrite": { "method": "createIntegerColumn", "group": "columns", - "weight": 409, + "weight": 367, "cookies": false, "type": "", "demo": "tablesdb\/create-integer-column.md", @@ -28554,18 +28698,21 @@ "type": "integer", "description": "Minimum value", "x-example": null, + "format": "int64", "x-nullable": true }, "max": { "type": "integer", "description": "Maximum value", "x-example": null, + "format": "int64", "x-nullable": true }, "default": { "type": "integer", "description": "Default value. Cannot be set when column is required.", "x-example": null, + "format": "int64", "x-nullable": true }, "array": { @@ -28608,7 +28755,7 @@ "x-appwrite": { "method": "updateIntegerColumn", "group": "columns", - "weight": 410, + "weight": 368, "cookies": false, "type": "", "demo": "tablesdb\/update-integer-column.md", @@ -28683,18 +28830,21 @@ "type": "integer", "description": "Minimum value", "x-example": null, + "format": "int64", "x-nullable": true }, "max": { "type": "integer", "description": "Maximum value", "x-example": null, + "format": "int64", "x-nullable": true }, "default": { "type": "integer", "description": "Default value. Cannot be set when column is required.", "x-example": null, + "format": "int64", "x-nullable": true }, "newKey": { @@ -28738,7 +28888,7 @@ "x-appwrite": { "method": "createIpColumn", "group": "columns", - "weight": 411, + "weight": 369, "cookies": false, "type": "", "demo": "tablesdb\/create-ip-column.md", @@ -28851,7 +29001,7 @@ "x-appwrite": { "method": "updateIpColumn", "group": "columns", - "weight": 412, + "weight": 370, "cookies": false, "type": "", "demo": "tablesdb\/update-ip-column.md", @@ -28969,7 +29119,7 @@ "x-appwrite": { "method": "createLineColumn", "group": "columns", - "weight": 413, + "weight": 371, "cookies": false, "type": "", "demo": "tablesdb\/create-line-column.md", @@ -29084,7 +29234,7 @@ "x-appwrite": { "method": "updateLineColumn", "group": "columns", - "weight": 414, + "weight": 372, "cookies": false, "type": "", "demo": "tablesdb\/update-line-column.md", @@ -29208,7 +29358,7 @@ "x-appwrite": { "method": "createPointColumn", "group": "columns", - "weight": 415, + "weight": 373, "cookies": false, "type": "", "demo": "tablesdb\/create-point-column.md", @@ -29323,7 +29473,7 @@ "x-appwrite": { "method": "updatePointColumn", "group": "columns", - "weight": 416, + "weight": 374, "cookies": false, "type": "", "demo": "tablesdb\/update-point-column.md", @@ -29447,7 +29597,7 @@ "x-appwrite": { "method": "createPolygonColumn", "group": "columns", - "weight": 417, + "weight": 375, "cookies": false, "type": "", "demo": "tablesdb\/create-polygon-column.md", @@ -29562,7 +29712,7 @@ "x-appwrite": { "method": "updatePolygonColumn", "group": "columns", - "weight": 418, + "weight": 376, "cookies": false, "type": "", "demo": "tablesdb\/update-polygon-column.md", @@ -29686,7 +29836,7 @@ "x-appwrite": { "method": "createRelationshipColumn", "group": "columns", - "weight": 419, + "weight": 377, "cookies": false, "type": "", "demo": "tablesdb\/create-relationship-column.md", @@ -29825,7 +29975,7 @@ "x-appwrite": { "method": "createStringColumn", "group": "columns", - "weight": 421, + "weight": 379, "cookies": false, "type": "", "demo": "tablesdb\/create-string-column.md", @@ -29890,7 +30040,8 @@ "size": { "type": "integer", "description": "Column size for text columns, in number of characters.", - "x-example": 1 + "x-example": 1, + "format": "int32" }, "required": { "type": "boolean", @@ -29949,7 +30100,7 @@ "x-appwrite": { "method": "updateStringColumn", "group": "columns", - "weight": 422, + "weight": 380, "cookies": false, "type": "", "demo": "tablesdb\/update-string-column.md", @@ -30030,6 +30181,7 @@ "type": "integer", "description": "Maximum size of the string column.", "x-example": 1, + "format": "int32", "x-nullable": true }, "newKey": { @@ -30073,7 +30225,7 @@ "x-appwrite": { "method": "createUrlColumn", "group": "columns", - "weight": 423, + "weight": 381, "cookies": false, "type": "", "demo": "tablesdb\/create-url-column.md", @@ -30144,6 +30296,7 @@ "type": "string", "description": "Default value for column when not provided. Cannot be set when column is required.", "x-example": "https:\/\/example.com", + "format": "url", "x-nullable": true }, "array": { @@ -30186,7 +30339,7 @@ "x-appwrite": { "method": "updateUrlColumn", "group": "columns", - "weight": 424, + "weight": 382, "cookies": false, "type": "", "demo": "tablesdb\/update-url-column.md", @@ -30261,6 +30414,7 @@ "type": "string", "description": "Default value for column when not provided. Cannot be set when column is required.", "x-example": "https:\/\/example.com", + "format": "url", "x-nullable": true }, "newKey": { @@ -30335,7 +30489,7 @@ "x-appwrite": { "method": "getColumn", "group": "columns", - "weight": 396, + "weight": 354, "cookies": false, "type": "", "demo": "tablesdb\/get-column.md", @@ -30412,7 +30566,7 @@ "x-appwrite": { "method": "deleteColumn", "group": "columns", - "weight": 397, + "weight": 355, "cookies": false, "type": "", "demo": "tablesdb\/delete-column.md", @@ -30498,7 +30652,7 @@ "x-appwrite": { "method": "updateRelationshipColumn", "group": "columns", - "weight": 420, + "weight": 378, "cookies": false, "type": "", "demo": "tablesdb\/update-relationship-column.md", @@ -30614,7 +30768,7 @@ "x-appwrite": { "method": "listIndexes", "group": "indexes", - "weight": 428, + "weight": 386, "cookies": false, "type": "", "demo": "tablesdb\/list-indexes.md", @@ -30713,7 +30867,7 @@ "x-appwrite": { "method": "createIndex", "group": "indexes", - "weight": 425, + "weight": 383, "cookies": false, "type": "", "demo": "tablesdb\/create-index.md", @@ -30854,7 +31008,7 @@ "x-appwrite": { "method": "getIndex", "group": "indexes", - "weight": 426, + "weight": 384, "cookies": false, "type": "", "demo": "tablesdb\/get-index.md", @@ -30931,7 +31085,7 @@ "x-appwrite": { "method": "deleteIndex", "group": "indexes", - "weight": 427, + "weight": 385, "cookies": false, "type": "", "demo": "tablesdb\/delete-index.md", @@ -31017,7 +31171,7 @@ "x-appwrite": { "method": "listRows", "group": "rows", - "weight": 437, + "weight": 395, "cookies": false, "type": "", "demo": "tablesdb\/list-rows.md", @@ -31130,7 +31284,7 @@ "x-appwrite": { "method": "createRow", "group": "rows", - "weight": 429, + "weight": 387, "cookies": false, "type": "", "demo": "tablesdb\/create-row.md", @@ -31316,7 +31470,7 @@ "x-appwrite": { "method": "upsertRows", "group": "rows", - "weight": 434, + "weight": 392, "cookies": false, "type": "", "demo": "tablesdb\/upsert-rows.md", @@ -31450,7 +31604,7 @@ "x-appwrite": { "method": "updateRows", "group": "rows", - "weight": 432, + "weight": 390, "cookies": false, "type": "", "demo": "tablesdb\/update-rows.md", @@ -31555,7 +31709,7 @@ "x-appwrite": { "method": "deleteRows", "group": "rows", - "weight": 436, + "weight": 394, "cookies": false, "type": "", "demo": "tablesdb\/delete-rows.md", @@ -31657,7 +31811,7 @@ "x-appwrite": { "method": "getRow", "group": "rows", - "weight": 430, + "weight": 388, "cookies": false, "type": "", "demo": "tablesdb\/get-row.md", @@ -31769,7 +31923,7 @@ "x-appwrite": { "method": "upsertRow", "group": "rows", - "weight": 433, + "weight": 391, "cookies": false, "type": "", "demo": "tablesdb\/upsert-row.md", @@ -31922,7 +32076,7 @@ "x-appwrite": { "method": "updateRow", "group": "rows", - "weight": 431, + "weight": 389, "cookies": false, "type": "", "demo": "tablesdb\/update-row.md", @@ -32035,7 +32189,7 @@ "x-appwrite": { "method": "deleteRow", "group": "rows", - "weight": 435, + "weight": 393, "cookies": false, "type": "", "demo": "tablesdb\/delete-row.md", @@ -32143,7 +32297,7 @@ "x-appwrite": { "method": "decrementRowColumn", "group": "rows", - "weight": 440, + "weight": 398, "cookies": false, "type": "", "demo": "tablesdb\/decrement-row-column.md", @@ -32226,12 +32380,14 @@ "value": { "type": "number", "description": "Value to increment the column by. The value must be a number.", - "x-example": null + "x-example": null, + "format": "float" }, "min": { "type": "number", "description": "Minimum value for the column. If the current value is lesser than this value, an exception will be thrown.", "x-example": null, + "format": "float", "x-nullable": true }, "transactionId": { @@ -32271,7 +32427,7 @@ "x-appwrite": { "method": "incrementRowColumn", "group": "rows", - "weight": 439, + "weight": 397, "cookies": false, "type": "", "demo": "tablesdb\/increment-row-column.md", @@ -32354,12 +32510,14 @@ "value": { "type": "number", "description": "Value to increment the column by. The value must be a number.", - "x-example": null + "x-example": null, + "format": "float" }, "max": { "type": "number", "description": "Maximum value for the column. If the current value is greater than this value, an error will be thrown.", "x-example": null, + "format": "float", "x-nullable": true }, "transactionId": { @@ -32399,7 +32557,7 @@ "x-appwrite": { "method": "list", "group": "teams", - "weight": 162, + "weight": 110, "cookies": false, "type": "", "demo": "teams\/list.md", @@ -32490,7 +32648,7 @@ "x-appwrite": { "method": "create", "group": "teams", - "weight": 161, + "weight": 109, "cookies": false, "type": "", "demo": "teams\/create.md", @@ -32579,7 +32737,7 @@ "x-appwrite": { "method": "get", "group": "teams", - "weight": 163, + "weight": 111, "cookies": false, "type": "", "demo": "teams\/get.md", @@ -32645,7 +32803,7 @@ "x-appwrite": { "method": "updateName", "group": "teams", - "weight": 165, + "weight": 113, "cookies": false, "type": "", "demo": "teams\/update-name.md", @@ -32723,7 +32881,7 @@ "x-appwrite": { "method": "delete", "group": "teams", - "weight": 167, + "weight": 115, "cookies": false, "type": "", "demo": "teams\/delete.md", @@ -32791,7 +32949,7 @@ "x-appwrite": { "method": "listMemberships", "group": "memberships", - "weight": 169, + "weight": 117, "cookies": false, "type": "", "demo": "teams\/list-memberships.md", @@ -32892,7 +33050,7 @@ "x-appwrite": { "method": "createMembership", "group": "memberships", - "weight": 168, + "weight": 116, "cookies": false, "type": "", "demo": "teams\/create-membership.md", @@ -32943,7 +33101,8 @@ "email": { "type": "string", "description": "Email of the new team member.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "userId": { "type": "string", @@ -32953,7 +33112,8 @@ "phone": { "type": "string", "description": "Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "roles": { "type": "array", @@ -32973,7 +33133,8 @@ "url": { "type": "string", "description": "URL to redirect the user back to your app from the invitation email. This parameter is not required when an API key is supplied. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.", - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" }, "name": { "type": "string", @@ -33014,7 +33175,7 @@ "x-appwrite": { "method": "getMembership", "group": "memberships", - "weight": 170, + "weight": 118, "cookies": false, "type": "", "demo": "teams\/get-membership.md", @@ -33090,7 +33251,7 @@ "x-appwrite": { "method": "updateMembership", "group": "memberships", - "weight": 171, + "weight": 119, "cookies": false, "type": "", "demo": "teams\/update-membership.md", @@ -33188,7 +33349,7 @@ "x-appwrite": { "method": "deleteMembership", "group": "memberships", - "weight": 173, + "weight": 121, "cookies": false, "type": "", "demo": "teams\/delete-membership.md", @@ -33266,7 +33427,7 @@ "x-appwrite": { "method": "updateMembershipStatus", "group": "memberships", - "weight": 172, + "weight": 120, "cookies": false, "type": "", "demo": "teams\/update-membership-status.md", @@ -33367,7 +33528,7 @@ "x-appwrite": { "method": "getPrefs", "group": "teams", - "weight": 164, + "weight": 112, "cookies": false, "type": "", "demo": "teams\/get-prefs.md", @@ -33431,7 +33592,7 @@ "x-appwrite": { "method": "updatePrefs", "group": "teams", - "weight": 166, + "weight": 114, "cookies": false, "type": "", "demo": "teams\/update-prefs.md", @@ -33516,7 +33677,7 @@ "x-appwrite": { "method": "list", "group": "files", - "weight": 523, + "weight": 517, "cookies": false, "type": "", "demo": "tokens\/list.md", @@ -33611,7 +33772,7 @@ "x-appwrite": { "method": "createFileToken", "group": "files", - "weight": 521, + "weight": 515, "cookies": false, "type": "", "demo": "tokens\/create-file-token.md", @@ -33701,7 +33862,7 @@ "x-appwrite": { "method": "get", "group": "tokens", - "weight": 522, + "weight": 516, "cookies": false, "type": "", "demo": "tokens\/get.md", @@ -33762,7 +33923,7 @@ "x-appwrite": { "method": "update", "group": "tokens", - "weight": 524, + "weight": 518, "cookies": false, "type": "", "demo": "tokens\/update.md", @@ -33833,7 +33994,7 @@ "x-appwrite": { "method": "delete", "group": "tokens", - "weight": 525, + "weight": 519, "cookies": false, "type": "", "demo": "tokens\/delete.md", @@ -33896,7 +34057,7 @@ "x-appwrite": { "method": "list", "group": "users", - "weight": 184, + "weight": 132, "cookies": false, "type": "", "demo": "users\/list.md", @@ -33983,7 +34144,7 @@ "x-appwrite": { "method": "create", "group": "users", - "weight": 175, + "weight": 123, "cookies": false, "type": "", "demo": "users\/create.md", @@ -34024,12 +34185,14 @@ "type": "string", "description": "User email.", "x-example": "email@example.com", + "format": "email", "x-nullable": true }, "phone": { "type": "string", "description": "Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", "x-example": "+12065550100", + "format": "phone", "x-nullable": true }, "password": { @@ -34076,7 +34239,7 @@ "x-appwrite": { "method": "createArgon2User", "group": "users", - "weight": 178, + "weight": 126, "cookies": false, "type": "", "demo": "users\/create-argon-2-user.md", @@ -34116,12 +34279,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using Argon2.", - "x-example": "password" + "x-example": "password", + "format": "password" }, "name": { "type": "string", @@ -34164,7 +34329,7 @@ "x-appwrite": { "method": "createBcryptUser", "group": "users", - "weight": 176, + "weight": 124, "cookies": false, "type": "", "demo": "users\/create-bcrypt-user.md", @@ -34204,12 +34369,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using Bcrypt.", - "x-example": "password" + "x-example": "password", + "format": "password" }, "name": { "type": "string", @@ -34252,7 +34419,7 @@ "x-appwrite": { "method": "listIdentities", "group": "identities", - "weight": 192, + "weight": 140, "cookies": false, "type": "", "demo": "users\/list-identities.md", @@ -34334,7 +34501,7 @@ "x-appwrite": { "method": "deleteIdentity", "group": "identities", - "weight": 215, + "weight": 163, "cookies": false, "type": "", "demo": "users\/delete-identity.md", @@ -34398,7 +34565,7 @@ "x-appwrite": { "method": "createMD5User", "group": "users", - "weight": 177, + "weight": 125, "cookies": false, "type": "", "demo": "users\/create-md-5-user.md", @@ -34438,12 +34605,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using MD5.", - "x-example": "password" + "x-example": "password", + "format": "password" }, "name": { "type": "string", @@ -34486,7 +34655,7 @@ "x-appwrite": { "method": "createPHPassUser", "group": "users", - "weight": 180, + "weight": 128, "cookies": false, "type": "", "demo": "users\/create-ph-pass-user.md", @@ -34526,12 +34695,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using PHPass.", - "x-example": "password" + "x-example": "password", + "format": "password" }, "name": { "type": "string", @@ -34574,7 +34745,7 @@ "x-appwrite": { "method": "createScryptUser", "group": "users", - "weight": 181, + "weight": 129, "cookies": false, "type": "", "demo": "users\/create-scrypt-user.md", @@ -34614,12 +34785,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using Scrypt.", - "x-example": "password" + "x-example": "password", + "format": "password" }, "passwordSalt": { "type": "string", @@ -34629,22 +34802,26 @@ "passwordCpu": { "type": "integer", "description": "Optional CPU cost used to hash password.", - "x-example": null + "x-example": null, + "format": "int32" }, "passwordMemory": { "type": "integer", "description": "Optional memory cost used to hash password.", - "x-example": null + "x-example": null, + "format": "int32" }, "passwordParallel": { "type": "integer", "description": "Optional parallelization cost used to hash password.", - "x-example": null + "x-example": null, + "format": "int32" }, "passwordLength": { "type": "integer", "description": "Optional hash length used to hash password.", - "x-example": null + "x-example": null, + "format": "int32" }, "name": { "type": "string", @@ -34692,7 +34869,7 @@ "x-appwrite": { "method": "createScryptModifiedUser", "group": "users", - "weight": 182, + "weight": 130, "cookies": false, "type": "", "demo": "users\/create-scrypt-modified-user.md", @@ -34732,12 +34909,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using Scrypt Modified.", - "x-example": "password" + "x-example": "password", + "format": "password" }, "passwordSalt": { "type": "string", @@ -34798,7 +34977,7 @@ "x-appwrite": { "method": "createSHAUser", "group": "users", - "weight": 179, + "weight": 127, "cookies": false, "type": "", "demo": "users\/create-sha-user.md", @@ -34838,12 +35017,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using SHA.", - "x-example": "password" + "x-example": "password", + "format": "password" }, "passwordVersion": { "type": "string", @@ -34906,7 +35087,7 @@ "x-appwrite": { "method": "get", "group": "users", - "weight": 185, + "weight": 133, "cookies": false, "type": "", "demo": "users\/get.md", @@ -34961,7 +35142,7 @@ "x-appwrite": { "method": "delete", "group": "users", - "weight": 213, + "weight": 161, "cookies": false, "type": "", "demo": "users\/delete.md", @@ -35025,7 +35206,7 @@ "x-appwrite": { "method": "updateEmail", "group": "users", - "weight": 198, + "weight": 146, "cookies": false, "type": "", "demo": "users\/update-email.md", @@ -35072,7 +35253,8 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" } }, "required": [ @@ -35108,7 +35290,7 @@ "x-appwrite": { "method": "createJWT", "group": "sessions", - "weight": 216, + "weight": 164, "cookies": false, "type": "", "demo": "users\/create-jwt.md", @@ -35160,7 +35342,8 @@ "duration": { "type": "integer", "description": "Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds.", - "x-example": 0 + "x-example": 0, + "format": "int32" } } } @@ -35193,7 +35376,7 @@ "x-appwrite": { "method": "updateLabels", "group": "users", - "weight": 194, + "weight": 142, "cookies": false, "type": "", "demo": "users\/update-labels.md", @@ -35279,7 +35462,7 @@ "x-appwrite": { "method": "listLogs", "group": "logs", - "weight": 190, + "weight": 138, "cookies": false, "type": "", "demo": "users\/list-logs.md", @@ -35367,7 +35550,7 @@ "x-appwrite": { "method": "listMemberships", "group": "memberships", - "weight": 189, + "weight": 137, "cookies": false, "type": "", "demo": "users\/list-memberships.md", @@ -35466,7 +35649,7 @@ "x-appwrite": { "method": "updateMfa", "group": "users", - "weight": 203, + "weight": 151, "cookies": false, "type": "", "demo": "users\/update-mfa.md", @@ -35604,7 +35787,7 @@ "x-appwrite": { "method": "deleteMfaAuthenticator", "group": "mfa", - "weight": 208, + "weight": 156, "cookies": false, "type": "", "demo": "users\/delete-mfa-authenticator.md", @@ -35743,7 +35926,7 @@ "x-appwrite": { "method": "listMfaFactors", "group": "mfa", - "weight": 204, + "weight": 152, "cookies": false, "type": "", "demo": "users\/list-mfa-factors.md", @@ -35865,7 +36048,7 @@ "x-appwrite": { "method": "getMfaRecoveryCodes", "group": "mfa", - "weight": 205, + "weight": 153, "cookies": false, "type": "", "demo": "users\/get-mfa-recovery-codes.md", @@ -35985,7 +36168,7 @@ "x-appwrite": { "method": "updateMfaRecoveryCodes", "group": "mfa", - "weight": 207, + "weight": 155, "cookies": false, "type": "", "demo": "users\/update-mfa-recovery-codes.md", @@ -36105,7 +36288,7 @@ "x-appwrite": { "method": "createMfaRecoveryCodes", "group": "mfa", - "weight": 206, + "weight": 154, "cookies": false, "type": "", "demo": "users\/create-mfa-recovery-codes.md", @@ -36227,7 +36410,7 @@ "x-appwrite": { "method": "updateName", "group": "users", - "weight": 196, + "weight": 144, "cookies": false, "type": "", "demo": "users\/update-name.md", @@ -36310,7 +36493,7 @@ "x-appwrite": { "method": "updatePassword", "group": "users", - "weight": 197, + "weight": 145, "cookies": false, "type": "", "demo": "users\/update-password.md", @@ -36393,7 +36576,7 @@ "x-appwrite": { "method": "updatePhone", "group": "users", - "weight": 199, + "weight": 147, "cookies": false, "type": "", "demo": "users\/update-phone.md", @@ -36440,7 +36623,8 @@ "number": { "type": "string", "description": "User phone number.", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" } }, "required": [ @@ -36476,7 +36660,7 @@ "x-appwrite": { "method": "getPrefs", "group": "users", - "weight": 186, + "weight": 134, "cookies": false, "type": "", "demo": "users\/get-prefs.md", @@ -36538,7 +36722,7 @@ "x-appwrite": { "method": "updatePrefs", "group": "users", - "weight": 201, + "weight": 149, "cookies": false, "type": "", "demo": "users\/update-prefs.md", @@ -36621,7 +36805,7 @@ "x-appwrite": { "method": "listSessions", "group": "sessions", - "weight": 188, + "weight": 136, "cookies": false, "type": "", "demo": "users\/list-sessions.md", @@ -36694,7 +36878,7 @@ "x-appwrite": { "method": "createSession", "group": "sessions", - "weight": 209, + "weight": 157, "cookies": false, "type": "", "demo": "users\/create-session.md", @@ -36749,7 +36933,7 @@ "x-appwrite": { "method": "deleteSessions", "group": "sessions", - "weight": 212, + "weight": 160, "cookies": false, "type": "", "demo": "users\/delete-sessions.md", @@ -36806,7 +36990,7 @@ "x-appwrite": { "method": "deleteSession", "group": "sessions", - "weight": 211, + "weight": 159, "cookies": false, "type": "", "demo": "users\/delete-session.md", @@ -36880,7 +37064,7 @@ "x-appwrite": { "method": "updateStatus", "group": "users", - "weight": 193, + "weight": 141, "cookies": false, "type": "", "demo": "users\/update-status.md", @@ -36963,7 +37147,7 @@ "x-appwrite": { "method": "listTargets", "group": "targets", - "weight": 191, + "weight": 139, "cookies": false, "type": "", "demo": "users\/list-targets.md", @@ -37049,7 +37233,7 @@ "x-appwrite": { "method": "createTarget", "group": "targets", - "weight": 183, + "weight": 131, "cookies": false, "type": "", "demo": "users\/create-target.md", @@ -37161,7 +37345,7 @@ "x-appwrite": { "method": "getTarget", "group": "targets", - "weight": 187, + "weight": 135, "cookies": false, "type": "", "demo": "users\/get-target.md", @@ -37233,7 +37417,7 @@ "x-appwrite": { "method": "updateTarget", "group": "targets", - "weight": 202, + "weight": 150, "cookies": false, "type": "", "demo": "users\/update-target.md", @@ -37324,7 +37508,7 @@ "x-appwrite": { "method": "deleteTarget", "group": "targets", - "weight": 214, + "weight": 162, "cookies": false, "type": "", "demo": "users\/delete-target.md", @@ -37398,7 +37582,7 @@ "x-appwrite": { "method": "createToken", "group": "sessions", - "weight": 210, + "weight": 158, "cookies": false, "type": "", "demo": "users\/create-token.md", @@ -37445,12 +37629,14 @@ "length": { "type": "integer", "description": "Token length in characters. The default length is 6 characters", - "x-example": 4 + "x-example": 4, + "format": "int32" }, "expire": { "type": "integer", "description": "Token expiration period in seconds. The default expiration is 15 minutes.", - "x-example": 60 + "x-example": 60, + "format": "int32" } } } @@ -37483,7 +37669,7 @@ "x-appwrite": { "method": "updateEmailVerification", "group": "users", - "weight": 200, + "weight": 148, "cookies": false, "type": "", "demo": "users\/update-email-verification.md", @@ -37566,7 +37752,7 @@ "x-appwrite": { "method": "updatePhoneVerification", "group": "users", - "weight": 195, + "weight": 143, "cookies": false, "type": "", "demo": "users\/update-phone-verification.md", @@ -37689,7 +37875,7 @@ }, { "name": "console", - "description": "The Console service allows you to interact with console relevant informations." + "description": "The Console service allows you to interact with console relevant information." }, { "name": "migrations", @@ -38530,6 +38716,34 @@ "variables": "" } }, + "healthStatusList": { + "description": "Status List", + "type": "object", + "properties": { + "total": { + "type": "integer", + "description": "Total number of statuses that matched your query.", + "x-example": 5, + "format": "int32" + }, + "statuses": { + "type": "array", + "description": "List of statuses.", + "items": { + "$ref": "#\/components\/schemas\/healthStatus" + }, + "x-example": "" + } + }, + "required": [ + "total", + "statuses" + ], + "example": { + "total": 5, + "statuses": "" + } + }, "localeCodeList": { "description": "Locale codes list", "type": "object", @@ -39164,14 +39378,14 @@ "type": "integer", "description": "Minimum value to enforce for new documents.", "x-example": 1, - "format": "int32", + "format": "int64", "nullable": true }, "max": { "type": "integer", "description": "Maximum value to enforce for new documents.", "x-example": 10, - "format": "int32", + "format": "int64", "nullable": true }, "default": { @@ -40613,14 +40827,14 @@ "type": "integer", "description": "Minimum value to enforce for new documents.", "x-example": 1, - "format": "int32", + "format": "int64", "nullable": true }, "max": { "type": "integer", "description": "Maximum value to enforce for new documents.", "x-example": 10, - "format": "int32", + "format": "int64", "nullable": true }, "default": { @@ -43110,6 +43324,16 @@ "description": "Total number of chunks uploaded", "x-example": 17890, "format": "int32" + }, + "encryption": { + "type": "boolean", + "description": "Whether file contents are encrypted at rest.", + "x-example": true + }, + "compression": { + "type": "string", + "description": "Compression algorithm used for the file. Will be one of none, [gzip](https:\/\/en.wikipedia.org\/wiki\/Gzip), or [zstd](https:\/\/en.wikipedia.org\/wiki\/Zstd).", + "x-example": "gzip" } }, "required": [ @@ -43123,7 +43347,9 @@ "mimeType", "sizeOriginal", "chunksTotal", - "chunksUploaded" + "chunksUploaded", + "encryption", + "compression" ], "example": { "$id": "5e5ea5c16897e", @@ -43138,7 +43364,9 @@ "mimeType": "image\/png", "sizeOriginal": 17890, "chunksTotal": 17890, - "chunksUploaded": 17890 + "chunksUploaded": 17890, + "encryption": true, + "compression": "gzip" } }, "bucket": { @@ -43204,7 +43432,7 @@ }, "compression": { "type": "string", - "description": "Compression algorithm choosen for compression. Will be one of none, [gzip](https:\/\/en.wikipedia.org\/wiki\/Gzip), or [zstd](https:\/\/en.wikipedia.org\/wiki\/Zstd).", + "description": "Compression algorithm chosen for compression. Will be one of none, [gzip](https:\/\/en.wikipedia.org\/wiki\/Gzip), or [zstd](https:\/\/en.wikipedia.org\/wiki\/Zstd).", "x-example": "gzip" }, "encryption": { @@ -43221,6 +43449,12 @@ "type": "boolean", "description": "Image transformations are enabled.", "x-example": false + }, + "totalSize": { + "type": "integer", + "description": "Total size of this bucket in bytes.", + "x-example": 128, + "format": "int32" } }, "required": [ @@ -43236,7 +43470,8 @@ "compression", "encryption", "antivirus", - "transformations" + "transformations", + "totalSize" ], "example": { "$id": "5e5ea5c16897e", @@ -43256,7 +43491,8 @@ "compression": "gzip", "encryption": false, "antivirus": false, - "transformations": false + "transformations": false, + "totalSize": 128 } }, "resourceToken": { @@ -44190,13 +44426,14 @@ }, "status": { "type": "string", - "description": "The deployment status. Possible values are \"waiting\", \"processing\", \"building\", \"ready\", and \"failed\".", + "description": "The deployment status. Possible values are \"waiting\", \"processing\", \"building\", \"ready\", \"canceled\" and \"failed\".", "x-example": "ready", "enum": [ "waiting", "processing", "building", "ready", + "canceled", "failed" ] }, @@ -45272,7 +45509,7 @@ "status": { "type": "string", "description": "Status of delivery.", - "x-example": "Message status can be one of the following: draft, processing, scheduled, sent, or failed.", + "x-example": "processing", "enum": [ "draft", "processing", @@ -45318,7 +45555,7 @@ "subject": "Welcome to Appwrite", "content": "Hi there, welcome to Appwrite family." }, - "status": "Message status can be one of the following: draft, processing, scheduled, sent, or failed." + "status": "processing" } }, "topic": { diff --git a/app/config/specs/open-api3-latest-client.json b/app/config/specs/open-api3-latest-client.json index 7724b1644a..44caa47679 100644 --- a/app/config/specs/open-api3-latest-client.json +++ b/app/config/specs/open-api3-latest-client.json @@ -1,7 +1,7 @@ { "openapi": "3.0.0", "info": { - "version": "1.8.0", + "version": "1.8.1", "title": "Appwrite", "description": "Appwrite backend as a service cuts up to 70% of the time and costs required for building a modern application. We abstract and simplify common development tasks behind a REST APIs, to help you develop your app in a fast and secure way. For full API documentation and tutorials go to [https:\/\/appwrite.io\/docs](https:\/\/appwrite.io\/docs)", "termsOfService": "https:\/\/appwrite.io\/policy\/terms", @@ -48,7 +48,7 @@ "x-appwrite": { "method": "get", "group": "account", - "weight": 10, + "weight": 9, "cookies": false, "type": "", "demo": "account\/get.md", @@ -99,7 +99,7 @@ "x-appwrite": { "method": "create", "group": "account", - "weight": 9, + "weight": 8, "cookies": false, "type": "", "demo": "account\/create.md", @@ -140,7 +140,8 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", @@ -188,7 +189,7 @@ "x-appwrite": { "method": "updateEmail", "group": "account", - "weight": 35, + "weight": 34, "cookies": false, "type": "", "demo": "account\/update-email.md", @@ -224,12 +225,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password. Must be at least 8 chars.", - "x-example": "password" + "x-example": "password", + "format": "password" } }, "required": [ @@ -266,7 +269,7 @@ "x-appwrite": { "method": "listIdentities", "group": "identities", - "weight": 48, + "weight": 47, "cookies": false, "type": "", "demo": "account\/list-identities.md", @@ -338,7 +341,7 @@ "x-appwrite": { "method": "deleteIdentity", "group": "identities", - "weight": 49, + "weight": 48, "cookies": false, "type": "", "demo": "account\/delete-identity.md", @@ -403,12 +406,12 @@ "x-appwrite": { "method": "createJWT", "group": "tokens", - "weight": 30, + "weight": 29, "cookies": false, "type": "", "demo": "account\/create-jwt.md", - "rate-limit": 100, - "rate-time": 3600, + "rate-limit": 120, + "rate-time": 60, "rate-key": "url:{url},userId:{userId}", "scope": "account", "platforms": [ @@ -429,7 +432,24 @@ "Session": [], "JWT": [] } - ] + ], + "requestBody": { + "content": { + "application\/json": { + "schema": { + "type": "object", + "properties": { + "duration": { + "type": "integer", + "description": "Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds.", + "x-example": 0, + "format": "int32" + } + } + } + } + } + } } }, "\/account\/logs": { @@ -456,7 +476,7 @@ "x-appwrite": { "method": "listLogs", "group": "logs", - "weight": 32, + "weight": 31, "cookies": false, "type": "", "demo": "account\/list-logs.md", @@ -535,7 +555,7 @@ "x-appwrite": { "method": "updateMFA", "group": "mfa", - "weight": 306, + "weight": 253, "cookies": false, "type": "", "demo": "account\/update-mfa.md", @@ -607,7 +627,7 @@ "x-appwrite": { "method": "createMfaAuthenticator", "group": "mfa", - "weight": 308, + "weight": 255, "cookies": false, "type": "", "demo": "account\/create-mfa-authenticator.md", @@ -731,7 +751,7 @@ "x-appwrite": { "method": "updateMfaAuthenticator", "group": "mfa", - "weight": 309, + "weight": 256, "cookies": false, "type": "", "demo": "account\/update-mfa-authenticator.md", @@ -871,7 +891,7 @@ "x-appwrite": { "method": "deleteMfaAuthenticator", "group": "mfa", - "weight": 310, + "weight": 257, "cookies": false, "type": "", "demo": "account\/delete-mfa-authenticator.md", @@ -995,7 +1015,7 @@ "x-appwrite": { "method": "createMfaChallenge", "group": "mfa", - "weight": 314, + "weight": 261, "cookies": false, "type": "", "demo": "account\/create-mfa-challenge.md", @@ -1129,7 +1149,7 @@ "x-appwrite": { "method": "updateMfaChallenge", "group": "mfa", - "weight": 315, + "weight": 262, "cookies": false, "type": "", "demo": "account\/update-mfa-challenge.md", @@ -1267,7 +1287,7 @@ "x-appwrite": { "method": "listMfaFactors", "group": "mfa", - "weight": 307, + "weight": 254, "cookies": false, "type": "", "demo": "account\/list-mfa-factors.md", @@ -1368,7 +1388,7 @@ "x-appwrite": { "method": "getMfaRecoveryCodes", "group": "mfa", - "weight": 313, + "weight": 260, "cookies": false, "type": "", "demo": "account\/get-mfa-recovery-codes.md", @@ -1467,7 +1487,7 @@ "x-appwrite": { "method": "createMfaRecoveryCodes", "group": "mfa", - "weight": 311, + "weight": 258, "cookies": false, "type": "", "demo": "account\/create-mfa-recovery-codes.md", @@ -1566,7 +1586,7 @@ "x-appwrite": { "method": "updateMfaRecoveryCodes", "group": "mfa", - "weight": 312, + "weight": 259, "cookies": false, "type": "", "demo": "account\/update-mfa-recovery-codes.md", @@ -1667,7 +1687,7 @@ "x-appwrite": { "method": "updateName", "group": "account", - "weight": 33, + "weight": 32, "cookies": false, "type": "", "demo": "account\/update-name.md", @@ -1739,7 +1759,7 @@ "x-appwrite": { "method": "updatePassword", "group": "account", - "weight": 34, + "weight": 33, "cookies": false, "type": "", "demo": "account\/update-password.md", @@ -1780,7 +1800,8 @@ "oldPassword": { "type": "string", "description": "Current user password. Must be at least 8 chars.", - "x-example": "password" + "x-example": "password", + "format": "password" } }, "required": [ @@ -1816,7 +1837,7 @@ "x-appwrite": { "method": "updatePhone", "group": "account", - "weight": 36, + "weight": 35, "cookies": false, "type": "", "demo": "account\/update-phone.md", @@ -1852,12 +1873,14 @@ "phone": { "type": "string", "description": "Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "password": { "type": "string", "description": "User password. Must be at least 8 chars.", - "x-example": "password" + "x-example": "password", + "format": "password" } }, "required": [ @@ -1894,7 +1917,7 @@ "x-appwrite": { "method": "getPrefs", "group": "account", - "weight": 31, + "weight": 30, "cookies": false, "type": "", "demo": "account\/get-prefs.md", @@ -1945,7 +1968,7 @@ "x-appwrite": { "method": "updatePrefs", "group": "account", - "weight": 37, + "weight": 36, "cookies": false, "type": "", "demo": "account\/update-prefs.md", @@ -2017,7 +2040,7 @@ "x-appwrite": { "method": "createRecovery", "group": "recovery", - "weight": 39, + "weight": 38, "cookies": false, "type": "", "demo": "account\/create-recovery.md", @@ -2056,12 +2079,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "url": { "type": "string", "description": "URL to redirect the user back to your app from the recovery email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.", - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" } }, "required": [ @@ -2096,7 +2121,7 @@ "x-appwrite": { "method": "updateRecovery", "group": "recovery", - "weight": 40, + "weight": 39, "cookies": false, "type": "", "demo": "account\/update-recovery.md", @@ -2180,7 +2205,7 @@ "x-appwrite": { "method": "listSessions", "group": "sessions", - "weight": 12, + "weight": 11, "cookies": false, "type": "", "demo": "account\/list-sessions.md", @@ -2224,7 +2249,7 @@ "x-appwrite": { "method": "deleteSessions", "group": "sessions", - "weight": 13, + "weight": 12, "cookies": false, "type": "", "demo": "account\/delete-sessions.md", @@ -2277,7 +2302,7 @@ "x-appwrite": { "method": "createAnonymousSession", "group": "sessions", - "weight": 18, + "weight": 17, "cookies": false, "type": "", "demo": "account\/create-anonymous-session.md", @@ -2330,7 +2355,7 @@ "x-appwrite": { "method": "createEmailPasswordSession", "group": "sessions", - "weight": 17, + "weight": 16, "cookies": false, "type": "", "demo": "account\/create-email-password-session.md", @@ -2366,12 +2391,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password. Must be at least 8 chars.", - "x-example": "password" + "x-example": "password", + "format": "password" } }, "required": [ @@ -2408,7 +2435,7 @@ "x-appwrite": { "method": "updateMagicURLSession", "group": "sessions", - "weight": 27, + "weight": 26, "cookies": false, "type": "", "demo": "account\/update-magic-url-session.md", @@ -2483,7 +2510,7 @@ "x-appwrite": { "method": "createOAuth2Session", "group": "sessions", - "weight": 20, + "weight": 19, "cookies": false, "type": "webAuth", "demo": "account\/create-o-auth-2-session.md", @@ -2557,8 +2584,7 @@ "yammer", "yandex", "zoho", - "zoom", - "mock" + "zoom" ], "x-enum-name": "OAuthProvider", "x-enum-keys": [] @@ -2629,7 +2655,7 @@ "x-appwrite": { "method": "updatePhoneSession", "group": "sessions", - "weight": 28, + "weight": 27, "cookies": false, "type": "", "demo": "account\/update-phone-session.md", @@ -2711,7 +2737,7 @@ "x-appwrite": { "method": "createSession", "group": "sessions", - "weight": 19, + "weight": 18, "cookies": false, "type": "", "demo": "account\/create-session.md", @@ -2789,7 +2815,7 @@ "x-appwrite": { "method": "getSession", "group": "sessions", - "weight": 14, + "weight": 13, "cookies": false, "type": "", "demo": "account\/get-session.md", @@ -2852,7 +2878,7 @@ "x-appwrite": { "method": "updateSession", "group": "sessions", - "weight": 16, + "weight": 15, "cookies": false, "type": "", "demo": "account\/update-session.md", @@ -2908,7 +2934,7 @@ "x-appwrite": { "method": "deleteSession", "group": "sessions", - "weight": 15, + "weight": 14, "cookies": false, "type": "", "demo": "account\/delete-session.md", @@ -2973,7 +2999,7 @@ "x-appwrite": { "method": "updateStatus", "group": "account", - "weight": 38, + "weight": 37, "cookies": false, "type": "", "demo": "account\/update-status.md", @@ -3026,7 +3052,7 @@ "x-appwrite": { "method": "createPushTarget", "group": "pushTargets", - "weight": 45, + "weight": 44, "cookies": false, "type": "", "demo": "account\/create-push-target.md", @@ -3107,7 +3133,7 @@ "x-appwrite": { "method": "updatePushTarget", "group": "pushTargets", - "weight": 46, + "weight": 45, "cookies": false, "type": "", "demo": "account\/update-push-target.md", @@ -3180,7 +3206,7 @@ "x-appwrite": { "method": "deletePushTarget", "group": "pushTargets", - "weight": 47, + "weight": 46, "cookies": false, "type": "", "demo": "account\/delete-push-target.md", @@ -3243,7 +3269,7 @@ "x-appwrite": { "method": "createEmailToken", "group": "tokens", - "weight": 26, + "weight": 25, "cookies": false, "type": "", "demo": "account\/create-email-token.md", @@ -3287,7 +3313,8 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "phrase": { "type": "boolean", @@ -3329,7 +3356,7 @@ "x-appwrite": { "method": "createMagicURLToken", "group": "tokens", - "weight": 25, + "weight": 24, "cookies": false, "type": "", "demo": "account\/create-magic-url-token.md", @@ -3373,12 +3400,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "url": { "type": "string", "description": "URL to redirect the user back to your app from the magic URL login. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.", - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" }, "phrase": { "type": "boolean", @@ -3413,7 +3442,7 @@ "x-appwrite": { "method": "createOAuth2Token", "group": "tokens", - "weight": 24, + "weight": 23, "cookies": false, "type": "webAuth", "demo": "account\/create-o-auth-2-token.md", @@ -3487,8 +3516,7 @@ "yammer", "yandex", "zoho", - "zoom", - "mock" + "zoom" ], "x-enum-name": "OAuthProvider", "x-enum-keys": [] @@ -3559,7 +3587,7 @@ "x-appwrite": { "method": "createPhoneToken", "group": "tokens", - "weight": 29, + "weight": 28, "cookies": false, "type": "", "demo": "account\/create-phone-token.md", @@ -3603,7 +3631,8 @@ "phone": { "type": "string", "description": "Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" } }, "required": [ @@ -3640,7 +3669,7 @@ "x-appwrite": { "method": "createEmailVerification", "group": "verification", - "weight": 41, + "weight": 40, "cookies": false, "type": "", "demo": "account\/create-email-verification.md", @@ -3728,7 +3757,8 @@ "url": { "type": "string", "description": "URL to redirect the user back to your app from the verification email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.", - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" } }, "required": [ @@ -3762,7 +3792,7 @@ "x-appwrite": { "method": "updateEmailVerification", "group": "verification", - "weight": 42, + "weight": 41, "cookies": false, "type": "", "demo": "account\/update-email-verification.md", @@ -3896,7 +3926,7 @@ "x-appwrite": { "method": "createPhoneVerification", "group": "verification", - "weight": 43, + "weight": 42, "cookies": false, "type": "", "demo": "account\/create-phone-verification.md", @@ -3950,7 +3980,7 @@ "x-appwrite": { "method": "updatePhoneVerification", "group": "verification", - "weight": 44, + "weight": 43, "cookies": false, "type": "", "demo": "account\/update-phone-verification.md", @@ -4021,7 +4051,7 @@ "x-appwrite": { "method": "getBrowser", "group": null, - "weight": 51, + "weight": 264, "cookies": false, "type": "location", "demo": "avatars\/get-browser.md", @@ -4149,7 +4179,7 @@ "x-appwrite": { "method": "getCreditCard", "group": null, - "weight": 50, + "weight": 263, "cookies": false, "type": "location", "demo": "avatars\/get-credit-card.md", @@ -4283,7 +4313,7 @@ "x-appwrite": { "method": "getFavicon", "group": null, - "weight": 54, + "weight": 267, "cookies": false, "type": "location", "demo": "avatars\/get-favicon.md", @@ -4343,7 +4373,7 @@ "x-appwrite": { "method": "getFlag", "group": null, - "weight": 52, + "weight": 265, "cookies": false, "type": "location", "demo": "avatars\/get-flag.md", @@ -4833,7 +4863,7 @@ "x-appwrite": { "method": "getImage", "group": null, - "weight": 53, + "weight": 266, "cookies": false, "type": "location", "demo": "avatars\/get-image.md", @@ -4917,7 +4947,7 @@ "x-appwrite": { "method": "getInitials", "group": null, - "weight": 56, + "weight": 269, "cookies": false, "type": "location", "demo": "avatars\/get-initials.md", @@ -5011,7 +5041,7 @@ "x-appwrite": { "method": "getQR", "group": null, - "weight": 55, + "weight": 268, "cookies": false, "type": "location", "demo": "avatars\/get-qr.md", @@ -5105,7 +5135,7 @@ "x-appwrite": { "method": "getScreenshot", "group": null, - "weight": 57, + "weight": 270, "cookies": false, "type": "location", "demo": "avatars\/get-screenshot.md", @@ -5825,7 +5855,7 @@ "avif", "gif" ], - "x-enum-name": null, + "x-enum-name": "ImageFormat", "x-enum-keys": [], "default": "" }, @@ -5858,7 +5888,7 @@ "x-appwrite": { "method": "listTransactions", "group": "transactions", - "weight": 380, + "weight": 338, "cookies": false, "type": "", "demo": "databases\/list-transactions.md", @@ -5925,7 +5955,7 @@ "x-appwrite": { "method": "createTransaction", "group": "transactions", - "weight": 376, + "weight": 334, "cookies": false, "type": "", "demo": "databases\/create-transaction.md", @@ -5962,7 +5992,8 @@ "ttl": { "type": "integer", "description": "Seconds before the transaction expires.", - "x-example": 60 + "x-example": 60, + "format": "int32" } } } @@ -5995,7 +6026,7 @@ "x-appwrite": { "method": "getTransaction", "group": "transactions", - "weight": 377, + "weight": 335, "cookies": false, "type": "", "demo": "databases\/get-transaction.md", @@ -6059,7 +6090,7 @@ "x-appwrite": { "method": "updateTransaction", "group": "transactions", - "weight": 378, + "weight": 336, "cookies": false, "type": "", "demo": "databases\/update-transaction.md", @@ -6137,7 +6168,7 @@ "x-appwrite": { "method": "deleteTransaction", "group": "transactions", - "weight": 379, + "weight": 337, "cookies": false, "type": "", "demo": "databases\/delete-transaction.md", @@ -6203,7 +6234,7 @@ "x-appwrite": { "method": "createOperations", "group": "transactions", - "weight": 381, + "weight": 339, "cookies": false, "type": "", "demo": "databases\/create-operations.md", @@ -6288,7 +6319,7 @@ "x-appwrite": { "method": "listDocuments", "group": "documents", - "weight": 339, + "weight": 297, "cookies": false, "type": "", "demo": "databases\/list-documents.md", @@ -6400,7 +6431,7 @@ "x-appwrite": { "method": "createDocument", "group": "documents", - "weight": 331, + "weight": 289, "cookies": false, "type": "", "demo": "databases\/create-document.md", @@ -6561,7 +6592,7 @@ "x-appwrite": { "method": "getDocument", "group": "documents", - "weight": 332, + "weight": 290, "cookies": false, "type": "", "demo": "databases\/get-document.md", @@ -6672,7 +6703,7 @@ "x-appwrite": { "method": "upsertDocument", "group": "documents", - "weight": 335, + "weight": 293, "cookies": false, "type": "", "demo": "databases\/upsert-document.md", @@ -6827,7 +6858,7 @@ "x-appwrite": { "method": "updateDocument", "group": "documents", - "weight": 333, + "weight": 291, "cookies": false, "type": "", "demo": "databases\/update-document.md", @@ -6939,7 +6970,7 @@ "x-appwrite": { "method": "deleteDocument", "group": "documents", - "weight": 337, + "weight": 295, "cookies": false, "type": "", "demo": "databases\/delete-document.md", @@ -7046,7 +7077,7 @@ "x-appwrite": { "method": "decrementDocumentAttribute", "group": "documents", - "weight": 342, + "weight": 300, "cookies": false, "type": "", "demo": "databases\/decrement-document-attribute.md", @@ -7128,12 +7159,14 @@ "value": { "type": "number", "description": "Value to increment the attribute by. The value must be a number.", - "x-example": null + "x-example": null, + "format": "float" }, "min": { "type": "number", "description": "Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown.", "x-example": null, + "format": "float", "x-nullable": true }, "transactionId": { @@ -7173,7 +7206,7 @@ "x-appwrite": { "method": "incrementDocumentAttribute", "group": "documents", - "weight": 341, + "weight": 299, "cookies": false, "type": "", "demo": "databases\/increment-document-attribute.md", @@ -7255,12 +7288,14 @@ "value": { "type": "number", "description": "Value to increment the attribute by. The value must be a number.", - "x-example": null + "x-example": null, + "format": "float" }, "max": { "type": "number", "description": "Maximum value for the attribute. If the current value is greater than this value, an error will be thrown.", "x-example": null, + "format": "float", "x-nullable": true }, "transactionId": { @@ -7300,7 +7335,7 @@ "x-appwrite": { "method": "listExecutions", "group": "executions", - "weight": 472, + "weight": 431, "cookies": false, "type": "", "demo": "functions\/list-executions.md", @@ -7387,7 +7422,7 @@ "x-appwrite": { "method": "createExecution", "group": "executions", - "weight": 470, + "weight": 429, "cookies": false, "type": "", "demo": "functions\/create-execution.md", @@ -7505,7 +7540,7 @@ "x-appwrite": { "method": "getExecution", "group": "executions", - "weight": 471, + "weight": 430, "cookies": false, "type": "", "demo": "functions\/get-execution.md", @@ -7580,7 +7615,7 @@ "x-appwrite": { "method": "query", "group": "graphql", - "weight": 241, + "weight": 190, "cookies": false, "type": "graphql", "demo": "graphql\/query.md", @@ -7634,7 +7669,7 @@ "x-appwrite": { "method": "mutation", "group": "graphql", - "weight": 240, + "weight": 189, "cookies": false, "type": "graphql", "demo": "graphql\/mutation.md", @@ -7688,7 +7723,7 @@ "x-appwrite": { "method": "get", "group": null, - "weight": 61, + "weight": 49, "cookies": false, "type": "", "demo": "locale\/get.md", @@ -7742,7 +7777,7 @@ "x-appwrite": { "method": "listCodes", "group": null, - "weight": 62, + "weight": 50, "cookies": false, "type": "", "demo": "locale\/list-codes.md", @@ -7796,7 +7831,7 @@ "x-appwrite": { "method": "listContinents", "group": null, - "weight": 66, + "weight": 54, "cookies": false, "type": "", "demo": "locale\/list-continents.md", @@ -7850,7 +7885,7 @@ "x-appwrite": { "method": "listCountries", "group": null, - "weight": 63, + "weight": 51, "cookies": false, "type": "", "demo": "locale\/list-countries.md", @@ -7904,7 +7939,7 @@ "x-appwrite": { "method": "listCountriesEU", "group": null, - "weight": 64, + "weight": 52, "cookies": false, "type": "", "demo": "locale\/list-countries-eu.md", @@ -7958,7 +7993,7 @@ "x-appwrite": { "method": "listCountriesPhones", "group": null, - "weight": 65, + "weight": 53, "cookies": false, "type": "", "demo": "locale\/list-countries-phones.md", @@ -8012,7 +8047,7 @@ "x-appwrite": { "method": "listCurrencies", "group": null, - "weight": 67, + "weight": 55, "cookies": false, "type": "", "demo": "locale\/list-currencies.md", @@ -8066,7 +8101,7 @@ "x-appwrite": { "method": "listLanguages", "group": null, - "weight": 68, + "weight": 56, "cookies": false, "type": "", "demo": "locale\/list-languages.md", @@ -8120,7 +8155,7 @@ "x-appwrite": { "method": "createSubscriber", "group": "subscribers", - "weight": 290, + "weight": 237, "cookies": false, "type": "", "demo": "messaging\/create-subscriber.md", @@ -8204,7 +8239,7 @@ "x-appwrite": { "method": "deleteSubscriber", "group": "subscribers", - "weight": 294, + "weight": 241, "cookies": false, "type": "", "demo": "messaging\/delete-subscriber.md", @@ -8280,7 +8315,7 @@ "x-appwrite": { "method": "listFiles", "group": "files", - "weight": 151, + "weight": 527, "cookies": false, "type": "", "demo": "storage\/list-files.md", @@ -8379,7 +8414,7 @@ "x-appwrite": { "method": "createFile", "group": "files", - "weight": 150, + "weight": 525, "cookies": false, "type": "upload", "demo": "storage\/create-file.md", @@ -8434,7 +8469,8 @@ "file": { "type": "string", "description": "Binary file. Appwrite SDKs provide helpers to handle file input. [Learn about file input](https:\/\/appwrite.io\/docs\/products\/storage\/upload-download#input-file).", - "x-example": null + "x-example": null, + "format": "binary" }, "permissions": { "type": "array", @@ -8480,7 +8516,7 @@ "x-appwrite": { "method": "getFile", "group": "files", - "weight": 152, + "weight": 526, "cookies": false, "type": "", "demo": "storage\/get-file.md", @@ -8554,13 +8590,13 @@ "x-appwrite": { "method": "updateFile", "group": "files", - "weight": 157, + "weight": 528, "cookies": false, "type": "", "demo": "storage\/update-file.md", - "rate-limit": 60, - "rate-time": 60, - "rate-key": "ip:{ip},method:{method},url:{url},userId:{userId}", + "rate-limit": 0, + "rate-time": 3600, + "rate-key": "url:{url},ip:{ip}", "scope": "files.write", "platforms": [ "console", @@ -8585,7 +8621,7 @@ "parameters": [ { "name": "bucketId", - "description": "Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https:\/\/appwrite.io\/docs\/server\/storage#createBucket).", + "description": "Bucket unique ID.", "required": true, "schema": { "type": "string", @@ -8595,7 +8631,7 @@ }, { "name": "fileId", - "description": "File unique ID.", + "description": "File ID.", "required": true, "schema": { "type": "string", @@ -8612,13 +8648,12 @@ "properties": { "name": { "type": "string", - "description": "Name of the file", - "x-example": "", - "x-nullable": true + "description": "File name.", + "x-example": "" }, "permissions": { "type": "array", - "description": "An array of permission string. By default, the current permissions are inherited. [Learn more about permissions](https:\/\/appwrite.io\/docs\/permissions).", + "description": "An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https:\/\/appwrite.io\/docs\/permissions).", "x-example": "[\"read(\"any\")\"]", "items": { "type": "string" @@ -8647,7 +8682,7 @@ "x-appwrite": { "method": "deleteFile", "group": "files", - "weight": 158, + "weight": 529, "cookies": false, "type": "", "demo": "storage\/delete-file.md", @@ -8716,7 +8751,7 @@ "x-appwrite": { "method": "getFileDownload", "group": "files", - "weight": 154, + "weight": 531, "cookies": false, "type": "location", "demo": "storage\/get-file-download.md", @@ -8796,7 +8831,7 @@ "x-appwrite": { "method": "getFilePreview", "group": "files", - "weight": 153, + "weight": 530, "cookies": false, "type": "location", "demo": "storage\/get-file-preview.md", @@ -9026,7 +9061,7 @@ "x-appwrite": { "method": "getFileView", "group": "files", - "weight": 155, + "weight": 532, "cookies": false, "type": "location", "demo": "storage\/get-file-view.md", @@ -9113,7 +9148,7 @@ "x-appwrite": { "method": "listTransactions", "group": "transactions", - "weight": 445, + "weight": 403, "cookies": false, "type": "", "demo": "tablesdb\/list-transactions.md", @@ -9183,7 +9218,7 @@ "x-appwrite": { "method": "createTransaction", "group": "transactions", - "weight": 441, + "weight": 399, "cookies": false, "type": "", "demo": "tablesdb\/create-transaction.md", @@ -9223,7 +9258,8 @@ "ttl": { "type": "integer", "description": "Seconds before the transaction expires.", - "x-example": 60 + "x-example": 60, + "format": "int32" } } } @@ -9256,7 +9292,7 @@ "x-appwrite": { "method": "getTransaction", "group": "transactions", - "weight": 442, + "weight": 400, "cookies": false, "type": "", "demo": "tablesdb\/get-transaction.md", @@ -9323,7 +9359,7 @@ "x-appwrite": { "method": "updateTransaction", "group": "transactions", - "weight": 443, + "weight": 401, "cookies": false, "type": "", "demo": "tablesdb\/update-transaction.md", @@ -9404,7 +9440,7 @@ "x-appwrite": { "method": "deleteTransaction", "group": "transactions", - "weight": 444, + "weight": 402, "cookies": false, "type": "", "demo": "tablesdb\/delete-transaction.md", @@ -9473,7 +9509,7 @@ "x-appwrite": { "method": "createOperations", "group": "transactions", - "weight": 446, + "weight": 404, "cookies": false, "type": "", "demo": "tablesdb\/create-operations.md", @@ -9561,7 +9597,7 @@ "x-appwrite": { "method": "listRows", "group": "rows", - "weight": 437, + "weight": 395, "cookies": false, "type": "", "demo": "tablesdb\/list-rows.md", @@ -9672,7 +9708,7 @@ "x-appwrite": { "method": "createRow", "group": "rows", - "weight": 429, + "weight": 387, "cookies": false, "type": "", "demo": "tablesdb\/create-row.md", @@ -9828,7 +9864,7 @@ "x-appwrite": { "method": "getRow", "group": "rows", - "weight": 430, + "weight": 388, "cookies": false, "type": "", "demo": "tablesdb\/get-row.md", @@ -9938,7 +9974,7 @@ "x-appwrite": { "method": "upsertRow", "group": "rows", - "weight": 433, + "weight": 391, "cookies": false, "type": "", "demo": "tablesdb\/upsert-row.md", @@ -10088,7 +10124,7 @@ "x-appwrite": { "method": "updateRow", "group": "rows", - "weight": 431, + "weight": 389, "cookies": false, "type": "", "demo": "tablesdb\/update-row.md", @@ -10199,7 +10235,7 @@ "x-appwrite": { "method": "deleteRow", "group": "rows", - "weight": 435, + "weight": 393, "cookies": false, "type": "", "demo": "tablesdb\/delete-row.md", @@ -10305,7 +10341,7 @@ "x-appwrite": { "method": "decrementRowColumn", "group": "rows", - "weight": 440, + "weight": 398, "cookies": false, "type": "", "demo": "tablesdb\/decrement-row-column.md", @@ -10386,12 +10422,14 @@ "value": { "type": "number", "description": "Value to increment the column by. The value must be a number.", - "x-example": null + "x-example": null, + "format": "float" }, "min": { "type": "number", "description": "Minimum value for the column. If the current value is lesser than this value, an exception will be thrown.", "x-example": null, + "format": "float", "x-nullable": true }, "transactionId": { @@ -10431,7 +10469,7 @@ "x-appwrite": { "method": "incrementRowColumn", "group": "rows", - "weight": 439, + "weight": 397, "cookies": false, "type": "", "demo": "tablesdb\/increment-row-column.md", @@ -10512,12 +10550,14 @@ "value": { "type": "number", "description": "Value to increment the column by. The value must be a number.", - "x-example": null + "x-example": null, + "format": "float" }, "max": { "type": "number", "description": "Maximum value for the column. If the current value is greater than this value, an error will be thrown.", "x-example": null, + "format": "float", "x-nullable": true }, "transactionId": { @@ -10557,7 +10597,7 @@ "x-appwrite": { "method": "list", "group": "teams", - "weight": 162, + "weight": 110, "cookies": false, "type": "", "demo": "teams\/list.md", @@ -10646,7 +10686,7 @@ "x-appwrite": { "method": "create", "group": "teams", - "weight": 161, + "weight": 109, "cookies": false, "type": "", "demo": "teams\/create.md", @@ -10733,7 +10773,7 @@ "x-appwrite": { "method": "get", "group": "teams", - "weight": 163, + "weight": 111, "cookies": false, "type": "", "demo": "teams\/get.md", @@ -10797,7 +10837,7 @@ "x-appwrite": { "method": "updateName", "group": "teams", - "weight": 165, + "weight": 113, "cookies": false, "type": "", "demo": "teams\/update-name.md", @@ -10873,7 +10913,7 @@ "x-appwrite": { "method": "delete", "group": "teams", - "weight": 167, + "weight": 115, "cookies": false, "type": "", "demo": "teams\/delete.md", @@ -10939,7 +10979,7 @@ "x-appwrite": { "method": "listMemberships", "group": "memberships", - "weight": 169, + "weight": 117, "cookies": false, "type": "", "demo": "teams\/list-memberships.md", @@ -11038,7 +11078,7 @@ "x-appwrite": { "method": "createMembership", "group": "memberships", - "weight": 168, + "weight": 116, "cookies": false, "type": "", "demo": "teams\/create-membership.md", @@ -11087,7 +11127,8 @@ "email": { "type": "string", "description": "Email of the new team member.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "userId": { "type": "string", @@ -11097,7 +11138,8 @@ "phone": { "type": "string", "description": "Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "roles": { "type": "array", @@ -11117,7 +11159,8 @@ "url": { "type": "string", "description": "URL to redirect the user back to your app from the invitation email. This parameter is not required when an API key is supplied. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.", - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" }, "name": { "type": "string", @@ -11158,7 +11201,7 @@ "x-appwrite": { "method": "getMembership", "group": "memberships", - "weight": 170, + "weight": 118, "cookies": false, "type": "", "demo": "teams\/get-membership.md", @@ -11232,7 +11275,7 @@ "x-appwrite": { "method": "updateMembership", "group": "memberships", - "weight": 171, + "weight": 119, "cookies": false, "type": "", "demo": "teams\/update-membership.md", @@ -11328,7 +11371,7 @@ "x-appwrite": { "method": "deleteMembership", "group": "memberships", - "weight": 173, + "weight": 121, "cookies": false, "type": "", "demo": "teams\/delete-membership.md", @@ -11404,7 +11447,7 @@ "x-appwrite": { "method": "updateMembershipStatus", "group": "memberships", - "weight": 172, + "weight": 120, "cookies": false, "type": "", "demo": "teams\/update-membership-status.md", @@ -11504,7 +11547,7 @@ "x-appwrite": { "method": "getPrefs", "group": "teams", - "weight": 164, + "weight": 112, "cookies": false, "type": "", "demo": "teams\/get-prefs.md", @@ -11567,7 +11610,7 @@ "x-appwrite": { "method": "updatePrefs", "group": "teams", - "weight": 166, + "weight": 114, "cookies": false, "type": "", "demo": "teams\/update-prefs.md", @@ -11691,7 +11734,7 @@ }, { "name": "console", - "description": "The Console service allows you to interact with console relevant informations." + "description": "The Console service allows you to interact with console relevant information." }, { "name": "migrations", @@ -13411,6 +13454,16 @@ "description": "Total number of chunks uploaded", "x-example": 17890, "format": "int32" + }, + "encryption": { + "type": "boolean", + "description": "Whether file contents are encrypted at rest.", + "x-example": true + }, + "compression": { + "type": "string", + "description": "Compression algorithm used for the file. Will be one of none, [gzip](https:\/\/en.wikipedia.org\/wiki\/Gzip), or [zstd](https:\/\/en.wikipedia.org\/wiki\/Zstd).", + "x-example": "gzip" } }, "required": [ @@ -13424,7 +13477,9 @@ "mimeType", "sizeOriginal", "chunksTotal", - "chunksUploaded" + "chunksUploaded", + "encryption", + "compression" ], "example": { "$id": "5e5ea5c16897e", @@ -13439,7 +13494,9 @@ "mimeType": "image\/png", "sizeOriginal": 17890, "chunksTotal": 17890, - "chunksUploaded": 17890 + "chunksUploaded": 17890, + "encryption": true, + "compression": "gzip" } }, "team": { diff --git a/app/config/specs/open-api3-latest-console.json b/app/config/specs/open-api3-latest-console.json index 2819a6c9a6..d83d7c20ba 100644 --- a/app/config/specs/open-api3-latest-console.json +++ b/app/config/specs/open-api3-latest-console.json @@ -1,7 +1,7 @@ { "openapi": "3.0.0", "info": { - "version": "1.8.0", + "version": "1.8.1", "title": "Appwrite", "description": "Appwrite backend as a service cuts up to 70% of the time and costs required for building a modern application. We abstract and simplify common development tasks behind a REST APIs, to help you develop your app in a fast and secure way. For full API documentation and tutorials go to [https:\/\/appwrite.io\/docs](https:\/\/appwrite.io\/docs)", "termsOfService": "https:\/\/appwrite.io\/policy\/terms", @@ -48,7 +48,7 @@ "x-appwrite": { "method": "get", "group": "account", - "weight": 10, + "weight": 9, "cookies": false, "type": "", "demo": "account\/get.md", @@ -98,7 +98,7 @@ "x-appwrite": { "method": "create", "group": "account", - "weight": 9, + "weight": 8, "cookies": false, "type": "", "demo": "account\/create.md", @@ -138,7 +138,8 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", @@ -177,7 +178,7 @@ "x-appwrite": { "method": "delete", "group": "account", - "weight": 11, + "weight": 10, "cookies": false, "type": "", "demo": "account\/delete.md", @@ -226,7 +227,7 @@ "x-appwrite": { "method": "updateEmail", "group": "account", - "weight": 35, + "weight": 34, "cookies": false, "type": "", "demo": "account\/update-email.md", @@ -261,12 +262,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password. Must be at least 8 chars.", - "x-example": "password" + "x-example": "password", + "format": "password" } }, "required": [ @@ -303,7 +306,7 @@ "x-appwrite": { "method": "listIdentities", "group": "identities", - "weight": 48, + "weight": 47, "cookies": false, "type": "", "demo": "account\/list-identities.md", @@ -374,7 +377,7 @@ "x-appwrite": { "method": "deleteIdentity", "group": "identities", - "weight": 49, + "weight": 48, "cookies": false, "type": "", "demo": "account\/delete-identity.md", @@ -438,12 +441,12 @@ "x-appwrite": { "method": "createJWT", "group": "tokens", - "weight": 30, + "weight": 29, "cookies": false, "type": "", "demo": "account\/create-jwt.md", - "rate-limit": 100, - "rate-time": 3600, + "rate-limit": 120, + "rate-time": 60, "rate-key": "url:{url},userId:{userId}", "scope": "account", "platforms": [ @@ -463,7 +466,24 @@ "Project": [], "JWT": [] } - ] + ], + "requestBody": { + "content": { + "application\/json": { + "schema": { + "type": "object", + "properties": { + "duration": { + "type": "integer", + "description": "Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds.", + "x-example": 0, + "format": "int32" + } + } + } + } + } + } } }, "\/account\/logs": { @@ -490,7 +510,7 @@ "x-appwrite": { "method": "listLogs", "group": "logs", - "weight": 32, + "weight": 31, "cookies": false, "type": "", "demo": "account\/list-logs.md", @@ -568,7 +588,7 @@ "x-appwrite": { "method": "updateMFA", "group": "mfa", - "weight": 306, + "weight": 253, "cookies": false, "type": "", "demo": "account\/update-mfa.md", @@ -639,7 +659,7 @@ "x-appwrite": { "method": "createMfaAuthenticator", "group": "mfa", - "weight": 308, + "weight": 255, "cookies": false, "type": "", "demo": "account\/create-mfa-authenticator.md", @@ -762,7 +782,7 @@ "x-appwrite": { "method": "updateMfaAuthenticator", "group": "mfa", - "weight": 309, + "weight": 256, "cookies": false, "type": "", "demo": "account\/update-mfa-authenticator.md", @@ -901,7 +921,7 @@ "x-appwrite": { "method": "deleteMfaAuthenticator", "group": "mfa", - "weight": 310, + "weight": 257, "cookies": false, "type": "", "demo": "account\/delete-mfa-authenticator.md", @@ -1024,7 +1044,7 @@ "x-appwrite": { "method": "createMfaChallenge", "group": "mfa", - "weight": 314, + "weight": 261, "cookies": false, "type": "", "demo": "account\/create-mfa-challenge.md", @@ -1157,7 +1177,7 @@ "x-appwrite": { "method": "updateMfaChallenge", "group": "mfa", - "weight": 315, + "weight": 262, "cookies": false, "type": "", "demo": "account\/update-mfa-challenge.md", @@ -1294,7 +1314,7 @@ "x-appwrite": { "method": "listMfaFactors", "group": "mfa", - "weight": 307, + "weight": 254, "cookies": false, "type": "", "demo": "account\/list-mfa-factors.md", @@ -1394,7 +1414,7 @@ "x-appwrite": { "method": "getMfaRecoveryCodes", "group": "mfa", - "weight": 313, + "weight": 260, "cookies": false, "type": "", "demo": "account\/get-mfa-recovery-codes.md", @@ -1492,7 +1512,7 @@ "x-appwrite": { "method": "createMfaRecoveryCodes", "group": "mfa", - "weight": 311, + "weight": 258, "cookies": false, "type": "", "demo": "account\/create-mfa-recovery-codes.md", @@ -1590,7 +1610,7 @@ "x-appwrite": { "method": "updateMfaRecoveryCodes", "group": "mfa", - "weight": 312, + "weight": 259, "cookies": false, "type": "", "demo": "account\/update-mfa-recovery-codes.md", @@ -1690,7 +1710,7 @@ "x-appwrite": { "method": "updateName", "group": "account", - "weight": 33, + "weight": 32, "cookies": false, "type": "", "demo": "account\/update-name.md", @@ -1761,7 +1781,7 @@ "x-appwrite": { "method": "updatePassword", "group": "account", - "weight": 34, + "weight": 33, "cookies": false, "type": "", "demo": "account\/update-password.md", @@ -1801,7 +1821,8 @@ "oldPassword": { "type": "string", "description": "Current user password. Must be at least 8 chars.", - "x-example": "password" + "x-example": "password", + "format": "password" } }, "required": [ @@ -1837,7 +1858,7 @@ "x-appwrite": { "method": "updatePhone", "group": "account", - "weight": 36, + "weight": 35, "cookies": false, "type": "", "demo": "account\/update-phone.md", @@ -1872,12 +1893,14 @@ "phone": { "type": "string", "description": "Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "password": { "type": "string", "description": "User password. Must be at least 8 chars.", - "x-example": "password" + "x-example": "password", + "format": "password" } }, "required": [ @@ -1914,7 +1937,7 @@ "x-appwrite": { "method": "getPrefs", "group": "account", - "weight": 31, + "weight": 30, "cookies": false, "type": "", "demo": "account\/get-prefs.md", @@ -1964,7 +1987,7 @@ "x-appwrite": { "method": "updatePrefs", "group": "account", - "weight": 37, + "weight": 36, "cookies": false, "type": "", "demo": "account\/update-prefs.md", @@ -2035,7 +2058,7 @@ "x-appwrite": { "method": "createRecovery", "group": "recovery", - "weight": 39, + "weight": 38, "cookies": false, "type": "", "demo": "account\/create-recovery.md", @@ -2073,12 +2096,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "url": { "type": "string", "description": "URL to redirect the user back to your app from the recovery email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.", - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" } }, "required": [ @@ -2113,7 +2138,7 @@ "x-appwrite": { "method": "updateRecovery", "group": "recovery", - "weight": 40, + "weight": 39, "cookies": false, "type": "", "demo": "account\/update-recovery.md", @@ -2196,7 +2221,7 @@ "x-appwrite": { "method": "listSessions", "group": "sessions", - "weight": 12, + "weight": 11, "cookies": false, "type": "", "demo": "account\/list-sessions.md", @@ -2239,7 +2264,7 @@ "x-appwrite": { "method": "deleteSessions", "group": "sessions", - "weight": 13, + "weight": 12, "cookies": false, "type": "", "demo": "account\/delete-sessions.md", @@ -2291,7 +2316,7 @@ "x-appwrite": { "method": "createAnonymousSession", "group": "sessions", - "weight": 18, + "weight": 17, "cookies": false, "type": "", "demo": "account\/create-anonymous-session.md", @@ -2343,7 +2368,7 @@ "x-appwrite": { "method": "createEmailPasswordSession", "group": "sessions", - "weight": 17, + "weight": 16, "cookies": false, "type": "", "demo": "account\/create-email-password-session.md", @@ -2378,12 +2403,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password. Must be at least 8 chars.", - "x-example": "password" + "x-example": "password", + "format": "password" } }, "required": [ @@ -2420,7 +2447,7 @@ "x-appwrite": { "method": "updateMagicURLSession", "group": "sessions", - "weight": 27, + "weight": 26, "cookies": false, "type": "", "demo": "account\/update-magic-url-session.md", @@ -2494,7 +2521,7 @@ "x-appwrite": { "method": "createOAuth2Session", "group": "sessions", - "weight": 20, + "weight": 19, "cookies": false, "type": "webAuth", "demo": "account\/create-o-auth-2-session.md", @@ -2567,8 +2594,7 @@ "yammer", "yandex", "zoho", - "zoom", - "mock" + "zoom" ], "x-enum-name": "OAuthProvider", "x-enum-keys": [] @@ -2639,7 +2665,7 @@ "x-appwrite": { "method": "updatePhoneSession", "group": "sessions", - "weight": 28, + "weight": 27, "cookies": false, "type": "", "demo": "account\/update-phone-session.md", @@ -2720,7 +2746,7 @@ "x-appwrite": { "method": "createSession", "group": "sessions", - "weight": 19, + "weight": 18, "cookies": false, "type": "", "demo": "account\/create-session.md", @@ -2797,7 +2823,7 @@ "x-appwrite": { "method": "getSession", "group": "sessions", - "weight": 14, + "weight": 13, "cookies": false, "type": "", "demo": "account\/get-session.md", @@ -2859,7 +2885,7 @@ "x-appwrite": { "method": "updateSession", "group": "sessions", - "weight": 16, + "weight": 15, "cookies": false, "type": "", "demo": "account\/update-session.md", @@ -2914,7 +2940,7 @@ "x-appwrite": { "method": "deleteSession", "group": "sessions", - "weight": 15, + "weight": 14, "cookies": false, "type": "", "demo": "account\/delete-session.md", @@ -2978,7 +3004,7 @@ "x-appwrite": { "method": "updateStatus", "group": "account", - "weight": 38, + "weight": 37, "cookies": false, "type": "", "demo": "account\/update-status.md", @@ -3030,7 +3056,7 @@ "x-appwrite": { "method": "createPushTarget", "group": "pushTargets", - "weight": 45, + "weight": 44, "cookies": false, "type": "", "demo": "account\/create-push-target.md", @@ -3110,7 +3136,7 @@ "x-appwrite": { "method": "updatePushTarget", "group": "pushTargets", - "weight": 46, + "weight": 45, "cookies": false, "type": "", "demo": "account\/update-push-target.md", @@ -3182,7 +3208,7 @@ "x-appwrite": { "method": "deletePushTarget", "group": "pushTargets", - "weight": 47, + "weight": 46, "cookies": false, "type": "", "demo": "account\/delete-push-target.md", @@ -3244,7 +3270,7 @@ "x-appwrite": { "method": "createEmailToken", "group": "tokens", - "weight": 26, + "weight": 25, "cookies": false, "type": "", "demo": "account\/create-email-token.md", @@ -3287,7 +3313,8 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "phrase": { "type": "boolean", @@ -3329,7 +3356,7 @@ "x-appwrite": { "method": "createMagicURLToken", "group": "tokens", - "weight": 25, + "weight": 24, "cookies": false, "type": "", "demo": "account\/create-magic-url-token.md", @@ -3372,12 +3399,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "url": { "type": "string", "description": "URL to redirect the user back to your app from the magic URL login. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.", - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" }, "phrase": { "type": "boolean", @@ -3412,7 +3441,7 @@ "x-appwrite": { "method": "createOAuth2Token", "group": "tokens", - "weight": 24, + "weight": 23, "cookies": false, "type": "webAuth", "demo": "account\/create-o-auth-2-token.md", @@ -3485,8 +3514,7 @@ "yammer", "yandex", "zoho", - "zoom", - "mock" + "zoom" ], "x-enum-name": "OAuthProvider", "x-enum-keys": [] @@ -3557,7 +3585,7 @@ "x-appwrite": { "method": "createPhoneToken", "group": "tokens", - "weight": 29, + "weight": 28, "cookies": false, "type": "", "demo": "account\/create-phone-token.md", @@ -3600,7 +3628,8 @@ "phone": { "type": "string", "description": "Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" } }, "required": [ @@ -3637,7 +3666,7 @@ "x-appwrite": { "method": "createEmailVerification", "group": "verification", - "weight": 41, + "weight": 40, "cookies": false, "type": "", "demo": "account\/create-email-verification.md", @@ -3724,7 +3753,8 @@ "url": { "type": "string", "description": "URL to redirect the user back to your app from the verification email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.", - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" } }, "required": [ @@ -3758,7 +3788,7 @@ "x-appwrite": { "method": "updateEmailVerification", "group": "verification", - "weight": 42, + "weight": 41, "cookies": false, "type": "", "demo": "account\/update-email-verification.md", @@ -3891,7 +3921,7 @@ "x-appwrite": { "method": "createPhoneVerification", "group": "verification", - "weight": 43, + "weight": 42, "cookies": false, "type": "", "demo": "account\/create-phone-verification.md", @@ -3944,7 +3974,7 @@ "x-appwrite": { "method": "updatePhoneVerification", "group": "verification", - "weight": 44, + "weight": 43, "cookies": false, "type": "", "demo": "account\/update-phone-verification.md", @@ -4014,7 +4044,7 @@ "x-appwrite": { "method": "getBrowser", "group": null, - "weight": 51, + "weight": 264, "cookies": false, "type": "location", "demo": "avatars\/get-browser.md", @@ -4142,7 +4172,7 @@ "x-appwrite": { "method": "getCreditCard", "group": null, - "weight": 50, + "weight": 263, "cookies": false, "type": "location", "demo": "avatars\/get-credit-card.md", @@ -4276,7 +4306,7 @@ "x-appwrite": { "method": "getFavicon", "group": null, - "weight": 54, + "weight": 267, "cookies": false, "type": "location", "demo": "avatars\/get-favicon.md", @@ -4336,7 +4366,7 @@ "x-appwrite": { "method": "getFlag", "group": null, - "weight": 52, + "weight": 265, "cookies": false, "type": "location", "demo": "avatars\/get-flag.md", @@ -4826,7 +4856,7 @@ "x-appwrite": { "method": "getImage", "group": null, - "weight": 53, + "weight": 266, "cookies": false, "type": "location", "demo": "avatars\/get-image.md", @@ -4910,7 +4940,7 @@ "x-appwrite": { "method": "getInitials", "group": null, - "weight": 56, + "weight": 269, "cookies": false, "type": "location", "demo": "avatars\/get-initials.md", @@ -5004,7 +5034,7 @@ "x-appwrite": { "method": "getQR", "group": null, - "weight": 55, + "weight": 268, "cookies": false, "type": "location", "demo": "avatars\/get-qr.md", @@ -5098,7 +5128,7 @@ "x-appwrite": { "method": "getScreenshot", "group": null, - "weight": 57, + "weight": 270, "cookies": false, "type": "location", "demo": "avatars\/get-screenshot.md", @@ -5818,7 +5848,7 @@ "avif", "gif" ], - "x-enum-name": null, + "x-enum-name": "ImageFormat", "x-enum-keys": [], "default": "" }, @@ -5844,7 +5874,7 @@ "x-appwrite": { "method": "chat", "group": "console", - "weight": 243, + "weight": 497, "cookies": false, "type": "", "demo": "assistant\/chat.md", @@ -5905,7 +5935,7 @@ "x-appwrite": { "method": "getResource", "group": null, - "weight": 512, + "weight": 498, "cookies": false, "type": "", "demo": "console\/get-resource.md", @@ -5980,7 +6010,7 @@ "x-appwrite": { "method": "variables", "group": "console", - "weight": 242, + "weight": 496, "cookies": false, "type": "", "demo": "console\/variables.md", @@ -6029,7 +6059,7 @@ "x-appwrite": { "method": "list", "group": "databases", - "weight": 320, + "weight": 278, "cookies": false, "type": "", "demo": "databases\/list.md", @@ -6148,7 +6178,7 @@ "x-appwrite": { "method": "create", "group": "databases", - "weight": 316, + "weight": 274, "cookies": false, "type": "", "demo": "databases\/create.md", @@ -6265,7 +6295,7 @@ "x-appwrite": { "method": "listTransactions", "group": "transactions", - "weight": 380, + "weight": 338, "cookies": false, "type": "", "demo": "databases\/list-transactions.md", @@ -6332,7 +6362,7 @@ "x-appwrite": { "method": "createTransaction", "group": "transactions", - "weight": 376, + "weight": 334, "cookies": false, "type": "", "demo": "databases\/create-transaction.md", @@ -6369,7 +6399,8 @@ "ttl": { "type": "integer", "description": "Seconds before the transaction expires.", - "x-example": 60 + "x-example": 60, + "format": "int32" } } } @@ -6402,7 +6433,7 @@ "x-appwrite": { "method": "getTransaction", "group": "transactions", - "weight": 377, + "weight": 335, "cookies": false, "type": "", "demo": "databases\/get-transaction.md", @@ -6466,7 +6497,7 @@ "x-appwrite": { "method": "updateTransaction", "group": "transactions", - "weight": 378, + "weight": 336, "cookies": false, "type": "", "demo": "databases\/update-transaction.md", @@ -6544,7 +6575,7 @@ "x-appwrite": { "method": "deleteTransaction", "group": "transactions", - "weight": 379, + "weight": 337, "cookies": false, "type": "", "demo": "databases\/delete-transaction.md", @@ -6610,7 +6641,7 @@ "x-appwrite": { "method": "createOperations", "group": "transactions", - "weight": 381, + "weight": 339, "cookies": false, "type": "", "demo": "databases\/create-operations.md", @@ -6695,7 +6726,7 @@ "x-appwrite": { "method": "listUsage", "group": null, - "weight": 323, + "weight": 281, "cookies": false, "type": "", "demo": "databases\/list-usage.md", @@ -6799,7 +6830,7 @@ "x-appwrite": { "method": "get", "group": "databases", - "weight": 317, + "weight": 275, "cookies": false, "type": "", "demo": "databases\/get.md", @@ -6893,7 +6924,7 @@ "x-appwrite": { "method": "update", "group": "databases", - "weight": 318, + "weight": 276, "cookies": false, "type": "", "demo": "databases\/update.md", @@ -6926,8 +6957,7 @@ "enabled" ], "required": [ - "databaseId", - "name" + "databaseId" ], "responses": [ { @@ -6982,10 +7012,7 @@ "description": "Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled.", "x-example": false } - }, - "required": [ - "name" - ] + } } } } @@ -7007,7 +7034,7 @@ "x-appwrite": { "method": "delete", "group": "databases", - "weight": 319, + "weight": 277, "cookies": false, "type": "", "demo": "databases\/delete.md", @@ -7102,7 +7129,7 @@ "x-appwrite": { "method": "listCollections", "group": "collections", - "weight": 328, + "weight": 286, "cookies": false, "type": "", "demo": "databases\/list-collections.md", @@ -7202,7 +7229,7 @@ "x-appwrite": { "method": "createCollection", "group": "collections", - "weight": 324, + "weight": 282, "cookies": false, "type": "", "demo": "databases\/create-collection.md", @@ -7329,7 +7356,7 @@ "x-appwrite": { "method": "getCollection", "group": "collections", - "weight": 325, + "weight": 283, "cookies": false, "type": "", "demo": "databases\/get-collection.md", @@ -7404,7 +7431,7 @@ "x-appwrite": { "method": "updateCollection", "group": "collections", - "weight": 326, + "weight": 284, "cookies": false, "type": "", "demo": "databases\/update-collection.md", @@ -7485,10 +7512,7 @@ "description": "Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled.", "x-example": false } - }, - "required": [ - "name" - ] + } } } } @@ -7510,7 +7534,7 @@ "x-appwrite": { "method": "deleteCollection", "group": "collections", - "weight": 327, + "weight": 285, "cookies": false, "type": "", "demo": "databases\/delete-collection.md", @@ -7587,7 +7611,7 @@ "x-appwrite": { "method": "listAttributes", "group": "attributes", - "weight": 345, + "weight": 303, "cookies": false, "type": "", "demo": "databases\/list-attributes.md", @@ -7688,7 +7712,7 @@ "x-appwrite": { "method": "createBooleanAttribute", "group": "attributes", - "weight": 346, + "weight": 304, "cookies": false, "type": "", "demo": "databases\/create-boolean-attribute.md", @@ -7801,7 +7825,7 @@ "x-appwrite": { "method": "updateBooleanAttribute", "group": "attributes", - "weight": 347, + "weight": 305, "cookies": false, "type": "", "demo": "databases\/update-boolean-attribute.md", @@ -7919,7 +7943,7 @@ "x-appwrite": { "method": "createDatetimeAttribute", "group": "attributes", - "weight": 348, + "weight": 306, "cookies": false, "type": "", "demo": "databases\/create-datetime-attribute.md", @@ -8032,7 +8056,7 @@ "x-appwrite": { "method": "updateDatetimeAttribute", "group": "attributes", - "weight": 349, + "weight": 307, "cookies": false, "type": "", "demo": "databases\/update-datetime-attribute.md", @@ -8150,7 +8174,7 @@ "x-appwrite": { "method": "createEmailAttribute", "group": "attributes", - "weight": 350, + "weight": 308, "cookies": false, "type": "", "demo": "databases\/create-email-attribute.md", @@ -8221,6 +8245,7 @@ "type": "string", "description": "Default value for attribute when not provided. Cannot be set when attribute is required.", "x-example": "email@example.com", + "format": "email", "x-nullable": true }, "array": { @@ -8263,7 +8288,7 @@ "x-appwrite": { "method": "updateEmailAttribute", "group": "attributes", - "weight": 351, + "weight": 309, "cookies": false, "type": "", "demo": "databases\/update-email-attribute.md", @@ -8338,6 +8363,7 @@ "type": "string", "description": "Default value for attribute when not provided. Cannot be set when attribute is required.", "x-example": "email@example.com", + "format": "email", "x-nullable": true }, "newKey": { @@ -8381,7 +8407,7 @@ "x-appwrite": { "method": "createEnumAttribute", "group": "attributes", - "weight": 352, + "weight": 310, "cookies": false, "type": "", "demo": "databases\/create-enum-attribute.md", @@ -8503,7 +8529,7 @@ "x-appwrite": { "method": "updateEnumAttribute", "group": "attributes", - "weight": 353, + "weight": 311, "cookies": false, "type": "", "demo": "databases\/update-enum-attribute.md", @@ -8630,7 +8656,7 @@ "x-appwrite": { "method": "createFloatAttribute", "group": "attributes", - "weight": 354, + "weight": 312, "cookies": false, "type": "", "demo": "databases\/create-float-attribute.md", @@ -8701,18 +8727,21 @@ "type": "number", "description": "Minimum value.", "x-example": null, + "format": "float", "x-nullable": true }, "max": { "type": "number", "description": "Maximum value.", "x-example": null, + "format": "float", "x-nullable": true }, "default": { "type": "number", "description": "Default value. Cannot be set when required.", "x-example": null, + "format": "float", "x-nullable": true }, "array": { @@ -8755,7 +8784,7 @@ "x-appwrite": { "method": "updateFloatAttribute", "group": "attributes", - "weight": 355, + "weight": 313, "cookies": false, "type": "", "demo": "databases\/update-float-attribute.md", @@ -8830,18 +8859,21 @@ "type": "number", "description": "Minimum value.", "x-example": null, + "format": "float", "x-nullable": true }, "max": { "type": "number", "description": "Maximum value.", "x-example": null, + "format": "float", "x-nullable": true }, "default": { "type": "number", "description": "Default value. Cannot be set when required.", "x-example": null, + "format": "float", "x-nullable": true }, "newKey": { @@ -8885,7 +8917,7 @@ "x-appwrite": { "method": "createIntegerAttribute", "group": "attributes", - "weight": 356, + "weight": 314, "cookies": false, "type": "", "demo": "databases\/create-integer-attribute.md", @@ -8956,18 +8988,21 @@ "type": "integer", "description": "Minimum value", "x-example": null, + "format": "int64", "x-nullable": true }, "max": { "type": "integer", "description": "Maximum value", "x-example": null, + "format": "int64", "x-nullable": true }, "default": { "type": "integer", "description": "Default value. Cannot be set when attribute is required.", "x-example": null, + "format": "int64", "x-nullable": true }, "array": { @@ -9010,7 +9045,7 @@ "x-appwrite": { "method": "updateIntegerAttribute", "group": "attributes", - "weight": 357, + "weight": 315, "cookies": false, "type": "", "demo": "databases\/update-integer-attribute.md", @@ -9085,18 +9120,21 @@ "type": "integer", "description": "Minimum value", "x-example": null, + "format": "int64", "x-nullable": true }, "max": { "type": "integer", "description": "Maximum value", "x-example": null, + "format": "int64", "x-nullable": true }, "default": { "type": "integer", "description": "Default value. Cannot be set when attribute is required.", "x-example": null, + "format": "int64", "x-nullable": true }, "newKey": { @@ -9140,7 +9178,7 @@ "x-appwrite": { "method": "createIpAttribute", "group": "attributes", - "weight": 358, + "weight": 316, "cookies": false, "type": "", "demo": "databases\/create-ip-attribute.md", @@ -9253,7 +9291,7 @@ "x-appwrite": { "method": "updateIpAttribute", "group": "attributes", - "weight": 359, + "weight": 317, "cookies": false, "type": "", "demo": "databases\/update-ip-attribute.md", @@ -9371,7 +9409,7 @@ "x-appwrite": { "method": "createLineAttribute", "group": "attributes", - "weight": 360, + "weight": 318, "cookies": false, "type": "", "demo": "databases\/create-line-attribute.md", @@ -9486,7 +9524,7 @@ "x-appwrite": { "method": "updateLineAttribute", "group": "attributes", - "weight": 361, + "weight": 319, "cookies": false, "type": "", "demo": "databases\/update-line-attribute.md", @@ -9610,7 +9648,7 @@ "x-appwrite": { "method": "createPointAttribute", "group": "attributes", - "weight": 362, + "weight": 320, "cookies": false, "type": "", "demo": "databases\/create-point-attribute.md", @@ -9725,7 +9763,7 @@ "x-appwrite": { "method": "updatePointAttribute", "group": "attributes", - "weight": 363, + "weight": 321, "cookies": false, "type": "", "demo": "databases\/update-point-attribute.md", @@ -9849,7 +9887,7 @@ "x-appwrite": { "method": "createPolygonAttribute", "group": "attributes", - "weight": 364, + "weight": 322, "cookies": false, "type": "", "demo": "databases\/create-polygon-attribute.md", @@ -9964,7 +10002,7 @@ "x-appwrite": { "method": "updatePolygonAttribute", "group": "attributes", - "weight": 365, + "weight": 323, "cookies": false, "type": "", "demo": "databases\/update-polygon-attribute.md", @@ -10088,7 +10126,7 @@ "x-appwrite": { "method": "createRelationshipAttribute", "group": "attributes", - "weight": 366, + "weight": 324, "cookies": false, "type": "", "demo": "databases\/create-relationship-attribute.md", @@ -10227,7 +10265,7 @@ "x-appwrite": { "method": "createStringAttribute", "group": "attributes", - "weight": 368, + "weight": 326, "cookies": false, "type": "", "demo": "databases\/create-string-attribute.md", @@ -10292,7 +10330,8 @@ "size": { "type": "integer", "description": "Attribute size for text attributes, in number of characters.", - "x-example": 1 + "x-example": 1, + "format": "int32" }, "required": { "type": "boolean", @@ -10351,7 +10390,7 @@ "x-appwrite": { "method": "updateStringAttribute", "group": "attributes", - "weight": 369, + "weight": 327, "cookies": false, "type": "", "demo": "databases\/update-string-attribute.md", @@ -10432,6 +10471,7 @@ "type": "integer", "description": "Maximum size of the string attribute.", "x-example": 1, + "format": "int32", "x-nullable": true }, "newKey": { @@ -10475,7 +10515,7 @@ "x-appwrite": { "method": "createUrlAttribute", "group": "attributes", - "weight": 370, + "weight": 328, "cookies": false, "type": "", "demo": "databases\/create-url-attribute.md", @@ -10546,6 +10586,7 @@ "type": "string", "description": "Default value for attribute when not provided. Cannot be set when attribute is required.", "x-example": "https:\/\/example.com", + "format": "url", "x-nullable": true }, "array": { @@ -10588,7 +10629,7 @@ "x-appwrite": { "method": "updateUrlAttribute", "group": "attributes", - "weight": 371, + "weight": 329, "cookies": false, "type": "", "demo": "databases\/update-url-attribute.md", @@ -10663,6 +10704,7 @@ "type": "string", "description": "Default value for attribute when not provided. Cannot be set when attribute is required.", "x-example": "https:\/\/example.com", + "format": "url", "x-nullable": true }, "newKey": { @@ -10737,7 +10779,7 @@ "x-appwrite": { "method": "getAttribute", "group": "attributes", - "weight": 343, + "weight": 301, "cookies": false, "type": "", "demo": "databases\/get-attribute.md", @@ -10814,7 +10856,7 @@ "x-appwrite": { "method": "deleteAttribute", "group": "attributes", - "weight": 344, + "weight": 302, "cookies": false, "type": "", "demo": "databases\/delete-attribute.md", @@ -10900,7 +10942,7 @@ "x-appwrite": { "method": "updateRelationshipAttribute", "group": "attributes", - "weight": 367, + "weight": 325, "cookies": false, "type": "", "demo": "databases\/update-relationship-attribute.md", @@ -11016,7 +11058,7 @@ "x-appwrite": { "method": "listDocuments", "group": "documents", - "weight": 339, + "weight": 297, "cookies": false, "type": "", "demo": "databases\/list-documents.md", @@ -11128,7 +11170,7 @@ "x-appwrite": { "method": "createDocument", "group": "documents", - "weight": 331, + "weight": 289, "cookies": false, "type": "", "demo": "databases\/create-document.md", @@ -11319,7 +11361,7 @@ "x-appwrite": { "method": "upsertDocuments", "group": "documents", - "weight": 336, + "weight": 294, "cookies": false, "type": "", "demo": "databases\/upsert-documents.md", @@ -11456,7 +11498,7 @@ "x-appwrite": { "method": "updateDocuments", "group": "documents", - "weight": 334, + "weight": 292, "cookies": false, "type": "", "demo": "databases\/update-documents.md", @@ -11561,7 +11603,7 @@ "x-appwrite": { "method": "deleteDocuments", "group": "documents", - "weight": 338, + "weight": 296, "cookies": false, "type": "", "demo": "databases\/delete-documents.md", @@ -11663,7 +11705,7 @@ "x-appwrite": { "method": "getDocument", "group": "documents", - "weight": 332, + "weight": 290, "cookies": false, "type": "", "demo": "databases\/get-document.md", @@ -11774,7 +11816,7 @@ "x-appwrite": { "method": "upsertDocument", "group": "documents", - "weight": 335, + "weight": 293, "cookies": false, "type": "", "demo": "databases\/upsert-document.md", @@ -11929,7 +11971,7 @@ "x-appwrite": { "method": "updateDocument", "group": "documents", - "weight": 333, + "weight": 291, "cookies": false, "type": "", "demo": "databases\/update-document.md", @@ -12041,7 +12083,7 @@ "x-appwrite": { "method": "deleteDocument", "group": "documents", - "weight": 337, + "weight": 295, "cookies": false, "type": "", "demo": "databases\/delete-document.md", @@ -12148,7 +12190,7 @@ "x-appwrite": { "method": "listDocumentLogs", "group": "logs", - "weight": 340, + "weight": 298, "cookies": false, "type": "", "demo": "databases\/list-document-logs.md", @@ -12246,7 +12288,7 @@ "x-appwrite": { "method": "decrementDocumentAttribute", "group": "documents", - "weight": 342, + "weight": 300, "cookies": false, "type": "", "demo": "databases\/decrement-document-attribute.md", @@ -12328,12 +12370,14 @@ "value": { "type": "number", "description": "Value to increment the attribute by. The value must be a number.", - "x-example": null + "x-example": null, + "format": "float" }, "min": { "type": "number", "description": "Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown.", "x-example": null, + "format": "float", "x-nullable": true }, "transactionId": { @@ -12373,7 +12417,7 @@ "x-appwrite": { "method": "incrementDocumentAttribute", "group": "documents", - "weight": 341, + "weight": 299, "cookies": false, "type": "", "demo": "databases\/increment-document-attribute.md", @@ -12455,12 +12499,14 @@ "value": { "type": "number", "description": "Value to increment the attribute by. The value must be a number.", - "x-example": null + "x-example": null, + "format": "float" }, "max": { "type": "number", "description": "Maximum value for the attribute. If the current value is greater than this value, an error will be thrown.", "x-example": null, + "format": "float", "x-nullable": true }, "transactionId": { @@ -12500,7 +12546,7 @@ "x-appwrite": { "method": "listIndexes", "group": "indexes", - "weight": 375, + "weight": 333, "cookies": false, "type": "", "demo": "databases\/list-indexes.md", @@ -12599,7 +12645,7 @@ "x-appwrite": { "method": "createIndex", "group": "indexes", - "weight": 372, + "weight": 330, "cookies": false, "type": "", "demo": "databases\/create-index.md", @@ -12740,7 +12786,7 @@ "x-appwrite": { "method": "getIndex", "group": "indexes", - "weight": 373, + "weight": 331, "cookies": false, "type": "", "demo": "databases\/get-index.md", @@ -12817,7 +12863,7 @@ "x-appwrite": { "method": "deleteIndex", "group": "indexes", - "weight": 374, + "weight": 332, "cookies": false, "type": "", "demo": "databases\/delete-index.md", @@ -12903,7 +12949,7 @@ "x-appwrite": { "method": "listCollectionLogs", "group": "collections", - "weight": 329, + "weight": 287, "cookies": false, "type": "", "demo": "databases\/list-collection-logs.md", @@ -12991,7 +13037,7 @@ "x-appwrite": { "method": "getCollectionUsage", "group": null, - "weight": 330, + "weight": 288, "cookies": false, "type": "", "demo": "databases\/get-collection-usage.md", @@ -13088,7 +13134,7 @@ "x-appwrite": { "method": "listLogs", "group": "logs", - "weight": 321, + "weight": 279, "cookies": false, "type": "", "demo": "databases\/list-logs.md", @@ -13196,7 +13242,7 @@ "x-appwrite": { "method": "getUsage", "group": null, - "weight": 322, + "weight": 280, "cookies": false, "type": "", "demo": "databases\/get-usage.md", @@ -13313,7 +13359,7 @@ "x-appwrite": { "method": "list", "group": "functions", - "weight": 456, + "weight": 415, "cookies": false, "type": "", "demo": "functions\/list.md", @@ -13398,7 +13444,7 @@ "x-appwrite": { "method": "create", "group": "functions", - "weight": 453, + "weight": 412, "cookies": false, "type": "", "demo": "functions\/create.md", @@ -13538,7 +13584,8 @@ "timeout": { "type": "integer", "description": "Function maximum execution time in seconds.", - "x-example": 1 + "x-example": 1, + "format": "int32" }, "enabled": { "type": "boolean", @@ -13693,7 +13740,7 @@ "x-appwrite": { "method": "listRuntimes", "group": "runtimes", - "weight": 458, + "weight": 417, "cookies": false, "type": "", "demo": "functions\/list-runtimes.md", @@ -13743,7 +13790,7 @@ "x-appwrite": { "method": "listSpecifications", "group": "runtimes", - "weight": 459, + "weight": 418, "cookies": false, "type": "", "demo": "functions\/list-specifications.md", @@ -13793,7 +13840,7 @@ "x-appwrite": { "method": "listTemplates", "group": "templates", - "weight": 482, + "weight": 441, "cookies": false, "type": "", "demo": "functions\/list-templates.md", @@ -13985,7 +14032,7 @@ "x-appwrite": { "method": "getTemplate", "group": "templates", - "weight": 481, + "weight": 440, "cookies": false, "type": "", "demo": "functions\/get-template.md", @@ -14045,7 +14092,7 @@ "x-appwrite": { "method": "listUsage", "group": null, - "weight": 475, + "weight": 434, "cookies": false, "type": "", "demo": "functions\/list-usage.md", @@ -14117,7 +14164,7 @@ "x-appwrite": { "method": "get", "group": "functions", - "weight": 454, + "weight": 413, "cookies": false, "type": "", "demo": "functions\/get.md", @@ -14177,7 +14224,7 @@ "x-appwrite": { "method": "update", "group": "functions", - "weight": 455, + "weight": 414, "cookies": false, "type": "", "demo": "functions\/update.md", @@ -14324,7 +14371,8 @@ "timeout": { "type": "integer", "description": "Maximum execution time in seconds.", - "x-example": 1 + "x-example": 1, + "format": "int32" }, "enabled": { "type": "boolean", @@ -14469,7 +14517,7 @@ "x-appwrite": { "method": "delete", "group": "functions", - "weight": 457, + "weight": 416, "cookies": false, "type": "", "demo": "functions\/delete.md", @@ -14531,7 +14579,7 @@ "x-appwrite": { "method": "updateFunctionDeployment", "group": "functions", - "weight": 462, + "weight": 421, "cookies": false, "type": "", "demo": "functions\/update-function-deployment.md", @@ -14612,7 +14660,7 @@ "x-appwrite": { "method": "listDeployments", "group": "deployments", - "weight": 463, + "weight": 422, "cookies": false, "type": "", "demo": "functions\/list-deployments.md", @@ -14707,7 +14755,7 @@ "x-appwrite": { "method": "createDeployment", "group": "deployments", - "weight": 460, + "weight": 419, "cookies": false, "type": "upload", "demo": "functions\/create-deployment.md", @@ -14764,7 +14812,8 @@ "code": { "type": "string", "description": "Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory.", - "x-example": null + "x-example": null, + "format": "binary" }, "activate": { "type": "boolean", @@ -14806,7 +14855,7 @@ "x-appwrite": { "method": "createDuplicateDeployment", "group": "deployments", - "weight": 468, + "weight": 427, "cookies": false, "type": "", "demo": "functions\/create-duplicate-deployment.md", @@ -14892,7 +14941,7 @@ "x-appwrite": { "method": "createTemplateDeployment", "group": "deployments", - "weight": 465, + "weight": 424, "cookies": false, "type": "", "demo": "functions\/create-template-deployment.md", @@ -15009,7 +15058,7 @@ "x-appwrite": { "method": "createVcsDeployment", "group": "deployments", - "weight": 466, + "weight": 425, "cookies": false, "type": "", "demo": "functions\/create-vcs-deployment.md", @@ -15107,7 +15156,7 @@ "x-appwrite": { "method": "getDeployment", "group": "deployments", - "weight": 461, + "weight": 420, "cookies": false, "type": "", "demo": "functions\/get-deployment.md", @@ -15170,7 +15219,7 @@ "x-appwrite": { "method": "deleteDeployment", "group": "deployments", - "weight": 464, + "weight": 423, "cookies": false, "type": "", "demo": "functions\/delete-deployment.md", @@ -15235,7 +15284,7 @@ "x-appwrite": { "method": "getDeploymentDownload", "group": "deployments", - "weight": 467, + "weight": 426, "cookies": false, "type": "location", "demo": "functions\/get-deployment-download.md", @@ -15326,7 +15375,7 @@ "x-appwrite": { "method": "updateDeploymentStatus", "group": "deployments", - "weight": 469, + "weight": 428, "cookies": false, "type": "", "demo": "functions\/update-deployment-status.md", @@ -15398,7 +15447,7 @@ "x-appwrite": { "method": "listExecutions", "group": "executions", - "weight": 472, + "weight": 431, "cookies": false, "type": "", "demo": "functions\/list-executions.md", @@ -15485,7 +15534,7 @@ "x-appwrite": { "method": "createExecution", "group": "executions", - "weight": 470, + "weight": 429, "cookies": false, "type": "", "demo": "functions\/create-execution.md", @@ -15603,7 +15652,7 @@ "x-appwrite": { "method": "getExecution", "group": "executions", - "weight": 471, + "weight": 430, "cookies": false, "type": "", "demo": "functions\/get-execution.md", @@ -15669,7 +15718,7 @@ "x-appwrite": { "method": "deleteExecution", "group": "executions", - "weight": 473, + "weight": 432, "cookies": false, "type": "", "demo": "functions\/delete-execution.md", @@ -15741,7 +15790,7 @@ "x-appwrite": { "method": "getUsage", "group": null, - "weight": 474, + "weight": 433, "cookies": false, "type": "", "demo": "functions\/get-usage.md", @@ -15823,7 +15872,7 @@ "x-appwrite": { "method": "listVariables", "group": "variables", - "weight": 478, + "weight": 437, "cookies": false, "type": "", "demo": "functions\/list-variables.md", @@ -15883,7 +15932,7 @@ "x-appwrite": { "method": "createVariable", "group": "variables", - "weight": 476, + "weight": 435, "cookies": false, "type": "", "demo": "functions\/create-variable.md", @@ -15975,7 +16024,7 @@ "x-appwrite": { "method": "getVariable", "group": "variables", - "weight": 477, + "weight": 436, "cookies": false, "type": "", "demo": "functions\/get-variable.md", @@ -16045,7 +16094,7 @@ "x-appwrite": { "method": "updateVariable", "group": "variables", - "weight": 479, + "weight": 438, "cookies": false, "type": "", "demo": "functions\/update-variable.md", @@ -16139,7 +16188,7 @@ "x-appwrite": { "method": "deleteVariable", "group": "variables", - "weight": 480, + "weight": 439, "cookies": false, "type": "", "demo": "functions\/delete-variable.md", @@ -16211,7 +16260,7 @@ "x-appwrite": { "method": "query", "group": "graphql", - "weight": 241, + "weight": 190, "cookies": false, "type": "graphql", "demo": "graphql\/query.md", @@ -16265,7 +16314,7 @@ "x-appwrite": { "method": "mutation", "group": "graphql", - "weight": 240, + "weight": 189, "cookies": false, "type": "graphql", "demo": "graphql\/mutation.md", @@ -16319,7 +16368,7 @@ "x-appwrite": { "method": "get", "group": "health", - "weight": 69, + "weight": 442, "cookies": false, "type": "", "demo": "health\/get.md", @@ -16370,7 +16419,7 @@ "x-appwrite": { "method": "getAntivirus", "group": "health", - "weight": 90, + "weight": 451, "cookies": false, "type": "", "demo": "health\/get-antivirus.md", @@ -16407,11 +16456,11 @@ "description": "Check the Appwrite in-memory cache servers are up and connection is successful.", "responses": { "200": { - "description": "Health Status", + "description": "Status List", "content": { "application\/json": { "schema": { - "$ref": "#\/components\/schemas\/healthStatus" + "$ref": "#\/components\/schemas\/healthStatusList" } } } @@ -16421,7 +16470,7 @@ "x-appwrite": { "method": "getCache", "group": "health", - "weight": 72, + "weight": 445, "cookies": false, "type": "", "demo": "health\/get-cache.md", @@ -16472,7 +16521,7 @@ "x-appwrite": { "method": "getCertificate", "group": "health", - "weight": 77, + "weight": 448, "cookies": false, "type": "", "demo": "health\/get-certificate.md", @@ -16520,11 +16569,11 @@ "description": "Check the Appwrite database servers are up and connection is successful.", "responses": { "200": { - "description": "Health Status", + "description": "Status List", "content": { "application\/json": { "schema": { - "$ref": "#\/components\/schemas\/healthStatus" + "$ref": "#\/components\/schemas\/healthStatusList" } } } @@ -16534,7 +16583,7 @@ "x-appwrite": { "method": "getDB", "group": "health", - "weight": 71, + "weight": 444, "cookies": false, "type": "", "demo": "health\/get-db.md", @@ -16571,11 +16620,11 @@ "description": "Check the Appwrite pub-sub servers are up and connection is successful.", "responses": { "200": { - "description": "Health Status", + "description": "Status List", "content": { "application\/json": { "schema": { - "$ref": "#\/components\/schemas\/healthStatus" + "$ref": "#\/components\/schemas\/healthStatusList" } } } @@ -16585,7 +16634,7 @@ "x-appwrite": { "method": "getPubSub", "group": "health", - "weight": 73, + "weight": 446, "cookies": false, "type": "", "demo": "health\/get-pub-sub.md", @@ -16612,6 +16661,70 @@ ] } }, + "\/health\/queue\/audits": { + "get": { + "summary": "Get audits queue", + "operationId": "healthGetQueueAudits", + "tags": [ + "health" + ], + "description": "Get the number of audit logs that are waiting to be processed in the Appwrite internal queue server.", + "responses": { + "200": { + "description": "Health Queue", + "content": { + "application\/json": { + "schema": { + "$ref": "#\/components\/schemas\/healthQueue" + } + } + } + } + }, + "deprecated": false, + "x-appwrite": { + "method": "getQueueAudits", + "group": "queue", + "weight": 452, + "cookies": false, + "type": "", + "demo": "health\/get-queue-audits.md", + "rate-limit": 0, + "rate-time": 3600, + "rate-key": "url:{url},ip:{ip}", + "scope": "health.read", + "platforms": [ + "console", + "server" + ], + "packaging": false, + "public": true, + "edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-audits.md", + "auth": { + "Project": [] + } + }, + "security": [ + { + "Project": [], + "Key": [] + } + ], + "parameters": [ + { + "name": "threshold", + "description": "Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.", + "required": false, + "schema": { + "type": "integer", + "format": "int32", + "default": 5000 + }, + "in": "query" + } + ] + } + }, "\/health\/queue\/builds": { "get": { "summary": "Get builds queue", @@ -16636,7 +16749,7 @@ "x-appwrite": { "method": "getQueueBuilds", "group": "queue", - "weight": 79, + "weight": 456, "cookies": false, "type": "", "demo": "health\/get-queue-builds.md", @@ -16700,7 +16813,7 @@ "x-appwrite": { "method": "getQueueCertificates", "group": "queue", - "weight": 78, + "weight": 455, "cookies": false, "type": "", "demo": "health\/get-queue-certificates.md", @@ -16764,7 +16877,7 @@ "x-appwrite": { "method": "getQueueDatabases", "group": "queue", - "weight": 80, + "weight": 457, "cookies": false, "type": "", "demo": "health\/get-queue-databases.md", @@ -16839,7 +16952,7 @@ "x-appwrite": { "method": "getQueueDeletes", "group": "queue", - "weight": 81, + "weight": 458, "cookies": false, "type": "", "demo": "health\/get-queue-deletes.md", @@ -16903,7 +17016,7 @@ "x-appwrite": { "method": "getFailedJobs", "group": "queue", - "weight": 91, + "weight": 465, "cookies": false, "type": "", "demo": "health\/get-failed-jobs.md", @@ -16947,6 +17060,7 @@ "v1-webhooks", "v1-certificates", "v1-builds", + "v1-screenshots", "v1-messaging", "v1-migrations" ], @@ -16993,7 +17107,7 @@ "x-appwrite": { "method": "getQueueFunctions", "group": "queue", - "weight": 85, + "weight": 462, "cookies": false, "type": "", "demo": "health\/get-queue-functions.md", @@ -17057,7 +17171,7 @@ "x-appwrite": { "method": "getQueueLogs", "group": "queue", - "weight": 76, + "weight": 454, "cookies": false, "type": "", "demo": "health\/get-queue-logs.md", @@ -17121,7 +17235,7 @@ "x-appwrite": { "method": "getQueueMails", "group": "queue", - "weight": 82, + "weight": 459, "cookies": false, "type": "", "demo": "health\/get-queue-mails.md", @@ -17185,7 +17299,7 @@ "x-appwrite": { "method": "getQueueMessaging", "group": "queue", - "weight": 83, + "weight": 460, "cookies": false, "type": "", "demo": "health\/get-queue-messaging.md", @@ -17249,7 +17363,7 @@ "x-appwrite": { "method": "getQueueMigrations", "group": "queue", - "weight": 84, + "weight": 461, "cookies": false, "type": "", "demo": "health\/get-queue-migrations.md", @@ -17313,7 +17427,7 @@ "x-appwrite": { "method": "getQueueStatsResources", "group": "queue", - "weight": 86, + "weight": 463, "cookies": false, "type": "", "demo": "health\/get-queue-stats-resources.md", @@ -17377,7 +17491,7 @@ "x-appwrite": { "method": "getQueueUsage", "group": "queue", - "weight": 87, + "weight": 464, "cookies": false, "type": "", "demo": "health\/get-queue-usage.md", @@ -17441,7 +17555,7 @@ "x-appwrite": { "method": "getQueueWebhooks", "group": "queue", - "weight": 75, + "weight": 453, "cookies": false, "type": "", "demo": "health\/get-queue-webhooks.md", @@ -17505,7 +17619,7 @@ "x-appwrite": { "method": "getStorage", "group": "storage", - "weight": 89, + "weight": 450, "cookies": false, "type": "", "demo": "health\/get-storage.md", @@ -17556,7 +17670,7 @@ "x-appwrite": { "method": "getStorageLocal", "group": "storage", - "weight": 88, + "weight": 449, "cookies": false, "type": "", "demo": "health\/get-storage-local.md", @@ -17607,7 +17721,7 @@ "x-appwrite": { "method": "getTime", "group": "health", - "weight": 74, + "weight": 447, "cookies": false, "type": "", "demo": "health\/get-time.md", @@ -17658,7 +17772,7 @@ "x-appwrite": { "method": "get", "group": null, - "weight": 61, + "weight": 49, "cookies": false, "type": "", "demo": "locale\/get.md", @@ -17712,7 +17826,7 @@ "x-appwrite": { "method": "listCodes", "group": null, - "weight": 62, + "weight": 50, "cookies": false, "type": "", "demo": "locale\/list-codes.md", @@ -17766,7 +17880,7 @@ "x-appwrite": { "method": "listContinents", "group": null, - "weight": 66, + "weight": 54, "cookies": false, "type": "", "demo": "locale\/list-continents.md", @@ -17820,7 +17934,7 @@ "x-appwrite": { "method": "listCountries", "group": null, - "weight": 63, + "weight": 51, "cookies": false, "type": "", "demo": "locale\/list-countries.md", @@ -17874,7 +17988,7 @@ "x-appwrite": { "method": "listCountriesEU", "group": null, - "weight": 64, + "weight": 52, "cookies": false, "type": "", "demo": "locale\/list-countries-eu.md", @@ -17928,7 +18042,7 @@ "x-appwrite": { "method": "listCountriesPhones", "group": null, - "weight": 65, + "weight": 53, "cookies": false, "type": "", "demo": "locale\/list-countries-phones.md", @@ -17982,7 +18096,7 @@ "x-appwrite": { "method": "listCurrencies", "group": null, - "weight": 67, + "weight": 55, "cookies": false, "type": "", "demo": "locale\/list-currencies.md", @@ -18036,7 +18150,7 @@ "x-appwrite": { "method": "listLanguages", "group": null, - "weight": 68, + "weight": 56, "cookies": false, "type": "", "demo": "locale\/list-languages.md", @@ -18090,7 +18204,7 @@ "x-appwrite": { "method": "listMessages", "group": "messages", - "weight": 298, + "weight": 245, "cookies": false, "type": "", "demo": "messaging\/list-messages.md", @@ -18178,7 +18292,7 @@ "x-appwrite": { "method": "createEmail", "group": "messages", - "weight": 295, + "weight": 242, "cookies": false, "type": "", "demo": "messaging\/create-email.md", @@ -18324,7 +18438,7 @@ "x-appwrite": { "method": "updateEmail", "group": "messages", - "weight": 302, + "weight": 249, "cookies": false, "type": "", "demo": "messaging\/update-email.md", @@ -18482,7 +18596,7 @@ "x-appwrite": { "method": "createPush", "group": "messages", - "weight": 297, + "weight": 244, "cookies": false, "type": "", "demo": "messaging\/create-push.md", @@ -18591,7 +18705,8 @@ "badge": { "type": "integer", "description": "Badge for push notification. Available only for iOS Platform.", - "x-example": null + "x-example": null, + "format": "int32" }, "draft": { "type": "boolean", @@ -18659,7 +18774,7 @@ "x-appwrite": { "method": "updatePush", "group": "messages", - "weight": 304, + "weight": 251, "cookies": false, "type": "", "demo": "messaging\/update-push.md", @@ -18787,6 +18902,7 @@ "type": "integer", "description": "Badge for push notification. Available only for iOS platforms.", "x-example": null, + "format": "int32", "x-nullable": true }, "draft": { @@ -18856,7 +18972,7 @@ "x-appwrite": { "method": "createSms", "group": "messages", - "weight": 296, + "weight": 243, "cookies": false, "type": "", "demo": "messaging\/create-sms.md", @@ -19037,7 +19153,7 @@ "x-appwrite": { "method": "updateSms", "group": "messages", - "weight": 303, + "weight": 250, "cookies": false, "type": "", "demo": "messaging\/update-sms.md", @@ -19224,7 +19340,7 @@ "x-appwrite": { "method": "getMessage", "group": "messages", - "weight": 301, + "weight": 248, "cookies": false, "type": "", "demo": "messaging\/get-message.md", @@ -19278,7 +19394,7 @@ "x-appwrite": { "method": "delete", "group": "messages", - "weight": 305, + "weight": 252, "cookies": false, "type": "", "demo": "messaging\/delete.md", @@ -19341,7 +19457,7 @@ "x-appwrite": { "method": "listMessageLogs", "group": "logs", - "weight": 299, + "weight": 246, "cookies": false, "type": "", "demo": "messaging\/list-message-logs.md", @@ -19428,7 +19544,7 @@ "x-appwrite": { "method": "listTargets", "group": "messages", - "weight": 300, + "weight": 247, "cookies": false, "type": "", "demo": "messaging\/list-targets.md", @@ -19515,7 +19631,7 @@ "x-appwrite": { "method": "listProviders", "group": "providers", - "weight": 269, + "weight": 216, "cookies": false, "type": "", "demo": "messaging\/list-providers.md", @@ -19603,7 +19719,7 @@ "x-appwrite": { "method": "createApnsProvider", "group": "providers", - "weight": 268, + "weight": 215, "cookies": false, "type": "", "demo": "messaging\/create-apns-provider.md", @@ -19782,7 +19898,7 @@ "x-appwrite": { "method": "updateApnsProvider", "group": "providers", - "weight": 282, + "weight": 229, "cookies": false, "type": "", "demo": "messaging\/update-apns-provider.md", @@ -19963,7 +20079,7 @@ "x-appwrite": { "method": "createFcmProvider", "group": "providers", - "weight": 267, + "weight": 214, "cookies": false, "type": "", "demo": "messaging\/create-fcm-provider.md", @@ -20115,7 +20231,7 @@ "x-appwrite": { "method": "updateFcmProvider", "group": "providers", - "weight": 281, + "weight": 228, "cookies": false, "type": "", "demo": "messaging\/update-fcm-provider.md", @@ -20268,7 +20384,7 @@ "x-appwrite": { "method": "createMailgunProvider", "group": "providers", - "weight": 258, + "weight": 205, "cookies": false, "type": "", "demo": "messaging\/create-mailgun-provider.md", @@ -20333,7 +20449,8 @@ "fromEmail": { "type": "string", "description": "Sender email address.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -20343,7 +20460,8 @@ "replyToEmail": { "type": "string", "description": "Email set in the reply to field for the mail. Default value is sender email. Reply to email must have reply to name as well.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "enabled": { "type": "boolean", @@ -20386,7 +20504,7 @@ "x-appwrite": { "method": "updateMailgunProvider", "group": "providers", - "weight": 272, + "weight": 219, "cookies": false, "type": "", "demo": "messaging\/update-mailgun-provider.md", @@ -20464,7 +20582,8 @@ "fromEmail": { "type": "string", "description": "Sender email address.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -20507,7 +20626,7 @@ "x-appwrite": { "method": "createMsg91Provider", "group": "providers", - "weight": 262, + "weight": 209, "cookies": false, "type": "", "demo": "messaging\/create-msg-91-provider.md", @@ -20604,7 +20723,7 @@ "x-appwrite": { "method": "updateMsg91Provider", "group": "providers", - "weight": 276, + "weight": 223, "cookies": false, "type": "", "demo": "messaging\/update-msg-91-provider.md", @@ -20704,7 +20823,7 @@ "x-appwrite": { "method": "createResendProvider", "group": "providers", - "weight": 260, + "weight": 207, "cookies": false, "type": "", "demo": "messaging\/create-resend-provider.md", @@ -20758,7 +20877,8 @@ "fromEmail": { "type": "string", "description": "Sender email address.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -20768,7 +20888,8 @@ "replyToEmail": { "type": "string", "description": "Email set in the reply to field for the mail. Default value is sender email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "enabled": { "type": "boolean", @@ -20811,7 +20932,7 @@ "x-appwrite": { "method": "updateResendProvider", "group": "providers", - "weight": 274, + "weight": 221, "cookies": false, "type": "", "demo": "messaging\/update-resend-provider.md", @@ -20878,7 +20999,8 @@ "fromEmail": { "type": "string", "description": "Sender email address.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -20921,7 +21043,7 @@ "x-appwrite": { "method": "createSendgridProvider", "group": "providers", - "weight": 259, + "weight": 206, "cookies": false, "type": "", "demo": "messaging\/create-sendgrid-provider.md", @@ -20975,7 +21097,8 @@ "fromEmail": { "type": "string", "description": "Sender email address.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -20985,7 +21108,8 @@ "replyToEmail": { "type": "string", "description": "Email set in the reply to field for the mail. Default value is sender email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "enabled": { "type": "boolean", @@ -21028,7 +21152,7 @@ "x-appwrite": { "method": "updateSendgridProvider", "group": "providers", - "weight": 273, + "weight": 220, "cookies": false, "type": "", "demo": "messaging\/update-sendgrid-provider.md", @@ -21095,7 +21219,8 @@ "fromEmail": { "type": "string", "description": "Sender email address.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -21138,7 +21263,7 @@ "x-appwrite": { "method": "createSmtpProvider", "group": "providers", - "weight": 261, + "weight": 208, "cookies": false, "type": "", "demo": "messaging\/create-smtp-provider.md", @@ -21273,7 +21398,8 @@ "port": { "type": "integer", "description": "The default SMTP server port.", - "x-example": 1 + "x-example": 1, + "format": "int32" }, "username": { "type": "string", @@ -21315,7 +21441,8 @@ "fromEmail": { "type": "string", "description": "Sender email address.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -21325,7 +21452,8 @@ "replyToEmail": { "type": "string", "description": "Email set in the reply to field for the mail. Default value is sender email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "enabled": { "type": "boolean", @@ -21369,7 +21497,7 @@ "x-appwrite": { "method": "updateSmtpProvider", "group": "providers", - "weight": 275, + "weight": 222, "cookies": false, "type": "", "demo": "messaging\/update-smtp-provider.md", @@ -21508,6 +21636,7 @@ "type": "integer", "description": "SMTP port.", "x-example": 1, + "format": "int32", "x-nullable": true }, "username": { @@ -21551,7 +21680,8 @@ "fromEmail": { "type": "string", "description": "Sender email address.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -21600,7 +21730,7 @@ "x-appwrite": { "method": "createTelesignProvider", "group": "providers", - "weight": 263, + "weight": 210, "cookies": false, "type": "", "demo": "messaging\/create-telesign-provider.md", @@ -21644,7 +21774,8 @@ "from": { "type": "string", "description": "Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "customerId": { "type": "string", @@ -21697,7 +21828,7 @@ "x-appwrite": { "method": "updateTelesignProvider", "group": "providers", - "weight": 277, + "weight": 224, "cookies": false, "type": "", "demo": "messaging\/update-telesign-provider.md", @@ -21797,7 +21928,7 @@ "x-appwrite": { "method": "createTextmagicProvider", "group": "providers", - "weight": 264, + "weight": 211, "cookies": false, "type": "", "demo": "messaging\/create-textmagic-provider.md", @@ -21841,7 +21972,8 @@ "from": { "type": "string", "description": "Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "username": { "type": "string", @@ -21894,7 +22026,7 @@ "x-appwrite": { "method": "updateTextmagicProvider", "group": "providers", - "weight": 278, + "weight": 225, "cookies": false, "type": "", "demo": "messaging\/update-textmagic-provider.md", @@ -21994,7 +22126,7 @@ "x-appwrite": { "method": "createTwilioProvider", "group": "providers", - "weight": 265, + "weight": 212, "cookies": false, "type": "", "demo": "messaging\/create-twilio-provider.md", @@ -22038,7 +22170,8 @@ "from": { "type": "string", "description": "Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "accountSid": { "type": "string", @@ -22091,7 +22224,7 @@ "x-appwrite": { "method": "updateTwilioProvider", "group": "providers", - "weight": 279, + "weight": 226, "cookies": false, "type": "", "demo": "messaging\/update-twilio-provider.md", @@ -22191,7 +22324,7 @@ "x-appwrite": { "method": "createVonageProvider", "group": "providers", - "weight": 266, + "weight": 213, "cookies": false, "type": "", "demo": "messaging\/create-vonage-provider.md", @@ -22235,7 +22368,8 @@ "from": { "type": "string", "description": "Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "apiKey": { "type": "string", @@ -22288,7 +22422,7 @@ "x-appwrite": { "method": "updateVonageProvider", "group": "providers", - "weight": 280, + "weight": 227, "cookies": false, "type": "", "demo": "messaging\/update-vonage-provider.md", @@ -22388,7 +22522,7 @@ "x-appwrite": { "method": "getProvider", "group": "providers", - "weight": 271, + "weight": 218, "cookies": false, "type": "", "demo": "messaging\/get-provider.md", @@ -22442,7 +22576,7 @@ "x-appwrite": { "method": "deleteProvider", "group": "providers", - "weight": 283, + "weight": 230, "cookies": false, "type": "", "demo": "messaging\/delete-provider.md", @@ -22505,7 +22639,7 @@ "x-appwrite": { "method": "listProviderLogs", "group": "providers", - "weight": 270, + "weight": 217, "cookies": false, "type": "", "demo": "messaging\/list-provider-logs.md", @@ -22592,7 +22726,7 @@ "x-appwrite": { "method": "listSubscriberLogs", "group": "subscribers", - "weight": 292, + "weight": 239, "cookies": false, "type": "", "demo": "messaging\/list-subscriber-logs.md", @@ -22679,7 +22813,7 @@ "x-appwrite": { "method": "listTopics", "group": "topics", - "weight": 285, + "weight": 232, "cookies": false, "type": "", "demo": "messaging\/list-topics.md", @@ -22765,7 +22899,7 @@ "x-appwrite": { "method": "createTopic", "group": "topics", - "weight": 284, + "weight": 231, "cookies": false, "type": "", "demo": "messaging\/create-topic.md", @@ -22849,7 +22983,7 @@ "x-appwrite": { "method": "getTopic", "group": "topics", - "weight": 287, + "weight": 234, "cookies": false, "type": "", "demo": "messaging\/get-topic.md", @@ -22910,7 +23044,7 @@ "x-appwrite": { "method": "updateTopic", "group": "topics", - "weight": 288, + "weight": 235, "cookies": false, "type": "", "demo": "messaging\/update-topic.md", @@ -22990,7 +23124,7 @@ "x-appwrite": { "method": "deleteTopic", "group": "topics", - "weight": 289, + "weight": 236, "cookies": false, "type": "", "demo": "messaging\/delete-topic.md", @@ -23053,7 +23187,7 @@ "x-appwrite": { "method": "listTopicLogs", "group": "topics", - "weight": 286, + "weight": 233, "cookies": false, "type": "", "demo": "messaging\/list-topic-logs.md", @@ -23140,7 +23274,7 @@ "x-appwrite": { "method": "listSubscribers", "group": "subscribers", - "weight": 291, + "weight": 238, "cookies": false, "type": "", "demo": "messaging\/list-subscribers.md", @@ -23236,7 +23370,7 @@ "x-appwrite": { "method": "createSubscriber", "group": "subscribers", - "weight": 290, + "weight": 237, "cookies": false, "type": "", "demo": "messaging\/create-subscriber.md", @@ -23327,7 +23461,7 @@ "x-appwrite": { "method": "getSubscriber", "group": "subscribers", - "weight": 293, + "weight": 240, "cookies": false, "type": "", "demo": "messaging\/get-subscriber.md", @@ -23391,7 +23525,7 @@ "x-appwrite": { "method": "deleteSubscriber", "group": "subscribers", - "weight": 294, + "weight": 241, "cookies": false, "type": "", "demo": "messaging\/delete-subscriber.md", @@ -23467,7 +23601,7 @@ "x-appwrite": { "method": "list", "group": null, - "weight": 250, + "weight": 197, "cookies": false, "type": "", "demo": "migrations\/list.md", @@ -23553,7 +23687,7 @@ "x-appwrite": { "method": "createAppwriteMigration", "group": null, - "weight": 244, + "weight": 191, "cookies": false, "type": "", "demo": "migrations\/create-appwrite-migration.md", @@ -23613,7 +23747,8 @@ "endpoint": { "type": "string", "description": "Source Appwrite endpoint", - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" }, "projectId": { "type": "string", @@ -23662,7 +23797,7 @@ "x-appwrite": { "method": "getAppwriteReport", "group": null, - "weight": 252, + "weight": 199, "cookies": false, "type": "", "demo": "migrations\/get-appwrite-report.md", @@ -23776,7 +23911,7 @@ "x-appwrite": { "method": "createCSVExport", "group": null, - "weight": 249, + "weight": 196, "cookies": false, "type": "", "demo": "migrations\/create-csv-export.md", @@ -23891,7 +24026,7 @@ "x-appwrite": { "method": "createCSVImport", "group": null, - "weight": 248, + "weight": 195, "cookies": false, "type": "", "demo": "migrations\/create-csv-import.md", @@ -23976,7 +24111,7 @@ "x-appwrite": { "method": "createFirebaseMigration", "group": null, - "weight": 245, + "weight": 192, "cookies": false, "type": "", "demo": "migrations\/create-firebase-migration.md", @@ -24067,7 +24202,7 @@ "x-appwrite": { "method": "getFirebaseReport", "group": null, - "weight": 253, + "weight": 200, "cookies": false, "type": "", "demo": "migrations\/get-firebase-report.md", @@ -24154,7 +24289,7 @@ "x-appwrite": { "method": "createNHostMigration", "group": null, - "weight": 247, + "weight": 194, "cookies": false, "type": "", "demo": "migrations\/create-n-host-migration.md", @@ -24239,7 +24374,8 @@ "port": { "type": "integer", "description": "Source's Database Port", - "x-example": null + "x-example": null, + "format": "int32" } }, "required": [ @@ -24281,7 +24417,7 @@ "x-appwrite": { "method": "getNHostReport", "group": null, - "weight": 255, + "weight": 202, "cookies": false, "type": "", "demo": "migrations\/get-n-host-report.md", @@ -24430,7 +24566,7 @@ "x-appwrite": { "method": "createSupabaseMigration", "group": null, - "weight": 246, + "weight": 193, "cookies": false, "type": "", "demo": "migrations\/create-supabase-migration.md", @@ -24485,7 +24621,8 @@ "endpoint": { "type": "string", "description": "Source's Supabase Endpoint", - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" }, "apiKey": { "type": "string", @@ -24510,7 +24647,8 @@ "port": { "type": "integer", "description": "Source's Database Port", - "x-example": null + "x-example": null, + "format": "int32" } }, "required": [ @@ -24551,7 +24689,7 @@ "x-appwrite": { "method": "getSupabaseReport", "group": null, - "weight": 254, + "weight": 201, "cookies": false, "type": "", "demo": "migrations\/get-supabase-report.md", @@ -24691,7 +24829,7 @@ "x-appwrite": { "method": "get", "group": null, - "weight": 251, + "weight": 198, "cookies": false, "type": "", "demo": "migrations\/get.md", @@ -24750,7 +24888,7 @@ "x-appwrite": { "method": "retry", "group": null, - "weight": 256, + "weight": 203, "cookies": false, "type": "", "demo": "migrations\/retry.md", @@ -24802,7 +24940,7 @@ "x-appwrite": { "method": "delete", "group": null, - "weight": 257, + "weight": 204, "cookies": false, "type": "", "demo": "migrations\/delete.md", @@ -24863,7 +25001,7 @@ "x-appwrite": { "method": "getUsage", "group": null, - "weight": 139, + "weight": 103, "cookies": false, "type": "", "demo": "project\/get-usage.md", @@ -24952,7 +25090,7 @@ "x-appwrite": { "method": "listVariables", "group": null, - "weight": 141, + "weight": 105, "cookies": false, "type": "", "demo": "project\/list-variables.md", @@ -24999,7 +25137,7 @@ "x-appwrite": { "method": "createVariable", "group": null, - "weight": 140, + "weight": 104, "cookies": false, "type": "", "demo": "project\/create-variable.md", @@ -25078,7 +25216,7 @@ "x-appwrite": { "method": "getVariable", "group": null, - "weight": 142, + "weight": 106, "cookies": false, "type": "", "demo": "project\/get-variable.md", @@ -25137,7 +25275,7 @@ "x-appwrite": { "method": "updateVariable", "group": null, - "weight": 143, + "weight": 107, "cookies": false, "type": "", "demo": "project\/update-variable.md", @@ -25220,7 +25358,7 @@ "x-appwrite": { "method": "deleteVariable", "group": null, - "weight": 144, + "weight": 108, "cookies": false, "type": "", "demo": "project\/delete-variable.md", @@ -25281,7 +25419,7 @@ "x-appwrite": { "method": "list", "group": "projects", - "weight": 452, + "weight": 410, "cookies": false, "type": "", "demo": "projects\/list.md", @@ -25306,7 +25444,7 @@ "parameters": [ { "name": "queries", - "description": "Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https:\/\/appwrite.io\/docs\/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, teamId", + "description": "Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https:\/\/appwrite.io\/docs\/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, teamId, labels, search", "required": false, "schema": { "type": "array", @@ -25364,7 +25502,7 @@ "x-appwrite": { "method": "create", "group": "projects", - "weight": 93, + "weight": 57, "cookies": false, "type": "", "demo": "projects\/create.md", @@ -25431,7 +25569,8 @@ "url": { "type": "string", "description": "Project URL.", - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" }, "legalName": { "type": "string", @@ -25499,7 +25638,7 @@ "x-appwrite": { "method": "get", "group": "projects", - "weight": 94, + "weight": 58, "cookies": false, "type": "", "demo": "projects\/get.md", @@ -25558,7 +25697,7 @@ "x-appwrite": { "method": "update", "group": "projects", - "weight": 95, + "weight": 59, "cookies": false, "type": "", "demo": "projects\/update.md", @@ -25617,7 +25756,8 @@ "url": { "type": "string", "description": "Project URL.", - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" }, "legalName": { "type": "string", @@ -25674,7 +25814,7 @@ "x-appwrite": { "method": "delete", "group": "projects", - "weight": 112, + "weight": 76, "cookies": false, "type": "", "demo": "projects\/delete.md", @@ -25735,7 +25875,7 @@ "x-appwrite": { "method": "updateApiStatus", "group": "projects", - "weight": 99, + "weight": 63, "cookies": false, "type": "", "demo": "projects\/update-api-status.md", @@ -25892,7 +26032,7 @@ "x-appwrite": { "method": "updateApiStatusAll", "group": "projects", - "weight": 100, + "weight": 64, "cookies": false, "type": "", "demo": "projects\/update-api-status-all.md", @@ -26032,7 +26172,7 @@ "x-appwrite": { "method": "updateAuthDuration", "group": "auth", - "weight": 105, + "weight": 69, "cookies": false, "type": "", "demo": "projects\/update-auth-duration.md", @@ -26076,7 +26216,8 @@ "duration": { "type": "integer", "description": "Project session length in seconds. Max length: 31536000 seconds.", - "x-example": 0 + "x-example": 0, + "format": "int32" } }, "required": [ @@ -26112,7 +26253,7 @@ "x-appwrite": { "method": "updateAuthLimit", "group": "auth", - "weight": 104, + "weight": 68, "cookies": false, "type": "", "demo": "projects\/update-auth-limit.md", @@ -26156,7 +26297,8 @@ "limit": { "type": "integer", "description": "Set the max number of users allowed in this project. Use 0 for unlimited.", - "x-example": 0 + "x-example": 0, + "format": "int32" } }, "required": [ @@ -26192,7 +26334,7 @@ "x-appwrite": { "method": "updateAuthSessionsLimit", "group": "auth", - "weight": 110, + "weight": 74, "cookies": false, "type": "", "demo": "projects\/update-auth-sessions-limit.md", @@ -26236,7 +26378,8 @@ "limit": { "type": "integer", "description": "Set the max number of users allowed in this project. Value allowed is between 1-100. Default is 10", - "x-example": 1 + "x-example": 1, + "format": "int32" } }, "required": [ @@ -26272,7 +26415,7 @@ "x-appwrite": { "method": "updateMembershipsPrivacy", "group": "auth", - "weight": 103, + "weight": 67, "cookies": false, "type": "", "demo": "projects\/update-memberships-privacy.md", @@ -26364,7 +26507,7 @@ "x-appwrite": { "method": "updateMockNumbers", "group": "auth", - "weight": 111, + "weight": 75, "cookies": false, "type": "", "demo": "projects\/update-mock-numbers.md", @@ -26447,7 +26590,7 @@ "x-appwrite": { "method": "updateAuthPasswordDictionary", "group": "auth", - "weight": 108, + "weight": 72, "cookies": false, "type": "", "demo": "projects\/update-auth-password-dictionary.md", @@ -26527,7 +26670,7 @@ "x-appwrite": { "method": "updateAuthPasswordHistory", "group": "auth", - "weight": 107, + "weight": 71, "cookies": false, "type": "", "demo": "projects\/update-auth-password-history.md", @@ -26571,7 +26714,8 @@ "limit": { "type": "integer", "description": "Set the max number of passwords to store in user history. User can't choose a new password that is already stored in the password history list. Max number of passwords allowed in history is20. Default value is 0", - "x-example": 0 + "x-example": 0, + "format": "int32" } }, "required": [ @@ -26607,7 +26751,7 @@ "x-appwrite": { "method": "updatePersonalDataCheck", "group": "auth", - "weight": 109, + "weight": 73, "cookies": false, "type": "", "demo": "projects\/update-personal-data-check.md", @@ -26687,7 +26831,7 @@ "x-appwrite": { "method": "updateSessionAlerts", "group": "auth", - "weight": 102, + "weight": 66, "cookies": false, "type": "", "demo": "projects\/update-session-alerts.md", @@ -26767,7 +26911,7 @@ "x-appwrite": { "method": "updateSessionInvalidation", "group": "auth", - "weight": 138, + "weight": 102, "cookies": false, "type": "", "demo": "projects\/update-session-invalidation.md", @@ -26847,7 +26991,7 @@ "x-appwrite": { "method": "updateAuthStatus", "group": "auth", - "weight": 106, + "weight": 70, "cookies": false, "type": "", "demo": "projects\/update-auth-status.md", @@ -26948,14 +27092,14 @@ "x-appwrite": { "method": "listDevKeys", "group": "devKeys", - "weight": 450, + "weight": 408, "cookies": false, "type": "", "demo": "projects\/list-dev-keys.md", "rate-limit": 0, "rate-time": 3600, "rate-key": "url:{url},ip:{ip}", - "scope": "projects.read", + "scope": "devKeys.read", "platforms": [ "console" ], @@ -27019,14 +27163,14 @@ "x-appwrite": { "method": "createDevKey", "group": "devKeys", - "weight": 447, + "weight": 405, "cookies": false, "type": "", "demo": "projects\/create-dev-key.md", "rate-limit": 0, "rate-time": 3600, "rate-key": "url:{url},ip:{ip}", - "scope": "projects.write", + "scope": "devKeys.write", "platforms": [ "console" ], @@ -27104,14 +27248,14 @@ "x-appwrite": { "method": "getDevKey", "group": "devKeys", - "weight": 449, + "weight": 407, "cookies": false, "type": "", "demo": "projects\/get-dev-key.md", "rate-limit": 0, "rate-time": 3600, "rate-key": "url:{url},ip:{ip}", - "scope": "projects.read", + "scope": "devKeys.read", "platforms": [ "console" ], @@ -27172,14 +27316,14 @@ "x-appwrite": { "method": "updateDevKey", "group": "devKeys", - "weight": 448, + "weight": 406, "cookies": false, "type": "", "demo": "projects\/update-dev-key.md", "rate-limit": 0, "rate-time": 3600, "rate-key": "url:{url},ip:{ip}", - "scope": "projects.write", + "scope": "devKeys.write", "platforms": [ "console" ], @@ -27258,14 +27402,14 @@ "x-appwrite": { "method": "deleteDevKey", "group": "devKeys", - "weight": 451, + "weight": 409, "cookies": false, "type": "", "demo": "projects\/delete-dev-key.md", "rate-limit": 0, "rate-time": 3600, "rate-key": "url:{url},ip:{ip}", - "scope": "projects.write", + "scope": "devKeys.write", "platforms": [ "console" ], @@ -27328,7 +27472,7 @@ "x-appwrite": { "method": "createJWT", "group": "auth", - "weight": 124, + "weight": 88, "cookies": false, "type": "", "demo": "projects\/create-jwt.md", @@ -27439,7 +27583,8 @@ "duration": { "type": "integer", "description": "Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds.", - "x-example": 0 + "x-example": 0, + "format": "int32" } }, "required": [ @@ -27475,7 +27620,7 @@ "x-appwrite": { "method": "listKeys", "group": "keys", - "weight": 120, + "weight": 84, "cookies": false, "type": "", "demo": "projects\/list-keys.md", @@ -27545,7 +27690,7 @@ "x-appwrite": { "method": "createKey", "group": "keys", - "weight": 119, + "weight": 83, "cookies": false, "type": "", "demo": "projects\/create-key.md", @@ -27700,7 +27845,7 @@ "x-appwrite": { "method": "getKey", "group": "keys", - "weight": 121, + "weight": 85, "cookies": false, "type": "", "demo": "projects\/get-key.md", @@ -27769,7 +27914,7 @@ "x-appwrite": { "method": "updateKey", "group": "keys", - "weight": 122, + "weight": 86, "cookies": false, "type": "", "demo": "projects\/update-key.md", @@ -27925,7 +28070,7 @@ "x-appwrite": { "method": "deleteKey", "group": "keys", - "weight": 123, + "weight": 87, "cookies": false, "type": "", "demo": "projects\/delete-key.md", @@ -27972,6 +28117,88 @@ ] } }, + "\/projects\/{projectId}\/labels": { + "put": { + "summary": "Update project labels", + "operationId": "projectsUpdateLabels", + "tags": [ + "projects" + ], + "description": "Update the project labels by its unique ID. Labels can be used to easily filter projects in an organization.", + "responses": { + "200": { + "description": "Project", + "content": { + "application\/json": { + "schema": { + "$ref": "#\/components\/schemas\/project" + } + } + } + } + }, + "deprecated": false, + "x-appwrite": { + "method": "updateLabels", + "group": "projects", + "weight": 411, + "cookies": false, + "type": "", + "demo": "projects\/update-labels.md", + "rate-limit": 0, + "rate-time": 3600, + "rate-key": "url:{url},ip:{ip}", + "scope": "projects.write", + "platforms": [ + "console" + ], + "packaging": false, + "public": true, + "auth": { + "Project": [] + } + }, + "security": [ + { + "Project": [] + } + ], + "parameters": [ + { + "name": "projectId", + "description": "Project unique ID.", + "required": true, + "schema": { + "type": "string", + "x-example": "" + }, + "in": "path" + } + ], + "requestBody": { + "content": { + "application\/json": { + "schema": { + "type": "object", + "properties": { + "labels": { + "type": "array", + "description": "Array of project labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long.", + "x-example": null, + "items": { + "type": "string" + } + } + }, + "required": [ + "labels" + ] + } + } + } + } + } + }, "\/projects\/{projectId}\/oauth2": { "patch": { "summary": "Update project OAuth2", @@ -27996,7 +28223,7 @@ "x-appwrite": { "method": "updateOAuth2", "group": "auth", - "weight": 101, + "weight": 65, "cookies": false, "type": "", "demo": "projects\/update-o-auth-2.md", @@ -28080,8 +28307,7 @@ "yammer", "yandex", "zoho", - "zoom", - "mock" + "zoom" ], "x-enum-name": "OAuthProvider", "x-enum-keys": [] @@ -28138,7 +28364,7 @@ "x-appwrite": { "method": "listPlatforms", "group": "platforms", - "weight": 126, + "weight": 90, "cookies": false, "type": "", "demo": "projects\/list-platforms.md", @@ -28208,7 +28434,7 @@ "x-appwrite": { "method": "createPlatform", "group": "platforms", - "weight": 125, + "weight": 89, "cookies": false, "type": "", "demo": "projects\/create-platform.md", @@ -28328,7 +28554,7 @@ "x-appwrite": { "method": "getPlatform", "group": "platforms", - "weight": 127, + "weight": 91, "cookies": false, "type": "", "demo": "projects\/get-platform.md", @@ -28397,7 +28623,7 @@ "x-appwrite": { "method": "updatePlatform", "group": "platforms", - "weight": 128, + "weight": 92, "cookies": false, "type": "", "demo": "projects\/update-platform.md", @@ -28493,7 +28719,7 @@ "x-appwrite": { "method": "deletePlatform", "group": "platforms", - "weight": 129, + "weight": 93, "cookies": false, "type": "", "demo": "projects\/delete-platform.md", @@ -28564,7 +28790,7 @@ "x-appwrite": { "method": "updateServiceStatus", "group": "projects", - "weight": 97, + "weight": 61, "cookies": false, "type": "", "demo": "projects\/update-service-status.md", @@ -28667,7 +28893,7 @@ "x-appwrite": { "method": "updateServiceStatusAll", "group": "projects", - "weight": 98, + "weight": 62, "cookies": false, "type": "", "demo": "projects\/update-service-status-all.md", @@ -28747,7 +28973,7 @@ "x-appwrite": { "method": "updateSmtp", "group": "templates", - "weight": 130, + "weight": 94, "cookies": false, "type": "", "demo": "projects\/update-smtp.md", @@ -28877,12 +29103,14 @@ "senderEmail": { "type": "string", "description": "Email of the sender", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyTo": { "type": "string", "description": "Reply to email", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "host": { "type": "string", @@ -28892,7 +29120,8 @@ "port": { "type": "integer", "description": "SMTP server port", - "x-example": null + "x-example": null, + "format": "int32" }, "username": { "type": "string", @@ -28942,7 +29171,7 @@ "x-appwrite": { "method": "createSmtpTest", "group": "templates", - "weight": 131, + "weight": 95, "cookies": false, "type": "", "demo": "projects\/create-smtp-test.md", @@ -29079,12 +29308,14 @@ "senderEmail": { "type": "string", "description": "Email of the sender", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyTo": { "type": "string", "description": "Reply to email", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "host": { "type": "string", @@ -29094,7 +29325,8 @@ "port": { "type": "integer", "description": "SMTP server port", - "x-example": null + "x-example": null, + "format": "int32" }, "username": { "type": "string", @@ -29154,7 +29386,7 @@ "x-appwrite": { "method": "updateTeam", "group": "projects", - "weight": 96, + "weight": 60, "cookies": false, "type": "", "demo": "projects\/update-team.md", @@ -29234,7 +29466,7 @@ "x-appwrite": { "method": "getEmailTemplate", "group": "templates", - "weight": 133, + "weight": 97, "cookies": false, "type": "", "demo": "projects\/get-email-template.md", @@ -29459,7 +29691,7 @@ "x-appwrite": { "method": "updateEmailTemplate", "group": "templates", - "weight": 135, + "weight": 99, "cookies": false, "type": "", "demo": "projects\/update-email-template.md", @@ -29684,12 +29916,14 @@ "senderEmail": { "type": "string", "description": "Email of the sender", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyTo": { "type": "string", "description": "Reply to email", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" } }, "required": [ @@ -29724,7 +29958,7 @@ "x-appwrite": { "method": "deleteEmailTemplate", "group": "templates", - "weight": 137, + "weight": 101, "cookies": false, "type": "", "demo": "projects\/delete-email-template.md", @@ -29951,7 +30185,7 @@ "x-appwrite": { "method": "getSmsTemplate", "group": "templates", - "weight": 132, + "weight": 96, "cookies": false, "type": "", "demo": "projects\/get-sms-template.md", @@ -30237,7 +30471,7 @@ "x-appwrite": { "method": "updateSmsTemplate", "group": "templates", - "weight": 134, + "weight": 98, "cookies": false, "type": "", "demo": "projects\/update-sms-template.md", @@ -30546,7 +30780,7 @@ "x-appwrite": { "method": "deleteSmsTemplate", "group": "templates", - "weight": 136, + "weight": 100, "cookies": false, "type": "", "demo": "projects\/delete-sms-template.md", @@ -30834,7 +31068,7 @@ "x-appwrite": { "method": "listWebhooks", "group": "webhooks", - "weight": 114, + "weight": 78, "cookies": false, "type": "", "demo": "projects\/list-webhooks.md", @@ -30904,7 +31138,7 @@ "x-appwrite": { "method": "createWebhook", "group": "webhooks", - "weight": 113, + "weight": 77, "cookies": false, "type": "", "demo": "projects\/create-webhook.md", @@ -31020,7 +31254,7 @@ "x-appwrite": { "method": "getWebhook", "group": "webhooks", - "weight": 115, + "weight": 79, "cookies": false, "type": "", "demo": "projects\/get-webhook.md", @@ -31089,7 +31323,7 @@ "x-appwrite": { "method": "updateWebhook", "group": "webhooks", - "weight": 116, + "weight": 80, "cookies": false, "type": "", "demo": "projects\/update-webhook.md", @@ -31206,7 +31440,7 @@ "x-appwrite": { "method": "deleteWebhook", "group": "webhooks", - "weight": 118, + "weight": 82, "cookies": false, "type": "", "demo": "projects\/delete-webhook.md", @@ -31277,7 +31511,7 @@ "x-appwrite": { "method": "updateWebhookSignature", "group": "webhooks", - "weight": 117, + "weight": 81, "cookies": false, "type": "", "demo": "projects\/update-webhook-signature.md", @@ -31348,7 +31582,7 @@ "x-appwrite": { "method": "listRules", "group": null, - "weight": 518, + "weight": 512, "cookies": false, "type": "", "demo": "proxy\/list-rules.md", @@ -31433,7 +31667,7 @@ "x-appwrite": { "method": "createAPIRule", "group": null, - "weight": 513, + "weight": 507, "cookies": false, "type": "", "demo": "proxy\/create-api-rule.md", @@ -31500,7 +31734,7 @@ "x-appwrite": { "method": "createFunctionRule", "group": null, - "weight": 515, + "weight": 509, "cookies": false, "type": "", "demo": "proxy\/create-function-rule.md", @@ -31578,7 +31812,7 @@ "x-appwrite": { "method": "createRedirectRule", "group": null, - "weight": 516, + "weight": 510, "cookies": false, "type": "", "demo": "proxy\/create-redirect-rule.md", @@ -31614,7 +31848,8 @@ "url": { "type": "string", "description": "Target URL of redirection", - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" }, "statusCode": { "type": "string", @@ -31691,7 +31926,7 @@ "x-appwrite": { "method": "createSiteRule", "group": null, - "weight": 514, + "weight": 508, "cookies": false, "type": "", "demo": "proxy\/create-site-rule.md", @@ -31769,7 +32004,7 @@ "x-appwrite": { "method": "getRule", "group": null, - "weight": 517, + "weight": 511, "cookies": false, "type": "", "demo": "proxy\/get-rule.md", @@ -31820,7 +32055,7 @@ "x-appwrite": { "method": "deleteRule", "group": null, - "weight": 519, + "weight": 513, "cookies": false, "type": "", "demo": "proxy\/delete-rule.md", @@ -31880,7 +32115,7 @@ "x-appwrite": { "method": "updateRuleVerification", "group": null, - "weight": 520, + "weight": 514, "cookies": false, "type": "", "demo": "proxy\/update-rule-verification.md", @@ -31940,7 +32175,7 @@ "x-appwrite": { "method": "list", "group": "sites", - "weight": 485, + "weight": 469, "cookies": false, "type": "", "demo": "sites\/list.md", @@ -32025,7 +32260,7 @@ "x-appwrite": { "method": "create", "group": "sites", - "weight": 483, + "weight": 467, "cookies": false, "type": "", "demo": "sites\/create.md", @@ -32102,7 +32337,8 @@ "timeout": { "type": "integer", "description": "Maximum request time in seconds.", - "x-example": 1 + "x-example": 1, + "format": "int32" }, "installCommand": { "type": "string", @@ -32278,7 +32514,7 @@ "x-appwrite": { "method": "listFrameworks", "group": "frameworks", - "weight": 488, + "weight": 472, "cookies": false, "type": "", "demo": "sites\/list-frameworks.md", @@ -32328,7 +32564,7 @@ "x-appwrite": { "method": "listSpecifications", "group": "frameworks", - "weight": 511, + "weight": 495, "cookies": false, "type": "", "demo": "sites\/list-specifications.md", @@ -32378,7 +32614,7 @@ "x-appwrite": { "method": "listTemplates", "group": "templates", - "weight": 507, + "weight": 491, "cookies": false, "type": "", "demo": "sites\/list-templates.md", @@ -32507,7 +32743,7 @@ "x-appwrite": { "method": "getTemplate", "group": "templates", - "weight": 508, + "weight": 492, "cookies": false, "type": "", "demo": "sites\/get-template.md", @@ -32567,7 +32803,7 @@ "x-appwrite": { "method": "listUsage", "group": null, - "weight": 509, + "weight": 493, "cookies": false, "type": "", "demo": "sites\/list-usage.md", @@ -32639,7 +32875,7 @@ "x-appwrite": { "method": "get", "group": "sites", - "weight": 484, + "weight": 468, "cookies": false, "type": "", "demo": "sites\/get.md", @@ -32699,7 +32935,7 @@ "x-appwrite": { "method": "update", "group": "sites", - "weight": 486, + "weight": 470, "cookies": false, "type": "", "demo": "sites\/update.md", @@ -32783,7 +33019,8 @@ "timeout": { "type": "integer", "description": "Maximum request time in seconds.", - "x-example": 1 + "x-example": 1, + "format": "int32" }, "installCommand": { "type": "string", @@ -32948,7 +33185,7 @@ "x-appwrite": { "method": "delete", "group": "sites", - "weight": 487, + "weight": 471, "cookies": false, "type": "", "demo": "sites\/delete.md", @@ -33010,7 +33247,7 @@ "x-appwrite": { "method": "updateSiteDeployment", "group": "sites", - "weight": 494, + "weight": 478, "cookies": false, "type": "", "demo": "sites\/update-site-deployment.md", @@ -33091,7 +33328,7 @@ "x-appwrite": { "method": "listDeployments", "group": "deployments", - "weight": 493, + "weight": 477, "cookies": false, "type": "", "demo": "sites\/list-deployments.md", @@ -33186,7 +33423,7 @@ "x-appwrite": { "method": "createDeployment", "group": "deployments", - "weight": 489, + "weight": 473, "cookies": false, "type": "upload", "demo": "sites\/create-deployment.md", @@ -33249,7 +33486,8 @@ "code": { "type": "string", "description": "Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory.", - "x-example": null + "x-example": null, + "format": "binary" }, "activate": { "type": "boolean", @@ -33291,7 +33529,7 @@ "x-appwrite": { "method": "createDuplicateDeployment", "group": "deployments", - "weight": 497, + "weight": 481, "cookies": false, "type": "", "demo": "sites\/create-duplicate-deployment.md", @@ -33372,7 +33610,7 @@ "x-appwrite": { "method": "createTemplateDeployment", "group": "deployments", - "weight": 490, + "weight": 474, "cookies": false, "type": "", "demo": "sites\/create-template-deployment.md", @@ -33489,7 +33727,7 @@ "x-appwrite": { "method": "createVcsDeployment", "group": "deployments", - "weight": 491, + "weight": 475, "cookies": false, "type": "", "demo": "sites\/create-vcs-deployment.md", @@ -33588,7 +33826,7 @@ "x-appwrite": { "method": "getDeployment", "group": "deployments", - "weight": 492, + "weight": 476, "cookies": false, "type": "", "demo": "sites\/get-deployment.md", @@ -33651,7 +33889,7 @@ "x-appwrite": { "method": "deleteDeployment", "group": "deployments", - "weight": 495, + "weight": 479, "cookies": false, "type": "", "demo": "sites\/delete-deployment.md", @@ -33716,7 +33954,7 @@ "x-appwrite": { "method": "getDeploymentDownload", "group": "deployments", - "weight": 496, + "weight": 480, "cookies": false, "type": "location", "demo": "sites\/get-deployment-download.md", @@ -33807,7 +34045,7 @@ "x-appwrite": { "method": "updateDeploymentStatus", "group": "deployments", - "weight": 498, + "weight": 482, "cookies": false, "type": "", "demo": "sites\/update-deployment-status.md", @@ -33879,7 +34117,7 @@ "x-appwrite": { "method": "listLogs", "group": "logs", - "weight": 500, + "weight": 484, "cookies": false, "type": "", "demo": "sites\/list-logs.md", @@ -33965,7 +34203,7 @@ "x-appwrite": { "method": "getLog", "group": "logs", - "weight": 499, + "weight": 483, "cookies": false, "type": "", "demo": "sites\/get-log.md", @@ -34028,7 +34266,7 @@ "x-appwrite": { "method": "deleteLog", "group": "logs", - "weight": 501, + "weight": 485, "cookies": false, "type": "", "demo": "sites\/delete-log.md", @@ -34100,7 +34338,7 @@ "x-appwrite": { "method": "getUsage", "group": null, - "weight": 510, + "weight": 494, "cookies": false, "type": "", "demo": "sites\/get-usage.md", @@ -34182,7 +34420,7 @@ "x-appwrite": { "method": "listVariables", "group": "variables", - "weight": 504, + "weight": 488, "cookies": false, "type": "", "demo": "sites\/list-variables.md", @@ -34242,7 +34480,7 @@ "x-appwrite": { "method": "createVariable", "group": "variables", - "weight": 502, + "weight": 486, "cookies": false, "type": "", "demo": "sites\/create-variable.md", @@ -34334,7 +34572,7 @@ "x-appwrite": { "method": "getVariable", "group": "variables", - "weight": 503, + "weight": 487, "cookies": false, "type": "", "demo": "sites\/get-variable.md", @@ -34404,7 +34642,7 @@ "x-appwrite": { "method": "updateVariable", "group": "variables", - "weight": 505, + "weight": 489, "cookies": false, "type": "", "demo": "sites\/update-variable.md", @@ -34498,7 +34736,7 @@ "x-appwrite": { "method": "deleteVariable", "group": "variables", - "weight": 506, + "weight": 490, "cookies": false, "type": "", "demo": "sites\/delete-variable.md", @@ -34570,7 +34808,7 @@ "x-appwrite": { "method": "listBuckets", "group": "buckets", - "weight": 146, + "weight": 522, "cookies": false, "type": "", "demo": "storage\/list-buckets.md", @@ -34656,7 +34894,7 @@ "x-appwrite": { "method": "createBucket", "group": "buckets", - "weight": 145, + "weight": 520, "cookies": false, "type": "", "demo": "storage\/create-bucket.md", @@ -34719,7 +34957,8 @@ "maximumFileSize": { "type": "integer", "description": "Maximum file size allowed in bytes. Maximum allowed value is 30MB.", - "x-example": 1 + "x-example": 1, + "format": "int32" }, "allowedFileExtensions": { "type": "array", @@ -34731,7 +34970,7 @@ }, "compression": { "type": "string", - "description": "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", + "description": "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", "x-example": "none", "enum": [ "none", @@ -34791,7 +35030,7 @@ "x-appwrite": { "method": "getBucket", "group": "buckets", - "weight": 147, + "weight": 521, "cookies": false, "type": "", "demo": "storage\/get-bucket.md", @@ -34852,7 +35091,7 @@ "x-appwrite": { "method": "updateBucket", "group": "buckets", - "weight": 148, + "weight": 523, "cookies": false, "type": "", "demo": "storage\/update-bucket.md", @@ -34922,7 +35161,8 @@ "maximumFileSize": { "type": "integer", "description": "Maximum file size allowed in bytes. Maximum allowed value is 30MB.", - "x-example": 1 + "x-example": 1, + "format": "int32" }, "allowedFileExtensions": { "type": "array", @@ -34934,7 +35174,7 @@ }, "compression": { "type": "string", - "description": "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", + "description": "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", "x-example": "none", "enum": [ "none", @@ -34984,7 +35224,7 @@ "x-appwrite": { "method": "deleteBucket", "group": "buckets", - "weight": 149, + "weight": 524, "cookies": false, "type": "", "demo": "storage\/delete-bucket.md", @@ -35047,7 +35287,7 @@ "x-appwrite": { "method": "listFiles", "group": "files", - "weight": 151, + "weight": 527, "cookies": false, "type": "", "demo": "storage\/list-files.md", @@ -35146,7 +35386,7 @@ "x-appwrite": { "method": "createFile", "group": "files", - "weight": 150, + "weight": 525, "cookies": false, "type": "upload", "demo": "storage\/create-file.md", @@ -35201,7 +35441,8 @@ "file": { "type": "string", "description": "Binary file. Appwrite SDKs provide helpers to handle file input. [Learn about file input](https:\/\/appwrite.io\/docs\/products\/storage\/upload-download#input-file).", - "x-example": null + "x-example": null, + "format": "binary" }, "permissions": { "type": "array", @@ -35247,7 +35488,7 @@ "x-appwrite": { "method": "getFile", "group": "files", - "weight": 152, + "weight": 526, "cookies": false, "type": "", "demo": "storage\/get-file.md", @@ -35321,13 +35562,13 @@ "x-appwrite": { "method": "updateFile", "group": "files", - "weight": 157, + "weight": 528, "cookies": false, "type": "", "demo": "storage\/update-file.md", - "rate-limit": 60, - "rate-time": 60, - "rate-key": "ip:{ip},method:{method},url:{url},userId:{userId}", + "rate-limit": 0, + "rate-time": 3600, + "rate-key": "url:{url},ip:{ip}", "scope": "files.write", "platforms": [ "console", @@ -35352,7 +35593,7 @@ "parameters": [ { "name": "bucketId", - "description": "Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https:\/\/appwrite.io\/docs\/server\/storage#createBucket).", + "description": "Bucket unique ID.", "required": true, "schema": { "type": "string", @@ -35362,7 +35603,7 @@ }, { "name": "fileId", - "description": "File unique ID.", + "description": "File ID.", "required": true, "schema": { "type": "string", @@ -35379,13 +35620,12 @@ "properties": { "name": { "type": "string", - "description": "Name of the file", - "x-example": "", - "x-nullable": true + "description": "File name.", + "x-example": "" }, "permissions": { "type": "array", - "description": "An array of permission string. By default, the current permissions are inherited. [Learn more about permissions](https:\/\/appwrite.io\/docs\/permissions).", + "description": "An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https:\/\/appwrite.io\/docs\/permissions).", "x-example": "[\"read(\"any\")\"]", "items": { "type": "string" @@ -35414,7 +35654,7 @@ "x-appwrite": { "method": "deleteFile", "group": "files", - "weight": 158, + "weight": 529, "cookies": false, "type": "", "demo": "storage\/delete-file.md", @@ -35483,7 +35723,7 @@ "x-appwrite": { "method": "getFileDownload", "group": "files", - "weight": 154, + "weight": 531, "cookies": false, "type": "location", "demo": "storage\/get-file-download.md", @@ -35563,7 +35803,7 @@ "x-appwrite": { "method": "getFilePreview", "group": "files", - "weight": 153, + "weight": 530, "cookies": false, "type": "location", "demo": "storage\/get-file-preview.md", @@ -35793,7 +36033,7 @@ "x-appwrite": { "method": "getFileView", "group": "files", - "weight": 155, + "weight": 532, "cookies": false, "type": "location", "demo": "storage\/get-file-view.md", @@ -35880,7 +36120,7 @@ "x-appwrite": { "method": "getUsage", "group": null, - "weight": 159, + "weight": 534, "cookies": false, "type": "", "demo": "storage\/get-usage.md", @@ -35953,7 +36193,7 @@ "x-appwrite": { "method": "getBucketUsage", "group": null, - "weight": 160, + "weight": 535, "cookies": false, "type": "", "demo": "storage\/get-bucket-usage.md", @@ -36036,7 +36276,7 @@ "x-appwrite": { "method": "list", "group": "tablesdb", - "weight": 386, + "weight": 344, "cookies": false, "type": "", "demo": "tablesdb\/list.md", @@ -36122,7 +36362,7 @@ "x-appwrite": { "method": "create", "group": "tablesdb", - "weight": 382, + "weight": 340, "cookies": false, "type": "", "demo": "tablesdb\/create.md", @@ -36203,7 +36443,7 @@ "x-appwrite": { "method": "listTransactions", "group": "transactions", - "weight": 445, + "weight": 403, "cookies": false, "type": "", "demo": "tablesdb\/list-transactions.md", @@ -36273,7 +36513,7 @@ "x-appwrite": { "method": "createTransaction", "group": "transactions", - "weight": 441, + "weight": 399, "cookies": false, "type": "", "demo": "tablesdb\/create-transaction.md", @@ -36313,7 +36553,8 @@ "ttl": { "type": "integer", "description": "Seconds before the transaction expires.", - "x-example": 60 + "x-example": 60, + "format": "int32" } } } @@ -36346,7 +36587,7 @@ "x-appwrite": { "method": "getTransaction", "group": "transactions", - "weight": 442, + "weight": 400, "cookies": false, "type": "", "demo": "tablesdb\/get-transaction.md", @@ -36413,7 +36654,7 @@ "x-appwrite": { "method": "updateTransaction", "group": "transactions", - "weight": 443, + "weight": 401, "cookies": false, "type": "", "demo": "tablesdb\/update-transaction.md", @@ -36494,7 +36735,7 @@ "x-appwrite": { "method": "deleteTransaction", "group": "transactions", - "weight": 444, + "weight": 402, "cookies": false, "type": "", "demo": "tablesdb\/delete-transaction.md", @@ -36563,7 +36804,7 @@ "x-appwrite": { "method": "createOperations", "group": "transactions", - "weight": 446, + "weight": 404, "cookies": false, "type": "", "demo": "tablesdb\/create-operations.md", @@ -36651,7 +36892,7 @@ "x-appwrite": { "method": "listUsage", "group": null, - "weight": 388, + "weight": 346, "cookies": false, "type": "", "demo": "tablesdb\/list-usage.md", @@ -36750,7 +36991,7 @@ "x-appwrite": { "method": "get", "group": "tablesdb", - "weight": 383, + "weight": 341, "cookies": false, "type": "", "demo": "tablesdb\/get.md", @@ -36811,7 +37052,7 @@ "x-appwrite": { "method": "update", "group": "tablesdb", - "weight": 384, + "weight": 342, "cookies": false, "type": "", "demo": "tablesdb\/update.md", @@ -36864,10 +37105,7 @@ "description": "Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled.", "x-example": false } - }, - "required": [ - "name" - ] + } } } } @@ -36889,7 +37127,7 @@ "x-appwrite": { "method": "delete", "group": "tablesdb", - "weight": 385, + "weight": 343, "cookies": false, "type": "", "demo": "tablesdb\/delete.md", @@ -36952,7 +37190,7 @@ "x-appwrite": { "method": "listTables", "group": "tables", - "weight": 393, + "weight": 351, "cookies": false, "type": "", "demo": "tablesdb\/list-tables.md", @@ -37051,7 +37289,7 @@ "x-appwrite": { "method": "createTable", "group": "tables", - "weight": 389, + "weight": 347, "cookies": false, "type": "", "demo": "tablesdb\/create-table.md", @@ -37177,7 +37415,7 @@ "x-appwrite": { "method": "getTable", "group": "tables", - "weight": 390, + "weight": 348, "cookies": false, "type": "", "demo": "tablesdb\/get-table.md", @@ -37251,7 +37489,7 @@ "x-appwrite": { "method": "updateTable", "group": "tables", - "weight": 391, + "weight": 349, "cookies": false, "type": "", "demo": "tablesdb\/update-table.md", @@ -37331,10 +37569,7 @@ "description": "Is table enabled? When set to 'disabled', users cannot access the table but Server SDKs with and API key can still read and write to the table. No data is lost when this is toggled.", "x-example": false } - }, - "required": [ - "name" - ] + } } } } @@ -37356,7 +37591,7 @@ "x-appwrite": { "method": "deleteTable", "group": "tables", - "weight": 392, + "weight": 350, "cookies": false, "type": "", "demo": "tablesdb\/delete-table.md", @@ -37432,7 +37667,7 @@ "x-appwrite": { "method": "listColumns", "group": "columns", - "weight": 398, + "weight": 356, "cookies": false, "type": "", "demo": "tablesdb\/list-columns.md", @@ -37532,7 +37767,7 @@ "x-appwrite": { "method": "createBooleanColumn", "group": "columns", - "weight": 399, + "weight": 357, "cookies": false, "type": "", "demo": "tablesdb\/create-boolean-column.md", @@ -37644,7 +37879,7 @@ "x-appwrite": { "method": "updateBooleanColumn", "group": "columns", - "weight": 400, + "weight": 358, "cookies": false, "type": "", "demo": "tablesdb\/update-boolean-column.md", @@ -37761,7 +37996,7 @@ "x-appwrite": { "method": "createDatetimeColumn", "group": "columns", - "weight": 401, + "weight": 359, "cookies": false, "type": "", "demo": "tablesdb\/create-datetime-column.md", @@ -37873,7 +38108,7 @@ "x-appwrite": { "method": "updateDatetimeColumn", "group": "columns", - "weight": 402, + "weight": 360, "cookies": false, "type": "", "demo": "tablesdb\/update-datetime-column.md", @@ -37990,7 +38225,7 @@ "x-appwrite": { "method": "createEmailColumn", "group": "columns", - "weight": 403, + "weight": 361, "cookies": false, "type": "", "demo": "tablesdb\/create-email-column.md", @@ -38060,6 +38295,7 @@ "type": "string", "description": "Default value for column when not provided. Cannot be set when column is required.", "x-example": "email@example.com", + "format": "email", "x-nullable": true }, "array": { @@ -38102,7 +38338,7 @@ "x-appwrite": { "method": "updateEmailColumn", "group": "columns", - "weight": 404, + "weight": 362, "cookies": false, "type": "", "demo": "tablesdb\/update-email-column.md", @@ -38176,6 +38412,7 @@ "type": "string", "description": "Default value for column when not provided. Cannot be set when column is required.", "x-example": "email@example.com", + "format": "email", "x-nullable": true }, "newKey": { @@ -38219,7 +38456,7 @@ "x-appwrite": { "method": "createEnumColumn", "group": "columns", - "weight": 405, + "weight": 363, "cookies": false, "type": "", "demo": "tablesdb\/create-enum-column.md", @@ -38340,7 +38577,7 @@ "x-appwrite": { "method": "updateEnumColumn", "group": "columns", - "weight": 406, + "weight": 364, "cookies": false, "type": "", "demo": "tablesdb\/update-enum-column.md", @@ -38466,7 +38703,7 @@ "x-appwrite": { "method": "createFloatColumn", "group": "columns", - "weight": 407, + "weight": 365, "cookies": false, "type": "", "demo": "tablesdb\/create-float-column.md", @@ -38536,18 +38773,21 @@ "type": "number", "description": "Minimum value", "x-example": null, + "format": "float", "x-nullable": true }, "max": { "type": "number", "description": "Maximum value", "x-example": null, + "format": "float", "x-nullable": true }, "default": { "type": "number", "description": "Default value. Cannot be set when required.", "x-example": null, + "format": "float", "x-nullable": true }, "array": { @@ -38590,7 +38830,7 @@ "x-appwrite": { "method": "updateFloatColumn", "group": "columns", - "weight": 408, + "weight": 366, "cookies": false, "type": "", "demo": "tablesdb\/update-float-column.md", @@ -38664,18 +38904,21 @@ "type": "number", "description": "Minimum value", "x-example": null, + "format": "float", "x-nullable": true }, "max": { "type": "number", "description": "Maximum value", "x-example": null, + "format": "float", "x-nullable": true }, "default": { "type": "number", "description": "Default value. Cannot be set when required.", "x-example": null, + "format": "float", "x-nullable": true }, "newKey": { @@ -38719,7 +38962,7 @@ "x-appwrite": { "method": "createIntegerColumn", "group": "columns", - "weight": 409, + "weight": 367, "cookies": false, "type": "", "demo": "tablesdb\/create-integer-column.md", @@ -38789,18 +39032,21 @@ "type": "integer", "description": "Minimum value", "x-example": null, + "format": "int64", "x-nullable": true }, "max": { "type": "integer", "description": "Maximum value", "x-example": null, + "format": "int64", "x-nullable": true }, "default": { "type": "integer", "description": "Default value. Cannot be set when column is required.", "x-example": null, + "format": "int64", "x-nullable": true }, "array": { @@ -38843,7 +39089,7 @@ "x-appwrite": { "method": "updateIntegerColumn", "group": "columns", - "weight": 410, + "weight": 368, "cookies": false, "type": "", "demo": "tablesdb\/update-integer-column.md", @@ -38917,18 +39163,21 @@ "type": "integer", "description": "Minimum value", "x-example": null, + "format": "int64", "x-nullable": true }, "max": { "type": "integer", "description": "Maximum value", "x-example": null, + "format": "int64", "x-nullable": true }, "default": { "type": "integer", "description": "Default value. Cannot be set when column is required.", "x-example": null, + "format": "int64", "x-nullable": true }, "newKey": { @@ -38972,7 +39221,7 @@ "x-appwrite": { "method": "createIpColumn", "group": "columns", - "weight": 411, + "weight": 369, "cookies": false, "type": "", "demo": "tablesdb\/create-ip-column.md", @@ -39084,7 +39333,7 @@ "x-appwrite": { "method": "updateIpColumn", "group": "columns", - "weight": 412, + "weight": 370, "cookies": false, "type": "", "demo": "tablesdb\/update-ip-column.md", @@ -39201,7 +39450,7 @@ "x-appwrite": { "method": "createLineColumn", "group": "columns", - "weight": 413, + "weight": 371, "cookies": false, "type": "", "demo": "tablesdb\/create-line-column.md", @@ -39315,7 +39564,7 @@ "x-appwrite": { "method": "updateLineColumn", "group": "columns", - "weight": 414, + "weight": 372, "cookies": false, "type": "", "demo": "tablesdb\/update-line-column.md", @@ -39438,7 +39687,7 @@ "x-appwrite": { "method": "createPointColumn", "group": "columns", - "weight": 415, + "weight": 373, "cookies": false, "type": "", "demo": "tablesdb\/create-point-column.md", @@ -39552,7 +39801,7 @@ "x-appwrite": { "method": "updatePointColumn", "group": "columns", - "weight": 416, + "weight": 374, "cookies": false, "type": "", "demo": "tablesdb\/update-point-column.md", @@ -39675,7 +39924,7 @@ "x-appwrite": { "method": "createPolygonColumn", "group": "columns", - "weight": 417, + "weight": 375, "cookies": false, "type": "", "demo": "tablesdb\/create-polygon-column.md", @@ -39789,7 +40038,7 @@ "x-appwrite": { "method": "updatePolygonColumn", "group": "columns", - "weight": 418, + "weight": 376, "cookies": false, "type": "", "demo": "tablesdb\/update-polygon-column.md", @@ -39912,7 +40161,7 @@ "x-appwrite": { "method": "createRelationshipColumn", "group": "columns", - "weight": 419, + "weight": 377, "cookies": false, "type": "", "demo": "tablesdb\/create-relationship-column.md", @@ -40050,7 +40299,7 @@ "x-appwrite": { "method": "createStringColumn", "group": "columns", - "weight": 421, + "weight": 379, "cookies": false, "type": "", "demo": "tablesdb\/create-string-column.md", @@ -40114,7 +40363,8 @@ "size": { "type": "integer", "description": "Column size for text columns, in number of characters.", - "x-example": 1 + "x-example": 1, + "format": "int32" }, "required": { "type": "boolean", @@ -40173,7 +40423,7 @@ "x-appwrite": { "method": "updateStringColumn", "group": "columns", - "weight": 422, + "weight": 380, "cookies": false, "type": "", "demo": "tablesdb\/update-string-column.md", @@ -40253,6 +40503,7 @@ "type": "integer", "description": "Maximum size of the string column.", "x-example": 1, + "format": "int32", "x-nullable": true }, "newKey": { @@ -40296,7 +40547,7 @@ "x-appwrite": { "method": "createUrlColumn", "group": "columns", - "weight": 423, + "weight": 381, "cookies": false, "type": "", "demo": "tablesdb\/create-url-column.md", @@ -40366,6 +40617,7 @@ "type": "string", "description": "Default value for column when not provided. Cannot be set when column is required.", "x-example": "https:\/\/example.com", + "format": "url", "x-nullable": true }, "array": { @@ -40408,7 +40660,7 @@ "x-appwrite": { "method": "updateUrlColumn", "group": "columns", - "weight": 424, + "weight": 382, "cookies": false, "type": "", "demo": "tablesdb\/update-url-column.md", @@ -40482,6 +40734,7 @@ "type": "string", "description": "Default value for column when not provided. Cannot be set when column is required.", "x-example": "https:\/\/example.com", + "format": "url", "x-nullable": true }, "newKey": { @@ -40556,7 +40809,7 @@ "x-appwrite": { "method": "getColumn", "group": "columns", - "weight": 396, + "weight": 354, "cookies": false, "type": "", "demo": "tablesdb\/get-column.md", @@ -40632,7 +40885,7 @@ "x-appwrite": { "method": "deleteColumn", "group": "columns", - "weight": 397, + "weight": 355, "cookies": false, "type": "", "demo": "tablesdb\/delete-column.md", @@ -40717,7 +40970,7 @@ "x-appwrite": { "method": "updateRelationshipColumn", "group": "columns", - "weight": 420, + "weight": 378, "cookies": false, "type": "", "demo": "tablesdb\/update-relationship-column.md", @@ -40832,7 +41085,7 @@ "x-appwrite": { "method": "listIndexes", "group": "indexes", - "weight": 428, + "weight": 386, "cookies": false, "type": "", "demo": "tablesdb\/list-indexes.md", @@ -40930,7 +41183,7 @@ "x-appwrite": { "method": "createIndex", "group": "indexes", - "weight": 425, + "weight": 383, "cookies": false, "type": "", "demo": "tablesdb\/create-index.md", @@ -41070,7 +41323,7 @@ "x-appwrite": { "method": "getIndex", "group": "indexes", - "weight": 426, + "weight": 384, "cookies": false, "type": "", "demo": "tablesdb\/get-index.md", @@ -41146,7 +41399,7 @@ "x-appwrite": { "method": "deleteIndex", "group": "indexes", - "weight": 427, + "weight": 385, "cookies": false, "type": "", "demo": "tablesdb\/delete-index.md", @@ -41231,7 +41484,7 @@ "x-appwrite": { "method": "listTableLogs", "group": "tables", - "weight": 394, + "weight": 352, "cookies": false, "type": "", "demo": "tablesdb\/list-table-logs.md", @@ -41318,7 +41571,7 @@ "x-appwrite": { "method": "listRows", "group": "rows", - "weight": 437, + "weight": 395, "cookies": false, "type": "", "demo": "tablesdb\/list-rows.md", @@ -41429,7 +41682,7 @@ "x-appwrite": { "method": "createRow", "group": "rows", - "weight": 429, + "weight": 387, "cookies": false, "type": "", "demo": "tablesdb\/create-row.md", @@ -41611,7 +41864,7 @@ "x-appwrite": { "method": "upsertRows", "group": "rows", - "weight": 434, + "weight": 392, "cookies": false, "type": "", "demo": "tablesdb\/upsert-rows.md", @@ -41743,7 +41996,7 @@ "x-appwrite": { "method": "updateRows", "group": "rows", - "weight": 432, + "weight": 390, "cookies": false, "type": "", "demo": "tablesdb\/update-rows.md", @@ -41847,7 +42100,7 @@ "x-appwrite": { "method": "deleteRows", "group": "rows", - "weight": 436, + "weight": 394, "cookies": false, "type": "", "demo": "tablesdb\/delete-rows.md", @@ -41948,7 +42201,7 @@ "x-appwrite": { "method": "getRow", "group": "rows", - "weight": 430, + "weight": 388, "cookies": false, "type": "", "demo": "tablesdb\/get-row.md", @@ -42058,7 +42311,7 @@ "x-appwrite": { "method": "upsertRow", "group": "rows", - "weight": 433, + "weight": 391, "cookies": false, "type": "", "demo": "tablesdb\/upsert-row.md", @@ -42208,7 +42461,7 @@ "x-appwrite": { "method": "updateRow", "group": "rows", - "weight": 431, + "weight": 389, "cookies": false, "type": "", "demo": "tablesdb\/update-row.md", @@ -42319,7 +42572,7 @@ "x-appwrite": { "method": "deleteRow", "group": "rows", - "weight": 435, + "weight": 393, "cookies": false, "type": "", "demo": "tablesdb\/delete-row.md", @@ -42425,7 +42678,7 @@ "x-appwrite": { "method": "listRowLogs", "group": "logs", - "weight": 438, + "weight": 396, "cookies": false, "type": "", "demo": "tablesdb\/list-row-logs.md", @@ -42522,7 +42775,7 @@ "x-appwrite": { "method": "decrementRowColumn", "group": "rows", - "weight": 440, + "weight": 398, "cookies": false, "type": "", "demo": "tablesdb\/decrement-row-column.md", @@ -42603,12 +42856,14 @@ "value": { "type": "number", "description": "Value to increment the column by. The value must be a number.", - "x-example": null + "x-example": null, + "format": "float" }, "min": { "type": "number", "description": "Minimum value for the column. If the current value is lesser than this value, an exception will be thrown.", "x-example": null, + "format": "float", "x-nullable": true }, "transactionId": { @@ -42648,7 +42903,7 @@ "x-appwrite": { "method": "incrementRowColumn", "group": "rows", - "weight": 439, + "weight": 397, "cookies": false, "type": "", "demo": "tablesdb\/increment-row-column.md", @@ -42729,12 +42984,14 @@ "value": { "type": "number", "description": "Value to increment the column by. The value must be a number.", - "x-example": null + "x-example": null, + "format": "float" }, "max": { "type": "number", "description": "Maximum value for the column. If the current value is greater than this value, an error will be thrown.", "x-example": null, + "format": "float", "x-nullable": true }, "transactionId": { @@ -42774,7 +43031,7 @@ "x-appwrite": { "method": "getTableUsage", "group": null, - "weight": 395, + "weight": 353, "cookies": false, "type": "", "demo": "tablesdb\/get-table-usage.md", @@ -42870,7 +43127,7 @@ "x-appwrite": { "method": "getUsage", "group": null, - "weight": 387, + "weight": 345, "cookies": false, "type": "", "demo": "tablesdb\/get-usage.md", @@ -42982,7 +43239,7 @@ "x-appwrite": { "method": "list", "group": "teams", - "weight": 162, + "weight": 110, "cookies": false, "type": "", "demo": "teams\/list.md", @@ -43071,7 +43328,7 @@ "x-appwrite": { "method": "create", "group": "teams", - "weight": 161, + "weight": 109, "cookies": false, "type": "", "demo": "teams\/create.md", @@ -43158,7 +43415,7 @@ "x-appwrite": { "method": "get", "group": "teams", - "weight": 163, + "weight": 111, "cookies": false, "type": "", "demo": "teams\/get.md", @@ -43222,7 +43479,7 @@ "x-appwrite": { "method": "updateName", "group": "teams", - "weight": 165, + "weight": 113, "cookies": false, "type": "", "demo": "teams\/update-name.md", @@ -43298,7 +43555,7 @@ "x-appwrite": { "method": "delete", "group": "teams", - "weight": 167, + "weight": 115, "cookies": false, "type": "", "demo": "teams\/delete.md", @@ -43364,7 +43621,7 @@ "x-appwrite": { "method": "listLogs", "group": "logs", - "weight": 174, + "weight": 122, "cookies": false, "type": "", "demo": "teams\/list-logs.md", @@ -43449,7 +43706,7 @@ "x-appwrite": { "method": "listMemberships", "group": "memberships", - "weight": 169, + "weight": 117, "cookies": false, "type": "", "demo": "teams\/list-memberships.md", @@ -43548,7 +43805,7 @@ "x-appwrite": { "method": "createMembership", "group": "memberships", - "weight": 168, + "weight": 116, "cookies": false, "type": "", "demo": "teams\/create-membership.md", @@ -43597,7 +43854,8 @@ "email": { "type": "string", "description": "Email of the new team member.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "userId": { "type": "string", @@ -43607,7 +43865,8 @@ "phone": { "type": "string", "description": "Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "roles": { "type": "array", @@ -43627,7 +43886,8 @@ "url": { "type": "string", "description": "URL to redirect the user back to your app from the invitation email. This parameter is not required when an API key is supplied. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.", - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" }, "name": { "type": "string", @@ -43668,7 +43928,7 @@ "x-appwrite": { "method": "getMembership", "group": "memberships", - "weight": 170, + "weight": 118, "cookies": false, "type": "", "demo": "teams\/get-membership.md", @@ -43742,7 +44002,7 @@ "x-appwrite": { "method": "updateMembership", "group": "memberships", - "weight": 171, + "weight": 119, "cookies": false, "type": "", "demo": "teams\/update-membership.md", @@ -43838,7 +44098,7 @@ "x-appwrite": { "method": "deleteMembership", "group": "memberships", - "weight": 173, + "weight": 121, "cookies": false, "type": "", "demo": "teams\/delete-membership.md", @@ -43914,7 +44174,7 @@ "x-appwrite": { "method": "updateMembershipStatus", "group": "memberships", - "weight": 172, + "weight": 120, "cookies": false, "type": "", "demo": "teams\/update-membership-status.md", @@ -44013,7 +44273,7 @@ "x-appwrite": { "method": "getPrefs", "group": "teams", - "weight": 164, + "weight": 112, "cookies": false, "type": "", "demo": "teams\/get-prefs.md", @@ -44075,7 +44335,7 @@ "x-appwrite": { "method": "updatePrefs", "group": "teams", - "weight": 166, + "weight": 114, "cookies": false, "type": "", "demo": "teams\/update-prefs.md", @@ -44158,7 +44418,7 @@ "x-appwrite": { "method": "list", "group": "files", - "weight": 523, + "weight": 517, "cookies": false, "type": "", "demo": "tokens\/list.md", @@ -44252,7 +44512,7 @@ "x-appwrite": { "method": "createFileToken", "group": "files", - "weight": 521, + "weight": 515, "cookies": false, "type": "", "demo": "tokens\/create-file-token.md", @@ -44341,7 +44601,7 @@ "x-appwrite": { "method": "get", "group": "tokens", - "weight": 522, + "weight": 516, "cookies": false, "type": "", "demo": "tokens\/get.md", @@ -44401,7 +44661,7 @@ "x-appwrite": { "method": "update", "group": "tokens", - "weight": 524, + "weight": 518, "cookies": false, "type": "", "demo": "tokens\/update.md", @@ -44471,7 +44731,7 @@ "x-appwrite": { "method": "delete", "group": "tokens", - "weight": 525, + "weight": 519, "cookies": false, "type": "", "demo": "tokens\/delete.md", @@ -44533,7 +44793,7 @@ "x-appwrite": { "method": "list", "group": "users", - "weight": 184, + "weight": 132, "cookies": false, "type": "", "demo": "users\/list.md", @@ -44619,7 +44879,7 @@ "x-appwrite": { "method": "create", "group": "users", - "weight": 175, + "weight": 123, "cookies": false, "type": "", "demo": "users\/create.md", @@ -44659,12 +44919,14 @@ "type": "string", "description": "User email.", "x-example": "email@example.com", + "format": "email", "x-nullable": true }, "phone": { "type": "string", "description": "Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", "x-example": "+12065550100", + "format": "phone", "x-nullable": true }, "password": { @@ -44711,7 +44973,7 @@ "x-appwrite": { "method": "createArgon2User", "group": "users", - "weight": 178, + "weight": 126, "cookies": false, "type": "", "demo": "users\/create-argon-2-user.md", @@ -44750,12 +45012,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using Argon2.", - "x-example": "password" + "x-example": "password", + "format": "password" }, "name": { "type": "string", @@ -44798,7 +45062,7 @@ "x-appwrite": { "method": "createBcryptUser", "group": "users", - "weight": 176, + "weight": 124, "cookies": false, "type": "", "demo": "users\/create-bcrypt-user.md", @@ -44837,12 +45101,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using Bcrypt.", - "x-example": "password" + "x-example": "password", + "format": "password" }, "name": { "type": "string", @@ -44885,7 +45151,7 @@ "x-appwrite": { "method": "listIdentities", "group": "identities", - "weight": 192, + "weight": 140, "cookies": false, "type": "", "demo": "users\/list-identities.md", @@ -44966,7 +45232,7 @@ "x-appwrite": { "method": "deleteIdentity", "group": "identities", - "weight": 215, + "weight": 163, "cookies": false, "type": "", "demo": "users\/delete-identity.md", @@ -45029,7 +45295,7 @@ "x-appwrite": { "method": "createMD5User", "group": "users", - "weight": 177, + "weight": 125, "cookies": false, "type": "", "demo": "users\/create-md-5-user.md", @@ -45068,12 +45334,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using MD5.", - "x-example": "password" + "x-example": "password", + "format": "password" }, "name": { "type": "string", @@ -45116,7 +45384,7 @@ "x-appwrite": { "method": "createPHPassUser", "group": "users", - "weight": 180, + "weight": 128, "cookies": false, "type": "", "demo": "users\/create-ph-pass-user.md", @@ -45155,12 +45423,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using PHPass.", - "x-example": "password" + "x-example": "password", + "format": "password" }, "name": { "type": "string", @@ -45203,7 +45473,7 @@ "x-appwrite": { "method": "createScryptUser", "group": "users", - "weight": 181, + "weight": 129, "cookies": false, "type": "", "demo": "users\/create-scrypt-user.md", @@ -45242,12 +45512,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using Scrypt.", - "x-example": "password" + "x-example": "password", + "format": "password" }, "passwordSalt": { "type": "string", @@ -45257,22 +45529,26 @@ "passwordCpu": { "type": "integer", "description": "Optional CPU cost used to hash password.", - "x-example": null + "x-example": null, + "format": "int32" }, "passwordMemory": { "type": "integer", "description": "Optional memory cost used to hash password.", - "x-example": null + "x-example": null, + "format": "int32" }, "passwordParallel": { "type": "integer", "description": "Optional parallelization cost used to hash password.", - "x-example": null + "x-example": null, + "format": "int32" }, "passwordLength": { "type": "integer", "description": "Optional hash length used to hash password.", - "x-example": null + "x-example": null, + "format": "int32" }, "name": { "type": "string", @@ -45320,7 +45596,7 @@ "x-appwrite": { "method": "createScryptModifiedUser", "group": "users", - "weight": 182, + "weight": 130, "cookies": false, "type": "", "demo": "users\/create-scrypt-modified-user.md", @@ -45359,12 +45635,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using Scrypt Modified.", - "x-example": "password" + "x-example": "password", + "format": "password" }, "passwordSalt": { "type": "string", @@ -45425,7 +45703,7 @@ "x-appwrite": { "method": "createSHAUser", "group": "users", - "weight": 179, + "weight": 127, "cookies": false, "type": "", "demo": "users\/create-sha-user.md", @@ -45464,12 +45742,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using SHA.", - "x-example": "password" + "x-example": "password", + "format": "password" }, "passwordVersion": { "type": "string", @@ -45532,7 +45812,7 @@ "x-appwrite": { "method": "getUsage", "group": null, - "weight": 217, + "weight": 165, "cookies": false, "type": "", "demo": "users\/get-usage.md", @@ -45605,7 +45885,7 @@ "x-appwrite": { "method": "get", "group": "users", - "weight": 185, + "weight": 133, "cookies": false, "type": "", "demo": "users\/get.md", @@ -45659,7 +45939,7 @@ "x-appwrite": { "method": "delete", "group": "users", - "weight": 213, + "weight": 161, "cookies": false, "type": "", "demo": "users\/delete.md", @@ -45722,7 +46002,7 @@ "x-appwrite": { "method": "updateEmail", "group": "users", - "weight": 198, + "weight": 146, "cookies": false, "type": "", "demo": "users\/update-email.md", @@ -45768,7 +46048,8 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" } }, "required": [ @@ -45804,7 +46085,7 @@ "x-appwrite": { "method": "createJWT", "group": "sessions", - "weight": 216, + "weight": 164, "cookies": false, "type": "", "demo": "users\/create-jwt.md", @@ -45855,7 +46136,8 @@ "duration": { "type": "integer", "description": "Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds.", - "x-example": 0 + "x-example": 0, + "format": "int32" } } } @@ -45888,7 +46170,7 @@ "x-appwrite": { "method": "updateLabels", "group": "users", - "weight": 194, + "weight": 142, "cookies": false, "type": "", "demo": "users\/update-labels.md", @@ -45973,7 +46255,7 @@ "x-appwrite": { "method": "listLogs", "group": "logs", - "weight": 190, + "weight": 138, "cookies": false, "type": "", "demo": "users\/list-logs.md", @@ -46060,7 +46342,7 @@ "x-appwrite": { "method": "listMemberships", "group": "memberships", - "weight": 189, + "weight": 137, "cookies": false, "type": "", "demo": "users\/list-memberships.md", @@ -46158,7 +46440,7 @@ "x-appwrite": { "method": "updateMfa", "group": "users", - "weight": 203, + "weight": 151, "cookies": false, "type": "", "demo": "users\/update-mfa.md", @@ -46293,7 +46575,7 @@ "x-appwrite": { "method": "deleteMfaAuthenticator", "group": "mfa", - "weight": 208, + "weight": 156, "cookies": false, "type": "", "demo": "users\/delete-mfa-authenticator.md", @@ -46429,7 +46711,7 @@ "x-appwrite": { "method": "listMfaFactors", "group": "mfa", - "weight": 204, + "weight": 152, "cookies": false, "type": "", "demo": "users\/list-mfa-factors.md", @@ -46548,7 +46830,7 @@ "x-appwrite": { "method": "getMfaRecoveryCodes", "group": "mfa", - "weight": 205, + "weight": 153, "cookies": false, "type": "", "demo": "users\/get-mfa-recovery-codes.md", @@ -46665,7 +46947,7 @@ "x-appwrite": { "method": "updateMfaRecoveryCodes", "group": "mfa", - "weight": 207, + "weight": 155, "cookies": false, "type": "", "demo": "users\/update-mfa-recovery-codes.md", @@ -46782,7 +47064,7 @@ "x-appwrite": { "method": "createMfaRecoveryCodes", "group": "mfa", - "weight": 206, + "weight": 154, "cookies": false, "type": "", "demo": "users\/create-mfa-recovery-codes.md", @@ -46901,7 +47183,7 @@ "x-appwrite": { "method": "updateName", "group": "users", - "weight": 196, + "weight": 144, "cookies": false, "type": "", "demo": "users\/update-name.md", @@ -46983,7 +47265,7 @@ "x-appwrite": { "method": "updatePassword", "group": "users", - "weight": 197, + "weight": 145, "cookies": false, "type": "", "demo": "users\/update-password.md", @@ -47065,7 +47347,7 @@ "x-appwrite": { "method": "updatePhone", "group": "users", - "weight": 199, + "weight": 147, "cookies": false, "type": "", "demo": "users\/update-phone.md", @@ -47111,7 +47393,8 @@ "number": { "type": "string", "description": "User phone number.", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" } }, "required": [ @@ -47147,7 +47430,7 @@ "x-appwrite": { "method": "getPrefs", "group": "users", - "weight": 186, + "weight": 134, "cookies": false, "type": "", "demo": "users\/get-prefs.md", @@ -47208,7 +47491,7 @@ "x-appwrite": { "method": "updatePrefs", "group": "users", - "weight": 201, + "weight": 149, "cookies": false, "type": "", "demo": "users\/update-prefs.md", @@ -47290,7 +47573,7 @@ "x-appwrite": { "method": "listSessions", "group": "sessions", - "weight": 188, + "weight": 136, "cookies": false, "type": "", "demo": "users\/list-sessions.md", @@ -47362,7 +47645,7 @@ "x-appwrite": { "method": "createSession", "group": "sessions", - "weight": 209, + "weight": 157, "cookies": false, "type": "", "demo": "users\/create-session.md", @@ -47416,7 +47699,7 @@ "x-appwrite": { "method": "deleteSessions", "group": "sessions", - "weight": 212, + "weight": 160, "cookies": false, "type": "", "demo": "users\/delete-sessions.md", @@ -47472,7 +47755,7 @@ "x-appwrite": { "method": "deleteSession", "group": "sessions", - "weight": 211, + "weight": 159, "cookies": false, "type": "", "demo": "users\/delete-session.md", @@ -47545,7 +47828,7 @@ "x-appwrite": { "method": "updateStatus", "group": "users", - "weight": 193, + "weight": 141, "cookies": false, "type": "", "demo": "users\/update-status.md", @@ -47627,7 +47910,7 @@ "x-appwrite": { "method": "listTargets", "group": "targets", - "weight": 191, + "weight": 139, "cookies": false, "type": "", "demo": "users\/list-targets.md", @@ -47712,7 +47995,7 @@ "x-appwrite": { "method": "createTarget", "group": "targets", - "weight": 183, + "weight": 131, "cookies": false, "type": "", "demo": "users\/create-target.md", @@ -47823,7 +48106,7 @@ "x-appwrite": { "method": "getTarget", "group": "targets", - "weight": 187, + "weight": 135, "cookies": false, "type": "", "demo": "users\/get-target.md", @@ -47894,7 +48177,7 @@ "x-appwrite": { "method": "updateTarget", "group": "targets", - "weight": 202, + "weight": 150, "cookies": false, "type": "", "demo": "users\/update-target.md", @@ -47984,7 +48267,7 @@ "x-appwrite": { "method": "deleteTarget", "group": "targets", - "weight": 214, + "weight": 162, "cookies": false, "type": "", "demo": "users\/delete-target.md", @@ -48057,7 +48340,7 @@ "x-appwrite": { "method": "createToken", "group": "sessions", - "weight": 210, + "weight": 158, "cookies": false, "type": "", "demo": "users\/create-token.md", @@ -48103,12 +48386,14 @@ "length": { "type": "integer", "description": "Token length in characters. The default length is 6 characters", - "x-example": 4 + "x-example": 4, + "format": "int32" }, "expire": { "type": "integer", "description": "Token expiration period in seconds. The default expiration is 15 minutes.", - "x-example": 60 + "x-example": 60, + "format": "int32" } } } @@ -48141,7 +48426,7 @@ "x-appwrite": { "method": "updateEmailVerification", "group": "users", - "weight": 200, + "weight": 148, "cookies": false, "type": "", "demo": "users\/update-email-verification.md", @@ -48223,7 +48508,7 @@ "x-appwrite": { "method": "updatePhoneVerification", "group": "users", - "weight": 195, + "weight": 143, "cookies": false, "type": "", "demo": "users\/update-phone-verification.md", @@ -48305,7 +48590,7 @@ "x-appwrite": { "method": "createRepositoryDetection", "group": "repositories", - "weight": 221, + "weight": 169, "cookies": false, "type": "", "demo": "vcs\/create-repository-detection.md", @@ -48402,7 +48687,7 @@ "x-appwrite": { "method": "listRepositories", "group": "repositories", - "weight": 222, + "weight": 170, "cookies": false, "type": "", "demo": "vcs\/list-repositories.md", @@ -48501,7 +48786,7 @@ "x-appwrite": { "method": "createRepository", "group": "repositories", - "weight": 223, + "weight": 171, "cookies": false, "type": "", "demo": "vcs\/create-repository.md", @@ -48587,7 +48872,7 @@ "x-appwrite": { "method": "getRepository", "group": "repositories", - "weight": 224, + "weight": 172, "cookies": false, "type": "", "demo": "vcs\/get-repository.md", @@ -48658,7 +48943,7 @@ "x-appwrite": { "method": "listRepositoryBranches", "group": "repositories", - "weight": 225, + "weight": 173, "cookies": false, "type": "", "demo": "vcs\/list-repository-branches.md", @@ -48729,7 +49014,7 @@ "x-appwrite": { "method": "getRepositoryContents", "group": "repositories", - "weight": 220, + "weight": 168, "cookies": false, "type": "", "demo": "vcs\/get-repository-contents.md", @@ -48815,7 +49100,7 @@ "x-appwrite": { "method": "updateExternalDeployments", "group": "repositories", - "weight": 230, + "weight": 178, "cookies": false, "type": "", "demo": "vcs\/update-external-deployments.md", @@ -48905,7 +49190,7 @@ "x-appwrite": { "method": "listInstallations", "group": "installations", - "weight": 227, + "weight": 175, "cookies": false, "type": "", "demo": "vcs\/list-installations.md", @@ -48991,7 +49276,7 @@ "x-appwrite": { "method": "getInstallation", "group": "installations", - "weight": 228, + "weight": 176, "cookies": false, "type": "", "demo": "vcs\/get-installation.md", @@ -49043,7 +49328,7 @@ "x-appwrite": { "method": "deleteInstallation", "group": "installations", - "weight": 229, + "weight": 177, "cookies": false, "type": "", "demo": "vcs\/delete-installation.md", @@ -49144,7 +49429,7 @@ }, { "name": "console", - "description": "The Console service allows you to interact with console relevant informations." + "description": "The Console service allows you to interact with console relevant information." }, { "name": "migrations", @@ -50293,6 +50578,34 @@ "variables": "" } }, + "healthStatusList": { + "description": "Status List", + "type": "object", + "properties": { + "total": { + "type": "integer", + "description": "Total number of statuses that matched your query.", + "x-example": 5, + "format": "int32" + }, + "statuses": { + "type": "array", + "description": "List of statuses.", + "items": { + "$ref": "#\/components\/schemas\/healthStatus" + }, + "x-example": "" + } + }, + "required": [ + "total", + "statuses" + ], + "example": { + "total": 5, + "statuses": "" + } + }, "proxyRuleList": { "description": "Rule List", "type": "object", @@ -51011,14 +51324,14 @@ "type": "integer", "description": "Minimum value to enforce for new documents.", "x-example": 1, - "format": "int32", + "format": "int64", "nullable": true }, "max": { "type": "integer", "description": "Maximum value to enforce for new documents.", "x-example": 10, - "format": "int32", + "format": "int64", "nullable": true }, "default": { @@ -52460,14 +52773,14 @@ "type": "integer", "description": "Minimum value to enforce for new documents.", "x-example": 1, - "format": "int32", + "format": "int64", "nullable": true }, "max": { "type": "integer", "description": "Maximum value to enforce for new documents.", "x-example": 10, - "format": "int32", + "format": "int64", "nullable": true }, "default": { @@ -54957,6 +55270,16 @@ "description": "Total number of chunks uploaded", "x-example": 17890, "format": "int32" + }, + "encryption": { + "type": "boolean", + "description": "Whether file contents are encrypted at rest.", + "x-example": true + }, + "compression": { + "type": "string", + "description": "Compression algorithm used for the file. Will be one of none, [gzip](https:\/\/en.wikipedia.org\/wiki\/Gzip), or [zstd](https:\/\/en.wikipedia.org\/wiki\/Zstd).", + "x-example": "gzip" } }, "required": [ @@ -54970,7 +55293,9 @@ "mimeType", "sizeOriginal", "chunksTotal", - "chunksUploaded" + "chunksUploaded", + "encryption", + "compression" ], "example": { "$id": "5e5ea5c16897e", @@ -54985,7 +55310,9 @@ "mimeType": "image\/png", "sizeOriginal": 17890, "chunksTotal": 17890, - "chunksUploaded": 17890 + "chunksUploaded": 17890, + "encryption": true, + "compression": "gzip" } }, "bucket": { @@ -55051,7 +55378,7 @@ }, "compression": { "type": "string", - "description": "Compression algorithm choosen for compression. Will be one of none, [gzip](https:\/\/en.wikipedia.org\/wiki\/Gzip), or [zstd](https:\/\/en.wikipedia.org\/wiki\/Zstd).", + "description": "Compression algorithm chosen for compression. Will be one of none, [gzip](https:\/\/en.wikipedia.org\/wiki\/Gzip), or [zstd](https:\/\/en.wikipedia.org\/wiki\/Zstd).", "x-example": "gzip" }, "encryption": { @@ -55068,6 +55395,12 @@ "type": "boolean", "description": "Image transformations are enabled.", "x-example": false + }, + "totalSize": { + "type": "integer", + "description": "Total size of this bucket in bytes.", + "x-example": 128, + "format": "int32" } }, "required": [ @@ -55083,7 +55416,8 @@ "compression", "encryption", "antivirus", - "transformations" + "transformations", + "totalSize" ], "example": { "$id": "5e5ea5c16897e", @@ -55103,7 +55437,8 @@ "compression": "gzip", "encryption": false, "antivirus": false, - "transformations": false + "transformations": false, + "totalSize": 128 } }, "resourceToken": { @@ -56918,13 +57253,14 @@ }, "status": { "type": "string", - "description": "The deployment status. Possible values are \"waiting\", \"processing\", \"building\", \"ready\", and \"failed\".", + "description": "The deployment status. Possible values are \"waiting\", \"processing\", \"building\", \"ready\", \"canceled\" and \"failed\".", "x-example": "ready", "enum": [ "waiting", "processing", "building", "ready", + "canceled", "failed" ] }, @@ -57470,6 +57806,16 @@ "description": "Last ping datetime in ISO 8601 format.", "x-example": "2020-10-15T06:38:00.000+00:00" }, + "labels": { + "type": "array", + "description": "Labels for the project.", + "items": { + "type": "string" + }, + "x-example": [ + "vip" + ] + }, "authEmailPassword": { "type": "boolean", "description": "Email\/Password auth method status", @@ -57614,6 +57960,7 @@ "smtpSecure", "pingCount", "pingedAt", + "labels", "authEmailPassword", "authUsersAuthMagicURL", "authEmailOtp", @@ -57682,6 +58029,9 @@ "smtpSecure": "tls", "pingCount": 1, "pingedAt": "2020-10-15T06:38:00.000+00:00", + "labels": [ + "vip" + ], "authEmailPassword": true, "authUsersAuthMagicURL": true, "authEmailOtp": true, @@ -59635,160 +59985,6 @@ "description": "Time range of the usage stats.", "x-example": "30d" }, - "deploymentsTotal": { - "type": "integer", - "description": "Total aggregated number of functions deployments.", - "x-example": 0, - "format": "int32" - }, - "deploymentsStorageTotal": { - "type": "integer", - "description": "Total aggregated sum of functions deployment storage.", - "x-example": 0, - "format": "int32" - }, - "buildsTotal": { - "type": "integer", - "description": "Total aggregated number of functions build.", - "x-example": 0, - "format": "int32" - }, - "buildsStorageTotal": { - "type": "integer", - "description": "total aggregated sum of functions build storage.", - "x-example": 0, - "format": "int32" - }, - "buildsTimeTotal": { - "type": "integer", - "description": "Total aggregated sum of functions build compute time.", - "x-example": 0, - "format": "int32" - }, - "buildsMbSecondsTotal": { - "type": "integer", - "description": "Total aggregated sum of functions build mbSeconds.", - "x-example": 0, - "format": "int32" - }, - "executionsTotal": { - "type": "integer", - "description": "Total aggregated number of functions execution.", - "x-example": 0, - "format": "int32" - }, - "executionsTimeTotal": { - "type": "integer", - "description": "Total aggregated sum of functions execution compute time.", - "x-example": 0, - "format": "int32" - }, - "executionsMbSecondsTotal": { - "type": "integer", - "description": "Total aggregated sum of functions execution mbSeconds.", - "x-example": 0, - "format": "int32" - }, - "deployments": { - "type": "array", - "description": "Aggregated number of functions deployment per period.", - "items": { - "$ref": "#\/components\/schemas\/metric" - }, - "x-example": [] - }, - "deploymentsStorage": { - "type": "array", - "description": "Aggregated number of functions deployment storage per period.", - "items": { - "$ref": "#\/components\/schemas\/metric" - }, - "x-example": [] - }, - "buildsSuccessTotal": { - "type": "integer", - "description": "Total aggregated number of successful function builds.", - "x-example": 0, - "format": "int32" - }, - "buildsFailedTotal": { - "type": "integer", - "description": "Total aggregated number of failed function builds.", - "x-example": 0, - "format": "int32" - }, - "builds": { - "type": "array", - "description": "Aggregated number of functions build per period.", - "items": { - "$ref": "#\/components\/schemas\/metric" - }, - "x-example": [] - }, - "buildsStorage": { - "type": "array", - "description": "Aggregated sum of functions build storage per period.", - "items": { - "$ref": "#\/components\/schemas\/metric" - }, - "x-example": [] - }, - "buildsTime": { - "type": "array", - "description": "Aggregated sum of functions build compute time per period.", - "items": { - "$ref": "#\/components\/schemas\/metric" - }, - "x-example": [] - }, - "buildsMbSeconds": { - "type": "array", - "description": "Aggregated sum of functions build mbSeconds per period.", - "items": { - "$ref": "#\/components\/schemas\/metric" - }, - "x-example": [] - }, - "executions": { - "type": "array", - "description": "Aggregated number of functions execution per period.", - "items": { - "$ref": "#\/components\/schemas\/metric" - }, - "x-example": [] - }, - "executionsTime": { - "type": "array", - "description": "Aggregated number of functions execution compute time per period.", - "items": { - "$ref": "#\/components\/schemas\/metric" - }, - "x-example": [] - }, - "executionsMbSeconds": { - "type": "array", - "description": "Aggregated number of functions mbSeconds per period.", - "items": { - "$ref": "#\/components\/schemas\/metric" - }, - "x-example": [] - }, - "buildsSuccess": { - "type": "array", - "description": "Aggregated number of successful function builds per period.", - "items": { - "$ref": "#\/components\/schemas\/metric" - }, - "x-example": [] - }, - "buildsFailed": { - "type": "array", - "description": "Aggregated number of failed function builds per period.", - "items": { - "$ref": "#\/components\/schemas\/metric" - }, - "x-example": [] - }, "sitesTotal": { "type": "integer", "description": "Total aggregated number of sites.", @@ -59803,6 +59999,60 @@ }, "x-example": [] }, + "deploymentsTotal": { + "type": "integer", + "description": "Total aggregated number of sites deployments.", + "x-example": 0, + "format": "int32" + }, + "deploymentsStorageTotal": { + "type": "integer", + "description": "Total aggregated sum of sites deployment storage.", + "x-example": 0, + "format": "int32" + }, + "buildsTotal": { + "type": "integer", + "description": "Total aggregated number of sites build.", + "x-example": 0, + "format": "int32" + }, + "buildsStorageTotal": { + "type": "integer", + "description": "total aggregated sum of sites build storage.", + "x-example": 0, + "format": "int32" + }, + "buildsTimeTotal": { + "type": "integer", + "description": "Total aggregated sum of sites build compute time.", + "x-example": 0, + "format": "int32" + }, + "buildsMbSecondsTotal": { + "type": "integer", + "description": "Total aggregated sum of sites build mbSeconds.", + "x-example": 0, + "format": "int32" + }, + "executionsTotal": { + "type": "integer", + "description": "Total aggregated number of sites execution.", + "x-example": 0, + "format": "int32" + }, + "executionsTimeTotal": { + "type": "integer", + "description": "Total aggregated sum of sites execution compute time.", + "x-example": 0, + "format": "int32" + }, + "executionsMbSecondsTotal": { + "type": "integer", + "description": "Total aggregated sum of sites execution mbSeconds.", + "x-example": 0, + "format": "int32" + }, "requestsTotal": { "type": "integer", "description": "Total aggregated number of requests.", @@ -59844,10 +60094,112 @@ "$ref": "#\/components\/schemas\/metric" }, "x-example": [] + }, + "deployments": { + "type": "array", + "description": "Aggregated number of sites deployment per period.", + "items": { + "$ref": "#\/components\/schemas\/metric" + }, + "x-example": [] + }, + "deploymentsStorage": { + "type": "array", + "description": "Aggregated number of sites deployment storage per period.", + "items": { + "$ref": "#\/components\/schemas\/metric" + }, + "x-example": [] + }, + "buildsSuccessTotal": { + "type": "integer", + "description": "Total aggregated number of successful site builds.", + "x-example": 0, + "format": "int32" + }, + "buildsFailedTotal": { + "type": "integer", + "description": "Total aggregated number of failed site builds.", + "x-example": 0, + "format": "int32" + }, + "builds": { + "type": "array", + "description": "Aggregated number of sites build per period.", + "items": { + "$ref": "#\/components\/schemas\/metric" + }, + "x-example": [] + }, + "buildsStorage": { + "type": "array", + "description": "Aggregated sum of sites build storage per period.", + "items": { + "$ref": "#\/components\/schemas\/metric" + }, + "x-example": [] + }, + "buildsTime": { + "type": "array", + "description": "Aggregated sum of sites build compute time per period.", + "items": { + "$ref": "#\/components\/schemas\/metric" + }, + "x-example": [] + }, + "buildsMbSeconds": { + "type": "array", + "description": "Aggregated sum of sites build mbSeconds per period.", + "items": { + "$ref": "#\/components\/schemas\/metric" + }, + "x-example": [] + }, + "executions": { + "type": "array", + "description": "Aggregated number of sites execution per period.", + "items": { + "$ref": "#\/components\/schemas\/metric" + }, + "x-example": [] + }, + "executionsTime": { + "type": "array", + "description": "Aggregated number of sites execution compute time per period.", + "items": { + "$ref": "#\/components\/schemas\/metric" + }, + "x-example": [] + }, + "executionsMbSeconds": { + "type": "array", + "description": "Aggregated number of sites mbSeconds per period.", + "items": { + "$ref": "#\/components\/schemas\/metric" + }, + "x-example": [] + }, + "buildsSuccess": { + "type": "array", + "description": "Aggregated number of successful site builds per period.", + "items": { + "$ref": "#\/components\/schemas\/metric" + }, + "x-example": [] + }, + "buildsFailed": { + "type": "array", + "description": "Aggregated number of failed site builds per period.", + "items": { + "$ref": "#\/components\/schemas\/metric" + }, + "x-example": [] } }, "required": [ "range", + "sitesTotal", + "sites", "deploymentsTotal", "deploymentsStorageTotal", "buildsTotal", @@ -59857,6 +60209,12 @@ "executionsTotal", "executionsTimeTotal", "executionsMbSecondsTotal", + "requestsTotal", + "requests", + "inboundTotal", + "inbound", + "outboundTotal", + "outbound", "deployments", "deploymentsStorage", "buildsSuccessTotal", @@ -59869,18 +60227,12 @@ "executionsTime", "executionsMbSeconds", "buildsSuccess", - "buildsFailed", - "sitesTotal", - "sites", - "requestsTotal", - "requests", - "inboundTotal", - "inbound", - "outboundTotal", - "outbound" + "buildsFailed" ], "example": { "range": "30d", + "sitesTotal": 0, + "sites": [], "deploymentsTotal": 0, "deploymentsStorageTotal": 0, "buildsTotal": 0, @@ -59890,6 +60242,12 @@ "executionsTotal": 0, "executionsTimeTotal": 0, "executionsMbSecondsTotal": 0, + "requestsTotal": 0, + "requests": [], + "inboundTotal": 0, + "inbound": [], + "outboundTotal": 0, + "outbound": [], "deployments": [], "deploymentsStorage": [], "buildsSuccessTotal": 0, @@ -59902,15 +60260,7 @@ "executionsTime": [], "executionsMbSeconds": [], "buildsSuccess": [], - "buildsFailed": [], - "sitesTotal": 0, - "sites": [], - "requestsTotal": 0, - "requests": [], - "inboundTotal": 0, - "inbound": [], - "outboundTotal": 0, - "outbound": [] + "buildsFailed": [] } }, "usageSite": { @@ -61183,7 +61533,7 @@ "status": { "type": "string", "description": "Status of delivery.", - "x-example": "Message status can be one of the following: draft, processing, scheduled, sent, or failed.", + "x-example": "processing", "enum": [ "draft", "processing", @@ -61229,7 +61579,7 @@ "subject": "Welcome to Appwrite", "content": "Hi there, welcome to Appwrite family." }, - "status": "Message status can be one of the following: draft, processing, scheduled, sent, or failed." + "status": "processing" } }, "topic": { @@ -61759,6 +62109,12 @@ "x-appwrite": { "demo": "" } + }, + "Cookie": { + "type": "apiKey", + "name": "Cookie", + "description": "The user cookie to authenticate with", + "in": "header" } } }, diff --git a/app/config/specs/open-api3-latest-server.json b/app/config/specs/open-api3-latest-server.json index 45a67ef9aa..6b4e836a43 100644 --- a/app/config/specs/open-api3-latest-server.json +++ b/app/config/specs/open-api3-latest-server.json @@ -1,7 +1,7 @@ { "openapi": "3.0.0", "info": { - "version": "1.8.0", + "version": "1.8.1", "title": "Appwrite", "description": "Appwrite backend as a service cuts up to 70% of the time and costs required for building a modern application. We abstract and simplify common development tasks behind a REST APIs, to help you develop your app in a fast and secure way. For full API documentation and tutorials go to [https:\/\/appwrite.io\/docs](https:\/\/appwrite.io\/docs)", "termsOfService": "https:\/\/appwrite.io\/policy\/terms", @@ -48,7 +48,7 @@ "x-appwrite": { "method": "get", "group": "account", - "weight": 10, + "weight": 9, "cookies": false, "type": "", "demo": "account\/get.md", @@ -100,7 +100,7 @@ "x-appwrite": { "method": "create", "group": "account", - "weight": 9, + "weight": 8, "cookies": false, "type": "", "demo": "account\/create.md", @@ -142,7 +142,8 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", @@ -190,7 +191,7 @@ "x-appwrite": { "method": "updateEmail", "group": "account", - "weight": 35, + "weight": 34, "cookies": false, "type": "", "demo": "account\/update-email.md", @@ -227,12 +228,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password. Must be at least 8 chars.", - "x-example": "password" + "x-example": "password", + "format": "password" } }, "required": [ @@ -269,7 +272,7 @@ "x-appwrite": { "method": "listIdentities", "group": "identities", - "weight": 48, + "weight": 47, "cookies": false, "type": "", "demo": "account\/list-identities.md", @@ -342,7 +345,7 @@ "x-appwrite": { "method": "deleteIdentity", "group": "identities", - "weight": 49, + "weight": 48, "cookies": false, "type": "", "demo": "account\/delete-identity.md", @@ -408,12 +411,12 @@ "x-appwrite": { "method": "createJWT", "group": "tokens", - "weight": 30, + "weight": 29, "cookies": false, "type": "", "demo": "account\/create-jwt.md", - "rate-limit": 100, - "rate-time": 3600, + "rate-limit": 120, + "rate-time": 60, "rate-key": "url:{url},userId:{userId}", "scope": "account", "platforms": [ @@ -435,7 +438,24 @@ "Session": [], "JWT": [] } - ] + ], + "requestBody": { + "content": { + "application\/json": { + "schema": { + "type": "object", + "properties": { + "duration": { + "type": "integer", + "description": "Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds.", + "x-example": 0, + "format": "int32" + } + } + } + } + } + } } }, "\/account\/logs": { @@ -462,7 +482,7 @@ "x-appwrite": { "method": "listLogs", "group": "logs", - "weight": 32, + "weight": 31, "cookies": false, "type": "", "demo": "account\/list-logs.md", @@ -542,7 +562,7 @@ "x-appwrite": { "method": "updateMFA", "group": "mfa", - "weight": 306, + "weight": 253, "cookies": false, "type": "", "demo": "account\/update-mfa.md", @@ -615,7 +635,7 @@ "x-appwrite": { "method": "createMfaAuthenticator", "group": "mfa", - "weight": 308, + "weight": 255, "cookies": false, "type": "", "demo": "account\/create-mfa-authenticator.md", @@ -742,7 +762,7 @@ "x-appwrite": { "method": "updateMfaAuthenticator", "group": "mfa", - "weight": 309, + "weight": 256, "cookies": false, "type": "", "demo": "account\/update-mfa-authenticator.md", @@ -885,7 +905,7 @@ "x-appwrite": { "method": "deleteMfaAuthenticator", "group": "mfa", - "weight": 310, + "weight": 257, "cookies": false, "type": "", "demo": "account\/delete-mfa-authenticator.md", @@ -1012,7 +1032,7 @@ "x-appwrite": { "method": "createMfaChallenge", "group": "mfa", - "weight": 314, + "weight": 261, "cookies": false, "type": "", "demo": "account\/create-mfa-challenge.md", @@ -1149,7 +1169,7 @@ "x-appwrite": { "method": "updateMfaChallenge", "group": "mfa", - "weight": 315, + "weight": 262, "cookies": false, "type": "", "demo": "account\/update-mfa-challenge.md", @@ -1290,7 +1310,7 @@ "x-appwrite": { "method": "listMfaFactors", "group": "mfa", - "weight": 307, + "weight": 254, "cookies": false, "type": "", "demo": "account\/list-mfa-factors.md", @@ -1394,7 +1414,7 @@ "x-appwrite": { "method": "getMfaRecoveryCodes", "group": "mfa", - "weight": 313, + "weight": 260, "cookies": false, "type": "", "demo": "account\/get-mfa-recovery-codes.md", @@ -1496,7 +1516,7 @@ "x-appwrite": { "method": "createMfaRecoveryCodes", "group": "mfa", - "weight": 311, + "weight": 258, "cookies": false, "type": "", "demo": "account\/create-mfa-recovery-codes.md", @@ -1598,7 +1618,7 @@ "x-appwrite": { "method": "updateMfaRecoveryCodes", "group": "mfa", - "weight": 312, + "weight": 259, "cookies": false, "type": "", "demo": "account\/update-mfa-recovery-codes.md", @@ -1702,7 +1722,7 @@ "x-appwrite": { "method": "updateName", "group": "account", - "weight": 33, + "weight": 32, "cookies": false, "type": "", "demo": "account\/update-name.md", @@ -1775,7 +1795,7 @@ "x-appwrite": { "method": "updatePassword", "group": "account", - "weight": 34, + "weight": 33, "cookies": false, "type": "", "demo": "account\/update-password.md", @@ -1817,7 +1837,8 @@ "oldPassword": { "type": "string", "description": "Current user password. Must be at least 8 chars.", - "x-example": "password" + "x-example": "password", + "format": "password" } }, "required": [ @@ -1853,7 +1874,7 @@ "x-appwrite": { "method": "updatePhone", "group": "account", - "weight": 36, + "weight": 35, "cookies": false, "type": "", "demo": "account\/update-phone.md", @@ -1890,12 +1911,14 @@ "phone": { "type": "string", "description": "Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "password": { "type": "string", "description": "User password. Must be at least 8 chars.", - "x-example": "password" + "x-example": "password", + "format": "password" } }, "required": [ @@ -1932,7 +1955,7 @@ "x-appwrite": { "method": "getPrefs", "group": "account", - "weight": 31, + "weight": 30, "cookies": false, "type": "", "demo": "account\/get-prefs.md", @@ -1984,7 +2007,7 @@ "x-appwrite": { "method": "updatePrefs", "group": "account", - "weight": 37, + "weight": 36, "cookies": false, "type": "", "demo": "account\/update-prefs.md", @@ -2057,7 +2080,7 @@ "x-appwrite": { "method": "createRecovery", "group": "recovery", - "weight": 39, + "weight": 38, "cookies": false, "type": "", "demo": "account\/create-recovery.md", @@ -2097,12 +2120,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "url": { "type": "string", "description": "URL to redirect the user back to your app from the recovery email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.", - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" } }, "required": [ @@ -2137,7 +2162,7 @@ "x-appwrite": { "method": "updateRecovery", "group": "recovery", - "weight": 40, + "weight": 39, "cookies": false, "type": "", "demo": "account\/update-recovery.md", @@ -2222,7 +2247,7 @@ "x-appwrite": { "method": "listSessions", "group": "sessions", - "weight": 12, + "weight": 11, "cookies": false, "type": "", "demo": "account\/list-sessions.md", @@ -2267,7 +2292,7 @@ "x-appwrite": { "method": "deleteSessions", "group": "sessions", - "weight": 13, + "weight": 12, "cookies": false, "type": "", "demo": "account\/delete-sessions.md", @@ -2321,7 +2346,7 @@ "x-appwrite": { "method": "createAnonymousSession", "group": "sessions", - "weight": 18, + "weight": 17, "cookies": false, "type": "", "demo": "account\/create-anonymous-session.md", @@ -2375,7 +2400,7 @@ "x-appwrite": { "method": "createEmailPasswordSession", "group": "sessions", - "weight": 17, + "weight": 16, "cookies": false, "type": "", "demo": "account\/create-email-password-session.md", @@ -2412,12 +2437,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password. Must be at least 8 chars.", - "x-example": "password" + "x-example": "password", + "format": "password" } }, "required": [ @@ -2454,7 +2481,7 @@ "x-appwrite": { "method": "updateMagicURLSession", "group": "sessions", - "weight": 27, + "weight": 26, "cookies": false, "type": "", "demo": "account\/update-magic-url-session.md", @@ -2537,7 +2564,7 @@ "x-appwrite": { "method": "updatePhoneSession", "group": "sessions", - "weight": 28, + "weight": 27, "cookies": false, "type": "", "demo": "account\/update-phone-session.md", @@ -2620,7 +2647,7 @@ "x-appwrite": { "method": "createSession", "group": "sessions", - "weight": 19, + "weight": 18, "cookies": false, "type": "", "demo": "account\/create-session.md", @@ -2699,7 +2726,7 @@ "x-appwrite": { "method": "getSession", "group": "sessions", - "weight": 14, + "weight": 13, "cookies": false, "type": "", "demo": "account\/get-session.md", @@ -2763,7 +2790,7 @@ "x-appwrite": { "method": "updateSession", "group": "sessions", - "weight": 16, + "weight": 15, "cookies": false, "type": "", "demo": "account\/update-session.md", @@ -2820,7 +2847,7 @@ "x-appwrite": { "method": "deleteSession", "group": "sessions", - "weight": 15, + "weight": 14, "cookies": false, "type": "", "demo": "account\/delete-session.md", @@ -2886,7 +2913,7 @@ "x-appwrite": { "method": "updateStatus", "group": "account", - "weight": 38, + "weight": 37, "cookies": false, "type": "", "demo": "account\/update-status.md", @@ -2940,7 +2967,7 @@ "x-appwrite": { "method": "createEmailToken", "group": "tokens", - "weight": 26, + "weight": 25, "cookies": false, "type": "", "demo": "account\/create-email-token.md", @@ -2985,7 +3012,8 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "phrase": { "type": "boolean", @@ -3027,7 +3055,7 @@ "x-appwrite": { "method": "createMagicURLToken", "group": "tokens", - "weight": 25, + "weight": 24, "cookies": false, "type": "", "demo": "account\/create-magic-url-token.md", @@ -3072,12 +3100,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "url": { "type": "string", "description": "URL to redirect the user back to your app from the magic URL login. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.", - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" }, "phrase": { "type": "boolean", @@ -3112,7 +3142,7 @@ "x-appwrite": { "method": "createOAuth2Token", "group": "tokens", - "weight": 24, + "weight": 23, "cookies": false, "type": "webAuth", "demo": "account\/create-o-auth-2-token.md", @@ -3187,8 +3217,7 @@ "yammer", "yandex", "zoho", - "zoom", - "mock" + "zoom" ], "x-enum-name": "OAuthProvider", "x-enum-keys": [] @@ -3259,7 +3288,7 @@ "x-appwrite": { "method": "createPhoneToken", "group": "tokens", - "weight": 29, + "weight": 28, "cookies": false, "type": "", "demo": "account\/create-phone-token.md", @@ -3304,7 +3333,8 @@ "phone": { "type": "string", "description": "Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" } }, "required": [ @@ -3341,7 +3371,7 @@ "x-appwrite": { "method": "createEmailVerification", "group": "verification", - "weight": 41, + "weight": 40, "cookies": false, "type": "", "demo": "account\/create-email-verification.md", @@ -3432,7 +3462,8 @@ "url": { "type": "string", "description": "URL to redirect the user back to your app from the verification email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.", - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" } }, "required": [ @@ -3466,7 +3497,7 @@ "x-appwrite": { "method": "updateEmailVerification", "group": "verification", - "weight": 42, + "weight": 41, "cookies": false, "type": "", "demo": "account\/update-email-verification.md", @@ -3603,7 +3634,7 @@ "x-appwrite": { "method": "createPhoneVerification", "group": "verification", - "weight": 43, + "weight": 42, "cookies": false, "type": "", "demo": "account\/create-phone-verification.md", @@ -3658,7 +3689,7 @@ "x-appwrite": { "method": "updatePhoneVerification", "group": "verification", - "weight": 44, + "weight": 43, "cookies": false, "type": "", "demo": "account\/update-phone-verification.md", @@ -3730,7 +3761,7 @@ "x-appwrite": { "method": "getBrowser", "group": null, - "weight": 51, + "weight": 264, "cookies": false, "type": "location", "demo": "avatars\/get-browser.md", @@ -3860,7 +3891,7 @@ "x-appwrite": { "method": "getCreditCard", "group": null, - "weight": 50, + "weight": 263, "cookies": false, "type": "location", "demo": "avatars\/get-credit-card.md", @@ -3996,7 +4027,7 @@ "x-appwrite": { "method": "getFavicon", "group": null, - "weight": 54, + "weight": 267, "cookies": false, "type": "location", "demo": "avatars\/get-favicon.md", @@ -4058,7 +4089,7 @@ "x-appwrite": { "method": "getFlag", "group": null, - "weight": 52, + "weight": 265, "cookies": false, "type": "location", "demo": "avatars\/get-flag.md", @@ -4550,7 +4581,7 @@ "x-appwrite": { "method": "getImage", "group": null, - "weight": 53, + "weight": 266, "cookies": false, "type": "location", "demo": "avatars\/get-image.md", @@ -4636,7 +4667,7 @@ "x-appwrite": { "method": "getInitials", "group": null, - "weight": 56, + "weight": 269, "cookies": false, "type": "location", "demo": "avatars\/get-initials.md", @@ -4732,7 +4763,7 @@ "x-appwrite": { "method": "getQR", "group": null, - "weight": 55, + "weight": 268, "cookies": false, "type": "location", "demo": "avatars\/get-qr.md", @@ -4828,7 +4859,7 @@ "x-appwrite": { "method": "getScreenshot", "group": null, - "weight": 57, + "weight": 270, "cookies": false, "type": "location", "demo": "avatars\/get-screenshot.md", @@ -5550,7 +5581,7 @@ "avif", "gif" ], - "x-enum-name": null, + "x-enum-name": "ImageFormat", "x-enum-keys": [], "default": "" }, @@ -5583,7 +5614,7 @@ "x-appwrite": { "method": "list", "group": "databases", - "weight": 320, + "weight": 278, "cookies": false, "type": "", "demo": "databases\/list.md", @@ -5704,7 +5735,7 @@ "x-appwrite": { "method": "create", "group": "databases", - "weight": 316, + "weight": 274, "cookies": false, "type": "", "demo": "databases\/create.md", @@ -5823,7 +5854,7 @@ "x-appwrite": { "method": "listTransactions", "group": "transactions", - "weight": 380, + "weight": 338, "cookies": false, "type": "", "demo": "databases\/list-transactions.md", @@ -5892,7 +5923,7 @@ "x-appwrite": { "method": "createTransaction", "group": "transactions", - "weight": 376, + "weight": 334, "cookies": false, "type": "", "demo": "databases\/create-transaction.md", @@ -5931,7 +5962,8 @@ "ttl": { "type": "integer", "description": "Seconds before the transaction expires.", - "x-example": 60 + "x-example": 60, + "format": "int32" } } } @@ -5964,7 +5996,7 @@ "x-appwrite": { "method": "getTransaction", "group": "transactions", - "weight": 377, + "weight": 335, "cookies": false, "type": "", "demo": "databases\/get-transaction.md", @@ -6030,7 +6062,7 @@ "x-appwrite": { "method": "updateTransaction", "group": "transactions", - "weight": 378, + "weight": 336, "cookies": false, "type": "", "demo": "databases\/update-transaction.md", @@ -6110,7 +6142,7 @@ "x-appwrite": { "method": "deleteTransaction", "group": "transactions", - "weight": 379, + "weight": 337, "cookies": false, "type": "", "demo": "databases\/delete-transaction.md", @@ -6178,7 +6210,7 @@ "x-appwrite": { "method": "createOperations", "group": "transactions", - "weight": 381, + "weight": 339, "cookies": false, "type": "", "demo": "databases\/create-operations.md", @@ -6265,7 +6297,7 @@ "x-appwrite": { "method": "get", "group": "databases", - "weight": 317, + "weight": 275, "cookies": false, "type": "", "demo": "databases\/get.md", @@ -6361,7 +6393,7 @@ "x-appwrite": { "method": "update", "group": "databases", - "weight": 318, + "weight": 276, "cookies": false, "type": "", "demo": "databases\/update.md", @@ -6395,8 +6427,7 @@ "enabled" ], "required": [ - "databaseId", - "name" + "databaseId" ], "responses": [ { @@ -6452,10 +6483,7 @@ "description": "Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled.", "x-example": false } - }, - "required": [ - "name" - ] + } } } } @@ -6477,7 +6505,7 @@ "x-appwrite": { "method": "delete", "group": "databases", - "weight": 319, + "weight": 277, "cookies": false, "type": "", "demo": "databases\/delete.md", @@ -6574,7 +6602,7 @@ "x-appwrite": { "method": "listCollections", "group": "collections", - "weight": 328, + "weight": 286, "cookies": false, "type": "", "demo": "databases\/list-collections.md", @@ -6675,7 +6703,7 @@ "x-appwrite": { "method": "createCollection", "group": "collections", - "weight": 324, + "weight": 282, "cookies": false, "type": "", "demo": "databases\/create-collection.md", @@ -6803,7 +6831,7 @@ "x-appwrite": { "method": "getCollection", "group": "collections", - "weight": 325, + "weight": 283, "cookies": false, "type": "", "demo": "databases\/get-collection.md", @@ -6879,7 +6907,7 @@ "x-appwrite": { "method": "updateCollection", "group": "collections", - "weight": 326, + "weight": 284, "cookies": false, "type": "", "demo": "databases\/update-collection.md", @@ -6961,10 +6989,7 @@ "description": "Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled.", "x-example": false } - }, - "required": [ - "name" - ] + } } } } @@ -6986,7 +7011,7 @@ "x-appwrite": { "method": "deleteCollection", "group": "collections", - "weight": 327, + "weight": 285, "cookies": false, "type": "", "demo": "databases\/delete-collection.md", @@ -7064,7 +7089,7 @@ "x-appwrite": { "method": "listAttributes", "group": "attributes", - "weight": 345, + "weight": 303, "cookies": false, "type": "", "demo": "databases\/list-attributes.md", @@ -7166,7 +7191,7 @@ "x-appwrite": { "method": "createBooleanAttribute", "group": "attributes", - "weight": 346, + "weight": 304, "cookies": false, "type": "", "demo": "databases\/create-boolean-attribute.md", @@ -7280,7 +7305,7 @@ "x-appwrite": { "method": "updateBooleanAttribute", "group": "attributes", - "weight": 347, + "weight": 305, "cookies": false, "type": "", "demo": "databases\/update-boolean-attribute.md", @@ -7399,7 +7424,7 @@ "x-appwrite": { "method": "createDatetimeAttribute", "group": "attributes", - "weight": 348, + "weight": 306, "cookies": false, "type": "", "demo": "databases\/create-datetime-attribute.md", @@ -7513,7 +7538,7 @@ "x-appwrite": { "method": "updateDatetimeAttribute", "group": "attributes", - "weight": 349, + "weight": 307, "cookies": false, "type": "", "demo": "databases\/update-datetime-attribute.md", @@ -7632,7 +7657,7 @@ "x-appwrite": { "method": "createEmailAttribute", "group": "attributes", - "weight": 350, + "weight": 308, "cookies": false, "type": "", "demo": "databases\/create-email-attribute.md", @@ -7704,6 +7729,7 @@ "type": "string", "description": "Default value for attribute when not provided. Cannot be set when attribute is required.", "x-example": "email@example.com", + "format": "email", "x-nullable": true }, "array": { @@ -7746,7 +7772,7 @@ "x-appwrite": { "method": "updateEmailAttribute", "group": "attributes", - "weight": 351, + "weight": 309, "cookies": false, "type": "", "demo": "databases\/update-email-attribute.md", @@ -7822,6 +7848,7 @@ "type": "string", "description": "Default value for attribute when not provided. Cannot be set when attribute is required.", "x-example": "email@example.com", + "format": "email", "x-nullable": true }, "newKey": { @@ -7865,7 +7892,7 @@ "x-appwrite": { "method": "createEnumAttribute", "group": "attributes", - "weight": 352, + "weight": 310, "cookies": false, "type": "", "demo": "databases\/create-enum-attribute.md", @@ -7988,7 +8015,7 @@ "x-appwrite": { "method": "updateEnumAttribute", "group": "attributes", - "weight": 353, + "weight": 311, "cookies": false, "type": "", "demo": "databases\/update-enum-attribute.md", @@ -8116,7 +8143,7 @@ "x-appwrite": { "method": "createFloatAttribute", "group": "attributes", - "weight": 354, + "weight": 312, "cookies": false, "type": "", "demo": "databases\/create-float-attribute.md", @@ -8188,18 +8215,21 @@ "type": "number", "description": "Minimum value.", "x-example": null, + "format": "float", "x-nullable": true }, "max": { "type": "number", "description": "Maximum value.", "x-example": null, + "format": "float", "x-nullable": true }, "default": { "type": "number", "description": "Default value. Cannot be set when required.", "x-example": null, + "format": "float", "x-nullable": true }, "array": { @@ -8242,7 +8272,7 @@ "x-appwrite": { "method": "updateFloatAttribute", "group": "attributes", - "weight": 355, + "weight": 313, "cookies": false, "type": "", "demo": "databases\/update-float-attribute.md", @@ -8318,18 +8348,21 @@ "type": "number", "description": "Minimum value.", "x-example": null, + "format": "float", "x-nullable": true }, "max": { "type": "number", "description": "Maximum value.", "x-example": null, + "format": "float", "x-nullable": true }, "default": { "type": "number", "description": "Default value. Cannot be set when required.", "x-example": null, + "format": "float", "x-nullable": true }, "newKey": { @@ -8373,7 +8406,7 @@ "x-appwrite": { "method": "createIntegerAttribute", "group": "attributes", - "weight": 356, + "weight": 314, "cookies": false, "type": "", "demo": "databases\/create-integer-attribute.md", @@ -8445,18 +8478,21 @@ "type": "integer", "description": "Minimum value", "x-example": null, + "format": "int64", "x-nullable": true }, "max": { "type": "integer", "description": "Maximum value", "x-example": null, + "format": "int64", "x-nullable": true }, "default": { "type": "integer", "description": "Default value. Cannot be set when attribute is required.", "x-example": null, + "format": "int64", "x-nullable": true }, "array": { @@ -8499,7 +8535,7 @@ "x-appwrite": { "method": "updateIntegerAttribute", "group": "attributes", - "weight": 357, + "weight": 315, "cookies": false, "type": "", "demo": "databases\/update-integer-attribute.md", @@ -8575,18 +8611,21 @@ "type": "integer", "description": "Minimum value", "x-example": null, + "format": "int64", "x-nullable": true }, "max": { "type": "integer", "description": "Maximum value", "x-example": null, + "format": "int64", "x-nullable": true }, "default": { "type": "integer", "description": "Default value. Cannot be set when attribute is required.", "x-example": null, + "format": "int64", "x-nullable": true }, "newKey": { @@ -8630,7 +8669,7 @@ "x-appwrite": { "method": "createIpAttribute", "group": "attributes", - "weight": 358, + "weight": 316, "cookies": false, "type": "", "demo": "databases\/create-ip-attribute.md", @@ -8744,7 +8783,7 @@ "x-appwrite": { "method": "updateIpAttribute", "group": "attributes", - "weight": 359, + "weight": 317, "cookies": false, "type": "", "demo": "databases\/update-ip-attribute.md", @@ -8863,7 +8902,7 @@ "x-appwrite": { "method": "createLineAttribute", "group": "attributes", - "weight": 360, + "weight": 318, "cookies": false, "type": "", "demo": "databases\/create-line-attribute.md", @@ -8979,7 +9018,7 @@ "x-appwrite": { "method": "updateLineAttribute", "group": "attributes", - "weight": 361, + "weight": 319, "cookies": false, "type": "", "demo": "databases\/update-line-attribute.md", @@ -9104,7 +9143,7 @@ "x-appwrite": { "method": "createPointAttribute", "group": "attributes", - "weight": 362, + "weight": 320, "cookies": false, "type": "", "demo": "databases\/create-point-attribute.md", @@ -9220,7 +9259,7 @@ "x-appwrite": { "method": "updatePointAttribute", "group": "attributes", - "weight": 363, + "weight": 321, "cookies": false, "type": "", "demo": "databases\/update-point-attribute.md", @@ -9345,7 +9384,7 @@ "x-appwrite": { "method": "createPolygonAttribute", "group": "attributes", - "weight": 364, + "weight": 322, "cookies": false, "type": "", "demo": "databases\/create-polygon-attribute.md", @@ -9461,7 +9500,7 @@ "x-appwrite": { "method": "updatePolygonAttribute", "group": "attributes", - "weight": 365, + "weight": 323, "cookies": false, "type": "", "demo": "databases\/update-polygon-attribute.md", @@ -9586,7 +9625,7 @@ "x-appwrite": { "method": "createRelationshipAttribute", "group": "attributes", - "weight": 366, + "weight": 324, "cookies": false, "type": "", "demo": "databases\/create-relationship-attribute.md", @@ -9726,7 +9765,7 @@ "x-appwrite": { "method": "createStringAttribute", "group": "attributes", - "weight": 368, + "weight": 326, "cookies": false, "type": "", "demo": "databases\/create-string-attribute.md", @@ -9792,7 +9831,8 @@ "size": { "type": "integer", "description": "Attribute size for text attributes, in number of characters.", - "x-example": 1 + "x-example": 1, + "format": "int32" }, "required": { "type": "boolean", @@ -9851,7 +9891,7 @@ "x-appwrite": { "method": "updateStringAttribute", "group": "attributes", - "weight": 369, + "weight": 327, "cookies": false, "type": "", "demo": "databases\/update-string-attribute.md", @@ -9933,6 +9973,7 @@ "type": "integer", "description": "Maximum size of the string attribute.", "x-example": 1, + "format": "int32", "x-nullable": true }, "newKey": { @@ -9976,7 +10017,7 @@ "x-appwrite": { "method": "createUrlAttribute", "group": "attributes", - "weight": 370, + "weight": 328, "cookies": false, "type": "", "demo": "databases\/create-url-attribute.md", @@ -10048,6 +10089,7 @@ "type": "string", "description": "Default value for attribute when not provided. Cannot be set when attribute is required.", "x-example": "https:\/\/example.com", + "format": "url", "x-nullable": true }, "array": { @@ -10090,7 +10132,7 @@ "x-appwrite": { "method": "updateUrlAttribute", "group": "attributes", - "weight": 371, + "weight": 329, "cookies": false, "type": "", "demo": "databases\/update-url-attribute.md", @@ -10166,6 +10208,7 @@ "type": "string", "description": "Default value for attribute when not provided. Cannot be set when attribute is required.", "x-example": "https:\/\/example.com", + "format": "url", "x-nullable": true }, "newKey": { @@ -10240,7 +10283,7 @@ "x-appwrite": { "method": "getAttribute", "group": "attributes", - "weight": 343, + "weight": 301, "cookies": false, "type": "", "demo": "databases\/get-attribute.md", @@ -10318,7 +10361,7 @@ "x-appwrite": { "method": "deleteAttribute", "group": "attributes", - "weight": 344, + "weight": 302, "cookies": false, "type": "", "demo": "databases\/delete-attribute.md", @@ -10405,7 +10448,7 @@ "x-appwrite": { "method": "updateRelationshipAttribute", "group": "attributes", - "weight": 367, + "weight": 325, "cookies": false, "type": "", "demo": "databases\/update-relationship-attribute.md", @@ -10522,7 +10565,7 @@ "x-appwrite": { "method": "listDocuments", "group": "documents", - "weight": 339, + "weight": 297, "cookies": false, "type": "", "demo": "databases\/list-documents.md", @@ -10636,7 +10679,7 @@ "x-appwrite": { "method": "createDocument", "group": "documents", - "weight": 331, + "weight": 289, "cookies": false, "type": "", "demo": "databases\/create-document.md", @@ -10831,7 +10874,7 @@ "x-appwrite": { "method": "upsertDocuments", "group": "documents", - "weight": 336, + "weight": 294, "cookies": false, "type": "", "demo": "databases\/upsert-documents.md", @@ -10970,7 +11013,7 @@ "x-appwrite": { "method": "updateDocuments", "group": "documents", - "weight": 334, + "weight": 292, "cookies": false, "type": "", "demo": "databases\/update-documents.md", @@ -11076,7 +11119,7 @@ "x-appwrite": { "method": "deleteDocuments", "group": "documents", - "weight": 338, + "weight": 296, "cookies": false, "type": "", "demo": "databases\/delete-documents.md", @@ -11179,7 +11222,7 @@ "x-appwrite": { "method": "getDocument", "group": "documents", - "weight": 332, + "weight": 290, "cookies": false, "type": "", "demo": "databases\/get-document.md", @@ -11292,7 +11335,7 @@ "x-appwrite": { "method": "upsertDocument", "group": "documents", - "weight": 335, + "weight": 293, "cookies": false, "type": "", "demo": "databases\/upsert-document.md", @@ -11450,7 +11493,7 @@ "x-appwrite": { "method": "updateDocument", "group": "documents", - "weight": 333, + "weight": 291, "cookies": false, "type": "", "demo": "databases\/update-document.md", @@ -11564,7 +11607,7 @@ "x-appwrite": { "method": "deleteDocument", "group": "documents", - "weight": 337, + "weight": 295, "cookies": false, "type": "", "demo": "databases\/delete-document.md", @@ -11673,7 +11716,7 @@ "x-appwrite": { "method": "decrementDocumentAttribute", "group": "documents", - "weight": 342, + "weight": 300, "cookies": false, "type": "", "demo": "databases\/decrement-document-attribute.md", @@ -11757,12 +11800,14 @@ "value": { "type": "number", "description": "Value to increment the attribute by. The value must be a number.", - "x-example": null + "x-example": null, + "format": "float" }, "min": { "type": "number", "description": "Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown.", "x-example": null, + "format": "float", "x-nullable": true }, "transactionId": { @@ -11802,7 +11847,7 @@ "x-appwrite": { "method": "incrementDocumentAttribute", "group": "documents", - "weight": 341, + "weight": 299, "cookies": false, "type": "", "demo": "databases\/increment-document-attribute.md", @@ -11886,12 +11931,14 @@ "value": { "type": "number", "description": "Value to increment the attribute by. The value must be a number.", - "x-example": null + "x-example": null, + "format": "float" }, "max": { "type": "number", "description": "Maximum value for the attribute. If the current value is greater than this value, an error will be thrown.", "x-example": null, + "format": "float", "x-nullable": true }, "transactionId": { @@ -11931,7 +11978,7 @@ "x-appwrite": { "method": "listIndexes", "group": "indexes", - "weight": 375, + "weight": 333, "cookies": false, "type": "", "demo": "databases\/list-indexes.md", @@ -12031,7 +12078,7 @@ "x-appwrite": { "method": "createIndex", "group": "indexes", - "weight": 372, + "weight": 330, "cookies": false, "type": "", "demo": "databases\/create-index.md", @@ -12173,7 +12220,7 @@ "x-appwrite": { "method": "getIndex", "group": "indexes", - "weight": 373, + "weight": 331, "cookies": false, "type": "", "demo": "databases\/get-index.md", @@ -12251,7 +12298,7 @@ "x-appwrite": { "method": "deleteIndex", "group": "indexes", - "weight": 374, + "weight": 332, "cookies": false, "type": "", "demo": "databases\/delete-index.md", @@ -12338,7 +12385,7 @@ "x-appwrite": { "method": "list", "group": "functions", - "weight": 456, + "weight": 415, "cookies": false, "type": "", "demo": "functions\/list.md", @@ -12424,7 +12471,7 @@ "x-appwrite": { "method": "create", "group": "functions", - "weight": 453, + "weight": 412, "cookies": false, "type": "", "demo": "functions\/create.md", @@ -12565,7 +12612,8 @@ "timeout": { "type": "integer", "description": "Function maximum execution time in seconds.", - "x-example": 1 + "x-example": 1, + "format": "int32" }, "enabled": { "type": "boolean", @@ -12720,7 +12768,7 @@ "x-appwrite": { "method": "listRuntimes", "group": "runtimes", - "weight": 458, + "weight": 417, "cookies": false, "type": "", "demo": "functions\/list-runtimes.md", @@ -12771,7 +12819,7 @@ "x-appwrite": { "method": "listSpecifications", "group": "runtimes", - "weight": 459, + "weight": 418, "cookies": false, "type": "", "demo": "functions\/list-specifications.md", @@ -12822,7 +12870,7 @@ "x-appwrite": { "method": "get", "group": "functions", - "weight": 454, + "weight": 413, "cookies": false, "type": "", "demo": "functions\/get.md", @@ -12883,7 +12931,7 @@ "x-appwrite": { "method": "update", "group": "functions", - "weight": 455, + "weight": 414, "cookies": false, "type": "", "demo": "functions\/update.md", @@ -13031,7 +13079,8 @@ "timeout": { "type": "integer", "description": "Maximum execution time in seconds.", - "x-example": 1 + "x-example": 1, + "format": "int32" }, "enabled": { "type": "boolean", @@ -13176,7 +13225,7 @@ "x-appwrite": { "method": "delete", "group": "functions", - "weight": 457, + "weight": 416, "cookies": false, "type": "", "demo": "functions\/delete.md", @@ -13239,7 +13288,7 @@ "x-appwrite": { "method": "updateFunctionDeployment", "group": "functions", - "weight": 462, + "weight": 421, "cookies": false, "type": "", "demo": "functions\/update-function-deployment.md", @@ -13321,7 +13370,7 @@ "x-appwrite": { "method": "listDeployments", "group": "deployments", - "weight": 463, + "weight": 422, "cookies": false, "type": "", "demo": "functions\/list-deployments.md", @@ -13417,7 +13466,7 @@ "x-appwrite": { "method": "createDeployment", "group": "deployments", - "weight": 460, + "weight": 419, "cookies": false, "type": "upload", "demo": "functions\/create-deployment.md", @@ -13475,7 +13524,8 @@ "code": { "type": "string", "description": "Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory.", - "x-example": null + "x-example": null, + "format": "binary" }, "activate": { "type": "boolean", @@ -13517,7 +13567,7 @@ "x-appwrite": { "method": "createDuplicateDeployment", "group": "deployments", - "weight": 468, + "weight": 427, "cookies": false, "type": "", "demo": "functions\/create-duplicate-deployment.md", @@ -13604,7 +13654,7 @@ "x-appwrite": { "method": "createTemplateDeployment", "group": "deployments", - "weight": 465, + "weight": 424, "cookies": false, "type": "", "demo": "functions\/create-template-deployment.md", @@ -13722,7 +13772,7 @@ "x-appwrite": { "method": "createVcsDeployment", "group": "deployments", - "weight": 466, + "weight": 425, "cookies": false, "type": "", "demo": "functions\/create-vcs-deployment.md", @@ -13821,7 +13871,7 @@ "x-appwrite": { "method": "getDeployment", "group": "deployments", - "weight": 461, + "weight": 420, "cookies": false, "type": "", "demo": "functions\/get-deployment.md", @@ -13885,7 +13935,7 @@ "x-appwrite": { "method": "deleteDeployment", "group": "deployments", - "weight": 464, + "weight": 423, "cookies": false, "type": "", "demo": "functions\/delete-deployment.md", @@ -13951,7 +14001,7 @@ "x-appwrite": { "method": "getDeploymentDownload", "group": "deployments", - "weight": 467, + "weight": 426, "cookies": false, "type": "location", "demo": "functions\/get-deployment-download.md", @@ -14043,7 +14093,7 @@ "x-appwrite": { "method": "updateDeploymentStatus", "group": "deployments", - "weight": 469, + "weight": 428, "cookies": false, "type": "", "demo": "functions\/update-deployment-status.md", @@ -14116,7 +14166,7 @@ "x-appwrite": { "method": "listExecutions", "group": "executions", - "weight": 472, + "weight": 431, "cookies": false, "type": "", "demo": "functions\/list-executions.md", @@ -14205,7 +14255,7 @@ "x-appwrite": { "method": "createExecution", "group": "executions", - "weight": 470, + "weight": 429, "cookies": false, "type": "", "demo": "functions\/create-execution.md", @@ -14325,7 +14375,7 @@ "x-appwrite": { "method": "getExecution", "group": "executions", - "weight": 471, + "weight": 430, "cookies": false, "type": "", "demo": "functions\/get-execution.md", @@ -14393,7 +14443,7 @@ "x-appwrite": { "method": "deleteExecution", "group": "executions", - "weight": 473, + "weight": 432, "cookies": false, "type": "", "demo": "functions\/delete-execution.md", @@ -14466,7 +14516,7 @@ "x-appwrite": { "method": "listVariables", "group": "variables", - "weight": 478, + "weight": 437, "cookies": false, "type": "", "demo": "functions\/list-variables.md", @@ -14527,7 +14577,7 @@ "x-appwrite": { "method": "createVariable", "group": "variables", - "weight": 476, + "weight": 435, "cookies": false, "type": "", "demo": "functions\/create-variable.md", @@ -14620,7 +14670,7 @@ "x-appwrite": { "method": "getVariable", "group": "variables", - "weight": 477, + "weight": 436, "cookies": false, "type": "", "demo": "functions\/get-variable.md", @@ -14691,7 +14741,7 @@ "x-appwrite": { "method": "updateVariable", "group": "variables", - "weight": 479, + "weight": 438, "cookies": false, "type": "", "demo": "functions\/update-variable.md", @@ -14786,7 +14836,7 @@ "x-appwrite": { "method": "deleteVariable", "group": "variables", - "weight": 480, + "weight": 439, "cookies": false, "type": "", "demo": "functions\/delete-variable.md", @@ -14859,7 +14909,7 @@ "x-appwrite": { "method": "query", "group": "graphql", - "weight": 241, + "weight": 190, "cookies": false, "type": "graphql", "demo": "graphql\/query.md", @@ -14915,7 +14965,7 @@ "x-appwrite": { "method": "mutation", "group": "graphql", - "weight": 240, + "weight": 189, "cookies": false, "type": "graphql", "demo": "graphql\/mutation.md", @@ -14971,7 +15021,7 @@ "x-appwrite": { "method": "get", "group": "health", - "weight": 69, + "weight": 442, "cookies": false, "type": "", "demo": "health\/get.md", @@ -15023,7 +15073,7 @@ "x-appwrite": { "method": "getAntivirus", "group": "health", - "weight": 90, + "weight": 451, "cookies": false, "type": "", "demo": "health\/get-antivirus.md", @@ -15061,11 +15111,11 @@ "description": "Check the Appwrite in-memory cache servers are up and connection is successful.", "responses": { "200": { - "description": "Health Status", + "description": "Status List", "content": { "application\/json": { "schema": { - "$ref": "#\/components\/schemas\/healthStatus" + "$ref": "#\/components\/schemas\/healthStatusList" } } } @@ -15075,7 +15125,7 @@ "x-appwrite": { "method": "getCache", "group": "health", - "weight": 72, + "weight": 445, "cookies": false, "type": "", "demo": "health\/get-cache.md", @@ -15127,7 +15177,7 @@ "x-appwrite": { "method": "getCertificate", "group": "health", - "weight": 77, + "weight": 448, "cookies": false, "type": "", "demo": "health\/get-certificate.md", @@ -15176,11 +15226,11 @@ "description": "Check the Appwrite database servers are up and connection is successful.", "responses": { "200": { - "description": "Health Status", + "description": "Status List", "content": { "application\/json": { "schema": { - "$ref": "#\/components\/schemas\/healthStatus" + "$ref": "#\/components\/schemas\/healthStatusList" } } } @@ -15190,7 +15240,7 @@ "x-appwrite": { "method": "getDB", "group": "health", - "weight": 71, + "weight": 444, "cookies": false, "type": "", "demo": "health\/get-db.md", @@ -15228,11 +15278,11 @@ "description": "Check the Appwrite pub-sub servers are up and connection is successful.", "responses": { "200": { - "description": "Health Status", + "description": "Status List", "content": { "application\/json": { "schema": { - "$ref": "#\/components\/schemas\/healthStatus" + "$ref": "#\/components\/schemas\/healthStatusList" } } } @@ -15242,7 +15292,7 @@ "x-appwrite": { "method": "getPubSub", "group": "health", - "weight": 73, + "weight": 446, "cookies": false, "type": "", "demo": "health\/get-pub-sub.md", @@ -15270,6 +15320,71 @@ ] } }, + "\/health\/queue\/audits": { + "get": { + "summary": "Get audits queue", + "operationId": "healthGetQueueAudits", + "tags": [ + "health" + ], + "description": "Get the number of audit logs that are waiting to be processed in the Appwrite internal queue server.", + "responses": { + "200": { + "description": "Health Queue", + "content": { + "application\/json": { + "schema": { + "$ref": "#\/components\/schemas\/healthQueue" + } + } + } + } + }, + "deprecated": false, + "x-appwrite": { + "method": "getQueueAudits", + "group": "queue", + "weight": 452, + "cookies": false, + "type": "", + "demo": "health\/get-queue-audits.md", + "rate-limit": 0, + "rate-time": 3600, + "rate-key": "url:{url},ip:{ip}", + "scope": "health.read", + "platforms": [ + "console", + "server" + ], + "packaging": false, + "public": true, + "edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-audits.md", + "auth": { + "Project": [], + "Key": [] + } + }, + "security": [ + { + "Project": [], + "Key": [] + } + ], + "parameters": [ + { + "name": "threshold", + "description": "Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.", + "required": false, + "schema": { + "type": "integer", + "format": "int32", + "default": 5000 + }, + "in": "query" + } + ] + } + }, "\/health\/queue\/builds": { "get": { "summary": "Get builds queue", @@ -15294,7 +15409,7 @@ "x-appwrite": { "method": "getQueueBuilds", "group": "queue", - "weight": 79, + "weight": 456, "cookies": false, "type": "", "demo": "health\/get-queue-builds.md", @@ -15359,7 +15474,7 @@ "x-appwrite": { "method": "getQueueCertificates", "group": "queue", - "weight": 78, + "weight": 455, "cookies": false, "type": "", "demo": "health\/get-queue-certificates.md", @@ -15424,7 +15539,7 @@ "x-appwrite": { "method": "getQueueDatabases", "group": "queue", - "weight": 80, + "weight": 457, "cookies": false, "type": "", "demo": "health\/get-queue-databases.md", @@ -15500,7 +15615,7 @@ "x-appwrite": { "method": "getQueueDeletes", "group": "queue", - "weight": 81, + "weight": 458, "cookies": false, "type": "", "demo": "health\/get-queue-deletes.md", @@ -15565,7 +15680,7 @@ "x-appwrite": { "method": "getFailedJobs", "group": "queue", - "weight": 91, + "weight": 465, "cookies": false, "type": "", "demo": "health\/get-failed-jobs.md", @@ -15610,6 +15725,7 @@ "v1-webhooks", "v1-certificates", "v1-builds", + "v1-screenshots", "v1-messaging", "v1-migrations" ], @@ -15656,7 +15772,7 @@ "x-appwrite": { "method": "getQueueFunctions", "group": "queue", - "weight": 85, + "weight": 462, "cookies": false, "type": "", "demo": "health\/get-queue-functions.md", @@ -15721,7 +15837,7 @@ "x-appwrite": { "method": "getQueueLogs", "group": "queue", - "weight": 76, + "weight": 454, "cookies": false, "type": "", "demo": "health\/get-queue-logs.md", @@ -15786,7 +15902,7 @@ "x-appwrite": { "method": "getQueueMails", "group": "queue", - "weight": 82, + "weight": 459, "cookies": false, "type": "", "demo": "health\/get-queue-mails.md", @@ -15851,7 +15967,7 @@ "x-appwrite": { "method": "getQueueMessaging", "group": "queue", - "weight": 83, + "weight": 460, "cookies": false, "type": "", "demo": "health\/get-queue-messaging.md", @@ -15916,7 +16032,7 @@ "x-appwrite": { "method": "getQueueMigrations", "group": "queue", - "weight": 84, + "weight": 461, "cookies": false, "type": "", "demo": "health\/get-queue-migrations.md", @@ -15981,7 +16097,7 @@ "x-appwrite": { "method": "getQueueStatsResources", "group": "queue", - "weight": 86, + "weight": 463, "cookies": false, "type": "", "demo": "health\/get-queue-stats-resources.md", @@ -16046,7 +16162,7 @@ "x-appwrite": { "method": "getQueueUsage", "group": "queue", - "weight": 87, + "weight": 464, "cookies": false, "type": "", "demo": "health\/get-queue-usage.md", @@ -16111,7 +16227,7 @@ "x-appwrite": { "method": "getQueueWebhooks", "group": "queue", - "weight": 75, + "weight": 453, "cookies": false, "type": "", "demo": "health\/get-queue-webhooks.md", @@ -16176,7 +16292,7 @@ "x-appwrite": { "method": "getStorage", "group": "storage", - "weight": 89, + "weight": 450, "cookies": false, "type": "", "demo": "health\/get-storage.md", @@ -16228,7 +16344,7 @@ "x-appwrite": { "method": "getStorageLocal", "group": "storage", - "weight": 88, + "weight": 449, "cookies": false, "type": "", "demo": "health\/get-storage-local.md", @@ -16280,7 +16396,7 @@ "x-appwrite": { "method": "getTime", "group": "health", - "weight": 74, + "weight": 447, "cookies": false, "type": "", "demo": "health\/get-time.md", @@ -16332,7 +16448,7 @@ "x-appwrite": { "method": "get", "group": null, - "weight": 61, + "weight": 49, "cookies": false, "type": "", "demo": "locale\/get.md", @@ -16388,7 +16504,7 @@ "x-appwrite": { "method": "listCodes", "group": null, - "weight": 62, + "weight": 50, "cookies": false, "type": "", "demo": "locale\/list-codes.md", @@ -16444,7 +16560,7 @@ "x-appwrite": { "method": "listContinents", "group": null, - "weight": 66, + "weight": 54, "cookies": false, "type": "", "demo": "locale\/list-continents.md", @@ -16500,7 +16616,7 @@ "x-appwrite": { "method": "listCountries", "group": null, - "weight": 63, + "weight": 51, "cookies": false, "type": "", "demo": "locale\/list-countries.md", @@ -16556,7 +16672,7 @@ "x-appwrite": { "method": "listCountriesEU", "group": null, - "weight": 64, + "weight": 52, "cookies": false, "type": "", "demo": "locale\/list-countries-eu.md", @@ -16612,7 +16728,7 @@ "x-appwrite": { "method": "listCountriesPhones", "group": null, - "weight": 65, + "weight": 53, "cookies": false, "type": "", "demo": "locale\/list-countries-phones.md", @@ -16668,7 +16784,7 @@ "x-appwrite": { "method": "listCurrencies", "group": null, - "weight": 67, + "weight": 55, "cookies": false, "type": "", "demo": "locale\/list-currencies.md", @@ -16724,7 +16840,7 @@ "x-appwrite": { "method": "listLanguages", "group": null, - "weight": 68, + "weight": 56, "cookies": false, "type": "", "demo": "locale\/list-languages.md", @@ -16780,7 +16896,7 @@ "x-appwrite": { "method": "listMessages", "group": "messages", - "weight": 298, + "weight": 245, "cookies": false, "type": "", "demo": "messaging\/list-messages.md", @@ -16869,7 +16985,7 @@ "x-appwrite": { "method": "createEmail", "group": "messages", - "weight": 295, + "weight": 242, "cookies": false, "type": "", "demo": "messaging\/create-email.md", @@ -17016,7 +17132,7 @@ "x-appwrite": { "method": "updateEmail", "group": "messages", - "weight": 302, + "weight": 249, "cookies": false, "type": "", "demo": "messaging\/update-email.md", @@ -17175,7 +17291,7 @@ "x-appwrite": { "method": "createPush", "group": "messages", - "weight": 297, + "weight": 244, "cookies": false, "type": "", "demo": "messaging\/create-push.md", @@ -17285,7 +17401,8 @@ "badge": { "type": "integer", "description": "Badge for push notification. Available only for iOS Platform.", - "x-example": null + "x-example": null, + "format": "int32" }, "draft": { "type": "boolean", @@ -17353,7 +17470,7 @@ "x-appwrite": { "method": "updatePush", "group": "messages", - "weight": 304, + "weight": 251, "cookies": false, "type": "", "demo": "messaging\/update-push.md", @@ -17482,6 +17599,7 @@ "type": "integer", "description": "Badge for push notification. Available only for iOS platforms.", "x-example": null, + "format": "int32", "x-nullable": true }, "draft": { @@ -17551,7 +17669,7 @@ "x-appwrite": { "method": "createSms", "group": "messages", - "weight": 296, + "weight": 243, "cookies": false, "type": "", "demo": "messaging\/create-sms.md", @@ -17735,7 +17853,7 @@ "x-appwrite": { "method": "updateSms", "group": "messages", - "weight": 303, + "weight": 250, "cookies": false, "type": "", "demo": "messaging\/update-sms.md", @@ -17925,7 +18043,7 @@ "x-appwrite": { "method": "getMessage", "group": "messages", - "weight": 301, + "weight": 248, "cookies": false, "type": "", "demo": "messaging\/get-message.md", @@ -17980,7 +18098,7 @@ "x-appwrite": { "method": "delete", "group": "messages", - "weight": 305, + "weight": 252, "cookies": false, "type": "", "demo": "messaging\/delete.md", @@ -18044,7 +18162,7 @@ "x-appwrite": { "method": "listMessageLogs", "group": "logs", - "weight": 299, + "weight": 246, "cookies": false, "type": "", "demo": "messaging\/list-message-logs.md", @@ -18132,7 +18250,7 @@ "x-appwrite": { "method": "listTargets", "group": "messages", - "weight": 300, + "weight": 247, "cookies": false, "type": "", "demo": "messaging\/list-targets.md", @@ -18220,7 +18338,7 @@ "x-appwrite": { "method": "listProviders", "group": "providers", - "weight": 269, + "weight": 216, "cookies": false, "type": "", "demo": "messaging\/list-providers.md", @@ -18309,7 +18427,7 @@ "x-appwrite": { "method": "createApnsProvider", "group": "providers", - "weight": 268, + "weight": 215, "cookies": false, "type": "", "demo": "messaging\/create-apns-provider.md", @@ -18491,7 +18609,7 @@ "x-appwrite": { "method": "updateApnsProvider", "group": "providers", - "weight": 282, + "weight": 229, "cookies": false, "type": "", "demo": "messaging\/update-apns-provider.md", @@ -18675,7 +18793,7 @@ "x-appwrite": { "method": "createFcmProvider", "group": "providers", - "weight": 267, + "weight": 214, "cookies": false, "type": "", "demo": "messaging\/create-fcm-provider.md", @@ -18830,7 +18948,7 @@ "x-appwrite": { "method": "updateFcmProvider", "group": "providers", - "weight": 281, + "weight": 228, "cookies": false, "type": "", "demo": "messaging\/update-fcm-provider.md", @@ -18986,7 +19104,7 @@ "x-appwrite": { "method": "createMailgunProvider", "group": "providers", - "weight": 258, + "weight": 205, "cookies": false, "type": "", "demo": "messaging\/create-mailgun-provider.md", @@ -19052,7 +19170,8 @@ "fromEmail": { "type": "string", "description": "Sender email address.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -19062,7 +19181,8 @@ "replyToEmail": { "type": "string", "description": "Email set in the reply to field for the mail. Default value is sender email. Reply to email must have reply to name as well.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "enabled": { "type": "boolean", @@ -19105,7 +19225,7 @@ "x-appwrite": { "method": "updateMailgunProvider", "group": "providers", - "weight": 272, + "weight": 219, "cookies": false, "type": "", "demo": "messaging\/update-mailgun-provider.md", @@ -19184,7 +19304,8 @@ "fromEmail": { "type": "string", "description": "Sender email address.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -19227,7 +19348,7 @@ "x-appwrite": { "method": "createMsg91Provider", "group": "providers", - "weight": 262, + "weight": 209, "cookies": false, "type": "", "demo": "messaging\/create-msg-91-provider.md", @@ -19325,7 +19446,7 @@ "x-appwrite": { "method": "updateMsg91Provider", "group": "providers", - "weight": 276, + "weight": 223, "cookies": false, "type": "", "demo": "messaging\/update-msg-91-provider.md", @@ -19426,7 +19547,7 @@ "x-appwrite": { "method": "createResendProvider", "group": "providers", - "weight": 260, + "weight": 207, "cookies": false, "type": "", "demo": "messaging\/create-resend-provider.md", @@ -19481,7 +19602,8 @@ "fromEmail": { "type": "string", "description": "Sender email address.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -19491,7 +19613,8 @@ "replyToEmail": { "type": "string", "description": "Email set in the reply to field for the mail. Default value is sender email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "enabled": { "type": "boolean", @@ -19534,7 +19657,7 @@ "x-appwrite": { "method": "updateResendProvider", "group": "providers", - "weight": 274, + "weight": 221, "cookies": false, "type": "", "demo": "messaging\/update-resend-provider.md", @@ -19602,7 +19725,8 @@ "fromEmail": { "type": "string", "description": "Sender email address.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -19645,7 +19769,7 @@ "x-appwrite": { "method": "createSendgridProvider", "group": "providers", - "weight": 259, + "weight": 206, "cookies": false, "type": "", "demo": "messaging\/create-sendgrid-provider.md", @@ -19700,7 +19824,8 @@ "fromEmail": { "type": "string", "description": "Sender email address.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -19710,7 +19835,8 @@ "replyToEmail": { "type": "string", "description": "Email set in the reply to field for the mail. Default value is sender email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "enabled": { "type": "boolean", @@ -19753,7 +19879,7 @@ "x-appwrite": { "method": "updateSendgridProvider", "group": "providers", - "weight": 273, + "weight": 220, "cookies": false, "type": "", "demo": "messaging\/update-sendgrid-provider.md", @@ -19821,7 +19947,8 @@ "fromEmail": { "type": "string", "description": "Sender email address.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -19864,7 +19991,7 @@ "x-appwrite": { "method": "createSmtpProvider", "group": "providers", - "weight": 261, + "weight": 208, "cookies": false, "type": "", "demo": "messaging\/create-smtp-provider.md", @@ -20002,7 +20129,8 @@ "port": { "type": "integer", "description": "The default SMTP server port.", - "x-example": 1 + "x-example": 1, + "format": "int32" }, "username": { "type": "string", @@ -20044,7 +20172,8 @@ "fromEmail": { "type": "string", "description": "Sender email address.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -20054,7 +20183,8 @@ "replyToEmail": { "type": "string", "description": "Email set in the reply to field for the mail. Default value is sender email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "enabled": { "type": "boolean", @@ -20098,7 +20228,7 @@ "x-appwrite": { "method": "updateSmtpProvider", "group": "providers", - "weight": 275, + "weight": 222, "cookies": false, "type": "", "demo": "messaging\/update-smtp-provider.md", @@ -20240,6 +20370,7 @@ "type": "integer", "description": "SMTP port.", "x-example": 1, + "format": "int32", "x-nullable": true }, "username": { @@ -20283,7 +20414,8 @@ "fromEmail": { "type": "string", "description": "Sender email address.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -20332,7 +20464,7 @@ "x-appwrite": { "method": "createTelesignProvider", "group": "providers", - "weight": 263, + "weight": 210, "cookies": false, "type": "", "demo": "messaging\/create-telesign-provider.md", @@ -20377,7 +20509,8 @@ "from": { "type": "string", "description": "Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "customerId": { "type": "string", @@ -20430,7 +20563,7 @@ "x-appwrite": { "method": "updateTelesignProvider", "group": "providers", - "weight": 277, + "weight": 224, "cookies": false, "type": "", "demo": "messaging\/update-telesign-provider.md", @@ -20531,7 +20664,7 @@ "x-appwrite": { "method": "createTextmagicProvider", "group": "providers", - "weight": 264, + "weight": 211, "cookies": false, "type": "", "demo": "messaging\/create-textmagic-provider.md", @@ -20576,7 +20709,8 @@ "from": { "type": "string", "description": "Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "username": { "type": "string", @@ -20629,7 +20763,7 @@ "x-appwrite": { "method": "updateTextmagicProvider", "group": "providers", - "weight": 278, + "weight": 225, "cookies": false, "type": "", "demo": "messaging\/update-textmagic-provider.md", @@ -20730,7 +20864,7 @@ "x-appwrite": { "method": "createTwilioProvider", "group": "providers", - "weight": 265, + "weight": 212, "cookies": false, "type": "", "demo": "messaging\/create-twilio-provider.md", @@ -20775,7 +20909,8 @@ "from": { "type": "string", "description": "Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "accountSid": { "type": "string", @@ -20828,7 +20963,7 @@ "x-appwrite": { "method": "updateTwilioProvider", "group": "providers", - "weight": 279, + "weight": 226, "cookies": false, "type": "", "demo": "messaging\/update-twilio-provider.md", @@ -20929,7 +21064,7 @@ "x-appwrite": { "method": "createVonageProvider", "group": "providers", - "weight": 266, + "weight": 213, "cookies": false, "type": "", "demo": "messaging\/create-vonage-provider.md", @@ -20974,7 +21109,8 @@ "from": { "type": "string", "description": "Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "apiKey": { "type": "string", @@ -21027,7 +21163,7 @@ "x-appwrite": { "method": "updateVonageProvider", "group": "providers", - "weight": 280, + "weight": 227, "cookies": false, "type": "", "demo": "messaging\/update-vonage-provider.md", @@ -21128,7 +21264,7 @@ "x-appwrite": { "method": "getProvider", "group": "providers", - "weight": 271, + "weight": 218, "cookies": false, "type": "", "demo": "messaging\/get-provider.md", @@ -21183,7 +21319,7 @@ "x-appwrite": { "method": "deleteProvider", "group": "providers", - "weight": 283, + "weight": 230, "cookies": false, "type": "", "demo": "messaging\/delete-provider.md", @@ -21247,7 +21383,7 @@ "x-appwrite": { "method": "listProviderLogs", "group": "providers", - "weight": 270, + "weight": 217, "cookies": false, "type": "", "demo": "messaging\/list-provider-logs.md", @@ -21335,7 +21471,7 @@ "x-appwrite": { "method": "listSubscriberLogs", "group": "subscribers", - "weight": 292, + "weight": 239, "cookies": false, "type": "", "demo": "messaging\/list-subscriber-logs.md", @@ -21423,7 +21559,7 @@ "x-appwrite": { "method": "listTopics", "group": "topics", - "weight": 285, + "weight": 232, "cookies": false, "type": "", "demo": "messaging\/list-topics.md", @@ -21510,7 +21646,7 @@ "x-appwrite": { "method": "createTopic", "group": "topics", - "weight": 284, + "weight": 231, "cookies": false, "type": "", "demo": "messaging\/create-topic.md", @@ -21595,7 +21731,7 @@ "x-appwrite": { "method": "getTopic", "group": "topics", - "weight": 287, + "weight": 234, "cookies": false, "type": "", "demo": "messaging\/get-topic.md", @@ -21657,7 +21793,7 @@ "x-appwrite": { "method": "updateTopic", "group": "topics", - "weight": 288, + "weight": 235, "cookies": false, "type": "", "demo": "messaging\/update-topic.md", @@ -21738,7 +21874,7 @@ "x-appwrite": { "method": "deleteTopic", "group": "topics", - "weight": 289, + "weight": 236, "cookies": false, "type": "", "demo": "messaging\/delete-topic.md", @@ -21802,7 +21938,7 @@ "x-appwrite": { "method": "listTopicLogs", "group": "topics", - "weight": 286, + "weight": 233, "cookies": false, "type": "", "demo": "messaging\/list-topic-logs.md", @@ -21890,7 +22026,7 @@ "x-appwrite": { "method": "listSubscribers", "group": "subscribers", - "weight": 291, + "weight": 238, "cookies": false, "type": "", "demo": "messaging\/list-subscribers.md", @@ -21987,7 +22123,7 @@ "x-appwrite": { "method": "createSubscriber", "group": "subscribers", - "weight": 290, + "weight": 237, "cookies": false, "type": "", "demo": "messaging\/create-subscriber.md", @@ -22080,7 +22216,7 @@ "x-appwrite": { "method": "getSubscriber", "group": "subscribers", - "weight": 293, + "weight": 240, "cookies": false, "type": "", "demo": "messaging\/get-subscriber.md", @@ -22145,7 +22281,7 @@ "x-appwrite": { "method": "deleteSubscriber", "group": "subscribers", - "weight": 294, + "weight": 241, "cookies": false, "type": "", "demo": "messaging\/delete-subscriber.md", @@ -22223,7 +22359,7 @@ "x-appwrite": { "method": "list", "group": "sites", - "weight": 485, + "weight": 469, "cookies": false, "type": "", "demo": "sites\/list.md", @@ -22309,7 +22445,7 @@ "x-appwrite": { "method": "create", "group": "sites", - "weight": 483, + "weight": 467, "cookies": false, "type": "", "demo": "sites\/create.md", @@ -22387,7 +22523,8 @@ "timeout": { "type": "integer", "description": "Maximum request time in seconds.", - "x-example": 1 + "x-example": 1, + "format": "int32" }, "installCommand": { "type": "string", @@ -22563,7 +22700,7 @@ "x-appwrite": { "method": "listFrameworks", "group": "frameworks", - "weight": 488, + "weight": 472, "cookies": false, "type": "", "demo": "sites\/list-frameworks.md", @@ -22614,7 +22751,7 @@ "x-appwrite": { "method": "listSpecifications", "group": "frameworks", - "weight": 511, + "weight": 495, "cookies": false, "type": "", "demo": "sites\/list-specifications.md", @@ -22665,7 +22802,7 @@ "x-appwrite": { "method": "get", "group": "sites", - "weight": 484, + "weight": 468, "cookies": false, "type": "", "demo": "sites\/get.md", @@ -22726,7 +22863,7 @@ "x-appwrite": { "method": "update", "group": "sites", - "weight": 486, + "weight": 470, "cookies": false, "type": "", "demo": "sites\/update.md", @@ -22811,7 +22948,8 @@ "timeout": { "type": "integer", "description": "Maximum request time in seconds.", - "x-example": 1 + "x-example": 1, + "format": "int32" }, "installCommand": { "type": "string", @@ -22976,7 +23114,7 @@ "x-appwrite": { "method": "delete", "group": "sites", - "weight": 487, + "weight": 471, "cookies": false, "type": "", "demo": "sites\/delete.md", @@ -23039,7 +23177,7 @@ "x-appwrite": { "method": "updateSiteDeployment", "group": "sites", - "weight": 494, + "weight": 478, "cookies": false, "type": "", "demo": "sites\/update-site-deployment.md", @@ -23121,7 +23259,7 @@ "x-appwrite": { "method": "listDeployments", "group": "deployments", - "weight": 493, + "weight": 477, "cookies": false, "type": "", "demo": "sites\/list-deployments.md", @@ -23217,7 +23355,7 @@ "x-appwrite": { "method": "createDeployment", "group": "deployments", - "weight": 489, + "weight": 473, "cookies": false, "type": "upload", "demo": "sites\/create-deployment.md", @@ -23281,7 +23419,8 @@ "code": { "type": "string", "description": "Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory.", - "x-example": null + "x-example": null, + "format": "binary" }, "activate": { "type": "boolean", @@ -23323,7 +23462,7 @@ "x-appwrite": { "method": "createDuplicateDeployment", "group": "deployments", - "weight": 497, + "weight": 481, "cookies": false, "type": "", "demo": "sites\/create-duplicate-deployment.md", @@ -23405,7 +23544,7 @@ "x-appwrite": { "method": "createTemplateDeployment", "group": "deployments", - "weight": 490, + "weight": 474, "cookies": false, "type": "", "demo": "sites\/create-template-deployment.md", @@ -23523,7 +23662,7 @@ "x-appwrite": { "method": "createVcsDeployment", "group": "deployments", - "weight": 491, + "weight": 475, "cookies": false, "type": "", "demo": "sites\/create-vcs-deployment.md", @@ -23623,7 +23762,7 @@ "x-appwrite": { "method": "getDeployment", "group": "deployments", - "weight": 492, + "weight": 476, "cookies": false, "type": "", "demo": "sites\/get-deployment.md", @@ -23687,7 +23826,7 @@ "x-appwrite": { "method": "deleteDeployment", "group": "deployments", - "weight": 495, + "weight": 479, "cookies": false, "type": "", "demo": "sites\/delete-deployment.md", @@ -23753,7 +23892,7 @@ "x-appwrite": { "method": "getDeploymentDownload", "group": "deployments", - "weight": 496, + "weight": 480, "cookies": false, "type": "location", "demo": "sites\/get-deployment-download.md", @@ -23845,7 +23984,7 @@ "x-appwrite": { "method": "updateDeploymentStatus", "group": "deployments", - "weight": 498, + "weight": 482, "cookies": false, "type": "", "demo": "sites\/update-deployment-status.md", @@ -23918,7 +24057,7 @@ "x-appwrite": { "method": "listLogs", "group": "logs", - "weight": 500, + "weight": 484, "cookies": false, "type": "", "demo": "sites\/list-logs.md", @@ -24005,7 +24144,7 @@ "x-appwrite": { "method": "getLog", "group": "logs", - "weight": 499, + "weight": 483, "cookies": false, "type": "", "demo": "sites\/get-log.md", @@ -24069,7 +24208,7 @@ "x-appwrite": { "method": "deleteLog", "group": "logs", - "weight": 501, + "weight": 485, "cookies": false, "type": "", "demo": "sites\/delete-log.md", @@ -24142,7 +24281,7 @@ "x-appwrite": { "method": "listVariables", "group": "variables", - "weight": 504, + "weight": 488, "cookies": false, "type": "", "demo": "sites\/list-variables.md", @@ -24203,7 +24342,7 @@ "x-appwrite": { "method": "createVariable", "group": "variables", - "weight": 502, + "weight": 486, "cookies": false, "type": "", "demo": "sites\/create-variable.md", @@ -24296,7 +24435,7 @@ "x-appwrite": { "method": "getVariable", "group": "variables", - "weight": 503, + "weight": 487, "cookies": false, "type": "", "demo": "sites\/get-variable.md", @@ -24367,7 +24506,7 @@ "x-appwrite": { "method": "updateVariable", "group": "variables", - "weight": 505, + "weight": 489, "cookies": false, "type": "", "demo": "sites\/update-variable.md", @@ -24462,7 +24601,7 @@ "x-appwrite": { "method": "deleteVariable", "group": "variables", - "weight": 506, + "weight": 490, "cookies": false, "type": "", "demo": "sites\/delete-variable.md", @@ -24535,7 +24674,7 @@ "x-appwrite": { "method": "listBuckets", "group": "buckets", - "weight": 146, + "weight": 522, "cookies": false, "type": "", "demo": "storage\/list-buckets.md", @@ -24622,7 +24761,7 @@ "x-appwrite": { "method": "createBucket", "group": "buckets", - "weight": 145, + "weight": 520, "cookies": false, "type": "", "demo": "storage\/create-bucket.md", @@ -24686,7 +24825,8 @@ "maximumFileSize": { "type": "integer", "description": "Maximum file size allowed in bytes. Maximum allowed value is 30MB.", - "x-example": 1 + "x-example": 1, + "format": "int32" }, "allowedFileExtensions": { "type": "array", @@ -24698,7 +24838,7 @@ }, "compression": { "type": "string", - "description": "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", + "description": "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", "x-example": "none", "enum": [ "none", @@ -24758,7 +24898,7 @@ "x-appwrite": { "method": "getBucket", "group": "buckets", - "weight": 147, + "weight": 521, "cookies": false, "type": "", "demo": "storage\/get-bucket.md", @@ -24820,7 +24960,7 @@ "x-appwrite": { "method": "updateBucket", "group": "buckets", - "weight": 148, + "weight": 523, "cookies": false, "type": "", "demo": "storage\/update-bucket.md", @@ -24891,7 +25031,8 @@ "maximumFileSize": { "type": "integer", "description": "Maximum file size allowed in bytes. Maximum allowed value is 30MB.", - "x-example": 1 + "x-example": 1, + "format": "int32" }, "allowedFileExtensions": { "type": "array", @@ -24903,7 +25044,7 @@ }, "compression": { "type": "string", - "description": "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", + "description": "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", "x-example": "none", "enum": [ "none", @@ -24953,7 +25094,7 @@ "x-appwrite": { "method": "deleteBucket", "group": "buckets", - "weight": 149, + "weight": 524, "cookies": false, "type": "", "demo": "storage\/delete-bucket.md", @@ -25017,7 +25158,7 @@ "x-appwrite": { "method": "listFiles", "group": "files", - "weight": 151, + "weight": 527, "cookies": false, "type": "", "demo": "storage\/list-files.md", @@ -25118,7 +25259,7 @@ "x-appwrite": { "method": "createFile", "group": "files", - "weight": 150, + "weight": 525, "cookies": false, "type": "upload", "demo": "storage\/create-file.md", @@ -25175,7 +25316,8 @@ "file": { "type": "string", "description": "Binary file. Appwrite SDKs provide helpers to handle file input. [Learn about file input](https:\/\/appwrite.io\/docs\/products\/storage\/upload-download#input-file).", - "x-example": null + "x-example": null, + "format": "binary" }, "permissions": { "type": "array", @@ -25221,7 +25363,7 @@ "x-appwrite": { "method": "getFile", "group": "files", - "weight": 152, + "weight": 526, "cookies": false, "type": "", "demo": "storage\/get-file.md", @@ -25297,13 +25439,13 @@ "x-appwrite": { "method": "updateFile", "group": "files", - "weight": 157, + "weight": 528, "cookies": false, "type": "", "demo": "storage\/update-file.md", - "rate-limit": 60, - "rate-time": 60, - "rate-key": "ip:{ip},method:{method},url:{url},userId:{userId}", + "rate-limit": 0, + "rate-time": 3600, + "rate-key": "url:{url},ip:{ip}", "scope": "files.write", "platforms": [ "console", @@ -25330,7 +25472,7 @@ "parameters": [ { "name": "bucketId", - "description": "Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https:\/\/appwrite.io\/docs\/server\/storage#createBucket).", + "description": "Bucket unique ID.", "required": true, "schema": { "type": "string", @@ -25340,7 +25482,7 @@ }, { "name": "fileId", - "description": "File unique ID.", + "description": "File ID.", "required": true, "schema": { "type": "string", @@ -25357,13 +25499,12 @@ "properties": { "name": { "type": "string", - "description": "Name of the file", - "x-example": "", - "x-nullable": true + "description": "File name.", + "x-example": "" }, "permissions": { "type": "array", - "description": "An array of permission string. By default, the current permissions are inherited. [Learn more about permissions](https:\/\/appwrite.io\/docs\/permissions).", + "description": "An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https:\/\/appwrite.io\/docs\/permissions).", "x-example": "[\"read(\"any\")\"]", "items": { "type": "string" @@ -25392,7 +25533,7 @@ "x-appwrite": { "method": "deleteFile", "group": "files", - "weight": 158, + "weight": 529, "cookies": false, "type": "", "demo": "storage\/delete-file.md", @@ -25463,7 +25604,7 @@ "x-appwrite": { "method": "getFileDownload", "group": "files", - "weight": 154, + "weight": 531, "cookies": false, "type": "location", "demo": "storage\/get-file-download.md", @@ -25545,7 +25686,7 @@ "x-appwrite": { "method": "getFilePreview", "group": "files", - "weight": 153, + "weight": 530, "cookies": false, "type": "location", "demo": "storage\/get-file-preview.md", @@ -25777,7 +25918,7 @@ "x-appwrite": { "method": "getFileView", "group": "files", - "weight": 155, + "weight": 532, "cookies": false, "type": "location", "demo": "storage\/get-file-view.md", @@ -25866,7 +26007,7 @@ "x-appwrite": { "method": "list", "group": "tablesdb", - "weight": 386, + "weight": 344, "cookies": false, "type": "", "demo": "tablesdb\/list.md", @@ -25953,7 +26094,7 @@ "x-appwrite": { "method": "create", "group": "tablesdb", - "weight": 382, + "weight": 340, "cookies": false, "type": "", "demo": "tablesdb\/create.md", @@ -26035,7 +26176,7 @@ "x-appwrite": { "method": "listTransactions", "group": "transactions", - "weight": 445, + "weight": 403, "cookies": false, "type": "", "demo": "tablesdb\/list-transactions.md", @@ -26107,7 +26248,7 @@ "x-appwrite": { "method": "createTransaction", "group": "transactions", - "weight": 441, + "weight": 399, "cookies": false, "type": "", "demo": "tablesdb\/create-transaction.md", @@ -26149,7 +26290,8 @@ "ttl": { "type": "integer", "description": "Seconds before the transaction expires.", - "x-example": 60 + "x-example": 60, + "format": "int32" } } } @@ -26182,7 +26324,7 @@ "x-appwrite": { "method": "getTransaction", "group": "transactions", - "weight": 442, + "weight": 400, "cookies": false, "type": "", "demo": "tablesdb\/get-transaction.md", @@ -26251,7 +26393,7 @@ "x-appwrite": { "method": "updateTransaction", "group": "transactions", - "weight": 443, + "weight": 401, "cookies": false, "type": "", "demo": "tablesdb\/update-transaction.md", @@ -26334,7 +26476,7 @@ "x-appwrite": { "method": "deleteTransaction", "group": "transactions", - "weight": 444, + "weight": 402, "cookies": false, "type": "", "demo": "tablesdb\/delete-transaction.md", @@ -26405,7 +26547,7 @@ "x-appwrite": { "method": "createOperations", "group": "transactions", - "weight": 446, + "weight": 404, "cookies": false, "type": "", "demo": "tablesdb\/create-operations.md", @@ -26495,7 +26637,7 @@ "x-appwrite": { "method": "get", "group": "tablesdb", - "weight": 383, + "weight": 341, "cookies": false, "type": "", "demo": "tablesdb\/get.md", @@ -26557,7 +26699,7 @@ "x-appwrite": { "method": "update", "group": "tablesdb", - "weight": 384, + "weight": 342, "cookies": false, "type": "", "demo": "tablesdb\/update.md", @@ -26611,10 +26753,7 @@ "description": "Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled.", "x-example": false } - }, - "required": [ - "name" - ] + } } } } @@ -26636,7 +26775,7 @@ "x-appwrite": { "method": "delete", "group": "tablesdb", - "weight": 385, + "weight": 343, "cookies": false, "type": "", "demo": "tablesdb\/delete.md", @@ -26700,7 +26839,7 @@ "x-appwrite": { "method": "listTables", "group": "tables", - "weight": 393, + "weight": 351, "cookies": false, "type": "", "demo": "tablesdb\/list-tables.md", @@ -26800,7 +26939,7 @@ "x-appwrite": { "method": "createTable", "group": "tables", - "weight": 389, + "weight": 347, "cookies": false, "type": "", "demo": "tablesdb\/create-table.md", @@ -26927,7 +27066,7 @@ "x-appwrite": { "method": "getTable", "group": "tables", - "weight": 390, + "weight": 348, "cookies": false, "type": "", "demo": "tablesdb\/get-table.md", @@ -27002,7 +27141,7 @@ "x-appwrite": { "method": "updateTable", "group": "tables", - "weight": 391, + "weight": 349, "cookies": false, "type": "", "demo": "tablesdb\/update-table.md", @@ -27083,10 +27222,7 @@ "description": "Is table enabled? When set to 'disabled', users cannot access the table but Server SDKs with and API key can still read and write to the table. No data is lost when this is toggled.", "x-example": false } - }, - "required": [ - "name" - ] + } } } } @@ -27108,7 +27244,7 @@ "x-appwrite": { "method": "deleteTable", "group": "tables", - "weight": 392, + "weight": 350, "cookies": false, "type": "", "demo": "tablesdb\/delete-table.md", @@ -27185,7 +27321,7 @@ "x-appwrite": { "method": "listColumns", "group": "columns", - "weight": 398, + "weight": 356, "cookies": false, "type": "", "demo": "tablesdb\/list-columns.md", @@ -27286,7 +27422,7 @@ "x-appwrite": { "method": "createBooleanColumn", "group": "columns", - "weight": 399, + "weight": 357, "cookies": false, "type": "", "demo": "tablesdb\/create-boolean-column.md", @@ -27399,7 +27535,7 @@ "x-appwrite": { "method": "updateBooleanColumn", "group": "columns", - "weight": 400, + "weight": 358, "cookies": false, "type": "", "demo": "tablesdb\/update-boolean-column.md", @@ -27517,7 +27653,7 @@ "x-appwrite": { "method": "createDatetimeColumn", "group": "columns", - "weight": 401, + "weight": 359, "cookies": false, "type": "", "demo": "tablesdb\/create-datetime-column.md", @@ -27630,7 +27766,7 @@ "x-appwrite": { "method": "updateDatetimeColumn", "group": "columns", - "weight": 402, + "weight": 360, "cookies": false, "type": "", "demo": "tablesdb\/update-datetime-column.md", @@ -27748,7 +27884,7 @@ "x-appwrite": { "method": "createEmailColumn", "group": "columns", - "weight": 403, + "weight": 361, "cookies": false, "type": "", "demo": "tablesdb\/create-email-column.md", @@ -27819,6 +27955,7 @@ "type": "string", "description": "Default value for column when not provided. Cannot be set when column is required.", "x-example": "email@example.com", + "format": "email", "x-nullable": true }, "array": { @@ -27861,7 +27998,7 @@ "x-appwrite": { "method": "updateEmailColumn", "group": "columns", - "weight": 404, + "weight": 362, "cookies": false, "type": "", "demo": "tablesdb\/update-email-column.md", @@ -27936,6 +28073,7 @@ "type": "string", "description": "Default value for column when not provided. Cannot be set when column is required.", "x-example": "email@example.com", + "format": "email", "x-nullable": true }, "newKey": { @@ -27979,7 +28117,7 @@ "x-appwrite": { "method": "createEnumColumn", "group": "columns", - "weight": 405, + "weight": 363, "cookies": false, "type": "", "demo": "tablesdb\/create-enum-column.md", @@ -28101,7 +28239,7 @@ "x-appwrite": { "method": "updateEnumColumn", "group": "columns", - "weight": 406, + "weight": 364, "cookies": false, "type": "", "demo": "tablesdb\/update-enum-column.md", @@ -28228,7 +28366,7 @@ "x-appwrite": { "method": "createFloatColumn", "group": "columns", - "weight": 407, + "weight": 365, "cookies": false, "type": "", "demo": "tablesdb\/create-float-column.md", @@ -28299,18 +28437,21 @@ "type": "number", "description": "Minimum value", "x-example": null, + "format": "float", "x-nullable": true }, "max": { "type": "number", "description": "Maximum value", "x-example": null, + "format": "float", "x-nullable": true }, "default": { "type": "number", "description": "Default value. Cannot be set when required.", "x-example": null, + "format": "float", "x-nullable": true }, "array": { @@ -28353,7 +28494,7 @@ "x-appwrite": { "method": "updateFloatColumn", "group": "columns", - "weight": 408, + "weight": 366, "cookies": false, "type": "", "demo": "tablesdb\/update-float-column.md", @@ -28428,18 +28569,21 @@ "type": "number", "description": "Minimum value", "x-example": null, + "format": "float", "x-nullable": true }, "max": { "type": "number", "description": "Maximum value", "x-example": null, + "format": "float", "x-nullable": true }, "default": { "type": "number", "description": "Default value. Cannot be set when required.", "x-example": null, + "format": "float", "x-nullable": true }, "newKey": { @@ -28483,7 +28627,7 @@ "x-appwrite": { "method": "createIntegerColumn", "group": "columns", - "weight": 409, + "weight": 367, "cookies": false, "type": "", "demo": "tablesdb\/create-integer-column.md", @@ -28554,18 +28698,21 @@ "type": "integer", "description": "Minimum value", "x-example": null, + "format": "int64", "x-nullable": true }, "max": { "type": "integer", "description": "Maximum value", "x-example": null, + "format": "int64", "x-nullable": true }, "default": { "type": "integer", "description": "Default value. Cannot be set when column is required.", "x-example": null, + "format": "int64", "x-nullable": true }, "array": { @@ -28608,7 +28755,7 @@ "x-appwrite": { "method": "updateIntegerColumn", "group": "columns", - "weight": 410, + "weight": 368, "cookies": false, "type": "", "demo": "tablesdb\/update-integer-column.md", @@ -28683,18 +28830,21 @@ "type": "integer", "description": "Minimum value", "x-example": null, + "format": "int64", "x-nullable": true }, "max": { "type": "integer", "description": "Maximum value", "x-example": null, + "format": "int64", "x-nullable": true }, "default": { "type": "integer", "description": "Default value. Cannot be set when column is required.", "x-example": null, + "format": "int64", "x-nullable": true }, "newKey": { @@ -28738,7 +28888,7 @@ "x-appwrite": { "method": "createIpColumn", "group": "columns", - "weight": 411, + "weight": 369, "cookies": false, "type": "", "demo": "tablesdb\/create-ip-column.md", @@ -28851,7 +29001,7 @@ "x-appwrite": { "method": "updateIpColumn", "group": "columns", - "weight": 412, + "weight": 370, "cookies": false, "type": "", "demo": "tablesdb\/update-ip-column.md", @@ -28969,7 +29119,7 @@ "x-appwrite": { "method": "createLineColumn", "group": "columns", - "weight": 413, + "weight": 371, "cookies": false, "type": "", "demo": "tablesdb\/create-line-column.md", @@ -29084,7 +29234,7 @@ "x-appwrite": { "method": "updateLineColumn", "group": "columns", - "weight": 414, + "weight": 372, "cookies": false, "type": "", "demo": "tablesdb\/update-line-column.md", @@ -29208,7 +29358,7 @@ "x-appwrite": { "method": "createPointColumn", "group": "columns", - "weight": 415, + "weight": 373, "cookies": false, "type": "", "demo": "tablesdb\/create-point-column.md", @@ -29323,7 +29473,7 @@ "x-appwrite": { "method": "updatePointColumn", "group": "columns", - "weight": 416, + "weight": 374, "cookies": false, "type": "", "demo": "tablesdb\/update-point-column.md", @@ -29447,7 +29597,7 @@ "x-appwrite": { "method": "createPolygonColumn", "group": "columns", - "weight": 417, + "weight": 375, "cookies": false, "type": "", "demo": "tablesdb\/create-polygon-column.md", @@ -29562,7 +29712,7 @@ "x-appwrite": { "method": "updatePolygonColumn", "group": "columns", - "weight": 418, + "weight": 376, "cookies": false, "type": "", "demo": "tablesdb\/update-polygon-column.md", @@ -29686,7 +29836,7 @@ "x-appwrite": { "method": "createRelationshipColumn", "group": "columns", - "weight": 419, + "weight": 377, "cookies": false, "type": "", "demo": "tablesdb\/create-relationship-column.md", @@ -29825,7 +29975,7 @@ "x-appwrite": { "method": "createStringColumn", "group": "columns", - "weight": 421, + "weight": 379, "cookies": false, "type": "", "demo": "tablesdb\/create-string-column.md", @@ -29890,7 +30040,8 @@ "size": { "type": "integer", "description": "Column size for text columns, in number of characters.", - "x-example": 1 + "x-example": 1, + "format": "int32" }, "required": { "type": "boolean", @@ -29949,7 +30100,7 @@ "x-appwrite": { "method": "updateStringColumn", "group": "columns", - "weight": 422, + "weight": 380, "cookies": false, "type": "", "demo": "tablesdb\/update-string-column.md", @@ -30030,6 +30181,7 @@ "type": "integer", "description": "Maximum size of the string column.", "x-example": 1, + "format": "int32", "x-nullable": true }, "newKey": { @@ -30073,7 +30225,7 @@ "x-appwrite": { "method": "createUrlColumn", "group": "columns", - "weight": 423, + "weight": 381, "cookies": false, "type": "", "demo": "tablesdb\/create-url-column.md", @@ -30144,6 +30296,7 @@ "type": "string", "description": "Default value for column when not provided. Cannot be set when column is required.", "x-example": "https:\/\/example.com", + "format": "url", "x-nullable": true }, "array": { @@ -30186,7 +30339,7 @@ "x-appwrite": { "method": "updateUrlColumn", "group": "columns", - "weight": 424, + "weight": 382, "cookies": false, "type": "", "demo": "tablesdb\/update-url-column.md", @@ -30261,6 +30414,7 @@ "type": "string", "description": "Default value for column when not provided. Cannot be set when column is required.", "x-example": "https:\/\/example.com", + "format": "url", "x-nullable": true }, "newKey": { @@ -30335,7 +30489,7 @@ "x-appwrite": { "method": "getColumn", "group": "columns", - "weight": 396, + "weight": 354, "cookies": false, "type": "", "demo": "tablesdb\/get-column.md", @@ -30412,7 +30566,7 @@ "x-appwrite": { "method": "deleteColumn", "group": "columns", - "weight": 397, + "weight": 355, "cookies": false, "type": "", "demo": "tablesdb\/delete-column.md", @@ -30498,7 +30652,7 @@ "x-appwrite": { "method": "updateRelationshipColumn", "group": "columns", - "weight": 420, + "weight": 378, "cookies": false, "type": "", "demo": "tablesdb\/update-relationship-column.md", @@ -30614,7 +30768,7 @@ "x-appwrite": { "method": "listIndexes", "group": "indexes", - "weight": 428, + "weight": 386, "cookies": false, "type": "", "demo": "tablesdb\/list-indexes.md", @@ -30713,7 +30867,7 @@ "x-appwrite": { "method": "createIndex", "group": "indexes", - "weight": 425, + "weight": 383, "cookies": false, "type": "", "demo": "tablesdb\/create-index.md", @@ -30854,7 +31008,7 @@ "x-appwrite": { "method": "getIndex", "group": "indexes", - "weight": 426, + "weight": 384, "cookies": false, "type": "", "demo": "tablesdb\/get-index.md", @@ -30931,7 +31085,7 @@ "x-appwrite": { "method": "deleteIndex", "group": "indexes", - "weight": 427, + "weight": 385, "cookies": false, "type": "", "demo": "tablesdb\/delete-index.md", @@ -31017,7 +31171,7 @@ "x-appwrite": { "method": "listRows", "group": "rows", - "weight": 437, + "weight": 395, "cookies": false, "type": "", "demo": "tablesdb\/list-rows.md", @@ -31130,7 +31284,7 @@ "x-appwrite": { "method": "createRow", "group": "rows", - "weight": 429, + "weight": 387, "cookies": false, "type": "", "demo": "tablesdb\/create-row.md", @@ -31316,7 +31470,7 @@ "x-appwrite": { "method": "upsertRows", "group": "rows", - "weight": 434, + "weight": 392, "cookies": false, "type": "", "demo": "tablesdb\/upsert-rows.md", @@ -31450,7 +31604,7 @@ "x-appwrite": { "method": "updateRows", "group": "rows", - "weight": 432, + "weight": 390, "cookies": false, "type": "", "demo": "tablesdb\/update-rows.md", @@ -31555,7 +31709,7 @@ "x-appwrite": { "method": "deleteRows", "group": "rows", - "weight": 436, + "weight": 394, "cookies": false, "type": "", "demo": "tablesdb\/delete-rows.md", @@ -31657,7 +31811,7 @@ "x-appwrite": { "method": "getRow", "group": "rows", - "weight": 430, + "weight": 388, "cookies": false, "type": "", "demo": "tablesdb\/get-row.md", @@ -31769,7 +31923,7 @@ "x-appwrite": { "method": "upsertRow", "group": "rows", - "weight": 433, + "weight": 391, "cookies": false, "type": "", "demo": "tablesdb\/upsert-row.md", @@ -31922,7 +32076,7 @@ "x-appwrite": { "method": "updateRow", "group": "rows", - "weight": 431, + "weight": 389, "cookies": false, "type": "", "demo": "tablesdb\/update-row.md", @@ -32035,7 +32189,7 @@ "x-appwrite": { "method": "deleteRow", "group": "rows", - "weight": 435, + "weight": 393, "cookies": false, "type": "", "demo": "tablesdb\/delete-row.md", @@ -32143,7 +32297,7 @@ "x-appwrite": { "method": "decrementRowColumn", "group": "rows", - "weight": 440, + "weight": 398, "cookies": false, "type": "", "demo": "tablesdb\/decrement-row-column.md", @@ -32226,12 +32380,14 @@ "value": { "type": "number", "description": "Value to increment the column by. The value must be a number.", - "x-example": null + "x-example": null, + "format": "float" }, "min": { "type": "number", "description": "Minimum value for the column. If the current value is lesser than this value, an exception will be thrown.", "x-example": null, + "format": "float", "x-nullable": true }, "transactionId": { @@ -32271,7 +32427,7 @@ "x-appwrite": { "method": "incrementRowColumn", "group": "rows", - "weight": 439, + "weight": 397, "cookies": false, "type": "", "demo": "tablesdb\/increment-row-column.md", @@ -32354,12 +32510,14 @@ "value": { "type": "number", "description": "Value to increment the column by. The value must be a number.", - "x-example": null + "x-example": null, + "format": "float" }, "max": { "type": "number", "description": "Maximum value for the column. If the current value is greater than this value, an error will be thrown.", "x-example": null, + "format": "float", "x-nullable": true }, "transactionId": { @@ -32399,7 +32557,7 @@ "x-appwrite": { "method": "list", "group": "teams", - "weight": 162, + "weight": 110, "cookies": false, "type": "", "demo": "teams\/list.md", @@ -32490,7 +32648,7 @@ "x-appwrite": { "method": "create", "group": "teams", - "weight": 161, + "weight": 109, "cookies": false, "type": "", "demo": "teams\/create.md", @@ -32579,7 +32737,7 @@ "x-appwrite": { "method": "get", "group": "teams", - "weight": 163, + "weight": 111, "cookies": false, "type": "", "demo": "teams\/get.md", @@ -32645,7 +32803,7 @@ "x-appwrite": { "method": "updateName", "group": "teams", - "weight": 165, + "weight": 113, "cookies": false, "type": "", "demo": "teams\/update-name.md", @@ -32723,7 +32881,7 @@ "x-appwrite": { "method": "delete", "group": "teams", - "weight": 167, + "weight": 115, "cookies": false, "type": "", "demo": "teams\/delete.md", @@ -32791,7 +32949,7 @@ "x-appwrite": { "method": "listMemberships", "group": "memberships", - "weight": 169, + "weight": 117, "cookies": false, "type": "", "demo": "teams\/list-memberships.md", @@ -32892,7 +33050,7 @@ "x-appwrite": { "method": "createMembership", "group": "memberships", - "weight": 168, + "weight": 116, "cookies": false, "type": "", "demo": "teams\/create-membership.md", @@ -32943,7 +33101,8 @@ "email": { "type": "string", "description": "Email of the new team member.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "userId": { "type": "string", @@ -32953,7 +33112,8 @@ "phone": { "type": "string", "description": "Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "roles": { "type": "array", @@ -32973,7 +33133,8 @@ "url": { "type": "string", "description": "URL to redirect the user back to your app from the invitation email. This parameter is not required when an API key is supplied. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.", - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" }, "name": { "type": "string", @@ -33014,7 +33175,7 @@ "x-appwrite": { "method": "getMembership", "group": "memberships", - "weight": 170, + "weight": 118, "cookies": false, "type": "", "demo": "teams\/get-membership.md", @@ -33090,7 +33251,7 @@ "x-appwrite": { "method": "updateMembership", "group": "memberships", - "weight": 171, + "weight": 119, "cookies": false, "type": "", "demo": "teams\/update-membership.md", @@ -33188,7 +33349,7 @@ "x-appwrite": { "method": "deleteMembership", "group": "memberships", - "weight": 173, + "weight": 121, "cookies": false, "type": "", "demo": "teams\/delete-membership.md", @@ -33266,7 +33427,7 @@ "x-appwrite": { "method": "updateMembershipStatus", "group": "memberships", - "weight": 172, + "weight": 120, "cookies": false, "type": "", "demo": "teams\/update-membership-status.md", @@ -33367,7 +33528,7 @@ "x-appwrite": { "method": "getPrefs", "group": "teams", - "weight": 164, + "weight": 112, "cookies": false, "type": "", "demo": "teams\/get-prefs.md", @@ -33431,7 +33592,7 @@ "x-appwrite": { "method": "updatePrefs", "group": "teams", - "weight": 166, + "weight": 114, "cookies": false, "type": "", "demo": "teams\/update-prefs.md", @@ -33516,7 +33677,7 @@ "x-appwrite": { "method": "list", "group": "files", - "weight": 523, + "weight": 517, "cookies": false, "type": "", "demo": "tokens\/list.md", @@ -33611,7 +33772,7 @@ "x-appwrite": { "method": "createFileToken", "group": "files", - "weight": 521, + "weight": 515, "cookies": false, "type": "", "demo": "tokens\/create-file-token.md", @@ -33701,7 +33862,7 @@ "x-appwrite": { "method": "get", "group": "tokens", - "weight": 522, + "weight": 516, "cookies": false, "type": "", "demo": "tokens\/get.md", @@ -33762,7 +33923,7 @@ "x-appwrite": { "method": "update", "group": "tokens", - "weight": 524, + "weight": 518, "cookies": false, "type": "", "demo": "tokens\/update.md", @@ -33833,7 +33994,7 @@ "x-appwrite": { "method": "delete", "group": "tokens", - "weight": 525, + "weight": 519, "cookies": false, "type": "", "demo": "tokens\/delete.md", @@ -33896,7 +34057,7 @@ "x-appwrite": { "method": "list", "group": "users", - "weight": 184, + "weight": 132, "cookies": false, "type": "", "demo": "users\/list.md", @@ -33983,7 +34144,7 @@ "x-appwrite": { "method": "create", "group": "users", - "weight": 175, + "weight": 123, "cookies": false, "type": "", "demo": "users\/create.md", @@ -34024,12 +34185,14 @@ "type": "string", "description": "User email.", "x-example": "email@example.com", + "format": "email", "x-nullable": true }, "phone": { "type": "string", "description": "Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", "x-example": "+12065550100", + "format": "phone", "x-nullable": true }, "password": { @@ -34076,7 +34239,7 @@ "x-appwrite": { "method": "createArgon2User", "group": "users", - "weight": 178, + "weight": 126, "cookies": false, "type": "", "demo": "users\/create-argon-2-user.md", @@ -34116,12 +34279,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using Argon2.", - "x-example": "password" + "x-example": "password", + "format": "password" }, "name": { "type": "string", @@ -34164,7 +34329,7 @@ "x-appwrite": { "method": "createBcryptUser", "group": "users", - "weight": 176, + "weight": 124, "cookies": false, "type": "", "demo": "users\/create-bcrypt-user.md", @@ -34204,12 +34369,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using Bcrypt.", - "x-example": "password" + "x-example": "password", + "format": "password" }, "name": { "type": "string", @@ -34252,7 +34419,7 @@ "x-appwrite": { "method": "listIdentities", "group": "identities", - "weight": 192, + "weight": 140, "cookies": false, "type": "", "demo": "users\/list-identities.md", @@ -34334,7 +34501,7 @@ "x-appwrite": { "method": "deleteIdentity", "group": "identities", - "weight": 215, + "weight": 163, "cookies": false, "type": "", "demo": "users\/delete-identity.md", @@ -34398,7 +34565,7 @@ "x-appwrite": { "method": "createMD5User", "group": "users", - "weight": 177, + "weight": 125, "cookies": false, "type": "", "demo": "users\/create-md-5-user.md", @@ -34438,12 +34605,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using MD5.", - "x-example": "password" + "x-example": "password", + "format": "password" }, "name": { "type": "string", @@ -34486,7 +34655,7 @@ "x-appwrite": { "method": "createPHPassUser", "group": "users", - "weight": 180, + "weight": 128, "cookies": false, "type": "", "demo": "users\/create-ph-pass-user.md", @@ -34526,12 +34695,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using PHPass.", - "x-example": "password" + "x-example": "password", + "format": "password" }, "name": { "type": "string", @@ -34574,7 +34745,7 @@ "x-appwrite": { "method": "createScryptUser", "group": "users", - "weight": 181, + "weight": 129, "cookies": false, "type": "", "demo": "users\/create-scrypt-user.md", @@ -34614,12 +34785,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using Scrypt.", - "x-example": "password" + "x-example": "password", + "format": "password" }, "passwordSalt": { "type": "string", @@ -34629,22 +34802,26 @@ "passwordCpu": { "type": "integer", "description": "Optional CPU cost used to hash password.", - "x-example": null + "x-example": null, + "format": "int32" }, "passwordMemory": { "type": "integer", "description": "Optional memory cost used to hash password.", - "x-example": null + "x-example": null, + "format": "int32" }, "passwordParallel": { "type": "integer", "description": "Optional parallelization cost used to hash password.", - "x-example": null + "x-example": null, + "format": "int32" }, "passwordLength": { "type": "integer", "description": "Optional hash length used to hash password.", - "x-example": null + "x-example": null, + "format": "int32" }, "name": { "type": "string", @@ -34692,7 +34869,7 @@ "x-appwrite": { "method": "createScryptModifiedUser", "group": "users", - "weight": 182, + "weight": 130, "cookies": false, "type": "", "demo": "users\/create-scrypt-modified-user.md", @@ -34732,12 +34909,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using Scrypt Modified.", - "x-example": "password" + "x-example": "password", + "format": "password" }, "passwordSalt": { "type": "string", @@ -34798,7 +34977,7 @@ "x-appwrite": { "method": "createSHAUser", "group": "users", - "weight": 179, + "weight": 127, "cookies": false, "type": "", "demo": "users\/create-sha-user.md", @@ -34838,12 +35017,14 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using SHA.", - "x-example": "password" + "x-example": "password", + "format": "password" }, "passwordVersion": { "type": "string", @@ -34906,7 +35087,7 @@ "x-appwrite": { "method": "get", "group": "users", - "weight": 185, + "weight": 133, "cookies": false, "type": "", "demo": "users\/get.md", @@ -34961,7 +35142,7 @@ "x-appwrite": { "method": "delete", "group": "users", - "weight": 213, + "weight": 161, "cookies": false, "type": "", "demo": "users\/delete.md", @@ -35025,7 +35206,7 @@ "x-appwrite": { "method": "updateEmail", "group": "users", - "weight": 198, + "weight": 146, "cookies": false, "type": "", "demo": "users\/update-email.md", @@ -35072,7 +35253,8 @@ "email": { "type": "string", "description": "User email.", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" } }, "required": [ @@ -35108,7 +35290,7 @@ "x-appwrite": { "method": "createJWT", "group": "sessions", - "weight": 216, + "weight": 164, "cookies": false, "type": "", "demo": "users\/create-jwt.md", @@ -35160,7 +35342,8 @@ "duration": { "type": "integer", "description": "Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds.", - "x-example": 0 + "x-example": 0, + "format": "int32" } } } @@ -35193,7 +35376,7 @@ "x-appwrite": { "method": "updateLabels", "group": "users", - "weight": 194, + "weight": 142, "cookies": false, "type": "", "demo": "users\/update-labels.md", @@ -35279,7 +35462,7 @@ "x-appwrite": { "method": "listLogs", "group": "logs", - "weight": 190, + "weight": 138, "cookies": false, "type": "", "demo": "users\/list-logs.md", @@ -35367,7 +35550,7 @@ "x-appwrite": { "method": "listMemberships", "group": "memberships", - "weight": 189, + "weight": 137, "cookies": false, "type": "", "demo": "users\/list-memberships.md", @@ -35466,7 +35649,7 @@ "x-appwrite": { "method": "updateMfa", "group": "users", - "weight": 203, + "weight": 151, "cookies": false, "type": "", "demo": "users\/update-mfa.md", @@ -35604,7 +35787,7 @@ "x-appwrite": { "method": "deleteMfaAuthenticator", "group": "mfa", - "weight": 208, + "weight": 156, "cookies": false, "type": "", "demo": "users\/delete-mfa-authenticator.md", @@ -35743,7 +35926,7 @@ "x-appwrite": { "method": "listMfaFactors", "group": "mfa", - "weight": 204, + "weight": 152, "cookies": false, "type": "", "demo": "users\/list-mfa-factors.md", @@ -35865,7 +36048,7 @@ "x-appwrite": { "method": "getMfaRecoveryCodes", "group": "mfa", - "weight": 205, + "weight": 153, "cookies": false, "type": "", "demo": "users\/get-mfa-recovery-codes.md", @@ -35985,7 +36168,7 @@ "x-appwrite": { "method": "updateMfaRecoveryCodes", "group": "mfa", - "weight": 207, + "weight": 155, "cookies": false, "type": "", "demo": "users\/update-mfa-recovery-codes.md", @@ -36105,7 +36288,7 @@ "x-appwrite": { "method": "createMfaRecoveryCodes", "group": "mfa", - "weight": 206, + "weight": 154, "cookies": false, "type": "", "demo": "users\/create-mfa-recovery-codes.md", @@ -36227,7 +36410,7 @@ "x-appwrite": { "method": "updateName", "group": "users", - "weight": 196, + "weight": 144, "cookies": false, "type": "", "demo": "users\/update-name.md", @@ -36310,7 +36493,7 @@ "x-appwrite": { "method": "updatePassword", "group": "users", - "weight": 197, + "weight": 145, "cookies": false, "type": "", "demo": "users\/update-password.md", @@ -36393,7 +36576,7 @@ "x-appwrite": { "method": "updatePhone", "group": "users", - "weight": 199, + "weight": 147, "cookies": false, "type": "", "demo": "users\/update-phone.md", @@ -36440,7 +36623,8 @@ "number": { "type": "string", "description": "User phone number.", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" } }, "required": [ @@ -36476,7 +36660,7 @@ "x-appwrite": { "method": "getPrefs", "group": "users", - "weight": 186, + "weight": 134, "cookies": false, "type": "", "demo": "users\/get-prefs.md", @@ -36538,7 +36722,7 @@ "x-appwrite": { "method": "updatePrefs", "group": "users", - "weight": 201, + "weight": 149, "cookies": false, "type": "", "demo": "users\/update-prefs.md", @@ -36621,7 +36805,7 @@ "x-appwrite": { "method": "listSessions", "group": "sessions", - "weight": 188, + "weight": 136, "cookies": false, "type": "", "demo": "users\/list-sessions.md", @@ -36694,7 +36878,7 @@ "x-appwrite": { "method": "createSession", "group": "sessions", - "weight": 209, + "weight": 157, "cookies": false, "type": "", "demo": "users\/create-session.md", @@ -36749,7 +36933,7 @@ "x-appwrite": { "method": "deleteSessions", "group": "sessions", - "weight": 212, + "weight": 160, "cookies": false, "type": "", "demo": "users\/delete-sessions.md", @@ -36806,7 +36990,7 @@ "x-appwrite": { "method": "deleteSession", "group": "sessions", - "weight": 211, + "weight": 159, "cookies": false, "type": "", "demo": "users\/delete-session.md", @@ -36880,7 +37064,7 @@ "x-appwrite": { "method": "updateStatus", "group": "users", - "weight": 193, + "weight": 141, "cookies": false, "type": "", "demo": "users\/update-status.md", @@ -36963,7 +37147,7 @@ "x-appwrite": { "method": "listTargets", "group": "targets", - "weight": 191, + "weight": 139, "cookies": false, "type": "", "demo": "users\/list-targets.md", @@ -37049,7 +37233,7 @@ "x-appwrite": { "method": "createTarget", "group": "targets", - "weight": 183, + "weight": 131, "cookies": false, "type": "", "demo": "users\/create-target.md", @@ -37161,7 +37345,7 @@ "x-appwrite": { "method": "getTarget", "group": "targets", - "weight": 187, + "weight": 135, "cookies": false, "type": "", "demo": "users\/get-target.md", @@ -37233,7 +37417,7 @@ "x-appwrite": { "method": "updateTarget", "group": "targets", - "weight": 202, + "weight": 150, "cookies": false, "type": "", "demo": "users\/update-target.md", @@ -37324,7 +37508,7 @@ "x-appwrite": { "method": "deleteTarget", "group": "targets", - "weight": 214, + "weight": 162, "cookies": false, "type": "", "demo": "users\/delete-target.md", @@ -37398,7 +37582,7 @@ "x-appwrite": { "method": "createToken", "group": "sessions", - "weight": 210, + "weight": 158, "cookies": false, "type": "", "demo": "users\/create-token.md", @@ -37445,12 +37629,14 @@ "length": { "type": "integer", "description": "Token length in characters. The default length is 6 characters", - "x-example": 4 + "x-example": 4, + "format": "int32" }, "expire": { "type": "integer", "description": "Token expiration period in seconds. The default expiration is 15 minutes.", - "x-example": 60 + "x-example": 60, + "format": "int32" } } } @@ -37483,7 +37669,7 @@ "x-appwrite": { "method": "updateEmailVerification", "group": "users", - "weight": 200, + "weight": 148, "cookies": false, "type": "", "demo": "users\/update-email-verification.md", @@ -37566,7 +37752,7 @@ "x-appwrite": { "method": "updatePhoneVerification", "group": "users", - "weight": 195, + "weight": 143, "cookies": false, "type": "", "demo": "users\/update-phone-verification.md", @@ -37689,7 +37875,7 @@ }, { "name": "console", - "description": "The Console service allows you to interact with console relevant informations." + "description": "The Console service allows you to interact with console relevant information." }, { "name": "migrations", @@ -38530,6 +38716,34 @@ "variables": "" } }, + "healthStatusList": { + "description": "Status List", + "type": "object", + "properties": { + "total": { + "type": "integer", + "description": "Total number of statuses that matched your query.", + "x-example": 5, + "format": "int32" + }, + "statuses": { + "type": "array", + "description": "List of statuses.", + "items": { + "$ref": "#\/components\/schemas\/healthStatus" + }, + "x-example": "" + } + }, + "required": [ + "total", + "statuses" + ], + "example": { + "total": 5, + "statuses": "" + } + }, "localeCodeList": { "description": "Locale codes list", "type": "object", @@ -39164,14 +39378,14 @@ "type": "integer", "description": "Minimum value to enforce for new documents.", "x-example": 1, - "format": "int32", + "format": "int64", "nullable": true }, "max": { "type": "integer", "description": "Maximum value to enforce for new documents.", "x-example": 10, - "format": "int32", + "format": "int64", "nullable": true }, "default": { @@ -40613,14 +40827,14 @@ "type": "integer", "description": "Minimum value to enforce for new documents.", "x-example": 1, - "format": "int32", + "format": "int64", "nullable": true }, "max": { "type": "integer", "description": "Maximum value to enforce for new documents.", "x-example": 10, - "format": "int32", + "format": "int64", "nullable": true }, "default": { @@ -43110,6 +43324,16 @@ "description": "Total number of chunks uploaded", "x-example": 17890, "format": "int32" + }, + "encryption": { + "type": "boolean", + "description": "Whether file contents are encrypted at rest.", + "x-example": true + }, + "compression": { + "type": "string", + "description": "Compression algorithm used for the file. Will be one of none, [gzip](https:\/\/en.wikipedia.org\/wiki\/Gzip), or [zstd](https:\/\/en.wikipedia.org\/wiki\/Zstd).", + "x-example": "gzip" } }, "required": [ @@ -43123,7 +43347,9 @@ "mimeType", "sizeOriginal", "chunksTotal", - "chunksUploaded" + "chunksUploaded", + "encryption", + "compression" ], "example": { "$id": "5e5ea5c16897e", @@ -43138,7 +43364,9 @@ "mimeType": "image\/png", "sizeOriginal": 17890, "chunksTotal": 17890, - "chunksUploaded": 17890 + "chunksUploaded": 17890, + "encryption": true, + "compression": "gzip" } }, "bucket": { @@ -43204,7 +43432,7 @@ }, "compression": { "type": "string", - "description": "Compression algorithm choosen for compression. Will be one of none, [gzip](https:\/\/en.wikipedia.org\/wiki\/Gzip), or [zstd](https:\/\/en.wikipedia.org\/wiki\/Zstd).", + "description": "Compression algorithm chosen for compression. Will be one of none, [gzip](https:\/\/en.wikipedia.org\/wiki\/Gzip), or [zstd](https:\/\/en.wikipedia.org\/wiki\/Zstd).", "x-example": "gzip" }, "encryption": { @@ -43221,6 +43449,12 @@ "type": "boolean", "description": "Image transformations are enabled.", "x-example": false + }, + "totalSize": { + "type": "integer", + "description": "Total size of this bucket in bytes.", + "x-example": 128, + "format": "int32" } }, "required": [ @@ -43236,7 +43470,8 @@ "compression", "encryption", "antivirus", - "transformations" + "transformations", + "totalSize" ], "example": { "$id": "5e5ea5c16897e", @@ -43256,7 +43491,8 @@ "compression": "gzip", "encryption": false, "antivirus": false, - "transformations": false + "transformations": false, + "totalSize": 128 } }, "resourceToken": { @@ -44190,13 +44426,14 @@ }, "status": { "type": "string", - "description": "The deployment status. Possible values are \"waiting\", \"processing\", \"building\", \"ready\", and \"failed\".", + "description": "The deployment status. Possible values are \"waiting\", \"processing\", \"building\", \"ready\", \"canceled\" and \"failed\".", "x-example": "ready", "enum": [ "waiting", "processing", "building", "ready", + "canceled", "failed" ] }, @@ -45272,7 +45509,7 @@ "status": { "type": "string", "description": "Status of delivery.", - "x-example": "Message status can be one of the following: draft, processing, scheduled, sent, or failed.", + "x-example": "processing", "enum": [ "draft", "processing", @@ -45318,7 +45555,7 @@ "subject": "Welcome to Appwrite", "content": "Hi there, welcome to Appwrite family." }, - "status": "Message status can be one of the following: draft, processing, scheduled, sent, or failed." + "status": "processing" } }, "topic": { diff --git a/app/config/specs/swagger2-1.8.x-client.json b/app/config/specs/swagger2-1.8.x-client.json index 3abbc9cde5..347e172dfd 100644 --- a/app/config/specs/swagger2-1.8.x-client.json +++ b/app/config/specs/swagger2-1.8.x-client.json @@ -1,7 +1,7 @@ { "swagger": "2.0", "info": { - "version": "1.8.0", + "version": "1.8.1", "title": "Appwrite", "description": "Appwrite backend as a service cuts up to 70% of the time and costs required for building a modern application. We abstract and simplify common development tasks behind a REST APIs, to help you develop your app in a fast and secure way. For full API documentation and tutorials go to [https:\/\/appwrite.io\/docs](https:\/\/appwrite.io\/docs)", "termsOfService": "https:\/\/appwrite.io\/policy\/terms", @@ -94,7 +94,7 @@ "x-appwrite": { "method": "get", "group": "account", - "weight": 10, + "weight": 9, "cookies": false, "type": "", "demo": "account\/get.md", @@ -147,7 +147,7 @@ "x-appwrite": { "method": "create", "group": "account", - "weight": 9, + "weight": 8, "cookies": false, "type": "", "demo": "account\/create.md", @@ -191,7 +191,8 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", @@ -242,7 +243,7 @@ "x-appwrite": { "method": "updateEmail", "group": "account", - "weight": 35, + "weight": 34, "cookies": false, "type": "", "demo": "account\/update-email.md", @@ -280,13 +281,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password. Must be at least 8 chars.", "default": null, - "x-example": "password" + "x-example": "password", + "format": "password" } }, "required": [ @@ -322,7 +325,7 @@ "x-appwrite": { "method": "listIdentities", "group": "identities", - "weight": 48, + "weight": 47, "cookies": false, "type": "", "demo": "account\/list-identities.md", @@ -395,7 +398,7 @@ "x-appwrite": { "method": "deleteIdentity", "group": "identities", - "weight": 49, + "weight": 48, "cookies": false, "type": "", "demo": "account\/delete-identity.md", @@ -460,12 +463,12 @@ "x-appwrite": { "method": "createJWT", "group": "tokens", - "weight": 30, + "weight": 29, "cookies": false, "type": "", "demo": "account\/create-jwt.md", - "rate-limit": 100, - "rate-time": 3600, + "rate-limit": 120, + "rate-time": 60, "rate-key": "url:{url},userId:{userId}", "scope": "account", "platforms": [ @@ -486,6 +489,24 @@ "Session": [], "JWT": [] } + ], + "parameters": [ + { + "name": "payload", + "in": "body", + "schema": { + "type": "object", + "properties": { + "duration": { + "type": "integer", + "description": "Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds.", + "default": 900, + "x-example": 0, + "format": "int32" + } + } + } + } ] } }, @@ -513,7 +534,7 @@ "x-appwrite": { "method": "listLogs", "group": "logs", - "weight": 32, + "weight": 31, "cookies": false, "type": "", "demo": "account\/list-logs.md", @@ -591,7 +612,7 @@ "x-appwrite": { "method": "updateMFA", "group": "mfa", - "weight": 306, + "weight": 253, "cookies": false, "type": "", "demo": "account\/update-mfa.md", @@ -666,7 +687,7 @@ "x-appwrite": { "method": "createMfaAuthenticator", "group": "mfa", - "weight": 308, + "weight": 255, "cookies": false, "type": "", "demo": "account\/create-mfa-authenticator.md", @@ -790,7 +811,7 @@ "x-appwrite": { "method": "updateMfaAuthenticator", "group": "mfa", - "weight": 309, + "weight": 256, "cookies": false, "type": "", "demo": "account\/update-mfa-authenticator.md", @@ -931,7 +952,7 @@ "x-appwrite": { "method": "deleteMfaAuthenticator", "group": "mfa", - "weight": 310, + "weight": 257, "cookies": false, "type": "", "demo": "account\/delete-mfa-authenticator.md", @@ -1055,7 +1076,7 @@ "x-appwrite": { "method": "createMfaChallenge", "group": "mfa", - "weight": 314, + "weight": 261, "cookies": false, "type": "", "demo": "account\/create-mfa-challenge.md", @@ -1192,7 +1213,7 @@ "x-appwrite": { "method": "updateMfaChallenge", "group": "mfa", - "weight": 315, + "weight": 262, "cookies": false, "type": "", "demo": "account\/update-mfa-challenge.md", @@ -1332,7 +1353,7 @@ "x-appwrite": { "method": "listMfaFactors", "group": "mfa", - "weight": 307, + "weight": 254, "cookies": false, "type": "", "demo": "account\/list-mfa-factors.md", @@ -1433,7 +1454,7 @@ "x-appwrite": { "method": "getMfaRecoveryCodes", "group": "mfa", - "weight": 313, + "weight": 260, "cookies": false, "type": "", "demo": "account\/get-mfa-recovery-codes.md", @@ -1534,7 +1555,7 @@ "x-appwrite": { "method": "createMfaRecoveryCodes", "group": "mfa", - "weight": 311, + "weight": 258, "cookies": false, "type": "", "demo": "account\/create-mfa-recovery-codes.md", @@ -1635,7 +1656,7 @@ "x-appwrite": { "method": "updateMfaRecoveryCodes", "group": "mfa", - "weight": 312, + "weight": 259, "cookies": false, "type": "", "demo": "account\/update-mfa-recovery-codes.md", @@ -1738,7 +1759,7 @@ "x-appwrite": { "method": "updateName", "group": "account", - "weight": 33, + "weight": 32, "cookies": false, "type": "", "demo": "account\/update-name.md", @@ -1813,7 +1834,7 @@ "x-appwrite": { "method": "updatePassword", "group": "account", - "weight": 34, + "weight": 33, "cookies": false, "type": "", "demo": "account\/update-password.md", @@ -1857,7 +1878,8 @@ "type": "string", "description": "Current user password. Must be at least 8 chars.", "default": "", - "x-example": "password" + "x-example": "password", + "format": "password" } }, "required": [ @@ -1894,7 +1916,7 @@ "x-appwrite": { "method": "updatePhone", "group": "account", - "weight": 36, + "weight": 35, "cookies": false, "type": "", "demo": "account\/update-phone.md", @@ -1932,13 +1954,15 @@ "type": "string", "description": "Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", "default": null, - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "password": { "type": "string", "description": "User password. Must be at least 8 chars.", "default": null, - "x-example": "password" + "x-example": "password", + "format": "password" } }, "required": [ @@ -1974,7 +1998,7 @@ "x-appwrite": { "method": "getPrefs", "group": "account", - "weight": 31, + "weight": 30, "cookies": false, "type": "", "demo": "account\/get-prefs.md", @@ -2027,7 +2051,7 @@ "x-appwrite": { "method": "updatePrefs", "group": "account", - "weight": 37, + "weight": 36, "cookies": false, "type": "", "demo": "account\/update-prefs.md", @@ -2102,7 +2126,7 @@ "x-appwrite": { "method": "createRecovery", "group": "recovery", - "weight": 39, + "weight": 38, "cookies": false, "type": "", "demo": "account\/create-recovery.md", @@ -2143,13 +2167,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "url": { "type": "string", "description": "URL to redirect the user back to your app from the recovery email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.", "default": null, - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" } }, "required": [ @@ -2185,7 +2211,7 @@ "x-appwrite": { "method": "updateRecovery", "group": "recovery", - "weight": 40, + "weight": 39, "cookies": false, "type": "", "demo": "account\/update-recovery.md", @@ -2272,7 +2298,7 @@ "x-appwrite": { "method": "listSessions", "group": "sessions", - "weight": 12, + "weight": 11, "cookies": false, "type": "", "demo": "account\/list-sessions.md", @@ -2320,7 +2346,7 @@ "x-appwrite": { "method": "deleteSessions", "group": "sessions", - "weight": 13, + "weight": 12, "cookies": false, "type": "", "demo": "account\/delete-sessions.md", @@ -2375,7 +2401,7 @@ "x-appwrite": { "method": "createAnonymousSession", "group": "sessions", - "weight": 18, + "weight": 17, "cookies": false, "type": "", "demo": "account\/create-anonymous-session.md", @@ -2430,7 +2456,7 @@ "x-appwrite": { "method": "createEmailPasswordSession", "group": "sessions", - "weight": 17, + "weight": 16, "cookies": false, "type": "", "demo": "account\/create-email-password-session.md", @@ -2468,13 +2494,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password. Must be at least 8 chars.", "default": null, - "x-example": "password" + "x-example": "password", + "format": "password" } }, "required": [ @@ -2512,7 +2540,7 @@ "x-appwrite": { "method": "updateMagicURLSession", "group": "sessions", - "weight": 27, + "weight": 26, "cookies": false, "type": "", "demo": "account\/update-magic-url-session.md", @@ -2593,7 +2621,7 @@ "x-appwrite": { "method": "createOAuth2Session", "group": "sessions", - "weight": 20, + "weight": 19, "cookies": false, "type": "webAuth", "demo": "account\/create-o-auth-2-session.md", @@ -2666,8 +2694,7 @@ "yammer", "yandex", "zoho", - "zoom", - "mock" + "zoom" ], "x-enum-name": "OAuthProvider", "x-enum-keys": [], @@ -2734,7 +2761,7 @@ "x-appwrite": { "method": "updatePhoneSession", "group": "sessions", - "weight": 28, + "weight": 27, "cookies": false, "type": "", "demo": "account\/update-phone-session.md", @@ -2820,7 +2847,7 @@ "x-appwrite": { "method": "createSession", "group": "sessions", - "weight": 19, + "weight": 18, "cookies": false, "type": "", "demo": "account\/create-session.md", @@ -2900,7 +2927,7 @@ "x-appwrite": { "method": "getSession", "group": "sessions", - "weight": 14, + "weight": 13, "cookies": false, "type": "", "demo": "account\/get-session.md", @@ -2963,7 +2990,7 @@ "x-appwrite": { "method": "updateSession", "group": "sessions", - "weight": 16, + "weight": 15, "cookies": false, "type": "", "demo": "account\/update-session.md", @@ -3021,7 +3048,7 @@ "x-appwrite": { "method": "deleteSession", "group": "sessions", - "weight": 15, + "weight": 14, "cookies": false, "type": "", "demo": "account\/delete-session.md", @@ -3086,7 +3113,7 @@ "x-appwrite": { "method": "updateStatus", "group": "account", - "weight": 38, + "weight": 37, "cookies": false, "type": "", "demo": "account\/update-status.md", @@ -3141,7 +3168,7 @@ "x-appwrite": { "method": "createPushTarget", "group": "pushTargets", - "weight": 45, + "weight": 44, "cookies": false, "type": "", "demo": "account\/create-push-target.md", @@ -3227,7 +3254,7 @@ "x-appwrite": { "method": "updatePushTarget", "group": "pushTargets", - "weight": 46, + "weight": 45, "cookies": false, "type": "", "demo": "account\/update-push-target.md", @@ -3301,7 +3328,7 @@ "x-appwrite": { "method": "deletePushTarget", "group": "pushTargets", - "weight": 47, + "weight": 46, "cookies": false, "type": "", "demo": "account\/delete-push-target.md", @@ -3364,7 +3391,7 @@ "x-appwrite": { "method": "createEmailToken", "group": "tokens", - "weight": 26, + "weight": 25, "cookies": false, "type": "", "demo": "account\/create-email-token.md", @@ -3411,7 +3438,8 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "phrase": { "type": "boolean", @@ -3455,7 +3483,7 @@ "x-appwrite": { "method": "createMagicURLToken", "group": "tokens", - "weight": 25, + "weight": 24, "cookies": false, "type": "", "demo": "account\/create-magic-url-token.md", @@ -3502,13 +3530,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "url": { "type": "string", "description": "URL to redirect the user back to your app from the magic URL login. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.", "default": "", - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" }, "phrase": { "type": "boolean", @@ -3547,7 +3577,7 @@ "x-appwrite": { "method": "createOAuth2Token", "group": "tokens", - "weight": 24, + "weight": 23, "cookies": false, "type": "webAuth", "demo": "account\/create-o-auth-2-token.md", @@ -3620,8 +3650,7 @@ "yammer", "yandex", "zoho", - "zoom", - "mock" + "zoom" ], "x-enum-name": "OAuthProvider", "x-enum-keys": [], @@ -3688,7 +3717,7 @@ "x-appwrite": { "method": "createPhoneToken", "group": "tokens", - "weight": 29, + "weight": 28, "cookies": false, "type": "", "demo": "account\/create-phone-token.md", @@ -3735,7 +3764,8 @@ "type": "string", "description": "Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", "default": null, - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" } }, "required": [ @@ -3773,7 +3803,7 @@ "x-appwrite": { "method": "createEmailVerification", "group": "verification", - "weight": 41, + "weight": 40, "cookies": false, "type": "", "demo": "account\/create-email-verification.md", @@ -3863,7 +3893,8 @@ "type": "string", "description": "URL to redirect the user back to your app from the verification email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.", "default": null, - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" } }, "required": [ @@ -3898,7 +3929,7 @@ "x-appwrite": { "method": "updateEmailVerification", "group": "verification", - "weight": 42, + "weight": 41, "cookies": false, "type": "", "demo": "account\/update-email-verification.md", @@ -4036,7 +4067,7 @@ "x-appwrite": { "method": "createPhoneVerification", "group": "verification", - "weight": 43, + "weight": 42, "cookies": false, "type": "", "demo": "account\/create-phone-verification.md", @@ -4092,7 +4123,7 @@ "x-appwrite": { "method": "updatePhoneVerification", "group": "verification", - "weight": 44, + "weight": 43, "cookies": false, "type": "", "demo": "account\/update-phone-verification.md", @@ -4172,7 +4203,7 @@ "x-appwrite": { "method": "getBrowser", "group": null, - "weight": 51, + "weight": 264, "cookies": false, "type": "location", "demo": "avatars\/get-browser.md", @@ -4298,7 +4329,7 @@ "x-appwrite": { "method": "getCreditCard", "group": null, - "weight": 50, + "weight": 263, "cookies": false, "type": "location", "demo": "avatars\/get-credit-card.md", @@ -4430,7 +4461,7 @@ "x-appwrite": { "method": "getFavicon", "group": null, - "weight": 54, + "weight": 267, "cookies": false, "type": "location", "demo": "avatars\/get-favicon.md", @@ -4494,7 +4525,7 @@ "x-appwrite": { "method": "getFlag", "group": null, - "weight": 52, + "weight": 265, "cookies": false, "type": "location", "demo": "avatars\/get-flag.md", @@ -4982,7 +5013,7 @@ "x-appwrite": { "method": "getImage", "group": null, - "weight": 53, + "weight": 266, "cookies": false, "type": "location", "demo": "avatars\/get-image.md", @@ -5066,7 +5097,7 @@ "x-appwrite": { "method": "getInitials", "group": null, - "weight": 56, + "weight": 269, "cookies": false, "type": "location", "demo": "avatars\/get-initials.md", @@ -5158,7 +5189,7 @@ "x-appwrite": { "method": "getQR", "group": null, - "weight": 55, + "weight": 268, "cookies": false, "type": "location", "demo": "avatars\/get-qr.md", @@ -5250,7 +5281,7 @@ "x-appwrite": { "method": "getScreenshot", "group": null, - "weight": 57, + "weight": 270, "cookies": false, "type": "location", "demo": "avatars\/get-screenshot.md", @@ -5931,7 +5962,7 @@ "avif", "gif" ], - "x-enum-name": null, + "x-enum-name": "ImageFormat", "x-enum-keys": [], "default": "", "in": "query" @@ -5963,7 +5994,7 @@ "x-appwrite": { "method": "listTransactions", "group": "transactions", - "weight": 380, + "weight": 338, "cookies": false, "type": "", "demo": "databases\/list-transactions.md", @@ -6030,7 +6061,7 @@ "x-appwrite": { "method": "createTransaction", "group": "transactions", - "weight": 376, + "weight": 334, "cookies": false, "type": "", "demo": "databases\/create-transaction.md", @@ -6068,7 +6099,8 @@ "type": "integer", "description": "Seconds before the transaction expires.", "default": 300, - "x-example": 60 + "x-example": 60, + "format": "int32" } } } @@ -6100,7 +6132,7 @@ "x-appwrite": { "method": "getTransaction", "group": "transactions", - "weight": 377, + "weight": 335, "cookies": false, "type": "", "demo": "databases\/get-transaction.md", @@ -6163,7 +6195,7 @@ "x-appwrite": { "method": "updateTransaction", "group": "transactions", - "weight": 378, + "weight": 336, "cookies": false, "type": "", "demo": "databases\/update-transaction.md", @@ -6242,7 +6274,7 @@ "x-appwrite": { "method": "deleteTransaction", "group": "transactions", - "weight": 379, + "weight": 337, "cookies": false, "type": "", "demo": "databases\/delete-transaction.md", @@ -6307,7 +6339,7 @@ "x-appwrite": { "method": "createOperations", "group": "transactions", - "weight": 381, + "weight": 339, "cookies": false, "type": "", "demo": "databases\/create-operations.md", @@ -6388,7 +6420,7 @@ "x-appwrite": { "method": "listDocuments", "group": "documents", - "weight": 339, + "weight": 297, "cookies": false, "type": "", "demo": "databases\/list-documents.md", @@ -6492,7 +6524,7 @@ "x-appwrite": { "method": "createDocument", "group": "documents", - "weight": 331, + "weight": 289, "cookies": false, "type": "", "demo": "databases\/create-document.md", @@ -6651,7 +6683,7 @@ "x-appwrite": { "method": "getDocument", "group": "documents", - "weight": 332, + "weight": 290, "cookies": false, "type": "", "demo": "databases\/get-document.md", @@ -6754,7 +6786,7 @@ "x-appwrite": { "method": "upsertDocument", "group": "documents", - "weight": 335, + "weight": 293, "cookies": false, "type": "", "demo": "databases\/upsert-document.md", @@ -6905,7 +6937,7 @@ "x-appwrite": { "method": "updateDocument", "group": "documents", - "weight": 333, + "weight": 291, "cookies": false, "type": "", "demo": "databases\/update-document.md", @@ -7015,7 +7047,7 @@ "x-appwrite": { "method": "deleteDocument", "group": "documents", - "weight": 337, + "weight": 295, "cookies": false, "type": "", "demo": "databases\/delete-document.md", @@ -7116,7 +7148,7 @@ "x-appwrite": { "method": "decrementDocumentAttribute", "group": "documents", - "weight": 342, + "weight": 300, "cookies": false, "type": "", "demo": "databases\/decrement-document-attribute.md", @@ -7189,13 +7221,15 @@ "type": "number", "description": "Value to increment the attribute by. The value must be a number.", "default": 1, - "x-example": null + "x-example": null, + "format": "float" }, "min": { "type": "number", "description": "Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "transactionId": { @@ -7237,7 +7271,7 @@ "x-appwrite": { "method": "incrementDocumentAttribute", "group": "documents", - "weight": 341, + "weight": 299, "cookies": false, "type": "", "demo": "databases\/increment-document-attribute.md", @@ -7310,13 +7344,15 @@ "type": "number", "description": "Value to increment the attribute by. The value must be a number.", "default": 1, - "x-example": null + "x-example": null, + "format": "float" }, "max": { "type": "number", "description": "Maximum value for the attribute. If the current value is greater than this value, an error will be thrown.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "transactionId": { @@ -7356,7 +7392,7 @@ "x-appwrite": { "method": "listExecutions", "group": "executions", - "weight": 472, + "weight": 431, "cookies": false, "type": "", "demo": "functions\/list-executions.md", @@ -7439,7 +7475,7 @@ "x-appwrite": { "method": "createExecution", "group": "executions", - "weight": 470, + "weight": 429, "cookies": false, "type": "", "demo": "functions\/create-execution.md", @@ -7558,7 +7594,7 @@ "x-appwrite": { "method": "getExecution", "group": "executions", - "weight": 471, + "weight": 430, "cookies": false, "type": "", "demo": "functions\/get-execution.md", @@ -7630,7 +7666,7 @@ "x-appwrite": { "method": "query", "group": "graphql", - "weight": 241, + "weight": 190, "cookies": false, "type": "graphql", "demo": "graphql\/query.md", @@ -7705,7 +7741,7 @@ "x-appwrite": { "method": "mutation", "group": "graphql", - "weight": 240, + "weight": 189, "cookies": false, "type": "graphql", "demo": "graphql\/mutation.md", @@ -7778,7 +7814,7 @@ "x-appwrite": { "method": "get", "group": null, - "weight": 61, + "weight": 49, "cookies": false, "type": "", "demo": "locale\/get.md", @@ -7831,7 +7867,7 @@ "x-appwrite": { "method": "listCodes", "group": null, - "weight": 62, + "weight": 50, "cookies": false, "type": "", "demo": "locale\/list-codes.md", @@ -7884,7 +7920,7 @@ "x-appwrite": { "method": "listContinents", "group": null, - "weight": 66, + "weight": 54, "cookies": false, "type": "", "demo": "locale\/list-continents.md", @@ -7937,7 +7973,7 @@ "x-appwrite": { "method": "listCountries", "group": null, - "weight": 63, + "weight": 51, "cookies": false, "type": "", "demo": "locale\/list-countries.md", @@ -7990,7 +8026,7 @@ "x-appwrite": { "method": "listCountriesEU", "group": null, - "weight": 64, + "weight": 52, "cookies": false, "type": "", "demo": "locale\/list-countries-eu.md", @@ -8043,7 +8079,7 @@ "x-appwrite": { "method": "listCountriesPhones", "group": null, - "weight": 65, + "weight": 53, "cookies": false, "type": "", "demo": "locale\/list-countries-phones.md", @@ -8096,7 +8132,7 @@ "x-appwrite": { "method": "listCurrencies", "group": null, - "weight": 67, + "weight": 55, "cookies": false, "type": "", "demo": "locale\/list-currencies.md", @@ -8149,7 +8185,7 @@ "x-appwrite": { "method": "listLanguages", "group": null, - "weight": 68, + "weight": 56, "cookies": false, "type": "", "demo": "locale\/list-languages.md", @@ -8204,7 +8240,7 @@ "x-appwrite": { "method": "createSubscriber", "group": "subscribers", - "weight": 290, + "weight": 237, "cookies": false, "type": "", "demo": "messaging\/create-subscriber.md", @@ -8289,7 +8325,7 @@ "x-appwrite": { "method": "deleteSubscriber", "group": "subscribers", - "weight": 294, + "weight": 241, "cookies": false, "type": "", "demo": "messaging\/delete-subscriber.md", @@ -8360,7 +8396,7 @@ "x-appwrite": { "method": "listFiles", "group": "files", - "weight": 151, + "weight": 527, "cookies": false, "type": "", "demo": "storage\/list-files.md", @@ -8453,7 +8489,7 @@ "x-appwrite": { "method": "createFile", "group": "files", - "weight": 150, + "weight": 525, "cookies": false, "type": "upload", "demo": "storage\/create-file.md", @@ -8544,7 +8580,7 @@ "x-appwrite": { "method": "getFile", "group": "files", - "weight": 152, + "weight": 526, "cookies": false, "type": "", "demo": "storage\/get-file.md", @@ -8615,13 +8651,13 @@ "x-appwrite": { "method": "updateFile", "group": "files", - "weight": 157, + "weight": 528, "cookies": false, "type": "", "demo": "storage\/update-file.md", - "rate-limit": 60, - "rate-time": 60, - "rate-key": "ip:{ip},method:{method},url:{url},userId:{userId}", + "rate-limit": 0, + "rate-time": 3600, + "rate-key": "url:{url},ip:{ip}", "scope": "files.write", "platforms": [ "console", @@ -8645,7 +8681,7 @@ "parameters": [ { "name": "bucketId", - "description": "Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https:\/\/appwrite.io\/docs\/server\/storage#createBucket).", + "description": "Bucket unique ID.", "required": true, "type": "string", "x-example": "", @@ -8653,7 +8689,7 @@ }, { "name": "fileId", - "description": "File unique ID.", + "description": "File ID.", "required": true, "type": "string", "x-example": "", @@ -8667,14 +8703,13 @@ "properties": { "name": { "type": "string", - "description": "Name of the file", + "description": "File name.", "default": null, - "x-example": "", - "x-nullable": true + "x-example": "" }, "permissions": { "type": "array", - "description": "An array of permission string. By default, the current permissions are inherited. [Learn more about permissions](https:\/\/appwrite.io\/docs\/permissions).", + "description": "An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https:\/\/appwrite.io\/docs\/permissions).", "default": null, "x-example": "[\"read(\"any\")\"]", "x-nullable": true, @@ -8707,7 +8742,7 @@ "x-appwrite": { "method": "deleteFile", "group": "files", - "weight": 158, + "weight": 529, "cookies": false, "type": "", "demo": "storage\/delete-file.md", @@ -8778,7 +8813,7 @@ "x-appwrite": { "method": "getFileDownload", "group": "files", - "weight": 154, + "weight": 531, "cookies": false, "type": "location", "demo": "storage\/get-file-download.md", @@ -8858,7 +8893,7 @@ "x-appwrite": { "method": "getFilePreview", "group": "files", - "weight": 153, + "weight": 530, "cookies": false, "type": "location", "demo": "storage\/get-file-preview.md", @@ -9066,7 +9101,7 @@ "x-appwrite": { "method": "getFileView", "group": "files", - "weight": 155, + "weight": 532, "cookies": false, "type": "location", "demo": "storage\/get-file-view.md", @@ -9146,7 +9181,7 @@ "x-appwrite": { "method": "listTransactions", "group": "transactions", - "weight": 445, + "weight": 403, "cookies": false, "type": "", "demo": "tablesdb\/list-transactions.md", @@ -9216,7 +9251,7 @@ "x-appwrite": { "method": "createTransaction", "group": "transactions", - "weight": 441, + "weight": 399, "cookies": false, "type": "", "demo": "tablesdb\/create-transaction.md", @@ -9257,7 +9292,8 @@ "type": "integer", "description": "Seconds before the transaction expires.", "default": 300, - "x-example": 60 + "x-example": 60, + "format": "int32" } } } @@ -9289,7 +9325,7 @@ "x-appwrite": { "method": "getTransaction", "group": "transactions", - "weight": 442, + "weight": 400, "cookies": false, "type": "", "demo": "tablesdb\/get-transaction.md", @@ -9355,7 +9391,7 @@ "x-appwrite": { "method": "updateTransaction", "group": "transactions", - "weight": 443, + "weight": 401, "cookies": false, "type": "", "demo": "tablesdb\/update-transaction.md", @@ -9437,7 +9473,7 @@ "x-appwrite": { "method": "deleteTransaction", "group": "transactions", - "weight": 444, + "weight": 402, "cookies": false, "type": "", "demo": "tablesdb\/delete-transaction.md", @@ -9505,7 +9541,7 @@ "x-appwrite": { "method": "createOperations", "group": "transactions", - "weight": 446, + "weight": 404, "cookies": false, "type": "", "demo": "tablesdb\/create-operations.md", @@ -9589,7 +9625,7 @@ "x-appwrite": { "method": "listRows", "group": "rows", - "weight": 437, + "weight": 395, "cookies": false, "type": "", "demo": "tablesdb\/list-rows.md", @@ -9692,7 +9728,7 @@ "x-appwrite": { "method": "createRow", "group": "rows", - "weight": 429, + "weight": 387, "cookies": false, "type": "", "demo": "tablesdb\/create-row.md", @@ -9846,7 +9882,7 @@ "x-appwrite": { "method": "getRow", "group": "rows", - "weight": 430, + "weight": 388, "cookies": false, "type": "", "demo": "tablesdb\/get-row.md", @@ -9948,7 +9984,7 @@ "x-appwrite": { "method": "upsertRow", "group": "rows", - "weight": 433, + "weight": 391, "cookies": false, "type": "", "demo": "tablesdb\/upsert-row.md", @@ -10094,7 +10130,7 @@ "x-appwrite": { "method": "updateRow", "group": "rows", - "weight": 431, + "weight": 389, "cookies": false, "type": "", "demo": "tablesdb\/update-row.md", @@ -10203,7 +10239,7 @@ "x-appwrite": { "method": "deleteRow", "group": "rows", - "weight": 435, + "weight": 393, "cookies": false, "type": "", "demo": "tablesdb\/delete-row.md", @@ -10303,7 +10339,7 @@ "x-appwrite": { "method": "decrementRowColumn", "group": "rows", - "weight": 440, + "weight": 398, "cookies": false, "type": "", "demo": "tablesdb\/decrement-row-column.md", @@ -10375,13 +10411,15 @@ "type": "number", "description": "Value to increment the column by. The value must be a number.", "default": 1, - "x-example": null + "x-example": null, + "format": "float" }, "min": { "type": "number", "description": "Minimum value for the column. If the current value is lesser than this value, an exception will be thrown.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "transactionId": { @@ -10423,7 +10461,7 @@ "x-appwrite": { "method": "incrementRowColumn", "group": "rows", - "weight": 439, + "weight": 397, "cookies": false, "type": "", "demo": "tablesdb\/increment-row-column.md", @@ -10495,13 +10533,15 @@ "type": "number", "description": "Value to increment the column by. The value must be a number.", "default": 1, - "x-example": null + "x-example": null, + "format": "float" }, "max": { "type": "number", "description": "Maximum value for the column. If the current value is greater than this value, an error will be thrown.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "transactionId": { @@ -10541,7 +10581,7 @@ "x-appwrite": { "method": "list", "group": "teams", - "weight": 162, + "weight": 110, "cookies": false, "type": "", "demo": "teams\/list.md", @@ -10626,7 +10666,7 @@ "x-appwrite": { "method": "create", "group": "teams", - "weight": 161, + "weight": 109, "cookies": false, "type": "", "demo": "teams\/create.md", @@ -10717,7 +10757,7 @@ "x-appwrite": { "method": "get", "group": "teams", - "weight": 163, + "weight": 111, "cookies": false, "type": "", "demo": "teams\/get.md", @@ -10780,7 +10820,7 @@ "x-appwrite": { "method": "updateName", "group": "teams", - "weight": 165, + "weight": 113, "cookies": false, "type": "", "demo": "teams\/update-name.md", @@ -10856,7 +10896,7 @@ "x-appwrite": { "method": "delete", "group": "teams", - "weight": 167, + "weight": 115, "cookies": false, "type": "", "demo": "teams\/delete.md", @@ -10919,7 +10959,7 @@ "x-appwrite": { "method": "listMemberships", "group": "memberships", - "weight": 169, + "weight": 117, "cookies": false, "type": "", "demo": "teams\/list-memberships.md", @@ -11012,7 +11052,7 @@ "x-appwrite": { "method": "createMembership", "group": "memberships", - "weight": 168, + "weight": 116, "cookies": false, "type": "", "demo": "teams\/create-membership.md", @@ -11058,7 +11098,8 @@ "type": "string", "description": "Email of the new team member.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "userId": { "type": "string", @@ -11070,7 +11111,8 @@ "type": "string", "description": "Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", "default": "", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "roles": { "type": "array", @@ -11092,7 +11134,8 @@ "type": "string", "description": "URL to redirect the user back to your app from the invitation email. This parameter is not required when an API key is supplied. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.", "default": "", - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" }, "name": { "type": "string", @@ -11133,7 +11176,7 @@ "x-appwrite": { "method": "getMembership", "group": "memberships", - "weight": 170, + "weight": 118, "cookies": false, "type": "", "demo": "teams\/get-membership.md", @@ -11204,7 +11247,7 @@ "x-appwrite": { "method": "updateMembership", "group": "memberships", - "weight": 171, + "weight": 119, "cookies": false, "type": "", "demo": "teams\/update-membership.md", @@ -11298,7 +11341,7 @@ "x-appwrite": { "method": "deleteMembership", "group": "memberships", - "weight": 173, + "weight": 121, "cookies": false, "type": "", "demo": "teams\/delete-membership.md", @@ -11371,7 +11414,7 @@ "x-appwrite": { "method": "updateMembershipStatus", "group": "memberships", - "weight": 172, + "weight": 120, "cookies": false, "type": "", "demo": "teams\/update-membership-status.md", @@ -11467,7 +11510,7 @@ "x-appwrite": { "method": "getPrefs", "group": "teams", - "weight": 164, + "weight": 112, "cookies": false, "type": "", "demo": "teams\/get-prefs.md", @@ -11530,7 +11573,7 @@ "x-appwrite": { "method": "updatePrefs", "group": "teams", - "weight": 166, + "weight": 114, "cookies": false, "type": "", "demo": "teams\/update-prefs.md", @@ -11651,7 +11694,7 @@ }, { "name": "console", - "description": "The Console service allows you to interact with console relevant informations." + "description": "The Console service allows you to interact with console relevant information." }, { "name": "migrations", @@ -13350,6 +13393,16 @@ "description": "Total number of chunks uploaded", "x-example": 17890, "format": "int32" + }, + "encryption": { + "type": "boolean", + "description": "Whether file contents are encrypted at rest.", + "x-example": true + }, + "compression": { + "type": "string", + "description": "Compression algorithm used for the file. Will be one of none, [gzip](https:\/\/en.wikipedia.org\/wiki\/Gzip), or [zstd](https:\/\/en.wikipedia.org\/wiki\/Zstd).", + "x-example": "gzip" } }, "required": [ @@ -13363,7 +13416,9 @@ "mimeType", "sizeOriginal", "chunksTotal", - "chunksUploaded" + "chunksUploaded", + "encryption", + "compression" ], "example": { "$id": "5e5ea5c16897e", @@ -13378,7 +13433,9 @@ "mimeType": "image\/png", "sizeOriginal": 17890, "chunksTotal": 17890, - "chunksUploaded": 17890 + "chunksUploaded": 17890, + "encryption": true, + "compression": "gzip" } }, "team": { diff --git a/app/config/specs/swagger2-1.8.x-console.json b/app/config/specs/swagger2-1.8.x-console.json index 36e54a5c4d..0bb1a47f0a 100644 --- a/app/config/specs/swagger2-1.8.x-console.json +++ b/app/config/specs/swagger2-1.8.x-console.json @@ -1,7 +1,7 @@ { "swagger": "2.0", "info": { - "version": "1.8.0", + "version": "1.8.1", "title": "Appwrite", "description": "Appwrite backend as a service cuts up to 70% of the time and costs required for building a modern application. We abstract and simplify common development tasks behind a REST APIs, to help you develop your app in a fast and secure way. For full API documentation and tutorials go to [https:\/\/appwrite.io\/docs](https:\/\/appwrite.io\/docs)", "termsOfService": "https:\/\/appwrite.io\/policy\/terms", @@ -73,6 +73,12 @@ "x-appwrite": { "demo": "" } + }, + "Cookie": { + "type": "apiKey", + "name": "Cookie", + "description": "The user cookie to authenticate with", + "in": "header" } }, "paths": { @@ -100,7 +106,7 @@ "x-appwrite": { "method": "get", "group": "account", - "weight": 10, + "weight": 9, "cookies": false, "type": "", "demo": "account\/get.md", @@ -152,7 +158,7 @@ "x-appwrite": { "method": "create", "group": "account", - "weight": 9, + "weight": 8, "cookies": false, "type": "", "demo": "account\/create.md", @@ -195,7 +201,8 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", @@ -239,7 +246,7 @@ "x-appwrite": { "method": "delete", "group": "account", - "weight": 11, + "weight": 10, "cookies": false, "type": "", "demo": "account\/delete.md", @@ -290,7 +297,7 @@ "x-appwrite": { "method": "updateEmail", "group": "account", - "weight": 35, + "weight": 34, "cookies": false, "type": "", "demo": "account\/update-email.md", @@ -327,13 +334,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password. Must be at least 8 chars.", "default": null, - "x-example": "password" + "x-example": "password", + "format": "password" } }, "required": [ @@ -369,7 +378,7 @@ "x-appwrite": { "method": "listIdentities", "group": "identities", - "weight": 48, + "weight": 47, "cookies": false, "type": "", "demo": "account\/list-identities.md", @@ -441,7 +450,7 @@ "x-appwrite": { "method": "deleteIdentity", "group": "identities", - "weight": 49, + "weight": 48, "cookies": false, "type": "", "demo": "account\/delete-identity.md", @@ -505,12 +514,12 @@ "x-appwrite": { "method": "createJWT", "group": "tokens", - "weight": 30, + "weight": 29, "cookies": false, "type": "", "demo": "account\/create-jwt.md", - "rate-limit": 100, - "rate-time": 3600, + "rate-limit": 120, + "rate-time": 60, "rate-key": "url:{url},userId:{userId}", "scope": "account", "platforms": [ @@ -530,6 +539,24 @@ "Project": [], "JWT": [] } + ], + "parameters": [ + { + "name": "payload", + "in": "body", + "schema": { + "type": "object", + "properties": { + "duration": { + "type": "integer", + "description": "Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds.", + "default": 900, + "x-example": 0, + "format": "int32" + } + } + } + } ] } }, @@ -557,7 +584,7 @@ "x-appwrite": { "method": "listLogs", "group": "logs", - "weight": 32, + "weight": 31, "cookies": false, "type": "", "demo": "account\/list-logs.md", @@ -634,7 +661,7 @@ "x-appwrite": { "method": "updateMFA", "group": "mfa", - "weight": 306, + "weight": 253, "cookies": false, "type": "", "demo": "account\/update-mfa.md", @@ -708,7 +735,7 @@ "x-appwrite": { "method": "createMfaAuthenticator", "group": "mfa", - "weight": 308, + "weight": 255, "cookies": false, "type": "", "demo": "account\/create-mfa-authenticator.md", @@ -831,7 +858,7 @@ "x-appwrite": { "method": "updateMfaAuthenticator", "group": "mfa", - "weight": 309, + "weight": 256, "cookies": false, "type": "", "demo": "account\/update-mfa-authenticator.md", @@ -971,7 +998,7 @@ "x-appwrite": { "method": "deleteMfaAuthenticator", "group": "mfa", - "weight": 310, + "weight": 257, "cookies": false, "type": "", "demo": "account\/delete-mfa-authenticator.md", @@ -1094,7 +1121,7 @@ "x-appwrite": { "method": "createMfaChallenge", "group": "mfa", - "weight": 314, + "weight": 261, "cookies": false, "type": "", "demo": "account\/create-mfa-challenge.md", @@ -1230,7 +1257,7 @@ "x-appwrite": { "method": "updateMfaChallenge", "group": "mfa", - "weight": 315, + "weight": 262, "cookies": false, "type": "", "demo": "account\/update-mfa-challenge.md", @@ -1369,7 +1396,7 @@ "x-appwrite": { "method": "listMfaFactors", "group": "mfa", - "weight": 307, + "weight": 254, "cookies": false, "type": "", "demo": "account\/list-mfa-factors.md", @@ -1469,7 +1496,7 @@ "x-appwrite": { "method": "getMfaRecoveryCodes", "group": "mfa", - "weight": 313, + "weight": 260, "cookies": false, "type": "", "demo": "account\/get-mfa-recovery-codes.md", @@ -1569,7 +1596,7 @@ "x-appwrite": { "method": "createMfaRecoveryCodes", "group": "mfa", - "weight": 311, + "weight": 258, "cookies": false, "type": "", "demo": "account\/create-mfa-recovery-codes.md", @@ -1669,7 +1696,7 @@ "x-appwrite": { "method": "updateMfaRecoveryCodes", "group": "mfa", - "weight": 312, + "weight": 259, "cookies": false, "type": "", "demo": "account\/update-mfa-recovery-codes.md", @@ -1771,7 +1798,7 @@ "x-appwrite": { "method": "updateName", "group": "account", - "weight": 33, + "weight": 32, "cookies": false, "type": "", "demo": "account\/update-name.md", @@ -1845,7 +1872,7 @@ "x-appwrite": { "method": "updatePassword", "group": "account", - "weight": 34, + "weight": 33, "cookies": false, "type": "", "demo": "account\/update-password.md", @@ -1888,7 +1915,8 @@ "type": "string", "description": "Current user password. Must be at least 8 chars.", "default": "", - "x-example": "password" + "x-example": "password", + "format": "password" } }, "required": [ @@ -1925,7 +1953,7 @@ "x-appwrite": { "method": "updatePhone", "group": "account", - "weight": 36, + "weight": 35, "cookies": false, "type": "", "demo": "account\/update-phone.md", @@ -1962,13 +1990,15 @@ "type": "string", "description": "Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", "default": null, - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "password": { "type": "string", "description": "User password. Must be at least 8 chars.", "default": null, - "x-example": "password" + "x-example": "password", + "format": "password" } }, "required": [ @@ -2004,7 +2034,7 @@ "x-appwrite": { "method": "getPrefs", "group": "account", - "weight": 31, + "weight": 30, "cookies": false, "type": "", "demo": "account\/get-prefs.md", @@ -2056,7 +2086,7 @@ "x-appwrite": { "method": "updatePrefs", "group": "account", - "weight": 37, + "weight": 36, "cookies": false, "type": "", "demo": "account\/update-prefs.md", @@ -2130,7 +2160,7 @@ "x-appwrite": { "method": "createRecovery", "group": "recovery", - "weight": 39, + "weight": 38, "cookies": false, "type": "", "demo": "account\/create-recovery.md", @@ -2170,13 +2200,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "url": { "type": "string", "description": "URL to redirect the user back to your app from the recovery email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.", "default": null, - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" } }, "required": [ @@ -2212,7 +2244,7 @@ "x-appwrite": { "method": "updateRecovery", "group": "recovery", - "weight": 40, + "weight": 39, "cookies": false, "type": "", "demo": "account\/update-recovery.md", @@ -2298,7 +2330,7 @@ "x-appwrite": { "method": "listSessions", "group": "sessions", - "weight": 12, + "weight": 11, "cookies": false, "type": "", "demo": "account\/list-sessions.md", @@ -2345,7 +2377,7 @@ "x-appwrite": { "method": "deleteSessions", "group": "sessions", - "weight": 13, + "weight": 12, "cookies": false, "type": "", "demo": "account\/delete-sessions.md", @@ -2399,7 +2431,7 @@ "x-appwrite": { "method": "createAnonymousSession", "group": "sessions", - "weight": 18, + "weight": 17, "cookies": false, "type": "", "demo": "account\/create-anonymous-session.md", @@ -2453,7 +2485,7 @@ "x-appwrite": { "method": "createEmailPasswordSession", "group": "sessions", - "weight": 17, + "weight": 16, "cookies": false, "type": "", "demo": "account\/create-email-password-session.md", @@ -2490,13 +2522,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password. Must be at least 8 chars.", "default": null, - "x-example": "password" + "x-example": "password", + "format": "password" } }, "required": [ @@ -2534,7 +2568,7 @@ "x-appwrite": { "method": "updateMagicURLSession", "group": "sessions", - "weight": 27, + "weight": 26, "cookies": false, "type": "", "demo": "account\/update-magic-url-session.md", @@ -2614,7 +2648,7 @@ "x-appwrite": { "method": "createOAuth2Session", "group": "sessions", - "weight": 20, + "weight": 19, "cookies": false, "type": "webAuth", "demo": "account\/create-o-auth-2-session.md", @@ -2686,8 +2720,7 @@ "yammer", "yandex", "zoho", - "zoom", - "mock" + "zoom" ], "x-enum-name": "OAuthProvider", "x-enum-keys": [], @@ -2754,7 +2787,7 @@ "x-appwrite": { "method": "updatePhoneSession", "group": "sessions", - "weight": 28, + "weight": 27, "cookies": false, "type": "", "demo": "account\/update-phone-session.md", @@ -2839,7 +2872,7 @@ "x-appwrite": { "method": "createSession", "group": "sessions", - "weight": 19, + "weight": 18, "cookies": false, "type": "", "demo": "account\/create-session.md", @@ -2918,7 +2951,7 @@ "x-appwrite": { "method": "getSession", "group": "sessions", - "weight": 14, + "weight": 13, "cookies": false, "type": "", "demo": "account\/get-session.md", @@ -2980,7 +3013,7 @@ "x-appwrite": { "method": "updateSession", "group": "sessions", - "weight": 16, + "weight": 15, "cookies": false, "type": "", "demo": "account\/update-session.md", @@ -3037,7 +3070,7 @@ "x-appwrite": { "method": "deleteSession", "group": "sessions", - "weight": 15, + "weight": 14, "cookies": false, "type": "", "demo": "account\/delete-session.md", @@ -3101,7 +3134,7 @@ "x-appwrite": { "method": "updateStatus", "group": "account", - "weight": 38, + "weight": 37, "cookies": false, "type": "", "demo": "account\/update-status.md", @@ -3155,7 +3188,7 @@ "x-appwrite": { "method": "createPushTarget", "group": "pushTargets", - "weight": 45, + "weight": 44, "cookies": false, "type": "", "demo": "account\/create-push-target.md", @@ -3240,7 +3273,7 @@ "x-appwrite": { "method": "updatePushTarget", "group": "pushTargets", - "weight": 46, + "weight": 45, "cookies": false, "type": "", "demo": "account\/update-push-target.md", @@ -3313,7 +3346,7 @@ "x-appwrite": { "method": "deletePushTarget", "group": "pushTargets", - "weight": 47, + "weight": 46, "cookies": false, "type": "", "demo": "account\/delete-push-target.md", @@ -3375,7 +3408,7 @@ "x-appwrite": { "method": "createEmailToken", "group": "tokens", - "weight": 26, + "weight": 25, "cookies": false, "type": "", "demo": "account\/create-email-token.md", @@ -3421,7 +3454,8 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "phrase": { "type": "boolean", @@ -3465,7 +3499,7 @@ "x-appwrite": { "method": "createMagicURLToken", "group": "tokens", - "weight": 25, + "weight": 24, "cookies": false, "type": "", "demo": "account\/create-magic-url-token.md", @@ -3511,13 +3545,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "url": { "type": "string", "description": "URL to redirect the user back to your app from the magic URL login. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.", "default": "", - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" }, "phrase": { "type": "boolean", @@ -3556,7 +3592,7 @@ "x-appwrite": { "method": "createOAuth2Token", "group": "tokens", - "weight": 24, + "weight": 23, "cookies": false, "type": "webAuth", "demo": "account\/create-o-auth-2-token.md", @@ -3628,8 +3664,7 @@ "yammer", "yandex", "zoho", - "zoom", - "mock" + "zoom" ], "x-enum-name": "OAuthProvider", "x-enum-keys": [], @@ -3696,7 +3731,7 @@ "x-appwrite": { "method": "createPhoneToken", "group": "tokens", - "weight": 29, + "weight": 28, "cookies": false, "type": "", "demo": "account\/create-phone-token.md", @@ -3742,7 +3777,8 @@ "type": "string", "description": "Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", "default": null, - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" } }, "required": [ @@ -3780,7 +3816,7 @@ "x-appwrite": { "method": "createEmailVerification", "group": "verification", - "weight": 41, + "weight": 40, "cookies": false, "type": "", "demo": "account\/create-email-verification.md", @@ -3869,7 +3905,8 @@ "type": "string", "description": "URL to redirect the user back to your app from the verification email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.", "default": null, - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" } }, "required": [ @@ -3904,7 +3941,7 @@ "x-appwrite": { "method": "updateEmailVerification", "group": "verification", - "weight": 42, + "weight": 41, "cookies": false, "type": "", "demo": "account\/update-email-verification.md", @@ -4041,7 +4078,7 @@ "x-appwrite": { "method": "createPhoneVerification", "group": "verification", - "weight": 43, + "weight": 42, "cookies": false, "type": "", "demo": "account\/create-phone-verification.md", @@ -4096,7 +4133,7 @@ "x-appwrite": { "method": "updatePhoneVerification", "group": "verification", - "weight": 44, + "weight": 43, "cookies": false, "type": "", "demo": "account\/update-phone-verification.md", @@ -4175,7 +4212,7 @@ "x-appwrite": { "method": "getBrowser", "group": null, - "weight": 51, + "weight": 264, "cookies": false, "type": "location", "demo": "avatars\/get-browser.md", @@ -4301,7 +4338,7 @@ "x-appwrite": { "method": "getCreditCard", "group": null, - "weight": 50, + "weight": 263, "cookies": false, "type": "location", "demo": "avatars\/get-credit-card.md", @@ -4433,7 +4470,7 @@ "x-appwrite": { "method": "getFavicon", "group": null, - "weight": 54, + "weight": 267, "cookies": false, "type": "location", "demo": "avatars\/get-favicon.md", @@ -4497,7 +4534,7 @@ "x-appwrite": { "method": "getFlag", "group": null, - "weight": 52, + "weight": 265, "cookies": false, "type": "location", "demo": "avatars\/get-flag.md", @@ -4985,7 +5022,7 @@ "x-appwrite": { "method": "getImage", "group": null, - "weight": 53, + "weight": 266, "cookies": false, "type": "location", "demo": "avatars\/get-image.md", @@ -5069,7 +5106,7 @@ "x-appwrite": { "method": "getInitials", "group": null, - "weight": 56, + "weight": 269, "cookies": false, "type": "location", "demo": "avatars\/get-initials.md", @@ -5161,7 +5198,7 @@ "x-appwrite": { "method": "getQR", "group": null, - "weight": 55, + "weight": 268, "cookies": false, "type": "location", "demo": "avatars\/get-qr.md", @@ -5253,7 +5290,7 @@ "x-appwrite": { "method": "getScreenshot", "group": null, - "weight": 57, + "weight": 270, "cookies": false, "type": "location", "demo": "avatars\/get-screenshot.md", @@ -5934,7 +5971,7 @@ "avif", "gif" ], - "x-enum-name": null, + "x-enum-name": "ImageFormat", "x-enum-keys": [], "default": "", "in": "query" @@ -5968,7 +6005,7 @@ "x-appwrite": { "method": "chat", "group": "console", - "weight": 243, + "weight": 497, "cookies": false, "type": "", "demo": "assistant\/chat.md", @@ -6032,7 +6069,7 @@ "x-appwrite": { "method": "getResource", "group": null, - "weight": 512, + "weight": 498, "cookies": false, "type": "", "demo": "console\/get-resource.md", @@ -6103,7 +6140,7 @@ "x-appwrite": { "method": "variables", "group": "console", - "weight": 242, + "weight": 496, "cookies": false, "type": "", "demo": "console\/variables.md", @@ -6152,7 +6189,7 @@ "x-appwrite": { "method": "list", "group": "databases", - "weight": 320, + "weight": 278, "cookies": false, "type": "", "demo": "databases\/list.md", @@ -6268,7 +6305,7 @@ "x-appwrite": { "method": "create", "group": "databases", - "weight": 316, + "weight": 274, "cookies": false, "type": "", "demo": "databases\/create.md", @@ -6388,7 +6425,7 @@ "x-appwrite": { "method": "listTransactions", "group": "transactions", - "weight": 380, + "weight": 338, "cookies": false, "type": "", "demo": "databases\/list-transactions.md", @@ -6455,7 +6492,7 @@ "x-appwrite": { "method": "createTransaction", "group": "transactions", - "weight": 376, + "weight": 334, "cookies": false, "type": "", "demo": "databases\/create-transaction.md", @@ -6493,7 +6530,8 @@ "type": "integer", "description": "Seconds before the transaction expires.", "default": 300, - "x-example": 60 + "x-example": 60, + "format": "int32" } } } @@ -6525,7 +6563,7 @@ "x-appwrite": { "method": "getTransaction", "group": "transactions", - "weight": 377, + "weight": 335, "cookies": false, "type": "", "demo": "databases\/get-transaction.md", @@ -6588,7 +6626,7 @@ "x-appwrite": { "method": "updateTransaction", "group": "transactions", - "weight": 378, + "weight": 336, "cookies": false, "type": "", "demo": "databases\/update-transaction.md", @@ -6667,7 +6705,7 @@ "x-appwrite": { "method": "deleteTransaction", "group": "transactions", - "weight": 379, + "weight": 337, "cookies": false, "type": "", "demo": "databases\/delete-transaction.md", @@ -6732,7 +6770,7 @@ "x-appwrite": { "method": "createOperations", "group": "transactions", - "weight": 381, + "weight": 339, "cookies": false, "type": "", "demo": "databases\/create-operations.md", @@ -6813,7 +6851,7 @@ "x-appwrite": { "method": "listUsage", "group": null, - "weight": 323, + "weight": 281, "cookies": false, "type": "", "demo": "databases\/list-usage.md", @@ -6915,7 +6953,7 @@ "x-appwrite": { "method": "get", "group": "databases", - "weight": 317, + "weight": 275, "cookies": false, "type": "", "demo": "databases\/get.md", @@ -7009,7 +7047,7 @@ "x-appwrite": { "method": "update", "group": "databases", - "weight": 318, + "weight": 276, "cookies": false, "type": "", "demo": "databases\/update.md", @@ -7042,8 +7080,7 @@ "enabled" ], "required": [ - "databaseId", - "name" + "databaseId" ], "responses": [ { @@ -7097,10 +7134,7 @@ "default": true, "x-example": false } - }, - "required": [ - "name" - ] + } } } ] @@ -7125,7 +7159,7 @@ "x-appwrite": { "method": "delete", "group": "databases", - "weight": 319, + "weight": 277, "cookies": false, "type": "", "demo": "databases\/delete.md", @@ -7218,7 +7252,7 @@ "x-appwrite": { "method": "listCollections", "group": "collections", - "weight": 328, + "weight": 286, "cookies": false, "type": "", "demo": "databases\/list-collections.md", @@ -7313,7 +7347,7 @@ "x-appwrite": { "method": "createCollection", "group": "collections", - "weight": 324, + "weight": 282, "cookies": false, "type": "", "demo": "databases\/create-collection.md", @@ -7443,7 +7477,7 @@ "x-appwrite": { "method": "getCollection", "group": "collections", - "weight": 325, + "weight": 283, "cookies": false, "type": "", "demo": "databases\/get-collection.md", @@ -7516,7 +7550,7 @@ "x-appwrite": { "method": "updateCollection", "group": "collections", - "weight": 326, + "weight": 284, "cookies": false, "type": "", "demo": "databases\/update-collection.md", @@ -7596,10 +7630,7 @@ "default": true, "x-example": false } - }, - "required": [ - "name" - ] + } } } ] @@ -7624,7 +7655,7 @@ "x-appwrite": { "method": "deleteCollection", "group": "collections", - "weight": 327, + "weight": 285, "cookies": false, "type": "", "demo": "databases\/delete-collection.md", @@ -7697,7 +7728,7 @@ "x-appwrite": { "method": "listAttributes", "group": "attributes", - "weight": 345, + "weight": 303, "cookies": false, "type": "", "demo": "databases\/list-attributes.md", @@ -7793,7 +7824,7 @@ "x-appwrite": { "method": "createBooleanAttribute", "group": "attributes", - "weight": 346, + "weight": 304, "cookies": false, "type": "", "demo": "databases\/create-boolean-attribute.md", @@ -7906,7 +7937,7 @@ "x-appwrite": { "method": "updateBooleanAttribute", "group": "attributes", - "weight": 347, + "weight": 305, "cookies": false, "type": "", "demo": "databases\/update-boolean-attribute.md", @@ -8021,7 +8052,7 @@ "x-appwrite": { "method": "createDatetimeAttribute", "group": "attributes", - "weight": 348, + "weight": 306, "cookies": false, "type": "", "demo": "databases\/create-datetime-attribute.md", @@ -8134,7 +8165,7 @@ "x-appwrite": { "method": "updateDatetimeAttribute", "group": "attributes", - "weight": 349, + "weight": 307, "cookies": false, "type": "", "demo": "databases\/update-datetime-attribute.md", @@ -8249,7 +8280,7 @@ "x-appwrite": { "method": "createEmailAttribute", "group": "attributes", - "weight": 350, + "weight": 308, "cookies": false, "type": "", "demo": "databases\/create-email-attribute.md", @@ -8318,6 +8349,7 @@ "description": "Default value for attribute when not provided. Cannot be set when attribute is required.", "default": null, "x-example": "email@example.com", + "format": "email", "x-nullable": true }, "array": { @@ -8362,7 +8394,7 @@ "x-appwrite": { "method": "updateEmailAttribute", "group": "attributes", - "weight": 351, + "weight": 309, "cookies": false, "type": "", "demo": "databases\/update-email-attribute.md", @@ -8432,6 +8464,7 @@ "description": "Default value for attribute when not provided. Cannot be set when attribute is required.", "default": null, "x-example": "email@example.com", + "format": "email", "x-nullable": true }, "newKey": { @@ -8477,7 +8510,7 @@ "x-appwrite": { "method": "createEnumAttribute", "group": "attributes", - "weight": 352, + "weight": 310, "cookies": false, "type": "", "demo": "databases\/create-enum-attribute.md", @@ -8600,7 +8633,7 @@ "x-appwrite": { "method": "updateEnumAttribute", "group": "attributes", - "weight": 353, + "weight": 311, "cookies": false, "type": "", "demo": "databases\/update-enum-attribute.md", @@ -8725,7 +8758,7 @@ "x-appwrite": { "method": "createFloatAttribute", "group": "attributes", - "weight": 354, + "weight": 312, "cookies": false, "type": "", "demo": "databases\/create-float-attribute.md", @@ -8794,6 +8827,7 @@ "description": "Minimum value.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "max": { @@ -8801,6 +8835,7 @@ "description": "Maximum value.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "default": { @@ -8808,6 +8843,7 @@ "description": "Default value. Cannot be set when required.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "array": { @@ -8852,7 +8888,7 @@ "x-appwrite": { "method": "updateFloatAttribute", "group": "attributes", - "weight": 355, + "weight": 313, "cookies": false, "type": "", "demo": "databases\/update-float-attribute.md", @@ -8922,6 +8958,7 @@ "description": "Minimum value.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "max": { @@ -8929,6 +8966,7 @@ "description": "Maximum value.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "default": { @@ -8936,6 +8974,7 @@ "description": "Default value. Cannot be set when required.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "newKey": { @@ -8981,7 +9020,7 @@ "x-appwrite": { "method": "createIntegerAttribute", "group": "attributes", - "weight": 356, + "weight": 314, "cookies": false, "type": "", "demo": "databases\/create-integer-attribute.md", @@ -9050,6 +9089,7 @@ "description": "Minimum value", "default": null, "x-example": null, + "format": "int64", "x-nullable": true }, "max": { @@ -9057,6 +9097,7 @@ "description": "Maximum value", "default": null, "x-example": null, + "format": "int64", "x-nullable": true }, "default": { @@ -9064,6 +9105,7 @@ "description": "Default value. Cannot be set when attribute is required.", "default": null, "x-example": null, + "format": "int64", "x-nullable": true }, "array": { @@ -9108,7 +9150,7 @@ "x-appwrite": { "method": "updateIntegerAttribute", "group": "attributes", - "weight": 357, + "weight": 315, "cookies": false, "type": "", "demo": "databases\/update-integer-attribute.md", @@ -9178,6 +9220,7 @@ "description": "Minimum value", "default": null, "x-example": null, + "format": "int64", "x-nullable": true }, "max": { @@ -9185,6 +9228,7 @@ "description": "Maximum value", "default": null, "x-example": null, + "format": "int64", "x-nullable": true }, "default": { @@ -9192,6 +9236,7 @@ "description": "Default value. Cannot be set when attribute is required.", "default": null, "x-example": null, + "format": "int64", "x-nullable": true }, "newKey": { @@ -9237,7 +9282,7 @@ "x-appwrite": { "method": "createIpAttribute", "group": "attributes", - "weight": 358, + "weight": 316, "cookies": false, "type": "", "demo": "databases\/create-ip-attribute.md", @@ -9350,7 +9395,7 @@ "x-appwrite": { "method": "updateIpAttribute", "group": "attributes", - "weight": 359, + "weight": 317, "cookies": false, "type": "", "demo": "databases\/update-ip-attribute.md", @@ -9465,7 +9510,7 @@ "x-appwrite": { "method": "createLineAttribute", "group": "attributes", - "weight": 360, + "weight": 318, "cookies": false, "type": "", "demo": "databases\/create-line-attribute.md", @@ -9572,7 +9617,7 @@ "x-appwrite": { "method": "updateLineAttribute", "group": "attributes", - "weight": 361, + "weight": 319, "cookies": false, "type": "", "demo": "databases\/update-line-attribute.md", @@ -9686,7 +9731,7 @@ "x-appwrite": { "method": "createPointAttribute", "group": "attributes", - "weight": 362, + "weight": 320, "cookies": false, "type": "", "demo": "databases\/create-point-attribute.md", @@ -9793,7 +9838,7 @@ "x-appwrite": { "method": "updatePointAttribute", "group": "attributes", - "weight": 363, + "weight": 321, "cookies": false, "type": "", "demo": "databases\/update-point-attribute.md", @@ -9907,7 +9952,7 @@ "x-appwrite": { "method": "createPolygonAttribute", "group": "attributes", - "weight": 364, + "weight": 322, "cookies": false, "type": "", "demo": "databases\/create-polygon-attribute.md", @@ -10014,7 +10059,7 @@ "x-appwrite": { "method": "updatePolygonAttribute", "group": "attributes", - "weight": 365, + "weight": 323, "cookies": false, "type": "", "demo": "databases\/update-polygon-attribute.md", @@ -10128,7 +10173,7 @@ "x-appwrite": { "method": "createRelationshipAttribute", "group": "attributes", - "weight": 366, + "weight": 324, "cookies": false, "type": "", "demo": "databases\/create-relationship-attribute.md", @@ -10269,7 +10314,7 @@ "x-appwrite": { "method": "createStringAttribute", "group": "attributes", - "weight": 368, + "weight": 326, "cookies": false, "type": "", "demo": "databases\/create-string-attribute.md", @@ -10331,7 +10376,8 @@ "type": "integer", "description": "Attribute size for text attributes, in number of characters.", "default": null, - "x-example": 1 + "x-example": 1, + "format": "int32" }, "required": { "type": "boolean", @@ -10395,7 +10441,7 @@ "x-appwrite": { "method": "updateStringAttribute", "group": "attributes", - "weight": 369, + "weight": 327, "cookies": false, "type": "", "demo": "databases\/update-string-attribute.md", @@ -10472,6 +10518,7 @@ "description": "Maximum size of the string attribute.", "default": null, "x-example": 1, + "format": "int32", "x-nullable": true }, "newKey": { @@ -10517,7 +10564,7 @@ "x-appwrite": { "method": "createUrlAttribute", "group": "attributes", - "weight": 370, + "weight": 328, "cookies": false, "type": "", "demo": "databases\/create-url-attribute.md", @@ -10586,6 +10633,7 @@ "description": "Default value for attribute when not provided. Cannot be set when attribute is required.", "default": null, "x-example": "https:\/\/example.com", + "format": "url", "x-nullable": true }, "array": { @@ -10630,7 +10678,7 @@ "x-appwrite": { "method": "updateUrlAttribute", "group": "attributes", - "weight": 371, + "weight": 329, "cookies": false, "type": "", "demo": "databases\/update-url-attribute.md", @@ -10700,6 +10748,7 @@ "description": "Default value for attribute when not provided. Cannot be set when attribute is required.", "default": null, "x-example": "https:\/\/example.com", + "format": "url", "x-nullable": true }, "newKey": { @@ -10774,7 +10823,7 @@ "x-appwrite": { "method": "getAttribute", "group": "attributes", - "weight": 343, + "weight": 301, "cookies": false, "type": "", "demo": "databases\/get-attribute.md", @@ -10849,7 +10898,7 @@ "x-appwrite": { "method": "deleteAttribute", "group": "attributes", - "weight": 344, + "weight": 302, "cookies": false, "type": "", "demo": "databases\/delete-attribute.md", @@ -10931,7 +10980,7 @@ "x-appwrite": { "method": "updateRelationshipAttribute", "group": "attributes", - "weight": 367, + "weight": 325, "cookies": false, "type": "", "demo": "databases\/update-relationship-attribute.md", @@ -11041,7 +11090,7 @@ "x-appwrite": { "method": "listDocuments", "group": "documents", - "weight": 339, + "weight": 297, "cookies": false, "type": "", "demo": "databases\/list-documents.md", @@ -11145,7 +11194,7 @@ "x-appwrite": { "method": "createDocument", "group": "documents", - "weight": 331, + "weight": 289, "cookies": false, "type": "", "demo": "databases\/create-document.md", @@ -11336,7 +11385,7 @@ "x-appwrite": { "method": "upsertDocuments", "group": "documents", - "weight": 336, + "weight": 294, "cookies": false, "type": "", "demo": "databases\/upsert-documents.md", @@ -11471,7 +11520,7 @@ "x-appwrite": { "method": "updateDocuments", "group": "documents", - "weight": 334, + "weight": 292, "cookies": false, "type": "", "demo": "databases\/update-documents.md", @@ -11575,7 +11624,7 @@ "x-appwrite": { "method": "deleteDocuments", "group": "documents", - "weight": 338, + "weight": 296, "cookies": false, "type": "", "demo": "databases\/delete-documents.md", @@ -11673,7 +11722,7 @@ "x-appwrite": { "method": "getDocument", "group": "documents", - "weight": 332, + "weight": 290, "cookies": false, "type": "", "demo": "databases\/get-document.md", @@ -11776,7 +11825,7 @@ "x-appwrite": { "method": "upsertDocument", "group": "documents", - "weight": 335, + "weight": 293, "cookies": false, "type": "", "demo": "databases\/upsert-document.md", @@ -11927,7 +11976,7 @@ "x-appwrite": { "method": "updateDocument", "group": "documents", - "weight": 333, + "weight": 291, "cookies": false, "type": "", "demo": "databases\/update-document.md", @@ -12037,7 +12086,7 @@ "x-appwrite": { "method": "deleteDocument", "group": "documents", - "weight": 337, + "weight": 295, "cookies": false, "type": "", "demo": "databases\/delete-document.md", @@ -12136,7 +12185,7 @@ "x-appwrite": { "method": "listDocumentLogs", "group": "logs", - "weight": 340, + "weight": 298, "cookies": false, "type": "", "demo": "databases\/list-document-logs.md", @@ -12229,7 +12278,7 @@ "x-appwrite": { "method": "decrementDocumentAttribute", "group": "documents", - "weight": 342, + "weight": 300, "cookies": false, "type": "", "demo": "databases\/decrement-document-attribute.md", @@ -12302,13 +12351,15 @@ "type": "number", "description": "Value to increment the attribute by. The value must be a number.", "default": 1, - "x-example": null + "x-example": null, + "format": "float" }, "min": { "type": "number", "description": "Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "transactionId": { @@ -12350,7 +12401,7 @@ "x-appwrite": { "method": "incrementDocumentAttribute", "group": "documents", - "weight": 341, + "weight": 299, "cookies": false, "type": "", "demo": "databases\/increment-document-attribute.md", @@ -12423,13 +12474,15 @@ "type": "number", "description": "Value to increment the attribute by. The value must be a number.", "default": 1, - "x-example": null + "x-example": null, + "format": "float" }, "max": { "type": "number", "description": "Maximum value for the attribute. If the current value is greater than this value, an error will be thrown.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "transactionId": { @@ -12469,7 +12522,7 @@ "x-appwrite": { "method": "listIndexes", "group": "indexes", - "weight": 375, + "weight": 333, "cookies": false, "type": "", "demo": "databases\/list-indexes.md", @@ -12563,7 +12616,7 @@ "x-appwrite": { "method": "createIndex", "group": "indexes", - "weight": 372, + "weight": 330, "cookies": false, "type": "", "demo": "databases\/create-index.md", @@ -12703,7 +12756,7 @@ "x-appwrite": { "method": "getIndex", "group": "indexes", - "weight": 373, + "weight": 331, "cookies": false, "type": "", "demo": "databases\/get-index.md", @@ -12778,7 +12831,7 @@ "x-appwrite": { "method": "deleteIndex", "group": "indexes", - "weight": 374, + "weight": 332, "cookies": false, "type": "", "demo": "databases\/delete-index.md", @@ -12858,7 +12911,7 @@ "x-appwrite": { "method": "listCollectionLogs", "group": "collections", - "weight": 329, + "weight": 287, "cookies": false, "type": "", "demo": "databases\/list-collection-logs.md", @@ -12941,7 +12994,7 @@ "x-appwrite": { "method": "getCollectionUsage", "group": null, - "weight": 330, + "weight": 288, "cookies": false, "type": "", "demo": "databases\/get-collection-usage.md", @@ -13032,7 +13085,7 @@ "x-appwrite": { "method": "listLogs", "group": "logs", - "weight": 321, + "weight": 279, "cookies": false, "type": "", "demo": "databases\/list-logs.md", @@ -13137,7 +13190,7 @@ "x-appwrite": { "method": "getUsage", "group": null, - "weight": 322, + "weight": 280, "cookies": false, "type": "", "demo": "databases\/get-usage.md", @@ -13250,7 +13303,7 @@ "x-appwrite": { "method": "list", "group": "functions", - "weight": 456, + "weight": 415, "cookies": false, "type": "", "demo": "functions\/list.md", @@ -13332,7 +13385,7 @@ "x-appwrite": { "method": "create", "group": "functions", - "weight": 453, + "weight": 412, "cookies": false, "type": "", "demo": "functions\/create.md", @@ -13480,7 +13533,8 @@ "type": "integer", "description": "Function maximum execution time in seconds.", "default": 15, - "x-example": 1 + "x-example": 1, + "format": "int32" }, "enabled": { "type": "boolean", @@ -13645,7 +13699,7 @@ "x-appwrite": { "method": "listRuntimes", "group": "runtimes", - "weight": 458, + "weight": 417, "cookies": false, "type": "", "demo": "functions\/list-runtimes.md", @@ -13695,7 +13749,7 @@ "x-appwrite": { "method": "listSpecifications", "group": "runtimes", - "weight": 459, + "weight": 418, "cookies": false, "type": "", "demo": "functions\/list-specifications.md", @@ -13745,7 +13799,7 @@ "x-appwrite": { "method": "listTemplates", "group": "templates", - "weight": 482, + "weight": 441, "cookies": false, "type": "", "demo": "functions\/list-templates.md", @@ -13929,7 +13983,7 @@ "x-appwrite": { "method": "getTemplate", "group": "templates", - "weight": 481, + "weight": 440, "cookies": false, "type": "", "demo": "functions\/get-template.md", @@ -13987,7 +14041,7 @@ "x-appwrite": { "method": "listUsage", "group": null, - "weight": 475, + "weight": 434, "cookies": false, "type": "", "demo": "functions\/list-usage.md", @@ -14057,7 +14111,7 @@ "x-appwrite": { "method": "get", "group": "functions", - "weight": 454, + "weight": 413, "cookies": false, "type": "", "demo": "functions\/get.md", @@ -14117,7 +14171,7 @@ "x-appwrite": { "method": "update", "group": "functions", - "weight": 455, + "weight": 414, "cookies": false, "type": "", "demo": "functions\/update.md", @@ -14267,7 +14321,8 @@ "type": "integer", "description": "Maximum execution time in seconds.", "default": 15, - "x-example": 1 + "x-example": 1, + "format": "int32" }, "enabled": { "type": "boolean", @@ -14426,7 +14481,7 @@ "x-appwrite": { "method": "delete", "group": "functions", - "weight": 457, + "weight": 416, "cookies": false, "type": "", "demo": "functions\/delete.md", @@ -14488,7 +14543,7 @@ "x-appwrite": { "method": "updateFunctionDeployment", "group": "functions", - "weight": 462, + "weight": 421, "cookies": false, "type": "", "demo": "functions\/update-function-deployment.md", @@ -14566,7 +14621,7 @@ "x-appwrite": { "method": "listDeployments", "group": "deployments", - "weight": 463, + "weight": 422, "cookies": false, "type": "", "demo": "functions\/list-deployments.md", @@ -14656,7 +14711,7 @@ "x-appwrite": { "method": "createDeployment", "group": "deployments", - "weight": 460, + "weight": 419, "cookies": false, "type": "upload", "demo": "functions\/create-deployment.md", @@ -14749,7 +14804,7 @@ "x-appwrite": { "method": "createDuplicateDeployment", "group": "deployments", - "weight": 468, + "weight": 427, "cookies": false, "type": "", "demo": "functions\/create-duplicate-deployment.md", @@ -14835,7 +14890,7 @@ "x-appwrite": { "method": "createTemplateDeployment", "group": "deployments", - "weight": 465, + "weight": 424, "cookies": false, "type": "", "demo": "functions\/create-template-deployment.md", @@ -14956,7 +15011,7 @@ "x-appwrite": { "method": "createVcsDeployment", "group": "deployments", - "weight": 466, + "weight": 425, "cookies": false, "type": "", "demo": "functions\/create-vcs-deployment.md", @@ -15053,7 +15108,7 @@ "x-appwrite": { "method": "getDeployment", "group": "deployments", - "weight": 461, + "weight": 420, "cookies": false, "type": "", "demo": "functions\/get-deployment.md", @@ -15116,7 +15171,7 @@ "x-appwrite": { "method": "deleteDeployment", "group": "deployments", - "weight": 464, + "weight": 423, "cookies": false, "type": "", "demo": "functions\/delete-deployment.md", @@ -15184,7 +15239,7 @@ "x-appwrite": { "method": "getDeploymentDownload", "group": "deployments", - "weight": 467, + "weight": 426, "cookies": false, "type": "location", "demo": "functions\/get-deployment-download.md", @@ -15270,7 +15325,7 @@ "x-appwrite": { "method": "updateDeploymentStatus", "group": "deployments", - "weight": 469, + "weight": 428, "cookies": false, "type": "", "demo": "functions\/update-deployment-status.md", @@ -15338,7 +15393,7 @@ "x-appwrite": { "method": "listExecutions", "group": "executions", - "weight": 472, + "weight": 431, "cookies": false, "type": "", "demo": "functions\/list-executions.md", @@ -15421,7 +15476,7 @@ "x-appwrite": { "method": "createExecution", "group": "executions", - "weight": 470, + "weight": 429, "cookies": false, "type": "", "demo": "functions\/create-execution.md", @@ -15540,7 +15595,7 @@ "x-appwrite": { "method": "getExecution", "group": "executions", - "weight": 471, + "weight": 430, "cookies": false, "type": "", "demo": "functions\/get-execution.md", @@ -15605,7 +15660,7 @@ "x-appwrite": { "method": "deleteExecution", "group": "executions", - "weight": 473, + "weight": 432, "cookies": false, "type": "", "demo": "functions\/delete-execution.md", @@ -15673,7 +15728,7 @@ "x-appwrite": { "method": "getUsage", "group": null, - "weight": 474, + "weight": 433, "cookies": false, "type": "", "demo": "functions\/get-usage.md", @@ -15751,7 +15806,7 @@ "x-appwrite": { "method": "listVariables", "group": "variables", - "weight": 478, + "weight": 437, "cookies": false, "type": "", "demo": "functions\/list-variables.md", @@ -15811,7 +15866,7 @@ "x-appwrite": { "method": "createVariable", "group": "variables", - "weight": 476, + "weight": 435, "cookies": false, "type": "", "demo": "functions\/create-variable.md", @@ -15902,7 +15957,7 @@ "x-appwrite": { "method": "getVariable", "group": "variables", - "weight": 477, + "weight": 436, "cookies": false, "type": "", "demo": "functions\/get-variable.md", @@ -15970,7 +16025,7 @@ "x-appwrite": { "method": "updateVariable", "group": "variables", - "weight": 479, + "weight": 438, "cookies": false, "type": "", "demo": "functions\/update-variable.md", @@ -16065,7 +16120,7 @@ "x-appwrite": { "method": "deleteVariable", "group": "variables", - "weight": 480, + "weight": 439, "cookies": false, "type": "", "demo": "functions\/delete-variable.md", @@ -16135,7 +16190,7 @@ "x-appwrite": { "method": "query", "group": "graphql", - "weight": 241, + "weight": 190, "cookies": false, "type": "graphql", "demo": "graphql\/query.md", @@ -16210,7 +16265,7 @@ "x-appwrite": { "method": "mutation", "group": "graphql", - "weight": 240, + "weight": 189, "cookies": false, "type": "graphql", "demo": "graphql\/mutation.md", @@ -16283,7 +16338,7 @@ "x-appwrite": { "method": "get", "group": "health", - "weight": 69, + "weight": 442, "cookies": false, "type": "", "demo": "health\/get.md", @@ -16334,7 +16389,7 @@ "x-appwrite": { "method": "getAntivirus", "group": "health", - "weight": 90, + "weight": 451, "cookies": false, "type": "", "demo": "health\/get-antivirus.md", @@ -16375,9 +16430,9 @@ "description": "Check the Appwrite in-memory cache servers are up and connection is successful.", "responses": { "200": { - "description": "Health Status", + "description": "Status List", "schema": { - "$ref": "#\/definitions\/healthStatus" + "$ref": "#\/definitions\/healthStatusList" } } }, @@ -16385,7 +16440,7 @@ "x-appwrite": { "method": "getCache", "group": "health", - "weight": 72, + "weight": 445, "cookies": false, "type": "", "demo": "health\/get-cache.md", @@ -16436,7 +16491,7 @@ "x-appwrite": { "method": "getCertificate", "group": "health", - "weight": 77, + "weight": 448, "cookies": false, "type": "", "demo": "health\/get-certificate.md", @@ -16486,9 +16541,9 @@ "description": "Check the Appwrite database servers are up and connection is successful.", "responses": { "200": { - "description": "Health Status", + "description": "Status List", "schema": { - "$ref": "#\/definitions\/healthStatus" + "$ref": "#\/definitions\/healthStatusList" } } }, @@ -16496,7 +16551,7 @@ "x-appwrite": { "method": "getDB", "group": "health", - "weight": 71, + "weight": 444, "cookies": false, "type": "", "demo": "health\/get-db.md", @@ -16537,9 +16592,9 @@ "description": "Check the Appwrite pub-sub servers are up and connection is successful.", "responses": { "200": { - "description": "Health Status", + "description": "Status List", "schema": { - "$ref": "#\/definitions\/healthStatus" + "$ref": "#\/definitions\/healthStatusList" } } }, @@ -16547,7 +16602,7 @@ "x-appwrite": { "method": "getPubSub", "group": "health", - "weight": 73, + "weight": 446, "cookies": false, "type": "", "demo": "health\/get-pub-sub.md", @@ -16574,6 +16629,68 @@ ] } }, + "\/health\/queue\/audits": { + "get": { + "summary": "Get audits queue", + "operationId": "healthGetQueueAudits", + "consumes": [], + "produces": [ + "application\/json" + ], + "tags": [ + "health" + ], + "description": "Get the number of audit logs that are waiting to be processed in the Appwrite internal queue server.", + "responses": { + "200": { + "description": "Health Queue", + "schema": { + "$ref": "#\/definitions\/healthQueue" + } + } + }, + "deprecated": false, + "x-appwrite": { + "method": "getQueueAudits", + "group": "queue", + "weight": 452, + "cookies": false, + "type": "", + "demo": "health\/get-queue-audits.md", + "rate-limit": 0, + "rate-time": 3600, + "rate-key": "url:{url},ip:{ip}", + "scope": "health.read", + "platforms": [ + "console", + "server" + ], + "packaging": false, + "public": true, + "edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-audits.md", + "auth": { + "Project": [] + } + }, + "security": [ + { + "Project": [], + "Key": [] + } + ], + "parameters": [ + { + "name": "threshold", + "description": "Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.", + "required": false, + "type": "integer", + "format": "int32", + "default": 5000, + "in": "query" + } + ] + } + }, "\/health\/queue\/builds": { "get": { "summary": "Get builds queue", @@ -16598,7 +16715,7 @@ "x-appwrite": { "method": "getQueueBuilds", "group": "queue", - "weight": 79, + "weight": 456, "cookies": false, "type": "", "demo": "health\/get-queue-builds.md", @@ -16660,7 +16777,7 @@ "x-appwrite": { "method": "getQueueCertificates", "group": "queue", - "weight": 78, + "weight": 455, "cookies": false, "type": "", "demo": "health\/get-queue-certificates.md", @@ -16722,7 +16839,7 @@ "x-appwrite": { "method": "getQueueDatabases", "group": "queue", - "weight": 80, + "weight": 457, "cookies": false, "type": "", "demo": "health\/get-queue-databases.md", @@ -16793,7 +16910,7 @@ "x-appwrite": { "method": "getQueueDeletes", "group": "queue", - "weight": 81, + "weight": 458, "cookies": false, "type": "", "demo": "health\/get-queue-deletes.md", @@ -16855,7 +16972,7 @@ "x-appwrite": { "method": "getFailedJobs", "group": "queue", - "weight": 91, + "weight": 465, "cookies": false, "type": "", "demo": "health\/get-failed-jobs.md", @@ -16898,6 +17015,7 @@ "v1-webhooks", "v1-certificates", "v1-builds", + "v1-screenshots", "v1-messaging", "v1-migrations" ], @@ -16941,7 +17059,7 @@ "x-appwrite": { "method": "getQueueFunctions", "group": "queue", - "weight": 85, + "weight": 462, "cookies": false, "type": "", "demo": "health\/get-queue-functions.md", @@ -17003,7 +17121,7 @@ "x-appwrite": { "method": "getQueueLogs", "group": "queue", - "weight": 76, + "weight": 454, "cookies": false, "type": "", "demo": "health\/get-queue-logs.md", @@ -17065,7 +17183,7 @@ "x-appwrite": { "method": "getQueueMails", "group": "queue", - "weight": 82, + "weight": 459, "cookies": false, "type": "", "demo": "health\/get-queue-mails.md", @@ -17127,7 +17245,7 @@ "x-appwrite": { "method": "getQueueMessaging", "group": "queue", - "weight": 83, + "weight": 460, "cookies": false, "type": "", "demo": "health\/get-queue-messaging.md", @@ -17189,7 +17307,7 @@ "x-appwrite": { "method": "getQueueMigrations", "group": "queue", - "weight": 84, + "weight": 461, "cookies": false, "type": "", "demo": "health\/get-queue-migrations.md", @@ -17251,7 +17369,7 @@ "x-appwrite": { "method": "getQueueStatsResources", "group": "queue", - "weight": 86, + "weight": 463, "cookies": false, "type": "", "demo": "health\/get-queue-stats-resources.md", @@ -17313,7 +17431,7 @@ "x-appwrite": { "method": "getQueueUsage", "group": "queue", - "weight": 87, + "weight": 464, "cookies": false, "type": "", "demo": "health\/get-queue-usage.md", @@ -17375,7 +17493,7 @@ "x-appwrite": { "method": "getQueueWebhooks", "group": "queue", - "weight": 75, + "weight": 453, "cookies": false, "type": "", "demo": "health\/get-queue-webhooks.md", @@ -17437,7 +17555,7 @@ "x-appwrite": { "method": "getStorage", "group": "storage", - "weight": 89, + "weight": 450, "cookies": false, "type": "", "demo": "health\/get-storage.md", @@ -17488,7 +17606,7 @@ "x-appwrite": { "method": "getStorageLocal", "group": "storage", - "weight": 88, + "weight": 449, "cookies": false, "type": "", "demo": "health\/get-storage-local.md", @@ -17539,7 +17657,7 @@ "x-appwrite": { "method": "getTime", "group": "health", - "weight": 74, + "weight": 447, "cookies": false, "type": "", "demo": "health\/get-time.md", @@ -17590,7 +17708,7 @@ "x-appwrite": { "method": "get", "group": null, - "weight": 61, + "weight": 49, "cookies": false, "type": "", "demo": "locale\/get.md", @@ -17643,7 +17761,7 @@ "x-appwrite": { "method": "listCodes", "group": null, - "weight": 62, + "weight": 50, "cookies": false, "type": "", "demo": "locale\/list-codes.md", @@ -17696,7 +17814,7 @@ "x-appwrite": { "method": "listContinents", "group": null, - "weight": 66, + "weight": 54, "cookies": false, "type": "", "demo": "locale\/list-continents.md", @@ -17749,7 +17867,7 @@ "x-appwrite": { "method": "listCountries", "group": null, - "weight": 63, + "weight": 51, "cookies": false, "type": "", "demo": "locale\/list-countries.md", @@ -17802,7 +17920,7 @@ "x-appwrite": { "method": "listCountriesEU", "group": null, - "weight": 64, + "weight": 52, "cookies": false, "type": "", "demo": "locale\/list-countries-eu.md", @@ -17855,7 +17973,7 @@ "x-appwrite": { "method": "listCountriesPhones", "group": null, - "weight": 65, + "weight": 53, "cookies": false, "type": "", "demo": "locale\/list-countries-phones.md", @@ -17908,7 +18026,7 @@ "x-appwrite": { "method": "listCurrencies", "group": null, - "weight": 67, + "weight": 55, "cookies": false, "type": "", "demo": "locale\/list-currencies.md", @@ -17961,7 +18079,7 @@ "x-appwrite": { "method": "listLanguages", "group": null, - "weight": 68, + "weight": 56, "cookies": false, "type": "", "demo": "locale\/list-languages.md", @@ -18014,7 +18132,7 @@ "x-appwrite": { "method": "listMessages", "group": "messages", - "weight": 298, + "weight": 245, "cookies": false, "type": "", "demo": "messaging\/list-messages.md", @@ -18099,7 +18217,7 @@ "x-appwrite": { "method": "createEmail", "group": "messages", - "weight": 295, + "weight": 242, "cookies": false, "type": "", "demo": "messaging\/create-email.md", @@ -18259,7 +18377,7 @@ "x-appwrite": { "method": "updateEmail", "group": "messages", - "weight": 302, + "weight": 249, "cookies": false, "type": "", "demo": "messaging\/update-email.md", @@ -18426,7 +18544,7 @@ "x-appwrite": { "method": "createPush", "group": "messages", - "weight": 297, + "weight": 244, "cookies": false, "type": "", "demo": "messaging\/create-push.md", @@ -18550,7 +18668,8 @@ "type": "integer", "description": "Badge for push notification. Available only for iOS Platform.", "default": -1, - "x-example": null + "x-example": null, + "format": "int32" }, "draft": { "type": "boolean", @@ -18624,7 +18743,7 @@ "x-appwrite": { "method": "updatePush", "group": "messages", - "weight": 304, + "weight": 251, "cookies": false, "type": "", "demo": "messaging\/update-push.md", @@ -18762,6 +18881,7 @@ "description": "Badge for push notification. Available only for iOS platforms.", "default": null, "x-example": null, + "format": "int32", "x-nullable": true }, "draft": { @@ -18837,7 +18957,7 @@ "x-appwrite": { "method": "createSms", "group": "messages", - "weight": 296, + "weight": 243, "cookies": false, "type": "", "demo": "messaging\/create-sms.md", @@ -19027,7 +19147,7 @@ "x-appwrite": { "method": "updateSms", "group": "messages", - "weight": 303, + "weight": 250, "cookies": false, "type": "", "demo": "messaging\/update-sms.md", @@ -19216,7 +19336,7 @@ "x-appwrite": { "method": "getMessage", "group": "messages", - "weight": 301, + "weight": 248, "cookies": false, "type": "", "demo": "messaging\/get-message.md", @@ -19272,7 +19392,7 @@ "x-appwrite": { "method": "delete", "group": "messages", - "weight": 305, + "weight": 252, "cookies": false, "type": "", "demo": "messaging\/delete.md", @@ -19333,7 +19453,7 @@ "x-appwrite": { "method": "listMessageLogs", "group": "logs", - "weight": 299, + "weight": 246, "cookies": false, "type": "", "demo": "messaging\/list-message-logs.md", @@ -19415,7 +19535,7 @@ "x-appwrite": { "method": "listTargets", "group": "messages", - "weight": 300, + "weight": 247, "cookies": false, "type": "", "demo": "messaging\/list-targets.md", @@ -19497,7 +19617,7 @@ "x-appwrite": { "method": "listProviders", "group": "providers", - "weight": 269, + "weight": 216, "cookies": false, "type": "", "demo": "messaging\/list-providers.md", @@ -19582,7 +19702,7 @@ "x-appwrite": { "method": "createApnsProvider", "group": "providers", - "weight": 268, + "weight": 215, "cookies": false, "type": "", "demo": "messaging\/create-apns-provider.md", @@ -19771,7 +19891,7 @@ "x-appwrite": { "method": "updateApnsProvider", "group": "providers", - "weight": 282, + "weight": 229, "cookies": false, "type": "", "demo": "messaging\/update-apns-provider.md", @@ -19957,7 +20077,7 @@ "x-appwrite": { "method": "createFcmProvider", "group": "providers", - "weight": 267, + "weight": 214, "cookies": false, "type": "", "demo": "messaging\/create-fcm-provider.md", @@ -20115,7 +20235,7 @@ "x-appwrite": { "method": "updateFcmProvider", "group": "providers", - "weight": 281, + "weight": 228, "cookies": false, "type": "", "demo": "messaging\/update-fcm-provider.md", @@ -20269,7 +20389,7 @@ "x-appwrite": { "method": "createMailgunProvider", "group": "providers", - "weight": 258, + "weight": 205, "cookies": false, "type": "", "demo": "messaging\/create-mailgun-provider.md", @@ -20342,7 +20462,8 @@ "type": "string", "description": "Sender email address.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -20354,7 +20475,8 @@ "type": "string", "description": "Email set in the reply to field for the mail. Default value is sender email. Reply to email must have reply to name as well.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "enabled": { "type": "boolean", @@ -20399,7 +20521,7 @@ "x-appwrite": { "method": "updateMailgunProvider", "group": "providers", - "weight": 272, + "weight": 219, "cookies": false, "type": "", "demo": "messaging\/update-mailgun-provider.md", @@ -20481,7 +20603,8 @@ "type": "string", "description": "Sender email address.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -20527,7 +20650,7 @@ "x-appwrite": { "method": "createMsg91Provider", "group": "providers", - "weight": 262, + "weight": 209, "cookies": false, "type": "", "demo": "messaging\/create-msg-91-provider.md", @@ -20632,7 +20755,7 @@ "x-appwrite": { "method": "updateMsg91Provider", "group": "providers", - "weight": 276, + "weight": 223, "cookies": false, "type": "", "demo": "messaging\/update-msg-91-provider.md", @@ -20735,7 +20858,7 @@ "x-appwrite": { "method": "createResendProvider", "group": "providers", - "weight": 260, + "weight": 207, "cookies": false, "type": "", "demo": "messaging\/create-resend-provider.md", @@ -20795,7 +20918,8 @@ "type": "string", "description": "Sender email address.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -20807,7 +20931,8 @@ "type": "string", "description": "Email set in the reply to field for the mail. Default value is sender email.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "enabled": { "type": "boolean", @@ -20852,7 +20977,7 @@ "x-appwrite": { "method": "updateResendProvider", "group": "providers", - "weight": 274, + "weight": 221, "cookies": false, "type": "", "demo": "messaging\/update-resend-provider.md", @@ -20921,7 +21046,8 @@ "type": "string", "description": "Sender email address.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -20967,7 +21093,7 @@ "x-appwrite": { "method": "createSendgridProvider", "group": "providers", - "weight": 259, + "weight": 206, "cookies": false, "type": "", "demo": "messaging\/create-sendgrid-provider.md", @@ -21027,7 +21153,8 @@ "type": "string", "description": "Sender email address.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -21039,7 +21166,8 @@ "type": "string", "description": "Email set in the reply to field for the mail. Default value is sender email.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "enabled": { "type": "boolean", @@ -21084,7 +21212,7 @@ "x-appwrite": { "method": "updateSendgridProvider", "group": "providers", - "weight": 273, + "weight": 220, "cookies": false, "type": "", "demo": "messaging\/update-sendgrid-provider.md", @@ -21153,7 +21281,8 @@ "type": "string", "description": "Sender email address.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -21199,7 +21328,7 @@ "x-appwrite": { "method": "createSmtpProvider", "group": "providers", - "weight": 261, + "weight": 208, "cookies": false, "type": "", "demo": "messaging\/create-smtp-provider.md", @@ -21339,7 +21468,8 @@ "type": "integer", "description": "The default SMTP server port.", "default": 587, - "x-example": 1 + "x-example": 1, + "format": "int32" }, "username": { "type": "string", @@ -21388,7 +21518,8 @@ "type": "string", "description": "Sender email address.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -21400,7 +21531,8 @@ "type": "string", "description": "Email set in the reply to field for the mail. Default value is sender email.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "enabled": { "type": "boolean", @@ -21446,7 +21578,7 @@ "x-appwrite": { "method": "updateSmtpProvider", "group": "providers", - "weight": 275, + "weight": 222, "cookies": false, "type": "", "demo": "messaging\/update-smtp-provider.md", @@ -21585,6 +21717,7 @@ "description": "SMTP port.", "default": null, "x-example": 1, + "format": "int32", "x-nullable": true }, "username": { @@ -21635,7 +21768,8 @@ "type": "string", "description": "Sender email address.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -21688,7 +21822,7 @@ "x-appwrite": { "method": "createTelesignProvider", "group": "providers", - "weight": 263, + "weight": 210, "cookies": false, "type": "", "demo": "messaging\/create-telesign-provider.md", @@ -21736,7 +21870,8 @@ "type": "string", "description": "Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", "default": "", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "customerId": { "type": "string", @@ -21793,7 +21928,7 @@ "x-appwrite": { "method": "updateTelesignProvider", "group": "providers", - "weight": 277, + "weight": 224, "cookies": false, "type": "", "demo": "messaging\/update-telesign-provider.md", @@ -21896,7 +22031,7 @@ "x-appwrite": { "method": "createTextmagicProvider", "group": "providers", - "weight": 264, + "weight": 211, "cookies": false, "type": "", "demo": "messaging\/create-textmagic-provider.md", @@ -21944,7 +22079,8 @@ "type": "string", "description": "Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", "default": "", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "username": { "type": "string", @@ -22001,7 +22137,7 @@ "x-appwrite": { "method": "updateTextmagicProvider", "group": "providers", - "weight": 278, + "weight": 225, "cookies": false, "type": "", "demo": "messaging\/update-textmagic-provider.md", @@ -22104,7 +22240,7 @@ "x-appwrite": { "method": "createTwilioProvider", "group": "providers", - "weight": 265, + "weight": 212, "cookies": false, "type": "", "demo": "messaging\/create-twilio-provider.md", @@ -22152,7 +22288,8 @@ "type": "string", "description": "Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", "default": "", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "accountSid": { "type": "string", @@ -22209,7 +22346,7 @@ "x-appwrite": { "method": "updateTwilioProvider", "group": "providers", - "weight": 279, + "weight": 226, "cookies": false, "type": "", "demo": "messaging\/update-twilio-provider.md", @@ -22312,7 +22449,7 @@ "x-appwrite": { "method": "createVonageProvider", "group": "providers", - "weight": 266, + "weight": 213, "cookies": false, "type": "", "demo": "messaging\/create-vonage-provider.md", @@ -22360,7 +22497,8 @@ "type": "string", "description": "Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", "default": "", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "apiKey": { "type": "string", @@ -22417,7 +22555,7 @@ "x-appwrite": { "method": "updateVonageProvider", "group": "providers", - "weight": 280, + "weight": 227, "cookies": false, "type": "", "demo": "messaging\/update-vonage-provider.md", @@ -22518,7 +22656,7 @@ "x-appwrite": { "method": "getProvider", "group": "providers", - "weight": 271, + "weight": 218, "cookies": false, "type": "", "demo": "messaging\/get-provider.md", @@ -22574,7 +22712,7 @@ "x-appwrite": { "method": "deleteProvider", "group": "providers", - "weight": 283, + "weight": 230, "cookies": false, "type": "", "demo": "messaging\/delete-provider.md", @@ -22635,7 +22773,7 @@ "x-appwrite": { "method": "listProviderLogs", "group": "providers", - "weight": 270, + "weight": 217, "cookies": false, "type": "", "demo": "messaging\/list-provider-logs.md", @@ -22717,7 +22855,7 @@ "x-appwrite": { "method": "listSubscriberLogs", "group": "subscribers", - "weight": 292, + "weight": 239, "cookies": false, "type": "", "demo": "messaging\/list-subscriber-logs.md", @@ -22799,7 +22937,7 @@ "x-appwrite": { "method": "listTopics", "group": "topics", - "weight": 285, + "weight": 232, "cookies": false, "type": "", "demo": "messaging\/list-topics.md", @@ -22882,7 +23020,7 @@ "x-appwrite": { "method": "createTopic", "group": "topics", - "weight": 284, + "weight": 231, "cookies": false, "type": "", "demo": "messaging\/create-topic.md", @@ -22971,7 +23109,7 @@ "x-appwrite": { "method": "getTopic", "group": "topics", - "weight": 287, + "weight": 234, "cookies": false, "type": "", "demo": "messaging\/get-topic.md", @@ -23032,7 +23170,7 @@ "x-appwrite": { "method": "updateTopic", "group": "topics", - "weight": 288, + "weight": 235, "cookies": false, "type": "", "demo": "messaging\/update-topic.md", @@ -23114,7 +23252,7 @@ "x-appwrite": { "method": "deleteTopic", "group": "topics", - "weight": 289, + "weight": 236, "cookies": false, "type": "", "demo": "messaging\/delete-topic.md", @@ -23175,7 +23313,7 @@ "x-appwrite": { "method": "listTopicLogs", "group": "topics", - "weight": 286, + "weight": 233, "cookies": false, "type": "", "demo": "messaging\/list-topic-logs.md", @@ -23257,7 +23395,7 @@ "x-appwrite": { "method": "listSubscribers", "group": "subscribers", - "weight": 291, + "weight": 238, "cookies": false, "type": "", "demo": "messaging\/list-subscribers.md", @@ -23348,7 +23486,7 @@ "x-appwrite": { "method": "createSubscriber", "group": "subscribers", - "weight": 290, + "weight": 237, "cookies": false, "type": "", "demo": "messaging\/create-subscriber.md", @@ -23436,7 +23574,7 @@ "x-appwrite": { "method": "getSubscriber", "group": "subscribers", - "weight": 293, + "weight": 240, "cookies": false, "type": "", "demo": "messaging\/get-subscriber.md", @@ -23500,7 +23638,7 @@ "x-appwrite": { "method": "deleteSubscriber", "group": "subscribers", - "weight": 294, + "weight": 241, "cookies": false, "type": "", "demo": "messaging\/delete-subscriber.md", @@ -23571,7 +23709,7 @@ "x-appwrite": { "method": "list", "group": null, - "weight": 250, + "weight": 197, "cookies": false, "type": "", "demo": "migrations\/list.md", @@ -23654,7 +23792,7 @@ "x-appwrite": { "method": "createAppwriteMigration", "group": null, - "weight": 244, + "weight": 191, "cookies": false, "type": "", "demo": "migrations\/create-appwrite-migration.md", @@ -23717,7 +23855,8 @@ "type": "string", "description": "Source Appwrite endpoint", "default": null, - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" }, "projectId": { "type": "string", @@ -23767,7 +23906,7 @@ "x-appwrite": { "method": "getAppwriteReport", "group": null, - "weight": 252, + "weight": 199, "cookies": false, "type": "", "demo": "migrations\/get-appwrite-report.md", @@ -23876,7 +24015,7 @@ "x-appwrite": { "method": "createCSVExport", "group": null, - "weight": 249, + "weight": 196, "cookies": false, "type": "", "demo": "migrations\/create-csv-export.md", @@ -24002,7 +24141,7 @@ "x-appwrite": { "method": "createCSVImport", "group": null, - "weight": 248, + "weight": 195, "cookies": false, "type": "", "demo": "migrations\/create-csv-import.md", @@ -24093,7 +24232,7 @@ "x-appwrite": { "method": "createFirebaseMigration", "group": null, - "weight": 245, + "weight": 192, "cookies": false, "type": "", "demo": "migrations\/create-firebase-migration.md", @@ -24186,7 +24325,7 @@ "x-appwrite": { "method": "getFirebaseReport", "group": null, - "weight": 253, + "weight": 200, "cookies": false, "type": "", "demo": "migrations\/get-firebase-report.md", @@ -24272,7 +24411,7 @@ "x-appwrite": { "method": "createNHostMigration", "group": null, - "weight": 247, + "weight": 194, "cookies": false, "type": "", "demo": "migrations\/create-n-host-migration.md", @@ -24366,7 +24505,8 @@ "type": "integer", "description": "Source's Database Port", "default": 5432, - "x-example": null + "x-example": null, + "format": "int32" } }, "required": [ @@ -24407,7 +24547,7 @@ "x-appwrite": { "method": "getNHostReport", "group": null, - "weight": 255, + "weight": 202, "cookies": false, "type": "", "demo": "migrations\/get-n-host-report.md", @@ -24543,7 +24683,7 @@ "x-appwrite": { "method": "createSupabaseMigration", "group": null, - "weight": 246, + "weight": 193, "cookies": false, "type": "", "demo": "migrations\/create-supabase-migration.md", @@ -24601,7 +24741,8 @@ "type": "string", "description": "Source's Supabase Endpoint", "default": null, - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" }, "apiKey": { "type": "string", @@ -24631,7 +24772,8 @@ "type": "integer", "description": "Source's Database Port", "default": 5432, - "x-example": null + "x-example": null, + "format": "int32" } }, "required": [ @@ -24671,7 +24813,7 @@ "x-appwrite": { "method": "getSupabaseReport", "group": null, - "weight": 254, + "weight": 201, "cookies": false, "type": "", "demo": "migrations\/get-supabase-report.md", @@ -24798,7 +24940,7 @@ "x-appwrite": { "method": "get", "group": null, - "weight": 251, + "weight": 198, "cookies": false, "type": "", "demo": "migrations\/get.md", @@ -24857,7 +24999,7 @@ "x-appwrite": { "method": "retry", "group": null, - "weight": 256, + "weight": 203, "cookies": false, "type": "", "demo": "migrations\/retry.md", @@ -24911,7 +25053,7 @@ "x-appwrite": { "method": "delete", "group": null, - "weight": 257, + "weight": 204, "cookies": false, "type": "", "demo": "migrations\/delete.md", @@ -24970,7 +25112,7 @@ "x-appwrite": { "method": "getUsage", "group": null, - "weight": 139, + "weight": 103, "cookies": false, "type": "", "demo": "project\/get-usage.md", @@ -25053,7 +25195,7 @@ "x-appwrite": { "method": "listVariables", "group": null, - "weight": 141, + "weight": 105, "cookies": false, "type": "", "demo": "project\/list-variables.md", @@ -25102,7 +25244,7 @@ "x-appwrite": { "method": "createVariable", "group": null, - "weight": 140, + "weight": 104, "cookies": false, "type": "", "demo": "project\/create-variable.md", @@ -25184,7 +25326,7 @@ "x-appwrite": { "method": "getVariable", "group": null, - "weight": 142, + "weight": 106, "cookies": false, "type": "", "demo": "project\/get-variable.md", @@ -25243,7 +25385,7 @@ "x-appwrite": { "method": "updateVariable", "group": null, - "weight": 143, + "weight": 107, "cookies": false, "type": "", "demo": "project\/update-variable.md", @@ -25329,7 +25471,7 @@ "x-appwrite": { "method": "deleteVariable", "group": null, - "weight": 144, + "weight": 108, "cookies": false, "type": "", "demo": "project\/delete-variable.md", @@ -25388,7 +25530,7 @@ "x-appwrite": { "method": "list", "group": "projects", - "weight": 452, + "weight": 410, "cookies": false, "type": "", "demo": "projects\/list.md", @@ -25413,7 +25555,7 @@ "parameters": [ { "name": "queries", - "description": "Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https:\/\/appwrite.io\/docs\/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, teamId", + "description": "Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https:\/\/appwrite.io\/docs\/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, teamId, labels, search", "required": false, "type": "array", "collectionFormat": "multi", @@ -25468,7 +25610,7 @@ "x-appwrite": { "method": "create", "group": "projects", - "weight": 93, + "weight": 57, "cookies": false, "type": "", "demo": "projects\/create.md", @@ -25543,7 +25685,8 @@ "type": "string", "description": "Project URL.", "default": "", - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" }, "legalName": { "type": "string", @@ -25616,7 +25759,7 @@ "x-appwrite": { "method": "get", "group": "projects", - "weight": 94, + "weight": 58, "cookies": false, "type": "", "demo": "projects\/get.md", @@ -25675,7 +25818,7 @@ "x-appwrite": { "method": "update", "group": "projects", - "weight": 95, + "weight": 59, "cookies": false, "type": "", "demo": "projects\/update.md", @@ -25735,7 +25878,8 @@ "type": "string", "description": "Project URL.", "default": "", - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" }, "legalName": { "type": "string", @@ -25801,7 +25945,7 @@ "x-appwrite": { "method": "delete", "group": "projects", - "weight": 112, + "weight": 76, "cookies": false, "type": "", "demo": "projects\/delete.md", @@ -25862,7 +26006,7 @@ "x-appwrite": { "method": "updateApiStatus", "group": "projects", - "weight": 99, + "weight": 63, "cookies": false, "type": "", "demo": "projects\/update-api-status.md", @@ -26019,7 +26163,7 @@ "x-appwrite": { "method": "updateApiStatusAll", "group": "projects", - "weight": 100, + "weight": 64, "cookies": false, "type": "", "demo": "projects\/update-api-status-all.md", @@ -26158,7 +26302,7 @@ "x-appwrite": { "method": "updateAuthDuration", "group": "auth", - "weight": 105, + "weight": 69, "cookies": false, "type": "", "demo": "projects\/update-auth-duration.md", @@ -26200,7 +26344,8 @@ "type": "integer", "description": "Project session length in seconds. Max length: 31536000 seconds.", "default": null, - "x-example": 0 + "x-example": 0, + "format": "int32" } }, "required": [ @@ -26237,7 +26382,7 @@ "x-appwrite": { "method": "updateAuthLimit", "group": "auth", - "weight": 104, + "weight": 68, "cookies": false, "type": "", "demo": "projects\/update-auth-limit.md", @@ -26279,7 +26424,8 @@ "type": "integer", "description": "Set the max number of users allowed in this project. Use 0 for unlimited.", "default": null, - "x-example": 0 + "x-example": 0, + "format": "int32" } }, "required": [ @@ -26316,7 +26462,7 @@ "x-appwrite": { "method": "updateAuthSessionsLimit", "group": "auth", - "weight": 110, + "weight": 74, "cookies": false, "type": "", "demo": "projects\/update-auth-sessions-limit.md", @@ -26358,7 +26504,8 @@ "type": "integer", "description": "Set the max number of users allowed in this project. Value allowed is between 1-100. Default is 10", "default": null, - "x-example": 1 + "x-example": 1, + "format": "int32" } }, "required": [ @@ -26395,7 +26542,7 @@ "x-appwrite": { "method": "updateMembershipsPrivacy", "group": "auth", - "weight": 103, + "weight": 67, "cookies": false, "type": "", "demo": "projects\/update-memberships-privacy.md", @@ -26488,7 +26635,7 @@ "x-appwrite": { "method": "updateMockNumbers", "group": "auth", - "weight": 111, + "weight": 75, "cookies": false, "type": "", "demo": "projects\/update-mock-numbers.md", @@ -26570,7 +26717,7 @@ "x-appwrite": { "method": "updateAuthPasswordDictionary", "group": "auth", - "weight": 108, + "weight": 72, "cookies": false, "type": "", "demo": "projects\/update-auth-password-dictionary.md", @@ -26649,7 +26796,7 @@ "x-appwrite": { "method": "updateAuthPasswordHistory", "group": "auth", - "weight": 107, + "weight": 71, "cookies": false, "type": "", "demo": "projects\/update-auth-password-history.md", @@ -26691,7 +26838,8 @@ "type": "integer", "description": "Set the max number of passwords to store in user history. User can't choose a new password that is already stored in the password history list. Max number of passwords allowed in history is20. Default value is 0", "default": null, - "x-example": 0 + "x-example": 0, + "format": "int32" } }, "required": [ @@ -26728,7 +26876,7 @@ "x-appwrite": { "method": "updatePersonalDataCheck", "group": "auth", - "weight": 109, + "weight": 73, "cookies": false, "type": "", "demo": "projects\/update-personal-data-check.md", @@ -26807,7 +26955,7 @@ "x-appwrite": { "method": "updateSessionAlerts", "group": "auth", - "weight": 102, + "weight": 66, "cookies": false, "type": "", "demo": "projects\/update-session-alerts.md", @@ -26886,7 +27034,7 @@ "x-appwrite": { "method": "updateSessionInvalidation", "group": "auth", - "weight": 138, + "weight": 102, "cookies": false, "type": "", "demo": "projects\/update-session-invalidation.md", @@ -26965,7 +27113,7 @@ "x-appwrite": { "method": "updateAuthStatus", "group": "auth", - "weight": 106, + "weight": 70, "cookies": false, "type": "", "demo": "projects\/update-auth-status.md", @@ -27061,14 +27209,14 @@ "x-appwrite": { "method": "listDevKeys", "group": "devKeys", - "weight": 450, + "weight": 408, "cookies": false, "type": "", "demo": "projects\/list-dev-keys.md", "rate-limit": 0, "rate-time": 3600, "rate-key": "url:{url},ip:{ip}", - "scope": "projects.read", + "scope": "devKeys.read", "platforms": [ "console" ], @@ -27131,14 +27279,14 @@ "x-appwrite": { "method": "createDevKey", "group": "devKeys", - "weight": 447, + "weight": 405, "cookies": false, "type": "", "demo": "projects\/create-dev-key.md", "rate-limit": 0, "rate-time": 3600, "rate-key": "url:{url},ip:{ip}", - "scope": "projects.write", + "scope": "devKeys.write", "platforms": [ "console" ], @@ -27214,14 +27362,14 @@ "x-appwrite": { "method": "getDevKey", "group": "devKeys", - "weight": 449, + "weight": 407, "cookies": false, "type": "", "demo": "projects\/get-dev-key.md", "rate-limit": 0, "rate-time": 3600, "rate-key": "url:{url},ip:{ip}", - "scope": "projects.read", + "scope": "devKeys.read", "platforms": [ "console" ], @@ -27280,14 +27428,14 @@ "x-appwrite": { "method": "updateDevKey", "group": "devKeys", - "weight": 448, + "weight": 406, "cookies": false, "type": "", "demo": "projects\/update-dev-key.md", "rate-limit": 0, "rate-time": 3600, "rate-key": "url:{url},ip:{ip}", - "scope": "projects.write", + "scope": "devKeys.write", "platforms": [ "console" ], @@ -27366,14 +27514,14 @@ "x-appwrite": { "method": "deleteDevKey", "group": "devKeys", - "weight": 451, + "weight": 409, "cookies": false, "type": "", "demo": "projects\/delete-dev-key.md", "rate-limit": 0, "rate-time": 3600, "rate-key": "url:{url},ip:{ip}", - "scope": "projects.write", + "scope": "devKeys.write", "platforms": [ "console" ], @@ -27434,7 +27582,7 @@ "x-appwrite": { "method": "createJWT", "group": "auth", - "weight": 124, + "weight": 88, "cookies": false, "type": "", "demo": "projects\/create-jwt.md", @@ -27544,7 +27692,8 @@ "type": "integer", "description": "Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds.", "default": 900, - "x-example": 0 + "x-example": 0, + "format": "int32" } }, "required": [ @@ -27579,7 +27728,7 @@ "x-appwrite": { "method": "listKeys", "group": "keys", - "weight": 120, + "weight": 84, "cookies": false, "type": "", "demo": "projects\/list-keys.md", @@ -27647,7 +27796,7 @@ "x-appwrite": { "method": "createKey", "group": "keys", - "weight": 119, + "weight": 83, "cookies": false, "type": "", "demo": "projects\/create-key.md", @@ -27801,7 +27950,7 @@ "x-appwrite": { "method": "getKey", "group": "keys", - "weight": 121, + "weight": 85, "cookies": false, "type": "", "demo": "projects\/get-key.md", @@ -27868,7 +28017,7 @@ "x-appwrite": { "method": "updateKey", "group": "keys", - "weight": 122, + "weight": 86, "cookies": false, "type": "", "demo": "projects\/update-key.md", @@ -28025,7 +28174,7 @@ "x-appwrite": { "method": "deleteKey", "group": "keys", - "weight": 123, + "weight": 87, "cookies": false, "type": "", "demo": "projects\/delete-key.md", @@ -28068,6 +28217,87 @@ ] } }, + "\/projects\/{projectId}\/labels": { + "put": { + "summary": "Update project labels", + "operationId": "projectsUpdateLabels", + "consumes": [ + "application\/json" + ], + "produces": [ + "application\/json" + ], + "tags": [ + "projects" + ], + "description": "Update the project labels by its unique ID. Labels can be used to easily filter projects in an organization.", + "responses": { + "200": { + "description": "Project", + "schema": { + "$ref": "#\/definitions\/project" + } + } + }, + "deprecated": false, + "x-appwrite": { + "method": "updateLabels", + "group": "projects", + "weight": 411, + "cookies": false, + "type": "", + "demo": "projects\/update-labels.md", + "rate-limit": 0, + "rate-time": 3600, + "rate-key": "url:{url},ip:{ip}", + "scope": "projects.write", + "platforms": [ + "console" + ], + "packaging": false, + "public": true, + "auth": { + "Project": [] + } + }, + "security": [ + { + "Project": [] + } + ], + "parameters": [ + { + "name": "projectId", + "description": "Project unique ID.", + "required": true, + "type": "string", + "x-example": "", + "in": "path" + }, + { + "name": "payload", + "in": "body", + "schema": { + "type": "object", + "properties": { + "labels": { + "type": "array", + "description": "Array of project labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long.", + "default": null, + "x-example": null, + "items": { + "type": "string" + } + } + }, + "required": [ + "labels" + ] + } + } + ] + } + }, "\/projects\/{projectId}\/oauth2": { "patch": { "summary": "Update project OAuth2", @@ -28094,7 +28324,7 @@ "x-appwrite": { "method": "updateOAuth2", "group": "auth", - "weight": 101, + "weight": 65, "cookies": false, "type": "", "demo": "projects\/update-o-auth-2.md", @@ -28176,8 +28406,7 @@ "yammer", "yandex", "zoho", - "zoom", - "mock" + "zoom" ], "x-enum-name": "OAuthProvider", "x-enum-keys": [] @@ -28236,7 +28465,7 @@ "x-appwrite": { "method": "listPlatforms", "group": "platforms", - "weight": 126, + "weight": 90, "cookies": false, "type": "", "demo": "projects\/list-platforms.md", @@ -28304,7 +28533,7 @@ "x-appwrite": { "method": "createPlatform", "group": "platforms", - "weight": 125, + "weight": 89, "cookies": false, "type": "", "demo": "projects\/create-platform.md", @@ -28425,7 +28654,7 @@ "x-appwrite": { "method": "getPlatform", "group": "platforms", - "weight": 127, + "weight": 91, "cookies": false, "type": "", "demo": "projects\/get-platform.md", @@ -28492,7 +28721,7 @@ "x-appwrite": { "method": "updatePlatform", "group": "platforms", - "weight": 128, + "weight": 92, "cookies": false, "type": "", "demo": "projects\/update-platform.md", @@ -28590,7 +28819,7 @@ "x-appwrite": { "method": "deletePlatform", "group": "platforms", - "weight": 129, + "weight": 93, "cookies": false, "type": "", "demo": "projects\/delete-platform.md", @@ -28659,7 +28888,7 @@ "x-appwrite": { "method": "updateServiceStatus", "group": "projects", - "weight": 97, + "weight": 61, "cookies": false, "type": "", "demo": "projects\/update-service-status.md", @@ -28762,7 +28991,7 @@ "x-appwrite": { "method": "updateServiceStatusAll", "group": "projects", - "weight": 98, + "weight": 62, "cookies": false, "type": "", "demo": "projects\/update-service-status-all.md", @@ -28841,7 +29070,7 @@ "x-appwrite": { "method": "updateSmtp", "group": "templates", - "weight": 130, + "weight": 94, "cookies": false, "type": "", "demo": "projects\/update-smtp.md", @@ -28971,13 +29200,15 @@ "type": "string", "description": "Email of the sender", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyTo": { "type": "string", "description": "Reply to email", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "host": { "type": "string", @@ -28989,7 +29220,8 @@ "type": "integer", "description": "SMTP server port", "default": 587, - "x-example": null + "x-example": null, + "format": "int32" }, "username": { "type": "string", @@ -29047,7 +29279,7 @@ "x-appwrite": { "method": "createSmtpTest", "group": "templates", - "weight": 131, + "weight": 95, "cookies": false, "type": "", "demo": "projects\/create-smtp-test.md", @@ -29184,13 +29416,15 @@ "type": "string", "description": "Email of the sender", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyTo": { "type": "string", "description": "Reply to email", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "host": { "type": "string", @@ -29202,7 +29436,8 @@ "type": "integer", "description": "SMTP server port", "default": 587, - "x-example": null + "x-example": null, + "format": "int32" }, "username": { "type": "string", @@ -29266,7 +29501,7 @@ "x-appwrite": { "method": "updateTeam", "group": "projects", - "weight": 96, + "weight": 60, "cookies": false, "type": "", "demo": "projects\/update-team.md", @@ -29343,7 +29578,7 @@ "x-appwrite": { "method": "getEmailTemplate", "group": "templates", - "weight": 133, + "weight": 97, "cookies": false, "type": "", "demo": "projects\/get-email-template.md", @@ -29564,7 +29799,7 @@ "x-appwrite": { "method": "updateEmailTemplate", "group": "templates", - "weight": 135, + "weight": 99, "cookies": false, "type": "", "demo": "projects\/update-email-template.md", @@ -29786,13 +30021,15 @@ "type": "string", "description": "Email of the sender", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyTo": { "type": "string", "description": "Reply to email", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" } }, "required": [ @@ -29828,7 +30065,7 @@ "x-appwrite": { "method": "deleteEmailTemplate", "group": "templates", - "weight": 137, + "weight": 101, "cookies": false, "type": "", "demo": "projects\/delete-email-template.md", @@ -30049,7 +30286,7 @@ "x-appwrite": { "method": "getSmsTemplate", "group": "templates", - "weight": 132, + "weight": 96, "cookies": false, "type": "", "demo": "projects\/get-sms-template.md", @@ -30331,7 +30568,7 @@ "x-appwrite": { "method": "updateSmsTemplate", "group": "templates", - "weight": 134, + "weight": 98, "cookies": false, "type": "", "demo": "projects\/update-sms-template.md", @@ -30635,7 +30872,7 @@ "x-appwrite": { "method": "deleteSmsTemplate", "group": "templates", - "weight": 136, + "weight": 100, "cookies": false, "type": "", "demo": "projects\/delete-sms-template.md", @@ -30917,7 +31154,7 @@ "x-appwrite": { "method": "listWebhooks", "group": "webhooks", - "weight": 114, + "weight": 78, "cookies": false, "type": "", "demo": "projects\/list-webhooks.md", @@ -30985,7 +31222,7 @@ "x-appwrite": { "method": "createWebhook", "group": "webhooks", - "weight": 113, + "weight": 77, "cookies": false, "type": "", "demo": "projects\/create-webhook.md", @@ -31104,7 +31341,7 @@ "x-appwrite": { "method": "getWebhook", "group": "webhooks", - "weight": 115, + "weight": 79, "cookies": false, "type": "", "demo": "projects\/get-webhook.md", @@ -31171,7 +31408,7 @@ "x-appwrite": { "method": "updateWebhook", "group": "webhooks", - "weight": 116, + "weight": 80, "cookies": false, "type": "", "demo": "projects\/update-webhook.md", @@ -31293,7 +31530,7 @@ "x-appwrite": { "method": "deleteWebhook", "group": "webhooks", - "weight": 118, + "weight": 82, "cookies": false, "type": "", "demo": "projects\/delete-webhook.md", @@ -31362,7 +31599,7 @@ "x-appwrite": { "method": "updateWebhookSignature", "group": "webhooks", - "weight": 117, + "weight": 81, "cookies": false, "type": "", "demo": "projects\/update-webhook-signature.md", @@ -31429,7 +31666,7 @@ "x-appwrite": { "method": "listRules", "group": null, - "weight": 518, + "weight": 512, "cookies": false, "type": "", "demo": "proxy\/list-rules.md", @@ -31511,7 +31748,7 @@ "x-appwrite": { "method": "createAPIRule", "group": null, - "weight": 513, + "weight": 507, "cookies": false, "type": "", "demo": "proxy\/create-api-rule.md", @@ -31581,7 +31818,7 @@ "x-appwrite": { "method": "createFunctionRule", "group": null, - "weight": 515, + "weight": 509, "cookies": false, "type": "", "demo": "proxy\/create-function-rule.md", @@ -31664,7 +31901,7 @@ "x-appwrite": { "method": "createRedirectRule", "group": null, - "weight": 516, + "weight": 510, "cookies": false, "type": "", "demo": "proxy\/create-redirect-rule.md", @@ -31703,7 +31940,8 @@ "type": "string", "description": "Target URL of redirection", "default": null, - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" }, "statusCode": { "type": "string", @@ -31784,7 +32022,7 @@ "x-appwrite": { "method": "createSiteRule", "group": null, - "weight": 514, + "weight": 508, "cookies": false, "type": "", "demo": "proxy\/create-site-rule.md", @@ -31865,7 +32103,7 @@ "x-appwrite": { "method": "getRule", "group": null, - "weight": 517, + "weight": 511, "cookies": false, "type": "", "demo": "proxy\/get-rule.md", @@ -31918,7 +32156,7 @@ "x-appwrite": { "method": "deleteRule", "group": null, - "weight": 519, + "weight": 513, "cookies": false, "type": "", "demo": "proxy\/delete-rule.md", @@ -31978,7 +32216,7 @@ "x-appwrite": { "method": "updateRuleVerification", "group": null, - "weight": 520, + "weight": 514, "cookies": false, "type": "", "demo": "proxy\/update-rule-verification.md", @@ -32036,7 +32274,7 @@ "x-appwrite": { "method": "list", "group": "sites", - "weight": 485, + "weight": 469, "cookies": false, "type": "", "demo": "sites\/list.md", @@ -32118,7 +32356,7 @@ "x-appwrite": { "method": "create", "group": "sites", - "weight": 483, + "weight": 467, "cookies": false, "type": "", "demo": "sites\/create.md", @@ -32202,7 +32440,8 @@ "type": "integer", "description": "Maximum request time in seconds.", "default": 30, - "x-example": 1 + "x-example": 1, + "format": "int32" }, "installCommand": { "type": "string", @@ -32389,7 +32628,7 @@ "x-appwrite": { "method": "listFrameworks", "group": "frameworks", - "weight": 488, + "weight": 472, "cookies": false, "type": "", "demo": "sites\/list-frameworks.md", @@ -32439,7 +32678,7 @@ "x-appwrite": { "method": "listSpecifications", "group": "frameworks", - "weight": 511, + "weight": 495, "cookies": false, "type": "", "demo": "sites\/list-specifications.md", @@ -32489,7 +32728,7 @@ "x-appwrite": { "method": "listTemplates", "group": "templates", - "weight": 507, + "weight": 491, "cookies": false, "type": "", "demo": "sites\/list-templates.md", @@ -32612,7 +32851,7 @@ "x-appwrite": { "method": "getTemplate", "group": "templates", - "weight": 508, + "weight": 492, "cookies": false, "type": "", "demo": "sites\/get-template.md", @@ -32670,7 +32909,7 @@ "x-appwrite": { "method": "listUsage", "group": null, - "weight": 509, + "weight": 493, "cookies": false, "type": "", "demo": "sites\/list-usage.md", @@ -32740,7 +32979,7 @@ "x-appwrite": { "method": "get", "group": "sites", - "weight": 484, + "weight": 468, "cookies": false, "type": "", "demo": "sites\/get.md", @@ -32800,7 +33039,7 @@ "x-appwrite": { "method": "update", "group": "sites", - "weight": 486, + "weight": 470, "cookies": false, "type": "", "demo": "sites\/update.md", @@ -32886,7 +33125,8 @@ "type": "integer", "description": "Maximum request time in seconds.", "default": 30, - "x-example": 1 + "x-example": 1, + "format": "int32" }, "installCommand": { "type": "string", @@ -33066,7 +33306,7 @@ "x-appwrite": { "method": "delete", "group": "sites", - "weight": 487, + "weight": 471, "cookies": false, "type": "", "demo": "sites\/delete.md", @@ -33128,7 +33368,7 @@ "x-appwrite": { "method": "updateSiteDeployment", "group": "sites", - "weight": 494, + "weight": 478, "cookies": false, "type": "", "demo": "sites\/update-site-deployment.md", @@ -33206,7 +33446,7 @@ "x-appwrite": { "method": "listDeployments", "group": "deployments", - "weight": 493, + "weight": 477, "cookies": false, "type": "", "demo": "sites\/list-deployments.md", @@ -33296,7 +33536,7 @@ "x-appwrite": { "method": "createDeployment", "group": "deployments", - "weight": 489, + "weight": 473, "cookies": false, "type": "upload", "demo": "sites\/create-deployment.md", @@ -33397,7 +33637,7 @@ "x-appwrite": { "method": "createDuplicateDeployment", "group": "deployments", - "weight": 497, + "weight": 481, "cookies": false, "type": "", "demo": "sites\/create-duplicate-deployment.md", @@ -33477,7 +33717,7 @@ "x-appwrite": { "method": "createTemplateDeployment", "group": "deployments", - "weight": 490, + "weight": 474, "cookies": false, "type": "", "demo": "sites\/create-template-deployment.md", @@ -33598,7 +33838,7 @@ "x-appwrite": { "method": "createVcsDeployment", "group": "deployments", - "weight": 491, + "weight": 475, "cookies": false, "type": "", "demo": "sites\/create-vcs-deployment.md", @@ -33696,7 +33936,7 @@ "x-appwrite": { "method": "getDeployment", "group": "deployments", - "weight": 492, + "weight": 476, "cookies": false, "type": "", "demo": "sites\/get-deployment.md", @@ -33759,7 +33999,7 @@ "x-appwrite": { "method": "deleteDeployment", "group": "deployments", - "weight": 495, + "weight": 479, "cookies": false, "type": "", "demo": "sites\/delete-deployment.md", @@ -33827,7 +34067,7 @@ "x-appwrite": { "method": "getDeploymentDownload", "group": "deployments", - "weight": 496, + "weight": 480, "cookies": false, "type": "location", "demo": "sites\/get-deployment-download.md", @@ -33913,7 +34153,7 @@ "x-appwrite": { "method": "updateDeploymentStatus", "group": "deployments", - "weight": 498, + "weight": 482, "cookies": false, "type": "", "demo": "sites\/update-deployment-status.md", @@ -33981,7 +34221,7 @@ "x-appwrite": { "method": "listLogs", "group": "logs", - "weight": 500, + "weight": 484, "cookies": false, "type": "", "demo": "sites\/list-logs.md", @@ -34062,7 +34302,7 @@ "x-appwrite": { "method": "getLog", "group": "logs", - "weight": 499, + "weight": 483, "cookies": false, "type": "", "demo": "sites\/get-log.md", @@ -34127,7 +34367,7 @@ "x-appwrite": { "method": "deleteLog", "group": "logs", - "weight": 501, + "weight": 485, "cookies": false, "type": "", "demo": "sites\/delete-log.md", @@ -34195,7 +34435,7 @@ "x-appwrite": { "method": "getUsage", "group": null, - "weight": 510, + "weight": 494, "cookies": false, "type": "", "demo": "sites\/get-usage.md", @@ -34273,7 +34513,7 @@ "x-appwrite": { "method": "listVariables", "group": "variables", - "weight": 504, + "weight": 488, "cookies": false, "type": "", "demo": "sites\/list-variables.md", @@ -34333,7 +34573,7 @@ "x-appwrite": { "method": "createVariable", "group": "variables", - "weight": 502, + "weight": 486, "cookies": false, "type": "", "demo": "sites\/create-variable.md", @@ -34424,7 +34664,7 @@ "x-appwrite": { "method": "getVariable", "group": "variables", - "weight": 503, + "weight": 487, "cookies": false, "type": "", "demo": "sites\/get-variable.md", @@ -34492,7 +34732,7 @@ "x-appwrite": { "method": "updateVariable", "group": "variables", - "weight": 505, + "weight": 489, "cookies": false, "type": "", "demo": "sites\/update-variable.md", @@ -34587,7 +34827,7 @@ "x-appwrite": { "method": "deleteVariable", "group": "variables", - "weight": 506, + "weight": 490, "cookies": false, "type": "", "demo": "sites\/delete-variable.md", @@ -34655,7 +34895,7 @@ "x-appwrite": { "method": "listBuckets", "group": "buckets", - "weight": 146, + "weight": 522, "cookies": false, "type": "", "demo": "storage\/list-buckets.md", @@ -34738,7 +34978,7 @@ "x-appwrite": { "method": "createBucket", "group": "buckets", - "weight": 145, + "weight": 520, "cookies": false, "type": "", "demo": "storage\/create-bucket.md", @@ -34808,7 +35048,8 @@ "type": "integer", "description": "Maximum file size allowed in bytes. Maximum allowed value is 30MB.", "default": {}, - "x-example": 1 + "x-example": 1, + "format": "int32" }, "allowedFileExtensions": { "type": "array", @@ -34821,7 +35062,7 @@ }, "compression": { "type": "string", - "description": "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", + "description": "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", "default": "none", "x-example": "none", "enum": [ @@ -34884,7 +35125,7 @@ "x-appwrite": { "method": "getBucket", "group": "buckets", - "weight": 147, + "weight": 521, "cookies": false, "type": "", "demo": "storage\/get-bucket.md", @@ -34945,7 +35186,7 @@ "x-appwrite": { "method": "updateBucket", "group": "buckets", - "weight": 148, + "weight": 523, "cookies": false, "type": "", "demo": "storage\/update-bucket.md", @@ -35017,7 +35258,8 @@ "type": "integer", "description": "Maximum file size allowed in bytes. Maximum allowed value is 30MB.", "default": {}, - "x-example": 1 + "x-example": 1, + "format": "int32" }, "allowedFileExtensions": { "type": "array", @@ -35030,7 +35272,7 @@ }, "compression": { "type": "string", - "description": "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", + "description": "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", "default": "none", "x-example": "none", "enum": [ @@ -35087,7 +35329,7 @@ "x-appwrite": { "method": "deleteBucket", "group": "buckets", - "weight": 149, + "weight": 524, "cookies": false, "type": "", "demo": "storage\/delete-bucket.md", @@ -35148,7 +35390,7 @@ "x-appwrite": { "method": "listFiles", "group": "files", - "weight": 151, + "weight": 527, "cookies": false, "type": "", "demo": "storage\/list-files.md", @@ -35241,7 +35483,7 @@ "x-appwrite": { "method": "createFile", "group": "files", - "weight": 150, + "weight": 525, "cookies": false, "type": "upload", "demo": "storage\/create-file.md", @@ -35332,7 +35574,7 @@ "x-appwrite": { "method": "getFile", "group": "files", - "weight": 152, + "weight": 526, "cookies": false, "type": "", "demo": "storage\/get-file.md", @@ -35403,13 +35645,13 @@ "x-appwrite": { "method": "updateFile", "group": "files", - "weight": 157, + "weight": 528, "cookies": false, "type": "", "demo": "storage\/update-file.md", - "rate-limit": 60, - "rate-time": 60, - "rate-key": "ip:{ip},method:{method},url:{url},userId:{userId}", + "rate-limit": 0, + "rate-time": 3600, + "rate-key": "url:{url},ip:{ip}", "scope": "files.write", "platforms": [ "console", @@ -35433,7 +35675,7 @@ "parameters": [ { "name": "bucketId", - "description": "Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https:\/\/appwrite.io\/docs\/server\/storage#createBucket).", + "description": "Bucket unique ID.", "required": true, "type": "string", "x-example": "", @@ -35441,7 +35683,7 @@ }, { "name": "fileId", - "description": "File unique ID.", + "description": "File ID.", "required": true, "type": "string", "x-example": "", @@ -35455,14 +35697,13 @@ "properties": { "name": { "type": "string", - "description": "Name of the file", + "description": "File name.", "default": null, - "x-example": "", - "x-nullable": true + "x-example": "" }, "permissions": { "type": "array", - "description": "An array of permission string. By default, the current permissions are inherited. [Learn more about permissions](https:\/\/appwrite.io\/docs\/permissions).", + "description": "An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https:\/\/appwrite.io\/docs\/permissions).", "default": null, "x-example": "[\"read(\"any\")\"]", "x-nullable": true, @@ -35495,7 +35736,7 @@ "x-appwrite": { "method": "deleteFile", "group": "files", - "weight": 158, + "weight": 529, "cookies": false, "type": "", "demo": "storage\/delete-file.md", @@ -35566,7 +35807,7 @@ "x-appwrite": { "method": "getFileDownload", "group": "files", - "weight": 154, + "weight": 531, "cookies": false, "type": "location", "demo": "storage\/get-file-download.md", @@ -35646,7 +35887,7 @@ "x-appwrite": { "method": "getFilePreview", "group": "files", - "weight": 153, + "weight": 530, "cookies": false, "type": "location", "demo": "storage\/get-file-preview.md", @@ -35854,7 +36095,7 @@ "x-appwrite": { "method": "getFileView", "group": "files", - "weight": 155, + "weight": 532, "cookies": false, "type": "location", "demo": "storage\/get-file-view.md", @@ -35934,7 +36175,7 @@ "x-appwrite": { "method": "getUsage", "group": null, - "weight": 159, + "weight": 534, "cookies": false, "type": "", "demo": "storage\/get-usage.md", @@ -36005,7 +36246,7 @@ "x-appwrite": { "method": "getBucketUsage", "group": null, - "weight": 160, + "weight": 535, "cookies": false, "type": "", "demo": "storage\/get-bucket-usage.md", @@ -36084,7 +36325,7 @@ "x-appwrite": { "method": "list", "group": "tablesdb", - "weight": 386, + "weight": 344, "cookies": false, "type": "", "demo": "tablesdb\/list.md", @@ -36167,7 +36408,7 @@ "x-appwrite": { "method": "create", "group": "tablesdb", - "weight": 382, + "weight": 340, "cookies": false, "type": "", "demo": "tablesdb\/create.md", @@ -36251,7 +36492,7 @@ "x-appwrite": { "method": "listTransactions", "group": "transactions", - "weight": 445, + "weight": 403, "cookies": false, "type": "", "demo": "tablesdb\/list-transactions.md", @@ -36321,7 +36562,7 @@ "x-appwrite": { "method": "createTransaction", "group": "transactions", - "weight": 441, + "weight": 399, "cookies": false, "type": "", "demo": "tablesdb\/create-transaction.md", @@ -36362,7 +36603,8 @@ "type": "integer", "description": "Seconds before the transaction expires.", "default": 300, - "x-example": 60 + "x-example": 60, + "format": "int32" } } } @@ -36394,7 +36636,7 @@ "x-appwrite": { "method": "getTransaction", "group": "transactions", - "weight": 442, + "weight": 400, "cookies": false, "type": "", "demo": "tablesdb\/get-transaction.md", @@ -36460,7 +36702,7 @@ "x-appwrite": { "method": "updateTransaction", "group": "transactions", - "weight": 443, + "weight": 401, "cookies": false, "type": "", "demo": "tablesdb\/update-transaction.md", @@ -36542,7 +36784,7 @@ "x-appwrite": { "method": "deleteTransaction", "group": "transactions", - "weight": 444, + "weight": 402, "cookies": false, "type": "", "demo": "tablesdb\/delete-transaction.md", @@ -36610,7 +36852,7 @@ "x-appwrite": { "method": "createOperations", "group": "transactions", - "weight": 446, + "weight": 404, "cookies": false, "type": "", "demo": "tablesdb\/create-operations.md", @@ -36694,7 +36936,7 @@ "x-appwrite": { "method": "listUsage", "group": null, - "weight": 388, + "weight": 346, "cookies": false, "type": "", "demo": "tablesdb\/list-usage.md", @@ -36791,7 +37033,7 @@ "x-appwrite": { "method": "get", "group": "tablesdb", - "weight": 383, + "weight": 341, "cookies": false, "type": "", "demo": "tablesdb\/get.md", @@ -36852,7 +37094,7 @@ "x-appwrite": { "method": "update", "group": "tablesdb", - "weight": 384, + "weight": 342, "cookies": false, "type": "", "demo": "tablesdb\/update.md", @@ -36904,10 +37146,7 @@ "default": true, "x-example": false } - }, - "required": [ - "name" - ] + } } } ] @@ -36932,7 +37171,7 @@ "x-appwrite": { "method": "delete", "group": "tablesdb", - "weight": 385, + "weight": 343, "cookies": false, "type": "", "demo": "tablesdb\/delete.md", @@ -36993,7 +37232,7 @@ "x-appwrite": { "method": "listTables", "group": "tables", - "weight": 393, + "weight": 351, "cookies": false, "type": "", "demo": "tablesdb\/list-tables.md", @@ -37087,7 +37326,7 @@ "x-appwrite": { "method": "createTable", "group": "tables", - "weight": 389, + "weight": 347, "cookies": false, "type": "", "demo": "tablesdb\/create-table.md", @@ -37216,7 +37455,7 @@ "x-appwrite": { "method": "getTable", "group": "tables", - "weight": 390, + "weight": 348, "cookies": false, "type": "", "demo": "tablesdb\/get-table.md", @@ -37288,7 +37527,7 @@ "x-appwrite": { "method": "updateTable", "group": "tables", - "weight": 391, + "weight": 349, "cookies": false, "type": "", "demo": "tablesdb\/update-table.md", @@ -37367,10 +37606,7 @@ "default": true, "x-example": false } - }, - "required": [ - "name" - ] + } } } ] @@ -37395,7 +37631,7 @@ "x-appwrite": { "method": "deleteTable", "group": "tables", - "weight": 392, + "weight": 350, "cookies": false, "type": "", "demo": "tablesdb\/delete-table.md", @@ -37467,7 +37703,7 @@ "x-appwrite": { "method": "listColumns", "group": "columns", - "weight": 398, + "weight": 356, "cookies": false, "type": "", "demo": "tablesdb\/list-columns.md", @@ -37562,7 +37798,7 @@ "x-appwrite": { "method": "createBooleanColumn", "group": "columns", - "weight": 399, + "weight": 357, "cookies": false, "type": "", "demo": "tablesdb\/create-boolean-column.md", @@ -37674,7 +37910,7 @@ "x-appwrite": { "method": "updateBooleanColumn", "group": "columns", - "weight": 400, + "weight": 358, "cookies": false, "type": "", "demo": "tablesdb\/update-boolean-column.md", @@ -37788,7 +38024,7 @@ "x-appwrite": { "method": "createDatetimeColumn", "group": "columns", - "weight": 401, + "weight": 359, "cookies": false, "type": "", "demo": "tablesdb\/create-datetime-column.md", @@ -37900,7 +38136,7 @@ "x-appwrite": { "method": "updateDatetimeColumn", "group": "columns", - "weight": 402, + "weight": 360, "cookies": false, "type": "", "demo": "tablesdb\/update-datetime-column.md", @@ -38014,7 +38250,7 @@ "x-appwrite": { "method": "createEmailColumn", "group": "columns", - "weight": 403, + "weight": 361, "cookies": false, "type": "", "demo": "tablesdb\/create-email-column.md", @@ -38082,6 +38318,7 @@ "description": "Default value for column when not provided. Cannot be set when column is required.", "default": null, "x-example": "email@example.com", + "format": "email", "x-nullable": true }, "array": { @@ -38126,7 +38363,7 @@ "x-appwrite": { "method": "updateEmailColumn", "group": "columns", - "weight": 404, + "weight": 362, "cookies": false, "type": "", "demo": "tablesdb\/update-email-column.md", @@ -38195,6 +38432,7 @@ "description": "Default value for column when not provided. Cannot be set when column is required.", "default": null, "x-example": "email@example.com", + "format": "email", "x-nullable": true }, "newKey": { @@ -38240,7 +38478,7 @@ "x-appwrite": { "method": "createEnumColumn", "group": "columns", - "weight": 405, + "weight": 363, "cookies": false, "type": "", "demo": "tablesdb\/create-enum-column.md", @@ -38362,7 +38600,7 @@ "x-appwrite": { "method": "updateEnumColumn", "group": "columns", - "weight": 406, + "weight": 364, "cookies": false, "type": "", "demo": "tablesdb\/update-enum-column.md", @@ -38486,7 +38724,7 @@ "x-appwrite": { "method": "createFloatColumn", "group": "columns", - "weight": 407, + "weight": 365, "cookies": false, "type": "", "demo": "tablesdb\/create-float-column.md", @@ -38554,6 +38792,7 @@ "description": "Minimum value", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "max": { @@ -38561,6 +38800,7 @@ "description": "Maximum value", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "default": { @@ -38568,6 +38808,7 @@ "description": "Default value. Cannot be set when required.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "array": { @@ -38612,7 +38853,7 @@ "x-appwrite": { "method": "updateFloatColumn", "group": "columns", - "weight": 408, + "weight": 366, "cookies": false, "type": "", "demo": "tablesdb\/update-float-column.md", @@ -38681,6 +38922,7 @@ "description": "Minimum value", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "max": { @@ -38688,6 +38930,7 @@ "description": "Maximum value", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "default": { @@ -38695,6 +38938,7 @@ "description": "Default value. Cannot be set when required.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "newKey": { @@ -38740,7 +38984,7 @@ "x-appwrite": { "method": "createIntegerColumn", "group": "columns", - "weight": 409, + "weight": 367, "cookies": false, "type": "", "demo": "tablesdb\/create-integer-column.md", @@ -38808,6 +39052,7 @@ "description": "Minimum value", "default": null, "x-example": null, + "format": "int64", "x-nullable": true }, "max": { @@ -38815,6 +39060,7 @@ "description": "Maximum value", "default": null, "x-example": null, + "format": "int64", "x-nullable": true }, "default": { @@ -38822,6 +39068,7 @@ "description": "Default value. Cannot be set when column is required.", "default": null, "x-example": null, + "format": "int64", "x-nullable": true }, "array": { @@ -38866,7 +39113,7 @@ "x-appwrite": { "method": "updateIntegerColumn", "group": "columns", - "weight": 410, + "weight": 368, "cookies": false, "type": "", "demo": "tablesdb\/update-integer-column.md", @@ -38935,6 +39182,7 @@ "description": "Minimum value", "default": null, "x-example": null, + "format": "int64", "x-nullable": true }, "max": { @@ -38942,6 +39190,7 @@ "description": "Maximum value", "default": null, "x-example": null, + "format": "int64", "x-nullable": true }, "default": { @@ -38949,6 +39198,7 @@ "description": "Default value. Cannot be set when column is required.", "default": null, "x-example": null, + "format": "int64", "x-nullable": true }, "newKey": { @@ -38994,7 +39244,7 @@ "x-appwrite": { "method": "createIpColumn", "group": "columns", - "weight": 411, + "weight": 369, "cookies": false, "type": "", "demo": "tablesdb\/create-ip-column.md", @@ -39106,7 +39356,7 @@ "x-appwrite": { "method": "updateIpColumn", "group": "columns", - "weight": 412, + "weight": 370, "cookies": false, "type": "", "demo": "tablesdb\/update-ip-column.md", @@ -39220,7 +39470,7 @@ "x-appwrite": { "method": "createLineColumn", "group": "columns", - "weight": 413, + "weight": 371, "cookies": false, "type": "", "demo": "tablesdb\/create-line-column.md", @@ -39326,7 +39576,7 @@ "x-appwrite": { "method": "updateLineColumn", "group": "columns", - "weight": 414, + "weight": 372, "cookies": false, "type": "", "demo": "tablesdb\/update-line-column.md", @@ -39439,7 +39689,7 @@ "x-appwrite": { "method": "createPointColumn", "group": "columns", - "weight": 415, + "weight": 373, "cookies": false, "type": "", "demo": "tablesdb\/create-point-column.md", @@ -39545,7 +39795,7 @@ "x-appwrite": { "method": "updatePointColumn", "group": "columns", - "weight": 416, + "weight": 374, "cookies": false, "type": "", "demo": "tablesdb\/update-point-column.md", @@ -39658,7 +39908,7 @@ "x-appwrite": { "method": "createPolygonColumn", "group": "columns", - "weight": 417, + "weight": 375, "cookies": false, "type": "", "demo": "tablesdb\/create-polygon-column.md", @@ -39764,7 +40014,7 @@ "x-appwrite": { "method": "updatePolygonColumn", "group": "columns", - "weight": 418, + "weight": 376, "cookies": false, "type": "", "demo": "tablesdb\/update-polygon-column.md", @@ -39877,7 +40127,7 @@ "x-appwrite": { "method": "createRelationshipColumn", "group": "columns", - "weight": 419, + "weight": 377, "cookies": false, "type": "", "demo": "tablesdb\/create-relationship-column.md", @@ -40017,7 +40267,7 @@ "x-appwrite": { "method": "createStringColumn", "group": "columns", - "weight": 421, + "weight": 379, "cookies": false, "type": "", "demo": "tablesdb\/create-string-column.md", @@ -40078,7 +40328,8 @@ "type": "integer", "description": "Column size for text columns, in number of characters.", "default": null, - "x-example": 1 + "x-example": 1, + "format": "int32" }, "required": { "type": "boolean", @@ -40142,7 +40393,7 @@ "x-appwrite": { "method": "updateStringColumn", "group": "columns", - "weight": 422, + "weight": 380, "cookies": false, "type": "", "demo": "tablesdb\/update-string-column.md", @@ -40218,6 +40469,7 @@ "description": "Maximum size of the string column.", "default": null, "x-example": 1, + "format": "int32", "x-nullable": true }, "newKey": { @@ -40263,7 +40515,7 @@ "x-appwrite": { "method": "createUrlColumn", "group": "columns", - "weight": 423, + "weight": 381, "cookies": false, "type": "", "demo": "tablesdb\/create-url-column.md", @@ -40331,6 +40583,7 @@ "description": "Default value for column when not provided. Cannot be set when column is required.", "default": null, "x-example": "https:\/\/example.com", + "format": "url", "x-nullable": true }, "array": { @@ -40375,7 +40628,7 @@ "x-appwrite": { "method": "updateUrlColumn", "group": "columns", - "weight": 424, + "weight": 382, "cookies": false, "type": "", "demo": "tablesdb\/update-url-column.md", @@ -40444,6 +40697,7 @@ "description": "Default value for column when not provided. Cannot be set when column is required.", "default": null, "x-example": "https:\/\/example.com", + "format": "url", "x-nullable": true }, "newKey": { @@ -40518,7 +40772,7 @@ "x-appwrite": { "method": "getColumn", "group": "columns", - "weight": 396, + "weight": 354, "cookies": false, "type": "", "demo": "tablesdb\/get-column.md", @@ -40592,7 +40846,7 @@ "x-appwrite": { "method": "deleteColumn", "group": "columns", - "weight": 397, + "weight": 355, "cookies": false, "type": "", "demo": "tablesdb\/delete-column.md", @@ -40673,7 +40927,7 @@ "x-appwrite": { "method": "updateRelationshipColumn", "group": "columns", - "weight": 420, + "weight": 378, "cookies": false, "type": "", "demo": "tablesdb\/update-relationship-column.md", @@ -40782,7 +41036,7 @@ "x-appwrite": { "method": "listIndexes", "group": "indexes", - "weight": 428, + "weight": 386, "cookies": false, "type": "", "demo": "tablesdb\/list-indexes.md", @@ -40875,7 +41129,7 @@ "x-appwrite": { "method": "createIndex", "group": "indexes", - "weight": 425, + "weight": 383, "cookies": false, "type": "", "demo": "tablesdb\/create-index.md", @@ -41014,7 +41268,7 @@ "x-appwrite": { "method": "getIndex", "group": "indexes", - "weight": 426, + "weight": 384, "cookies": false, "type": "", "demo": "tablesdb\/get-index.md", @@ -41088,7 +41342,7 @@ "x-appwrite": { "method": "deleteIndex", "group": "indexes", - "weight": 427, + "weight": 385, "cookies": false, "type": "", "demo": "tablesdb\/delete-index.md", @@ -41167,7 +41421,7 @@ "x-appwrite": { "method": "listTableLogs", "group": "tables", - "weight": 394, + "weight": 352, "cookies": false, "type": "", "demo": "tablesdb\/list-table-logs.md", @@ -41249,7 +41503,7 @@ "x-appwrite": { "method": "listRows", "group": "rows", - "weight": 437, + "weight": 395, "cookies": false, "type": "", "demo": "tablesdb\/list-rows.md", @@ -41352,7 +41606,7 @@ "x-appwrite": { "method": "createRow", "group": "rows", - "weight": 429, + "weight": 387, "cookies": false, "type": "", "demo": "tablesdb\/create-row.md", @@ -41534,7 +41788,7 @@ "x-appwrite": { "method": "upsertRows", "group": "rows", - "weight": 434, + "weight": 392, "cookies": false, "type": "", "demo": "tablesdb\/upsert-rows.md", @@ -41664,7 +41918,7 @@ "x-appwrite": { "method": "updateRows", "group": "rows", - "weight": 432, + "weight": 390, "cookies": false, "type": "", "demo": "tablesdb\/update-rows.md", @@ -41767,7 +42021,7 @@ "x-appwrite": { "method": "deleteRows", "group": "rows", - "weight": 436, + "weight": 394, "cookies": false, "type": "", "demo": "tablesdb\/delete-rows.md", @@ -41864,7 +42118,7 @@ "x-appwrite": { "method": "getRow", "group": "rows", - "weight": 430, + "weight": 388, "cookies": false, "type": "", "demo": "tablesdb\/get-row.md", @@ -41966,7 +42220,7 @@ "x-appwrite": { "method": "upsertRow", "group": "rows", - "weight": 433, + "weight": 391, "cookies": false, "type": "", "demo": "tablesdb\/upsert-row.md", @@ -42112,7 +42366,7 @@ "x-appwrite": { "method": "updateRow", "group": "rows", - "weight": 431, + "weight": 389, "cookies": false, "type": "", "demo": "tablesdb\/update-row.md", @@ -42221,7 +42475,7 @@ "x-appwrite": { "method": "deleteRow", "group": "rows", - "weight": 435, + "weight": 393, "cookies": false, "type": "", "demo": "tablesdb\/delete-row.md", @@ -42319,7 +42573,7 @@ "x-appwrite": { "method": "listRowLogs", "group": "logs", - "weight": 438, + "weight": 396, "cookies": false, "type": "", "demo": "tablesdb\/list-row-logs.md", @@ -42411,7 +42665,7 @@ "x-appwrite": { "method": "decrementRowColumn", "group": "rows", - "weight": 440, + "weight": 398, "cookies": false, "type": "", "demo": "tablesdb\/decrement-row-column.md", @@ -42483,13 +42737,15 @@ "type": "number", "description": "Value to increment the column by. The value must be a number.", "default": 1, - "x-example": null + "x-example": null, + "format": "float" }, "min": { "type": "number", "description": "Minimum value for the column. If the current value is lesser than this value, an exception will be thrown.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "transactionId": { @@ -42531,7 +42787,7 @@ "x-appwrite": { "method": "incrementRowColumn", "group": "rows", - "weight": 439, + "weight": 397, "cookies": false, "type": "", "demo": "tablesdb\/increment-row-column.md", @@ -42603,13 +42859,15 @@ "type": "number", "description": "Value to increment the column by. The value must be a number.", "default": 1, - "x-example": null + "x-example": null, + "format": "float" }, "max": { "type": "number", "description": "Maximum value for the column. If the current value is greater than this value, an error will be thrown.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "transactionId": { @@ -42649,7 +42907,7 @@ "x-appwrite": { "method": "getTableUsage", "group": null, - "weight": 395, + "weight": 353, "cookies": false, "type": "", "demo": "tablesdb\/get-table-usage.md", @@ -42739,7 +42997,7 @@ "x-appwrite": { "method": "getUsage", "group": null, - "weight": 387, + "weight": 345, "cookies": false, "type": "", "demo": "tablesdb\/get-usage.md", @@ -42847,7 +43105,7 @@ "x-appwrite": { "method": "list", "group": "teams", - "weight": 162, + "weight": 110, "cookies": false, "type": "", "demo": "teams\/list.md", @@ -42932,7 +43190,7 @@ "x-appwrite": { "method": "create", "group": "teams", - "weight": 161, + "weight": 109, "cookies": false, "type": "", "demo": "teams\/create.md", @@ -43023,7 +43281,7 @@ "x-appwrite": { "method": "get", "group": "teams", - "weight": 163, + "weight": 111, "cookies": false, "type": "", "demo": "teams\/get.md", @@ -43086,7 +43344,7 @@ "x-appwrite": { "method": "updateName", "group": "teams", - "weight": 165, + "weight": 113, "cookies": false, "type": "", "demo": "teams\/update-name.md", @@ -43162,7 +43420,7 @@ "x-appwrite": { "method": "delete", "group": "teams", - "weight": 167, + "weight": 115, "cookies": false, "type": "", "demo": "teams\/delete.md", @@ -43225,7 +43483,7 @@ "x-appwrite": { "method": "listLogs", "group": "logs", - "weight": 174, + "weight": 122, "cookies": false, "type": "", "demo": "teams\/list-logs.md", @@ -43305,7 +43563,7 @@ "x-appwrite": { "method": "listMemberships", "group": "memberships", - "weight": 169, + "weight": 117, "cookies": false, "type": "", "demo": "teams\/list-memberships.md", @@ -43398,7 +43656,7 @@ "x-appwrite": { "method": "createMembership", "group": "memberships", - "weight": 168, + "weight": 116, "cookies": false, "type": "", "demo": "teams\/create-membership.md", @@ -43444,7 +43702,8 @@ "type": "string", "description": "Email of the new team member.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "userId": { "type": "string", @@ -43456,7 +43715,8 @@ "type": "string", "description": "Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", "default": "", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "roles": { "type": "array", @@ -43478,7 +43738,8 @@ "type": "string", "description": "URL to redirect the user back to your app from the invitation email. This parameter is not required when an API key is supplied. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.", "default": "", - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" }, "name": { "type": "string", @@ -43519,7 +43780,7 @@ "x-appwrite": { "method": "getMembership", "group": "memberships", - "weight": 170, + "weight": 118, "cookies": false, "type": "", "demo": "teams\/get-membership.md", @@ -43590,7 +43851,7 @@ "x-appwrite": { "method": "updateMembership", "group": "memberships", - "weight": 171, + "weight": 119, "cookies": false, "type": "", "demo": "teams\/update-membership.md", @@ -43684,7 +43945,7 @@ "x-appwrite": { "method": "deleteMembership", "group": "memberships", - "weight": 173, + "weight": 121, "cookies": false, "type": "", "demo": "teams\/delete-membership.md", @@ -43757,7 +44018,7 @@ "x-appwrite": { "method": "updateMembershipStatus", "group": "memberships", - "weight": 172, + "weight": 120, "cookies": false, "type": "", "demo": "teams\/update-membership-status.md", @@ -43852,7 +44113,7 @@ "x-appwrite": { "method": "getPrefs", "group": "teams", - "weight": 164, + "weight": 112, "cookies": false, "type": "", "demo": "teams\/get-prefs.md", @@ -43914,7 +44175,7 @@ "x-appwrite": { "method": "updatePrefs", "group": "teams", - "weight": 166, + "weight": 114, "cookies": false, "type": "", "demo": "teams\/update-prefs.md", @@ -43994,7 +44255,7 @@ "x-appwrite": { "method": "list", "group": "files", - "weight": 523, + "weight": 517, "cookies": false, "type": "", "demo": "tokens\/list.md", @@ -44083,7 +44344,7 @@ "x-appwrite": { "method": "createFileToken", "group": "files", - "weight": 521, + "weight": 515, "cookies": false, "type": "", "demo": "tokens\/create-file-token.md", @@ -44167,7 +44428,7 @@ "x-appwrite": { "method": "get", "group": "tokens", - "weight": 522, + "weight": 516, "cookies": false, "type": "", "demo": "tokens\/get.md", @@ -44227,7 +44488,7 @@ "x-appwrite": { "method": "update", "group": "tokens", - "weight": 524, + "weight": 518, "cookies": false, "type": "", "demo": "tokens\/update.md", @@ -44298,7 +44559,7 @@ "x-appwrite": { "method": "delete", "group": "tokens", - "weight": 525, + "weight": 519, "cookies": false, "type": "", "demo": "tokens\/delete.md", @@ -44358,7 +44619,7 @@ "x-appwrite": { "method": "list", "group": "users", - "weight": 184, + "weight": 132, "cookies": false, "type": "", "demo": "users\/list.md", @@ -44441,7 +44702,7 @@ "x-appwrite": { "method": "create", "group": "users", - "weight": 175, + "weight": 123, "cookies": false, "type": "", "demo": "users\/create.md", @@ -44484,6 +44745,7 @@ "description": "User email.", "default": null, "x-example": "email@example.com", + "format": "email", "x-nullable": true }, "phone": { @@ -44491,6 +44753,7 @@ "description": "Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", "default": null, "x-example": "+12065550100", + "format": "phone", "x-nullable": true }, "password": { @@ -44540,7 +44803,7 @@ "x-appwrite": { "method": "createArgon2User", "group": "users", - "weight": 178, + "weight": 126, "cookies": false, "type": "", "demo": "users\/create-argon-2-user.md", @@ -44582,13 +44845,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using Argon2.", "default": null, - "x-example": "password" + "x-example": "password", + "format": "password" }, "name": { "type": "string", @@ -44633,7 +44898,7 @@ "x-appwrite": { "method": "createBcryptUser", "group": "users", - "weight": 176, + "weight": 124, "cookies": false, "type": "", "demo": "users\/create-bcrypt-user.md", @@ -44675,13 +44940,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using Bcrypt.", "default": null, - "x-example": "password" + "x-example": "password", + "format": "password" }, "name": { "type": "string", @@ -44724,7 +44991,7 @@ "x-appwrite": { "method": "listIdentities", "group": "identities", - "weight": 192, + "weight": 140, "cookies": false, "type": "", "demo": "users\/list-identities.md", @@ -44804,7 +45071,7 @@ "x-appwrite": { "method": "deleteIdentity", "group": "identities", - "weight": 215, + "weight": 163, "cookies": false, "type": "", "demo": "users\/delete-identity.md", @@ -44867,7 +45134,7 @@ "x-appwrite": { "method": "createMD5User", "group": "users", - "weight": 177, + "weight": 125, "cookies": false, "type": "", "demo": "users\/create-md-5-user.md", @@ -44909,13 +45176,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using MD5.", "default": null, - "x-example": "password" + "x-example": "password", + "format": "password" }, "name": { "type": "string", @@ -44960,7 +45229,7 @@ "x-appwrite": { "method": "createPHPassUser", "group": "users", - "weight": 180, + "weight": 128, "cookies": false, "type": "", "demo": "users\/create-ph-pass-user.md", @@ -45002,13 +45271,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using PHPass.", "default": null, - "x-example": "password" + "x-example": "password", + "format": "password" }, "name": { "type": "string", @@ -45053,7 +45324,7 @@ "x-appwrite": { "method": "createScryptUser", "group": "users", - "weight": 181, + "weight": 129, "cookies": false, "type": "", "demo": "users\/create-scrypt-user.md", @@ -45095,13 +45366,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using Scrypt.", "default": null, - "x-example": "password" + "x-example": "password", + "format": "password" }, "passwordSalt": { "type": "string", @@ -45113,25 +45386,29 @@ "type": "integer", "description": "Optional CPU cost used to hash password.", "default": null, - "x-example": null + "x-example": null, + "format": "int32" }, "passwordMemory": { "type": "integer", "description": "Optional memory cost used to hash password.", "default": null, - "x-example": null + "x-example": null, + "format": "int32" }, "passwordParallel": { "type": "integer", "description": "Optional parallelization cost used to hash password.", "default": null, - "x-example": null + "x-example": null, + "format": "int32" }, "passwordLength": { "type": "integer", "description": "Optional hash length used to hash password.", "default": null, - "x-example": null + "x-example": null, + "format": "int32" }, "name": { "type": "string", @@ -45181,7 +45458,7 @@ "x-appwrite": { "method": "createScryptModifiedUser", "group": "users", - "weight": 182, + "weight": 130, "cookies": false, "type": "", "demo": "users\/create-scrypt-modified-user.md", @@ -45223,13 +45500,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using Scrypt Modified.", "default": null, - "x-example": "password" + "x-example": "password", + "format": "password" }, "passwordSalt": { "type": "string", @@ -45295,7 +45574,7 @@ "x-appwrite": { "method": "createSHAUser", "group": "users", - "weight": 179, + "weight": 127, "cookies": false, "type": "", "demo": "users\/create-sha-user.md", @@ -45337,13 +45616,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using SHA.", "default": null, - "x-example": "password" + "x-example": "password", + "format": "password" }, "passwordVersion": { "type": "string", @@ -45407,7 +45688,7 @@ "x-appwrite": { "method": "getUsage", "group": null, - "weight": 217, + "weight": 165, "cookies": false, "type": "", "demo": "users\/get-usage.md", @@ -45478,7 +45759,7 @@ "x-appwrite": { "method": "get", "group": "users", - "weight": 185, + "weight": 133, "cookies": false, "type": "", "demo": "users\/get.md", @@ -45534,7 +45815,7 @@ "x-appwrite": { "method": "delete", "group": "users", - "weight": 213, + "weight": 161, "cookies": false, "type": "", "demo": "users\/delete.md", @@ -45597,7 +45878,7 @@ "x-appwrite": { "method": "updateEmail", "group": "users", - "weight": 198, + "weight": 146, "cookies": false, "type": "", "demo": "users\/update-email.md", @@ -45641,7 +45922,8 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" } }, "required": [ @@ -45678,7 +45960,7 @@ "x-appwrite": { "method": "createJWT", "group": "sessions", - "weight": 216, + "weight": 164, "cookies": false, "type": "", "demo": "users\/create-jwt.md", @@ -45728,7 +46010,8 @@ "type": "integer", "description": "Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds.", "default": 900, - "x-example": 0 + "x-example": 0, + "format": "int32" } } } @@ -45762,7 +46045,7 @@ "x-appwrite": { "method": "updateLabels", "group": "users", - "weight": 194, + "weight": 142, "cookies": false, "type": "", "demo": "users\/update-labels.md", @@ -45844,7 +46127,7 @@ "x-appwrite": { "method": "listLogs", "group": "logs", - "weight": 190, + "weight": 138, "cookies": false, "type": "", "demo": "users\/list-logs.md", @@ -45926,7 +46209,7 @@ "x-appwrite": { "method": "listMemberships", "group": "memberships", - "weight": 189, + "weight": 137, "cookies": false, "type": "", "demo": "users\/list-memberships.md", @@ -46019,7 +46302,7 @@ "x-appwrite": { "method": "updateMfa", "group": "users", - "weight": 203, + "weight": 151, "cookies": false, "type": "", "demo": "users\/update-mfa.md", @@ -46155,7 +46438,7 @@ "x-appwrite": { "method": "deleteMfaAuthenticator", "group": "mfa", - "weight": 208, + "weight": 156, "cookies": false, "type": "", "demo": "users\/delete-mfa-authenticator.md", @@ -46287,7 +46570,7 @@ "x-appwrite": { "method": "listMfaFactors", "group": "mfa", - "weight": 204, + "weight": 152, "cookies": false, "type": "", "demo": "users\/list-mfa-factors.md", @@ -46404,7 +46687,7 @@ "x-appwrite": { "method": "getMfaRecoveryCodes", "group": "mfa", - "weight": 205, + "weight": 153, "cookies": false, "type": "", "demo": "users\/get-mfa-recovery-codes.md", @@ -46521,7 +46804,7 @@ "x-appwrite": { "method": "updateMfaRecoveryCodes", "group": "mfa", - "weight": 207, + "weight": 155, "cookies": false, "type": "", "demo": "users\/update-mfa-recovery-codes.md", @@ -46638,7 +46921,7 @@ "x-appwrite": { "method": "createMfaRecoveryCodes", "group": "mfa", - "weight": 206, + "weight": 154, "cookies": false, "type": "", "demo": "users\/create-mfa-recovery-codes.md", @@ -46757,7 +47040,7 @@ "x-appwrite": { "method": "updateName", "group": "users", - "weight": 196, + "weight": 144, "cookies": false, "type": "", "demo": "users\/update-name.md", @@ -46838,7 +47121,7 @@ "x-appwrite": { "method": "updatePassword", "group": "users", - "weight": 197, + "weight": 145, "cookies": false, "type": "", "demo": "users\/update-password.md", @@ -46919,7 +47202,7 @@ "x-appwrite": { "method": "updatePhone", "group": "users", - "weight": 199, + "weight": 147, "cookies": false, "type": "", "demo": "users\/update-phone.md", @@ -46963,7 +47246,8 @@ "type": "string", "description": "User phone number.", "default": null, - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" } }, "required": [ @@ -46998,7 +47282,7 @@ "x-appwrite": { "method": "getPrefs", "group": "users", - "weight": 186, + "weight": 134, "cookies": false, "type": "", "demo": "users\/get-prefs.md", @@ -47059,7 +47343,7 @@ "x-appwrite": { "method": "updatePrefs", "group": "users", - "weight": 201, + "weight": 149, "cookies": false, "type": "", "demo": "users\/update-prefs.md", @@ -47138,7 +47422,7 @@ "x-appwrite": { "method": "listSessions", "group": "sessions", - "weight": 188, + "weight": 136, "cookies": false, "type": "", "demo": "users\/list-sessions.md", @@ -47208,7 +47492,7 @@ "x-appwrite": { "method": "createSession", "group": "sessions", - "weight": 209, + "weight": 157, "cookies": false, "type": "", "demo": "users\/create-session.md", @@ -47264,7 +47548,7 @@ "x-appwrite": { "method": "deleteSessions", "group": "sessions", - "weight": 212, + "weight": 160, "cookies": false, "type": "", "demo": "users\/delete-sessions.md", @@ -47322,7 +47606,7 @@ "x-appwrite": { "method": "deleteSession", "group": "sessions", - "weight": 211, + "weight": 159, "cookies": false, "type": "", "demo": "users\/delete-session.md", @@ -47393,7 +47677,7 @@ "x-appwrite": { "method": "updateStatus", "group": "users", - "weight": 193, + "weight": 141, "cookies": false, "type": "", "demo": "users\/update-status.md", @@ -47472,7 +47756,7 @@ "x-appwrite": { "method": "listTargets", "group": "targets", - "weight": 191, + "weight": 139, "cookies": false, "type": "", "demo": "users\/list-targets.md", @@ -47554,7 +47838,7 @@ "x-appwrite": { "method": "createTarget", "group": "targets", - "weight": 183, + "weight": 131, "cookies": false, "type": "", "demo": "users\/create-target.md", @@ -47666,7 +47950,7 @@ "x-appwrite": { "method": "getTarget", "group": "targets", - "weight": 187, + "weight": 135, "cookies": false, "type": "", "demo": "users\/get-target.md", @@ -47735,7 +48019,7 @@ "x-appwrite": { "method": "updateTarget", "group": "targets", - "weight": 202, + "weight": 150, "cookies": false, "type": "", "demo": "users\/update-target.md", @@ -47826,7 +48110,7 @@ "x-appwrite": { "method": "deleteTarget", "group": "targets", - "weight": 214, + "weight": 162, "cookies": false, "type": "", "demo": "users\/delete-target.md", @@ -47897,7 +48181,7 @@ "x-appwrite": { "method": "createToken", "group": "sessions", - "weight": 210, + "weight": 158, "cookies": false, "type": "", "demo": "users\/create-token.md", @@ -47941,13 +48225,15 @@ "type": "integer", "description": "Token length in characters. The default length is 6 characters", "default": 6, - "x-example": 4 + "x-example": 4, + "format": "int32" }, "expire": { "type": "integer", "description": "Token expiration period in seconds. The default expiration is 15 minutes.", "default": 900, - "x-example": 60 + "x-example": 60, + "format": "int32" } } } @@ -47981,7 +48267,7 @@ "x-appwrite": { "method": "updateEmailVerification", "group": "users", - "weight": 200, + "weight": 148, "cookies": false, "type": "", "demo": "users\/update-email-verification.md", @@ -48062,7 +48348,7 @@ "x-appwrite": { "method": "updatePhoneVerification", "group": "users", - "weight": 195, + "weight": 143, "cookies": false, "type": "", "demo": "users\/update-phone-verification.md", @@ -48143,7 +48429,7 @@ "x-appwrite": { "method": "createRepositoryDetection", "group": "repositories", - "weight": 221, + "weight": 169, "cookies": false, "type": "", "demo": "vcs\/create-repository-detection.md", @@ -48239,7 +48525,7 @@ "x-appwrite": { "method": "listRepositories", "group": "repositories", - "weight": 222, + "weight": 170, "cookies": false, "type": "", "demo": "vcs\/list-repositories.md", @@ -48333,7 +48619,7 @@ "x-appwrite": { "method": "createRepository", "group": "repositories", - "weight": 223, + "weight": 171, "cookies": false, "type": "", "demo": "vcs\/create-repository.md", @@ -48417,7 +48703,7 @@ "x-appwrite": { "method": "getRepository", "group": "repositories", - "weight": 224, + "weight": 172, "cookies": false, "type": "", "demo": "vcs\/get-repository.md", @@ -48484,7 +48770,7 @@ "x-appwrite": { "method": "listRepositoryBranches", "group": "repositories", - "weight": 225, + "weight": 173, "cookies": false, "type": "", "demo": "vcs\/list-repository-branches.md", @@ -48551,7 +48837,7 @@ "x-appwrite": { "method": "getRepositoryContents", "group": "repositories", - "weight": 220, + "weight": 168, "cookies": false, "type": "", "demo": "vcs\/get-repository-contents.md", @@ -48635,7 +48921,7 @@ "x-appwrite": { "method": "updateExternalDeployments", "group": "repositories", - "weight": 230, + "weight": 178, "cookies": false, "type": "", "demo": "vcs\/update-external-deployments.md", @@ -48720,7 +49006,7 @@ "x-appwrite": { "method": "listInstallations", "group": "installations", - "weight": 227, + "weight": 175, "cookies": false, "type": "", "demo": "vcs\/list-installations.md", @@ -48801,7 +49087,7 @@ "x-appwrite": { "method": "getInstallation", "group": "installations", - "weight": 228, + "weight": 176, "cookies": false, "type": "", "demo": "vcs\/get-installation.md", @@ -48855,7 +49141,7 @@ "x-appwrite": { "method": "deleteInstallation", "group": "installations", - "weight": 229, + "weight": 177, "cookies": false, "type": "", "demo": "vcs\/delete-installation.md", @@ -48954,7 +49240,7 @@ }, { "name": "console", - "description": "The Console service allows you to interact with console relevant informations." + "description": "The Console service allows you to interact with console relevant information." }, { "name": "migrations", @@ -50103,6 +50389,35 @@ "variables": "" } }, + "healthStatusList": { + "description": "Status List", + "type": "object", + "properties": { + "total": { + "type": "integer", + "description": "Total number of statuses that matched your query.", + "x-example": 5, + "format": "int32" + }, + "statuses": { + "type": "array", + "description": "List of statuses.", + "items": { + "type": "object", + "$ref": "#\/definitions\/healthStatus" + }, + "x-example": "" + } + }, + "required": [ + "total", + "statuses" + ], + "example": { + "total": 5, + "statuses": "" + } + }, "proxyRuleList": { "description": "Rule List", "type": "object", @@ -50833,14 +51148,14 @@ "type": "integer", "description": "Minimum value to enforce for new documents.", "x-example": 1, - "format": "int32", + "format": "int64", "x-nullable": true }, "max": { "type": "integer", "description": "Maximum value to enforce for new documents.", "x-example": 10, - "format": "int32", + "format": "int64", "x-nullable": true }, "default": { @@ -52283,14 +52598,14 @@ "type": "integer", "description": "Minimum value to enforce for new documents.", "x-example": 1, - "format": "int32", + "format": "int64", "x-nullable": true }, "max": { "type": "integer", "description": "Maximum value to enforce for new documents.", "x-example": 10, - "format": "int32", + "format": "int64", "x-nullable": true }, "default": { @@ -54782,6 +55097,16 @@ "description": "Total number of chunks uploaded", "x-example": 17890, "format": "int32" + }, + "encryption": { + "type": "boolean", + "description": "Whether file contents are encrypted at rest.", + "x-example": true + }, + "compression": { + "type": "string", + "description": "Compression algorithm used for the file. Will be one of none, [gzip](https:\/\/en.wikipedia.org\/wiki\/Gzip), or [zstd](https:\/\/en.wikipedia.org\/wiki\/Zstd).", + "x-example": "gzip" } }, "required": [ @@ -54795,7 +55120,9 @@ "mimeType", "sizeOriginal", "chunksTotal", - "chunksUploaded" + "chunksUploaded", + "encryption", + "compression" ], "example": { "$id": "5e5ea5c16897e", @@ -54810,7 +55137,9 @@ "mimeType": "image\/png", "sizeOriginal": 17890, "chunksTotal": 17890, - "chunksUploaded": 17890 + "chunksUploaded": 17890, + "encryption": true, + "compression": "gzip" } }, "bucket": { @@ -54876,7 +55205,7 @@ }, "compression": { "type": "string", - "description": "Compression algorithm choosen for compression. Will be one of none, [gzip](https:\/\/en.wikipedia.org\/wiki\/Gzip), or [zstd](https:\/\/en.wikipedia.org\/wiki\/Zstd).", + "description": "Compression algorithm chosen for compression. Will be one of none, [gzip](https:\/\/en.wikipedia.org\/wiki\/Gzip), or [zstd](https:\/\/en.wikipedia.org\/wiki\/Zstd).", "x-example": "gzip" }, "encryption": { @@ -54893,6 +55222,12 @@ "type": "boolean", "description": "Image transformations are enabled.", "x-example": false + }, + "totalSize": { + "type": "integer", + "description": "Total size of this bucket in bytes.", + "x-example": 128, + "format": "int32" } }, "required": [ @@ -54908,7 +55243,8 @@ "compression", "encryption", "antivirus", - "transformations" + "transformations", + "totalSize" ], "example": { "$id": "5e5ea5c16897e", @@ -54928,7 +55264,8 @@ "compression": "gzip", "encryption": false, "antivirus": false, - "transformations": false + "transformations": false, + "totalSize": 128 } }, "resourceToken": { @@ -56753,13 +57090,14 @@ }, "status": { "type": "string", - "description": "The deployment status. Possible values are \"waiting\", \"processing\", \"building\", \"ready\", and \"failed\".", + "description": "The deployment status. Possible values are \"waiting\", \"processing\", \"building\", \"ready\", \"canceled\" and \"failed\".", "x-example": "ready", "enum": [ "waiting", "processing", "building", "ready", + "canceled", "failed" ] }, @@ -57313,6 +57651,16 @@ "description": "Last ping datetime in ISO 8601 format.", "x-example": "2020-10-15T06:38:00.000+00:00" }, + "labels": { + "type": "array", + "description": "Labels for the project.", + "items": { + "type": "string" + }, + "x-example": [ + "vip" + ] + }, "authEmailPassword": { "type": "boolean", "description": "Email\/Password auth method status", @@ -57457,6 +57805,7 @@ "smtpSecure", "pingCount", "pingedAt", + "labels", "authEmailPassword", "authUsersAuthMagicURL", "authEmailOtp", @@ -57525,6 +57874,9 @@ "smtpSecure": "tls", "pingCount": 1, "pingedAt": "2020-10-15T06:38:00.000+00:00", + "labels": [ + "vip" + ], "authEmailPassword": true, "authUsersAuthMagicURL": true, "authEmailOtp": true, @@ -59526,171 +59878,6 @@ "description": "Time range of the usage stats.", "x-example": "30d" }, - "deploymentsTotal": { - "type": "integer", - "description": "Total aggregated number of functions deployments.", - "x-example": 0, - "format": "int32" - }, - "deploymentsStorageTotal": { - "type": "integer", - "description": "Total aggregated sum of functions deployment storage.", - "x-example": 0, - "format": "int32" - }, - "buildsTotal": { - "type": "integer", - "description": "Total aggregated number of functions build.", - "x-example": 0, - "format": "int32" - }, - "buildsStorageTotal": { - "type": "integer", - "description": "total aggregated sum of functions build storage.", - "x-example": 0, - "format": "int32" - }, - "buildsTimeTotal": { - "type": "integer", - "description": "Total aggregated sum of functions build compute time.", - "x-example": 0, - "format": "int32" - }, - "buildsMbSecondsTotal": { - "type": "integer", - "description": "Total aggregated sum of functions build mbSeconds.", - "x-example": 0, - "format": "int32" - }, - "executionsTotal": { - "type": "integer", - "description": "Total aggregated number of functions execution.", - "x-example": 0, - "format": "int32" - }, - "executionsTimeTotal": { - "type": "integer", - "description": "Total aggregated sum of functions execution compute time.", - "x-example": 0, - "format": "int32" - }, - "executionsMbSecondsTotal": { - "type": "integer", - "description": "Total aggregated sum of functions execution mbSeconds.", - "x-example": 0, - "format": "int32" - }, - "deployments": { - "type": "array", - "description": "Aggregated number of functions deployment per period.", - "items": { - "type": "object", - "$ref": "#\/definitions\/metric" - }, - "x-example": [] - }, - "deploymentsStorage": { - "type": "array", - "description": "Aggregated number of functions deployment storage per period.", - "items": { - "type": "object", - "$ref": "#\/definitions\/metric" - }, - "x-example": [] - }, - "buildsSuccessTotal": { - "type": "integer", - "description": "Total aggregated number of successful function builds.", - "x-example": 0, - "format": "int32" - }, - "buildsFailedTotal": { - "type": "integer", - "description": "Total aggregated number of failed function builds.", - "x-example": 0, - "format": "int32" - }, - "builds": { - "type": "array", - "description": "Aggregated number of functions build per period.", - "items": { - "type": "object", - "$ref": "#\/definitions\/metric" - }, - "x-example": [] - }, - "buildsStorage": { - "type": "array", - "description": "Aggregated sum of functions build storage per period.", - "items": { - "type": "object", - "$ref": "#\/definitions\/metric" - }, - "x-example": [] - }, - "buildsTime": { - "type": "array", - "description": "Aggregated sum of functions build compute time per period.", - "items": { - "type": "object", - "$ref": "#\/definitions\/metric" - }, - "x-example": [] - }, - "buildsMbSeconds": { - "type": "array", - "description": "Aggregated sum of functions build mbSeconds per period.", - "items": { - "type": "object", - "$ref": "#\/definitions\/metric" - }, - "x-example": [] - }, - "executions": { - "type": "array", - "description": "Aggregated number of functions execution per period.", - "items": { - "type": "object", - "$ref": "#\/definitions\/metric" - }, - "x-example": [] - }, - "executionsTime": { - "type": "array", - "description": "Aggregated number of functions execution compute time per period.", - "items": { - "type": "object", - "$ref": "#\/definitions\/metric" - }, - "x-example": [] - }, - "executionsMbSeconds": { - "type": "array", - "description": "Aggregated number of functions mbSeconds per period.", - "items": { - "type": "object", - "$ref": "#\/definitions\/metric" - }, - "x-example": [] - }, - "buildsSuccess": { - "type": "array", - "description": "Aggregated number of successful function builds per period.", - "items": { - "type": "object", - "$ref": "#\/definitions\/metric" - }, - "x-example": [] - }, - "buildsFailed": { - "type": "array", - "description": "Aggregated number of failed function builds per period.", - "items": { - "type": "object", - "$ref": "#\/definitions\/metric" - }, - "x-example": [] - }, "sitesTotal": { "type": "integer", "description": "Total aggregated number of sites.", @@ -59706,6 +59893,60 @@ }, "x-example": [] }, + "deploymentsTotal": { + "type": "integer", + "description": "Total aggregated number of sites deployments.", + "x-example": 0, + "format": "int32" + }, + "deploymentsStorageTotal": { + "type": "integer", + "description": "Total aggregated sum of sites deployment storage.", + "x-example": 0, + "format": "int32" + }, + "buildsTotal": { + "type": "integer", + "description": "Total aggregated number of sites build.", + "x-example": 0, + "format": "int32" + }, + "buildsStorageTotal": { + "type": "integer", + "description": "total aggregated sum of sites build storage.", + "x-example": 0, + "format": "int32" + }, + "buildsTimeTotal": { + "type": "integer", + "description": "Total aggregated sum of sites build compute time.", + "x-example": 0, + "format": "int32" + }, + "buildsMbSecondsTotal": { + "type": "integer", + "description": "Total aggregated sum of sites build mbSeconds.", + "x-example": 0, + "format": "int32" + }, + "executionsTotal": { + "type": "integer", + "description": "Total aggregated number of sites execution.", + "x-example": 0, + "format": "int32" + }, + "executionsTimeTotal": { + "type": "integer", + "description": "Total aggregated sum of sites execution compute time.", + "x-example": 0, + "format": "int32" + }, + "executionsMbSecondsTotal": { + "type": "integer", + "description": "Total aggregated sum of sites execution mbSeconds.", + "x-example": 0, + "format": "int32" + }, "requestsTotal": { "type": "integer", "description": "Total aggregated number of requests.", @@ -59750,10 +59991,123 @@ "$ref": "#\/definitions\/metric" }, "x-example": [] + }, + "deployments": { + "type": "array", + "description": "Aggregated number of sites deployment per period.", + "items": { + "type": "object", + "$ref": "#\/definitions\/metric" + }, + "x-example": [] + }, + "deploymentsStorage": { + "type": "array", + "description": "Aggregated number of sites deployment storage per period.", + "items": { + "type": "object", + "$ref": "#\/definitions\/metric" + }, + "x-example": [] + }, + "buildsSuccessTotal": { + "type": "integer", + "description": "Total aggregated number of successful site builds.", + "x-example": 0, + "format": "int32" + }, + "buildsFailedTotal": { + "type": "integer", + "description": "Total aggregated number of failed site builds.", + "x-example": 0, + "format": "int32" + }, + "builds": { + "type": "array", + "description": "Aggregated number of sites build per period.", + "items": { + "type": "object", + "$ref": "#\/definitions\/metric" + }, + "x-example": [] + }, + "buildsStorage": { + "type": "array", + "description": "Aggregated sum of sites build storage per period.", + "items": { + "type": "object", + "$ref": "#\/definitions\/metric" + }, + "x-example": [] + }, + "buildsTime": { + "type": "array", + "description": "Aggregated sum of sites build compute time per period.", + "items": { + "type": "object", + "$ref": "#\/definitions\/metric" + }, + "x-example": [] + }, + "buildsMbSeconds": { + "type": "array", + "description": "Aggregated sum of sites build mbSeconds per period.", + "items": { + "type": "object", + "$ref": "#\/definitions\/metric" + }, + "x-example": [] + }, + "executions": { + "type": "array", + "description": "Aggregated number of sites execution per period.", + "items": { + "type": "object", + "$ref": "#\/definitions\/metric" + }, + "x-example": [] + }, + "executionsTime": { + "type": "array", + "description": "Aggregated number of sites execution compute time per period.", + "items": { + "type": "object", + "$ref": "#\/definitions\/metric" + }, + "x-example": [] + }, + "executionsMbSeconds": { + "type": "array", + "description": "Aggregated number of sites mbSeconds per period.", + "items": { + "type": "object", + "$ref": "#\/definitions\/metric" + }, + "x-example": [] + }, + "buildsSuccess": { + "type": "array", + "description": "Aggregated number of successful site builds per period.", + "items": { + "type": "object", + "$ref": "#\/definitions\/metric" + }, + "x-example": [] + }, + "buildsFailed": { + "type": "array", + "description": "Aggregated number of failed site builds per period.", + "items": { + "type": "object", + "$ref": "#\/definitions\/metric" + }, + "x-example": [] } }, "required": [ "range", + "sitesTotal", + "sites", "deploymentsTotal", "deploymentsStorageTotal", "buildsTotal", @@ -59763,6 +60117,12 @@ "executionsTotal", "executionsTimeTotal", "executionsMbSecondsTotal", + "requestsTotal", + "requests", + "inboundTotal", + "inbound", + "outboundTotal", + "outbound", "deployments", "deploymentsStorage", "buildsSuccessTotal", @@ -59775,18 +60135,12 @@ "executionsTime", "executionsMbSeconds", "buildsSuccess", - "buildsFailed", - "sitesTotal", - "sites", - "requestsTotal", - "requests", - "inboundTotal", - "inbound", - "outboundTotal", - "outbound" + "buildsFailed" ], "example": { "range": "30d", + "sitesTotal": 0, + "sites": [], "deploymentsTotal": 0, "deploymentsStorageTotal": 0, "buildsTotal": 0, @@ -59796,6 +60150,12 @@ "executionsTotal": 0, "executionsTimeTotal": 0, "executionsMbSecondsTotal": 0, + "requestsTotal": 0, + "requests": [], + "inboundTotal": 0, + "inbound": [], + "outboundTotal": 0, + "outbound": [], "deployments": [], "deploymentsStorage": [], "buildsSuccessTotal": 0, @@ -59808,15 +60168,7 @@ "executionsTime": [], "executionsMbSeconds": [], "buildsSuccess": [], - "buildsFailed": [], - "sitesTotal": 0, - "sites": [], - "requestsTotal": 0, - "requests": [], - "inboundTotal": 0, - "inbound": [], - "outboundTotal": 0, - "outbound": [] + "buildsFailed": [] } }, "usageSite": { @@ -61119,7 +61471,7 @@ "status": { "type": "string", "description": "Status of delivery.", - "x-example": "Message status can be one of the following: draft, processing, scheduled, sent, or failed.", + "x-example": "processing", "enum": [ "draft", "processing", @@ -61165,7 +61517,7 @@ "subject": "Welcome to Appwrite", "content": "Hi there, welcome to Appwrite family." }, - "status": "Message status can be one of the following: draft, processing, scheduled, sent, or failed." + "status": "processing" } }, "topic": { diff --git a/app/config/specs/swagger2-1.8.x-server.json b/app/config/specs/swagger2-1.8.x-server.json index 5ce8c4b74c..ba941164e2 100644 --- a/app/config/specs/swagger2-1.8.x-server.json +++ b/app/config/specs/swagger2-1.8.x-server.json @@ -1,7 +1,7 @@ { "swagger": "2.0", "info": { - "version": "1.8.0", + "version": "1.8.1", "title": "Appwrite", "description": "Appwrite backend as a service cuts up to 70% of the time and costs required for building a modern application. We abstract and simplify common development tasks behind a REST APIs, to help you develop your app in a fast and secure way. For full API documentation and tutorials go to [https:\/\/appwrite.io\/docs](https:\/\/appwrite.io\/docs)", "termsOfService": "https:\/\/appwrite.io\/policy\/terms", @@ -103,7 +103,7 @@ "x-appwrite": { "method": "get", "group": "account", - "weight": 10, + "weight": 9, "cookies": false, "type": "", "demo": "account\/get.md", @@ -157,7 +157,7 @@ "x-appwrite": { "method": "create", "group": "account", - "weight": 9, + "weight": 8, "cookies": false, "type": "", "demo": "account\/create.md", @@ -202,7 +202,8 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", @@ -253,7 +254,7 @@ "x-appwrite": { "method": "updateEmail", "group": "account", - "weight": 35, + "weight": 34, "cookies": false, "type": "", "demo": "account\/update-email.md", @@ -292,13 +293,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password. Must be at least 8 chars.", "default": null, - "x-example": "password" + "x-example": "password", + "format": "password" } }, "required": [ @@ -334,7 +337,7 @@ "x-appwrite": { "method": "listIdentities", "group": "identities", - "weight": 48, + "weight": 47, "cookies": false, "type": "", "demo": "account\/list-identities.md", @@ -408,7 +411,7 @@ "x-appwrite": { "method": "deleteIdentity", "group": "identities", - "weight": 49, + "weight": 48, "cookies": false, "type": "", "demo": "account\/delete-identity.md", @@ -474,12 +477,12 @@ "x-appwrite": { "method": "createJWT", "group": "tokens", - "weight": 30, + "weight": 29, "cookies": false, "type": "", "demo": "account\/create-jwt.md", - "rate-limit": 100, - "rate-time": 3600, + "rate-limit": 120, + "rate-time": 60, "rate-key": "url:{url},userId:{userId}", "scope": "account", "platforms": [ @@ -501,6 +504,24 @@ "Session": [], "JWT": [] } + ], + "parameters": [ + { + "name": "payload", + "in": "body", + "schema": { + "type": "object", + "properties": { + "duration": { + "type": "integer", + "description": "Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds.", + "default": 900, + "x-example": 0, + "format": "int32" + } + } + } + } ] } }, @@ -528,7 +549,7 @@ "x-appwrite": { "method": "listLogs", "group": "logs", - "weight": 32, + "weight": 31, "cookies": false, "type": "", "demo": "account\/list-logs.md", @@ -607,7 +628,7 @@ "x-appwrite": { "method": "updateMFA", "group": "mfa", - "weight": 306, + "weight": 253, "cookies": false, "type": "", "demo": "account\/update-mfa.md", @@ -683,7 +704,7 @@ "x-appwrite": { "method": "createMfaAuthenticator", "group": "mfa", - "weight": 308, + "weight": 255, "cookies": false, "type": "", "demo": "account\/create-mfa-authenticator.md", @@ -810,7 +831,7 @@ "x-appwrite": { "method": "updateMfaAuthenticator", "group": "mfa", - "weight": 309, + "weight": 256, "cookies": false, "type": "", "demo": "account\/update-mfa-authenticator.md", @@ -954,7 +975,7 @@ "x-appwrite": { "method": "deleteMfaAuthenticator", "group": "mfa", - "weight": 310, + "weight": 257, "cookies": false, "type": "", "demo": "account\/delete-mfa-authenticator.md", @@ -1081,7 +1102,7 @@ "x-appwrite": { "method": "createMfaChallenge", "group": "mfa", - "weight": 314, + "weight": 261, "cookies": false, "type": "", "demo": "account\/create-mfa-challenge.md", @@ -1221,7 +1242,7 @@ "x-appwrite": { "method": "updateMfaChallenge", "group": "mfa", - "weight": 315, + "weight": 262, "cookies": false, "type": "", "demo": "account\/update-mfa-challenge.md", @@ -1364,7 +1385,7 @@ "x-appwrite": { "method": "listMfaFactors", "group": "mfa", - "weight": 307, + "weight": 254, "cookies": false, "type": "", "demo": "account\/list-mfa-factors.md", @@ -1468,7 +1489,7 @@ "x-appwrite": { "method": "getMfaRecoveryCodes", "group": "mfa", - "weight": 313, + "weight": 260, "cookies": false, "type": "", "demo": "account\/get-mfa-recovery-codes.md", @@ -1572,7 +1593,7 @@ "x-appwrite": { "method": "createMfaRecoveryCodes", "group": "mfa", - "weight": 311, + "weight": 258, "cookies": false, "type": "", "demo": "account\/create-mfa-recovery-codes.md", @@ -1676,7 +1697,7 @@ "x-appwrite": { "method": "updateMfaRecoveryCodes", "group": "mfa", - "weight": 312, + "weight": 259, "cookies": false, "type": "", "demo": "account\/update-mfa-recovery-codes.md", @@ -1782,7 +1803,7 @@ "x-appwrite": { "method": "updateName", "group": "account", - "weight": 33, + "weight": 32, "cookies": false, "type": "", "demo": "account\/update-name.md", @@ -1858,7 +1879,7 @@ "x-appwrite": { "method": "updatePassword", "group": "account", - "weight": 34, + "weight": 33, "cookies": false, "type": "", "demo": "account\/update-password.md", @@ -1903,7 +1924,8 @@ "type": "string", "description": "Current user password. Must be at least 8 chars.", "default": "", - "x-example": "password" + "x-example": "password", + "format": "password" } }, "required": [ @@ -1940,7 +1962,7 @@ "x-appwrite": { "method": "updatePhone", "group": "account", - "weight": 36, + "weight": 35, "cookies": false, "type": "", "demo": "account\/update-phone.md", @@ -1979,13 +2001,15 @@ "type": "string", "description": "Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", "default": null, - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "password": { "type": "string", "description": "User password. Must be at least 8 chars.", "default": null, - "x-example": "password" + "x-example": "password", + "format": "password" } }, "required": [ @@ -2021,7 +2045,7 @@ "x-appwrite": { "method": "getPrefs", "group": "account", - "weight": 31, + "weight": 30, "cookies": false, "type": "", "demo": "account\/get-prefs.md", @@ -2075,7 +2099,7 @@ "x-appwrite": { "method": "updatePrefs", "group": "account", - "weight": 37, + "weight": 36, "cookies": false, "type": "", "demo": "account\/update-prefs.md", @@ -2151,7 +2175,7 @@ "x-appwrite": { "method": "createRecovery", "group": "recovery", - "weight": 39, + "weight": 38, "cookies": false, "type": "", "demo": "account\/create-recovery.md", @@ -2193,13 +2217,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "url": { "type": "string", "description": "URL to redirect the user back to your app from the recovery email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.", "default": null, - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" } }, "required": [ @@ -2235,7 +2261,7 @@ "x-appwrite": { "method": "updateRecovery", "group": "recovery", - "weight": 40, + "weight": 39, "cookies": false, "type": "", "demo": "account\/update-recovery.md", @@ -2323,7 +2349,7 @@ "x-appwrite": { "method": "listSessions", "group": "sessions", - "weight": 12, + "weight": 11, "cookies": false, "type": "", "demo": "account\/list-sessions.md", @@ -2372,7 +2398,7 @@ "x-appwrite": { "method": "deleteSessions", "group": "sessions", - "weight": 13, + "weight": 12, "cookies": false, "type": "", "demo": "account\/delete-sessions.md", @@ -2428,7 +2454,7 @@ "x-appwrite": { "method": "createAnonymousSession", "group": "sessions", - "weight": 18, + "weight": 17, "cookies": false, "type": "", "demo": "account\/create-anonymous-session.md", @@ -2484,7 +2510,7 @@ "x-appwrite": { "method": "createEmailPasswordSession", "group": "sessions", - "weight": 17, + "weight": 16, "cookies": false, "type": "", "demo": "account\/create-email-password-session.md", @@ -2523,13 +2549,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password. Must be at least 8 chars.", "default": null, - "x-example": "password" + "x-example": "password", + "format": "password" } }, "required": [ @@ -2567,7 +2595,7 @@ "x-appwrite": { "method": "updateMagicURLSession", "group": "sessions", - "weight": 27, + "weight": 26, "cookies": false, "type": "", "demo": "account\/update-magic-url-session.md", @@ -2654,7 +2682,7 @@ "x-appwrite": { "method": "updatePhoneSession", "group": "sessions", - "weight": 28, + "weight": 27, "cookies": false, "type": "", "demo": "account\/update-phone-session.md", @@ -2741,7 +2769,7 @@ "x-appwrite": { "method": "createSession", "group": "sessions", - "weight": 19, + "weight": 18, "cookies": false, "type": "", "demo": "account\/create-session.md", @@ -2822,7 +2850,7 @@ "x-appwrite": { "method": "getSession", "group": "sessions", - "weight": 14, + "weight": 13, "cookies": false, "type": "", "demo": "account\/get-session.md", @@ -2886,7 +2914,7 @@ "x-appwrite": { "method": "updateSession", "group": "sessions", - "weight": 16, + "weight": 15, "cookies": false, "type": "", "demo": "account\/update-session.md", @@ -2945,7 +2973,7 @@ "x-appwrite": { "method": "deleteSession", "group": "sessions", - "weight": 15, + "weight": 14, "cookies": false, "type": "", "demo": "account\/delete-session.md", @@ -3011,7 +3039,7 @@ "x-appwrite": { "method": "updateStatus", "group": "account", - "weight": 38, + "weight": 37, "cookies": false, "type": "", "demo": "account\/update-status.md", @@ -3067,7 +3095,7 @@ "x-appwrite": { "method": "createEmailToken", "group": "tokens", - "weight": 26, + "weight": 25, "cookies": false, "type": "", "demo": "account\/create-email-token.md", @@ -3115,7 +3143,8 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "phrase": { "type": "boolean", @@ -3159,7 +3188,7 @@ "x-appwrite": { "method": "createMagicURLToken", "group": "tokens", - "weight": 25, + "weight": 24, "cookies": false, "type": "", "demo": "account\/create-magic-url-token.md", @@ -3207,13 +3236,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "url": { "type": "string", "description": "URL to redirect the user back to your app from the magic URL login. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.", "default": "", - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" }, "phrase": { "type": "boolean", @@ -3252,7 +3283,7 @@ "x-appwrite": { "method": "createOAuth2Token", "group": "tokens", - "weight": 24, + "weight": 23, "cookies": false, "type": "webAuth", "demo": "account\/create-o-auth-2-token.md", @@ -3326,8 +3357,7 @@ "yammer", "yandex", "zoho", - "zoom", - "mock" + "zoom" ], "x-enum-name": "OAuthProvider", "x-enum-keys": [], @@ -3394,7 +3424,7 @@ "x-appwrite": { "method": "createPhoneToken", "group": "tokens", - "weight": 29, + "weight": 28, "cookies": false, "type": "", "demo": "account\/create-phone-token.md", @@ -3442,7 +3472,8 @@ "type": "string", "description": "Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", "default": null, - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" } }, "required": [ @@ -3480,7 +3511,7 @@ "x-appwrite": { "method": "createEmailVerification", "group": "verification", - "weight": 41, + "weight": 40, "cookies": false, "type": "", "demo": "account\/create-email-verification.md", @@ -3573,7 +3604,8 @@ "type": "string", "description": "URL to redirect the user back to your app from the verification email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.", "default": null, - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" } }, "required": [ @@ -3608,7 +3640,7 @@ "x-appwrite": { "method": "updateEmailVerification", "group": "verification", - "weight": 42, + "weight": 41, "cookies": false, "type": "", "demo": "account\/update-email-verification.md", @@ -3749,7 +3781,7 @@ "x-appwrite": { "method": "createPhoneVerification", "group": "verification", - "weight": 43, + "weight": 42, "cookies": false, "type": "", "demo": "account\/create-phone-verification.md", @@ -3806,7 +3838,7 @@ "x-appwrite": { "method": "updatePhoneVerification", "group": "verification", - "weight": 44, + "weight": 43, "cookies": false, "type": "", "demo": "account\/update-phone-verification.md", @@ -3887,7 +3919,7 @@ "x-appwrite": { "method": "getBrowser", "group": null, - "weight": 51, + "weight": 264, "cookies": false, "type": "location", "demo": "avatars\/get-browser.md", @@ -4015,7 +4047,7 @@ "x-appwrite": { "method": "getCreditCard", "group": null, - "weight": 50, + "weight": 263, "cookies": false, "type": "location", "demo": "avatars\/get-credit-card.md", @@ -4149,7 +4181,7 @@ "x-appwrite": { "method": "getFavicon", "group": null, - "weight": 54, + "weight": 267, "cookies": false, "type": "location", "demo": "avatars\/get-favicon.md", @@ -4215,7 +4247,7 @@ "x-appwrite": { "method": "getFlag", "group": null, - "weight": 52, + "weight": 265, "cookies": false, "type": "location", "demo": "avatars\/get-flag.md", @@ -4705,7 +4737,7 @@ "x-appwrite": { "method": "getImage", "group": null, - "weight": 53, + "weight": 266, "cookies": false, "type": "location", "demo": "avatars\/get-image.md", @@ -4791,7 +4823,7 @@ "x-appwrite": { "method": "getInitials", "group": null, - "weight": 56, + "weight": 269, "cookies": false, "type": "location", "demo": "avatars\/get-initials.md", @@ -4885,7 +4917,7 @@ "x-appwrite": { "method": "getQR", "group": null, - "weight": 55, + "weight": 268, "cookies": false, "type": "location", "demo": "avatars\/get-qr.md", @@ -4979,7 +5011,7 @@ "x-appwrite": { "method": "getScreenshot", "group": null, - "weight": 57, + "weight": 270, "cookies": false, "type": "location", "demo": "avatars\/get-screenshot.md", @@ -5662,7 +5694,7 @@ "avif", "gif" ], - "x-enum-name": null, + "x-enum-name": "ImageFormat", "x-enum-keys": [], "default": "", "in": "query" @@ -5694,7 +5726,7 @@ "x-appwrite": { "method": "list", "group": "databases", - "weight": 320, + "weight": 278, "cookies": false, "type": "", "demo": "databases\/list.md", @@ -5812,7 +5844,7 @@ "x-appwrite": { "method": "create", "group": "databases", - "weight": 316, + "weight": 274, "cookies": false, "type": "", "demo": "databases\/create.md", @@ -5934,7 +5966,7 @@ "x-appwrite": { "method": "listTransactions", "group": "transactions", - "weight": 380, + "weight": 338, "cookies": false, "type": "", "demo": "databases\/list-transactions.md", @@ -6003,7 +6035,7 @@ "x-appwrite": { "method": "createTransaction", "group": "transactions", - "weight": 376, + "weight": 334, "cookies": false, "type": "", "demo": "databases\/create-transaction.md", @@ -6043,7 +6075,8 @@ "type": "integer", "description": "Seconds before the transaction expires.", "default": 300, - "x-example": 60 + "x-example": 60, + "format": "int32" } } } @@ -6075,7 +6108,7 @@ "x-appwrite": { "method": "getTransaction", "group": "transactions", - "weight": 377, + "weight": 335, "cookies": false, "type": "", "demo": "databases\/get-transaction.md", @@ -6140,7 +6173,7 @@ "x-appwrite": { "method": "updateTransaction", "group": "transactions", - "weight": 378, + "weight": 336, "cookies": false, "type": "", "demo": "databases\/update-transaction.md", @@ -6221,7 +6254,7 @@ "x-appwrite": { "method": "deleteTransaction", "group": "transactions", - "weight": 379, + "weight": 337, "cookies": false, "type": "", "demo": "databases\/delete-transaction.md", @@ -6288,7 +6321,7 @@ "x-appwrite": { "method": "createOperations", "group": "transactions", - "weight": 381, + "weight": 339, "cookies": false, "type": "", "demo": "databases\/create-operations.md", @@ -6371,7 +6404,7 @@ "x-appwrite": { "method": "get", "group": "databases", - "weight": 317, + "weight": 275, "cookies": false, "type": "", "demo": "databases\/get.md", @@ -6467,7 +6500,7 @@ "x-appwrite": { "method": "update", "group": "databases", - "weight": 318, + "weight": 276, "cookies": false, "type": "", "demo": "databases\/update.md", @@ -6501,8 +6534,7 @@ "enabled" ], "required": [ - "databaseId", - "name" + "databaseId" ], "responses": [ { @@ -6557,10 +6589,7 @@ "default": true, "x-example": false } - }, - "required": [ - "name" - ] + } } } ] @@ -6585,7 +6614,7 @@ "x-appwrite": { "method": "delete", "group": "databases", - "weight": 319, + "weight": 277, "cookies": false, "type": "", "demo": "databases\/delete.md", @@ -6680,7 +6709,7 @@ "x-appwrite": { "method": "listCollections", "group": "collections", - "weight": 328, + "weight": 286, "cookies": false, "type": "", "demo": "databases\/list-collections.md", @@ -6776,7 +6805,7 @@ "x-appwrite": { "method": "createCollection", "group": "collections", - "weight": 324, + "weight": 282, "cookies": false, "type": "", "demo": "databases\/create-collection.md", @@ -6907,7 +6936,7 @@ "x-appwrite": { "method": "getCollection", "group": "collections", - "weight": 325, + "weight": 283, "cookies": false, "type": "", "demo": "databases\/get-collection.md", @@ -6981,7 +7010,7 @@ "x-appwrite": { "method": "updateCollection", "group": "collections", - "weight": 326, + "weight": 284, "cookies": false, "type": "", "demo": "databases\/update-collection.md", @@ -7062,10 +7091,7 @@ "default": true, "x-example": false } - }, - "required": [ - "name" - ] + } } } ] @@ -7090,7 +7116,7 @@ "x-appwrite": { "method": "deleteCollection", "group": "collections", - "weight": 327, + "weight": 285, "cookies": false, "type": "", "demo": "databases\/delete-collection.md", @@ -7164,7 +7190,7 @@ "x-appwrite": { "method": "listAttributes", "group": "attributes", - "weight": 345, + "weight": 303, "cookies": false, "type": "", "demo": "databases\/list-attributes.md", @@ -7261,7 +7287,7 @@ "x-appwrite": { "method": "createBooleanAttribute", "group": "attributes", - "weight": 346, + "weight": 304, "cookies": false, "type": "", "demo": "databases\/create-boolean-attribute.md", @@ -7375,7 +7401,7 @@ "x-appwrite": { "method": "updateBooleanAttribute", "group": "attributes", - "weight": 347, + "weight": 305, "cookies": false, "type": "", "demo": "databases\/update-boolean-attribute.md", @@ -7491,7 +7517,7 @@ "x-appwrite": { "method": "createDatetimeAttribute", "group": "attributes", - "weight": 348, + "weight": 306, "cookies": false, "type": "", "demo": "databases\/create-datetime-attribute.md", @@ -7605,7 +7631,7 @@ "x-appwrite": { "method": "updateDatetimeAttribute", "group": "attributes", - "weight": 349, + "weight": 307, "cookies": false, "type": "", "demo": "databases\/update-datetime-attribute.md", @@ -7721,7 +7747,7 @@ "x-appwrite": { "method": "createEmailAttribute", "group": "attributes", - "weight": 350, + "weight": 308, "cookies": false, "type": "", "demo": "databases\/create-email-attribute.md", @@ -7791,6 +7817,7 @@ "description": "Default value for attribute when not provided. Cannot be set when attribute is required.", "default": null, "x-example": "email@example.com", + "format": "email", "x-nullable": true }, "array": { @@ -7835,7 +7862,7 @@ "x-appwrite": { "method": "updateEmailAttribute", "group": "attributes", - "weight": 351, + "weight": 309, "cookies": false, "type": "", "demo": "databases\/update-email-attribute.md", @@ -7906,6 +7933,7 @@ "description": "Default value for attribute when not provided. Cannot be set when attribute is required.", "default": null, "x-example": "email@example.com", + "format": "email", "x-nullable": true }, "newKey": { @@ -7951,7 +7979,7 @@ "x-appwrite": { "method": "createEnumAttribute", "group": "attributes", - "weight": 352, + "weight": 310, "cookies": false, "type": "", "demo": "databases\/create-enum-attribute.md", @@ -8075,7 +8103,7 @@ "x-appwrite": { "method": "updateEnumAttribute", "group": "attributes", - "weight": 353, + "weight": 311, "cookies": false, "type": "", "demo": "databases\/update-enum-attribute.md", @@ -8201,7 +8229,7 @@ "x-appwrite": { "method": "createFloatAttribute", "group": "attributes", - "weight": 354, + "weight": 312, "cookies": false, "type": "", "demo": "databases\/create-float-attribute.md", @@ -8271,6 +8299,7 @@ "description": "Minimum value.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "max": { @@ -8278,6 +8307,7 @@ "description": "Maximum value.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "default": { @@ -8285,6 +8315,7 @@ "description": "Default value. Cannot be set when required.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "array": { @@ -8329,7 +8360,7 @@ "x-appwrite": { "method": "updateFloatAttribute", "group": "attributes", - "weight": 355, + "weight": 313, "cookies": false, "type": "", "demo": "databases\/update-float-attribute.md", @@ -8400,6 +8431,7 @@ "description": "Minimum value.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "max": { @@ -8407,6 +8439,7 @@ "description": "Maximum value.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "default": { @@ -8414,6 +8447,7 @@ "description": "Default value. Cannot be set when required.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "newKey": { @@ -8459,7 +8493,7 @@ "x-appwrite": { "method": "createIntegerAttribute", "group": "attributes", - "weight": 356, + "weight": 314, "cookies": false, "type": "", "demo": "databases\/create-integer-attribute.md", @@ -8529,6 +8563,7 @@ "description": "Minimum value", "default": null, "x-example": null, + "format": "int64", "x-nullable": true }, "max": { @@ -8536,6 +8571,7 @@ "description": "Maximum value", "default": null, "x-example": null, + "format": "int64", "x-nullable": true }, "default": { @@ -8543,6 +8579,7 @@ "description": "Default value. Cannot be set when attribute is required.", "default": null, "x-example": null, + "format": "int64", "x-nullable": true }, "array": { @@ -8587,7 +8624,7 @@ "x-appwrite": { "method": "updateIntegerAttribute", "group": "attributes", - "weight": 357, + "weight": 315, "cookies": false, "type": "", "demo": "databases\/update-integer-attribute.md", @@ -8658,6 +8695,7 @@ "description": "Minimum value", "default": null, "x-example": null, + "format": "int64", "x-nullable": true }, "max": { @@ -8665,6 +8703,7 @@ "description": "Maximum value", "default": null, "x-example": null, + "format": "int64", "x-nullable": true }, "default": { @@ -8672,6 +8711,7 @@ "description": "Default value. Cannot be set when attribute is required.", "default": null, "x-example": null, + "format": "int64", "x-nullable": true }, "newKey": { @@ -8717,7 +8757,7 @@ "x-appwrite": { "method": "createIpAttribute", "group": "attributes", - "weight": 358, + "weight": 316, "cookies": false, "type": "", "demo": "databases\/create-ip-attribute.md", @@ -8831,7 +8871,7 @@ "x-appwrite": { "method": "updateIpAttribute", "group": "attributes", - "weight": 359, + "weight": 317, "cookies": false, "type": "", "demo": "databases\/update-ip-attribute.md", @@ -8947,7 +8987,7 @@ "x-appwrite": { "method": "createLineAttribute", "group": "attributes", - "weight": 360, + "weight": 318, "cookies": false, "type": "", "demo": "databases\/create-line-attribute.md", @@ -9055,7 +9095,7 @@ "x-appwrite": { "method": "updateLineAttribute", "group": "attributes", - "weight": 361, + "weight": 319, "cookies": false, "type": "", "demo": "databases\/update-line-attribute.md", @@ -9170,7 +9210,7 @@ "x-appwrite": { "method": "createPointAttribute", "group": "attributes", - "weight": 362, + "weight": 320, "cookies": false, "type": "", "demo": "databases\/create-point-attribute.md", @@ -9278,7 +9318,7 @@ "x-appwrite": { "method": "updatePointAttribute", "group": "attributes", - "weight": 363, + "weight": 321, "cookies": false, "type": "", "demo": "databases\/update-point-attribute.md", @@ -9393,7 +9433,7 @@ "x-appwrite": { "method": "createPolygonAttribute", "group": "attributes", - "weight": 364, + "weight": 322, "cookies": false, "type": "", "demo": "databases\/create-polygon-attribute.md", @@ -9501,7 +9541,7 @@ "x-appwrite": { "method": "updatePolygonAttribute", "group": "attributes", - "weight": 365, + "weight": 323, "cookies": false, "type": "", "demo": "databases\/update-polygon-attribute.md", @@ -9616,7 +9656,7 @@ "x-appwrite": { "method": "createRelationshipAttribute", "group": "attributes", - "weight": 366, + "weight": 324, "cookies": false, "type": "", "demo": "databases\/create-relationship-attribute.md", @@ -9758,7 +9798,7 @@ "x-appwrite": { "method": "createStringAttribute", "group": "attributes", - "weight": 368, + "weight": 326, "cookies": false, "type": "", "demo": "databases\/create-string-attribute.md", @@ -9821,7 +9861,8 @@ "type": "integer", "description": "Attribute size for text attributes, in number of characters.", "default": null, - "x-example": 1 + "x-example": 1, + "format": "int32" }, "required": { "type": "boolean", @@ -9885,7 +9926,7 @@ "x-appwrite": { "method": "updateStringAttribute", "group": "attributes", - "weight": 369, + "weight": 327, "cookies": false, "type": "", "demo": "databases\/update-string-attribute.md", @@ -9963,6 +10004,7 @@ "description": "Maximum size of the string attribute.", "default": null, "x-example": 1, + "format": "int32", "x-nullable": true }, "newKey": { @@ -10008,7 +10050,7 @@ "x-appwrite": { "method": "createUrlAttribute", "group": "attributes", - "weight": 370, + "weight": 328, "cookies": false, "type": "", "demo": "databases\/create-url-attribute.md", @@ -10078,6 +10120,7 @@ "description": "Default value for attribute when not provided. Cannot be set when attribute is required.", "default": null, "x-example": "https:\/\/example.com", + "format": "url", "x-nullable": true }, "array": { @@ -10122,7 +10165,7 @@ "x-appwrite": { "method": "updateUrlAttribute", "group": "attributes", - "weight": 371, + "weight": 329, "cookies": false, "type": "", "demo": "databases\/update-url-attribute.md", @@ -10193,6 +10236,7 @@ "description": "Default value for attribute when not provided. Cannot be set when attribute is required.", "default": null, "x-example": "https:\/\/example.com", + "format": "url", "x-nullable": true }, "newKey": { @@ -10267,7 +10311,7 @@ "x-appwrite": { "method": "getAttribute", "group": "attributes", - "weight": 343, + "weight": 301, "cookies": false, "type": "", "demo": "databases\/get-attribute.md", @@ -10343,7 +10387,7 @@ "x-appwrite": { "method": "deleteAttribute", "group": "attributes", - "weight": 344, + "weight": 302, "cookies": false, "type": "", "demo": "databases\/delete-attribute.md", @@ -10426,7 +10470,7 @@ "x-appwrite": { "method": "updateRelationshipAttribute", "group": "attributes", - "weight": 367, + "weight": 325, "cookies": false, "type": "", "demo": "databases\/update-relationship-attribute.md", @@ -10537,7 +10581,7 @@ "x-appwrite": { "method": "listDocuments", "group": "documents", - "weight": 339, + "weight": 297, "cookies": false, "type": "", "demo": "databases\/list-documents.md", @@ -10643,7 +10687,7 @@ "x-appwrite": { "method": "createDocument", "group": "documents", - "weight": 331, + "weight": 289, "cookies": false, "type": "", "demo": "databases\/create-document.md", @@ -10838,7 +10882,7 @@ "x-appwrite": { "method": "upsertDocuments", "group": "documents", - "weight": 336, + "weight": 294, "cookies": false, "type": "", "demo": "databases\/upsert-documents.md", @@ -10975,7 +11019,7 @@ "x-appwrite": { "method": "updateDocuments", "group": "documents", - "weight": 334, + "weight": 292, "cookies": false, "type": "", "demo": "databases\/update-documents.md", @@ -11080,7 +11124,7 @@ "x-appwrite": { "method": "deleteDocuments", "group": "documents", - "weight": 338, + "weight": 296, "cookies": false, "type": "", "demo": "databases\/delete-documents.md", @@ -11179,7 +11223,7 @@ "x-appwrite": { "method": "getDocument", "group": "documents", - "weight": 332, + "weight": 290, "cookies": false, "type": "", "demo": "databases\/get-document.md", @@ -11284,7 +11328,7 @@ "x-appwrite": { "method": "upsertDocument", "group": "documents", - "weight": 335, + "weight": 293, "cookies": false, "type": "", "demo": "databases\/upsert-document.md", @@ -11438,7 +11482,7 @@ "x-appwrite": { "method": "updateDocument", "group": "documents", - "weight": 333, + "weight": 291, "cookies": false, "type": "", "demo": "databases\/update-document.md", @@ -11550,7 +11594,7 @@ "x-appwrite": { "method": "deleteDocument", "group": "documents", - "weight": 337, + "weight": 295, "cookies": false, "type": "", "demo": "databases\/delete-document.md", @@ -11653,7 +11697,7 @@ "x-appwrite": { "method": "decrementDocumentAttribute", "group": "documents", - "weight": 342, + "weight": 300, "cookies": false, "type": "", "demo": "databases\/decrement-document-attribute.md", @@ -11728,13 +11772,15 @@ "type": "number", "description": "Value to increment the attribute by. The value must be a number.", "default": 1, - "x-example": null + "x-example": null, + "format": "float" }, "min": { "type": "number", "description": "Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "transactionId": { @@ -11776,7 +11822,7 @@ "x-appwrite": { "method": "incrementDocumentAttribute", "group": "documents", - "weight": 341, + "weight": 299, "cookies": false, "type": "", "demo": "databases\/increment-document-attribute.md", @@ -11851,13 +11897,15 @@ "type": "number", "description": "Value to increment the attribute by. The value must be a number.", "default": 1, - "x-example": null + "x-example": null, + "format": "float" }, "max": { "type": "number", "description": "Maximum value for the attribute. If the current value is greater than this value, an error will be thrown.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "transactionId": { @@ -11897,7 +11945,7 @@ "x-appwrite": { "method": "listIndexes", "group": "indexes", - "weight": 375, + "weight": 333, "cookies": false, "type": "", "demo": "databases\/list-indexes.md", @@ -11992,7 +12040,7 @@ "x-appwrite": { "method": "createIndex", "group": "indexes", - "weight": 372, + "weight": 330, "cookies": false, "type": "", "demo": "databases\/create-index.md", @@ -12133,7 +12181,7 @@ "x-appwrite": { "method": "getIndex", "group": "indexes", - "weight": 373, + "weight": 331, "cookies": false, "type": "", "demo": "databases\/get-index.md", @@ -12209,7 +12257,7 @@ "x-appwrite": { "method": "deleteIndex", "group": "indexes", - "weight": 374, + "weight": 332, "cookies": false, "type": "", "demo": "databases\/delete-index.md", @@ -12290,7 +12338,7 @@ "x-appwrite": { "method": "list", "group": "functions", - "weight": 456, + "weight": 415, "cookies": false, "type": "", "demo": "functions\/list.md", @@ -12373,7 +12421,7 @@ "x-appwrite": { "method": "create", "group": "functions", - "weight": 453, + "weight": 412, "cookies": false, "type": "", "demo": "functions\/create.md", @@ -12522,7 +12570,8 @@ "type": "integer", "description": "Function maximum execution time in seconds.", "default": 15, - "x-example": 1 + "x-example": 1, + "format": "int32" }, "enabled": { "type": "boolean", @@ -12687,7 +12736,7 @@ "x-appwrite": { "method": "listRuntimes", "group": "runtimes", - "weight": 458, + "weight": 417, "cookies": false, "type": "", "demo": "functions\/list-runtimes.md", @@ -12738,7 +12787,7 @@ "x-appwrite": { "method": "listSpecifications", "group": "runtimes", - "weight": 459, + "weight": 418, "cookies": false, "type": "", "demo": "functions\/list-specifications.md", @@ -12789,7 +12838,7 @@ "x-appwrite": { "method": "get", "group": "functions", - "weight": 454, + "weight": 413, "cookies": false, "type": "", "demo": "functions\/get.md", @@ -12850,7 +12899,7 @@ "x-appwrite": { "method": "update", "group": "functions", - "weight": 455, + "weight": 414, "cookies": false, "type": "", "demo": "functions\/update.md", @@ -13001,7 +13050,8 @@ "type": "integer", "description": "Maximum execution time in seconds.", "default": 15, - "x-example": 1 + "x-example": 1, + "format": "int32" }, "enabled": { "type": "boolean", @@ -13160,7 +13210,7 @@ "x-appwrite": { "method": "delete", "group": "functions", - "weight": 457, + "weight": 416, "cookies": false, "type": "", "demo": "functions\/delete.md", @@ -13223,7 +13273,7 @@ "x-appwrite": { "method": "updateFunctionDeployment", "group": "functions", - "weight": 462, + "weight": 421, "cookies": false, "type": "", "demo": "functions\/update-function-deployment.md", @@ -13302,7 +13352,7 @@ "x-appwrite": { "method": "listDeployments", "group": "deployments", - "weight": 463, + "weight": 422, "cookies": false, "type": "", "demo": "functions\/list-deployments.md", @@ -13393,7 +13443,7 @@ "x-appwrite": { "method": "createDeployment", "group": "deployments", - "weight": 460, + "weight": 419, "cookies": false, "type": "upload", "demo": "functions\/create-deployment.md", @@ -13487,7 +13537,7 @@ "x-appwrite": { "method": "createDuplicateDeployment", "group": "deployments", - "weight": 468, + "weight": 427, "cookies": false, "type": "", "demo": "functions\/create-duplicate-deployment.md", @@ -13574,7 +13624,7 @@ "x-appwrite": { "method": "createTemplateDeployment", "group": "deployments", - "weight": 465, + "weight": 424, "cookies": false, "type": "", "demo": "functions\/create-template-deployment.md", @@ -13696,7 +13746,7 @@ "x-appwrite": { "method": "createVcsDeployment", "group": "deployments", - "weight": 466, + "weight": 425, "cookies": false, "type": "", "demo": "functions\/create-vcs-deployment.md", @@ -13794,7 +13844,7 @@ "x-appwrite": { "method": "getDeployment", "group": "deployments", - "weight": 461, + "weight": 420, "cookies": false, "type": "", "demo": "functions\/get-deployment.md", @@ -13858,7 +13908,7 @@ "x-appwrite": { "method": "deleteDeployment", "group": "deployments", - "weight": 464, + "weight": 423, "cookies": false, "type": "", "demo": "functions\/delete-deployment.md", @@ -13927,7 +13977,7 @@ "x-appwrite": { "method": "getDeploymentDownload", "group": "deployments", - "weight": 467, + "weight": 426, "cookies": false, "type": "location", "demo": "functions\/get-deployment-download.md", @@ -14014,7 +14064,7 @@ "x-appwrite": { "method": "updateDeploymentStatus", "group": "deployments", - "weight": 469, + "weight": 428, "cookies": false, "type": "", "demo": "functions\/update-deployment-status.md", @@ -14083,7 +14133,7 @@ "x-appwrite": { "method": "listExecutions", "group": "executions", - "weight": 472, + "weight": 431, "cookies": false, "type": "", "demo": "functions\/list-executions.md", @@ -14168,7 +14218,7 @@ "x-appwrite": { "method": "createExecution", "group": "executions", - "weight": 470, + "weight": 429, "cookies": false, "type": "", "demo": "functions\/create-execution.md", @@ -14289,7 +14339,7 @@ "x-appwrite": { "method": "getExecution", "group": "executions", - "weight": 471, + "weight": 430, "cookies": false, "type": "", "demo": "functions\/get-execution.md", @@ -14356,7 +14406,7 @@ "x-appwrite": { "method": "deleteExecution", "group": "executions", - "weight": 473, + "weight": 432, "cookies": false, "type": "", "demo": "functions\/delete-execution.md", @@ -14425,7 +14475,7 @@ "x-appwrite": { "method": "listVariables", "group": "variables", - "weight": 478, + "weight": 437, "cookies": false, "type": "", "demo": "functions\/list-variables.md", @@ -14486,7 +14536,7 @@ "x-appwrite": { "method": "createVariable", "group": "variables", - "weight": 476, + "weight": 435, "cookies": false, "type": "", "demo": "functions\/create-variable.md", @@ -14578,7 +14628,7 @@ "x-appwrite": { "method": "getVariable", "group": "variables", - "weight": 477, + "weight": 436, "cookies": false, "type": "", "demo": "functions\/get-variable.md", @@ -14647,7 +14697,7 @@ "x-appwrite": { "method": "updateVariable", "group": "variables", - "weight": 479, + "weight": 438, "cookies": false, "type": "", "demo": "functions\/update-variable.md", @@ -14743,7 +14793,7 @@ "x-appwrite": { "method": "deleteVariable", "group": "variables", - "weight": 480, + "weight": 439, "cookies": false, "type": "", "demo": "functions\/delete-variable.md", @@ -14814,7 +14864,7 @@ "x-appwrite": { "method": "query", "group": "graphql", - "weight": 241, + "weight": 190, "cookies": false, "type": "graphql", "demo": "graphql\/query.md", @@ -14891,7 +14941,7 @@ "x-appwrite": { "method": "mutation", "group": "graphql", - "weight": 240, + "weight": 189, "cookies": false, "type": "graphql", "demo": "graphql\/mutation.md", @@ -14966,7 +15016,7 @@ "x-appwrite": { "method": "get", "group": "health", - "weight": 69, + "weight": 442, "cookies": false, "type": "", "demo": "health\/get.md", @@ -15018,7 +15068,7 @@ "x-appwrite": { "method": "getAntivirus", "group": "health", - "weight": 90, + "weight": 451, "cookies": false, "type": "", "demo": "health\/get-antivirus.md", @@ -15060,9 +15110,9 @@ "description": "Check the Appwrite in-memory cache servers are up and connection is successful.", "responses": { "200": { - "description": "Health Status", + "description": "Status List", "schema": { - "$ref": "#\/definitions\/healthStatus" + "$ref": "#\/definitions\/healthStatusList" } } }, @@ -15070,7 +15120,7 @@ "x-appwrite": { "method": "getCache", "group": "health", - "weight": 72, + "weight": 445, "cookies": false, "type": "", "demo": "health\/get-cache.md", @@ -15122,7 +15172,7 @@ "x-appwrite": { "method": "getCertificate", "group": "health", - "weight": 77, + "weight": 448, "cookies": false, "type": "", "demo": "health\/get-certificate.md", @@ -15173,9 +15223,9 @@ "description": "Check the Appwrite database servers are up and connection is successful.", "responses": { "200": { - "description": "Health Status", + "description": "Status List", "schema": { - "$ref": "#\/definitions\/healthStatus" + "$ref": "#\/definitions\/healthStatusList" } } }, @@ -15183,7 +15233,7 @@ "x-appwrite": { "method": "getDB", "group": "health", - "weight": 71, + "weight": 444, "cookies": false, "type": "", "demo": "health\/get-db.md", @@ -15225,9 +15275,9 @@ "description": "Check the Appwrite pub-sub servers are up and connection is successful.", "responses": { "200": { - "description": "Health Status", + "description": "Status List", "schema": { - "$ref": "#\/definitions\/healthStatus" + "$ref": "#\/definitions\/healthStatusList" } } }, @@ -15235,7 +15285,7 @@ "x-appwrite": { "method": "getPubSub", "group": "health", - "weight": 73, + "weight": 446, "cookies": false, "type": "", "demo": "health\/get-pub-sub.md", @@ -15263,6 +15313,69 @@ ] } }, + "\/health\/queue\/audits": { + "get": { + "summary": "Get audits queue", + "operationId": "healthGetQueueAudits", + "consumes": [], + "produces": [ + "application\/json" + ], + "tags": [ + "health" + ], + "description": "Get the number of audit logs that are waiting to be processed in the Appwrite internal queue server.", + "responses": { + "200": { + "description": "Health Queue", + "schema": { + "$ref": "#\/definitions\/healthQueue" + } + } + }, + "deprecated": false, + "x-appwrite": { + "method": "getQueueAudits", + "group": "queue", + "weight": 452, + "cookies": false, + "type": "", + "demo": "health\/get-queue-audits.md", + "rate-limit": 0, + "rate-time": 3600, + "rate-key": "url:{url},ip:{ip}", + "scope": "health.read", + "platforms": [ + "console", + "server" + ], + "packaging": false, + "public": true, + "edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-audits.md", + "auth": { + "Project": [], + "Key": [] + } + }, + "security": [ + { + "Project": [], + "Key": [] + } + ], + "parameters": [ + { + "name": "threshold", + "description": "Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.", + "required": false, + "type": "integer", + "format": "int32", + "default": 5000, + "in": "query" + } + ] + } + }, "\/health\/queue\/builds": { "get": { "summary": "Get builds queue", @@ -15287,7 +15400,7 @@ "x-appwrite": { "method": "getQueueBuilds", "group": "queue", - "weight": 79, + "weight": 456, "cookies": false, "type": "", "demo": "health\/get-queue-builds.md", @@ -15350,7 +15463,7 @@ "x-appwrite": { "method": "getQueueCertificates", "group": "queue", - "weight": 78, + "weight": 455, "cookies": false, "type": "", "demo": "health\/get-queue-certificates.md", @@ -15413,7 +15526,7 @@ "x-appwrite": { "method": "getQueueDatabases", "group": "queue", - "weight": 80, + "weight": 457, "cookies": false, "type": "", "demo": "health\/get-queue-databases.md", @@ -15485,7 +15598,7 @@ "x-appwrite": { "method": "getQueueDeletes", "group": "queue", - "weight": 81, + "weight": 458, "cookies": false, "type": "", "demo": "health\/get-queue-deletes.md", @@ -15548,7 +15661,7 @@ "x-appwrite": { "method": "getFailedJobs", "group": "queue", - "weight": 91, + "weight": 465, "cookies": false, "type": "", "demo": "health\/get-failed-jobs.md", @@ -15592,6 +15705,7 @@ "v1-webhooks", "v1-certificates", "v1-builds", + "v1-screenshots", "v1-messaging", "v1-migrations" ], @@ -15635,7 +15749,7 @@ "x-appwrite": { "method": "getQueueFunctions", "group": "queue", - "weight": 85, + "weight": 462, "cookies": false, "type": "", "demo": "health\/get-queue-functions.md", @@ -15698,7 +15812,7 @@ "x-appwrite": { "method": "getQueueLogs", "group": "queue", - "weight": 76, + "weight": 454, "cookies": false, "type": "", "demo": "health\/get-queue-logs.md", @@ -15761,7 +15875,7 @@ "x-appwrite": { "method": "getQueueMails", "group": "queue", - "weight": 82, + "weight": 459, "cookies": false, "type": "", "demo": "health\/get-queue-mails.md", @@ -15824,7 +15938,7 @@ "x-appwrite": { "method": "getQueueMessaging", "group": "queue", - "weight": 83, + "weight": 460, "cookies": false, "type": "", "demo": "health\/get-queue-messaging.md", @@ -15887,7 +16001,7 @@ "x-appwrite": { "method": "getQueueMigrations", "group": "queue", - "weight": 84, + "weight": 461, "cookies": false, "type": "", "demo": "health\/get-queue-migrations.md", @@ -15950,7 +16064,7 @@ "x-appwrite": { "method": "getQueueStatsResources", "group": "queue", - "weight": 86, + "weight": 463, "cookies": false, "type": "", "demo": "health\/get-queue-stats-resources.md", @@ -16013,7 +16127,7 @@ "x-appwrite": { "method": "getQueueUsage", "group": "queue", - "weight": 87, + "weight": 464, "cookies": false, "type": "", "demo": "health\/get-queue-usage.md", @@ -16076,7 +16190,7 @@ "x-appwrite": { "method": "getQueueWebhooks", "group": "queue", - "weight": 75, + "weight": 453, "cookies": false, "type": "", "demo": "health\/get-queue-webhooks.md", @@ -16139,7 +16253,7 @@ "x-appwrite": { "method": "getStorage", "group": "storage", - "weight": 89, + "weight": 450, "cookies": false, "type": "", "demo": "health\/get-storage.md", @@ -16191,7 +16305,7 @@ "x-appwrite": { "method": "getStorageLocal", "group": "storage", - "weight": 88, + "weight": 449, "cookies": false, "type": "", "demo": "health\/get-storage-local.md", @@ -16243,7 +16357,7 @@ "x-appwrite": { "method": "getTime", "group": "health", - "weight": 74, + "weight": 447, "cookies": false, "type": "", "demo": "health\/get-time.md", @@ -16295,7 +16409,7 @@ "x-appwrite": { "method": "get", "group": null, - "weight": 61, + "weight": 49, "cookies": false, "type": "", "demo": "locale\/get.md", @@ -16350,7 +16464,7 @@ "x-appwrite": { "method": "listCodes", "group": null, - "weight": 62, + "weight": 50, "cookies": false, "type": "", "demo": "locale\/list-codes.md", @@ -16405,7 +16519,7 @@ "x-appwrite": { "method": "listContinents", "group": null, - "weight": 66, + "weight": 54, "cookies": false, "type": "", "demo": "locale\/list-continents.md", @@ -16460,7 +16574,7 @@ "x-appwrite": { "method": "listCountries", "group": null, - "weight": 63, + "weight": 51, "cookies": false, "type": "", "demo": "locale\/list-countries.md", @@ -16515,7 +16629,7 @@ "x-appwrite": { "method": "listCountriesEU", "group": null, - "weight": 64, + "weight": 52, "cookies": false, "type": "", "demo": "locale\/list-countries-eu.md", @@ -16570,7 +16684,7 @@ "x-appwrite": { "method": "listCountriesPhones", "group": null, - "weight": 65, + "weight": 53, "cookies": false, "type": "", "demo": "locale\/list-countries-phones.md", @@ -16625,7 +16739,7 @@ "x-appwrite": { "method": "listCurrencies", "group": null, - "weight": 67, + "weight": 55, "cookies": false, "type": "", "demo": "locale\/list-currencies.md", @@ -16680,7 +16794,7 @@ "x-appwrite": { "method": "listLanguages", "group": null, - "weight": 68, + "weight": 56, "cookies": false, "type": "", "demo": "locale\/list-languages.md", @@ -16735,7 +16849,7 @@ "x-appwrite": { "method": "listMessages", "group": "messages", - "weight": 298, + "weight": 245, "cookies": false, "type": "", "demo": "messaging\/list-messages.md", @@ -16821,7 +16935,7 @@ "x-appwrite": { "method": "createEmail", "group": "messages", - "weight": 295, + "weight": 242, "cookies": false, "type": "", "demo": "messaging\/create-email.md", @@ -16982,7 +17096,7 @@ "x-appwrite": { "method": "updateEmail", "group": "messages", - "weight": 302, + "weight": 249, "cookies": false, "type": "", "demo": "messaging\/update-email.md", @@ -17150,7 +17264,7 @@ "x-appwrite": { "method": "createPush", "group": "messages", - "weight": 297, + "weight": 244, "cookies": false, "type": "", "demo": "messaging\/create-push.md", @@ -17275,7 +17389,8 @@ "type": "integer", "description": "Badge for push notification. Available only for iOS Platform.", "default": -1, - "x-example": null + "x-example": null, + "format": "int32" }, "draft": { "type": "boolean", @@ -17349,7 +17464,7 @@ "x-appwrite": { "method": "updatePush", "group": "messages", - "weight": 304, + "weight": 251, "cookies": false, "type": "", "demo": "messaging\/update-push.md", @@ -17488,6 +17603,7 @@ "description": "Badge for push notification. Available only for iOS platforms.", "default": null, "x-example": null, + "format": "int32", "x-nullable": true }, "draft": { @@ -17563,7 +17679,7 @@ "x-appwrite": { "method": "createSms", "group": "messages", - "weight": 296, + "weight": 243, "cookies": false, "type": "", "demo": "messaging\/create-sms.md", @@ -17756,7 +17872,7 @@ "x-appwrite": { "method": "updateSms", "group": "messages", - "weight": 303, + "weight": 250, "cookies": false, "type": "", "demo": "messaging\/update-sms.md", @@ -17948,7 +18064,7 @@ "x-appwrite": { "method": "getMessage", "group": "messages", - "weight": 301, + "weight": 248, "cookies": false, "type": "", "demo": "messaging\/get-message.md", @@ -18005,7 +18121,7 @@ "x-appwrite": { "method": "delete", "group": "messages", - "weight": 305, + "weight": 252, "cookies": false, "type": "", "demo": "messaging\/delete.md", @@ -18067,7 +18183,7 @@ "x-appwrite": { "method": "listMessageLogs", "group": "logs", - "weight": 299, + "weight": 246, "cookies": false, "type": "", "demo": "messaging\/list-message-logs.md", @@ -18150,7 +18266,7 @@ "x-appwrite": { "method": "listTargets", "group": "messages", - "weight": 300, + "weight": 247, "cookies": false, "type": "", "demo": "messaging\/list-targets.md", @@ -18233,7 +18349,7 @@ "x-appwrite": { "method": "listProviders", "group": "providers", - "weight": 269, + "weight": 216, "cookies": false, "type": "", "demo": "messaging\/list-providers.md", @@ -18319,7 +18435,7 @@ "x-appwrite": { "method": "createApnsProvider", "group": "providers", - "weight": 268, + "weight": 215, "cookies": false, "type": "", "demo": "messaging\/create-apns-provider.md", @@ -18511,7 +18627,7 @@ "x-appwrite": { "method": "updateApnsProvider", "group": "providers", - "weight": 282, + "weight": 229, "cookies": false, "type": "", "demo": "messaging\/update-apns-provider.md", @@ -18700,7 +18816,7 @@ "x-appwrite": { "method": "createFcmProvider", "group": "providers", - "weight": 267, + "weight": 214, "cookies": false, "type": "", "demo": "messaging\/create-fcm-provider.md", @@ -18861,7 +18977,7 @@ "x-appwrite": { "method": "updateFcmProvider", "group": "providers", - "weight": 281, + "weight": 228, "cookies": false, "type": "", "demo": "messaging\/update-fcm-provider.md", @@ -19018,7 +19134,7 @@ "x-appwrite": { "method": "createMailgunProvider", "group": "providers", - "weight": 258, + "weight": 205, "cookies": false, "type": "", "demo": "messaging\/create-mailgun-provider.md", @@ -19092,7 +19208,8 @@ "type": "string", "description": "Sender email address.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -19104,7 +19221,8 @@ "type": "string", "description": "Email set in the reply to field for the mail. Default value is sender email. Reply to email must have reply to name as well.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "enabled": { "type": "boolean", @@ -19149,7 +19267,7 @@ "x-appwrite": { "method": "updateMailgunProvider", "group": "providers", - "weight": 272, + "weight": 219, "cookies": false, "type": "", "demo": "messaging\/update-mailgun-provider.md", @@ -19232,7 +19350,8 @@ "type": "string", "description": "Sender email address.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -19278,7 +19397,7 @@ "x-appwrite": { "method": "createMsg91Provider", "group": "providers", - "weight": 262, + "weight": 209, "cookies": false, "type": "", "demo": "messaging\/create-msg-91-provider.md", @@ -19384,7 +19503,7 @@ "x-appwrite": { "method": "updateMsg91Provider", "group": "providers", - "weight": 276, + "weight": 223, "cookies": false, "type": "", "demo": "messaging\/update-msg-91-provider.md", @@ -19488,7 +19607,7 @@ "x-appwrite": { "method": "createResendProvider", "group": "providers", - "weight": 260, + "weight": 207, "cookies": false, "type": "", "demo": "messaging\/create-resend-provider.md", @@ -19549,7 +19668,8 @@ "type": "string", "description": "Sender email address.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -19561,7 +19681,8 @@ "type": "string", "description": "Email set in the reply to field for the mail. Default value is sender email.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "enabled": { "type": "boolean", @@ -19606,7 +19727,7 @@ "x-appwrite": { "method": "updateResendProvider", "group": "providers", - "weight": 274, + "weight": 221, "cookies": false, "type": "", "demo": "messaging\/update-resend-provider.md", @@ -19676,7 +19797,8 @@ "type": "string", "description": "Sender email address.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -19722,7 +19844,7 @@ "x-appwrite": { "method": "createSendgridProvider", "group": "providers", - "weight": 259, + "weight": 206, "cookies": false, "type": "", "demo": "messaging\/create-sendgrid-provider.md", @@ -19783,7 +19905,8 @@ "type": "string", "description": "Sender email address.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -19795,7 +19918,8 @@ "type": "string", "description": "Email set in the reply to field for the mail. Default value is sender email.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "enabled": { "type": "boolean", @@ -19840,7 +19964,7 @@ "x-appwrite": { "method": "updateSendgridProvider", "group": "providers", - "weight": 273, + "weight": 220, "cookies": false, "type": "", "demo": "messaging\/update-sendgrid-provider.md", @@ -19910,7 +20034,8 @@ "type": "string", "description": "Sender email address.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -19956,7 +20081,7 @@ "x-appwrite": { "method": "createSmtpProvider", "group": "providers", - "weight": 261, + "weight": 208, "cookies": false, "type": "", "demo": "messaging\/create-smtp-provider.md", @@ -20099,7 +20224,8 @@ "type": "integer", "description": "The default SMTP server port.", "default": 587, - "x-example": 1 + "x-example": 1, + "format": "int32" }, "username": { "type": "string", @@ -20148,7 +20274,8 @@ "type": "string", "description": "Sender email address.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -20160,7 +20287,8 @@ "type": "string", "description": "Email set in the reply to field for the mail. Default value is sender email.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "enabled": { "type": "boolean", @@ -20206,7 +20334,7 @@ "x-appwrite": { "method": "updateSmtpProvider", "group": "providers", - "weight": 275, + "weight": 222, "cookies": false, "type": "", "demo": "messaging\/update-smtp-provider.md", @@ -20348,6 +20476,7 @@ "description": "SMTP port.", "default": null, "x-example": 1, + "format": "int32", "x-nullable": true }, "username": { @@ -20398,7 +20527,8 @@ "type": "string", "description": "Sender email address.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -20451,7 +20581,7 @@ "x-appwrite": { "method": "createTelesignProvider", "group": "providers", - "weight": 263, + "weight": 210, "cookies": false, "type": "", "demo": "messaging\/create-telesign-provider.md", @@ -20500,7 +20630,8 @@ "type": "string", "description": "Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", "default": "", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "customerId": { "type": "string", @@ -20557,7 +20688,7 @@ "x-appwrite": { "method": "updateTelesignProvider", "group": "providers", - "weight": 277, + "weight": 224, "cookies": false, "type": "", "demo": "messaging\/update-telesign-provider.md", @@ -20661,7 +20792,7 @@ "x-appwrite": { "method": "createTextmagicProvider", "group": "providers", - "weight": 264, + "weight": 211, "cookies": false, "type": "", "demo": "messaging\/create-textmagic-provider.md", @@ -20710,7 +20841,8 @@ "type": "string", "description": "Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", "default": "", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "username": { "type": "string", @@ -20767,7 +20899,7 @@ "x-appwrite": { "method": "updateTextmagicProvider", "group": "providers", - "weight": 278, + "weight": 225, "cookies": false, "type": "", "demo": "messaging\/update-textmagic-provider.md", @@ -20871,7 +21003,7 @@ "x-appwrite": { "method": "createTwilioProvider", "group": "providers", - "weight": 265, + "weight": 212, "cookies": false, "type": "", "demo": "messaging\/create-twilio-provider.md", @@ -20920,7 +21052,8 @@ "type": "string", "description": "Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", "default": "", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "accountSid": { "type": "string", @@ -20977,7 +21110,7 @@ "x-appwrite": { "method": "updateTwilioProvider", "group": "providers", - "weight": 279, + "weight": 226, "cookies": false, "type": "", "demo": "messaging\/update-twilio-provider.md", @@ -21081,7 +21214,7 @@ "x-appwrite": { "method": "createVonageProvider", "group": "providers", - "weight": 266, + "weight": 213, "cookies": false, "type": "", "demo": "messaging\/create-vonage-provider.md", @@ -21130,7 +21263,8 @@ "type": "string", "description": "Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", "default": "", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "apiKey": { "type": "string", @@ -21187,7 +21321,7 @@ "x-appwrite": { "method": "updateVonageProvider", "group": "providers", - "weight": 280, + "weight": 227, "cookies": false, "type": "", "demo": "messaging\/update-vonage-provider.md", @@ -21289,7 +21423,7 @@ "x-appwrite": { "method": "getProvider", "group": "providers", - "weight": 271, + "weight": 218, "cookies": false, "type": "", "demo": "messaging\/get-provider.md", @@ -21346,7 +21480,7 @@ "x-appwrite": { "method": "deleteProvider", "group": "providers", - "weight": 283, + "weight": 230, "cookies": false, "type": "", "demo": "messaging\/delete-provider.md", @@ -21408,7 +21542,7 @@ "x-appwrite": { "method": "listProviderLogs", "group": "providers", - "weight": 270, + "weight": 217, "cookies": false, "type": "", "demo": "messaging\/list-provider-logs.md", @@ -21491,7 +21625,7 @@ "x-appwrite": { "method": "listSubscriberLogs", "group": "subscribers", - "weight": 292, + "weight": 239, "cookies": false, "type": "", "demo": "messaging\/list-subscriber-logs.md", @@ -21574,7 +21708,7 @@ "x-appwrite": { "method": "listTopics", "group": "topics", - "weight": 285, + "weight": 232, "cookies": false, "type": "", "demo": "messaging\/list-topics.md", @@ -21658,7 +21792,7 @@ "x-appwrite": { "method": "createTopic", "group": "topics", - "weight": 284, + "weight": 231, "cookies": false, "type": "", "demo": "messaging\/create-topic.md", @@ -21748,7 +21882,7 @@ "x-appwrite": { "method": "getTopic", "group": "topics", - "weight": 287, + "weight": 234, "cookies": false, "type": "", "demo": "messaging\/get-topic.md", @@ -21810,7 +21944,7 @@ "x-appwrite": { "method": "updateTopic", "group": "topics", - "weight": 288, + "weight": 235, "cookies": false, "type": "", "demo": "messaging\/update-topic.md", @@ -21893,7 +22027,7 @@ "x-appwrite": { "method": "deleteTopic", "group": "topics", - "weight": 289, + "weight": 236, "cookies": false, "type": "", "demo": "messaging\/delete-topic.md", @@ -21955,7 +22089,7 @@ "x-appwrite": { "method": "listTopicLogs", "group": "topics", - "weight": 286, + "weight": 233, "cookies": false, "type": "", "demo": "messaging\/list-topic-logs.md", @@ -22038,7 +22172,7 @@ "x-appwrite": { "method": "listSubscribers", "group": "subscribers", - "weight": 291, + "weight": 238, "cookies": false, "type": "", "demo": "messaging\/list-subscribers.md", @@ -22130,7 +22264,7 @@ "x-appwrite": { "method": "createSubscriber", "group": "subscribers", - "weight": 290, + "weight": 237, "cookies": false, "type": "", "demo": "messaging\/create-subscriber.md", @@ -22220,7 +22354,7 @@ "x-appwrite": { "method": "getSubscriber", "group": "subscribers", - "weight": 293, + "weight": 240, "cookies": false, "type": "", "demo": "messaging\/get-subscriber.md", @@ -22285,7 +22419,7 @@ "x-appwrite": { "method": "deleteSubscriber", "group": "subscribers", - "weight": 294, + "weight": 241, "cookies": false, "type": "", "demo": "messaging\/delete-subscriber.md", @@ -22358,7 +22492,7 @@ "x-appwrite": { "method": "list", "group": "sites", - "weight": 485, + "weight": 469, "cookies": false, "type": "", "demo": "sites\/list.md", @@ -22441,7 +22575,7 @@ "x-appwrite": { "method": "create", "group": "sites", - "weight": 483, + "weight": 467, "cookies": false, "type": "", "demo": "sites\/create.md", @@ -22526,7 +22660,8 @@ "type": "integer", "description": "Maximum request time in seconds.", "default": 30, - "x-example": 1 + "x-example": 1, + "format": "int32" }, "installCommand": { "type": "string", @@ -22713,7 +22848,7 @@ "x-appwrite": { "method": "listFrameworks", "group": "frameworks", - "weight": 488, + "weight": 472, "cookies": false, "type": "", "demo": "sites\/list-frameworks.md", @@ -22764,7 +22899,7 @@ "x-appwrite": { "method": "listSpecifications", "group": "frameworks", - "weight": 511, + "weight": 495, "cookies": false, "type": "", "demo": "sites\/list-specifications.md", @@ -22815,7 +22950,7 @@ "x-appwrite": { "method": "get", "group": "sites", - "weight": 484, + "weight": 468, "cookies": false, "type": "", "demo": "sites\/get.md", @@ -22876,7 +23011,7 @@ "x-appwrite": { "method": "update", "group": "sites", - "weight": 486, + "weight": 470, "cookies": false, "type": "", "demo": "sites\/update.md", @@ -22963,7 +23098,8 @@ "type": "integer", "description": "Maximum request time in seconds.", "default": 30, - "x-example": 1 + "x-example": 1, + "format": "int32" }, "installCommand": { "type": "string", @@ -23143,7 +23279,7 @@ "x-appwrite": { "method": "delete", "group": "sites", - "weight": 487, + "weight": 471, "cookies": false, "type": "", "demo": "sites\/delete.md", @@ -23206,7 +23342,7 @@ "x-appwrite": { "method": "updateSiteDeployment", "group": "sites", - "weight": 494, + "weight": 478, "cookies": false, "type": "", "demo": "sites\/update-site-deployment.md", @@ -23285,7 +23421,7 @@ "x-appwrite": { "method": "listDeployments", "group": "deployments", - "weight": 493, + "weight": 477, "cookies": false, "type": "", "demo": "sites\/list-deployments.md", @@ -23376,7 +23512,7 @@ "x-appwrite": { "method": "createDeployment", "group": "deployments", - "weight": 489, + "weight": 473, "cookies": false, "type": "upload", "demo": "sites\/create-deployment.md", @@ -23478,7 +23614,7 @@ "x-appwrite": { "method": "createDuplicateDeployment", "group": "deployments", - "weight": 497, + "weight": 481, "cookies": false, "type": "", "demo": "sites\/create-duplicate-deployment.md", @@ -23559,7 +23695,7 @@ "x-appwrite": { "method": "createTemplateDeployment", "group": "deployments", - "weight": 490, + "weight": 474, "cookies": false, "type": "", "demo": "sites\/create-template-deployment.md", @@ -23681,7 +23817,7 @@ "x-appwrite": { "method": "createVcsDeployment", "group": "deployments", - "weight": 491, + "weight": 475, "cookies": false, "type": "", "demo": "sites\/create-vcs-deployment.md", @@ -23780,7 +23916,7 @@ "x-appwrite": { "method": "getDeployment", "group": "deployments", - "weight": 492, + "weight": 476, "cookies": false, "type": "", "demo": "sites\/get-deployment.md", @@ -23844,7 +23980,7 @@ "x-appwrite": { "method": "deleteDeployment", "group": "deployments", - "weight": 495, + "weight": 479, "cookies": false, "type": "", "demo": "sites\/delete-deployment.md", @@ -23913,7 +24049,7 @@ "x-appwrite": { "method": "getDeploymentDownload", "group": "deployments", - "weight": 496, + "weight": 480, "cookies": false, "type": "location", "demo": "sites\/get-deployment-download.md", @@ -24000,7 +24136,7 @@ "x-appwrite": { "method": "updateDeploymentStatus", "group": "deployments", - "weight": 498, + "weight": 482, "cookies": false, "type": "", "demo": "sites\/update-deployment-status.md", @@ -24069,7 +24205,7 @@ "x-appwrite": { "method": "listLogs", "group": "logs", - "weight": 500, + "weight": 484, "cookies": false, "type": "", "demo": "sites\/list-logs.md", @@ -24151,7 +24287,7 @@ "x-appwrite": { "method": "getLog", "group": "logs", - "weight": 499, + "weight": 483, "cookies": false, "type": "", "demo": "sites\/get-log.md", @@ -24217,7 +24353,7 @@ "x-appwrite": { "method": "deleteLog", "group": "logs", - "weight": 501, + "weight": 485, "cookies": false, "type": "", "demo": "sites\/delete-log.md", @@ -24286,7 +24422,7 @@ "x-appwrite": { "method": "listVariables", "group": "variables", - "weight": 504, + "weight": 488, "cookies": false, "type": "", "demo": "sites\/list-variables.md", @@ -24347,7 +24483,7 @@ "x-appwrite": { "method": "createVariable", "group": "variables", - "weight": 502, + "weight": 486, "cookies": false, "type": "", "demo": "sites\/create-variable.md", @@ -24439,7 +24575,7 @@ "x-appwrite": { "method": "getVariable", "group": "variables", - "weight": 503, + "weight": 487, "cookies": false, "type": "", "demo": "sites\/get-variable.md", @@ -24508,7 +24644,7 @@ "x-appwrite": { "method": "updateVariable", "group": "variables", - "weight": 505, + "weight": 489, "cookies": false, "type": "", "demo": "sites\/update-variable.md", @@ -24604,7 +24740,7 @@ "x-appwrite": { "method": "deleteVariable", "group": "variables", - "weight": 506, + "weight": 490, "cookies": false, "type": "", "demo": "sites\/delete-variable.md", @@ -24673,7 +24809,7 @@ "x-appwrite": { "method": "listBuckets", "group": "buckets", - "weight": 146, + "weight": 522, "cookies": false, "type": "", "demo": "storage\/list-buckets.md", @@ -24757,7 +24893,7 @@ "x-appwrite": { "method": "createBucket", "group": "buckets", - "weight": 145, + "weight": 520, "cookies": false, "type": "", "demo": "storage\/create-bucket.md", @@ -24828,7 +24964,8 @@ "type": "integer", "description": "Maximum file size allowed in bytes. Maximum allowed value is 30MB.", "default": {}, - "x-example": 1 + "x-example": 1, + "format": "int32" }, "allowedFileExtensions": { "type": "array", @@ -24841,7 +24978,7 @@ }, "compression": { "type": "string", - "description": "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", + "description": "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", "default": "none", "x-example": "none", "enum": [ @@ -24904,7 +25041,7 @@ "x-appwrite": { "method": "getBucket", "group": "buckets", - "weight": 147, + "weight": 521, "cookies": false, "type": "", "demo": "storage\/get-bucket.md", @@ -24966,7 +25103,7 @@ "x-appwrite": { "method": "updateBucket", "group": "buckets", - "weight": 148, + "weight": 523, "cookies": false, "type": "", "demo": "storage\/update-bucket.md", @@ -25039,7 +25176,8 @@ "type": "integer", "description": "Maximum file size allowed in bytes. Maximum allowed value is 30MB.", "default": {}, - "x-example": 1 + "x-example": 1, + "format": "int32" }, "allowedFileExtensions": { "type": "array", @@ -25052,7 +25190,7 @@ }, "compression": { "type": "string", - "description": "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", + "description": "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", "default": "none", "x-example": "none", "enum": [ @@ -25109,7 +25247,7 @@ "x-appwrite": { "method": "deleteBucket", "group": "buckets", - "weight": 149, + "weight": 524, "cookies": false, "type": "", "demo": "storage\/delete-bucket.md", @@ -25171,7 +25309,7 @@ "x-appwrite": { "method": "listFiles", "group": "files", - "weight": 151, + "weight": 527, "cookies": false, "type": "", "demo": "storage\/list-files.md", @@ -25266,7 +25404,7 @@ "x-appwrite": { "method": "createFile", "group": "files", - "weight": 150, + "weight": 525, "cookies": false, "type": "upload", "demo": "storage\/create-file.md", @@ -25359,7 +25497,7 @@ "x-appwrite": { "method": "getFile", "group": "files", - "weight": 152, + "weight": 526, "cookies": false, "type": "", "demo": "storage\/get-file.md", @@ -25432,13 +25570,13 @@ "x-appwrite": { "method": "updateFile", "group": "files", - "weight": 157, + "weight": 528, "cookies": false, "type": "", "demo": "storage\/update-file.md", - "rate-limit": 60, - "rate-time": 60, - "rate-key": "ip:{ip},method:{method},url:{url},userId:{userId}", + "rate-limit": 0, + "rate-time": 3600, + "rate-key": "url:{url},ip:{ip}", "scope": "files.write", "platforms": [ "console", @@ -25464,7 +25602,7 @@ "parameters": [ { "name": "bucketId", - "description": "Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https:\/\/appwrite.io\/docs\/server\/storage#createBucket).", + "description": "Bucket unique ID.", "required": true, "type": "string", "x-example": "", @@ -25472,7 +25610,7 @@ }, { "name": "fileId", - "description": "File unique ID.", + "description": "File ID.", "required": true, "type": "string", "x-example": "", @@ -25486,14 +25624,13 @@ "properties": { "name": { "type": "string", - "description": "Name of the file", + "description": "File name.", "default": null, - "x-example": "", - "x-nullable": true + "x-example": "" }, "permissions": { "type": "array", - "description": "An array of permission string. By default, the current permissions are inherited. [Learn more about permissions](https:\/\/appwrite.io\/docs\/permissions).", + "description": "An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https:\/\/appwrite.io\/docs\/permissions).", "default": null, "x-example": "[\"read(\"any\")\"]", "x-nullable": true, @@ -25526,7 +25663,7 @@ "x-appwrite": { "method": "deleteFile", "group": "files", - "weight": 158, + "weight": 529, "cookies": false, "type": "", "demo": "storage\/delete-file.md", @@ -25599,7 +25736,7 @@ "x-appwrite": { "method": "getFileDownload", "group": "files", - "weight": 154, + "weight": 531, "cookies": false, "type": "location", "demo": "storage\/get-file-download.md", @@ -25681,7 +25818,7 @@ "x-appwrite": { "method": "getFilePreview", "group": "files", - "weight": 153, + "weight": 530, "cookies": false, "type": "location", "demo": "storage\/get-file-preview.md", @@ -25891,7 +26028,7 @@ "x-appwrite": { "method": "getFileView", "group": "files", - "weight": 155, + "weight": 532, "cookies": false, "type": "location", "demo": "storage\/get-file-view.md", @@ -25973,7 +26110,7 @@ "x-appwrite": { "method": "list", "group": "tablesdb", - "weight": 386, + "weight": 344, "cookies": false, "type": "", "demo": "tablesdb\/list.md", @@ -26057,7 +26194,7 @@ "x-appwrite": { "method": "create", "group": "tablesdb", - "weight": 382, + "weight": 340, "cookies": false, "type": "", "demo": "tablesdb\/create.md", @@ -26142,7 +26279,7 @@ "x-appwrite": { "method": "listTransactions", "group": "transactions", - "weight": 445, + "weight": 403, "cookies": false, "type": "", "demo": "tablesdb\/list-transactions.md", @@ -26214,7 +26351,7 @@ "x-appwrite": { "method": "createTransaction", "group": "transactions", - "weight": 441, + "weight": 399, "cookies": false, "type": "", "demo": "tablesdb\/create-transaction.md", @@ -26257,7 +26394,8 @@ "type": "integer", "description": "Seconds before the transaction expires.", "default": 300, - "x-example": 60 + "x-example": 60, + "format": "int32" } } } @@ -26289,7 +26427,7 @@ "x-appwrite": { "method": "getTransaction", "group": "transactions", - "weight": 442, + "weight": 400, "cookies": false, "type": "", "demo": "tablesdb\/get-transaction.md", @@ -26357,7 +26495,7 @@ "x-appwrite": { "method": "updateTransaction", "group": "transactions", - "weight": 443, + "weight": 401, "cookies": false, "type": "", "demo": "tablesdb\/update-transaction.md", @@ -26441,7 +26579,7 @@ "x-appwrite": { "method": "deleteTransaction", "group": "transactions", - "weight": 444, + "weight": 402, "cookies": false, "type": "", "demo": "tablesdb\/delete-transaction.md", @@ -26511,7 +26649,7 @@ "x-appwrite": { "method": "createOperations", "group": "transactions", - "weight": 446, + "weight": 404, "cookies": false, "type": "", "demo": "tablesdb\/create-operations.md", @@ -26597,7 +26735,7 @@ "x-appwrite": { "method": "get", "group": "tablesdb", - "weight": 383, + "weight": 341, "cookies": false, "type": "", "demo": "tablesdb\/get.md", @@ -26659,7 +26797,7 @@ "x-appwrite": { "method": "update", "group": "tablesdb", - "weight": 384, + "weight": 342, "cookies": false, "type": "", "demo": "tablesdb\/update.md", @@ -26712,10 +26850,7 @@ "default": true, "x-example": false } - }, - "required": [ - "name" - ] + } } } ] @@ -26740,7 +26875,7 @@ "x-appwrite": { "method": "delete", "group": "tablesdb", - "weight": 385, + "weight": 343, "cookies": false, "type": "", "demo": "tablesdb\/delete.md", @@ -26802,7 +26937,7 @@ "x-appwrite": { "method": "listTables", "group": "tables", - "weight": 393, + "weight": 351, "cookies": false, "type": "", "demo": "tablesdb\/list-tables.md", @@ -26897,7 +27032,7 @@ "x-appwrite": { "method": "createTable", "group": "tables", - "weight": 389, + "weight": 347, "cookies": false, "type": "", "demo": "tablesdb\/create-table.md", @@ -27027,7 +27162,7 @@ "x-appwrite": { "method": "getTable", "group": "tables", - "weight": 390, + "weight": 348, "cookies": false, "type": "", "demo": "tablesdb\/get-table.md", @@ -27100,7 +27235,7 @@ "x-appwrite": { "method": "updateTable", "group": "tables", - "weight": 391, + "weight": 349, "cookies": false, "type": "", "demo": "tablesdb\/update-table.md", @@ -27180,10 +27315,7 @@ "default": true, "x-example": false } - }, - "required": [ - "name" - ] + } } } ] @@ -27208,7 +27340,7 @@ "x-appwrite": { "method": "deleteTable", "group": "tables", - "weight": 392, + "weight": 350, "cookies": false, "type": "", "demo": "tablesdb\/delete-table.md", @@ -27281,7 +27413,7 @@ "x-appwrite": { "method": "listColumns", "group": "columns", - "weight": 398, + "weight": 356, "cookies": false, "type": "", "demo": "tablesdb\/list-columns.md", @@ -27377,7 +27509,7 @@ "x-appwrite": { "method": "createBooleanColumn", "group": "columns", - "weight": 399, + "weight": 357, "cookies": false, "type": "", "demo": "tablesdb\/create-boolean-column.md", @@ -27490,7 +27622,7 @@ "x-appwrite": { "method": "updateBooleanColumn", "group": "columns", - "weight": 400, + "weight": 358, "cookies": false, "type": "", "demo": "tablesdb\/update-boolean-column.md", @@ -27605,7 +27737,7 @@ "x-appwrite": { "method": "createDatetimeColumn", "group": "columns", - "weight": 401, + "weight": 359, "cookies": false, "type": "", "demo": "tablesdb\/create-datetime-column.md", @@ -27718,7 +27850,7 @@ "x-appwrite": { "method": "updateDatetimeColumn", "group": "columns", - "weight": 402, + "weight": 360, "cookies": false, "type": "", "demo": "tablesdb\/update-datetime-column.md", @@ -27833,7 +27965,7 @@ "x-appwrite": { "method": "createEmailColumn", "group": "columns", - "weight": 403, + "weight": 361, "cookies": false, "type": "", "demo": "tablesdb\/create-email-column.md", @@ -27902,6 +28034,7 @@ "description": "Default value for column when not provided. Cannot be set when column is required.", "default": null, "x-example": "email@example.com", + "format": "email", "x-nullable": true }, "array": { @@ -27946,7 +28079,7 @@ "x-appwrite": { "method": "updateEmailColumn", "group": "columns", - "weight": 404, + "weight": 362, "cookies": false, "type": "", "demo": "tablesdb\/update-email-column.md", @@ -28016,6 +28149,7 @@ "description": "Default value for column when not provided. Cannot be set when column is required.", "default": null, "x-example": "email@example.com", + "format": "email", "x-nullable": true }, "newKey": { @@ -28061,7 +28195,7 @@ "x-appwrite": { "method": "createEnumColumn", "group": "columns", - "weight": 405, + "weight": 363, "cookies": false, "type": "", "demo": "tablesdb\/create-enum-column.md", @@ -28184,7 +28318,7 @@ "x-appwrite": { "method": "updateEnumColumn", "group": "columns", - "weight": 406, + "weight": 364, "cookies": false, "type": "", "demo": "tablesdb\/update-enum-column.md", @@ -28309,7 +28443,7 @@ "x-appwrite": { "method": "createFloatColumn", "group": "columns", - "weight": 407, + "weight": 365, "cookies": false, "type": "", "demo": "tablesdb\/create-float-column.md", @@ -28378,6 +28512,7 @@ "description": "Minimum value", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "max": { @@ -28385,6 +28520,7 @@ "description": "Maximum value", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "default": { @@ -28392,6 +28528,7 @@ "description": "Default value. Cannot be set when required.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "array": { @@ -28436,7 +28573,7 @@ "x-appwrite": { "method": "updateFloatColumn", "group": "columns", - "weight": 408, + "weight": 366, "cookies": false, "type": "", "demo": "tablesdb\/update-float-column.md", @@ -28506,6 +28643,7 @@ "description": "Minimum value", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "max": { @@ -28513,6 +28651,7 @@ "description": "Maximum value", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "default": { @@ -28520,6 +28659,7 @@ "description": "Default value. Cannot be set when required.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "newKey": { @@ -28565,7 +28705,7 @@ "x-appwrite": { "method": "createIntegerColumn", "group": "columns", - "weight": 409, + "weight": 367, "cookies": false, "type": "", "demo": "tablesdb\/create-integer-column.md", @@ -28634,6 +28774,7 @@ "description": "Minimum value", "default": null, "x-example": null, + "format": "int64", "x-nullable": true }, "max": { @@ -28641,6 +28782,7 @@ "description": "Maximum value", "default": null, "x-example": null, + "format": "int64", "x-nullable": true }, "default": { @@ -28648,6 +28790,7 @@ "description": "Default value. Cannot be set when column is required.", "default": null, "x-example": null, + "format": "int64", "x-nullable": true }, "array": { @@ -28692,7 +28835,7 @@ "x-appwrite": { "method": "updateIntegerColumn", "group": "columns", - "weight": 410, + "weight": 368, "cookies": false, "type": "", "demo": "tablesdb\/update-integer-column.md", @@ -28762,6 +28905,7 @@ "description": "Minimum value", "default": null, "x-example": null, + "format": "int64", "x-nullable": true }, "max": { @@ -28769,6 +28913,7 @@ "description": "Maximum value", "default": null, "x-example": null, + "format": "int64", "x-nullable": true }, "default": { @@ -28776,6 +28921,7 @@ "description": "Default value. Cannot be set when column is required.", "default": null, "x-example": null, + "format": "int64", "x-nullable": true }, "newKey": { @@ -28821,7 +28967,7 @@ "x-appwrite": { "method": "createIpColumn", "group": "columns", - "weight": 411, + "weight": 369, "cookies": false, "type": "", "demo": "tablesdb\/create-ip-column.md", @@ -28934,7 +29080,7 @@ "x-appwrite": { "method": "updateIpColumn", "group": "columns", - "weight": 412, + "weight": 370, "cookies": false, "type": "", "demo": "tablesdb\/update-ip-column.md", @@ -29049,7 +29195,7 @@ "x-appwrite": { "method": "createLineColumn", "group": "columns", - "weight": 413, + "weight": 371, "cookies": false, "type": "", "demo": "tablesdb\/create-line-column.md", @@ -29156,7 +29302,7 @@ "x-appwrite": { "method": "updateLineColumn", "group": "columns", - "weight": 414, + "weight": 372, "cookies": false, "type": "", "demo": "tablesdb\/update-line-column.md", @@ -29270,7 +29416,7 @@ "x-appwrite": { "method": "createPointColumn", "group": "columns", - "weight": 415, + "weight": 373, "cookies": false, "type": "", "demo": "tablesdb\/create-point-column.md", @@ -29377,7 +29523,7 @@ "x-appwrite": { "method": "updatePointColumn", "group": "columns", - "weight": 416, + "weight": 374, "cookies": false, "type": "", "demo": "tablesdb\/update-point-column.md", @@ -29491,7 +29637,7 @@ "x-appwrite": { "method": "createPolygonColumn", "group": "columns", - "weight": 417, + "weight": 375, "cookies": false, "type": "", "demo": "tablesdb\/create-polygon-column.md", @@ -29598,7 +29744,7 @@ "x-appwrite": { "method": "updatePolygonColumn", "group": "columns", - "weight": 418, + "weight": 376, "cookies": false, "type": "", "demo": "tablesdb\/update-polygon-column.md", @@ -29712,7 +29858,7 @@ "x-appwrite": { "method": "createRelationshipColumn", "group": "columns", - "weight": 419, + "weight": 377, "cookies": false, "type": "", "demo": "tablesdb\/create-relationship-column.md", @@ -29853,7 +29999,7 @@ "x-appwrite": { "method": "createStringColumn", "group": "columns", - "weight": 421, + "weight": 379, "cookies": false, "type": "", "demo": "tablesdb\/create-string-column.md", @@ -29915,7 +30061,8 @@ "type": "integer", "description": "Column size for text columns, in number of characters.", "default": null, - "x-example": 1 + "x-example": 1, + "format": "int32" }, "required": { "type": "boolean", @@ -29979,7 +30126,7 @@ "x-appwrite": { "method": "updateStringColumn", "group": "columns", - "weight": 422, + "weight": 380, "cookies": false, "type": "", "demo": "tablesdb\/update-string-column.md", @@ -30056,6 +30203,7 @@ "description": "Maximum size of the string column.", "default": null, "x-example": 1, + "format": "int32", "x-nullable": true }, "newKey": { @@ -30101,7 +30249,7 @@ "x-appwrite": { "method": "createUrlColumn", "group": "columns", - "weight": 423, + "weight": 381, "cookies": false, "type": "", "demo": "tablesdb\/create-url-column.md", @@ -30170,6 +30318,7 @@ "description": "Default value for column when not provided. Cannot be set when column is required.", "default": null, "x-example": "https:\/\/example.com", + "format": "url", "x-nullable": true }, "array": { @@ -30214,7 +30363,7 @@ "x-appwrite": { "method": "updateUrlColumn", "group": "columns", - "weight": 424, + "weight": 382, "cookies": false, "type": "", "demo": "tablesdb\/update-url-column.md", @@ -30284,6 +30433,7 @@ "description": "Default value for column when not provided. Cannot be set when column is required.", "default": null, "x-example": "https:\/\/example.com", + "format": "url", "x-nullable": true }, "newKey": { @@ -30358,7 +30508,7 @@ "x-appwrite": { "method": "getColumn", "group": "columns", - "weight": 396, + "weight": 354, "cookies": false, "type": "", "demo": "tablesdb\/get-column.md", @@ -30433,7 +30583,7 @@ "x-appwrite": { "method": "deleteColumn", "group": "columns", - "weight": 397, + "weight": 355, "cookies": false, "type": "", "demo": "tablesdb\/delete-column.md", @@ -30515,7 +30665,7 @@ "x-appwrite": { "method": "updateRelationshipColumn", "group": "columns", - "weight": 420, + "weight": 378, "cookies": false, "type": "", "demo": "tablesdb\/update-relationship-column.md", @@ -30625,7 +30775,7 @@ "x-appwrite": { "method": "listIndexes", "group": "indexes", - "weight": 428, + "weight": 386, "cookies": false, "type": "", "demo": "tablesdb\/list-indexes.md", @@ -30719,7 +30869,7 @@ "x-appwrite": { "method": "createIndex", "group": "indexes", - "weight": 425, + "weight": 383, "cookies": false, "type": "", "demo": "tablesdb\/create-index.md", @@ -30859,7 +31009,7 @@ "x-appwrite": { "method": "getIndex", "group": "indexes", - "weight": 426, + "weight": 384, "cookies": false, "type": "", "demo": "tablesdb\/get-index.md", @@ -30934,7 +31084,7 @@ "x-appwrite": { "method": "deleteIndex", "group": "indexes", - "weight": 427, + "weight": 385, "cookies": false, "type": "", "demo": "tablesdb\/delete-index.md", @@ -31014,7 +31164,7 @@ "x-appwrite": { "method": "listRows", "group": "rows", - "weight": 437, + "weight": 395, "cookies": false, "type": "", "demo": "tablesdb\/list-rows.md", @@ -31119,7 +31269,7 @@ "x-appwrite": { "method": "createRow", "group": "rows", - "weight": 429, + "weight": 387, "cookies": false, "type": "", "demo": "tablesdb\/create-row.md", @@ -31305,7 +31455,7 @@ "x-appwrite": { "method": "upsertRows", "group": "rows", - "weight": 434, + "weight": 392, "cookies": false, "type": "", "demo": "tablesdb\/upsert-rows.md", @@ -31437,7 +31587,7 @@ "x-appwrite": { "method": "updateRows", "group": "rows", - "weight": 432, + "weight": 390, "cookies": false, "type": "", "demo": "tablesdb\/update-rows.md", @@ -31541,7 +31691,7 @@ "x-appwrite": { "method": "deleteRows", "group": "rows", - "weight": 436, + "weight": 394, "cookies": false, "type": "", "demo": "tablesdb\/delete-rows.md", @@ -31639,7 +31789,7 @@ "x-appwrite": { "method": "getRow", "group": "rows", - "weight": 430, + "weight": 388, "cookies": false, "type": "", "demo": "tablesdb\/get-row.md", @@ -31743,7 +31893,7 @@ "x-appwrite": { "method": "upsertRow", "group": "rows", - "weight": 433, + "weight": 391, "cookies": false, "type": "", "demo": "tablesdb\/upsert-row.md", @@ -31892,7 +32042,7 @@ "x-appwrite": { "method": "updateRow", "group": "rows", - "weight": 431, + "weight": 389, "cookies": false, "type": "", "demo": "tablesdb\/update-row.md", @@ -32003,7 +32153,7 @@ "x-appwrite": { "method": "deleteRow", "group": "rows", - "weight": 435, + "weight": 393, "cookies": false, "type": "", "demo": "tablesdb\/delete-row.md", @@ -32105,7 +32255,7 @@ "x-appwrite": { "method": "decrementRowColumn", "group": "rows", - "weight": 440, + "weight": 398, "cookies": false, "type": "", "demo": "tablesdb\/decrement-row-column.md", @@ -32179,13 +32329,15 @@ "type": "number", "description": "Value to increment the column by. The value must be a number.", "default": 1, - "x-example": null + "x-example": null, + "format": "float" }, "min": { "type": "number", "description": "Minimum value for the column. If the current value is lesser than this value, an exception will be thrown.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "transactionId": { @@ -32227,7 +32379,7 @@ "x-appwrite": { "method": "incrementRowColumn", "group": "rows", - "weight": 439, + "weight": 397, "cookies": false, "type": "", "demo": "tablesdb\/increment-row-column.md", @@ -32301,13 +32453,15 @@ "type": "number", "description": "Value to increment the column by. The value must be a number.", "default": 1, - "x-example": null + "x-example": null, + "format": "float" }, "max": { "type": "number", "description": "Maximum value for the column. If the current value is greater than this value, an error will be thrown.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "transactionId": { @@ -32347,7 +32501,7 @@ "x-appwrite": { "method": "list", "group": "teams", - "weight": 162, + "weight": 110, "cookies": false, "type": "", "demo": "teams\/list.md", @@ -32434,7 +32588,7 @@ "x-appwrite": { "method": "create", "group": "teams", - "weight": 161, + "weight": 109, "cookies": false, "type": "", "demo": "teams\/create.md", @@ -32527,7 +32681,7 @@ "x-appwrite": { "method": "get", "group": "teams", - "weight": 163, + "weight": 111, "cookies": false, "type": "", "demo": "teams\/get.md", @@ -32592,7 +32746,7 @@ "x-appwrite": { "method": "updateName", "group": "teams", - "weight": 165, + "weight": 113, "cookies": false, "type": "", "demo": "teams\/update-name.md", @@ -32670,7 +32824,7 @@ "x-appwrite": { "method": "delete", "group": "teams", - "weight": 167, + "weight": 115, "cookies": false, "type": "", "demo": "teams\/delete.md", @@ -32735,7 +32889,7 @@ "x-appwrite": { "method": "listMemberships", "group": "memberships", - "weight": 169, + "weight": 117, "cookies": false, "type": "", "demo": "teams\/list-memberships.md", @@ -32830,7 +32984,7 @@ "x-appwrite": { "method": "createMembership", "group": "memberships", - "weight": 168, + "weight": 116, "cookies": false, "type": "", "demo": "teams\/create-membership.md", @@ -32878,7 +33032,8 @@ "type": "string", "description": "Email of the new team member.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "userId": { "type": "string", @@ -32890,7 +33045,8 @@ "type": "string", "description": "Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", "default": "", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "roles": { "type": "array", @@ -32912,7 +33068,8 @@ "type": "string", "description": "URL to redirect the user back to your app from the invitation email. This parameter is not required when an API key is supplied. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.", "default": "", - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" }, "name": { "type": "string", @@ -32953,7 +33110,7 @@ "x-appwrite": { "method": "getMembership", "group": "memberships", - "weight": 170, + "weight": 118, "cookies": false, "type": "", "demo": "teams\/get-membership.md", @@ -33026,7 +33183,7 @@ "x-appwrite": { "method": "updateMembership", "group": "memberships", - "weight": 171, + "weight": 119, "cookies": false, "type": "", "demo": "teams\/update-membership.md", @@ -33122,7 +33279,7 @@ "x-appwrite": { "method": "deleteMembership", "group": "memberships", - "weight": 173, + "weight": 121, "cookies": false, "type": "", "demo": "teams\/delete-membership.md", @@ -33197,7 +33354,7 @@ "x-appwrite": { "method": "updateMembershipStatus", "group": "memberships", - "weight": 172, + "weight": 120, "cookies": false, "type": "", "demo": "teams\/update-membership-status.md", @@ -33294,7 +33451,7 @@ "x-appwrite": { "method": "getPrefs", "group": "teams", - "weight": 164, + "weight": 112, "cookies": false, "type": "", "demo": "teams\/get-prefs.md", @@ -33358,7 +33515,7 @@ "x-appwrite": { "method": "updatePrefs", "group": "teams", - "weight": 166, + "weight": 114, "cookies": false, "type": "", "demo": "teams\/update-prefs.md", @@ -33440,7 +33597,7 @@ "x-appwrite": { "method": "list", "group": "files", - "weight": 523, + "weight": 517, "cookies": false, "type": "", "demo": "tokens\/list.md", @@ -33530,7 +33687,7 @@ "x-appwrite": { "method": "createFileToken", "group": "files", - "weight": 521, + "weight": 515, "cookies": false, "type": "", "demo": "tokens\/create-file-token.md", @@ -33615,7 +33772,7 @@ "x-appwrite": { "method": "get", "group": "tokens", - "weight": 522, + "weight": 516, "cookies": false, "type": "", "demo": "tokens\/get.md", @@ -33676,7 +33833,7 @@ "x-appwrite": { "method": "update", "group": "tokens", - "weight": 524, + "weight": 518, "cookies": false, "type": "", "demo": "tokens\/update.md", @@ -33748,7 +33905,7 @@ "x-appwrite": { "method": "delete", "group": "tokens", - "weight": 525, + "weight": 519, "cookies": false, "type": "", "demo": "tokens\/delete.md", @@ -33809,7 +33966,7 @@ "x-appwrite": { "method": "list", "group": "users", - "weight": 184, + "weight": 132, "cookies": false, "type": "", "demo": "users\/list.md", @@ -33893,7 +34050,7 @@ "x-appwrite": { "method": "create", "group": "users", - "weight": 175, + "weight": 123, "cookies": false, "type": "", "demo": "users\/create.md", @@ -33937,6 +34094,7 @@ "description": "User email.", "default": null, "x-example": "email@example.com", + "format": "email", "x-nullable": true }, "phone": { @@ -33944,6 +34102,7 @@ "description": "Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", "default": null, "x-example": "+12065550100", + "format": "phone", "x-nullable": true }, "password": { @@ -33993,7 +34152,7 @@ "x-appwrite": { "method": "createArgon2User", "group": "users", - "weight": 178, + "weight": 126, "cookies": false, "type": "", "demo": "users\/create-argon-2-user.md", @@ -34036,13 +34195,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using Argon2.", "default": null, - "x-example": "password" + "x-example": "password", + "format": "password" }, "name": { "type": "string", @@ -34087,7 +34248,7 @@ "x-appwrite": { "method": "createBcryptUser", "group": "users", - "weight": 176, + "weight": 124, "cookies": false, "type": "", "demo": "users\/create-bcrypt-user.md", @@ -34130,13 +34291,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using Bcrypt.", "default": null, - "x-example": "password" + "x-example": "password", + "format": "password" }, "name": { "type": "string", @@ -34179,7 +34342,7 @@ "x-appwrite": { "method": "listIdentities", "group": "identities", - "weight": 192, + "weight": 140, "cookies": false, "type": "", "demo": "users\/list-identities.md", @@ -34260,7 +34423,7 @@ "x-appwrite": { "method": "deleteIdentity", "group": "identities", - "weight": 215, + "weight": 163, "cookies": false, "type": "", "demo": "users\/delete-identity.md", @@ -34324,7 +34487,7 @@ "x-appwrite": { "method": "createMD5User", "group": "users", - "weight": 177, + "weight": 125, "cookies": false, "type": "", "demo": "users\/create-md-5-user.md", @@ -34367,13 +34530,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using MD5.", "default": null, - "x-example": "password" + "x-example": "password", + "format": "password" }, "name": { "type": "string", @@ -34418,7 +34583,7 @@ "x-appwrite": { "method": "createPHPassUser", "group": "users", - "weight": 180, + "weight": 128, "cookies": false, "type": "", "demo": "users\/create-ph-pass-user.md", @@ -34461,13 +34626,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using PHPass.", "default": null, - "x-example": "password" + "x-example": "password", + "format": "password" }, "name": { "type": "string", @@ -34512,7 +34679,7 @@ "x-appwrite": { "method": "createScryptUser", "group": "users", - "weight": 181, + "weight": 129, "cookies": false, "type": "", "demo": "users\/create-scrypt-user.md", @@ -34555,13 +34722,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using Scrypt.", "default": null, - "x-example": "password" + "x-example": "password", + "format": "password" }, "passwordSalt": { "type": "string", @@ -34573,25 +34742,29 @@ "type": "integer", "description": "Optional CPU cost used to hash password.", "default": null, - "x-example": null + "x-example": null, + "format": "int32" }, "passwordMemory": { "type": "integer", "description": "Optional memory cost used to hash password.", "default": null, - "x-example": null + "x-example": null, + "format": "int32" }, "passwordParallel": { "type": "integer", "description": "Optional parallelization cost used to hash password.", "default": null, - "x-example": null + "x-example": null, + "format": "int32" }, "passwordLength": { "type": "integer", "description": "Optional hash length used to hash password.", "default": null, - "x-example": null + "x-example": null, + "format": "int32" }, "name": { "type": "string", @@ -34641,7 +34814,7 @@ "x-appwrite": { "method": "createScryptModifiedUser", "group": "users", - "weight": 182, + "weight": 130, "cookies": false, "type": "", "demo": "users\/create-scrypt-modified-user.md", @@ -34684,13 +34857,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using Scrypt Modified.", "default": null, - "x-example": "password" + "x-example": "password", + "format": "password" }, "passwordSalt": { "type": "string", @@ -34756,7 +34931,7 @@ "x-appwrite": { "method": "createSHAUser", "group": "users", - "weight": 179, + "weight": 127, "cookies": false, "type": "", "demo": "users\/create-sha-user.md", @@ -34799,13 +34974,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using SHA.", "default": null, - "x-example": "password" + "x-example": "password", + "format": "password" }, "passwordVersion": { "type": "string", @@ -34869,7 +35046,7 @@ "x-appwrite": { "method": "get", "group": "users", - "weight": 185, + "weight": 133, "cookies": false, "type": "", "demo": "users\/get.md", @@ -34926,7 +35103,7 @@ "x-appwrite": { "method": "delete", "group": "users", - "weight": 213, + "weight": 161, "cookies": false, "type": "", "demo": "users\/delete.md", @@ -34990,7 +35167,7 @@ "x-appwrite": { "method": "updateEmail", "group": "users", - "weight": 198, + "weight": 146, "cookies": false, "type": "", "demo": "users\/update-email.md", @@ -35035,7 +35212,8 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" } }, "required": [ @@ -35072,7 +35250,7 @@ "x-appwrite": { "method": "createJWT", "group": "sessions", - "weight": 216, + "weight": 164, "cookies": false, "type": "", "demo": "users\/create-jwt.md", @@ -35123,7 +35301,8 @@ "type": "integer", "description": "Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds.", "default": 900, - "x-example": 0 + "x-example": 0, + "format": "int32" } } } @@ -35157,7 +35336,7 @@ "x-appwrite": { "method": "updateLabels", "group": "users", - "weight": 194, + "weight": 142, "cookies": false, "type": "", "demo": "users\/update-labels.md", @@ -35240,7 +35419,7 @@ "x-appwrite": { "method": "listLogs", "group": "logs", - "weight": 190, + "weight": 138, "cookies": false, "type": "", "demo": "users\/list-logs.md", @@ -35323,7 +35502,7 @@ "x-appwrite": { "method": "listMemberships", "group": "memberships", - "weight": 189, + "weight": 137, "cookies": false, "type": "", "demo": "users\/list-memberships.md", @@ -35417,7 +35596,7 @@ "x-appwrite": { "method": "updateMfa", "group": "users", - "weight": 203, + "weight": 151, "cookies": false, "type": "", "demo": "users\/update-mfa.md", @@ -35556,7 +35735,7 @@ "x-appwrite": { "method": "deleteMfaAuthenticator", "group": "mfa", - "weight": 208, + "weight": 156, "cookies": false, "type": "", "demo": "users\/delete-mfa-authenticator.md", @@ -35691,7 +35870,7 @@ "x-appwrite": { "method": "listMfaFactors", "group": "mfa", - "weight": 204, + "weight": 152, "cookies": false, "type": "", "demo": "users\/list-mfa-factors.md", @@ -35811,7 +35990,7 @@ "x-appwrite": { "method": "getMfaRecoveryCodes", "group": "mfa", - "weight": 205, + "weight": 153, "cookies": false, "type": "", "demo": "users\/get-mfa-recovery-codes.md", @@ -35931,7 +36110,7 @@ "x-appwrite": { "method": "updateMfaRecoveryCodes", "group": "mfa", - "weight": 207, + "weight": 155, "cookies": false, "type": "", "demo": "users\/update-mfa-recovery-codes.md", @@ -36051,7 +36230,7 @@ "x-appwrite": { "method": "createMfaRecoveryCodes", "group": "mfa", - "weight": 206, + "weight": 154, "cookies": false, "type": "", "demo": "users\/create-mfa-recovery-codes.md", @@ -36173,7 +36352,7 @@ "x-appwrite": { "method": "updateName", "group": "users", - "weight": 196, + "weight": 144, "cookies": false, "type": "", "demo": "users\/update-name.md", @@ -36255,7 +36434,7 @@ "x-appwrite": { "method": "updatePassword", "group": "users", - "weight": 197, + "weight": 145, "cookies": false, "type": "", "demo": "users\/update-password.md", @@ -36337,7 +36516,7 @@ "x-appwrite": { "method": "updatePhone", "group": "users", - "weight": 199, + "weight": 147, "cookies": false, "type": "", "demo": "users\/update-phone.md", @@ -36382,7 +36561,8 @@ "type": "string", "description": "User phone number.", "default": null, - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" } }, "required": [ @@ -36417,7 +36597,7 @@ "x-appwrite": { "method": "getPrefs", "group": "users", - "weight": 186, + "weight": 134, "cookies": false, "type": "", "demo": "users\/get-prefs.md", @@ -36479,7 +36659,7 @@ "x-appwrite": { "method": "updatePrefs", "group": "users", - "weight": 201, + "weight": 149, "cookies": false, "type": "", "demo": "users\/update-prefs.md", @@ -36559,7 +36739,7 @@ "x-appwrite": { "method": "listSessions", "group": "sessions", - "weight": 188, + "weight": 136, "cookies": false, "type": "", "demo": "users\/list-sessions.md", @@ -36630,7 +36810,7 @@ "x-appwrite": { "method": "createSession", "group": "sessions", - "weight": 209, + "weight": 157, "cookies": false, "type": "", "demo": "users\/create-session.md", @@ -36687,7 +36867,7 @@ "x-appwrite": { "method": "deleteSessions", "group": "sessions", - "weight": 212, + "weight": 160, "cookies": false, "type": "", "demo": "users\/delete-sessions.md", @@ -36746,7 +36926,7 @@ "x-appwrite": { "method": "deleteSession", "group": "sessions", - "weight": 211, + "weight": 159, "cookies": false, "type": "", "demo": "users\/delete-session.md", @@ -36818,7 +36998,7 @@ "x-appwrite": { "method": "updateStatus", "group": "users", - "weight": 193, + "weight": 141, "cookies": false, "type": "", "demo": "users\/update-status.md", @@ -36898,7 +37078,7 @@ "x-appwrite": { "method": "listTargets", "group": "targets", - "weight": 191, + "weight": 139, "cookies": false, "type": "", "demo": "users\/list-targets.md", @@ -36981,7 +37161,7 @@ "x-appwrite": { "method": "createTarget", "group": "targets", - "weight": 183, + "weight": 131, "cookies": false, "type": "", "demo": "users\/create-target.md", @@ -37094,7 +37274,7 @@ "x-appwrite": { "method": "getTarget", "group": "targets", - "weight": 187, + "weight": 135, "cookies": false, "type": "", "demo": "users\/get-target.md", @@ -37164,7 +37344,7 @@ "x-appwrite": { "method": "updateTarget", "group": "targets", - "weight": 202, + "weight": 150, "cookies": false, "type": "", "demo": "users\/update-target.md", @@ -37256,7 +37436,7 @@ "x-appwrite": { "method": "deleteTarget", "group": "targets", - "weight": 214, + "weight": 162, "cookies": false, "type": "", "demo": "users\/delete-target.md", @@ -37328,7 +37508,7 @@ "x-appwrite": { "method": "createToken", "group": "sessions", - "weight": 210, + "weight": 158, "cookies": false, "type": "", "demo": "users\/create-token.md", @@ -37373,13 +37553,15 @@ "type": "integer", "description": "Token length in characters. The default length is 6 characters", "default": 6, - "x-example": 4 + "x-example": 4, + "format": "int32" }, "expire": { "type": "integer", "description": "Token expiration period in seconds. The default expiration is 15 minutes.", "default": 900, - "x-example": 60 + "x-example": 60, + "format": "int32" } } } @@ -37413,7 +37595,7 @@ "x-appwrite": { "method": "updateEmailVerification", "group": "users", - "weight": 200, + "weight": 148, "cookies": false, "type": "", "demo": "users\/update-email-verification.md", @@ -37495,7 +37677,7 @@ "x-appwrite": { "method": "updatePhoneVerification", "group": "users", - "weight": 195, + "weight": 143, "cookies": false, "type": "", "demo": "users\/update-phone-verification.md", @@ -37615,7 +37797,7 @@ }, { "name": "console", - "description": "The Console service allows you to interact with console relevant informations." + "description": "The Console service allows you to interact with console relevant information." }, { "name": "migrations", @@ -38445,6 +38627,35 @@ "variables": "" } }, + "healthStatusList": { + "description": "Status List", + "type": "object", + "properties": { + "total": { + "type": "integer", + "description": "Total number of statuses that matched your query.", + "x-example": 5, + "format": "int32" + }, + "statuses": { + "type": "array", + "description": "List of statuses.", + "items": { + "type": "object", + "$ref": "#\/definitions\/healthStatus" + }, + "x-example": "" + } + }, + "required": [ + "total", + "statuses" + ], + "example": { + "total": 5, + "statuses": "" + } + }, "localeCodeList": { "description": "Locale codes list", "type": "object", @@ -39088,14 +39299,14 @@ "type": "integer", "description": "Minimum value to enforce for new documents.", "x-example": 1, - "format": "int32", + "format": "int64", "x-nullable": true }, "max": { "type": "integer", "description": "Maximum value to enforce for new documents.", "x-example": 10, - "format": "int32", + "format": "int64", "x-nullable": true }, "default": { @@ -40538,14 +40749,14 @@ "type": "integer", "description": "Minimum value to enforce for new documents.", "x-example": 1, - "format": "int32", + "format": "int64", "x-nullable": true }, "max": { "type": "integer", "description": "Maximum value to enforce for new documents.", "x-example": 10, - "format": "int32", + "format": "int64", "x-nullable": true }, "default": { @@ -43037,6 +43248,16 @@ "description": "Total number of chunks uploaded", "x-example": 17890, "format": "int32" + }, + "encryption": { + "type": "boolean", + "description": "Whether file contents are encrypted at rest.", + "x-example": true + }, + "compression": { + "type": "string", + "description": "Compression algorithm used for the file. Will be one of none, [gzip](https:\/\/en.wikipedia.org\/wiki\/Gzip), or [zstd](https:\/\/en.wikipedia.org\/wiki\/Zstd).", + "x-example": "gzip" } }, "required": [ @@ -43050,7 +43271,9 @@ "mimeType", "sizeOriginal", "chunksTotal", - "chunksUploaded" + "chunksUploaded", + "encryption", + "compression" ], "example": { "$id": "5e5ea5c16897e", @@ -43065,7 +43288,9 @@ "mimeType": "image\/png", "sizeOriginal": 17890, "chunksTotal": 17890, - "chunksUploaded": 17890 + "chunksUploaded": 17890, + "encryption": true, + "compression": "gzip" } }, "bucket": { @@ -43131,7 +43356,7 @@ }, "compression": { "type": "string", - "description": "Compression algorithm choosen for compression. Will be one of none, [gzip](https:\/\/en.wikipedia.org\/wiki\/Gzip), or [zstd](https:\/\/en.wikipedia.org\/wiki\/Zstd).", + "description": "Compression algorithm chosen for compression. Will be one of none, [gzip](https:\/\/en.wikipedia.org\/wiki\/Gzip), or [zstd](https:\/\/en.wikipedia.org\/wiki\/Zstd).", "x-example": "gzip" }, "encryption": { @@ -43148,6 +43373,12 @@ "type": "boolean", "description": "Image transformations are enabled.", "x-example": false + }, + "totalSize": { + "type": "integer", + "description": "Total size of this bucket in bytes.", + "x-example": 128, + "format": "int32" } }, "required": [ @@ -43163,7 +43394,8 @@ "compression", "encryption", "antivirus", - "transformations" + "transformations", + "totalSize" ], "example": { "$id": "5e5ea5c16897e", @@ -43183,7 +43415,8 @@ "compression": "gzip", "encryption": false, "antivirus": false, - "transformations": false + "transformations": false, + "totalSize": 128 } }, "resourceToken": { @@ -44121,13 +44354,14 @@ }, "status": { "type": "string", - "description": "The deployment status. Possible values are \"waiting\", \"processing\", \"building\", \"ready\", and \"failed\".", + "description": "The deployment status. Possible values are \"waiting\", \"processing\", \"building\", \"ready\", \"canceled\" and \"failed\".", "x-example": "ready", "enum": [ "waiting", "processing", "building", "ready", + "canceled", "failed" ] }, @@ -45207,7 +45441,7 @@ "status": { "type": "string", "description": "Status of delivery.", - "x-example": "Message status can be one of the following: draft, processing, scheduled, sent, or failed.", + "x-example": "processing", "enum": [ "draft", "processing", @@ -45253,7 +45487,7 @@ "subject": "Welcome to Appwrite", "content": "Hi there, welcome to Appwrite family." }, - "status": "Message status can be one of the following: draft, processing, scheduled, sent, or failed." + "status": "processing" } }, "topic": { diff --git a/app/config/specs/swagger2-latest-client.json b/app/config/specs/swagger2-latest-client.json index 3abbc9cde5..347e172dfd 100644 --- a/app/config/specs/swagger2-latest-client.json +++ b/app/config/specs/swagger2-latest-client.json @@ -1,7 +1,7 @@ { "swagger": "2.0", "info": { - "version": "1.8.0", + "version": "1.8.1", "title": "Appwrite", "description": "Appwrite backend as a service cuts up to 70% of the time and costs required for building a modern application. We abstract and simplify common development tasks behind a REST APIs, to help you develop your app in a fast and secure way. For full API documentation and tutorials go to [https:\/\/appwrite.io\/docs](https:\/\/appwrite.io\/docs)", "termsOfService": "https:\/\/appwrite.io\/policy\/terms", @@ -94,7 +94,7 @@ "x-appwrite": { "method": "get", "group": "account", - "weight": 10, + "weight": 9, "cookies": false, "type": "", "demo": "account\/get.md", @@ -147,7 +147,7 @@ "x-appwrite": { "method": "create", "group": "account", - "weight": 9, + "weight": 8, "cookies": false, "type": "", "demo": "account\/create.md", @@ -191,7 +191,8 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", @@ -242,7 +243,7 @@ "x-appwrite": { "method": "updateEmail", "group": "account", - "weight": 35, + "weight": 34, "cookies": false, "type": "", "demo": "account\/update-email.md", @@ -280,13 +281,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password. Must be at least 8 chars.", "default": null, - "x-example": "password" + "x-example": "password", + "format": "password" } }, "required": [ @@ -322,7 +325,7 @@ "x-appwrite": { "method": "listIdentities", "group": "identities", - "weight": 48, + "weight": 47, "cookies": false, "type": "", "demo": "account\/list-identities.md", @@ -395,7 +398,7 @@ "x-appwrite": { "method": "deleteIdentity", "group": "identities", - "weight": 49, + "weight": 48, "cookies": false, "type": "", "demo": "account\/delete-identity.md", @@ -460,12 +463,12 @@ "x-appwrite": { "method": "createJWT", "group": "tokens", - "weight": 30, + "weight": 29, "cookies": false, "type": "", "demo": "account\/create-jwt.md", - "rate-limit": 100, - "rate-time": 3600, + "rate-limit": 120, + "rate-time": 60, "rate-key": "url:{url},userId:{userId}", "scope": "account", "platforms": [ @@ -486,6 +489,24 @@ "Session": [], "JWT": [] } + ], + "parameters": [ + { + "name": "payload", + "in": "body", + "schema": { + "type": "object", + "properties": { + "duration": { + "type": "integer", + "description": "Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds.", + "default": 900, + "x-example": 0, + "format": "int32" + } + } + } + } ] } }, @@ -513,7 +534,7 @@ "x-appwrite": { "method": "listLogs", "group": "logs", - "weight": 32, + "weight": 31, "cookies": false, "type": "", "demo": "account\/list-logs.md", @@ -591,7 +612,7 @@ "x-appwrite": { "method": "updateMFA", "group": "mfa", - "weight": 306, + "weight": 253, "cookies": false, "type": "", "demo": "account\/update-mfa.md", @@ -666,7 +687,7 @@ "x-appwrite": { "method": "createMfaAuthenticator", "group": "mfa", - "weight": 308, + "weight": 255, "cookies": false, "type": "", "demo": "account\/create-mfa-authenticator.md", @@ -790,7 +811,7 @@ "x-appwrite": { "method": "updateMfaAuthenticator", "group": "mfa", - "weight": 309, + "weight": 256, "cookies": false, "type": "", "demo": "account\/update-mfa-authenticator.md", @@ -931,7 +952,7 @@ "x-appwrite": { "method": "deleteMfaAuthenticator", "group": "mfa", - "weight": 310, + "weight": 257, "cookies": false, "type": "", "demo": "account\/delete-mfa-authenticator.md", @@ -1055,7 +1076,7 @@ "x-appwrite": { "method": "createMfaChallenge", "group": "mfa", - "weight": 314, + "weight": 261, "cookies": false, "type": "", "demo": "account\/create-mfa-challenge.md", @@ -1192,7 +1213,7 @@ "x-appwrite": { "method": "updateMfaChallenge", "group": "mfa", - "weight": 315, + "weight": 262, "cookies": false, "type": "", "demo": "account\/update-mfa-challenge.md", @@ -1332,7 +1353,7 @@ "x-appwrite": { "method": "listMfaFactors", "group": "mfa", - "weight": 307, + "weight": 254, "cookies": false, "type": "", "demo": "account\/list-mfa-factors.md", @@ -1433,7 +1454,7 @@ "x-appwrite": { "method": "getMfaRecoveryCodes", "group": "mfa", - "weight": 313, + "weight": 260, "cookies": false, "type": "", "demo": "account\/get-mfa-recovery-codes.md", @@ -1534,7 +1555,7 @@ "x-appwrite": { "method": "createMfaRecoveryCodes", "group": "mfa", - "weight": 311, + "weight": 258, "cookies": false, "type": "", "demo": "account\/create-mfa-recovery-codes.md", @@ -1635,7 +1656,7 @@ "x-appwrite": { "method": "updateMfaRecoveryCodes", "group": "mfa", - "weight": 312, + "weight": 259, "cookies": false, "type": "", "demo": "account\/update-mfa-recovery-codes.md", @@ -1738,7 +1759,7 @@ "x-appwrite": { "method": "updateName", "group": "account", - "weight": 33, + "weight": 32, "cookies": false, "type": "", "demo": "account\/update-name.md", @@ -1813,7 +1834,7 @@ "x-appwrite": { "method": "updatePassword", "group": "account", - "weight": 34, + "weight": 33, "cookies": false, "type": "", "demo": "account\/update-password.md", @@ -1857,7 +1878,8 @@ "type": "string", "description": "Current user password. Must be at least 8 chars.", "default": "", - "x-example": "password" + "x-example": "password", + "format": "password" } }, "required": [ @@ -1894,7 +1916,7 @@ "x-appwrite": { "method": "updatePhone", "group": "account", - "weight": 36, + "weight": 35, "cookies": false, "type": "", "demo": "account\/update-phone.md", @@ -1932,13 +1954,15 @@ "type": "string", "description": "Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", "default": null, - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "password": { "type": "string", "description": "User password. Must be at least 8 chars.", "default": null, - "x-example": "password" + "x-example": "password", + "format": "password" } }, "required": [ @@ -1974,7 +1998,7 @@ "x-appwrite": { "method": "getPrefs", "group": "account", - "weight": 31, + "weight": 30, "cookies": false, "type": "", "demo": "account\/get-prefs.md", @@ -2027,7 +2051,7 @@ "x-appwrite": { "method": "updatePrefs", "group": "account", - "weight": 37, + "weight": 36, "cookies": false, "type": "", "demo": "account\/update-prefs.md", @@ -2102,7 +2126,7 @@ "x-appwrite": { "method": "createRecovery", "group": "recovery", - "weight": 39, + "weight": 38, "cookies": false, "type": "", "demo": "account\/create-recovery.md", @@ -2143,13 +2167,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "url": { "type": "string", "description": "URL to redirect the user back to your app from the recovery email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.", "default": null, - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" } }, "required": [ @@ -2185,7 +2211,7 @@ "x-appwrite": { "method": "updateRecovery", "group": "recovery", - "weight": 40, + "weight": 39, "cookies": false, "type": "", "demo": "account\/update-recovery.md", @@ -2272,7 +2298,7 @@ "x-appwrite": { "method": "listSessions", "group": "sessions", - "weight": 12, + "weight": 11, "cookies": false, "type": "", "demo": "account\/list-sessions.md", @@ -2320,7 +2346,7 @@ "x-appwrite": { "method": "deleteSessions", "group": "sessions", - "weight": 13, + "weight": 12, "cookies": false, "type": "", "demo": "account\/delete-sessions.md", @@ -2375,7 +2401,7 @@ "x-appwrite": { "method": "createAnonymousSession", "group": "sessions", - "weight": 18, + "weight": 17, "cookies": false, "type": "", "demo": "account\/create-anonymous-session.md", @@ -2430,7 +2456,7 @@ "x-appwrite": { "method": "createEmailPasswordSession", "group": "sessions", - "weight": 17, + "weight": 16, "cookies": false, "type": "", "demo": "account\/create-email-password-session.md", @@ -2468,13 +2494,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password. Must be at least 8 chars.", "default": null, - "x-example": "password" + "x-example": "password", + "format": "password" } }, "required": [ @@ -2512,7 +2540,7 @@ "x-appwrite": { "method": "updateMagicURLSession", "group": "sessions", - "weight": 27, + "weight": 26, "cookies": false, "type": "", "demo": "account\/update-magic-url-session.md", @@ -2593,7 +2621,7 @@ "x-appwrite": { "method": "createOAuth2Session", "group": "sessions", - "weight": 20, + "weight": 19, "cookies": false, "type": "webAuth", "demo": "account\/create-o-auth-2-session.md", @@ -2666,8 +2694,7 @@ "yammer", "yandex", "zoho", - "zoom", - "mock" + "zoom" ], "x-enum-name": "OAuthProvider", "x-enum-keys": [], @@ -2734,7 +2761,7 @@ "x-appwrite": { "method": "updatePhoneSession", "group": "sessions", - "weight": 28, + "weight": 27, "cookies": false, "type": "", "demo": "account\/update-phone-session.md", @@ -2820,7 +2847,7 @@ "x-appwrite": { "method": "createSession", "group": "sessions", - "weight": 19, + "weight": 18, "cookies": false, "type": "", "demo": "account\/create-session.md", @@ -2900,7 +2927,7 @@ "x-appwrite": { "method": "getSession", "group": "sessions", - "weight": 14, + "weight": 13, "cookies": false, "type": "", "demo": "account\/get-session.md", @@ -2963,7 +2990,7 @@ "x-appwrite": { "method": "updateSession", "group": "sessions", - "weight": 16, + "weight": 15, "cookies": false, "type": "", "demo": "account\/update-session.md", @@ -3021,7 +3048,7 @@ "x-appwrite": { "method": "deleteSession", "group": "sessions", - "weight": 15, + "weight": 14, "cookies": false, "type": "", "demo": "account\/delete-session.md", @@ -3086,7 +3113,7 @@ "x-appwrite": { "method": "updateStatus", "group": "account", - "weight": 38, + "weight": 37, "cookies": false, "type": "", "demo": "account\/update-status.md", @@ -3141,7 +3168,7 @@ "x-appwrite": { "method": "createPushTarget", "group": "pushTargets", - "weight": 45, + "weight": 44, "cookies": false, "type": "", "demo": "account\/create-push-target.md", @@ -3227,7 +3254,7 @@ "x-appwrite": { "method": "updatePushTarget", "group": "pushTargets", - "weight": 46, + "weight": 45, "cookies": false, "type": "", "demo": "account\/update-push-target.md", @@ -3301,7 +3328,7 @@ "x-appwrite": { "method": "deletePushTarget", "group": "pushTargets", - "weight": 47, + "weight": 46, "cookies": false, "type": "", "demo": "account\/delete-push-target.md", @@ -3364,7 +3391,7 @@ "x-appwrite": { "method": "createEmailToken", "group": "tokens", - "weight": 26, + "weight": 25, "cookies": false, "type": "", "demo": "account\/create-email-token.md", @@ -3411,7 +3438,8 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "phrase": { "type": "boolean", @@ -3455,7 +3483,7 @@ "x-appwrite": { "method": "createMagicURLToken", "group": "tokens", - "weight": 25, + "weight": 24, "cookies": false, "type": "", "demo": "account\/create-magic-url-token.md", @@ -3502,13 +3530,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "url": { "type": "string", "description": "URL to redirect the user back to your app from the magic URL login. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.", "default": "", - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" }, "phrase": { "type": "boolean", @@ -3547,7 +3577,7 @@ "x-appwrite": { "method": "createOAuth2Token", "group": "tokens", - "weight": 24, + "weight": 23, "cookies": false, "type": "webAuth", "demo": "account\/create-o-auth-2-token.md", @@ -3620,8 +3650,7 @@ "yammer", "yandex", "zoho", - "zoom", - "mock" + "zoom" ], "x-enum-name": "OAuthProvider", "x-enum-keys": [], @@ -3688,7 +3717,7 @@ "x-appwrite": { "method": "createPhoneToken", "group": "tokens", - "weight": 29, + "weight": 28, "cookies": false, "type": "", "demo": "account\/create-phone-token.md", @@ -3735,7 +3764,8 @@ "type": "string", "description": "Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", "default": null, - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" } }, "required": [ @@ -3773,7 +3803,7 @@ "x-appwrite": { "method": "createEmailVerification", "group": "verification", - "weight": 41, + "weight": 40, "cookies": false, "type": "", "demo": "account\/create-email-verification.md", @@ -3863,7 +3893,8 @@ "type": "string", "description": "URL to redirect the user back to your app from the verification email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.", "default": null, - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" } }, "required": [ @@ -3898,7 +3929,7 @@ "x-appwrite": { "method": "updateEmailVerification", "group": "verification", - "weight": 42, + "weight": 41, "cookies": false, "type": "", "demo": "account\/update-email-verification.md", @@ -4036,7 +4067,7 @@ "x-appwrite": { "method": "createPhoneVerification", "group": "verification", - "weight": 43, + "weight": 42, "cookies": false, "type": "", "demo": "account\/create-phone-verification.md", @@ -4092,7 +4123,7 @@ "x-appwrite": { "method": "updatePhoneVerification", "group": "verification", - "weight": 44, + "weight": 43, "cookies": false, "type": "", "demo": "account\/update-phone-verification.md", @@ -4172,7 +4203,7 @@ "x-appwrite": { "method": "getBrowser", "group": null, - "weight": 51, + "weight": 264, "cookies": false, "type": "location", "demo": "avatars\/get-browser.md", @@ -4298,7 +4329,7 @@ "x-appwrite": { "method": "getCreditCard", "group": null, - "weight": 50, + "weight": 263, "cookies": false, "type": "location", "demo": "avatars\/get-credit-card.md", @@ -4430,7 +4461,7 @@ "x-appwrite": { "method": "getFavicon", "group": null, - "weight": 54, + "weight": 267, "cookies": false, "type": "location", "demo": "avatars\/get-favicon.md", @@ -4494,7 +4525,7 @@ "x-appwrite": { "method": "getFlag", "group": null, - "weight": 52, + "weight": 265, "cookies": false, "type": "location", "demo": "avatars\/get-flag.md", @@ -4982,7 +5013,7 @@ "x-appwrite": { "method": "getImage", "group": null, - "weight": 53, + "weight": 266, "cookies": false, "type": "location", "demo": "avatars\/get-image.md", @@ -5066,7 +5097,7 @@ "x-appwrite": { "method": "getInitials", "group": null, - "weight": 56, + "weight": 269, "cookies": false, "type": "location", "demo": "avatars\/get-initials.md", @@ -5158,7 +5189,7 @@ "x-appwrite": { "method": "getQR", "group": null, - "weight": 55, + "weight": 268, "cookies": false, "type": "location", "demo": "avatars\/get-qr.md", @@ -5250,7 +5281,7 @@ "x-appwrite": { "method": "getScreenshot", "group": null, - "weight": 57, + "weight": 270, "cookies": false, "type": "location", "demo": "avatars\/get-screenshot.md", @@ -5931,7 +5962,7 @@ "avif", "gif" ], - "x-enum-name": null, + "x-enum-name": "ImageFormat", "x-enum-keys": [], "default": "", "in": "query" @@ -5963,7 +5994,7 @@ "x-appwrite": { "method": "listTransactions", "group": "transactions", - "weight": 380, + "weight": 338, "cookies": false, "type": "", "demo": "databases\/list-transactions.md", @@ -6030,7 +6061,7 @@ "x-appwrite": { "method": "createTransaction", "group": "transactions", - "weight": 376, + "weight": 334, "cookies": false, "type": "", "demo": "databases\/create-transaction.md", @@ -6068,7 +6099,8 @@ "type": "integer", "description": "Seconds before the transaction expires.", "default": 300, - "x-example": 60 + "x-example": 60, + "format": "int32" } } } @@ -6100,7 +6132,7 @@ "x-appwrite": { "method": "getTransaction", "group": "transactions", - "weight": 377, + "weight": 335, "cookies": false, "type": "", "demo": "databases\/get-transaction.md", @@ -6163,7 +6195,7 @@ "x-appwrite": { "method": "updateTransaction", "group": "transactions", - "weight": 378, + "weight": 336, "cookies": false, "type": "", "demo": "databases\/update-transaction.md", @@ -6242,7 +6274,7 @@ "x-appwrite": { "method": "deleteTransaction", "group": "transactions", - "weight": 379, + "weight": 337, "cookies": false, "type": "", "demo": "databases\/delete-transaction.md", @@ -6307,7 +6339,7 @@ "x-appwrite": { "method": "createOperations", "group": "transactions", - "weight": 381, + "weight": 339, "cookies": false, "type": "", "demo": "databases\/create-operations.md", @@ -6388,7 +6420,7 @@ "x-appwrite": { "method": "listDocuments", "group": "documents", - "weight": 339, + "weight": 297, "cookies": false, "type": "", "demo": "databases\/list-documents.md", @@ -6492,7 +6524,7 @@ "x-appwrite": { "method": "createDocument", "group": "documents", - "weight": 331, + "weight": 289, "cookies": false, "type": "", "demo": "databases\/create-document.md", @@ -6651,7 +6683,7 @@ "x-appwrite": { "method": "getDocument", "group": "documents", - "weight": 332, + "weight": 290, "cookies": false, "type": "", "demo": "databases\/get-document.md", @@ -6754,7 +6786,7 @@ "x-appwrite": { "method": "upsertDocument", "group": "documents", - "weight": 335, + "weight": 293, "cookies": false, "type": "", "demo": "databases\/upsert-document.md", @@ -6905,7 +6937,7 @@ "x-appwrite": { "method": "updateDocument", "group": "documents", - "weight": 333, + "weight": 291, "cookies": false, "type": "", "demo": "databases\/update-document.md", @@ -7015,7 +7047,7 @@ "x-appwrite": { "method": "deleteDocument", "group": "documents", - "weight": 337, + "weight": 295, "cookies": false, "type": "", "demo": "databases\/delete-document.md", @@ -7116,7 +7148,7 @@ "x-appwrite": { "method": "decrementDocumentAttribute", "group": "documents", - "weight": 342, + "weight": 300, "cookies": false, "type": "", "demo": "databases\/decrement-document-attribute.md", @@ -7189,13 +7221,15 @@ "type": "number", "description": "Value to increment the attribute by. The value must be a number.", "default": 1, - "x-example": null + "x-example": null, + "format": "float" }, "min": { "type": "number", "description": "Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "transactionId": { @@ -7237,7 +7271,7 @@ "x-appwrite": { "method": "incrementDocumentAttribute", "group": "documents", - "weight": 341, + "weight": 299, "cookies": false, "type": "", "demo": "databases\/increment-document-attribute.md", @@ -7310,13 +7344,15 @@ "type": "number", "description": "Value to increment the attribute by. The value must be a number.", "default": 1, - "x-example": null + "x-example": null, + "format": "float" }, "max": { "type": "number", "description": "Maximum value for the attribute. If the current value is greater than this value, an error will be thrown.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "transactionId": { @@ -7356,7 +7392,7 @@ "x-appwrite": { "method": "listExecutions", "group": "executions", - "weight": 472, + "weight": 431, "cookies": false, "type": "", "demo": "functions\/list-executions.md", @@ -7439,7 +7475,7 @@ "x-appwrite": { "method": "createExecution", "group": "executions", - "weight": 470, + "weight": 429, "cookies": false, "type": "", "demo": "functions\/create-execution.md", @@ -7558,7 +7594,7 @@ "x-appwrite": { "method": "getExecution", "group": "executions", - "weight": 471, + "weight": 430, "cookies": false, "type": "", "demo": "functions\/get-execution.md", @@ -7630,7 +7666,7 @@ "x-appwrite": { "method": "query", "group": "graphql", - "weight": 241, + "weight": 190, "cookies": false, "type": "graphql", "demo": "graphql\/query.md", @@ -7705,7 +7741,7 @@ "x-appwrite": { "method": "mutation", "group": "graphql", - "weight": 240, + "weight": 189, "cookies": false, "type": "graphql", "demo": "graphql\/mutation.md", @@ -7778,7 +7814,7 @@ "x-appwrite": { "method": "get", "group": null, - "weight": 61, + "weight": 49, "cookies": false, "type": "", "demo": "locale\/get.md", @@ -7831,7 +7867,7 @@ "x-appwrite": { "method": "listCodes", "group": null, - "weight": 62, + "weight": 50, "cookies": false, "type": "", "demo": "locale\/list-codes.md", @@ -7884,7 +7920,7 @@ "x-appwrite": { "method": "listContinents", "group": null, - "weight": 66, + "weight": 54, "cookies": false, "type": "", "demo": "locale\/list-continents.md", @@ -7937,7 +7973,7 @@ "x-appwrite": { "method": "listCountries", "group": null, - "weight": 63, + "weight": 51, "cookies": false, "type": "", "demo": "locale\/list-countries.md", @@ -7990,7 +8026,7 @@ "x-appwrite": { "method": "listCountriesEU", "group": null, - "weight": 64, + "weight": 52, "cookies": false, "type": "", "demo": "locale\/list-countries-eu.md", @@ -8043,7 +8079,7 @@ "x-appwrite": { "method": "listCountriesPhones", "group": null, - "weight": 65, + "weight": 53, "cookies": false, "type": "", "demo": "locale\/list-countries-phones.md", @@ -8096,7 +8132,7 @@ "x-appwrite": { "method": "listCurrencies", "group": null, - "weight": 67, + "weight": 55, "cookies": false, "type": "", "demo": "locale\/list-currencies.md", @@ -8149,7 +8185,7 @@ "x-appwrite": { "method": "listLanguages", "group": null, - "weight": 68, + "weight": 56, "cookies": false, "type": "", "demo": "locale\/list-languages.md", @@ -8204,7 +8240,7 @@ "x-appwrite": { "method": "createSubscriber", "group": "subscribers", - "weight": 290, + "weight": 237, "cookies": false, "type": "", "demo": "messaging\/create-subscriber.md", @@ -8289,7 +8325,7 @@ "x-appwrite": { "method": "deleteSubscriber", "group": "subscribers", - "weight": 294, + "weight": 241, "cookies": false, "type": "", "demo": "messaging\/delete-subscriber.md", @@ -8360,7 +8396,7 @@ "x-appwrite": { "method": "listFiles", "group": "files", - "weight": 151, + "weight": 527, "cookies": false, "type": "", "demo": "storage\/list-files.md", @@ -8453,7 +8489,7 @@ "x-appwrite": { "method": "createFile", "group": "files", - "weight": 150, + "weight": 525, "cookies": false, "type": "upload", "demo": "storage\/create-file.md", @@ -8544,7 +8580,7 @@ "x-appwrite": { "method": "getFile", "group": "files", - "weight": 152, + "weight": 526, "cookies": false, "type": "", "demo": "storage\/get-file.md", @@ -8615,13 +8651,13 @@ "x-appwrite": { "method": "updateFile", "group": "files", - "weight": 157, + "weight": 528, "cookies": false, "type": "", "demo": "storage\/update-file.md", - "rate-limit": 60, - "rate-time": 60, - "rate-key": "ip:{ip},method:{method},url:{url},userId:{userId}", + "rate-limit": 0, + "rate-time": 3600, + "rate-key": "url:{url},ip:{ip}", "scope": "files.write", "platforms": [ "console", @@ -8645,7 +8681,7 @@ "parameters": [ { "name": "bucketId", - "description": "Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https:\/\/appwrite.io\/docs\/server\/storage#createBucket).", + "description": "Bucket unique ID.", "required": true, "type": "string", "x-example": "", @@ -8653,7 +8689,7 @@ }, { "name": "fileId", - "description": "File unique ID.", + "description": "File ID.", "required": true, "type": "string", "x-example": "", @@ -8667,14 +8703,13 @@ "properties": { "name": { "type": "string", - "description": "Name of the file", + "description": "File name.", "default": null, - "x-example": "", - "x-nullable": true + "x-example": "" }, "permissions": { "type": "array", - "description": "An array of permission string. By default, the current permissions are inherited. [Learn more about permissions](https:\/\/appwrite.io\/docs\/permissions).", + "description": "An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https:\/\/appwrite.io\/docs\/permissions).", "default": null, "x-example": "[\"read(\"any\")\"]", "x-nullable": true, @@ -8707,7 +8742,7 @@ "x-appwrite": { "method": "deleteFile", "group": "files", - "weight": 158, + "weight": 529, "cookies": false, "type": "", "demo": "storage\/delete-file.md", @@ -8778,7 +8813,7 @@ "x-appwrite": { "method": "getFileDownload", "group": "files", - "weight": 154, + "weight": 531, "cookies": false, "type": "location", "demo": "storage\/get-file-download.md", @@ -8858,7 +8893,7 @@ "x-appwrite": { "method": "getFilePreview", "group": "files", - "weight": 153, + "weight": 530, "cookies": false, "type": "location", "demo": "storage\/get-file-preview.md", @@ -9066,7 +9101,7 @@ "x-appwrite": { "method": "getFileView", "group": "files", - "weight": 155, + "weight": 532, "cookies": false, "type": "location", "demo": "storage\/get-file-view.md", @@ -9146,7 +9181,7 @@ "x-appwrite": { "method": "listTransactions", "group": "transactions", - "weight": 445, + "weight": 403, "cookies": false, "type": "", "demo": "tablesdb\/list-transactions.md", @@ -9216,7 +9251,7 @@ "x-appwrite": { "method": "createTransaction", "group": "transactions", - "weight": 441, + "weight": 399, "cookies": false, "type": "", "demo": "tablesdb\/create-transaction.md", @@ -9257,7 +9292,8 @@ "type": "integer", "description": "Seconds before the transaction expires.", "default": 300, - "x-example": 60 + "x-example": 60, + "format": "int32" } } } @@ -9289,7 +9325,7 @@ "x-appwrite": { "method": "getTransaction", "group": "transactions", - "weight": 442, + "weight": 400, "cookies": false, "type": "", "demo": "tablesdb\/get-transaction.md", @@ -9355,7 +9391,7 @@ "x-appwrite": { "method": "updateTransaction", "group": "transactions", - "weight": 443, + "weight": 401, "cookies": false, "type": "", "demo": "tablesdb\/update-transaction.md", @@ -9437,7 +9473,7 @@ "x-appwrite": { "method": "deleteTransaction", "group": "transactions", - "weight": 444, + "weight": 402, "cookies": false, "type": "", "demo": "tablesdb\/delete-transaction.md", @@ -9505,7 +9541,7 @@ "x-appwrite": { "method": "createOperations", "group": "transactions", - "weight": 446, + "weight": 404, "cookies": false, "type": "", "demo": "tablesdb\/create-operations.md", @@ -9589,7 +9625,7 @@ "x-appwrite": { "method": "listRows", "group": "rows", - "weight": 437, + "weight": 395, "cookies": false, "type": "", "demo": "tablesdb\/list-rows.md", @@ -9692,7 +9728,7 @@ "x-appwrite": { "method": "createRow", "group": "rows", - "weight": 429, + "weight": 387, "cookies": false, "type": "", "demo": "tablesdb\/create-row.md", @@ -9846,7 +9882,7 @@ "x-appwrite": { "method": "getRow", "group": "rows", - "weight": 430, + "weight": 388, "cookies": false, "type": "", "demo": "tablesdb\/get-row.md", @@ -9948,7 +9984,7 @@ "x-appwrite": { "method": "upsertRow", "group": "rows", - "weight": 433, + "weight": 391, "cookies": false, "type": "", "demo": "tablesdb\/upsert-row.md", @@ -10094,7 +10130,7 @@ "x-appwrite": { "method": "updateRow", "group": "rows", - "weight": 431, + "weight": 389, "cookies": false, "type": "", "demo": "tablesdb\/update-row.md", @@ -10203,7 +10239,7 @@ "x-appwrite": { "method": "deleteRow", "group": "rows", - "weight": 435, + "weight": 393, "cookies": false, "type": "", "demo": "tablesdb\/delete-row.md", @@ -10303,7 +10339,7 @@ "x-appwrite": { "method": "decrementRowColumn", "group": "rows", - "weight": 440, + "weight": 398, "cookies": false, "type": "", "demo": "tablesdb\/decrement-row-column.md", @@ -10375,13 +10411,15 @@ "type": "number", "description": "Value to increment the column by. The value must be a number.", "default": 1, - "x-example": null + "x-example": null, + "format": "float" }, "min": { "type": "number", "description": "Minimum value for the column. If the current value is lesser than this value, an exception will be thrown.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "transactionId": { @@ -10423,7 +10461,7 @@ "x-appwrite": { "method": "incrementRowColumn", "group": "rows", - "weight": 439, + "weight": 397, "cookies": false, "type": "", "demo": "tablesdb\/increment-row-column.md", @@ -10495,13 +10533,15 @@ "type": "number", "description": "Value to increment the column by. The value must be a number.", "default": 1, - "x-example": null + "x-example": null, + "format": "float" }, "max": { "type": "number", "description": "Maximum value for the column. If the current value is greater than this value, an error will be thrown.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "transactionId": { @@ -10541,7 +10581,7 @@ "x-appwrite": { "method": "list", "group": "teams", - "weight": 162, + "weight": 110, "cookies": false, "type": "", "demo": "teams\/list.md", @@ -10626,7 +10666,7 @@ "x-appwrite": { "method": "create", "group": "teams", - "weight": 161, + "weight": 109, "cookies": false, "type": "", "demo": "teams\/create.md", @@ -10717,7 +10757,7 @@ "x-appwrite": { "method": "get", "group": "teams", - "weight": 163, + "weight": 111, "cookies": false, "type": "", "demo": "teams\/get.md", @@ -10780,7 +10820,7 @@ "x-appwrite": { "method": "updateName", "group": "teams", - "weight": 165, + "weight": 113, "cookies": false, "type": "", "demo": "teams\/update-name.md", @@ -10856,7 +10896,7 @@ "x-appwrite": { "method": "delete", "group": "teams", - "weight": 167, + "weight": 115, "cookies": false, "type": "", "demo": "teams\/delete.md", @@ -10919,7 +10959,7 @@ "x-appwrite": { "method": "listMemberships", "group": "memberships", - "weight": 169, + "weight": 117, "cookies": false, "type": "", "demo": "teams\/list-memberships.md", @@ -11012,7 +11052,7 @@ "x-appwrite": { "method": "createMembership", "group": "memberships", - "weight": 168, + "weight": 116, "cookies": false, "type": "", "demo": "teams\/create-membership.md", @@ -11058,7 +11098,8 @@ "type": "string", "description": "Email of the new team member.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "userId": { "type": "string", @@ -11070,7 +11111,8 @@ "type": "string", "description": "Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", "default": "", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "roles": { "type": "array", @@ -11092,7 +11134,8 @@ "type": "string", "description": "URL to redirect the user back to your app from the invitation email. This parameter is not required when an API key is supplied. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.", "default": "", - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" }, "name": { "type": "string", @@ -11133,7 +11176,7 @@ "x-appwrite": { "method": "getMembership", "group": "memberships", - "weight": 170, + "weight": 118, "cookies": false, "type": "", "demo": "teams\/get-membership.md", @@ -11204,7 +11247,7 @@ "x-appwrite": { "method": "updateMembership", "group": "memberships", - "weight": 171, + "weight": 119, "cookies": false, "type": "", "demo": "teams\/update-membership.md", @@ -11298,7 +11341,7 @@ "x-appwrite": { "method": "deleteMembership", "group": "memberships", - "weight": 173, + "weight": 121, "cookies": false, "type": "", "demo": "teams\/delete-membership.md", @@ -11371,7 +11414,7 @@ "x-appwrite": { "method": "updateMembershipStatus", "group": "memberships", - "weight": 172, + "weight": 120, "cookies": false, "type": "", "demo": "teams\/update-membership-status.md", @@ -11467,7 +11510,7 @@ "x-appwrite": { "method": "getPrefs", "group": "teams", - "weight": 164, + "weight": 112, "cookies": false, "type": "", "demo": "teams\/get-prefs.md", @@ -11530,7 +11573,7 @@ "x-appwrite": { "method": "updatePrefs", "group": "teams", - "weight": 166, + "weight": 114, "cookies": false, "type": "", "demo": "teams\/update-prefs.md", @@ -11651,7 +11694,7 @@ }, { "name": "console", - "description": "The Console service allows you to interact with console relevant informations." + "description": "The Console service allows you to interact with console relevant information." }, { "name": "migrations", @@ -13350,6 +13393,16 @@ "description": "Total number of chunks uploaded", "x-example": 17890, "format": "int32" + }, + "encryption": { + "type": "boolean", + "description": "Whether file contents are encrypted at rest.", + "x-example": true + }, + "compression": { + "type": "string", + "description": "Compression algorithm used for the file. Will be one of none, [gzip](https:\/\/en.wikipedia.org\/wiki\/Gzip), or [zstd](https:\/\/en.wikipedia.org\/wiki\/Zstd).", + "x-example": "gzip" } }, "required": [ @@ -13363,7 +13416,9 @@ "mimeType", "sizeOriginal", "chunksTotal", - "chunksUploaded" + "chunksUploaded", + "encryption", + "compression" ], "example": { "$id": "5e5ea5c16897e", @@ -13378,7 +13433,9 @@ "mimeType": "image\/png", "sizeOriginal": 17890, "chunksTotal": 17890, - "chunksUploaded": 17890 + "chunksUploaded": 17890, + "encryption": true, + "compression": "gzip" } }, "team": { diff --git a/app/config/specs/swagger2-latest-console.json b/app/config/specs/swagger2-latest-console.json index 36e54a5c4d..0bb1a47f0a 100644 --- a/app/config/specs/swagger2-latest-console.json +++ b/app/config/specs/swagger2-latest-console.json @@ -1,7 +1,7 @@ { "swagger": "2.0", "info": { - "version": "1.8.0", + "version": "1.8.1", "title": "Appwrite", "description": "Appwrite backend as a service cuts up to 70% of the time and costs required for building a modern application. We abstract and simplify common development tasks behind a REST APIs, to help you develop your app in a fast and secure way. For full API documentation and tutorials go to [https:\/\/appwrite.io\/docs](https:\/\/appwrite.io\/docs)", "termsOfService": "https:\/\/appwrite.io\/policy\/terms", @@ -73,6 +73,12 @@ "x-appwrite": { "demo": "" } + }, + "Cookie": { + "type": "apiKey", + "name": "Cookie", + "description": "The user cookie to authenticate with", + "in": "header" } }, "paths": { @@ -100,7 +106,7 @@ "x-appwrite": { "method": "get", "group": "account", - "weight": 10, + "weight": 9, "cookies": false, "type": "", "demo": "account\/get.md", @@ -152,7 +158,7 @@ "x-appwrite": { "method": "create", "group": "account", - "weight": 9, + "weight": 8, "cookies": false, "type": "", "demo": "account\/create.md", @@ -195,7 +201,8 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", @@ -239,7 +246,7 @@ "x-appwrite": { "method": "delete", "group": "account", - "weight": 11, + "weight": 10, "cookies": false, "type": "", "demo": "account\/delete.md", @@ -290,7 +297,7 @@ "x-appwrite": { "method": "updateEmail", "group": "account", - "weight": 35, + "weight": 34, "cookies": false, "type": "", "demo": "account\/update-email.md", @@ -327,13 +334,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password. Must be at least 8 chars.", "default": null, - "x-example": "password" + "x-example": "password", + "format": "password" } }, "required": [ @@ -369,7 +378,7 @@ "x-appwrite": { "method": "listIdentities", "group": "identities", - "weight": 48, + "weight": 47, "cookies": false, "type": "", "demo": "account\/list-identities.md", @@ -441,7 +450,7 @@ "x-appwrite": { "method": "deleteIdentity", "group": "identities", - "weight": 49, + "weight": 48, "cookies": false, "type": "", "demo": "account\/delete-identity.md", @@ -505,12 +514,12 @@ "x-appwrite": { "method": "createJWT", "group": "tokens", - "weight": 30, + "weight": 29, "cookies": false, "type": "", "demo": "account\/create-jwt.md", - "rate-limit": 100, - "rate-time": 3600, + "rate-limit": 120, + "rate-time": 60, "rate-key": "url:{url},userId:{userId}", "scope": "account", "platforms": [ @@ -530,6 +539,24 @@ "Project": [], "JWT": [] } + ], + "parameters": [ + { + "name": "payload", + "in": "body", + "schema": { + "type": "object", + "properties": { + "duration": { + "type": "integer", + "description": "Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds.", + "default": 900, + "x-example": 0, + "format": "int32" + } + } + } + } ] } }, @@ -557,7 +584,7 @@ "x-appwrite": { "method": "listLogs", "group": "logs", - "weight": 32, + "weight": 31, "cookies": false, "type": "", "demo": "account\/list-logs.md", @@ -634,7 +661,7 @@ "x-appwrite": { "method": "updateMFA", "group": "mfa", - "weight": 306, + "weight": 253, "cookies": false, "type": "", "demo": "account\/update-mfa.md", @@ -708,7 +735,7 @@ "x-appwrite": { "method": "createMfaAuthenticator", "group": "mfa", - "weight": 308, + "weight": 255, "cookies": false, "type": "", "demo": "account\/create-mfa-authenticator.md", @@ -831,7 +858,7 @@ "x-appwrite": { "method": "updateMfaAuthenticator", "group": "mfa", - "weight": 309, + "weight": 256, "cookies": false, "type": "", "demo": "account\/update-mfa-authenticator.md", @@ -971,7 +998,7 @@ "x-appwrite": { "method": "deleteMfaAuthenticator", "group": "mfa", - "weight": 310, + "weight": 257, "cookies": false, "type": "", "demo": "account\/delete-mfa-authenticator.md", @@ -1094,7 +1121,7 @@ "x-appwrite": { "method": "createMfaChallenge", "group": "mfa", - "weight": 314, + "weight": 261, "cookies": false, "type": "", "demo": "account\/create-mfa-challenge.md", @@ -1230,7 +1257,7 @@ "x-appwrite": { "method": "updateMfaChallenge", "group": "mfa", - "weight": 315, + "weight": 262, "cookies": false, "type": "", "demo": "account\/update-mfa-challenge.md", @@ -1369,7 +1396,7 @@ "x-appwrite": { "method": "listMfaFactors", "group": "mfa", - "weight": 307, + "weight": 254, "cookies": false, "type": "", "demo": "account\/list-mfa-factors.md", @@ -1469,7 +1496,7 @@ "x-appwrite": { "method": "getMfaRecoveryCodes", "group": "mfa", - "weight": 313, + "weight": 260, "cookies": false, "type": "", "demo": "account\/get-mfa-recovery-codes.md", @@ -1569,7 +1596,7 @@ "x-appwrite": { "method": "createMfaRecoveryCodes", "group": "mfa", - "weight": 311, + "weight": 258, "cookies": false, "type": "", "demo": "account\/create-mfa-recovery-codes.md", @@ -1669,7 +1696,7 @@ "x-appwrite": { "method": "updateMfaRecoveryCodes", "group": "mfa", - "weight": 312, + "weight": 259, "cookies": false, "type": "", "demo": "account\/update-mfa-recovery-codes.md", @@ -1771,7 +1798,7 @@ "x-appwrite": { "method": "updateName", "group": "account", - "weight": 33, + "weight": 32, "cookies": false, "type": "", "demo": "account\/update-name.md", @@ -1845,7 +1872,7 @@ "x-appwrite": { "method": "updatePassword", "group": "account", - "weight": 34, + "weight": 33, "cookies": false, "type": "", "demo": "account\/update-password.md", @@ -1888,7 +1915,8 @@ "type": "string", "description": "Current user password. Must be at least 8 chars.", "default": "", - "x-example": "password" + "x-example": "password", + "format": "password" } }, "required": [ @@ -1925,7 +1953,7 @@ "x-appwrite": { "method": "updatePhone", "group": "account", - "weight": 36, + "weight": 35, "cookies": false, "type": "", "demo": "account\/update-phone.md", @@ -1962,13 +1990,15 @@ "type": "string", "description": "Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", "default": null, - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "password": { "type": "string", "description": "User password. Must be at least 8 chars.", "default": null, - "x-example": "password" + "x-example": "password", + "format": "password" } }, "required": [ @@ -2004,7 +2034,7 @@ "x-appwrite": { "method": "getPrefs", "group": "account", - "weight": 31, + "weight": 30, "cookies": false, "type": "", "demo": "account\/get-prefs.md", @@ -2056,7 +2086,7 @@ "x-appwrite": { "method": "updatePrefs", "group": "account", - "weight": 37, + "weight": 36, "cookies": false, "type": "", "demo": "account\/update-prefs.md", @@ -2130,7 +2160,7 @@ "x-appwrite": { "method": "createRecovery", "group": "recovery", - "weight": 39, + "weight": 38, "cookies": false, "type": "", "demo": "account\/create-recovery.md", @@ -2170,13 +2200,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "url": { "type": "string", "description": "URL to redirect the user back to your app from the recovery email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.", "default": null, - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" } }, "required": [ @@ -2212,7 +2244,7 @@ "x-appwrite": { "method": "updateRecovery", "group": "recovery", - "weight": 40, + "weight": 39, "cookies": false, "type": "", "demo": "account\/update-recovery.md", @@ -2298,7 +2330,7 @@ "x-appwrite": { "method": "listSessions", "group": "sessions", - "weight": 12, + "weight": 11, "cookies": false, "type": "", "demo": "account\/list-sessions.md", @@ -2345,7 +2377,7 @@ "x-appwrite": { "method": "deleteSessions", "group": "sessions", - "weight": 13, + "weight": 12, "cookies": false, "type": "", "demo": "account\/delete-sessions.md", @@ -2399,7 +2431,7 @@ "x-appwrite": { "method": "createAnonymousSession", "group": "sessions", - "weight": 18, + "weight": 17, "cookies": false, "type": "", "demo": "account\/create-anonymous-session.md", @@ -2453,7 +2485,7 @@ "x-appwrite": { "method": "createEmailPasswordSession", "group": "sessions", - "weight": 17, + "weight": 16, "cookies": false, "type": "", "demo": "account\/create-email-password-session.md", @@ -2490,13 +2522,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password. Must be at least 8 chars.", "default": null, - "x-example": "password" + "x-example": "password", + "format": "password" } }, "required": [ @@ -2534,7 +2568,7 @@ "x-appwrite": { "method": "updateMagicURLSession", "group": "sessions", - "weight": 27, + "weight": 26, "cookies": false, "type": "", "demo": "account\/update-magic-url-session.md", @@ -2614,7 +2648,7 @@ "x-appwrite": { "method": "createOAuth2Session", "group": "sessions", - "weight": 20, + "weight": 19, "cookies": false, "type": "webAuth", "demo": "account\/create-o-auth-2-session.md", @@ -2686,8 +2720,7 @@ "yammer", "yandex", "zoho", - "zoom", - "mock" + "zoom" ], "x-enum-name": "OAuthProvider", "x-enum-keys": [], @@ -2754,7 +2787,7 @@ "x-appwrite": { "method": "updatePhoneSession", "group": "sessions", - "weight": 28, + "weight": 27, "cookies": false, "type": "", "demo": "account\/update-phone-session.md", @@ -2839,7 +2872,7 @@ "x-appwrite": { "method": "createSession", "group": "sessions", - "weight": 19, + "weight": 18, "cookies": false, "type": "", "demo": "account\/create-session.md", @@ -2918,7 +2951,7 @@ "x-appwrite": { "method": "getSession", "group": "sessions", - "weight": 14, + "weight": 13, "cookies": false, "type": "", "demo": "account\/get-session.md", @@ -2980,7 +3013,7 @@ "x-appwrite": { "method": "updateSession", "group": "sessions", - "weight": 16, + "weight": 15, "cookies": false, "type": "", "demo": "account\/update-session.md", @@ -3037,7 +3070,7 @@ "x-appwrite": { "method": "deleteSession", "group": "sessions", - "weight": 15, + "weight": 14, "cookies": false, "type": "", "demo": "account\/delete-session.md", @@ -3101,7 +3134,7 @@ "x-appwrite": { "method": "updateStatus", "group": "account", - "weight": 38, + "weight": 37, "cookies": false, "type": "", "demo": "account\/update-status.md", @@ -3155,7 +3188,7 @@ "x-appwrite": { "method": "createPushTarget", "group": "pushTargets", - "weight": 45, + "weight": 44, "cookies": false, "type": "", "demo": "account\/create-push-target.md", @@ -3240,7 +3273,7 @@ "x-appwrite": { "method": "updatePushTarget", "group": "pushTargets", - "weight": 46, + "weight": 45, "cookies": false, "type": "", "demo": "account\/update-push-target.md", @@ -3313,7 +3346,7 @@ "x-appwrite": { "method": "deletePushTarget", "group": "pushTargets", - "weight": 47, + "weight": 46, "cookies": false, "type": "", "demo": "account\/delete-push-target.md", @@ -3375,7 +3408,7 @@ "x-appwrite": { "method": "createEmailToken", "group": "tokens", - "weight": 26, + "weight": 25, "cookies": false, "type": "", "demo": "account\/create-email-token.md", @@ -3421,7 +3454,8 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "phrase": { "type": "boolean", @@ -3465,7 +3499,7 @@ "x-appwrite": { "method": "createMagicURLToken", "group": "tokens", - "weight": 25, + "weight": 24, "cookies": false, "type": "", "demo": "account\/create-magic-url-token.md", @@ -3511,13 +3545,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "url": { "type": "string", "description": "URL to redirect the user back to your app from the magic URL login. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.", "default": "", - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" }, "phrase": { "type": "boolean", @@ -3556,7 +3592,7 @@ "x-appwrite": { "method": "createOAuth2Token", "group": "tokens", - "weight": 24, + "weight": 23, "cookies": false, "type": "webAuth", "demo": "account\/create-o-auth-2-token.md", @@ -3628,8 +3664,7 @@ "yammer", "yandex", "zoho", - "zoom", - "mock" + "zoom" ], "x-enum-name": "OAuthProvider", "x-enum-keys": [], @@ -3696,7 +3731,7 @@ "x-appwrite": { "method": "createPhoneToken", "group": "tokens", - "weight": 29, + "weight": 28, "cookies": false, "type": "", "demo": "account\/create-phone-token.md", @@ -3742,7 +3777,8 @@ "type": "string", "description": "Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", "default": null, - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" } }, "required": [ @@ -3780,7 +3816,7 @@ "x-appwrite": { "method": "createEmailVerification", "group": "verification", - "weight": 41, + "weight": 40, "cookies": false, "type": "", "demo": "account\/create-email-verification.md", @@ -3869,7 +3905,8 @@ "type": "string", "description": "URL to redirect the user back to your app from the verification email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.", "default": null, - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" } }, "required": [ @@ -3904,7 +3941,7 @@ "x-appwrite": { "method": "updateEmailVerification", "group": "verification", - "weight": 42, + "weight": 41, "cookies": false, "type": "", "demo": "account\/update-email-verification.md", @@ -4041,7 +4078,7 @@ "x-appwrite": { "method": "createPhoneVerification", "group": "verification", - "weight": 43, + "weight": 42, "cookies": false, "type": "", "demo": "account\/create-phone-verification.md", @@ -4096,7 +4133,7 @@ "x-appwrite": { "method": "updatePhoneVerification", "group": "verification", - "weight": 44, + "weight": 43, "cookies": false, "type": "", "demo": "account\/update-phone-verification.md", @@ -4175,7 +4212,7 @@ "x-appwrite": { "method": "getBrowser", "group": null, - "weight": 51, + "weight": 264, "cookies": false, "type": "location", "demo": "avatars\/get-browser.md", @@ -4301,7 +4338,7 @@ "x-appwrite": { "method": "getCreditCard", "group": null, - "weight": 50, + "weight": 263, "cookies": false, "type": "location", "demo": "avatars\/get-credit-card.md", @@ -4433,7 +4470,7 @@ "x-appwrite": { "method": "getFavicon", "group": null, - "weight": 54, + "weight": 267, "cookies": false, "type": "location", "demo": "avatars\/get-favicon.md", @@ -4497,7 +4534,7 @@ "x-appwrite": { "method": "getFlag", "group": null, - "weight": 52, + "weight": 265, "cookies": false, "type": "location", "demo": "avatars\/get-flag.md", @@ -4985,7 +5022,7 @@ "x-appwrite": { "method": "getImage", "group": null, - "weight": 53, + "weight": 266, "cookies": false, "type": "location", "demo": "avatars\/get-image.md", @@ -5069,7 +5106,7 @@ "x-appwrite": { "method": "getInitials", "group": null, - "weight": 56, + "weight": 269, "cookies": false, "type": "location", "demo": "avatars\/get-initials.md", @@ -5161,7 +5198,7 @@ "x-appwrite": { "method": "getQR", "group": null, - "weight": 55, + "weight": 268, "cookies": false, "type": "location", "demo": "avatars\/get-qr.md", @@ -5253,7 +5290,7 @@ "x-appwrite": { "method": "getScreenshot", "group": null, - "weight": 57, + "weight": 270, "cookies": false, "type": "location", "demo": "avatars\/get-screenshot.md", @@ -5934,7 +5971,7 @@ "avif", "gif" ], - "x-enum-name": null, + "x-enum-name": "ImageFormat", "x-enum-keys": [], "default": "", "in": "query" @@ -5968,7 +6005,7 @@ "x-appwrite": { "method": "chat", "group": "console", - "weight": 243, + "weight": 497, "cookies": false, "type": "", "demo": "assistant\/chat.md", @@ -6032,7 +6069,7 @@ "x-appwrite": { "method": "getResource", "group": null, - "weight": 512, + "weight": 498, "cookies": false, "type": "", "demo": "console\/get-resource.md", @@ -6103,7 +6140,7 @@ "x-appwrite": { "method": "variables", "group": "console", - "weight": 242, + "weight": 496, "cookies": false, "type": "", "demo": "console\/variables.md", @@ -6152,7 +6189,7 @@ "x-appwrite": { "method": "list", "group": "databases", - "weight": 320, + "weight": 278, "cookies": false, "type": "", "demo": "databases\/list.md", @@ -6268,7 +6305,7 @@ "x-appwrite": { "method": "create", "group": "databases", - "weight": 316, + "weight": 274, "cookies": false, "type": "", "demo": "databases\/create.md", @@ -6388,7 +6425,7 @@ "x-appwrite": { "method": "listTransactions", "group": "transactions", - "weight": 380, + "weight": 338, "cookies": false, "type": "", "demo": "databases\/list-transactions.md", @@ -6455,7 +6492,7 @@ "x-appwrite": { "method": "createTransaction", "group": "transactions", - "weight": 376, + "weight": 334, "cookies": false, "type": "", "demo": "databases\/create-transaction.md", @@ -6493,7 +6530,8 @@ "type": "integer", "description": "Seconds before the transaction expires.", "default": 300, - "x-example": 60 + "x-example": 60, + "format": "int32" } } } @@ -6525,7 +6563,7 @@ "x-appwrite": { "method": "getTransaction", "group": "transactions", - "weight": 377, + "weight": 335, "cookies": false, "type": "", "demo": "databases\/get-transaction.md", @@ -6588,7 +6626,7 @@ "x-appwrite": { "method": "updateTransaction", "group": "transactions", - "weight": 378, + "weight": 336, "cookies": false, "type": "", "demo": "databases\/update-transaction.md", @@ -6667,7 +6705,7 @@ "x-appwrite": { "method": "deleteTransaction", "group": "transactions", - "weight": 379, + "weight": 337, "cookies": false, "type": "", "demo": "databases\/delete-transaction.md", @@ -6732,7 +6770,7 @@ "x-appwrite": { "method": "createOperations", "group": "transactions", - "weight": 381, + "weight": 339, "cookies": false, "type": "", "demo": "databases\/create-operations.md", @@ -6813,7 +6851,7 @@ "x-appwrite": { "method": "listUsage", "group": null, - "weight": 323, + "weight": 281, "cookies": false, "type": "", "demo": "databases\/list-usage.md", @@ -6915,7 +6953,7 @@ "x-appwrite": { "method": "get", "group": "databases", - "weight": 317, + "weight": 275, "cookies": false, "type": "", "demo": "databases\/get.md", @@ -7009,7 +7047,7 @@ "x-appwrite": { "method": "update", "group": "databases", - "weight": 318, + "weight": 276, "cookies": false, "type": "", "demo": "databases\/update.md", @@ -7042,8 +7080,7 @@ "enabled" ], "required": [ - "databaseId", - "name" + "databaseId" ], "responses": [ { @@ -7097,10 +7134,7 @@ "default": true, "x-example": false } - }, - "required": [ - "name" - ] + } } } ] @@ -7125,7 +7159,7 @@ "x-appwrite": { "method": "delete", "group": "databases", - "weight": 319, + "weight": 277, "cookies": false, "type": "", "demo": "databases\/delete.md", @@ -7218,7 +7252,7 @@ "x-appwrite": { "method": "listCollections", "group": "collections", - "weight": 328, + "weight": 286, "cookies": false, "type": "", "demo": "databases\/list-collections.md", @@ -7313,7 +7347,7 @@ "x-appwrite": { "method": "createCollection", "group": "collections", - "weight": 324, + "weight": 282, "cookies": false, "type": "", "demo": "databases\/create-collection.md", @@ -7443,7 +7477,7 @@ "x-appwrite": { "method": "getCollection", "group": "collections", - "weight": 325, + "weight": 283, "cookies": false, "type": "", "demo": "databases\/get-collection.md", @@ -7516,7 +7550,7 @@ "x-appwrite": { "method": "updateCollection", "group": "collections", - "weight": 326, + "weight": 284, "cookies": false, "type": "", "demo": "databases\/update-collection.md", @@ -7596,10 +7630,7 @@ "default": true, "x-example": false } - }, - "required": [ - "name" - ] + } } } ] @@ -7624,7 +7655,7 @@ "x-appwrite": { "method": "deleteCollection", "group": "collections", - "weight": 327, + "weight": 285, "cookies": false, "type": "", "demo": "databases\/delete-collection.md", @@ -7697,7 +7728,7 @@ "x-appwrite": { "method": "listAttributes", "group": "attributes", - "weight": 345, + "weight": 303, "cookies": false, "type": "", "demo": "databases\/list-attributes.md", @@ -7793,7 +7824,7 @@ "x-appwrite": { "method": "createBooleanAttribute", "group": "attributes", - "weight": 346, + "weight": 304, "cookies": false, "type": "", "demo": "databases\/create-boolean-attribute.md", @@ -7906,7 +7937,7 @@ "x-appwrite": { "method": "updateBooleanAttribute", "group": "attributes", - "weight": 347, + "weight": 305, "cookies": false, "type": "", "demo": "databases\/update-boolean-attribute.md", @@ -8021,7 +8052,7 @@ "x-appwrite": { "method": "createDatetimeAttribute", "group": "attributes", - "weight": 348, + "weight": 306, "cookies": false, "type": "", "demo": "databases\/create-datetime-attribute.md", @@ -8134,7 +8165,7 @@ "x-appwrite": { "method": "updateDatetimeAttribute", "group": "attributes", - "weight": 349, + "weight": 307, "cookies": false, "type": "", "demo": "databases\/update-datetime-attribute.md", @@ -8249,7 +8280,7 @@ "x-appwrite": { "method": "createEmailAttribute", "group": "attributes", - "weight": 350, + "weight": 308, "cookies": false, "type": "", "demo": "databases\/create-email-attribute.md", @@ -8318,6 +8349,7 @@ "description": "Default value for attribute when not provided. Cannot be set when attribute is required.", "default": null, "x-example": "email@example.com", + "format": "email", "x-nullable": true }, "array": { @@ -8362,7 +8394,7 @@ "x-appwrite": { "method": "updateEmailAttribute", "group": "attributes", - "weight": 351, + "weight": 309, "cookies": false, "type": "", "demo": "databases\/update-email-attribute.md", @@ -8432,6 +8464,7 @@ "description": "Default value for attribute when not provided. Cannot be set when attribute is required.", "default": null, "x-example": "email@example.com", + "format": "email", "x-nullable": true }, "newKey": { @@ -8477,7 +8510,7 @@ "x-appwrite": { "method": "createEnumAttribute", "group": "attributes", - "weight": 352, + "weight": 310, "cookies": false, "type": "", "demo": "databases\/create-enum-attribute.md", @@ -8600,7 +8633,7 @@ "x-appwrite": { "method": "updateEnumAttribute", "group": "attributes", - "weight": 353, + "weight": 311, "cookies": false, "type": "", "demo": "databases\/update-enum-attribute.md", @@ -8725,7 +8758,7 @@ "x-appwrite": { "method": "createFloatAttribute", "group": "attributes", - "weight": 354, + "weight": 312, "cookies": false, "type": "", "demo": "databases\/create-float-attribute.md", @@ -8794,6 +8827,7 @@ "description": "Minimum value.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "max": { @@ -8801,6 +8835,7 @@ "description": "Maximum value.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "default": { @@ -8808,6 +8843,7 @@ "description": "Default value. Cannot be set when required.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "array": { @@ -8852,7 +8888,7 @@ "x-appwrite": { "method": "updateFloatAttribute", "group": "attributes", - "weight": 355, + "weight": 313, "cookies": false, "type": "", "demo": "databases\/update-float-attribute.md", @@ -8922,6 +8958,7 @@ "description": "Minimum value.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "max": { @@ -8929,6 +8966,7 @@ "description": "Maximum value.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "default": { @@ -8936,6 +8974,7 @@ "description": "Default value. Cannot be set when required.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "newKey": { @@ -8981,7 +9020,7 @@ "x-appwrite": { "method": "createIntegerAttribute", "group": "attributes", - "weight": 356, + "weight": 314, "cookies": false, "type": "", "demo": "databases\/create-integer-attribute.md", @@ -9050,6 +9089,7 @@ "description": "Minimum value", "default": null, "x-example": null, + "format": "int64", "x-nullable": true }, "max": { @@ -9057,6 +9097,7 @@ "description": "Maximum value", "default": null, "x-example": null, + "format": "int64", "x-nullable": true }, "default": { @@ -9064,6 +9105,7 @@ "description": "Default value. Cannot be set when attribute is required.", "default": null, "x-example": null, + "format": "int64", "x-nullable": true }, "array": { @@ -9108,7 +9150,7 @@ "x-appwrite": { "method": "updateIntegerAttribute", "group": "attributes", - "weight": 357, + "weight": 315, "cookies": false, "type": "", "demo": "databases\/update-integer-attribute.md", @@ -9178,6 +9220,7 @@ "description": "Minimum value", "default": null, "x-example": null, + "format": "int64", "x-nullable": true }, "max": { @@ -9185,6 +9228,7 @@ "description": "Maximum value", "default": null, "x-example": null, + "format": "int64", "x-nullable": true }, "default": { @@ -9192,6 +9236,7 @@ "description": "Default value. Cannot be set when attribute is required.", "default": null, "x-example": null, + "format": "int64", "x-nullable": true }, "newKey": { @@ -9237,7 +9282,7 @@ "x-appwrite": { "method": "createIpAttribute", "group": "attributes", - "weight": 358, + "weight": 316, "cookies": false, "type": "", "demo": "databases\/create-ip-attribute.md", @@ -9350,7 +9395,7 @@ "x-appwrite": { "method": "updateIpAttribute", "group": "attributes", - "weight": 359, + "weight": 317, "cookies": false, "type": "", "demo": "databases\/update-ip-attribute.md", @@ -9465,7 +9510,7 @@ "x-appwrite": { "method": "createLineAttribute", "group": "attributes", - "weight": 360, + "weight": 318, "cookies": false, "type": "", "demo": "databases\/create-line-attribute.md", @@ -9572,7 +9617,7 @@ "x-appwrite": { "method": "updateLineAttribute", "group": "attributes", - "weight": 361, + "weight": 319, "cookies": false, "type": "", "demo": "databases\/update-line-attribute.md", @@ -9686,7 +9731,7 @@ "x-appwrite": { "method": "createPointAttribute", "group": "attributes", - "weight": 362, + "weight": 320, "cookies": false, "type": "", "demo": "databases\/create-point-attribute.md", @@ -9793,7 +9838,7 @@ "x-appwrite": { "method": "updatePointAttribute", "group": "attributes", - "weight": 363, + "weight": 321, "cookies": false, "type": "", "demo": "databases\/update-point-attribute.md", @@ -9907,7 +9952,7 @@ "x-appwrite": { "method": "createPolygonAttribute", "group": "attributes", - "weight": 364, + "weight": 322, "cookies": false, "type": "", "demo": "databases\/create-polygon-attribute.md", @@ -10014,7 +10059,7 @@ "x-appwrite": { "method": "updatePolygonAttribute", "group": "attributes", - "weight": 365, + "weight": 323, "cookies": false, "type": "", "demo": "databases\/update-polygon-attribute.md", @@ -10128,7 +10173,7 @@ "x-appwrite": { "method": "createRelationshipAttribute", "group": "attributes", - "weight": 366, + "weight": 324, "cookies": false, "type": "", "demo": "databases\/create-relationship-attribute.md", @@ -10269,7 +10314,7 @@ "x-appwrite": { "method": "createStringAttribute", "group": "attributes", - "weight": 368, + "weight": 326, "cookies": false, "type": "", "demo": "databases\/create-string-attribute.md", @@ -10331,7 +10376,8 @@ "type": "integer", "description": "Attribute size for text attributes, in number of characters.", "default": null, - "x-example": 1 + "x-example": 1, + "format": "int32" }, "required": { "type": "boolean", @@ -10395,7 +10441,7 @@ "x-appwrite": { "method": "updateStringAttribute", "group": "attributes", - "weight": 369, + "weight": 327, "cookies": false, "type": "", "demo": "databases\/update-string-attribute.md", @@ -10472,6 +10518,7 @@ "description": "Maximum size of the string attribute.", "default": null, "x-example": 1, + "format": "int32", "x-nullable": true }, "newKey": { @@ -10517,7 +10564,7 @@ "x-appwrite": { "method": "createUrlAttribute", "group": "attributes", - "weight": 370, + "weight": 328, "cookies": false, "type": "", "demo": "databases\/create-url-attribute.md", @@ -10586,6 +10633,7 @@ "description": "Default value for attribute when not provided. Cannot be set when attribute is required.", "default": null, "x-example": "https:\/\/example.com", + "format": "url", "x-nullable": true }, "array": { @@ -10630,7 +10678,7 @@ "x-appwrite": { "method": "updateUrlAttribute", "group": "attributes", - "weight": 371, + "weight": 329, "cookies": false, "type": "", "demo": "databases\/update-url-attribute.md", @@ -10700,6 +10748,7 @@ "description": "Default value for attribute when not provided. Cannot be set when attribute is required.", "default": null, "x-example": "https:\/\/example.com", + "format": "url", "x-nullable": true }, "newKey": { @@ -10774,7 +10823,7 @@ "x-appwrite": { "method": "getAttribute", "group": "attributes", - "weight": 343, + "weight": 301, "cookies": false, "type": "", "demo": "databases\/get-attribute.md", @@ -10849,7 +10898,7 @@ "x-appwrite": { "method": "deleteAttribute", "group": "attributes", - "weight": 344, + "weight": 302, "cookies": false, "type": "", "demo": "databases\/delete-attribute.md", @@ -10931,7 +10980,7 @@ "x-appwrite": { "method": "updateRelationshipAttribute", "group": "attributes", - "weight": 367, + "weight": 325, "cookies": false, "type": "", "demo": "databases\/update-relationship-attribute.md", @@ -11041,7 +11090,7 @@ "x-appwrite": { "method": "listDocuments", "group": "documents", - "weight": 339, + "weight": 297, "cookies": false, "type": "", "demo": "databases\/list-documents.md", @@ -11145,7 +11194,7 @@ "x-appwrite": { "method": "createDocument", "group": "documents", - "weight": 331, + "weight": 289, "cookies": false, "type": "", "demo": "databases\/create-document.md", @@ -11336,7 +11385,7 @@ "x-appwrite": { "method": "upsertDocuments", "group": "documents", - "weight": 336, + "weight": 294, "cookies": false, "type": "", "demo": "databases\/upsert-documents.md", @@ -11471,7 +11520,7 @@ "x-appwrite": { "method": "updateDocuments", "group": "documents", - "weight": 334, + "weight": 292, "cookies": false, "type": "", "demo": "databases\/update-documents.md", @@ -11575,7 +11624,7 @@ "x-appwrite": { "method": "deleteDocuments", "group": "documents", - "weight": 338, + "weight": 296, "cookies": false, "type": "", "demo": "databases\/delete-documents.md", @@ -11673,7 +11722,7 @@ "x-appwrite": { "method": "getDocument", "group": "documents", - "weight": 332, + "weight": 290, "cookies": false, "type": "", "demo": "databases\/get-document.md", @@ -11776,7 +11825,7 @@ "x-appwrite": { "method": "upsertDocument", "group": "documents", - "weight": 335, + "weight": 293, "cookies": false, "type": "", "demo": "databases\/upsert-document.md", @@ -11927,7 +11976,7 @@ "x-appwrite": { "method": "updateDocument", "group": "documents", - "weight": 333, + "weight": 291, "cookies": false, "type": "", "demo": "databases\/update-document.md", @@ -12037,7 +12086,7 @@ "x-appwrite": { "method": "deleteDocument", "group": "documents", - "weight": 337, + "weight": 295, "cookies": false, "type": "", "demo": "databases\/delete-document.md", @@ -12136,7 +12185,7 @@ "x-appwrite": { "method": "listDocumentLogs", "group": "logs", - "weight": 340, + "weight": 298, "cookies": false, "type": "", "demo": "databases\/list-document-logs.md", @@ -12229,7 +12278,7 @@ "x-appwrite": { "method": "decrementDocumentAttribute", "group": "documents", - "weight": 342, + "weight": 300, "cookies": false, "type": "", "demo": "databases\/decrement-document-attribute.md", @@ -12302,13 +12351,15 @@ "type": "number", "description": "Value to increment the attribute by. The value must be a number.", "default": 1, - "x-example": null + "x-example": null, + "format": "float" }, "min": { "type": "number", "description": "Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "transactionId": { @@ -12350,7 +12401,7 @@ "x-appwrite": { "method": "incrementDocumentAttribute", "group": "documents", - "weight": 341, + "weight": 299, "cookies": false, "type": "", "demo": "databases\/increment-document-attribute.md", @@ -12423,13 +12474,15 @@ "type": "number", "description": "Value to increment the attribute by. The value must be a number.", "default": 1, - "x-example": null + "x-example": null, + "format": "float" }, "max": { "type": "number", "description": "Maximum value for the attribute. If the current value is greater than this value, an error will be thrown.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "transactionId": { @@ -12469,7 +12522,7 @@ "x-appwrite": { "method": "listIndexes", "group": "indexes", - "weight": 375, + "weight": 333, "cookies": false, "type": "", "demo": "databases\/list-indexes.md", @@ -12563,7 +12616,7 @@ "x-appwrite": { "method": "createIndex", "group": "indexes", - "weight": 372, + "weight": 330, "cookies": false, "type": "", "demo": "databases\/create-index.md", @@ -12703,7 +12756,7 @@ "x-appwrite": { "method": "getIndex", "group": "indexes", - "weight": 373, + "weight": 331, "cookies": false, "type": "", "demo": "databases\/get-index.md", @@ -12778,7 +12831,7 @@ "x-appwrite": { "method": "deleteIndex", "group": "indexes", - "weight": 374, + "weight": 332, "cookies": false, "type": "", "demo": "databases\/delete-index.md", @@ -12858,7 +12911,7 @@ "x-appwrite": { "method": "listCollectionLogs", "group": "collections", - "weight": 329, + "weight": 287, "cookies": false, "type": "", "demo": "databases\/list-collection-logs.md", @@ -12941,7 +12994,7 @@ "x-appwrite": { "method": "getCollectionUsage", "group": null, - "weight": 330, + "weight": 288, "cookies": false, "type": "", "demo": "databases\/get-collection-usage.md", @@ -13032,7 +13085,7 @@ "x-appwrite": { "method": "listLogs", "group": "logs", - "weight": 321, + "weight": 279, "cookies": false, "type": "", "demo": "databases\/list-logs.md", @@ -13137,7 +13190,7 @@ "x-appwrite": { "method": "getUsage", "group": null, - "weight": 322, + "weight": 280, "cookies": false, "type": "", "demo": "databases\/get-usage.md", @@ -13250,7 +13303,7 @@ "x-appwrite": { "method": "list", "group": "functions", - "weight": 456, + "weight": 415, "cookies": false, "type": "", "demo": "functions\/list.md", @@ -13332,7 +13385,7 @@ "x-appwrite": { "method": "create", "group": "functions", - "weight": 453, + "weight": 412, "cookies": false, "type": "", "demo": "functions\/create.md", @@ -13480,7 +13533,8 @@ "type": "integer", "description": "Function maximum execution time in seconds.", "default": 15, - "x-example": 1 + "x-example": 1, + "format": "int32" }, "enabled": { "type": "boolean", @@ -13645,7 +13699,7 @@ "x-appwrite": { "method": "listRuntimes", "group": "runtimes", - "weight": 458, + "weight": 417, "cookies": false, "type": "", "demo": "functions\/list-runtimes.md", @@ -13695,7 +13749,7 @@ "x-appwrite": { "method": "listSpecifications", "group": "runtimes", - "weight": 459, + "weight": 418, "cookies": false, "type": "", "demo": "functions\/list-specifications.md", @@ -13745,7 +13799,7 @@ "x-appwrite": { "method": "listTemplates", "group": "templates", - "weight": 482, + "weight": 441, "cookies": false, "type": "", "demo": "functions\/list-templates.md", @@ -13929,7 +13983,7 @@ "x-appwrite": { "method": "getTemplate", "group": "templates", - "weight": 481, + "weight": 440, "cookies": false, "type": "", "demo": "functions\/get-template.md", @@ -13987,7 +14041,7 @@ "x-appwrite": { "method": "listUsage", "group": null, - "weight": 475, + "weight": 434, "cookies": false, "type": "", "demo": "functions\/list-usage.md", @@ -14057,7 +14111,7 @@ "x-appwrite": { "method": "get", "group": "functions", - "weight": 454, + "weight": 413, "cookies": false, "type": "", "demo": "functions\/get.md", @@ -14117,7 +14171,7 @@ "x-appwrite": { "method": "update", "group": "functions", - "weight": 455, + "weight": 414, "cookies": false, "type": "", "demo": "functions\/update.md", @@ -14267,7 +14321,8 @@ "type": "integer", "description": "Maximum execution time in seconds.", "default": 15, - "x-example": 1 + "x-example": 1, + "format": "int32" }, "enabled": { "type": "boolean", @@ -14426,7 +14481,7 @@ "x-appwrite": { "method": "delete", "group": "functions", - "weight": 457, + "weight": 416, "cookies": false, "type": "", "demo": "functions\/delete.md", @@ -14488,7 +14543,7 @@ "x-appwrite": { "method": "updateFunctionDeployment", "group": "functions", - "weight": 462, + "weight": 421, "cookies": false, "type": "", "demo": "functions\/update-function-deployment.md", @@ -14566,7 +14621,7 @@ "x-appwrite": { "method": "listDeployments", "group": "deployments", - "weight": 463, + "weight": 422, "cookies": false, "type": "", "demo": "functions\/list-deployments.md", @@ -14656,7 +14711,7 @@ "x-appwrite": { "method": "createDeployment", "group": "deployments", - "weight": 460, + "weight": 419, "cookies": false, "type": "upload", "demo": "functions\/create-deployment.md", @@ -14749,7 +14804,7 @@ "x-appwrite": { "method": "createDuplicateDeployment", "group": "deployments", - "weight": 468, + "weight": 427, "cookies": false, "type": "", "demo": "functions\/create-duplicate-deployment.md", @@ -14835,7 +14890,7 @@ "x-appwrite": { "method": "createTemplateDeployment", "group": "deployments", - "weight": 465, + "weight": 424, "cookies": false, "type": "", "demo": "functions\/create-template-deployment.md", @@ -14956,7 +15011,7 @@ "x-appwrite": { "method": "createVcsDeployment", "group": "deployments", - "weight": 466, + "weight": 425, "cookies": false, "type": "", "demo": "functions\/create-vcs-deployment.md", @@ -15053,7 +15108,7 @@ "x-appwrite": { "method": "getDeployment", "group": "deployments", - "weight": 461, + "weight": 420, "cookies": false, "type": "", "demo": "functions\/get-deployment.md", @@ -15116,7 +15171,7 @@ "x-appwrite": { "method": "deleteDeployment", "group": "deployments", - "weight": 464, + "weight": 423, "cookies": false, "type": "", "demo": "functions\/delete-deployment.md", @@ -15184,7 +15239,7 @@ "x-appwrite": { "method": "getDeploymentDownload", "group": "deployments", - "weight": 467, + "weight": 426, "cookies": false, "type": "location", "demo": "functions\/get-deployment-download.md", @@ -15270,7 +15325,7 @@ "x-appwrite": { "method": "updateDeploymentStatus", "group": "deployments", - "weight": 469, + "weight": 428, "cookies": false, "type": "", "demo": "functions\/update-deployment-status.md", @@ -15338,7 +15393,7 @@ "x-appwrite": { "method": "listExecutions", "group": "executions", - "weight": 472, + "weight": 431, "cookies": false, "type": "", "demo": "functions\/list-executions.md", @@ -15421,7 +15476,7 @@ "x-appwrite": { "method": "createExecution", "group": "executions", - "weight": 470, + "weight": 429, "cookies": false, "type": "", "demo": "functions\/create-execution.md", @@ -15540,7 +15595,7 @@ "x-appwrite": { "method": "getExecution", "group": "executions", - "weight": 471, + "weight": 430, "cookies": false, "type": "", "demo": "functions\/get-execution.md", @@ -15605,7 +15660,7 @@ "x-appwrite": { "method": "deleteExecution", "group": "executions", - "weight": 473, + "weight": 432, "cookies": false, "type": "", "demo": "functions\/delete-execution.md", @@ -15673,7 +15728,7 @@ "x-appwrite": { "method": "getUsage", "group": null, - "weight": 474, + "weight": 433, "cookies": false, "type": "", "demo": "functions\/get-usage.md", @@ -15751,7 +15806,7 @@ "x-appwrite": { "method": "listVariables", "group": "variables", - "weight": 478, + "weight": 437, "cookies": false, "type": "", "demo": "functions\/list-variables.md", @@ -15811,7 +15866,7 @@ "x-appwrite": { "method": "createVariable", "group": "variables", - "weight": 476, + "weight": 435, "cookies": false, "type": "", "demo": "functions\/create-variable.md", @@ -15902,7 +15957,7 @@ "x-appwrite": { "method": "getVariable", "group": "variables", - "weight": 477, + "weight": 436, "cookies": false, "type": "", "demo": "functions\/get-variable.md", @@ -15970,7 +16025,7 @@ "x-appwrite": { "method": "updateVariable", "group": "variables", - "weight": 479, + "weight": 438, "cookies": false, "type": "", "demo": "functions\/update-variable.md", @@ -16065,7 +16120,7 @@ "x-appwrite": { "method": "deleteVariable", "group": "variables", - "weight": 480, + "weight": 439, "cookies": false, "type": "", "demo": "functions\/delete-variable.md", @@ -16135,7 +16190,7 @@ "x-appwrite": { "method": "query", "group": "graphql", - "weight": 241, + "weight": 190, "cookies": false, "type": "graphql", "demo": "graphql\/query.md", @@ -16210,7 +16265,7 @@ "x-appwrite": { "method": "mutation", "group": "graphql", - "weight": 240, + "weight": 189, "cookies": false, "type": "graphql", "demo": "graphql\/mutation.md", @@ -16283,7 +16338,7 @@ "x-appwrite": { "method": "get", "group": "health", - "weight": 69, + "weight": 442, "cookies": false, "type": "", "demo": "health\/get.md", @@ -16334,7 +16389,7 @@ "x-appwrite": { "method": "getAntivirus", "group": "health", - "weight": 90, + "weight": 451, "cookies": false, "type": "", "demo": "health\/get-antivirus.md", @@ -16375,9 +16430,9 @@ "description": "Check the Appwrite in-memory cache servers are up and connection is successful.", "responses": { "200": { - "description": "Health Status", + "description": "Status List", "schema": { - "$ref": "#\/definitions\/healthStatus" + "$ref": "#\/definitions\/healthStatusList" } } }, @@ -16385,7 +16440,7 @@ "x-appwrite": { "method": "getCache", "group": "health", - "weight": 72, + "weight": 445, "cookies": false, "type": "", "demo": "health\/get-cache.md", @@ -16436,7 +16491,7 @@ "x-appwrite": { "method": "getCertificate", "group": "health", - "weight": 77, + "weight": 448, "cookies": false, "type": "", "demo": "health\/get-certificate.md", @@ -16486,9 +16541,9 @@ "description": "Check the Appwrite database servers are up and connection is successful.", "responses": { "200": { - "description": "Health Status", + "description": "Status List", "schema": { - "$ref": "#\/definitions\/healthStatus" + "$ref": "#\/definitions\/healthStatusList" } } }, @@ -16496,7 +16551,7 @@ "x-appwrite": { "method": "getDB", "group": "health", - "weight": 71, + "weight": 444, "cookies": false, "type": "", "demo": "health\/get-db.md", @@ -16537,9 +16592,9 @@ "description": "Check the Appwrite pub-sub servers are up and connection is successful.", "responses": { "200": { - "description": "Health Status", + "description": "Status List", "schema": { - "$ref": "#\/definitions\/healthStatus" + "$ref": "#\/definitions\/healthStatusList" } } }, @@ -16547,7 +16602,7 @@ "x-appwrite": { "method": "getPubSub", "group": "health", - "weight": 73, + "weight": 446, "cookies": false, "type": "", "demo": "health\/get-pub-sub.md", @@ -16574,6 +16629,68 @@ ] } }, + "\/health\/queue\/audits": { + "get": { + "summary": "Get audits queue", + "operationId": "healthGetQueueAudits", + "consumes": [], + "produces": [ + "application\/json" + ], + "tags": [ + "health" + ], + "description": "Get the number of audit logs that are waiting to be processed in the Appwrite internal queue server.", + "responses": { + "200": { + "description": "Health Queue", + "schema": { + "$ref": "#\/definitions\/healthQueue" + } + } + }, + "deprecated": false, + "x-appwrite": { + "method": "getQueueAudits", + "group": "queue", + "weight": 452, + "cookies": false, + "type": "", + "demo": "health\/get-queue-audits.md", + "rate-limit": 0, + "rate-time": 3600, + "rate-key": "url:{url},ip:{ip}", + "scope": "health.read", + "platforms": [ + "console", + "server" + ], + "packaging": false, + "public": true, + "edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-audits.md", + "auth": { + "Project": [] + } + }, + "security": [ + { + "Project": [], + "Key": [] + } + ], + "parameters": [ + { + "name": "threshold", + "description": "Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.", + "required": false, + "type": "integer", + "format": "int32", + "default": 5000, + "in": "query" + } + ] + } + }, "\/health\/queue\/builds": { "get": { "summary": "Get builds queue", @@ -16598,7 +16715,7 @@ "x-appwrite": { "method": "getQueueBuilds", "group": "queue", - "weight": 79, + "weight": 456, "cookies": false, "type": "", "demo": "health\/get-queue-builds.md", @@ -16660,7 +16777,7 @@ "x-appwrite": { "method": "getQueueCertificates", "group": "queue", - "weight": 78, + "weight": 455, "cookies": false, "type": "", "demo": "health\/get-queue-certificates.md", @@ -16722,7 +16839,7 @@ "x-appwrite": { "method": "getQueueDatabases", "group": "queue", - "weight": 80, + "weight": 457, "cookies": false, "type": "", "demo": "health\/get-queue-databases.md", @@ -16793,7 +16910,7 @@ "x-appwrite": { "method": "getQueueDeletes", "group": "queue", - "weight": 81, + "weight": 458, "cookies": false, "type": "", "demo": "health\/get-queue-deletes.md", @@ -16855,7 +16972,7 @@ "x-appwrite": { "method": "getFailedJobs", "group": "queue", - "weight": 91, + "weight": 465, "cookies": false, "type": "", "demo": "health\/get-failed-jobs.md", @@ -16898,6 +17015,7 @@ "v1-webhooks", "v1-certificates", "v1-builds", + "v1-screenshots", "v1-messaging", "v1-migrations" ], @@ -16941,7 +17059,7 @@ "x-appwrite": { "method": "getQueueFunctions", "group": "queue", - "weight": 85, + "weight": 462, "cookies": false, "type": "", "demo": "health\/get-queue-functions.md", @@ -17003,7 +17121,7 @@ "x-appwrite": { "method": "getQueueLogs", "group": "queue", - "weight": 76, + "weight": 454, "cookies": false, "type": "", "demo": "health\/get-queue-logs.md", @@ -17065,7 +17183,7 @@ "x-appwrite": { "method": "getQueueMails", "group": "queue", - "weight": 82, + "weight": 459, "cookies": false, "type": "", "demo": "health\/get-queue-mails.md", @@ -17127,7 +17245,7 @@ "x-appwrite": { "method": "getQueueMessaging", "group": "queue", - "weight": 83, + "weight": 460, "cookies": false, "type": "", "demo": "health\/get-queue-messaging.md", @@ -17189,7 +17307,7 @@ "x-appwrite": { "method": "getQueueMigrations", "group": "queue", - "weight": 84, + "weight": 461, "cookies": false, "type": "", "demo": "health\/get-queue-migrations.md", @@ -17251,7 +17369,7 @@ "x-appwrite": { "method": "getQueueStatsResources", "group": "queue", - "weight": 86, + "weight": 463, "cookies": false, "type": "", "demo": "health\/get-queue-stats-resources.md", @@ -17313,7 +17431,7 @@ "x-appwrite": { "method": "getQueueUsage", "group": "queue", - "weight": 87, + "weight": 464, "cookies": false, "type": "", "demo": "health\/get-queue-usage.md", @@ -17375,7 +17493,7 @@ "x-appwrite": { "method": "getQueueWebhooks", "group": "queue", - "weight": 75, + "weight": 453, "cookies": false, "type": "", "demo": "health\/get-queue-webhooks.md", @@ -17437,7 +17555,7 @@ "x-appwrite": { "method": "getStorage", "group": "storage", - "weight": 89, + "weight": 450, "cookies": false, "type": "", "demo": "health\/get-storage.md", @@ -17488,7 +17606,7 @@ "x-appwrite": { "method": "getStorageLocal", "group": "storage", - "weight": 88, + "weight": 449, "cookies": false, "type": "", "demo": "health\/get-storage-local.md", @@ -17539,7 +17657,7 @@ "x-appwrite": { "method": "getTime", "group": "health", - "weight": 74, + "weight": 447, "cookies": false, "type": "", "demo": "health\/get-time.md", @@ -17590,7 +17708,7 @@ "x-appwrite": { "method": "get", "group": null, - "weight": 61, + "weight": 49, "cookies": false, "type": "", "demo": "locale\/get.md", @@ -17643,7 +17761,7 @@ "x-appwrite": { "method": "listCodes", "group": null, - "weight": 62, + "weight": 50, "cookies": false, "type": "", "demo": "locale\/list-codes.md", @@ -17696,7 +17814,7 @@ "x-appwrite": { "method": "listContinents", "group": null, - "weight": 66, + "weight": 54, "cookies": false, "type": "", "demo": "locale\/list-continents.md", @@ -17749,7 +17867,7 @@ "x-appwrite": { "method": "listCountries", "group": null, - "weight": 63, + "weight": 51, "cookies": false, "type": "", "demo": "locale\/list-countries.md", @@ -17802,7 +17920,7 @@ "x-appwrite": { "method": "listCountriesEU", "group": null, - "weight": 64, + "weight": 52, "cookies": false, "type": "", "demo": "locale\/list-countries-eu.md", @@ -17855,7 +17973,7 @@ "x-appwrite": { "method": "listCountriesPhones", "group": null, - "weight": 65, + "weight": 53, "cookies": false, "type": "", "demo": "locale\/list-countries-phones.md", @@ -17908,7 +18026,7 @@ "x-appwrite": { "method": "listCurrencies", "group": null, - "weight": 67, + "weight": 55, "cookies": false, "type": "", "demo": "locale\/list-currencies.md", @@ -17961,7 +18079,7 @@ "x-appwrite": { "method": "listLanguages", "group": null, - "weight": 68, + "weight": 56, "cookies": false, "type": "", "demo": "locale\/list-languages.md", @@ -18014,7 +18132,7 @@ "x-appwrite": { "method": "listMessages", "group": "messages", - "weight": 298, + "weight": 245, "cookies": false, "type": "", "demo": "messaging\/list-messages.md", @@ -18099,7 +18217,7 @@ "x-appwrite": { "method": "createEmail", "group": "messages", - "weight": 295, + "weight": 242, "cookies": false, "type": "", "demo": "messaging\/create-email.md", @@ -18259,7 +18377,7 @@ "x-appwrite": { "method": "updateEmail", "group": "messages", - "weight": 302, + "weight": 249, "cookies": false, "type": "", "demo": "messaging\/update-email.md", @@ -18426,7 +18544,7 @@ "x-appwrite": { "method": "createPush", "group": "messages", - "weight": 297, + "weight": 244, "cookies": false, "type": "", "demo": "messaging\/create-push.md", @@ -18550,7 +18668,8 @@ "type": "integer", "description": "Badge for push notification. Available only for iOS Platform.", "default": -1, - "x-example": null + "x-example": null, + "format": "int32" }, "draft": { "type": "boolean", @@ -18624,7 +18743,7 @@ "x-appwrite": { "method": "updatePush", "group": "messages", - "weight": 304, + "weight": 251, "cookies": false, "type": "", "demo": "messaging\/update-push.md", @@ -18762,6 +18881,7 @@ "description": "Badge for push notification. Available only for iOS platforms.", "default": null, "x-example": null, + "format": "int32", "x-nullable": true }, "draft": { @@ -18837,7 +18957,7 @@ "x-appwrite": { "method": "createSms", "group": "messages", - "weight": 296, + "weight": 243, "cookies": false, "type": "", "demo": "messaging\/create-sms.md", @@ -19027,7 +19147,7 @@ "x-appwrite": { "method": "updateSms", "group": "messages", - "weight": 303, + "weight": 250, "cookies": false, "type": "", "demo": "messaging\/update-sms.md", @@ -19216,7 +19336,7 @@ "x-appwrite": { "method": "getMessage", "group": "messages", - "weight": 301, + "weight": 248, "cookies": false, "type": "", "demo": "messaging\/get-message.md", @@ -19272,7 +19392,7 @@ "x-appwrite": { "method": "delete", "group": "messages", - "weight": 305, + "weight": 252, "cookies": false, "type": "", "demo": "messaging\/delete.md", @@ -19333,7 +19453,7 @@ "x-appwrite": { "method": "listMessageLogs", "group": "logs", - "weight": 299, + "weight": 246, "cookies": false, "type": "", "demo": "messaging\/list-message-logs.md", @@ -19415,7 +19535,7 @@ "x-appwrite": { "method": "listTargets", "group": "messages", - "weight": 300, + "weight": 247, "cookies": false, "type": "", "demo": "messaging\/list-targets.md", @@ -19497,7 +19617,7 @@ "x-appwrite": { "method": "listProviders", "group": "providers", - "weight": 269, + "weight": 216, "cookies": false, "type": "", "demo": "messaging\/list-providers.md", @@ -19582,7 +19702,7 @@ "x-appwrite": { "method": "createApnsProvider", "group": "providers", - "weight": 268, + "weight": 215, "cookies": false, "type": "", "demo": "messaging\/create-apns-provider.md", @@ -19771,7 +19891,7 @@ "x-appwrite": { "method": "updateApnsProvider", "group": "providers", - "weight": 282, + "weight": 229, "cookies": false, "type": "", "demo": "messaging\/update-apns-provider.md", @@ -19957,7 +20077,7 @@ "x-appwrite": { "method": "createFcmProvider", "group": "providers", - "weight": 267, + "weight": 214, "cookies": false, "type": "", "demo": "messaging\/create-fcm-provider.md", @@ -20115,7 +20235,7 @@ "x-appwrite": { "method": "updateFcmProvider", "group": "providers", - "weight": 281, + "weight": 228, "cookies": false, "type": "", "demo": "messaging\/update-fcm-provider.md", @@ -20269,7 +20389,7 @@ "x-appwrite": { "method": "createMailgunProvider", "group": "providers", - "weight": 258, + "weight": 205, "cookies": false, "type": "", "demo": "messaging\/create-mailgun-provider.md", @@ -20342,7 +20462,8 @@ "type": "string", "description": "Sender email address.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -20354,7 +20475,8 @@ "type": "string", "description": "Email set in the reply to field for the mail. Default value is sender email. Reply to email must have reply to name as well.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "enabled": { "type": "boolean", @@ -20399,7 +20521,7 @@ "x-appwrite": { "method": "updateMailgunProvider", "group": "providers", - "weight": 272, + "weight": 219, "cookies": false, "type": "", "demo": "messaging\/update-mailgun-provider.md", @@ -20481,7 +20603,8 @@ "type": "string", "description": "Sender email address.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -20527,7 +20650,7 @@ "x-appwrite": { "method": "createMsg91Provider", "group": "providers", - "weight": 262, + "weight": 209, "cookies": false, "type": "", "demo": "messaging\/create-msg-91-provider.md", @@ -20632,7 +20755,7 @@ "x-appwrite": { "method": "updateMsg91Provider", "group": "providers", - "weight": 276, + "weight": 223, "cookies": false, "type": "", "demo": "messaging\/update-msg-91-provider.md", @@ -20735,7 +20858,7 @@ "x-appwrite": { "method": "createResendProvider", "group": "providers", - "weight": 260, + "weight": 207, "cookies": false, "type": "", "demo": "messaging\/create-resend-provider.md", @@ -20795,7 +20918,8 @@ "type": "string", "description": "Sender email address.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -20807,7 +20931,8 @@ "type": "string", "description": "Email set in the reply to field for the mail. Default value is sender email.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "enabled": { "type": "boolean", @@ -20852,7 +20977,7 @@ "x-appwrite": { "method": "updateResendProvider", "group": "providers", - "weight": 274, + "weight": 221, "cookies": false, "type": "", "demo": "messaging\/update-resend-provider.md", @@ -20921,7 +21046,8 @@ "type": "string", "description": "Sender email address.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -20967,7 +21093,7 @@ "x-appwrite": { "method": "createSendgridProvider", "group": "providers", - "weight": 259, + "weight": 206, "cookies": false, "type": "", "demo": "messaging\/create-sendgrid-provider.md", @@ -21027,7 +21153,8 @@ "type": "string", "description": "Sender email address.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -21039,7 +21166,8 @@ "type": "string", "description": "Email set in the reply to field for the mail. Default value is sender email.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "enabled": { "type": "boolean", @@ -21084,7 +21212,7 @@ "x-appwrite": { "method": "updateSendgridProvider", "group": "providers", - "weight": 273, + "weight": 220, "cookies": false, "type": "", "demo": "messaging\/update-sendgrid-provider.md", @@ -21153,7 +21281,8 @@ "type": "string", "description": "Sender email address.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -21199,7 +21328,7 @@ "x-appwrite": { "method": "createSmtpProvider", "group": "providers", - "weight": 261, + "weight": 208, "cookies": false, "type": "", "demo": "messaging\/create-smtp-provider.md", @@ -21339,7 +21468,8 @@ "type": "integer", "description": "The default SMTP server port.", "default": 587, - "x-example": 1 + "x-example": 1, + "format": "int32" }, "username": { "type": "string", @@ -21388,7 +21518,8 @@ "type": "string", "description": "Sender email address.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -21400,7 +21531,8 @@ "type": "string", "description": "Email set in the reply to field for the mail. Default value is sender email.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "enabled": { "type": "boolean", @@ -21446,7 +21578,7 @@ "x-appwrite": { "method": "updateSmtpProvider", "group": "providers", - "weight": 275, + "weight": 222, "cookies": false, "type": "", "demo": "messaging\/update-smtp-provider.md", @@ -21585,6 +21717,7 @@ "description": "SMTP port.", "default": null, "x-example": 1, + "format": "int32", "x-nullable": true }, "username": { @@ -21635,7 +21768,8 @@ "type": "string", "description": "Sender email address.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -21688,7 +21822,7 @@ "x-appwrite": { "method": "createTelesignProvider", "group": "providers", - "weight": 263, + "weight": 210, "cookies": false, "type": "", "demo": "messaging\/create-telesign-provider.md", @@ -21736,7 +21870,8 @@ "type": "string", "description": "Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", "default": "", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "customerId": { "type": "string", @@ -21793,7 +21928,7 @@ "x-appwrite": { "method": "updateTelesignProvider", "group": "providers", - "weight": 277, + "weight": 224, "cookies": false, "type": "", "demo": "messaging\/update-telesign-provider.md", @@ -21896,7 +22031,7 @@ "x-appwrite": { "method": "createTextmagicProvider", "group": "providers", - "weight": 264, + "weight": 211, "cookies": false, "type": "", "demo": "messaging\/create-textmagic-provider.md", @@ -21944,7 +22079,8 @@ "type": "string", "description": "Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", "default": "", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "username": { "type": "string", @@ -22001,7 +22137,7 @@ "x-appwrite": { "method": "updateTextmagicProvider", "group": "providers", - "weight": 278, + "weight": 225, "cookies": false, "type": "", "demo": "messaging\/update-textmagic-provider.md", @@ -22104,7 +22240,7 @@ "x-appwrite": { "method": "createTwilioProvider", "group": "providers", - "weight": 265, + "weight": 212, "cookies": false, "type": "", "demo": "messaging\/create-twilio-provider.md", @@ -22152,7 +22288,8 @@ "type": "string", "description": "Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", "default": "", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "accountSid": { "type": "string", @@ -22209,7 +22346,7 @@ "x-appwrite": { "method": "updateTwilioProvider", "group": "providers", - "weight": 279, + "weight": 226, "cookies": false, "type": "", "demo": "messaging\/update-twilio-provider.md", @@ -22312,7 +22449,7 @@ "x-appwrite": { "method": "createVonageProvider", "group": "providers", - "weight": 266, + "weight": 213, "cookies": false, "type": "", "demo": "messaging\/create-vonage-provider.md", @@ -22360,7 +22497,8 @@ "type": "string", "description": "Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", "default": "", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "apiKey": { "type": "string", @@ -22417,7 +22555,7 @@ "x-appwrite": { "method": "updateVonageProvider", "group": "providers", - "weight": 280, + "weight": 227, "cookies": false, "type": "", "demo": "messaging\/update-vonage-provider.md", @@ -22518,7 +22656,7 @@ "x-appwrite": { "method": "getProvider", "group": "providers", - "weight": 271, + "weight": 218, "cookies": false, "type": "", "demo": "messaging\/get-provider.md", @@ -22574,7 +22712,7 @@ "x-appwrite": { "method": "deleteProvider", "group": "providers", - "weight": 283, + "weight": 230, "cookies": false, "type": "", "demo": "messaging\/delete-provider.md", @@ -22635,7 +22773,7 @@ "x-appwrite": { "method": "listProviderLogs", "group": "providers", - "weight": 270, + "weight": 217, "cookies": false, "type": "", "demo": "messaging\/list-provider-logs.md", @@ -22717,7 +22855,7 @@ "x-appwrite": { "method": "listSubscriberLogs", "group": "subscribers", - "weight": 292, + "weight": 239, "cookies": false, "type": "", "demo": "messaging\/list-subscriber-logs.md", @@ -22799,7 +22937,7 @@ "x-appwrite": { "method": "listTopics", "group": "topics", - "weight": 285, + "weight": 232, "cookies": false, "type": "", "demo": "messaging\/list-topics.md", @@ -22882,7 +23020,7 @@ "x-appwrite": { "method": "createTopic", "group": "topics", - "weight": 284, + "weight": 231, "cookies": false, "type": "", "demo": "messaging\/create-topic.md", @@ -22971,7 +23109,7 @@ "x-appwrite": { "method": "getTopic", "group": "topics", - "weight": 287, + "weight": 234, "cookies": false, "type": "", "demo": "messaging\/get-topic.md", @@ -23032,7 +23170,7 @@ "x-appwrite": { "method": "updateTopic", "group": "topics", - "weight": 288, + "weight": 235, "cookies": false, "type": "", "demo": "messaging\/update-topic.md", @@ -23114,7 +23252,7 @@ "x-appwrite": { "method": "deleteTopic", "group": "topics", - "weight": 289, + "weight": 236, "cookies": false, "type": "", "demo": "messaging\/delete-topic.md", @@ -23175,7 +23313,7 @@ "x-appwrite": { "method": "listTopicLogs", "group": "topics", - "weight": 286, + "weight": 233, "cookies": false, "type": "", "demo": "messaging\/list-topic-logs.md", @@ -23257,7 +23395,7 @@ "x-appwrite": { "method": "listSubscribers", "group": "subscribers", - "weight": 291, + "weight": 238, "cookies": false, "type": "", "demo": "messaging\/list-subscribers.md", @@ -23348,7 +23486,7 @@ "x-appwrite": { "method": "createSubscriber", "group": "subscribers", - "weight": 290, + "weight": 237, "cookies": false, "type": "", "demo": "messaging\/create-subscriber.md", @@ -23436,7 +23574,7 @@ "x-appwrite": { "method": "getSubscriber", "group": "subscribers", - "weight": 293, + "weight": 240, "cookies": false, "type": "", "demo": "messaging\/get-subscriber.md", @@ -23500,7 +23638,7 @@ "x-appwrite": { "method": "deleteSubscriber", "group": "subscribers", - "weight": 294, + "weight": 241, "cookies": false, "type": "", "demo": "messaging\/delete-subscriber.md", @@ -23571,7 +23709,7 @@ "x-appwrite": { "method": "list", "group": null, - "weight": 250, + "weight": 197, "cookies": false, "type": "", "demo": "migrations\/list.md", @@ -23654,7 +23792,7 @@ "x-appwrite": { "method": "createAppwriteMigration", "group": null, - "weight": 244, + "weight": 191, "cookies": false, "type": "", "demo": "migrations\/create-appwrite-migration.md", @@ -23717,7 +23855,8 @@ "type": "string", "description": "Source Appwrite endpoint", "default": null, - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" }, "projectId": { "type": "string", @@ -23767,7 +23906,7 @@ "x-appwrite": { "method": "getAppwriteReport", "group": null, - "weight": 252, + "weight": 199, "cookies": false, "type": "", "demo": "migrations\/get-appwrite-report.md", @@ -23876,7 +24015,7 @@ "x-appwrite": { "method": "createCSVExport", "group": null, - "weight": 249, + "weight": 196, "cookies": false, "type": "", "demo": "migrations\/create-csv-export.md", @@ -24002,7 +24141,7 @@ "x-appwrite": { "method": "createCSVImport", "group": null, - "weight": 248, + "weight": 195, "cookies": false, "type": "", "demo": "migrations\/create-csv-import.md", @@ -24093,7 +24232,7 @@ "x-appwrite": { "method": "createFirebaseMigration", "group": null, - "weight": 245, + "weight": 192, "cookies": false, "type": "", "demo": "migrations\/create-firebase-migration.md", @@ -24186,7 +24325,7 @@ "x-appwrite": { "method": "getFirebaseReport", "group": null, - "weight": 253, + "weight": 200, "cookies": false, "type": "", "demo": "migrations\/get-firebase-report.md", @@ -24272,7 +24411,7 @@ "x-appwrite": { "method": "createNHostMigration", "group": null, - "weight": 247, + "weight": 194, "cookies": false, "type": "", "demo": "migrations\/create-n-host-migration.md", @@ -24366,7 +24505,8 @@ "type": "integer", "description": "Source's Database Port", "default": 5432, - "x-example": null + "x-example": null, + "format": "int32" } }, "required": [ @@ -24407,7 +24547,7 @@ "x-appwrite": { "method": "getNHostReport", "group": null, - "weight": 255, + "weight": 202, "cookies": false, "type": "", "demo": "migrations\/get-n-host-report.md", @@ -24543,7 +24683,7 @@ "x-appwrite": { "method": "createSupabaseMigration", "group": null, - "weight": 246, + "weight": 193, "cookies": false, "type": "", "demo": "migrations\/create-supabase-migration.md", @@ -24601,7 +24741,8 @@ "type": "string", "description": "Source's Supabase Endpoint", "default": null, - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" }, "apiKey": { "type": "string", @@ -24631,7 +24772,8 @@ "type": "integer", "description": "Source's Database Port", "default": 5432, - "x-example": null + "x-example": null, + "format": "int32" } }, "required": [ @@ -24671,7 +24813,7 @@ "x-appwrite": { "method": "getSupabaseReport", "group": null, - "weight": 254, + "weight": 201, "cookies": false, "type": "", "demo": "migrations\/get-supabase-report.md", @@ -24798,7 +24940,7 @@ "x-appwrite": { "method": "get", "group": null, - "weight": 251, + "weight": 198, "cookies": false, "type": "", "demo": "migrations\/get.md", @@ -24857,7 +24999,7 @@ "x-appwrite": { "method": "retry", "group": null, - "weight": 256, + "weight": 203, "cookies": false, "type": "", "demo": "migrations\/retry.md", @@ -24911,7 +25053,7 @@ "x-appwrite": { "method": "delete", "group": null, - "weight": 257, + "weight": 204, "cookies": false, "type": "", "demo": "migrations\/delete.md", @@ -24970,7 +25112,7 @@ "x-appwrite": { "method": "getUsage", "group": null, - "weight": 139, + "weight": 103, "cookies": false, "type": "", "demo": "project\/get-usage.md", @@ -25053,7 +25195,7 @@ "x-appwrite": { "method": "listVariables", "group": null, - "weight": 141, + "weight": 105, "cookies": false, "type": "", "demo": "project\/list-variables.md", @@ -25102,7 +25244,7 @@ "x-appwrite": { "method": "createVariable", "group": null, - "weight": 140, + "weight": 104, "cookies": false, "type": "", "demo": "project\/create-variable.md", @@ -25184,7 +25326,7 @@ "x-appwrite": { "method": "getVariable", "group": null, - "weight": 142, + "weight": 106, "cookies": false, "type": "", "demo": "project\/get-variable.md", @@ -25243,7 +25385,7 @@ "x-appwrite": { "method": "updateVariable", "group": null, - "weight": 143, + "weight": 107, "cookies": false, "type": "", "demo": "project\/update-variable.md", @@ -25329,7 +25471,7 @@ "x-appwrite": { "method": "deleteVariable", "group": null, - "weight": 144, + "weight": 108, "cookies": false, "type": "", "demo": "project\/delete-variable.md", @@ -25388,7 +25530,7 @@ "x-appwrite": { "method": "list", "group": "projects", - "weight": 452, + "weight": 410, "cookies": false, "type": "", "demo": "projects\/list.md", @@ -25413,7 +25555,7 @@ "parameters": [ { "name": "queries", - "description": "Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https:\/\/appwrite.io\/docs\/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, teamId", + "description": "Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https:\/\/appwrite.io\/docs\/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, teamId, labels, search", "required": false, "type": "array", "collectionFormat": "multi", @@ -25468,7 +25610,7 @@ "x-appwrite": { "method": "create", "group": "projects", - "weight": 93, + "weight": 57, "cookies": false, "type": "", "demo": "projects\/create.md", @@ -25543,7 +25685,8 @@ "type": "string", "description": "Project URL.", "default": "", - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" }, "legalName": { "type": "string", @@ -25616,7 +25759,7 @@ "x-appwrite": { "method": "get", "group": "projects", - "weight": 94, + "weight": 58, "cookies": false, "type": "", "demo": "projects\/get.md", @@ -25675,7 +25818,7 @@ "x-appwrite": { "method": "update", "group": "projects", - "weight": 95, + "weight": 59, "cookies": false, "type": "", "demo": "projects\/update.md", @@ -25735,7 +25878,8 @@ "type": "string", "description": "Project URL.", "default": "", - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" }, "legalName": { "type": "string", @@ -25801,7 +25945,7 @@ "x-appwrite": { "method": "delete", "group": "projects", - "weight": 112, + "weight": 76, "cookies": false, "type": "", "demo": "projects\/delete.md", @@ -25862,7 +26006,7 @@ "x-appwrite": { "method": "updateApiStatus", "group": "projects", - "weight": 99, + "weight": 63, "cookies": false, "type": "", "demo": "projects\/update-api-status.md", @@ -26019,7 +26163,7 @@ "x-appwrite": { "method": "updateApiStatusAll", "group": "projects", - "weight": 100, + "weight": 64, "cookies": false, "type": "", "demo": "projects\/update-api-status-all.md", @@ -26158,7 +26302,7 @@ "x-appwrite": { "method": "updateAuthDuration", "group": "auth", - "weight": 105, + "weight": 69, "cookies": false, "type": "", "demo": "projects\/update-auth-duration.md", @@ -26200,7 +26344,8 @@ "type": "integer", "description": "Project session length in seconds. Max length: 31536000 seconds.", "default": null, - "x-example": 0 + "x-example": 0, + "format": "int32" } }, "required": [ @@ -26237,7 +26382,7 @@ "x-appwrite": { "method": "updateAuthLimit", "group": "auth", - "weight": 104, + "weight": 68, "cookies": false, "type": "", "demo": "projects\/update-auth-limit.md", @@ -26279,7 +26424,8 @@ "type": "integer", "description": "Set the max number of users allowed in this project. Use 0 for unlimited.", "default": null, - "x-example": 0 + "x-example": 0, + "format": "int32" } }, "required": [ @@ -26316,7 +26462,7 @@ "x-appwrite": { "method": "updateAuthSessionsLimit", "group": "auth", - "weight": 110, + "weight": 74, "cookies": false, "type": "", "demo": "projects\/update-auth-sessions-limit.md", @@ -26358,7 +26504,8 @@ "type": "integer", "description": "Set the max number of users allowed in this project. Value allowed is between 1-100. Default is 10", "default": null, - "x-example": 1 + "x-example": 1, + "format": "int32" } }, "required": [ @@ -26395,7 +26542,7 @@ "x-appwrite": { "method": "updateMembershipsPrivacy", "group": "auth", - "weight": 103, + "weight": 67, "cookies": false, "type": "", "demo": "projects\/update-memberships-privacy.md", @@ -26488,7 +26635,7 @@ "x-appwrite": { "method": "updateMockNumbers", "group": "auth", - "weight": 111, + "weight": 75, "cookies": false, "type": "", "demo": "projects\/update-mock-numbers.md", @@ -26570,7 +26717,7 @@ "x-appwrite": { "method": "updateAuthPasswordDictionary", "group": "auth", - "weight": 108, + "weight": 72, "cookies": false, "type": "", "demo": "projects\/update-auth-password-dictionary.md", @@ -26649,7 +26796,7 @@ "x-appwrite": { "method": "updateAuthPasswordHistory", "group": "auth", - "weight": 107, + "weight": 71, "cookies": false, "type": "", "demo": "projects\/update-auth-password-history.md", @@ -26691,7 +26838,8 @@ "type": "integer", "description": "Set the max number of passwords to store in user history. User can't choose a new password that is already stored in the password history list. Max number of passwords allowed in history is20. Default value is 0", "default": null, - "x-example": 0 + "x-example": 0, + "format": "int32" } }, "required": [ @@ -26728,7 +26876,7 @@ "x-appwrite": { "method": "updatePersonalDataCheck", "group": "auth", - "weight": 109, + "weight": 73, "cookies": false, "type": "", "demo": "projects\/update-personal-data-check.md", @@ -26807,7 +26955,7 @@ "x-appwrite": { "method": "updateSessionAlerts", "group": "auth", - "weight": 102, + "weight": 66, "cookies": false, "type": "", "demo": "projects\/update-session-alerts.md", @@ -26886,7 +27034,7 @@ "x-appwrite": { "method": "updateSessionInvalidation", "group": "auth", - "weight": 138, + "weight": 102, "cookies": false, "type": "", "demo": "projects\/update-session-invalidation.md", @@ -26965,7 +27113,7 @@ "x-appwrite": { "method": "updateAuthStatus", "group": "auth", - "weight": 106, + "weight": 70, "cookies": false, "type": "", "demo": "projects\/update-auth-status.md", @@ -27061,14 +27209,14 @@ "x-appwrite": { "method": "listDevKeys", "group": "devKeys", - "weight": 450, + "weight": 408, "cookies": false, "type": "", "demo": "projects\/list-dev-keys.md", "rate-limit": 0, "rate-time": 3600, "rate-key": "url:{url},ip:{ip}", - "scope": "projects.read", + "scope": "devKeys.read", "platforms": [ "console" ], @@ -27131,14 +27279,14 @@ "x-appwrite": { "method": "createDevKey", "group": "devKeys", - "weight": 447, + "weight": 405, "cookies": false, "type": "", "demo": "projects\/create-dev-key.md", "rate-limit": 0, "rate-time": 3600, "rate-key": "url:{url},ip:{ip}", - "scope": "projects.write", + "scope": "devKeys.write", "platforms": [ "console" ], @@ -27214,14 +27362,14 @@ "x-appwrite": { "method": "getDevKey", "group": "devKeys", - "weight": 449, + "weight": 407, "cookies": false, "type": "", "demo": "projects\/get-dev-key.md", "rate-limit": 0, "rate-time": 3600, "rate-key": "url:{url},ip:{ip}", - "scope": "projects.read", + "scope": "devKeys.read", "platforms": [ "console" ], @@ -27280,14 +27428,14 @@ "x-appwrite": { "method": "updateDevKey", "group": "devKeys", - "weight": 448, + "weight": 406, "cookies": false, "type": "", "demo": "projects\/update-dev-key.md", "rate-limit": 0, "rate-time": 3600, "rate-key": "url:{url},ip:{ip}", - "scope": "projects.write", + "scope": "devKeys.write", "platforms": [ "console" ], @@ -27366,14 +27514,14 @@ "x-appwrite": { "method": "deleteDevKey", "group": "devKeys", - "weight": 451, + "weight": 409, "cookies": false, "type": "", "demo": "projects\/delete-dev-key.md", "rate-limit": 0, "rate-time": 3600, "rate-key": "url:{url},ip:{ip}", - "scope": "projects.write", + "scope": "devKeys.write", "platforms": [ "console" ], @@ -27434,7 +27582,7 @@ "x-appwrite": { "method": "createJWT", "group": "auth", - "weight": 124, + "weight": 88, "cookies": false, "type": "", "demo": "projects\/create-jwt.md", @@ -27544,7 +27692,8 @@ "type": "integer", "description": "Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds.", "default": 900, - "x-example": 0 + "x-example": 0, + "format": "int32" } }, "required": [ @@ -27579,7 +27728,7 @@ "x-appwrite": { "method": "listKeys", "group": "keys", - "weight": 120, + "weight": 84, "cookies": false, "type": "", "demo": "projects\/list-keys.md", @@ -27647,7 +27796,7 @@ "x-appwrite": { "method": "createKey", "group": "keys", - "weight": 119, + "weight": 83, "cookies": false, "type": "", "demo": "projects\/create-key.md", @@ -27801,7 +27950,7 @@ "x-appwrite": { "method": "getKey", "group": "keys", - "weight": 121, + "weight": 85, "cookies": false, "type": "", "demo": "projects\/get-key.md", @@ -27868,7 +28017,7 @@ "x-appwrite": { "method": "updateKey", "group": "keys", - "weight": 122, + "weight": 86, "cookies": false, "type": "", "demo": "projects\/update-key.md", @@ -28025,7 +28174,7 @@ "x-appwrite": { "method": "deleteKey", "group": "keys", - "weight": 123, + "weight": 87, "cookies": false, "type": "", "demo": "projects\/delete-key.md", @@ -28068,6 +28217,87 @@ ] } }, + "\/projects\/{projectId}\/labels": { + "put": { + "summary": "Update project labels", + "operationId": "projectsUpdateLabels", + "consumes": [ + "application\/json" + ], + "produces": [ + "application\/json" + ], + "tags": [ + "projects" + ], + "description": "Update the project labels by its unique ID. Labels can be used to easily filter projects in an organization.", + "responses": { + "200": { + "description": "Project", + "schema": { + "$ref": "#\/definitions\/project" + } + } + }, + "deprecated": false, + "x-appwrite": { + "method": "updateLabels", + "group": "projects", + "weight": 411, + "cookies": false, + "type": "", + "demo": "projects\/update-labels.md", + "rate-limit": 0, + "rate-time": 3600, + "rate-key": "url:{url},ip:{ip}", + "scope": "projects.write", + "platforms": [ + "console" + ], + "packaging": false, + "public": true, + "auth": { + "Project": [] + } + }, + "security": [ + { + "Project": [] + } + ], + "parameters": [ + { + "name": "projectId", + "description": "Project unique ID.", + "required": true, + "type": "string", + "x-example": "", + "in": "path" + }, + { + "name": "payload", + "in": "body", + "schema": { + "type": "object", + "properties": { + "labels": { + "type": "array", + "description": "Array of project labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long.", + "default": null, + "x-example": null, + "items": { + "type": "string" + } + } + }, + "required": [ + "labels" + ] + } + } + ] + } + }, "\/projects\/{projectId}\/oauth2": { "patch": { "summary": "Update project OAuth2", @@ -28094,7 +28324,7 @@ "x-appwrite": { "method": "updateOAuth2", "group": "auth", - "weight": 101, + "weight": 65, "cookies": false, "type": "", "demo": "projects\/update-o-auth-2.md", @@ -28176,8 +28406,7 @@ "yammer", "yandex", "zoho", - "zoom", - "mock" + "zoom" ], "x-enum-name": "OAuthProvider", "x-enum-keys": [] @@ -28236,7 +28465,7 @@ "x-appwrite": { "method": "listPlatforms", "group": "platforms", - "weight": 126, + "weight": 90, "cookies": false, "type": "", "demo": "projects\/list-platforms.md", @@ -28304,7 +28533,7 @@ "x-appwrite": { "method": "createPlatform", "group": "platforms", - "weight": 125, + "weight": 89, "cookies": false, "type": "", "demo": "projects\/create-platform.md", @@ -28425,7 +28654,7 @@ "x-appwrite": { "method": "getPlatform", "group": "platforms", - "weight": 127, + "weight": 91, "cookies": false, "type": "", "demo": "projects\/get-platform.md", @@ -28492,7 +28721,7 @@ "x-appwrite": { "method": "updatePlatform", "group": "platforms", - "weight": 128, + "weight": 92, "cookies": false, "type": "", "demo": "projects\/update-platform.md", @@ -28590,7 +28819,7 @@ "x-appwrite": { "method": "deletePlatform", "group": "platforms", - "weight": 129, + "weight": 93, "cookies": false, "type": "", "demo": "projects\/delete-platform.md", @@ -28659,7 +28888,7 @@ "x-appwrite": { "method": "updateServiceStatus", "group": "projects", - "weight": 97, + "weight": 61, "cookies": false, "type": "", "demo": "projects\/update-service-status.md", @@ -28762,7 +28991,7 @@ "x-appwrite": { "method": "updateServiceStatusAll", "group": "projects", - "weight": 98, + "weight": 62, "cookies": false, "type": "", "demo": "projects\/update-service-status-all.md", @@ -28841,7 +29070,7 @@ "x-appwrite": { "method": "updateSmtp", "group": "templates", - "weight": 130, + "weight": 94, "cookies": false, "type": "", "demo": "projects\/update-smtp.md", @@ -28971,13 +29200,15 @@ "type": "string", "description": "Email of the sender", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyTo": { "type": "string", "description": "Reply to email", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "host": { "type": "string", @@ -28989,7 +29220,8 @@ "type": "integer", "description": "SMTP server port", "default": 587, - "x-example": null + "x-example": null, + "format": "int32" }, "username": { "type": "string", @@ -29047,7 +29279,7 @@ "x-appwrite": { "method": "createSmtpTest", "group": "templates", - "weight": 131, + "weight": 95, "cookies": false, "type": "", "demo": "projects\/create-smtp-test.md", @@ -29184,13 +29416,15 @@ "type": "string", "description": "Email of the sender", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyTo": { "type": "string", "description": "Reply to email", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "host": { "type": "string", @@ -29202,7 +29436,8 @@ "type": "integer", "description": "SMTP server port", "default": 587, - "x-example": null + "x-example": null, + "format": "int32" }, "username": { "type": "string", @@ -29266,7 +29501,7 @@ "x-appwrite": { "method": "updateTeam", "group": "projects", - "weight": 96, + "weight": 60, "cookies": false, "type": "", "demo": "projects\/update-team.md", @@ -29343,7 +29578,7 @@ "x-appwrite": { "method": "getEmailTemplate", "group": "templates", - "weight": 133, + "weight": 97, "cookies": false, "type": "", "demo": "projects\/get-email-template.md", @@ -29564,7 +29799,7 @@ "x-appwrite": { "method": "updateEmailTemplate", "group": "templates", - "weight": 135, + "weight": 99, "cookies": false, "type": "", "demo": "projects\/update-email-template.md", @@ -29786,13 +30021,15 @@ "type": "string", "description": "Email of the sender", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyTo": { "type": "string", "description": "Reply to email", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" } }, "required": [ @@ -29828,7 +30065,7 @@ "x-appwrite": { "method": "deleteEmailTemplate", "group": "templates", - "weight": 137, + "weight": 101, "cookies": false, "type": "", "demo": "projects\/delete-email-template.md", @@ -30049,7 +30286,7 @@ "x-appwrite": { "method": "getSmsTemplate", "group": "templates", - "weight": 132, + "weight": 96, "cookies": false, "type": "", "demo": "projects\/get-sms-template.md", @@ -30331,7 +30568,7 @@ "x-appwrite": { "method": "updateSmsTemplate", "group": "templates", - "weight": 134, + "weight": 98, "cookies": false, "type": "", "demo": "projects\/update-sms-template.md", @@ -30635,7 +30872,7 @@ "x-appwrite": { "method": "deleteSmsTemplate", "group": "templates", - "weight": 136, + "weight": 100, "cookies": false, "type": "", "demo": "projects\/delete-sms-template.md", @@ -30917,7 +31154,7 @@ "x-appwrite": { "method": "listWebhooks", "group": "webhooks", - "weight": 114, + "weight": 78, "cookies": false, "type": "", "demo": "projects\/list-webhooks.md", @@ -30985,7 +31222,7 @@ "x-appwrite": { "method": "createWebhook", "group": "webhooks", - "weight": 113, + "weight": 77, "cookies": false, "type": "", "demo": "projects\/create-webhook.md", @@ -31104,7 +31341,7 @@ "x-appwrite": { "method": "getWebhook", "group": "webhooks", - "weight": 115, + "weight": 79, "cookies": false, "type": "", "demo": "projects\/get-webhook.md", @@ -31171,7 +31408,7 @@ "x-appwrite": { "method": "updateWebhook", "group": "webhooks", - "weight": 116, + "weight": 80, "cookies": false, "type": "", "demo": "projects\/update-webhook.md", @@ -31293,7 +31530,7 @@ "x-appwrite": { "method": "deleteWebhook", "group": "webhooks", - "weight": 118, + "weight": 82, "cookies": false, "type": "", "demo": "projects\/delete-webhook.md", @@ -31362,7 +31599,7 @@ "x-appwrite": { "method": "updateWebhookSignature", "group": "webhooks", - "weight": 117, + "weight": 81, "cookies": false, "type": "", "demo": "projects\/update-webhook-signature.md", @@ -31429,7 +31666,7 @@ "x-appwrite": { "method": "listRules", "group": null, - "weight": 518, + "weight": 512, "cookies": false, "type": "", "demo": "proxy\/list-rules.md", @@ -31511,7 +31748,7 @@ "x-appwrite": { "method": "createAPIRule", "group": null, - "weight": 513, + "weight": 507, "cookies": false, "type": "", "demo": "proxy\/create-api-rule.md", @@ -31581,7 +31818,7 @@ "x-appwrite": { "method": "createFunctionRule", "group": null, - "weight": 515, + "weight": 509, "cookies": false, "type": "", "demo": "proxy\/create-function-rule.md", @@ -31664,7 +31901,7 @@ "x-appwrite": { "method": "createRedirectRule", "group": null, - "weight": 516, + "weight": 510, "cookies": false, "type": "", "demo": "proxy\/create-redirect-rule.md", @@ -31703,7 +31940,8 @@ "type": "string", "description": "Target URL of redirection", "default": null, - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" }, "statusCode": { "type": "string", @@ -31784,7 +32022,7 @@ "x-appwrite": { "method": "createSiteRule", "group": null, - "weight": 514, + "weight": 508, "cookies": false, "type": "", "demo": "proxy\/create-site-rule.md", @@ -31865,7 +32103,7 @@ "x-appwrite": { "method": "getRule", "group": null, - "weight": 517, + "weight": 511, "cookies": false, "type": "", "demo": "proxy\/get-rule.md", @@ -31918,7 +32156,7 @@ "x-appwrite": { "method": "deleteRule", "group": null, - "weight": 519, + "weight": 513, "cookies": false, "type": "", "demo": "proxy\/delete-rule.md", @@ -31978,7 +32216,7 @@ "x-appwrite": { "method": "updateRuleVerification", "group": null, - "weight": 520, + "weight": 514, "cookies": false, "type": "", "demo": "proxy\/update-rule-verification.md", @@ -32036,7 +32274,7 @@ "x-appwrite": { "method": "list", "group": "sites", - "weight": 485, + "weight": 469, "cookies": false, "type": "", "demo": "sites\/list.md", @@ -32118,7 +32356,7 @@ "x-appwrite": { "method": "create", "group": "sites", - "weight": 483, + "weight": 467, "cookies": false, "type": "", "demo": "sites\/create.md", @@ -32202,7 +32440,8 @@ "type": "integer", "description": "Maximum request time in seconds.", "default": 30, - "x-example": 1 + "x-example": 1, + "format": "int32" }, "installCommand": { "type": "string", @@ -32389,7 +32628,7 @@ "x-appwrite": { "method": "listFrameworks", "group": "frameworks", - "weight": 488, + "weight": 472, "cookies": false, "type": "", "demo": "sites\/list-frameworks.md", @@ -32439,7 +32678,7 @@ "x-appwrite": { "method": "listSpecifications", "group": "frameworks", - "weight": 511, + "weight": 495, "cookies": false, "type": "", "demo": "sites\/list-specifications.md", @@ -32489,7 +32728,7 @@ "x-appwrite": { "method": "listTemplates", "group": "templates", - "weight": 507, + "weight": 491, "cookies": false, "type": "", "demo": "sites\/list-templates.md", @@ -32612,7 +32851,7 @@ "x-appwrite": { "method": "getTemplate", "group": "templates", - "weight": 508, + "weight": 492, "cookies": false, "type": "", "demo": "sites\/get-template.md", @@ -32670,7 +32909,7 @@ "x-appwrite": { "method": "listUsage", "group": null, - "weight": 509, + "weight": 493, "cookies": false, "type": "", "demo": "sites\/list-usage.md", @@ -32740,7 +32979,7 @@ "x-appwrite": { "method": "get", "group": "sites", - "weight": 484, + "weight": 468, "cookies": false, "type": "", "demo": "sites\/get.md", @@ -32800,7 +33039,7 @@ "x-appwrite": { "method": "update", "group": "sites", - "weight": 486, + "weight": 470, "cookies": false, "type": "", "demo": "sites\/update.md", @@ -32886,7 +33125,8 @@ "type": "integer", "description": "Maximum request time in seconds.", "default": 30, - "x-example": 1 + "x-example": 1, + "format": "int32" }, "installCommand": { "type": "string", @@ -33066,7 +33306,7 @@ "x-appwrite": { "method": "delete", "group": "sites", - "weight": 487, + "weight": 471, "cookies": false, "type": "", "demo": "sites\/delete.md", @@ -33128,7 +33368,7 @@ "x-appwrite": { "method": "updateSiteDeployment", "group": "sites", - "weight": 494, + "weight": 478, "cookies": false, "type": "", "demo": "sites\/update-site-deployment.md", @@ -33206,7 +33446,7 @@ "x-appwrite": { "method": "listDeployments", "group": "deployments", - "weight": 493, + "weight": 477, "cookies": false, "type": "", "demo": "sites\/list-deployments.md", @@ -33296,7 +33536,7 @@ "x-appwrite": { "method": "createDeployment", "group": "deployments", - "weight": 489, + "weight": 473, "cookies": false, "type": "upload", "demo": "sites\/create-deployment.md", @@ -33397,7 +33637,7 @@ "x-appwrite": { "method": "createDuplicateDeployment", "group": "deployments", - "weight": 497, + "weight": 481, "cookies": false, "type": "", "demo": "sites\/create-duplicate-deployment.md", @@ -33477,7 +33717,7 @@ "x-appwrite": { "method": "createTemplateDeployment", "group": "deployments", - "weight": 490, + "weight": 474, "cookies": false, "type": "", "demo": "sites\/create-template-deployment.md", @@ -33598,7 +33838,7 @@ "x-appwrite": { "method": "createVcsDeployment", "group": "deployments", - "weight": 491, + "weight": 475, "cookies": false, "type": "", "demo": "sites\/create-vcs-deployment.md", @@ -33696,7 +33936,7 @@ "x-appwrite": { "method": "getDeployment", "group": "deployments", - "weight": 492, + "weight": 476, "cookies": false, "type": "", "demo": "sites\/get-deployment.md", @@ -33759,7 +33999,7 @@ "x-appwrite": { "method": "deleteDeployment", "group": "deployments", - "weight": 495, + "weight": 479, "cookies": false, "type": "", "demo": "sites\/delete-deployment.md", @@ -33827,7 +34067,7 @@ "x-appwrite": { "method": "getDeploymentDownload", "group": "deployments", - "weight": 496, + "weight": 480, "cookies": false, "type": "location", "demo": "sites\/get-deployment-download.md", @@ -33913,7 +34153,7 @@ "x-appwrite": { "method": "updateDeploymentStatus", "group": "deployments", - "weight": 498, + "weight": 482, "cookies": false, "type": "", "demo": "sites\/update-deployment-status.md", @@ -33981,7 +34221,7 @@ "x-appwrite": { "method": "listLogs", "group": "logs", - "weight": 500, + "weight": 484, "cookies": false, "type": "", "demo": "sites\/list-logs.md", @@ -34062,7 +34302,7 @@ "x-appwrite": { "method": "getLog", "group": "logs", - "weight": 499, + "weight": 483, "cookies": false, "type": "", "demo": "sites\/get-log.md", @@ -34127,7 +34367,7 @@ "x-appwrite": { "method": "deleteLog", "group": "logs", - "weight": 501, + "weight": 485, "cookies": false, "type": "", "demo": "sites\/delete-log.md", @@ -34195,7 +34435,7 @@ "x-appwrite": { "method": "getUsage", "group": null, - "weight": 510, + "weight": 494, "cookies": false, "type": "", "demo": "sites\/get-usage.md", @@ -34273,7 +34513,7 @@ "x-appwrite": { "method": "listVariables", "group": "variables", - "weight": 504, + "weight": 488, "cookies": false, "type": "", "demo": "sites\/list-variables.md", @@ -34333,7 +34573,7 @@ "x-appwrite": { "method": "createVariable", "group": "variables", - "weight": 502, + "weight": 486, "cookies": false, "type": "", "demo": "sites\/create-variable.md", @@ -34424,7 +34664,7 @@ "x-appwrite": { "method": "getVariable", "group": "variables", - "weight": 503, + "weight": 487, "cookies": false, "type": "", "demo": "sites\/get-variable.md", @@ -34492,7 +34732,7 @@ "x-appwrite": { "method": "updateVariable", "group": "variables", - "weight": 505, + "weight": 489, "cookies": false, "type": "", "demo": "sites\/update-variable.md", @@ -34587,7 +34827,7 @@ "x-appwrite": { "method": "deleteVariable", "group": "variables", - "weight": 506, + "weight": 490, "cookies": false, "type": "", "demo": "sites\/delete-variable.md", @@ -34655,7 +34895,7 @@ "x-appwrite": { "method": "listBuckets", "group": "buckets", - "weight": 146, + "weight": 522, "cookies": false, "type": "", "demo": "storage\/list-buckets.md", @@ -34738,7 +34978,7 @@ "x-appwrite": { "method": "createBucket", "group": "buckets", - "weight": 145, + "weight": 520, "cookies": false, "type": "", "demo": "storage\/create-bucket.md", @@ -34808,7 +35048,8 @@ "type": "integer", "description": "Maximum file size allowed in bytes. Maximum allowed value is 30MB.", "default": {}, - "x-example": 1 + "x-example": 1, + "format": "int32" }, "allowedFileExtensions": { "type": "array", @@ -34821,7 +35062,7 @@ }, "compression": { "type": "string", - "description": "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", + "description": "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", "default": "none", "x-example": "none", "enum": [ @@ -34884,7 +35125,7 @@ "x-appwrite": { "method": "getBucket", "group": "buckets", - "weight": 147, + "weight": 521, "cookies": false, "type": "", "demo": "storage\/get-bucket.md", @@ -34945,7 +35186,7 @@ "x-appwrite": { "method": "updateBucket", "group": "buckets", - "weight": 148, + "weight": 523, "cookies": false, "type": "", "demo": "storage\/update-bucket.md", @@ -35017,7 +35258,8 @@ "type": "integer", "description": "Maximum file size allowed in bytes. Maximum allowed value is 30MB.", "default": {}, - "x-example": 1 + "x-example": 1, + "format": "int32" }, "allowedFileExtensions": { "type": "array", @@ -35030,7 +35272,7 @@ }, "compression": { "type": "string", - "description": "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", + "description": "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", "default": "none", "x-example": "none", "enum": [ @@ -35087,7 +35329,7 @@ "x-appwrite": { "method": "deleteBucket", "group": "buckets", - "weight": 149, + "weight": 524, "cookies": false, "type": "", "demo": "storage\/delete-bucket.md", @@ -35148,7 +35390,7 @@ "x-appwrite": { "method": "listFiles", "group": "files", - "weight": 151, + "weight": 527, "cookies": false, "type": "", "demo": "storage\/list-files.md", @@ -35241,7 +35483,7 @@ "x-appwrite": { "method": "createFile", "group": "files", - "weight": 150, + "weight": 525, "cookies": false, "type": "upload", "demo": "storage\/create-file.md", @@ -35332,7 +35574,7 @@ "x-appwrite": { "method": "getFile", "group": "files", - "weight": 152, + "weight": 526, "cookies": false, "type": "", "demo": "storage\/get-file.md", @@ -35403,13 +35645,13 @@ "x-appwrite": { "method": "updateFile", "group": "files", - "weight": 157, + "weight": 528, "cookies": false, "type": "", "demo": "storage\/update-file.md", - "rate-limit": 60, - "rate-time": 60, - "rate-key": "ip:{ip},method:{method},url:{url},userId:{userId}", + "rate-limit": 0, + "rate-time": 3600, + "rate-key": "url:{url},ip:{ip}", "scope": "files.write", "platforms": [ "console", @@ -35433,7 +35675,7 @@ "parameters": [ { "name": "bucketId", - "description": "Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https:\/\/appwrite.io\/docs\/server\/storage#createBucket).", + "description": "Bucket unique ID.", "required": true, "type": "string", "x-example": "", @@ -35441,7 +35683,7 @@ }, { "name": "fileId", - "description": "File unique ID.", + "description": "File ID.", "required": true, "type": "string", "x-example": "", @@ -35455,14 +35697,13 @@ "properties": { "name": { "type": "string", - "description": "Name of the file", + "description": "File name.", "default": null, - "x-example": "", - "x-nullable": true + "x-example": "" }, "permissions": { "type": "array", - "description": "An array of permission string. By default, the current permissions are inherited. [Learn more about permissions](https:\/\/appwrite.io\/docs\/permissions).", + "description": "An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https:\/\/appwrite.io\/docs\/permissions).", "default": null, "x-example": "[\"read(\"any\")\"]", "x-nullable": true, @@ -35495,7 +35736,7 @@ "x-appwrite": { "method": "deleteFile", "group": "files", - "weight": 158, + "weight": 529, "cookies": false, "type": "", "demo": "storage\/delete-file.md", @@ -35566,7 +35807,7 @@ "x-appwrite": { "method": "getFileDownload", "group": "files", - "weight": 154, + "weight": 531, "cookies": false, "type": "location", "demo": "storage\/get-file-download.md", @@ -35646,7 +35887,7 @@ "x-appwrite": { "method": "getFilePreview", "group": "files", - "weight": 153, + "weight": 530, "cookies": false, "type": "location", "demo": "storage\/get-file-preview.md", @@ -35854,7 +36095,7 @@ "x-appwrite": { "method": "getFileView", "group": "files", - "weight": 155, + "weight": 532, "cookies": false, "type": "location", "demo": "storage\/get-file-view.md", @@ -35934,7 +36175,7 @@ "x-appwrite": { "method": "getUsage", "group": null, - "weight": 159, + "weight": 534, "cookies": false, "type": "", "demo": "storage\/get-usage.md", @@ -36005,7 +36246,7 @@ "x-appwrite": { "method": "getBucketUsage", "group": null, - "weight": 160, + "weight": 535, "cookies": false, "type": "", "demo": "storage\/get-bucket-usage.md", @@ -36084,7 +36325,7 @@ "x-appwrite": { "method": "list", "group": "tablesdb", - "weight": 386, + "weight": 344, "cookies": false, "type": "", "demo": "tablesdb\/list.md", @@ -36167,7 +36408,7 @@ "x-appwrite": { "method": "create", "group": "tablesdb", - "weight": 382, + "weight": 340, "cookies": false, "type": "", "demo": "tablesdb\/create.md", @@ -36251,7 +36492,7 @@ "x-appwrite": { "method": "listTransactions", "group": "transactions", - "weight": 445, + "weight": 403, "cookies": false, "type": "", "demo": "tablesdb\/list-transactions.md", @@ -36321,7 +36562,7 @@ "x-appwrite": { "method": "createTransaction", "group": "transactions", - "weight": 441, + "weight": 399, "cookies": false, "type": "", "demo": "tablesdb\/create-transaction.md", @@ -36362,7 +36603,8 @@ "type": "integer", "description": "Seconds before the transaction expires.", "default": 300, - "x-example": 60 + "x-example": 60, + "format": "int32" } } } @@ -36394,7 +36636,7 @@ "x-appwrite": { "method": "getTransaction", "group": "transactions", - "weight": 442, + "weight": 400, "cookies": false, "type": "", "demo": "tablesdb\/get-transaction.md", @@ -36460,7 +36702,7 @@ "x-appwrite": { "method": "updateTransaction", "group": "transactions", - "weight": 443, + "weight": 401, "cookies": false, "type": "", "demo": "tablesdb\/update-transaction.md", @@ -36542,7 +36784,7 @@ "x-appwrite": { "method": "deleteTransaction", "group": "transactions", - "weight": 444, + "weight": 402, "cookies": false, "type": "", "demo": "tablesdb\/delete-transaction.md", @@ -36610,7 +36852,7 @@ "x-appwrite": { "method": "createOperations", "group": "transactions", - "weight": 446, + "weight": 404, "cookies": false, "type": "", "demo": "tablesdb\/create-operations.md", @@ -36694,7 +36936,7 @@ "x-appwrite": { "method": "listUsage", "group": null, - "weight": 388, + "weight": 346, "cookies": false, "type": "", "demo": "tablesdb\/list-usage.md", @@ -36791,7 +37033,7 @@ "x-appwrite": { "method": "get", "group": "tablesdb", - "weight": 383, + "weight": 341, "cookies": false, "type": "", "demo": "tablesdb\/get.md", @@ -36852,7 +37094,7 @@ "x-appwrite": { "method": "update", "group": "tablesdb", - "weight": 384, + "weight": 342, "cookies": false, "type": "", "demo": "tablesdb\/update.md", @@ -36904,10 +37146,7 @@ "default": true, "x-example": false } - }, - "required": [ - "name" - ] + } } } ] @@ -36932,7 +37171,7 @@ "x-appwrite": { "method": "delete", "group": "tablesdb", - "weight": 385, + "weight": 343, "cookies": false, "type": "", "demo": "tablesdb\/delete.md", @@ -36993,7 +37232,7 @@ "x-appwrite": { "method": "listTables", "group": "tables", - "weight": 393, + "weight": 351, "cookies": false, "type": "", "demo": "tablesdb\/list-tables.md", @@ -37087,7 +37326,7 @@ "x-appwrite": { "method": "createTable", "group": "tables", - "weight": 389, + "weight": 347, "cookies": false, "type": "", "demo": "tablesdb\/create-table.md", @@ -37216,7 +37455,7 @@ "x-appwrite": { "method": "getTable", "group": "tables", - "weight": 390, + "weight": 348, "cookies": false, "type": "", "demo": "tablesdb\/get-table.md", @@ -37288,7 +37527,7 @@ "x-appwrite": { "method": "updateTable", "group": "tables", - "weight": 391, + "weight": 349, "cookies": false, "type": "", "demo": "tablesdb\/update-table.md", @@ -37367,10 +37606,7 @@ "default": true, "x-example": false } - }, - "required": [ - "name" - ] + } } } ] @@ -37395,7 +37631,7 @@ "x-appwrite": { "method": "deleteTable", "group": "tables", - "weight": 392, + "weight": 350, "cookies": false, "type": "", "demo": "tablesdb\/delete-table.md", @@ -37467,7 +37703,7 @@ "x-appwrite": { "method": "listColumns", "group": "columns", - "weight": 398, + "weight": 356, "cookies": false, "type": "", "demo": "tablesdb\/list-columns.md", @@ -37562,7 +37798,7 @@ "x-appwrite": { "method": "createBooleanColumn", "group": "columns", - "weight": 399, + "weight": 357, "cookies": false, "type": "", "demo": "tablesdb\/create-boolean-column.md", @@ -37674,7 +37910,7 @@ "x-appwrite": { "method": "updateBooleanColumn", "group": "columns", - "weight": 400, + "weight": 358, "cookies": false, "type": "", "demo": "tablesdb\/update-boolean-column.md", @@ -37788,7 +38024,7 @@ "x-appwrite": { "method": "createDatetimeColumn", "group": "columns", - "weight": 401, + "weight": 359, "cookies": false, "type": "", "demo": "tablesdb\/create-datetime-column.md", @@ -37900,7 +38136,7 @@ "x-appwrite": { "method": "updateDatetimeColumn", "group": "columns", - "weight": 402, + "weight": 360, "cookies": false, "type": "", "demo": "tablesdb\/update-datetime-column.md", @@ -38014,7 +38250,7 @@ "x-appwrite": { "method": "createEmailColumn", "group": "columns", - "weight": 403, + "weight": 361, "cookies": false, "type": "", "demo": "tablesdb\/create-email-column.md", @@ -38082,6 +38318,7 @@ "description": "Default value for column when not provided. Cannot be set when column is required.", "default": null, "x-example": "email@example.com", + "format": "email", "x-nullable": true }, "array": { @@ -38126,7 +38363,7 @@ "x-appwrite": { "method": "updateEmailColumn", "group": "columns", - "weight": 404, + "weight": 362, "cookies": false, "type": "", "demo": "tablesdb\/update-email-column.md", @@ -38195,6 +38432,7 @@ "description": "Default value for column when not provided. Cannot be set when column is required.", "default": null, "x-example": "email@example.com", + "format": "email", "x-nullable": true }, "newKey": { @@ -38240,7 +38478,7 @@ "x-appwrite": { "method": "createEnumColumn", "group": "columns", - "weight": 405, + "weight": 363, "cookies": false, "type": "", "demo": "tablesdb\/create-enum-column.md", @@ -38362,7 +38600,7 @@ "x-appwrite": { "method": "updateEnumColumn", "group": "columns", - "weight": 406, + "weight": 364, "cookies": false, "type": "", "demo": "tablesdb\/update-enum-column.md", @@ -38486,7 +38724,7 @@ "x-appwrite": { "method": "createFloatColumn", "group": "columns", - "weight": 407, + "weight": 365, "cookies": false, "type": "", "demo": "tablesdb\/create-float-column.md", @@ -38554,6 +38792,7 @@ "description": "Minimum value", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "max": { @@ -38561,6 +38800,7 @@ "description": "Maximum value", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "default": { @@ -38568,6 +38808,7 @@ "description": "Default value. Cannot be set when required.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "array": { @@ -38612,7 +38853,7 @@ "x-appwrite": { "method": "updateFloatColumn", "group": "columns", - "weight": 408, + "weight": 366, "cookies": false, "type": "", "demo": "tablesdb\/update-float-column.md", @@ -38681,6 +38922,7 @@ "description": "Minimum value", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "max": { @@ -38688,6 +38930,7 @@ "description": "Maximum value", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "default": { @@ -38695,6 +38938,7 @@ "description": "Default value. Cannot be set when required.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "newKey": { @@ -38740,7 +38984,7 @@ "x-appwrite": { "method": "createIntegerColumn", "group": "columns", - "weight": 409, + "weight": 367, "cookies": false, "type": "", "demo": "tablesdb\/create-integer-column.md", @@ -38808,6 +39052,7 @@ "description": "Minimum value", "default": null, "x-example": null, + "format": "int64", "x-nullable": true }, "max": { @@ -38815,6 +39060,7 @@ "description": "Maximum value", "default": null, "x-example": null, + "format": "int64", "x-nullable": true }, "default": { @@ -38822,6 +39068,7 @@ "description": "Default value. Cannot be set when column is required.", "default": null, "x-example": null, + "format": "int64", "x-nullable": true }, "array": { @@ -38866,7 +39113,7 @@ "x-appwrite": { "method": "updateIntegerColumn", "group": "columns", - "weight": 410, + "weight": 368, "cookies": false, "type": "", "demo": "tablesdb\/update-integer-column.md", @@ -38935,6 +39182,7 @@ "description": "Minimum value", "default": null, "x-example": null, + "format": "int64", "x-nullable": true }, "max": { @@ -38942,6 +39190,7 @@ "description": "Maximum value", "default": null, "x-example": null, + "format": "int64", "x-nullable": true }, "default": { @@ -38949,6 +39198,7 @@ "description": "Default value. Cannot be set when column is required.", "default": null, "x-example": null, + "format": "int64", "x-nullable": true }, "newKey": { @@ -38994,7 +39244,7 @@ "x-appwrite": { "method": "createIpColumn", "group": "columns", - "weight": 411, + "weight": 369, "cookies": false, "type": "", "demo": "tablesdb\/create-ip-column.md", @@ -39106,7 +39356,7 @@ "x-appwrite": { "method": "updateIpColumn", "group": "columns", - "weight": 412, + "weight": 370, "cookies": false, "type": "", "demo": "tablesdb\/update-ip-column.md", @@ -39220,7 +39470,7 @@ "x-appwrite": { "method": "createLineColumn", "group": "columns", - "weight": 413, + "weight": 371, "cookies": false, "type": "", "demo": "tablesdb\/create-line-column.md", @@ -39326,7 +39576,7 @@ "x-appwrite": { "method": "updateLineColumn", "group": "columns", - "weight": 414, + "weight": 372, "cookies": false, "type": "", "demo": "tablesdb\/update-line-column.md", @@ -39439,7 +39689,7 @@ "x-appwrite": { "method": "createPointColumn", "group": "columns", - "weight": 415, + "weight": 373, "cookies": false, "type": "", "demo": "tablesdb\/create-point-column.md", @@ -39545,7 +39795,7 @@ "x-appwrite": { "method": "updatePointColumn", "group": "columns", - "weight": 416, + "weight": 374, "cookies": false, "type": "", "demo": "tablesdb\/update-point-column.md", @@ -39658,7 +39908,7 @@ "x-appwrite": { "method": "createPolygonColumn", "group": "columns", - "weight": 417, + "weight": 375, "cookies": false, "type": "", "demo": "tablesdb\/create-polygon-column.md", @@ -39764,7 +40014,7 @@ "x-appwrite": { "method": "updatePolygonColumn", "group": "columns", - "weight": 418, + "weight": 376, "cookies": false, "type": "", "demo": "tablesdb\/update-polygon-column.md", @@ -39877,7 +40127,7 @@ "x-appwrite": { "method": "createRelationshipColumn", "group": "columns", - "weight": 419, + "weight": 377, "cookies": false, "type": "", "demo": "tablesdb\/create-relationship-column.md", @@ -40017,7 +40267,7 @@ "x-appwrite": { "method": "createStringColumn", "group": "columns", - "weight": 421, + "weight": 379, "cookies": false, "type": "", "demo": "tablesdb\/create-string-column.md", @@ -40078,7 +40328,8 @@ "type": "integer", "description": "Column size for text columns, in number of characters.", "default": null, - "x-example": 1 + "x-example": 1, + "format": "int32" }, "required": { "type": "boolean", @@ -40142,7 +40393,7 @@ "x-appwrite": { "method": "updateStringColumn", "group": "columns", - "weight": 422, + "weight": 380, "cookies": false, "type": "", "demo": "tablesdb\/update-string-column.md", @@ -40218,6 +40469,7 @@ "description": "Maximum size of the string column.", "default": null, "x-example": 1, + "format": "int32", "x-nullable": true }, "newKey": { @@ -40263,7 +40515,7 @@ "x-appwrite": { "method": "createUrlColumn", "group": "columns", - "weight": 423, + "weight": 381, "cookies": false, "type": "", "demo": "tablesdb\/create-url-column.md", @@ -40331,6 +40583,7 @@ "description": "Default value for column when not provided. Cannot be set when column is required.", "default": null, "x-example": "https:\/\/example.com", + "format": "url", "x-nullable": true }, "array": { @@ -40375,7 +40628,7 @@ "x-appwrite": { "method": "updateUrlColumn", "group": "columns", - "weight": 424, + "weight": 382, "cookies": false, "type": "", "demo": "tablesdb\/update-url-column.md", @@ -40444,6 +40697,7 @@ "description": "Default value for column when not provided. Cannot be set when column is required.", "default": null, "x-example": "https:\/\/example.com", + "format": "url", "x-nullable": true }, "newKey": { @@ -40518,7 +40772,7 @@ "x-appwrite": { "method": "getColumn", "group": "columns", - "weight": 396, + "weight": 354, "cookies": false, "type": "", "demo": "tablesdb\/get-column.md", @@ -40592,7 +40846,7 @@ "x-appwrite": { "method": "deleteColumn", "group": "columns", - "weight": 397, + "weight": 355, "cookies": false, "type": "", "demo": "tablesdb\/delete-column.md", @@ -40673,7 +40927,7 @@ "x-appwrite": { "method": "updateRelationshipColumn", "group": "columns", - "weight": 420, + "weight": 378, "cookies": false, "type": "", "demo": "tablesdb\/update-relationship-column.md", @@ -40782,7 +41036,7 @@ "x-appwrite": { "method": "listIndexes", "group": "indexes", - "weight": 428, + "weight": 386, "cookies": false, "type": "", "demo": "tablesdb\/list-indexes.md", @@ -40875,7 +41129,7 @@ "x-appwrite": { "method": "createIndex", "group": "indexes", - "weight": 425, + "weight": 383, "cookies": false, "type": "", "demo": "tablesdb\/create-index.md", @@ -41014,7 +41268,7 @@ "x-appwrite": { "method": "getIndex", "group": "indexes", - "weight": 426, + "weight": 384, "cookies": false, "type": "", "demo": "tablesdb\/get-index.md", @@ -41088,7 +41342,7 @@ "x-appwrite": { "method": "deleteIndex", "group": "indexes", - "weight": 427, + "weight": 385, "cookies": false, "type": "", "demo": "tablesdb\/delete-index.md", @@ -41167,7 +41421,7 @@ "x-appwrite": { "method": "listTableLogs", "group": "tables", - "weight": 394, + "weight": 352, "cookies": false, "type": "", "demo": "tablesdb\/list-table-logs.md", @@ -41249,7 +41503,7 @@ "x-appwrite": { "method": "listRows", "group": "rows", - "weight": 437, + "weight": 395, "cookies": false, "type": "", "demo": "tablesdb\/list-rows.md", @@ -41352,7 +41606,7 @@ "x-appwrite": { "method": "createRow", "group": "rows", - "weight": 429, + "weight": 387, "cookies": false, "type": "", "demo": "tablesdb\/create-row.md", @@ -41534,7 +41788,7 @@ "x-appwrite": { "method": "upsertRows", "group": "rows", - "weight": 434, + "weight": 392, "cookies": false, "type": "", "demo": "tablesdb\/upsert-rows.md", @@ -41664,7 +41918,7 @@ "x-appwrite": { "method": "updateRows", "group": "rows", - "weight": 432, + "weight": 390, "cookies": false, "type": "", "demo": "tablesdb\/update-rows.md", @@ -41767,7 +42021,7 @@ "x-appwrite": { "method": "deleteRows", "group": "rows", - "weight": 436, + "weight": 394, "cookies": false, "type": "", "demo": "tablesdb\/delete-rows.md", @@ -41864,7 +42118,7 @@ "x-appwrite": { "method": "getRow", "group": "rows", - "weight": 430, + "weight": 388, "cookies": false, "type": "", "demo": "tablesdb\/get-row.md", @@ -41966,7 +42220,7 @@ "x-appwrite": { "method": "upsertRow", "group": "rows", - "weight": 433, + "weight": 391, "cookies": false, "type": "", "demo": "tablesdb\/upsert-row.md", @@ -42112,7 +42366,7 @@ "x-appwrite": { "method": "updateRow", "group": "rows", - "weight": 431, + "weight": 389, "cookies": false, "type": "", "demo": "tablesdb\/update-row.md", @@ -42221,7 +42475,7 @@ "x-appwrite": { "method": "deleteRow", "group": "rows", - "weight": 435, + "weight": 393, "cookies": false, "type": "", "demo": "tablesdb\/delete-row.md", @@ -42319,7 +42573,7 @@ "x-appwrite": { "method": "listRowLogs", "group": "logs", - "weight": 438, + "weight": 396, "cookies": false, "type": "", "demo": "tablesdb\/list-row-logs.md", @@ -42411,7 +42665,7 @@ "x-appwrite": { "method": "decrementRowColumn", "group": "rows", - "weight": 440, + "weight": 398, "cookies": false, "type": "", "demo": "tablesdb\/decrement-row-column.md", @@ -42483,13 +42737,15 @@ "type": "number", "description": "Value to increment the column by. The value must be a number.", "default": 1, - "x-example": null + "x-example": null, + "format": "float" }, "min": { "type": "number", "description": "Minimum value for the column. If the current value is lesser than this value, an exception will be thrown.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "transactionId": { @@ -42531,7 +42787,7 @@ "x-appwrite": { "method": "incrementRowColumn", "group": "rows", - "weight": 439, + "weight": 397, "cookies": false, "type": "", "demo": "tablesdb\/increment-row-column.md", @@ -42603,13 +42859,15 @@ "type": "number", "description": "Value to increment the column by. The value must be a number.", "default": 1, - "x-example": null + "x-example": null, + "format": "float" }, "max": { "type": "number", "description": "Maximum value for the column. If the current value is greater than this value, an error will be thrown.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "transactionId": { @@ -42649,7 +42907,7 @@ "x-appwrite": { "method": "getTableUsage", "group": null, - "weight": 395, + "weight": 353, "cookies": false, "type": "", "demo": "tablesdb\/get-table-usage.md", @@ -42739,7 +42997,7 @@ "x-appwrite": { "method": "getUsage", "group": null, - "weight": 387, + "weight": 345, "cookies": false, "type": "", "demo": "tablesdb\/get-usage.md", @@ -42847,7 +43105,7 @@ "x-appwrite": { "method": "list", "group": "teams", - "weight": 162, + "weight": 110, "cookies": false, "type": "", "demo": "teams\/list.md", @@ -42932,7 +43190,7 @@ "x-appwrite": { "method": "create", "group": "teams", - "weight": 161, + "weight": 109, "cookies": false, "type": "", "demo": "teams\/create.md", @@ -43023,7 +43281,7 @@ "x-appwrite": { "method": "get", "group": "teams", - "weight": 163, + "weight": 111, "cookies": false, "type": "", "demo": "teams\/get.md", @@ -43086,7 +43344,7 @@ "x-appwrite": { "method": "updateName", "group": "teams", - "weight": 165, + "weight": 113, "cookies": false, "type": "", "demo": "teams\/update-name.md", @@ -43162,7 +43420,7 @@ "x-appwrite": { "method": "delete", "group": "teams", - "weight": 167, + "weight": 115, "cookies": false, "type": "", "demo": "teams\/delete.md", @@ -43225,7 +43483,7 @@ "x-appwrite": { "method": "listLogs", "group": "logs", - "weight": 174, + "weight": 122, "cookies": false, "type": "", "demo": "teams\/list-logs.md", @@ -43305,7 +43563,7 @@ "x-appwrite": { "method": "listMemberships", "group": "memberships", - "weight": 169, + "weight": 117, "cookies": false, "type": "", "demo": "teams\/list-memberships.md", @@ -43398,7 +43656,7 @@ "x-appwrite": { "method": "createMembership", "group": "memberships", - "weight": 168, + "weight": 116, "cookies": false, "type": "", "demo": "teams\/create-membership.md", @@ -43444,7 +43702,8 @@ "type": "string", "description": "Email of the new team member.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "userId": { "type": "string", @@ -43456,7 +43715,8 @@ "type": "string", "description": "Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", "default": "", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "roles": { "type": "array", @@ -43478,7 +43738,8 @@ "type": "string", "description": "URL to redirect the user back to your app from the invitation email. This parameter is not required when an API key is supplied. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.", "default": "", - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" }, "name": { "type": "string", @@ -43519,7 +43780,7 @@ "x-appwrite": { "method": "getMembership", "group": "memberships", - "weight": 170, + "weight": 118, "cookies": false, "type": "", "demo": "teams\/get-membership.md", @@ -43590,7 +43851,7 @@ "x-appwrite": { "method": "updateMembership", "group": "memberships", - "weight": 171, + "weight": 119, "cookies": false, "type": "", "demo": "teams\/update-membership.md", @@ -43684,7 +43945,7 @@ "x-appwrite": { "method": "deleteMembership", "group": "memberships", - "weight": 173, + "weight": 121, "cookies": false, "type": "", "demo": "teams\/delete-membership.md", @@ -43757,7 +44018,7 @@ "x-appwrite": { "method": "updateMembershipStatus", "group": "memberships", - "weight": 172, + "weight": 120, "cookies": false, "type": "", "demo": "teams\/update-membership-status.md", @@ -43852,7 +44113,7 @@ "x-appwrite": { "method": "getPrefs", "group": "teams", - "weight": 164, + "weight": 112, "cookies": false, "type": "", "demo": "teams\/get-prefs.md", @@ -43914,7 +44175,7 @@ "x-appwrite": { "method": "updatePrefs", "group": "teams", - "weight": 166, + "weight": 114, "cookies": false, "type": "", "demo": "teams\/update-prefs.md", @@ -43994,7 +44255,7 @@ "x-appwrite": { "method": "list", "group": "files", - "weight": 523, + "weight": 517, "cookies": false, "type": "", "demo": "tokens\/list.md", @@ -44083,7 +44344,7 @@ "x-appwrite": { "method": "createFileToken", "group": "files", - "weight": 521, + "weight": 515, "cookies": false, "type": "", "demo": "tokens\/create-file-token.md", @@ -44167,7 +44428,7 @@ "x-appwrite": { "method": "get", "group": "tokens", - "weight": 522, + "weight": 516, "cookies": false, "type": "", "demo": "tokens\/get.md", @@ -44227,7 +44488,7 @@ "x-appwrite": { "method": "update", "group": "tokens", - "weight": 524, + "weight": 518, "cookies": false, "type": "", "demo": "tokens\/update.md", @@ -44298,7 +44559,7 @@ "x-appwrite": { "method": "delete", "group": "tokens", - "weight": 525, + "weight": 519, "cookies": false, "type": "", "demo": "tokens\/delete.md", @@ -44358,7 +44619,7 @@ "x-appwrite": { "method": "list", "group": "users", - "weight": 184, + "weight": 132, "cookies": false, "type": "", "demo": "users\/list.md", @@ -44441,7 +44702,7 @@ "x-appwrite": { "method": "create", "group": "users", - "weight": 175, + "weight": 123, "cookies": false, "type": "", "demo": "users\/create.md", @@ -44484,6 +44745,7 @@ "description": "User email.", "default": null, "x-example": "email@example.com", + "format": "email", "x-nullable": true }, "phone": { @@ -44491,6 +44753,7 @@ "description": "Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", "default": null, "x-example": "+12065550100", + "format": "phone", "x-nullable": true }, "password": { @@ -44540,7 +44803,7 @@ "x-appwrite": { "method": "createArgon2User", "group": "users", - "weight": 178, + "weight": 126, "cookies": false, "type": "", "demo": "users\/create-argon-2-user.md", @@ -44582,13 +44845,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using Argon2.", "default": null, - "x-example": "password" + "x-example": "password", + "format": "password" }, "name": { "type": "string", @@ -44633,7 +44898,7 @@ "x-appwrite": { "method": "createBcryptUser", "group": "users", - "weight": 176, + "weight": 124, "cookies": false, "type": "", "demo": "users\/create-bcrypt-user.md", @@ -44675,13 +44940,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using Bcrypt.", "default": null, - "x-example": "password" + "x-example": "password", + "format": "password" }, "name": { "type": "string", @@ -44724,7 +44991,7 @@ "x-appwrite": { "method": "listIdentities", "group": "identities", - "weight": 192, + "weight": 140, "cookies": false, "type": "", "demo": "users\/list-identities.md", @@ -44804,7 +45071,7 @@ "x-appwrite": { "method": "deleteIdentity", "group": "identities", - "weight": 215, + "weight": 163, "cookies": false, "type": "", "demo": "users\/delete-identity.md", @@ -44867,7 +45134,7 @@ "x-appwrite": { "method": "createMD5User", "group": "users", - "weight": 177, + "weight": 125, "cookies": false, "type": "", "demo": "users\/create-md-5-user.md", @@ -44909,13 +45176,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using MD5.", "default": null, - "x-example": "password" + "x-example": "password", + "format": "password" }, "name": { "type": "string", @@ -44960,7 +45229,7 @@ "x-appwrite": { "method": "createPHPassUser", "group": "users", - "weight": 180, + "weight": 128, "cookies": false, "type": "", "demo": "users\/create-ph-pass-user.md", @@ -45002,13 +45271,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using PHPass.", "default": null, - "x-example": "password" + "x-example": "password", + "format": "password" }, "name": { "type": "string", @@ -45053,7 +45324,7 @@ "x-appwrite": { "method": "createScryptUser", "group": "users", - "weight": 181, + "weight": 129, "cookies": false, "type": "", "demo": "users\/create-scrypt-user.md", @@ -45095,13 +45366,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using Scrypt.", "default": null, - "x-example": "password" + "x-example": "password", + "format": "password" }, "passwordSalt": { "type": "string", @@ -45113,25 +45386,29 @@ "type": "integer", "description": "Optional CPU cost used to hash password.", "default": null, - "x-example": null + "x-example": null, + "format": "int32" }, "passwordMemory": { "type": "integer", "description": "Optional memory cost used to hash password.", "default": null, - "x-example": null + "x-example": null, + "format": "int32" }, "passwordParallel": { "type": "integer", "description": "Optional parallelization cost used to hash password.", "default": null, - "x-example": null + "x-example": null, + "format": "int32" }, "passwordLength": { "type": "integer", "description": "Optional hash length used to hash password.", "default": null, - "x-example": null + "x-example": null, + "format": "int32" }, "name": { "type": "string", @@ -45181,7 +45458,7 @@ "x-appwrite": { "method": "createScryptModifiedUser", "group": "users", - "weight": 182, + "weight": 130, "cookies": false, "type": "", "demo": "users\/create-scrypt-modified-user.md", @@ -45223,13 +45500,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using Scrypt Modified.", "default": null, - "x-example": "password" + "x-example": "password", + "format": "password" }, "passwordSalt": { "type": "string", @@ -45295,7 +45574,7 @@ "x-appwrite": { "method": "createSHAUser", "group": "users", - "weight": 179, + "weight": 127, "cookies": false, "type": "", "demo": "users\/create-sha-user.md", @@ -45337,13 +45616,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using SHA.", "default": null, - "x-example": "password" + "x-example": "password", + "format": "password" }, "passwordVersion": { "type": "string", @@ -45407,7 +45688,7 @@ "x-appwrite": { "method": "getUsage", "group": null, - "weight": 217, + "weight": 165, "cookies": false, "type": "", "demo": "users\/get-usage.md", @@ -45478,7 +45759,7 @@ "x-appwrite": { "method": "get", "group": "users", - "weight": 185, + "weight": 133, "cookies": false, "type": "", "demo": "users\/get.md", @@ -45534,7 +45815,7 @@ "x-appwrite": { "method": "delete", "group": "users", - "weight": 213, + "weight": 161, "cookies": false, "type": "", "demo": "users\/delete.md", @@ -45597,7 +45878,7 @@ "x-appwrite": { "method": "updateEmail", "group": "users", - "weight": 198, + "weight": 146, "cookies": false, "type": "", "demo": "users\/update-email.md", @@ -45641,7 +45922,8 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" } }, "required": [ @@ -45678,7 +45960,7 @@ "x-appwrite": { "method": "createJWT", "group": "sessions", - "weight": 216, + "weight": 164, "cookies": false, "type": "", "demo": "users\/create-jwt.md", @@ -45728,7 +46010,8 @@ "type": "integer", "description": "Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds.", "default": 900, - "x-example": 0 + "x-example": 0, + "format": "int32" } } } @@ -45762,7 +46045,7 @@ "x-appwrite": { "method": "updateLabels", "group": "users", - "weight": 194, + "weight": 142, "cookies": false, "type": "", "demo": "users\/update-labels.md", @@ -45844,7 +46127,7 @@ "x-appwrite": { "method": "listLogs", "group": "logs", - "weight": 190, + "weight": 138, "cookies": false, "type": "", "demo": "users\/list-logs.md", @@ -45926,7 +46209,7 @@ "x-appwrite": { "method": "listMemberships", "group": "memberships", - "weight": 189, + "weight": 137, "cookies": false, "type": "", "demo": "users\/list-memberships.md", @@ -46019,7 +46302,7 @@ "x-appwrite": { "method": "updateMfa", "group": "users", - "weight": 203, + "weight": 151, "cookies": false, "type": "", "demo": "users\/update-mfa.md", @@ -46155,7 +46438,7 @@ "x-appwrite": { "method": "deleteMfaAuthenticator", "group": "mfa", - "weight": 208, + "weight": 156, "cookies": false, "type": "", "demo": "users\/delete-mfa-authenticator.md", @@ -46287,7 +46570,7 @@ "x-appwrite": { "method": "listMfaFactors", "group": "mfa", - "weight": 204, + "weight": 152, "cookies": false, "type": "", "demo": "users\/list-mfa-factors.md", @@ -46404,7 +46687,7 @@ "x-appwrite": { "method": "getMfaRecoveryCodes", "group": "mfa", - "weight": 205, + "weight": 153, "cookies": false, "type": "", "demo": "users\/get-mfa-recovery-codes.md", @@ -46521,7 +46804,7 @@ "x-appwrite": { "method": "updateMfaRecoveryCodes", "group": "mfa", - "weight": 207, + "weight": 155, "cookies": false, "type": "", "demo": "users\/update-mfa-recovery-codes.md", @@ -46638,7 +46921,7 @@ "x-appwrite": { "method": "createMfaRecoveryCodes", "group": "mfa", - "weight": 206, + "weight": 154, "cookies": false, "type": "", "demo": "users\/create-mfa-recovery-codes.md", @@ -46757,7 +47040,7 @@ "x-appwrite": { "method": "updateName", "group": "users", - "weight": 196, + "weight": 144, "cookies": false, "type": "", "demo": "users\/update-name.md", @@ -46838,7 +47121,7 @@ "x-appwrite": { "method": "updatePassword", "group": "users", - "weight": 197, + "weight": 145, "cookies": false, "type": "", "demo": "users\/update-password.md", @@ -46919,7 +47202,7 @@ "x-appwrite": { "method": "updatePhone", "group": "users", - "weight": 199, + "weight": 147, "cookies": false, "type": "", "demo": "users\/update-phone.md", @@ -46963,7 +47246,8 @@ "type": "string", "description": "User phone number.", "default": null, - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" } }, "required": [ @@ -46998,7 +47282,7 @@ "x-appwrite": { "method": "getPrefs", "group": "users", - "weight": 186, + "weight": 134, "cookies": false, "type": "", "demo": "users\/get-prefs.md", @@ -47059,7 +47343,7 @@ "x-appwrite": { "method": "updatePrefs", "group": "users", - "weight": 201, + "weight": 149, "cookies": false, "type": "", "demo": "users\/update-prefs.md", @@ -47138,7 +47422,7 @@ "x-appwrite": { "method": "listSessions", "group": "sessions", - "weight": 188, + "weight": 136, "cookies": false, "type": "", "demo": "users\/list-sessions.md", @@ -47208,7 +47492,7 @@ "x-appwrite": { "method": "createSession", "group": "sessions", - "weight": 209, + "weight": 157, "cookies": false, "type": "", "demo": "users\/create-session.md", @@ -47264,7 +47548,7 @@ "x-appwrite": { "method": "deleteSessions", "group": "sessions", - "weight": 212, + "weight": 160, "cookies": false, "type": "", "demo": "users\/delete-sessions.md", @@ -47322,7 +47606,7 @@ "x-appwrite": { "method": "deleteSession", "group": "sessions", - "weight": 211, + "weight": 159, "cookies": false, "type": "", "demo": "users\/delete-session.md", @@ -47393,7 +47677,7 @@ "x-appwrite": { "method": "updateStatus", "group": "users", - "weight": 193, + "weight": 141, "cookies": false, "type": "", "demo": "users\/update-status.md", @@ -47472,7 +47756,7 @@ "x-appwrite": { "method": "listTargets", "group": "targets", - "weight": 191, + "weight": 139, "cookies": false, "type": "", "demo": "users\/list-targets.md", @@ -47554,7 +47838,7 @@ "x-appwrite": { "method": "createTarget", "group": "targets", - "weight": 183, + "weight": 131, "cookies": false, "type": "", "demo": "users\/create-target.md", @@ -47666,7 +47950,7 @@ "x-appwrite": { "method": "getTarget", "group": "targets", - "weight": 187, + "weight": 135, "cookies": false, "type": "", "demo": "users\/get-target.md", @@ -47735,7 +48019,7 @@ "x-appwrite": { "method": "updateTarget", "group": "targets", - "weight": 202, + "weight": 150, "cookies": false, "type": "", "demo": "users\/update-target.md", @@ -47826,7 +48110,7 @@ "x-appwrite": { "method": "deleteTarget", "group": "targets", - "weight": 214, + "weight": 162, "cookies": false, "type": "", "demo": "users\/delete-target.md", @@ -47897,7 +48181,7 @@ "x-appwrite": { "method": "createToken", "group": "sessions", - "weight": 210, + "weight": 158, "cookies": false, "type": "", "demo": "users\/create-token.md", @@ -47941,13 +48225,15 @@ "type": "integer", "description": "Token length in characters. The default length is 6 characters", "default": 6, - "x-example": 4 + "x-example": 4, + "format": "int32" }, "expire": { "type": "integer", "description": "Token expiration period in seconds. The default expiration is 15 minutes.", "default": 900, - "x-example": 60 + "x-example": 60, + "format": "int32" } } } @@ -47981,7 +48267,7 @@ "x-appwrite": { "method": "updateEmailVerification", "group": "users", - "weight": 200, + "weight": 148, "cookies": false, "type": "", "demo": "users\/update-email-verification.md", @@ -48062,7 +48348,7 @@ "x-appwrite": { "method": "updatePhoneVerification", "group": "users", - "weight": 195, + "weight": 143, "cookies": false, "type": "", "demo": "users\/update-phone-verification.md", @@ -48143,7 +48429,7 @@ "x-appwrite": { "method": "createRepositoryDetection", "group": "repositories", - "weight": 221, + "weight": 169, "cookies": false, "type": "", "demo": "vcs\/create-repository-detection.md", @@ -48239,7 +48525,7 @@ "x-appwrite": { "method": "listRepositories", "group": "repositories", - "weight": 222, + "weight": 170, "cookies": false, "type": "", "demo": "vcs\/list-repositories.md", @@ -48333,7 +48619,7 @@ "x-appwrite": { "method": "createRepository", "group": "repositories", - "weight": 223, + "weight": 171, "cookies": false, "type": "", "demo": "vcs\/create-repository.md", @@ -48417,7 +48703,7 @@ "x-appwrite": { "method": "getRepository", "group": "repositories", - "weight": 224, + "weight": 172, "cookies": false, "type": "", "demo": "vcs\/get-repository.md", @@ -48484,7 +48770,7 @@ "x-appwrite": { "method": "listRepositoryBranches", "group": "repositories", - "weight": 225, + "weight": 173, "cookies": false, "type": "", "demo": "vcs\/list-repository-branches.md", @@ -48551,7 +48837,7 @@ "x-appwrite": { "method": "getRepositoryContents", "group": "repositories", - "weight": 220, + "weight": 168, "cookies": false, "type": "", "demo": "vcs\/get-repository-contents.md", @@ -48635,7 +48921,7 @@ "x-appwrite": { "method": "updateExternalDeployments", "group": "repositories", - "weight": 230, + "weight": 178, "cookies": false, "type": "", "demo": "vcs\/update-external-deployments.md", @@ -48720,7 +49006,7 @@ "x-appwrite": { "method": "listInstallations", "group": "installations", - "weight": 227, + "weight": 175, "cookies": false, "type": "", "demo": "vcs\/list-installations.md", @@ -48801,7 +49087,7 @@ "x-appwrite": { "method": "getInstallation", "group": "installations", - "weight": 228, + "weight": 176, "cookies": false, "type": "", "demo": "vcs\/get-installation.md", @@ -48855,7 +49141,7 @@ "x-appwrite": { "method": "deleteInstallation", "group": "installations", - "weight": 229, + "weight": 177, "cookies": false, "type": "", "demo": "vcs\/delete-installation.md", @@ -48954,7 +49240,7 @@ }, { "name": "console", - "description": "The Console service allows you to interact with console relevant informations." + "description": "The Console service allows you to interact with console relevant information." }, { "name": "migrations", @@ -50103,6 +50389,35 @@ "variables": "" } }, + "healthStatusList": { + "description": "Status List", + "type": "object", + "properties": { + "total": { + "type": "integer", + "description": "Total number of statuses that matched your query.", + "x-example": 5, + "format": "int32" + }, + "statuses": { + "type": "array", + "description": "List of statuses.", + "items": { + "type": "object", + "$ref": "#\/definitions\/healthStatus" + }, + "x-example": "" + } + }, + "required": [ + "total", + "statuses" + ], + "example": { + "total": 5, + "statuses": "" + } + }, "proxyRuleList": { "description": "Rule List", "type": "object", @@ -50833,14 +51148,14 @@ "type": "integer", "description": "Minimum value to enforce for new documents.", "x-example": 1, - "format": "int32", + "format": "int64", "x-nullable": true }, "max": { "type": "integer", "description": "Maximum value to enforce for new documents.", "x-example": 10, - "format": "int32", + "format": "int64", "x-nullable": true }, "default": { @@ -52283,14 +52598,14 @@ "type": "integer", "description": "Minimum value to enforce for new documents.", "x-example": 1, - "format": "int32", + "format": "int64", "x-nullable": true }, "max": { "type": "integer", "description": "Maximum value to enforce for new documents.", "x-example": 10, - "format": "int32", + "format": "int64", "x-nullable": true }, "default": { @@ -54782,6 +55097,16 @@ "description": "Total number of chunks uploaded", "x-example": 17890, "format": "int32" + }, + "encryption": { + "type": "boolean", + "description": "Whether file contents are encrypted at rest.", + "x-example": true + }, + "compression": { + "type": "string", + "description": "Compression algorithm used for the file. Will be one of none, [gzip](https:\/\/en.wikipedia.org\/wiki\/Gzip), or [zstd](https:\/\/en.wikipedia.org\/wiki\/Zstd).", + "x-example": "gzip" } }, "required": [ @@ -54795,7 +55120,9 @@ "mimeType", "sizeOriginal", "chunksTotal", - "chunksUploaded" + "chunksUploaded", + "encryption", + "compression" ], "example": { "$id": "5e5ea5c16897e", @@ -54810,7 +55137,9 @@ "mimeType": "image\/png", "sizeOriginal": 17890, "chunksTotal": 17890, - "chunksUploaded": 17890 + "chunksUploaded": 17890, + "encryption": true, + "compression": "gzip" } }, "bucket": { @@ -54876,7 +55205,7 @@ }, "compression": { "type": "string", - "description": "Compression algorithm choosen for compression. Will be one of none, [gzip](https:\/\/en.wikipedia.org\/wiki\/Gzip), or [zstd](https:\/\/en.wikipedia.org\/wiki\/Zstd).", + "description": "Compression algorithm chosen for compression. Will be one of none, [gzip](https:\/\/en.wikipedia.org\/wiki\/Gzip), or [zstd](https:\/\/en.wikipedia.org\/wiki\/Zstd).", "x-example": "gzip" }, "encryption": { @@ -54893,6 +55222,12 @@ "type": "boolean", "description": "Image transformations are enabled.", "x-example": false + }, + "totalSize": { + "type": "integer", + "description": "Total size of this bucket in bytes.", + "x-example": 128, + "format": "int32" } }, "required": [ @@ -54908,7 +55243,8 @@ "compression", "encryption", "antivirus", - "transformations" + "transformations", + "totalSize" ], "example": { "$id": "5e5ea5c16897e", @@ -54928,7 +55264,8 @@ "compression": "gzip", "encryption": false, "antivirus": false, - "transformations": false + "transformations": false, + "totalSize": 128 } }, "resourceToken": { @@ -56753,13 +57090,14 @@ }, "status": { "type": "string", - "description": "The deployment status. Possible values are \"waiting\", \"processing\", \"building\", \"ready\", and \"failed\".", + "description": "The deployment status. Possible values are \"waiting\", \"processing\", \"building\", \"ready\", \"canceled\" and \"failed\".", "x-example": "ready", "enum": [ "waiting", "processing", "building", "ready", + "canceled", "failed" ] }, @@ -57313,6 +57651,16 @@ "description": "Last ping datetime in ISO 8601 format.", "x-example": "2020-10-15T06:38:00.000+00:00" }, + "labels": { + "type": "array", + "description": "Labels for the project.", + "items": { + "type": "string" + }, + "x-example": [ + "vip" + ] + }, "authEmailPassword": { "type": "boolean", "description": "Email\/Password auth method status", @@ -57457,6 +57805,7 @@ "smtpSecure", "pingCount", "pingedAt", + "labels", "authEmailPassword", "authUsersAuthMagicURL", "authEmailOtp", @@ -57525,6 +57874,9 @@ "smtpSecure": "tls", "pingCount": 1, "pingedAt": "2020-10-15T06:38:00.000+00:00", + "labels": [ + "vip" + ], "authEmailPassword": true, "authUsersAuthMagicURL": true, "authEmailOtp": true, @@ -59526,171 +59878,6 @@ "description": "Time range of the usage stats.", "x-example": "30d" }, - "deploymentsTotal": { - "type": "integer", - "description": "Total aggregated number of functions deployments.", - "x-example": 0, - "format": "int32" - }, - "deploymentsStorageTotal": { - "type": "integer", - "description": "Total aggregated sum of functions deployment storage.", - "x-example": 0, - "format": "int32" - }, - "buildsTotal": { - "type": "integer", - "description": "Total aggregated number of functions build.", - "x-example": 0, - "format": "int32" - }, - "buildsStorageTotal": { - "type": "integer", - "description": "total aggregated sum of functions build storage.", - "x-example": 0, - "format": "int32" - }, - "buildsTimeTotal": { - "type": "integer", - "description": "Total aggregated sum of functions build compute time.", - "x-example": 0, - "format": "int32" - }, - "buildsMbSecondsTotal": { - "type": "integer", - "description": "Total aggregated sum of functions build mbSeconds.", - "x-example": 0, - "format": "int32" - }, - "executionsTotal": { - "type": "integer", - "description": "Total aggregated number of functions execution.", - "x-example": 0, - "format": "int32" - }, - "executionsTimeTotal": { - "type": "integer", - "description": "Total aggregated sum of functions execution compute time.", - "x-example": 0, - "format": "int32" - }, - "executionsMbSecondsTotal": { - "type": "integer", - "description": "Total aggregated sum of functions execution mbSeconds.", - "x-example": 0, - "format": "int32" - }, - "deployments": { - "type": "array", - "description": "Aggregated number of functions deployment per period.", - "items": { - "type": "object", - "$ref": "#\/definitions\/metric" - }, - "x-example": [] - }, - "deploymentsStorage": { - "type": "array", - "description": "Aggregated number of functions deployment storage per period.", - "items": { - "type": "object", - "$ref": "#\/definitions\/metric" - }, - "x-example": [] - }, - "buildsSuccessTotal": { - "type": "integer", - "description": "Total aggregated number of successful function builds.", - "x-example": 0, - "format": "int32" - }, - "buildsFailedTotal": { - "type": "integer", - "description": "Total aggregated number of failed function builds.", - "x-example": 0, - "format": "int32" - }, - "builds": { - "type": "array", - "description": "Aggregated number of functions build per period.", - "items": { - "type": "object", - "$ref": "#\/definitions\/metric" - }, - "x-example": [] - }, - "buildsStorage": { - "type": "array", - "description": "Aggregated sum of functions build storage per period.", - "items": { - "type": "object", - "$ref": "#\/definitions\/metric" - }, - "x-example": [] - }, - "buildsTime": { - "type": "array", - "description": "Aggregated sum of functions build compute time per period.", - "items": { - "type": "object", - "$ref": "#\/definitions\/metric" - }, - "x-example": [] - }, - "buildsMbSeconds": { - "type": "array", - "description": "Aggregated sum of functions build mbSeconds per period.", - "items": { - "type": "object", - "$ref": "#\/definitions\/metric" - }, - "x-example": [] - }, - "executions": { - "type": "array", - "description": "Aggregated number of functions execution per period.", - "items": { - "type": "object", - "$ref": "#\/definitions\/metric" - }, - "x-example": [] - }, - "executionsTime": { - "type": "array", - "description": "Aggregated number of functions execution compute time per period.", - "items": { - "type": "object", - "$ref": "#\/definitions\/metric" - }, - "x-example": [] - }, - "executionsMbSeconds": { - "type": "array", - "description": "Aggregated number of functions mbSeconds per period.", - "items": { - "type": "object", - "$ref": "#\/definitions\/metric" - }, - "x-example": [] - }, - "buildsSuccess": { - "type": "array", - "description": "Aggregated number of successful function builds per period.", - "items": { - "type": "object", - "$ref": "#\/definitions\/metric" - }, - "x-example": [] - }, - "buildsFailed": { - "type": "array", - "description": "Aggregated number of failed function builds per period.", - "items": { - "type": "object", - "$ref": "#\/definitions\/metric" - }, - "x-example": [] - }, "sitesTotal": { "type": "integer", "description": "Total aggregated number of sites.", @@ -59706,6 +59893,60 @@ }, "x-example": [] }, + "deploymentsTotal": { + "type": "integer", + "description": "Total aggregated number of sites deployments.", + "x-example": 0, + "format": "int32" + }, + "deploymentsStorageTotal": { + "type": "integer", + "description": "Total aggregated sum of sites deployment storage.", + "x-example": 0, + "format": "int32" + }, + "buildsTotal": { + "type": "integer", + "description": "Total aggregated number of sites build.", + "x-example": 0, + "format": "int32" + }, + "buildsStorageTotal": { + "type": "integer", + "description": "total aggregated sum of sites build storage.", + "x-example": 0, + "format": "int32" + }, + "buildsTimeTotal": { + "type": "integer", + "description": "Total aggregated sum of sites build compute time.", + "x-example": 0, + "format": "int32" + }, + "buildsMbSecondsTotal": { + "type": "integer", + "description": "Total aggregated sum of sites build mbSeconds.", + "x-example": 0, + "format": "int32" + }, + "executionsTotal": { + "type": "integer", + "description": "Total aggregated number of sites execution.", + "x-example": 0, + "format": "int32" + }, + "executionsTimeTotal": { + "type": "integer", + "description": "Total aggregated sum of sites execution compute time.", + "x-example": 0, + "format": "int32" + }, + "executionsMbSecondsTotal": { + "type": "integer", + "description": "Total aggregated sum of sites execution mbSeconds.", + "x-example": 0, + "format": "int32" + }, "requestsTotal": { "type": "integer", "description": "Total aggregated number of requests.", @@ -59750,10 +59991,123 @@ "$ref": "#\/definitions\/metric" }, "x-example": [] + }, + "deployments": { + "type": "array", + "description": "Aggregated number of sites deployment per period.", + "items": { + "type": "object", + "$ref": "#\/definitions\/metric" + }, + "x-example": [] + }, + "deploymentsStorage": { + "type": "array", + "description": "Aggregated number of sites deployment storage per period.", + "items": { + "type": "object", + "$ref": "#\/definitions\/metric" + }, + "x-example": [] + }, + "buildsSuccessTotal": { + "type": "integer", + "description": "Total aggregated number of successful site builds.", + "x-example": 0, + "format": "int32" + }, + "buildsFailedTotal": { + "type": "integer", + "description": "Total aggregated number of failed site builds.", + "x-example": 0, + "format": "int32" + }, + "builds": { + "type": "array", + "description": "Aggregated number of sites build per period.", + "items": { + "type": "object", + "$ref": "#\/definitions\/metric" + }, + "x-example": [] + }, + "buildsStorage": { + "type": "array", + "description": "Aggregated sum of sites build storage per period.", + "items": { + "type": "object", + "$ref": "#\/definitions\/metric" + }, + "x-example": [] + }, + "buildsTime": { + "type": "array", + "description": "Aggregated sum of sites build compute time per period.", + "items": { + "type": "object", + "$ref": "#\/definitions\/metric" + }, + "x-example": [] + }, + "buildsMbSeconds": { + "type": "array", + "description": "Aggregated sum of sites build mbSeconds per period.", + "items": { + "type": "object", + "$ref": "#\/definitions\/metric" + }, + "x-example": [] + }, + "executions": { + "type": "array", + "description": "Aggregated number of sites execution per period.", + "items": { + "type": "object", + "$ref": "#\/definitions\/metric" + }, + "x-example": [] + }, + "executionsTime": { + "type": "array", + "description": "Aggregated number of sites execution compute time per period.", + "items": { + "type": "object", + "$ref": "#\/definitions\/metric" + }, + "x-example": [] + }, + "executionsMbSeconds": { + "type": "array", + "description": "Aggregated number of sites mbSeconds per period.", + "items": { + "type": "object", + "$ref": "#\/definitions\/metric" + }, + "x-example": [] + }, + "buildsSuccess": { + "type": "array", + "description": "Aggregated number of successful site builds per period.", + "items": { + "type": "object", + "$ref": "#\/definitions\/metric" + }, + "x-example": [] + }, + "buildsFailed": { + "type": "array", + "description": "Aggregated number of failed site builds per period.", + "items": { + "type": "object", + "$ref": "#\/definitions\/metric" + }, + "x-example": [] } }, "required": [ "range", + "sitesTotal", + "sites", "deploymentsTotal", "deploymentsStorageTotal", "buildsTotal", @@ -59763,6 +60117,12 @@ "executionsTotal", "executionsTimeTotal", "executionsMbSecondsTotal", + "requestsTotal", + "requests", + "inboundTotal", + "inbound", + "outboundTotal", + "outbound", "deployments", "deploymentsStorage", "buildsSuccessTotal", @@ -59775,18 +60135,12 @@ "executionsTime", "executionsMbSeconds", "buildsSuccess", - "buildsFailed", - "sitesTotal", - "sites", - "requestsTotal", - "requests", - "inboundTotal", - "inbound", - "outboundTotal", - "outbound" + "buildsFailed" ], "example": { "range": "30d", + "sitesTotal": 0, + "sites": [], "deploymentsTotal": 0, "deploymentsStorageTotal": 0, "buildsTotal": 0, @@ -59796,6 +60150,12 @@ "executionsTotal": 0, "executionsTimeTotal": 0, "executionsMbSecondsTotal": 0, + "requestsTotal": 0, + "requests": [], + "inboundTotal": 0, + "inbound": [], + "outboundTotal": 0, + "outbound": [], "deployments": [], "deploymentsStorage": [], "buildsSuccessTotal": 0, @@ -59808,15 +60168,7 @@ "executionsTime": [], "executionsMbSeconds": [], "buildsSuccess": [], - "buildsFailed": [], - "sitesTotal": 0, - "sites": [], - "requestsTotal": 0, - "requests": [], - "inboundTotal": 0, - "inbound": [], - "outboundTotal": 0, - "outbound": [] + "buildsFailed": [] } }, "usageSite": { @@ -61119,7 +61471,7 @@ "status": { "type": "string", "description": "Status of delivery.", - "x-example": "Message status can be one of the following: draft, processing, scheduled, sent, or failed.", + "x-example": "processing", "enum": [ "draft", "processing", @@ -61165,7 +61517,7 @@ "subject": "Welcome to Appwrite", "content": "Hi there, welcome to Appwrite family." }, - "status": "Message status can be one of the following: draft, processing, scheduled, sent, or failed." + "status": "processing" } }, "topic": { diff --git a/app/config/specs/swagger2-latest-server.json b/app/config/specs/swagger2-latest-server.json index 5ce8c4b74c..ba941164e2 100644 --- a/app/config/specs/swagger2-latest-server.json +++ b/app/config/specs/swagger2-latest-server.json @@ -1,7 +1,7 @@ { "swagger": "2.0", "info": { - "version": "1.8.0", + "version": "1.8.1", "title": "Appwrite", "description": "Appwrite backend as a service cuts up to 70% of the time and costs required for building a modern application. We abstract and simplify common development tasks behind a REST APIs, to help you develop your app in a fast and secure way. For full API documentation and tutorials go to [https:\/\/appwrite.io\/docs](https:\/\/appwrite.io\/docs)", "termsOfService": "https:\/\/appwrite.io\/policy\/terms", @@ -103,7 +103,7 @@ "x-appwrite": { "method": "get", "group": "account", - "weight": 10, + "weight": 9, "cookies": false, "type": "", "demo": "account\/get.md", @@ -157,7 +157,7 @@ "x-appwrite": { "method": "create", "group": "account", - "weight": 9, + "weight": 8, "cookies": false, "type": "", "demo": "account\/create.md", @@ -202,7 +202,8 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", @@ -253,7 +254,7 @@ "x-appwrite": { "method": "updateEmail", "group": "account", - "weight": 35, + "weight": 34, "cookies": false, "type": "", "demo": "account\/update-email.md", @@ -292,13 +293,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password. Must be at least 8 chars.", "default": null, - "x-example": "password" + "x-example": "password", + "format": "password" } }, "required": [ @@ -334,7 +337,7 @@ "x-appwrite": { "method": "listIdentities", "group": "identities", - "weight": 48, + "weight": 47, "cookies": false, "type": "", "demo": "account\/list-identities.md", @@ -408,7 +411,7 @@ "x-appwrite": { "method": "deleteIdentity", "group": "identities", - "weight": 49, + "weight": 48, "cookies": false, "type": "", "demo": "account\/delete-identity.md", @@ -474,12 +477,12 @@ "x-appwrite": { "method": "createJWT", "group": "tokens", - "weight": 30, + "weight": 29, "cookies": false, "type": "", "demo": "account\/create-jwt.md", - "rate-limit": 100, - "rate-time": 3600, + "rate-limit": 120, + "rate-time": 60, "rate-key": "url:{url},userId:{userId}", "scope": "account", "platforms": [ @@ -501,6 +504,24 @@ "Session": [], "JWT": [] } + ], + "parameters": [ + { + "name": "payload", + "in": "body", + "schema": { + "type": "object", + "properties": { + "duration": { + "type": "integer", + "description": "Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds.", + "default": 900, + "x-example": 0, + "format": "int32" + } + } + } + } ] } }, @@ -528,7 +549,7 @@ "x-appwrite": { "method": "listLogs", "group": "logs", - "weight": 32, + "weight": 31, "cookies": false, "type": "", "demo": "account\/list-logs.md", @@ -607,7 +628,7 @@ "x-appwrite": { "method": "updateMFA", "group": "mfa", - "weight": 306, + "weight": 253, "cookies": false, "type": "", "demo": "account\/update-mfa.md", @@ -683,7 +704,7 @@ "x-appwrite": { "method": "createMfaAuthenticator", "group": "mfa", - "weight": 308, + "weight": 255, "cookies": false, "type": "", "demo": "account\/create-mfa-authenticator.md", @@ -810,7 +831,7 @@ "x-appwrite": { "method": "updateMfaAuthenticator", "group": "mfa", - "weight": 309, + "weight": 256, "cookies": false, "type": "", "demo": "account\/update-mfa-authenticator.md", @@ -954,7 +975,7 @@ "x-appwrite": { "method": "deleteMfaAuthenticator", "group": "mfa", - "weight": 310, + "weight": 257, "cookies": false, "type": "", "demo": "account\/delete-mfa-authenticator.md", @@ -1081,7 +1102,7 @@ "x-appwrite": { "method": "createMfaChallenge", "group": "mfa", - "weight": 314, + "weight": 261, "cookies": false, "type": "", "demo": "account\/create-mfa-challenge.md", @@ -1221,7 +1242,7 @@ "x-appwrite": { "method": "updateMfaChallenge", "group": "mfa", - "weight": 315, + "weight": 262, "cookies": false, "type": "", "demo": "account\/update-mfa-challenge.md", @@ -1364,7 +1385,7 @@ "x-appwrite": { "method": "listMfaFactors", "group": "mfa", - "weight": 307, + "weight": 254, "cookies": false, "type": "", "demo": "account\/list-mfa-factors.md", @@ -1468,7 +1489,7 @@ "x-appwrite": { "method": "getMfaRecoveryCodes", "group": "mfa", - "weight": 313, + "weight": 260, "cookies": false, "type": "", "demo": "account\/get-mfa-recovery-codes.md", @@ -1572,7 +1593,7 @@ "x-appwrite": { "method": "createMfaRecoveryCodes", "group": "mfa", - "weight": 311, + "weight": 258, "cookies": false, "type": "", "demo": "account\/create-mfa-recovery-codes.md", @@ -1676,7 +1697,7 @@ "x-appwrite": { "method": "updateMfaRecoveryCodes", "group": "mfa", - "weight": 312, + "weight": 259, "cookies": false, "type": "", "demo": "account\/update-mfa-recovery-codes.md", @@ -1782,7 +1803,7 @@ "x-appwrite": { "method": "updateName", "group": "account", - "weight": 33, + "weight": 32, "cookies": false, "type": "", "demo": "account\/update-name.md", @@ -1858,7 +1879,7 @@ "x-appwrite": { "method": "updatePassword", "group": "account", - "weight": 34, + "weight": 33, "cookies": false, "type": "", "demo": "account\/update-password.md", @@ -1903,7 +1924,8 @@ "type": "string", "description": "Current user password. Must be at least 8 chars.", "default": "", - "x-example": "password" + "x-example": "password", + "format": "password" } }, "required": [ @@ -1940,7 +1962,7 @@ "x-appwrite": { "method": "updatePhone", "group": "account", - "weight": 36, + "weight": 35, "cookies": false, "type": "", "demo": "account\/update-phone.md", @@ -1979,13 +2001,15 @@ "type": "string", "description": "Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", "default": null, - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "password": { "type": "string", "description": "User password. Must be at least 8 chars.", "default": null, - "x-example": "password" + "x-example": "password", + "format": "password" } }, "required": [ @@ -2021,7 +2045,7 @@ "x-appwrite": { "method": "getPrefs", "group": "account", - "weight": 31, + "weight": 30, "cookies": false, "type": "", "demo": "account\/get-prefs.md", @@ -2075,7 +2099,7 @@ "x-appwrite": { "method": "updatePrefs", "group": "account", - "weight": 37, + "weight": 36, "cookies": false, "type": "", "demo": "account\/update-prefs.md", @@ -2151,7 +2175,7 @@ "x-appwrite": { "method": "createRecovery", "group": "recovery", - "weight": 39, + "weight": 38, "cookies": false, "type": "", "demo": "account\/create-recovery.md", @@ -2193,13 +2217,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "url": { "type": "string", "description": "URL to redirect the user back to your app from the recovery email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.", "default": null, - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" } }, "required": [ @@ -2235,7 +2261,7 @@ "x-appwrite": { "method": "updateRecovery", "group": "recovery", - "weight": 40, + "weight": 39, "cookies": false, "type": "", "demo": "account\/update-recovery.md", @@ -2323,7 +2349,7 @@ "x-appwrite": { "method": "listSessions", "group": "sessions", - "weight": 12, + "weight": 11, "cookies": false, "type": "", "demo": "account\/list-sessions.md", @@ -2372,7 +2398,7 @@ "x-appwrite": { "method": "deleteSessions", "group": "sessions", - "weight": 13, + "weight": 12, "cookies": false, "type": "", "demo": "account\/delete-sessions.md", @@ -2428,7 +2454,7 @@ "x-appwrite": { "method": "createAnonymousSession", "group": "sessions", - "weight": 18, + "weight": 17, "cookies": false, "type": "", "demo": "account\/create-anonymous-session.md", @@ -2484,7 +2510,7 @@ "x-appwrite": { "method": "createEmailPasswordSession", "group": "sessions", - "weight": 17, + "weight": 16, "cookies": false, "type": "", "demo": "account\/create-email-password-session.md", @@ -2523,13 +2549,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password. Must be at least 8 chars.", "default": null, - "x-example": "password" + "x-example": "password", + "format": "password" } }, "required": [ @@ -2567,7 +2595,7 @@ "x-appwrite": { "method": "updateMagicURLSession", "group": "sessions", - "weight": 27, + "weight": 26, "cookies": false, "type": "", "demo": "account\/update-magic-url-session.md", @@ -2654,7 +2682,7 @@ "x-appwrite": { "method": "updatePhoneSession", "group": "sessions", - "weight": 28, + "weight": 27, "cookies": false, "type": "", "demo": "account\/update-phone-session.md", @@ -2741,7 +2769,7 @@ "x-appwrite": { "method": "createSession", "group": "sessions", - "weight": 19, + "weight": 18, "cookies": false, "type": "", "demo": "account\/create-session.md", @@ -2822,7 +2850,7 @@ "x-appwrite": { "method": "getSession", "group": "sessions", - "weight": 14, + "weight": 13, "cookies": false, "type": "", "demo": "account\/get-session.md", @@ -2886,7 +2914,7 @@ "x-appwrite": { "method": "updateSession", "group": "sessions", - "weight": 16, + "weight": 15, "cookies": false, "type": "", "demo": "account\/update-session.md", @@ -2945,7 +2973,7 @@ "x-appwrite": { "method": "deleteSession", "group": "sessions", - "weight": 15, + "weight": 14, "cookies": false, "type": "", "demo": "account\/delete-session.md", @@ -3011,7 +3039,7 @@ "x-appwrite": { "method": "updateStatus", "group": "account", - "weight": 38, + "weight": 37, "cookies": false, "type": "", "demo": "account\/update-status.md", @@ -3067,7 +3095,7 @@ "x-appwrite": { "method": "createEmailToken", "group": "tokens", - "weight": 26, + "weight": 25, "cookies": false, "type": "", "demo": "account\/create-email-token.md", @@ -3115,7 +3143,8 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "phrase": { "type": "boolean", @@ -3159,7 +3188,7 @@ "x-appwrite": { "method": "createMagicURLToken", "group": "tokens", - "weight": 25, + "weight": 24, "cookies": false, "type": "", "demo": "account\/create-magic-url-token.md", @@ -3207,13 +3236,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "url": { "type": "string", "description": "URL to redirect the user back to your app from the magic URL login. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.", "default": "", - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" }, "phrase": { "type": "boolean", @@ -3252,7 +3283,7 @@ "x-appwrite": { "method": "createOAuth2Token", "group": "tokens", - "weight": 24, + "weight": 23, "cookies": false, "type": "webAuth", "demo": "account\/create-o-auth-2-token.md", @@ -3326,8 +3357,7 @@ "yammer", "yandex", "zoho", - "zoom", - "mock" + "zoom" ], "x-enum-name": "OAuthProvider", "x-enum-keys": [], @@ -3394,7 +3424,7 @@ "x-appwrite": { "method": "createPhoneToken", "group": "tokens", - "weight": 29, + "weight": 28, "cookies": false, "type": "", "demo": "account\/create-phone-token.md", @@ -3442,7 +3472,8 @@ "type": "string", "description": "Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", "default": null, - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" } }, "required": [ @@ -3480,7 +3511,7 @@ "x-appwrite": { "method": "createEmailVerification", "group": "verification", - "weight": 41, + "weight": 40, "cookies": false, "type": "", "demo": "account\/create-email-verification.md", @@ -3573,7 +3604,8 @@ "type": "string", "description": "URL to redirect the user back to your app from the verification email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.", "default": null, - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" } }, "required": [ @@ -3608,7 +3640,7 @@ "x-appwrite": { "method": "updateEmailVerification", "group": "verification", - "weight": 42, + "weight": 41, "cookies": false, "type": "", "demo": "account\/update-email-verification.md", @@ -3749,7 +3781,7 @@ "x-appwrite": { "method": "createPhoneVerification", "group": "verification", - "weight": 43, + "weight": 42, "cookies": false, "type": "", "demo": "account\/create-phone-verification.md", @@ -3806,7 +3838,7 @@ "x-appwrite": { "method": "updatePhoneVerification", "group": "verification", - "weight": 44, + "weight": 43, "cookies": false, "type": "", "demo": "account\/update-phone-verification.md", @@ -3887,7 +3919,7 @@ "x-appwrite": { "method": "getBrowser", "group": null, - "weight": 51, + "weight": 264, "cookies": false, "type": "location", "demo": "avatars\/get-browser.md", @@ -4015,7 +4047,7 @@ "x-appwrite": { "method": "getCreditCard", "group": null, - "weight": 50, + "weight": 263, "cookies": false, "type": "location", "demo": "avatars\/get-credit-card.md", @@ -4149,7 +4181,7 @@ "x-appwrite": { "method": "getFavicon", "group": null, - "weight": 54, + "weight": 267, "cookies": false, "type": "location", "demo": "avatars\/get-favicon.md", @@ -4215,7 +4247,7 @@ "x-appwrite": { "method": "getFlag", "group": null, - "weight": 52, + "weight": 265, "cookies": false, "type": "location", "demo": "avatars\/get-flag.md", @@ -4705,7 +4737,7 @@ "x-appwrite": { "method": "getImage", "group": null, - "weight": 53, + "weight": 266, "cookies": false, "type": "location", "demo": "avatars\/get-image.md", @@ -4791,7 +4823,7 @@ "x-appwrite": { "method": "getInitials", "group": null, - "weight": 56, + "weight": 269, "cookies": false, "type": "location", "demo": "avatars\/get-initials.md", @@ -4885,7 +4917,7 @@ "x-appwrite": { "method": "getQR", "group": null, - "weight": 55, + "weight": 268, "cookies": false, "type": "location", "demo": "avatars\/get-qr.md", @@ -4979,7 +5011,7 @@ "x-appwrite": { "method": "getScreenshot", "group": null, - "weight": 57, + "weight": 270, "cookies": false, "type": "location", "demo": "avatars\/get-screenshot.md", @@ -5662,7 +5694,7 @@ "avif", "gif" ], - "x-enum-name": null, + "x-enum-name": "ImageFormat", "x-enum-keys": [], "default": "", "in": "query" @@ -5694,7 +5726,7 @@ "x-appwrite": { "method": "list", "group": "databases", - "weight": 320, + "weight": 278, "cookies": false, "type": "", "demo": "databases\/list.md", @@ -5812,7 +5844,7 @@ "x-appwrite": { "method": "create", "group": "databases", - "weight": 316, + "weight": 274, "cookies": false, "type": "", "demo": "databases\/create.md", @@ -5934,7 +5966,7 @@ "x-appwrite": { "method": "listTransactions", "group": "transactions", - "weight": 380, + "weight": 338, "cookies": false, "type": "", "demo": "databases\/list-transactions.md", @@ -6003,7 +6035,7 @@ "x-appwrite": { "method": "createTransaction", "group": "transactions", - "weight": 376, + "weight": 334, "cookies": false, "type": "", "demo": "databases\/create-transaction.md", @@ -6043,7 +6075,8 @@ "type": "integer", "description": "Seconds before the transaction expires.", "default": 300, - "x-example": 60 + "x-example": 60, + "format": "int32" } } } @@ -6075,7 +6108,7 @@ "x-appwrite": { "method": "getTransaction", "group": "transactions", - "weight": 377, + "weight": 335, "cookies": false, "type": "", "demo": "databases\/get-transaction.md", @@ -6140,7 +6173,7 @@ "x-appwrite": { "method": "updateTransaction", "group": "transactions", - "weight": 378, + "weight": 336, "cookies": false, "type": "", "demo": "databases\/update-transaction.md", @@ -6221,7 +6254,7 @@ "x-appwrite": { "method": "deleteTransaction", "group": "transactions", - "weight": 379, + "weight": 337, "cookies": false, "type": "", "demo": "databases\/delete-transaction.md", @@ -6288,7 +6321,7 @@ "x-appwrite": { "method": "createOperations", "group": "transactions", - "weight": 381, + "weight": 339, "cookies": false, "type": "", "demo": "databases\/create-operations.md", @@ -6371,7 +6404,7 @@ "x-appwrite": { "method": "get", "group": "databases", - "weight": 317, + "weight": 275, "cookies": false, "type": "", "demo": "databases\/get.md", @@ -6467,7 +6500,7 @@ "x-appwrite": { "method": "update", "group": "databases", - "weight": 318, + "weight": 276, "cookies": false, "type": "", "demo": "databases\/update.md", @@ -6501,8 +6534,7 @@ "enabled" ], "required": [ - "databaseId", - "name" + "databaseId" ], "responses": [ { @@ -6557,10 +6589,7 @@ "default": true, "x-example": false } - }, - "required": [ - "name" - ] + } } } ] @@ -6585,7 +6614,7 @@ "x-appwrite": { "method": "delete", "group": "databases", - "weight": 319, + "weight": 277, "cookies": false, "type": "", "demo": "databases\/delete.md", @@ -6680,7 +6709,7 @@ "x-appwrite": { "method": "listCollections", "group": "collections", - "weight": 328, + "weight": 286, "cookies": false, "type": "", "demo": "databases\/list-collections.md", @@ -6776,7 +6805,7 @@ "x-appwrite": { "method": "createCollection", "group": "collections", - "weight": 324, + "weight": 282, "cookies": false, "type": "", "demo": "databases\/create-collection.md", @@ -6907,7 +6936,7 @@ "x-appwrite": { "method": "getCollection", "group": "collections", - "weight": 325, + "weight": 283, "cookies": false, "type": "", "demo": "databases\/get-collection.md", @@ -6981,7 +7010,7 @@ "x-appwrite": { "method": "updateCollection", "group": "collections", - "weight": 326, + "weight": 284, "cookies": false, "type": "", "demo": "databases\/update-collection.md", @@ -7062,10 +7091,7 @@ "default": true, "x-example": false } - }, - "required": [ - "name" - ] + } } } ] @@ -7090,7 +7116,7 @@ "x-appwrite": { "method": "deleteCollection", "group": "collections", - "weight": 327, + "weight": 285, "cookies": false, "type": "", "demo": "databases\/delete-collection.md", @@ -7164,7 +7190,7 @@ "x-appwrite": { "method": "listAttributes", "group": "attributes", - "weight": 345, + "weight": 303, "cookies": false, "type": "", "demo": "databases\/list-attributes.md", @@ -7261,7 +7287,7 @@ "x-appwrite": { "method": "createBooleanAttribute", "group": "attributes", - "weight": 346, + "weight": 304, "cookies": false, "type": "", "demo": "databases\/create-boolean-attribute.md", @@ -7375,7 +7401,7 @@ "x-appwrite": { "method": "updateBooleanAttribute", "group": "attributes", - "weight": 347, + "weight": 305, "cookies": false, "type": "", "demo": "databases\/update-boolean-attribute.md", @@ -7491,7 +7517,7 @@ "x-appwrite": { "method": "createDatetimeAttribute", "group": "attributes", - "weight": 348, + "weight": 306, "cookies": false, "type": "", "demo": "databases\/create-datetime-attribute.md", @@ -7605,7 +7631,7 @@ "x-appwrite": { "method": "updateDatetimeAttribute", "group": "attributes", - "weight": 349, + "weight": 307, "cookies": false, "type": "", "demo": "databases\/update-datetime-attribute.md", @@ -7721,7 +7747,7 @@ "x-appwrite": { "method": "createEmailAttribute", "group": "attributes", - "weight": 350, + "weight": 308, "cookies": false, "type": "", "demo": "databases\/create-email-attribute.md", @@ -7791,6 +7817,7 @@ "description": "Default value for attribute when not provided. Cannot be set when attribute is required.", "default": null, "x-example": "email@example.com", + "format": "email", "x-nullable": true }, "array": { @@ -7835,7 +7862,7 @@ "x-appwrite": { "method": "updateEmailAttribute", "group": "attributes", - "weight": 351, + "weight": 309, "cookies": false, "type": "", "demo": "databases\/update-email-attribute.md", @@ -7906,6 +7933,7 @@ "description": "Default value for attribute when not provided. Cannot be set when attribute is required.", "default": null, "x-example": "email@example.com", + "format": "email", "x-nullable": true }, "newKey": { @@ -7951,7 +7979,7 @@ "x-appwrite": { "method": "createEnumAttribute", "group": "attributes", - "weight": 352, + "weight": 310, "cookies": false, "type": "", "demo": "databases\/create-enum-attribute.md", @@ -8075,7 +8103,7 @@ "x-appwrite": { "method": "updateEnumAttribute", "group": "attributes", - "weight": 353, + "weight": 311, "cookies": false, "type": "", "demo": "databases\/update-enum-attribute.md", @@ -8201,7 +8229,7 @@ "x-appwrite": { "method": "createFloatAttribute", "group": "attributes", - "weight": 354, + "weight": 312, "cookies": false, "type": "", "demo": "databases\/create-float-attribute.md", @@ -8271,6 +8299,7 @@ "description": "Minimum value.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "max": { @@ -8278,6 +8307,7 @@ "description": "Maximum value.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "default": { @@ -8285,6 +8315,7 @@ "description": "Default value. Cannot be set when required.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "array": { @@ -8329,7 +8360,7 @@ "x-appwrite": { "method": "updateFloatAttribute", "group": "attributes", - "weight": 355, + "weight": 313, "cookies": false, "type": "", "demo": "databases\/update-float-attribute.md", @@ -8400,6 +8431,7 @@ "description": "Minimum value.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "max": { @@ -8407,6 +8439,7 @@ "description": "Maximum value.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "default": { @@ -8414,6 +8447,7 @@ "description": "Default value. Cannot be set when required.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "newKey": { @@ -8459,7 +8493,7 @@ "x-appwrite": { "method": "createIntegerAttribute", "group": "attributes", - "weight": 356, + "weight": 314, "cookies": false, "type": "", "demo": "databases\/create-integer-attribute.md", @@ -8529,6 +8563,7 @@ "description": "Minimum value", "default": null, "x-example": null, + "format": "int64", "x-nullable": true }, "max": { @@ -8536,6 +8571,7 @@ "description": "Maximum value", "default": null, "x-example": null, + "format": "int64", "x-nullable": true }, "default": { @@ -8543,6 +8579,7 @@ "description": "Default value. Cannot be set when attribute is required.", "default": null, "x-example": null, + "format": "int64", "x-nullable": true }, "array": { @@ -8587,7 +8624,7 @@ "x-appwrite": { "method": "updateIntegerAttribute", "group": "attributes", - "weight": 357, + "weight": 315, "cookies": false, "type": "", "demo": "databases\/update-integer-attribute.md", @@ -8658,6 +8695,7 @@ "description": "Minimum value", "default": null, "x-example": null, + "format": "int64", "x-nullable": true }, "max": { @@ -8665,6 +8703,7 @@ "description": "Maximum value", "default": null, "x-example": null, + "format": "int64", "x-nullable": true }, "default": { @@ -8672,6 +8711,7 @@ "description": "Default value. Cannot be set when attribute is required.", "default": null, "x-example": null, + "format": "int64", "x-nullable": true }, "newKey": { @@ -8717,7 +8757,7 @@ "x-appwrite": { "method": "createIpAttribute", "group": "attributes", - "weight": 358, + "weight": 316, "cookies": false, "type": "", "demo": "databases\/create-ip-attribute.md", @@ -8831,7 +8871,7 @@ "x-appwrite": { "method": "updateIpAttribute", "group": "attributes", - "weight": 359, + "weight": 317, "cookies": false, "type": "", "demo": "databases\/update-ip-attribute.md", @@ -8947,7 +8987,7 @@ "x-appwrite": { "method": "createLineAttribute", "group": "attributes", - "weight": 360, + "weight": 318, "cookies": false, "type": "", "demo": "databases\/create-line-attribute.md", @@ -9055,7 +9095,7 @@ "x-appwrite": { "method": "updateLineAttribute", "group": "attributes", - "weight": 361, + "weight": 319, "cookies": false, "type": "", "demo": "databases\/update-line-attribute.md", @@ -9170,7 +9210,7 @@ "x-appwrite": { "method": "createPointAttribute", "group": "attributes", - "weight": 362, + "weight": 320, "cookies": false, "type": "", "demo": "databases\/create-point-attribute.md", @@ -9278,7 +9318,7 @@ "x-appwrite": { "method": "updatePointAttribute", "group": "attributes", - "weight": 363, + "weight": 321, "cookies": false, "type": "", "demo": "databases\/update-point-attribute.md", @@ -9393,7 +9433,7 @@ "x-appwrite": { "method": "createPolygonAttribute", "group": "attributes", - "weight": 364, + "weight": 322, "cookies": false, "type": "", "demo": "databases\/create-polygon-attribute.md", @@ -9501,7 +9541,7 @@ "x-appwrite": { "method": "updatePolygonAttribute", "group": "attributes", - "weight": 365, + "weight": 323, "cookies": false, "type": "", "demo": "databases\/update-polygon-attribute.md", @@ -9616,7 +9656,7 @@ "x-appwrite": { "method": "createRelationshipAttribute", "group": "attributes", - "weight": 366, + "weight": 324, "cookies": false, "type": "", "demo": "databases\/create-relationship-attribute.md", @@ -9758,7 +9798,7 @@ "x-appwrite": { "method": "createStringAttribute", "group": "attributes", - "weight": 368, + "weight": 326, "cookies": false, "type": "", "demo": "databases\/create-string-attribute.md", @@ -9821,7 +9861,8 @@ "type": "integer", "description": "Attribute size for text attributes, in number of characters.", "default": null, - "x-example": 1 + "x-example": 1, + "format": "int32" }, "required": { "type": "boolean", @@ -9885,7 +9926,7 @@ "x-appwrite": { "method": "updateStringAttribute", "group": "attributes", - "weight": 369, + "weight": 327, "cookies": false, "type": "", "demo": "databases\/update-string-attribute.md", @@ -9963,6 +10004,7 @@ "description": "Maximum size of the string attribute.", "default": null, "x-example": 1, + "format": "int32", "x-nullable": true }, "newKey": { @@ -10008,7 +10050,7 @@ "x-appwrite": { "method": "createUrlAttribute", "group": "attributes", - "weight": 370, + "weight": 328, "cookies": false, "type": "", "demo": "databases\/create-url-attribute.md", @@ -10078,6 +10120,7 @@ "description": "Default value for attribute when not provided. Cannot be set when attribute is required.", "default": null, "x-example": "https:\/\/example.com", + "format": "url", "x-nullable": true }, "array": { @@ -10122,7 +10165,7 @@ "x-appwrite": { "method": "updateUrlAttribute", "group": "attributes", - "weight": 371, + "weight": 329, "cookies": false, "type": "", "demo": "databases\/update-url-attribute.md", @@ -10193,6 +10236,7 @@ "description": "Default value for attribute when not provided. Cannot be set when attribute is required.", "default": null, "x-example": "https:\/\/example.com", + "format": "url", "x-nullable": true }, "newKey": { @@ -10267,7 +10311,7 @@ "x-appwrite": { "method": "getAttribute", "group": "attributes", - "weight": 343, + "weight": 301, "cookies": false, "type": "", "demo": "databases\/get-attribute.md", @@ -10343,7 +10387,7 @@ "x-appwrite": { "method": "deleteAttribute", "group": "attributes", - "weight": 344, + "weight": 302, "cookies": false, "type": "", "demo": "databases\/delete-attribute.md", @@ -10426,7 +10470,7 @@ "x-appwrite": { "method": "updateRelationshipAttribute", "group": "attributes", - "weight": 367, + "weight": 325, "cookies": false, "type": "", "demo": "databases\/update-relationship-attribute.md", @@ -10537,7 +10581,7 @@ "x-appwrite": { "method": "listDocuments", "group": "documents", - "weight": 339, + "weight": 297, "cookies": false, "type": "", "demo": "databases\/list-documents.md", @@ -10643,7 +10687,7 @@ "x-appwrite": { "method": "createDocument", "group": "documents", - "weight": 331, + "weight": 289, "cookies": false, "type": "", "demo": "databases\/create-document.md", @@ -10838,7 +10882,7 @@ "x-appwrite": { "method": "upsertDocuments", "group": "documents", - "weight": 336, + "weight": 294, "cookies": false, "type": "", "demo": "databases\/upsert-documents.md", @@ -10975,7 +11019,7 @@ "x-appwrite": { "method": "updateDocuments", "group": "documents", - "weight": 334, + "weight": 292, "cookies": false, "type": "", "demo": "databases\/update-documents.md", @@ -11080,7 +11124,7 @@ "x-appwrite": { "method": "deleteDocuments", "group": "documents", - "weight": 338, + "weight": 296, "cookies": false, "type": "", "demo": "databases\/delete-documents.md", @@ -11179,7 +11223,7 @@ "x-appwrite": { "method": "getDocument", "group": "documents", - "weight": 332, + "weight": 290, "cookies": false, "type": "", "demo": "databases\/get-document.md", @@ -11284,7 +11328,7 @@ "x-appwrite": { "method": "upsertDocument", "group": "documents", - "weight": 335, + "weight": 293, "cookies": false, "type": "", "demo": "databases\/upsert-document.md", @@ -11438,7 +11482,7 @@ "x-appwrite": { "method": "updateDocument", "group": "documents", - "weight": 333, + "weight": 291, "cookies": false, "type": "", "demo": "databases\/update-document.md", @@ -11550,7 +11594,7 @@ "x-appwrite": { "method": "deleteDocument", "group": "documents", - "weight": 337, + "weight": 295, "cookies": false, "type": "", "demo": "databases\/delete-document.md", @@ -11653,7 +11697,7 @@ "x-appwrite": { "method": "decrementDocumentAttribute", "group": "documents", - "weight": 342, + "weight": 300, "cookies": false, "type": "", "demo": "databases\/decrement-document-attribute.md", @@ -11728,13 +11772,15 @@ "type": "number", "description": "Value to increment the attribute by. The value must be a number.", "default": 1, - "x-example": null + "x-example": null, + "format": "float" }, "min": { "type": "number", "description": "Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "transactionId": { @@ -11776,7 +11822,7 @@ "x-appwrite": { "method": "incrementDocumentAttribute", "group": "documents", - "weight": 341, + "weight": 299, "cookies": false, "type": "", "demo": "databases\/increment-document-attribute.md", @@ -11851,13 +11897,15 @@ "type": "number", "description": "Value to increment the attribute by. The value must be a number.", "default": 1, - "x-example": null + "x-example": null, + "format": "float" }, "max": { "type": "number", "description": "Maximum value for the attribute. If the current value is greater than this value, an error will be thrown.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "transactionId": { @@ -11897,7 +11945,7 @@ "x-appwrite": { "method": "listIndexes", "group": "indexes", - "weight": 375, + "weight": 333, "cookies": false, "type": "", "demo": "databases\/list-indexes.md", @@ -11992,7 +12040,7 @@ "x-appwrite": { "method": "createIndex", "group": "indexes", - "weight": 372, + "weight": 330, "cookies": false, "type": "", "demo": "databases\/create-index.md", @@ -12133,7 +12181,7 @@ "x-appwrite": { "method": "getIndex", "group": "indexes", - "weight": 373, + "weight": 331, "cookies": false, "type": "", "demo": "databases\/get-index.md", @@ -12209,7 +12257,7 @@ "x-appwrite": { "method": "deleteIndex", "group": "indexes", - "weight": 374, + "weight": 332, "cookies": false, "type": "", "demo": "databases\/delete-index.md", @@ -12290,7 +12338,7 @@ "x-appwrite": { "method": "list", "group": "functions", - "weight": 456, + "weight": 415, "cookies": false, "type": "", "demo": "functions\/list.md", @@ -12373,7 +12421,7 @@ "x-appwrite": { "method": "create", "group": "functions", - "weight": 453, + "weight": 412, "cookies": false, "type": "", "demo": "functions\/create.md", @@ -12522,7 +12570,8 @@ "type": "integer", "description": "Function maximum execution time in seconds.", "default": 15, - "x-example": 1 + "x-example": 1, + "format": "int32" }, "enabled": { "type": "boolean", @@ -12687,7 +12736,7 @@ "x-appwrite": { "method": "listRuntimes", "group": "runtimes", - "weight": 458, + "weight": 417, "cookies": false, "type": "", "demo": "functions\/list-runtimes.md", @@ -12738,7 +12787,7 @@ "x-appwrite": { "method": "listSpecifications", "group": "runtimes", - "weight": 459, + "weight": 418, "cookies": false, "type": "", "demo": "functions\/list-specifications.md", @@ -12789,7 +12838,7 @@ "x-appwrite": { "method": "get", "group": "functions", - "weight": 454, + "weight": 413, "cookies": false, "type": "", "demo": "functions\/get.md", @@ -12850,7 +12899,7 @@ "x-appwrite": { "method": "update", "group": "functions", - "weight": 455, + "weight": 414, "cookies": false, "type": "", "demo": "functions\/update.md", @@ -13001,7 +13050,8 @@ "type": "integer", "description": "Maximum execution time in seconds.", "default": 15, - "x-example": 1 + "x-example": 1, + "format": "int32" }, "enabled": { "type": "boolean", @@ -13160,7 +13210,7 @@ "x-appwrite": { "method": "delete", "group": "functions", - "weight": 457, + "weight": 416, "cookies": false, "type": "", "demo": "functions\/delete.md", @@ -13223,7 +13273,7 @@ "x-appwrite": { "method": "updateFunctionDeployment", "group": "functions", - "weight": 462, + "weight": 421, "cookies": false, "type": "", "demo": "functions\/update-function-deployment.md", @@ -13302,7 +13352,7 @@ "x-appwrite": { "method": "listDeployments", "group": "deployments", - "weight": 463, + "weight": 422, "cookies": false, "type": "", "demo": "functions\/list-deployments.md", @@ -13393,7 +13443,7 @@ "x-appwrite": { "method": "createDeployment", "group": "deployments", - "weight": 460, + "weight": 419, "cookies": false, "type": "upload", "demo": "functions\/create-deployment.md", @@ -13487,7 +13537,7 @@ "x-appwrite": { "method": "createDuplicateDeployment", "group": "deployments", - "weight": 468, + "weight": 427, "cookies": false, "type": "", "demo": "functions\/create-duplicate-deployment.md", @@ -13574,7 +13624,7 @@ "x-appwrite": { "method": "createTemplateDeployment", "group": "deployments", - "weight": 465, + "weight": 424, "cookies": false, "type": "", "demo": "functions\/create-template-deployment.md", @@ -13696,7 +13746,7 @@ "x-appwrite": { "method": "createVcsDeployment", "group": "deployments", - "weight": 466, + "weight": 425, "cookies": false, "type": "", "demo": "functions\/create-vcs-deployment.md", @@ -13794,7 +13844,7 @@ "x-appwrite": { "method": "getDeployment", "group": "deployments", - "weight": 461, + "weight": 420, "cookies": false, "type": "", "demo": "functions\/get-deployment.md", @@ -13858,7 +13908,7 @@ "x-appwrite": { "method": "deleteDeployment", "group": "deployments", - "weight": 464, + "weight": 423, "cookies": false, "type": "", "demo": "functions\/delete-deployment.md", @@ -13927,7 +13977,7 @@ "x-appwrite": { "method": "getDeploymentDownload", "group": "deployments", - "weight": 467, + "weight": 426, "cookies": false, "type": "location", "demo": "functions\/get-deployment-download.md", @@ -14014,7 +14064,7 @@ "x-appwrite": { "method": "updateDeploymentStatus", "group": "deployments", - "weight": 469, + "weight": 428, "cookies": false, "type": "", "demo": "functions\/update-deployment-status.md", @@ -14083,7 +14133,7 @@ "x-appwrite": { "method": "listExecutions", "group": "executions", - "weight": 472, + "weight": 431, "cookies": false, "type": "", "demo": "functions\/list-executions.md", @@ -14168,7 +14218,7 @@ "x-appwrite": { "method": "createExecution", "group": "executions", - "weight": 470, + "weight": 429, "cookies": false, "type": "", "demo": "functions\/create-execution.md", @@ -14289,7 +14339,7 @@ "x-appwrite": { "method": "getExecution", "group": "executions", - "weight": 471, + "weight": 430, "cookies": false, "type": "", "demo": "functions\/get-execution.md", @@ -14356,7 +14406,7 @@ "x-appwrite": { "method": "deleteExecution", "group": "executions", - "weight": 473, + "weight": 432, "cookies": false, "type": "", "demo": "functions\/delete-execution.md", @@ -14425,7 +14475,7 @@ "x-appwrite": { "method": "listVariables", "group": "variables", - "weight": 478, + "weight": 437, "cookies": false, "type": "", "demo": "functions\/list-variables.md", @@ -14486,7 +14536,7 @@ "x-appwrite": { "method": "createVariable", "group": "variables", - "weight": 476, + "weight": 435, "cookies": false, "type": "", "demo": "functions\/create-variable.md", @@ -14578,7 +14628,7 @@ "x-appwrite": { "method": "getVariable", "group": "variables", - "weight": 477, + "weight": 436, "cookies": false, "type": "", "demo": "functions\/get-variable.md", @@ -14647,7 +14697,7 @@ "x-appwrite": { "method": "updateVariable", "group": "variables", - "weight": 479, + "weight": 438, "cookies": false, "type": "", "demo": "functions\/update-variable.md", @@ -14743,7 +14793,7 @@ "x-appwrite": { "method": "deleteVariable", "group": "variables", - "weight": 480, + "weight": 439, "cookies": false, "type": "", "demo": "functions\/delete-variable.md", @@ -14814,7 +14864,7 @@ "x-appwrite": { "method": "query", "group": "graphql", - "weight": 241, + "weight": 190, "cookies": false, "type": "graphql", "demo": "graphql\/query.md", @@ -14891,7 +14941,7 @@ "x-appwrite": { "method": "mutation", "group": "graphql", - "weight": 240, + "weight": 189, "cookies": false, "type": "graphql", "demo": "graphql\/mutation.md", @@ -14966,7 +15016,7 @@ "x-appwrite": { "method": "get", "group": "health", - "weight": 69, + "weight": 442, "cookies": false, "type": "", "demo": "health\/get.md", @@ -15018,7 +15068,7 @@ "x-appwrite": { "method": "getAntivirus", "group": "health", - "weight": 90, + "weight": 451, "cookies": false, "type": "", "demo": "health\/get-antivirus.md", @@ -15060,9 +15110,9 @@ "description": "Check the Appwrite in-memory cache servers are up and connection is successful.", "responses": { "200": { - "description": "Health Status", + "description": "Status List", "schema": { - "$ref": "#\/definitions\/healthStatus" + "$ref": "#\/definitions\/healthStatusList" } } }, @@ -15070,7 +15120,7 @@ "x-appwrite": { "method": "getCache", "group": "health", - "weight": 72, + "weight": 445, "cookies": false, "type": "", "demo": "health\/get-cache.md", @@ -15122,7 +15172,7 @@ "x-appwrite": { "method": "getCertificate", "group": "health", - "weight": 77, + "weight": 448, "cookies": false, "type": "", "demo": "health\/get-certificate.md", @@ -15173,9 +15223,9 @@ "description": "Check the Appwrite database servers are up and connection is successful.", "responses": { "200": { - "description": "Health Status", + "description": "Status List", "schema": { - "$ref": "#\/definitions\/healthStatus" + "$ref": "#\/definitions\/healthStatusList" } } }, @@ -15183,7 +15233,7 @@ "x-appwrite": { "method": "getDB", "group": "health", - "weight": 71, + "weight": 444, "cookies": false, "type": "", "demo": "health\/get-db.md", @@ -15225,9 +15275,9 @@ "description": "Check the Appwrite pub-sub servers are up and connection is successful.", "responses": { "200": { - "description": "Health Status", + "description": "Status List", "schema": { - "$ref": "#\/definitions\/healthStatus" + "$ref": "#\/definitions\/healthStatusList" } } }, @@ -15235,7 +15285,7 @@ "x-appwrite": { "method": "getPubSub", "group": "health", - "weight": 73, + "weight": 446, "cookies": false, "type": "", "demo": "health\/get-pub-sub.md", @@ -15263,6 +15313,69 @@ ] } }, + "\/health\/queue\/audits": { + "get": { + "summary": "Get audits queue", + "operationId": "healthGetQueueAudits", + "consumes": [], + "produces": [ + "application\/json" + ], + "tags": [ + "health" + ], + "description": "Get the number of audit logs that are waiting to be processed in the Appwrite internal queue server.", + "responses": { + "200": { + "description": "Health Queue", + "schema": { + "$ref": "#\/definitions\/healthQueue" + } + } + }, + "deprecated": false, + "x-appwrite": { + "method": "getQueueAudits", + "group": "queue", + "weight": 452, + "cookies": false, + "type": "", + "demo": "health\/get-queue-audits.md", + "rate-limit": 0, + "rate-time": 3600, + "rate-key": "url:{url},ip:{ip}", + "scope": "health.read", + "platforms": [ + "console", + "server" + ], + "packaging": false, + "public": true, + "edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-audits.md", + "auth": { + "Project": [], + "Key": [] + } + }, + "security": [ + { + "Project": [], + "Key": [] + } + ], + "parameters": [ + { + "name": "threshold", + "description": "Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.", + "required": false, + "type": "integer", + "format": "int32", + "default": 5000, + "in": "query" + } + ] + } + }, "\/health\/queue\/builds": { "get": { "summary": "Get builds queue", @@ -15287,7 +15400,7 @@ "x-appwrite": { "method": "getQueueBuilds", "group": "queue", - "weight": 79, + "weight": 456, "cookies": false, "type": "", "demo": "health\/get-queue-builds.md", @@ -15350,7 +15463,7 @@ "x-appwrite": { "method": "getQueueCertificates", "group": "queue", - "weight": 78, + "weight": 455, "cookies": false, "type": "", "demo": "health\/get-queue-certificates.md", @@ -15413,7 +15526,7 @@ "x-appwrite": { "method": "getQueueDatabases", "group": "queue", - "weight": 80, + "weight": 457, "cookies": false, "type": "", "demo": "health\/get-queue-databases.md", @@ -15485,7 +15598,7 @@ "x-appwrite": { "method": "getQueueDeletes", "group": "queue", - "weight": 81, + "weight": 458, "cookies": false, "type": "", "demo": "health\/get-queue-deletes.md", @@ -15548,7 +15661,7 @@ "x-appwrite": { "method": "getFailedJobs", "group": "queue", - "weight": 91, + "weight": 465, "cookies": false, "type": "", "demo": "health\/get-failed-jobs.md", @@ -15592,6 +15705,7 @@ "v1-webhooks", "v1-certificates", "v1-builds", + "v1-screenshots", "v1-messaging", "v1-migrations" ], @@ -15635,7 +15749,7 @@ "x-appwrite": { "method": "getQueueFunctions", "group": "queue", - "weight": 85, + "weight": 462, "cookies": false, "type": "", "demo": "health\/get-queue-functions.md", @@ -15698,7 +15812,7 @@ "x-appwrite": { "method": "getQueueLogs", "group": "queue", - "weight": 76, + "weight": 454, "cookies": false, "type": "", "demo": "health\/get-queue-logs.md", @@ -15761,7 +15875,7 @@ "x-appwrite": { "method": "getQueueMails", "group": "queue", - "weight": 82, + "weight": 459, "cookies": false, "type": "", "demo": "health\/get-queue-mails.md", @@ -15824,7 +15938,7 @@ "x-appwrite": { "method": "getQueueMessaging", "group": "queue", - "weight": 83, + "weight": 460, "cookies": false, "type": "", "demo": "health\/get-queue-messaging.md", @@ -15887,7 +16001,7 @@ "x-appwrite": { "method": "getQueueMigrations", "group": "queue", - "weight": 84, + "weight": 461, "cookies": false, "type": "", "demo": "health\/get-queue-migrations.md", @@ -15950,7 +16064,7 @@ "x-appwrite": { "method": "getQueueStatsResources", "group": "queue", - "weight": 86, + "weight": 463, "cookies": false, "type": "", "demo": "health\/get-queue-stats-resources.md", @@ -16013,7 +16127,7 @@ "x-appwrite": { "method": "getQueueUsage", "group": "queue", - "weight": 87, + "weight": 464, "cookies": false, "type": "", "demo": "health\/get-queue-usage.md", @@ -16076,7 +16190,7 @@ "x-appwrite": { "method": "getQueueWebhooks", "group": "queue", - "weight": 75, + "weight": 453, "cookies": false, "type": "", "demo": "health\/get-queue-webhooks.md", @@ -16139,7 +16253,7 @@ "x-appwrite": { "method": "getStorage", "group": "storage", - "weight": 89, + "weight": 450, "cookies": false, "type": "", "demo": "health\/get-storage.md", @@ -16191,7 +16305,7 @@ "x-appwrite": { "method": "getStorageLocal", "group": "storage", - "weight": 88, + "weight": 449, "cookies": false, "type": "", "demo": "health\/get-storage-local.md", @@ -16243,7 +16357,7 @@ "x-appwrite": { "method": "getTime", "group": "health", - "weight": 74, + "weight": 447, "cookies": false, "type": "", "demo": "health\/get-time.md", @@ -16295,7 +16409,7 @@ "x-appwrite": { "method": "get", "group": null, - "weight": 61, + "weight": 49, "cookies": false, "type": "", "demo": "locale\/get.md", @@ -16350,7 +16464,7 @@ "x-appwrite": { "method": "listCodes", "group": null, - "weight": 62, + "weight": 50, "cookies": false, "type": "", "demo": "locale\/list-codes.md", @@ -16405,7 +16519,7 @@ "x-appwrite": { "method": "listContinents", "group": null, - "weight": 66, + "weight": 54, "cookies": false, "type": "", "demo": "locale\/list-continents.md", @@ -16460,7 +16574,7 @@ "x-appwrite": { "method": "listCountries", "group": null, - "weight": 63, + "weight": 51, "cookies": false, "type": "", "demo": "locale\/list-countries.md", @@ -16515,7 +16629,7 @@ "x-appwrite": { "method": "listCountriesEU", "group": null, - "weight": 64, + "weight": 52, "cookies": false, "type": "", "demo": "locale\/list-countries-eu.md", @@ -16570,7 +16684,7 @@ "x-appwrite": { "method": "listCountriesPhones", "group": null, - "weight": 65, + "weight": 53, "cookies": false, "type": "", "demo": "locale\/list-countries-phones.md", @@ -16625,7 +16739,7 @@ "x-appwrite": { "method": "listCurrencies", "group": null, - "weight": 67, + "weight": 55, "cookies": false, "type": "", "demo": "locale\/list-currencies.md", @@ -16680,7 +16794,7 @@ "x-appwrite": { "method": "listLanguages", "group": null, - "weight": 68, + "weight": 56, "cookies": false, "type": "", "demo": "locale\/list-languages.md", @@ -16735,7 +16849,7 @@ "x-appwrite": { "method": "listMessages", "group": "messages", - "weight": 298, + "weight": 245, "cookies": false, "type": "", "demo": "messaging\/list-messages.md", @@ -16821,7 +16935,7 @@ "x-appwrite": { "method": "createEmail", "group": "messages", - "weight": 295, + "weight": 242, "cookies": false, "type": "", "demo": "messaging\/create-email.md", @@ -16982,7 +17096,7 @@ "x-appwrite": { "method": "updateEmail", "group": "messages", - "weight": 302, + "weight": 249, "cookies": false, "type": "", "demo": "messaging\/update-email.md", @@ -17150,7 +17264,7 @@ "x-appwrite": { "method": "createPush", "group": "messages", - "weight": 297, + "weight": 244, "cookies": false, "type": "", "demo": "messaging\/create-push.md", @@ -17275,7 +17389,8 @@ "type": "integer", "description": "Badge for push notification. Available only for iOS Platform.", "default": -1, - "x-example": null + "x-example": null, + "format": "int32" }, "draft": { "type": "boolean", @@ -17349,7 +17464,7 @@ "x-appwrite": { "method": "updatePush", "group": "messages", - "weight": 304, + "weight": 251, "cookies": false, "type": "", "demo": "messaging\/update-push.md", @@ -17488,6 +17603,7 @@ "description": "Badge for push notification. Available only for iOS platforms.", "default": null, "x-example": null, + "format": "int32", "x-nullable": true }, "draft": { @@ -17563,7 +17679,7 @@ "x-appwrite": { "method": "createSms", "group": "messages", - "weight": 296, + "weight": 243, "cookies": false, "type": "", "demo": "messaging\/create-sms.md", @@ -17756,7 +17872,7 @@ "x-appwrite": { "method": "updateSms", "group": "messages", - "weight": 303, + "weight": 250, "cookies": false, "type": "", "demo": "messaging\/update-sms.md", @@ -17948,7 +18064,7 @@ "x-appwrite": { "method": "getMessage", "group": "messages", - "weight": 301, + "weight": 248, "cookies": false, "type": "", "demo": "messaging\/get-message.md", @@ -18005,7 +18121,7 @@ "x-appwrite": { "method": "delete", "group": "messages", - "weight": 305, + "weight": 252, "cookies": false, "type": "", "demo": "messaging\/delete.md", @@ -18067,7 +18183,7 @@ "x-appwrite": { "method": "listMessageLogs", "group": "logs", - "weight": 299, + "weight": 246, "cookies": false, "type": "", "demo": "messaging\/list-message-logs.md", @@ -18150,7 +18266,7 @@ "x-appwrite": { "method": "listTargets", "group": "messages", - "weight": 300, + "weight": 247, "cookies": false, "type": "", "demo": "messaging\/list-targets.md", @@ -18233,7 +18349,7 @@ "x-appwrite": { "method": "listProviders", "group": "providers", - "weight": 269, + "weight": 216, "cookies": false, "type": "", "demo": "messaging\/list-providers.md", @@ -18319,7 +18435,7 @@ "x-appwrite": { "method": "createApnsProvider", "group": "providers", - "weight": 268, + "weight": 215, "cookies": false, "type": "", "demo": "messaging\/create-apns-provider.md", @@ -18511,7 +18627,7 @@ "x-appwrite": { "method": "updateApnsProvider", "group": "providers", - "weight": 282, + "weight": 229, "cookies": false, "type": "", "demo": "messaging\/update-apns-provider.md", @@ -18700,7 +18816,7 @@ "x-appwrite": { "method": "createFcmProvider", "group": "providers", - "weight": 267, + "weight": 214, "cookies": false, "type": "", "demo": "messaging\/create-fcm-provider.md", @@ -18861,7 +18977,7 @@ "x-appwrite": { "method": "updateFcmProvider", "group": "providers", - "weight": 281, + "weight": 228, "cookies": false, "type": "", "demo": "messaging\/update-fcm-provider.md", @@ -19018,7 +19134,7 @@ "x-appwrite": { "method": "createMailgunProvider", "group": "providers", - "weight": 258, + "weight": 205, "cookies": false, "type": "", "demo": "messaging\/create-mailgun-provider.md", @@ -19092,7 +19208,8 @@ "type": "string", "description": "Sender email address.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -19104,7 +19221,8 @@ "type": "string", "description": "Email set in the reply to field for the mail. Default value is sender email. Reply to email must have reply to name as well.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "enabled": { "type": "boolean", @@ -19149,7 +19267,7 @@ "x-appwrite": { "method": "updateMailgunProvider", "group": "providers", - "weight": 272, + "weight": 219, "cookies": false, "type": "", "demo": "messaging\/update-mailgun-provider.md", @@ -19232,7 +19350,8 @@ "type": "string", "description": "Sender email address.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -19278,7 +19397,7 @@ "x-appwrite": { "method": "createMsg91Provider", "group": "providers", - "weight": 262, + "weight": 209, "cookies": false, "type": "", "demo": "messaging\/create-msg-91-provider.md", @@ -19384,7 +19503,7 @@ "x-appwrite": { "method": "updateMsg91Provider", "group": "providers", - "weight": 276, + "weight": 223, "cookies": false, "type": "", "demo": "messaging\/update-msg-91-provider.md", @@ -19488,7 +19607,7 @@ "x-appwrite": { "method": "createResendProvider", "group": "providers", - "weight": 260, + "weight": 207, "cookies": false, "type": "", "demo": "messaging\/create-resend-provider.md", @@ -19549,7 +19668,8 @@ "type": "string", "description": "Sender email address.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -19561,7 +19681,8 @@ "type": "string", "description": "Email set in the reply to field for the mail. Default value is sender email.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "enabled": { "type": "boolean", @@ -19606,7 +19727,7 @@ "x-appwrite": { "method": "updateResendProvider", "group": "providers", - "weight": 274, + "weight": 221, "cookies": false, "type": "", "demo": "messaging\/update-resend-provider.md", @@ -19676,7 +19797,8 @@ "type": "string", "description": "Sender email address.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -19722,7 +19844,7 @@ "x-appwrite": { "method": "createSendgridProvider", "group": "providers", - "weight": 259, + "weight": 206, "cookies": false, "type": "", "demo": "messaging\/create-sendgrid-provider.md", @@ -19783,7 +19905,8 @@ "type": "string", "description": "Sender email address.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -19795,7 +19918,8 @@ "type": "string", "description": "Email set in the reply to field for the mail. Default value is sender email.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "enabled": { "type": "boolean", @@ -19840,7 +19964,7 @@ "x-appwrite": { "method": "updateSendgridProvider", "group": "providers", - "weight": 273, + "weight": 220, "cookies": false, "type": "", "demo": "messaging\/update-sendgrid-provider.md", @@ -19910,7 +20034,8 @@ "type": "string", "description": "Sender email address.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -19956,7 +20081,7 @@ "x-appwrite": { "method": "createSmtpProvider", "group": "providers", - "weight": 261, + "weight": 208, "cookies": false, "type": "", "demo": "messaging\/create-smtp-provider.md", @@ -20099,7 +20224,8 @@ "type": "integer", "description": "The default SMTP server port.", "default": 587, - "x-example": 1 + "x-example": 1, + "format": "int32" }, "username": { "type": "string", @@ -20148,7 +20274,8 @@ "type": "string", "description": "Sender email address.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -20160,7 +20287,8 @@ "type": "string", "description": "Email set in the reply to field for the mail. Default value is sender email.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "enabled": { "type": "boolean", @@ -20206,7 +20334,7 @@ "x-appwrite": { "method": "updateSmtpProvider", "group": "providers", - "weight": 275, + "weight": 222, "cookies": false, "type": "", "demo": "messaging\/update-smtp-provider.md", @@ -20348,6 +20476,7 @@ "description": "SMTP port.", "default": null, "x-example": 1, + "format": "int32", "x-nullable": true }, "username": { @@ -20398,7 +20527,8 @@ "type": "string", "description": "Sender email address.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "replyToName": { "type": "string", @@ -20451,7 +20581,7 @@ "x-appwrite": { "method": "createTelesignProvider", "group": "providers", - "weight": 263, + "weight": 210, "cookies": false, "type": "", "demo": "messaging\/create-telesign-provider.md", @@ -20500,7 +20630,8 @@ "type": "string", "description": "Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", "default": "", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "customerId": { "type": "string", @@ -20557,7 +20688,7 @@ "x-appwrite": { "method": "updateTelesignProvider", "group": "providers", - "weight": 277, + "weight": 224, "cookies": false, "type": "", "demo": "messaging\/update-telesign-provider.md", @@ -20661,7 +20792,7 @@ "x-appwrite": { "method": "createTextmagicProvider", "group": "providers", - "weight": 264, + "weight": 211, "cookies": false, "type": "", "demo": "messaging\/create-textmagic-provider.md", @@ -20710,7 +20841,8 @@ "type": "string", "description": "Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", "default": "", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "username": { "type": "string", @@ -20767,7 +20899,7 @@ "x-appwrite": { "method": "updateTextmagicProvider", "group": "providers", - "weight": 278, + "weight": 225, "cookies": false, "type": "", "demo": "messaging\/update-textmagic-provider.md", @@ -20871,7 +21003,7 @@ "x-appwrite": { "method": "createTwilioProvider", "group": "providers", - "weight": 265, + "weight": 212, "cookies": false, "type": "", "demo": "messaging\/create-twilio-provider.md", @@ -20920,7 +21052,8 @@ "type": "string", "description": "Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", "default": "", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "accountSid": { "type": "string", @@ -20977,7 +21110,7 @@ "x-appwrite": { "method": "updateTwilioProvider", "group": "providers", - "weight": 279, + "weight": 226, "cookies": false, "type": "", "demo": "messaging\/update-twilio-provider.md", @@ -21081,7 +21214,7 @@ "x-appwrite": { "method": "createVonageProvider", "group": "providers", - "weight": 266, + "weight": 213, "cookies": false, "type": "", "demo": "messaging\/create-vonage-provider.md", @@ -21130,7 +21263,8 @@ "type": "string", "description": "Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", "default": "", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "apiKey": { "type": "string", @@ -21187,7 +21321,7 @@ "x-appwrite": { "method": "updateVonageProvider", "group": "providers", - "weight": 280, + "weight": 227, "cookies": false, "type": "", "demo": "messaging\/update-vonage-provider.md", @@ -21289,7 +21423,7 @@ "x-appwrite": { "method": "getProvider", "group": "providers", - "weight": 271, + "weight": 218, "cookies": false, "type": "", "demo": "messaging\/get-provider.md", @@ -21346,7 +21480,7 @@ "x-appwrite": { "method": "deleteProvider", "group": "providers", - "weight": 283, + "weight": 230, "cookies": false, "type": "", "demo": "messaging\/delete-provider.md", @@ -21408,7 +21542,7 @@ "x-appwrite": { "method": "listProviderLogs", "group": "providers", - "weight": 270, + "weight": 217, "cookies": false, "type": "", "demo": "messaging\/list-provider-logs.md", @@ -21491,7 +21625,7 @@ "x-appwrite": { "method": "listSubscriberLogs", "group": "subscribers", - "weight": 292, + "weight": 239, "cookies": false, "type": "", "demo": "messaging\/list-subscriber-logs.md", @@ -21574,7 +21708,7 @@ "x-appwrite": { "method": "listTopics", "group": "topics", - "weight": 285, + "weight": 232, "cookies": false, "type": "", "demo": "messaging\/list-topics.md", @@ -21658,7 +21792,7 @@ "x-appwrite": { "method": "createTopic", "group": "topics", - "weight": 284, + "weight": 231, "cookies": false, "type": "", "demo": "messaging\/create-topic.md", @@ -21748,7 +21882,7 @@ "x-appwrite": { "method": "getTopic", "group": "topics", - "weight": 287, + "weight": 234, "cookies": false, "type": "", "demo": "messaging\/get-topic.md", @@ -21810,7 +21944,7 @@ "x-appwrite": { "method": "updateTopic", "group": "topics", - "weight": 288, + "weight": 235, "cookies": false, "type": "", "demo": "messaging\/update-topic.md", @@ -21893,7 +22027,7 @@ "x-appwrite": { "method": "deleteTopic", "group": "topics", - "weight": 289, + "weight": 236, "cookies": false, "type": "", "demo": "messaging\/delete-topic.md", @@ -21955,7 +22089,7 @@ "x-appwrite": { "method": "listTopicLogs", "group": "topics", - "weight": 286, + "weight": 233, "cookies": false, "type": "", "demo": "messaging\/list-topic-logs.md", @@ -22038,7 +22172,7 @@ "x-appwrite": { "method": "listSubscribers", "group": "subscribers", - "weight": 291, + "weight": 238, "cookies": false, "type": "", "demo": "messaging\/list-subscribers.md", @@ -22130,7 +22264,7 @@ "x-appwrite": { "method": "createSubscriber", "group": "subscribers", - "weight": 290, + "weight": 237, "cookies": false, "type": "", "demo": "messaging\/create-subscriber.md", @@ -22220,7 +22354,7 @@ "x-appwrite": { "method": "getSubscriber", "group": "subscribers", - "weight": 293, + "weight": 240, "cookies": false, "type": "", "demo": "messaging\/get-subscriber.md", @@ -22285,7 +22419,7 @@ "x-appwrite": { "method": "deleteSubscriber", "group": "subscribers", - "weight": 294, + "weight": 241, "cookies": false, "type": "", "demo": "messaging\/delete-subscriber.md", @@ -22358,7 +22492,7 @@ "x-appwrite": { "method": "list", "group": "sites", - "weight": 485, + "weight": 469, "cookies": false, "type": "", "demo": "sites\/list.md", @@ -22441,7 +22575,7 @@ "x-appwrite": { "method": "create", "group": "sites", - "weight": 483, + "weight": 467, "cookies": false, "type": "", "demo": "sites\/create.md", @@ -22526,7 +22660,8 @@ "type": "integer", "description": "Maximum request time in seconds.", "default": 30, - "x-example": 1 + "x-example": 1, + "format": "int32" }, "installCommand": { "type": "string", @@ -22713,7 +22848,7 @@ "x-appwrite": { "method": "listFrameworks", "group": "frameworks", - "weight": 488, + "weight": 472, "cookies": false, "type": "", "demo": "sites\/list-frameworks.md", @@ -22764,7 +22899,7 @@ "x-appwrite": { "method": "listSpecifications", "group": "frameworks", - "weight": 511, + "weight": 495, "cookies": false, "type": "", "demo": "sites\/list-specifications.md", @@ -22815,7 +22950,7 @@ "x-appwrite": { "method": "get", "group": "sites", - "weight": 484, + "weight": 468, "cookies": false, "type": "", "demo": "sites\/get.md", @@ -22876,7 +23011,7 @@ "x-appwrite": { "method": "update", "group": "sites", - "weight": 486, + "weight": 470, "cookies": false, "type": "", "demo": "sites\/update.md", @@ -22963,7 +23098,8 @@ "type": "integer", "description": "Maximum request time in seconds.", "default": 30, - "x-example": 1 + "x-example": 1, + "format": "int32" }, "installCommand": { "type": "string", @@ -23143,7 +23279,7 @@ "x-appwrite": { "method": "delete", "group": "sites", - "weight": 487, + "weight": 471, "cookies": false, "type": "", "demo": "sites\/delete.md", @@ -23206,7 +23342,7 @@ "x-appwrite": { "method": "updateSiteDeployment", "group": "sites", - "weight": 494, + "weight": 478, "cookies": false, "type": "", "demo": "sites\/update-site-deployment.md", @@ -23285,7 +23421,7 @@ "x-appwrite": { "method": "listDeployments", "group": "deployments", - "weight": 493, + "weight": 477, "cookies": false, "type": "", "demo": "sites\/list-deployments.md", @@ -23376,7 +23512,7 @@ "x-appwrite": { "method": "createDeployment", "group": "deployments", - "weight": 489, + "weight": 473, "cookies": false, "type": "upload", "demo": "sites\/create-deployment.md", @@ -23478,7 +23614,7 @@ "x-appwrite": { "method": "createDuplicateDeployment", "group": "deployments", - "weight": 497, + "weight": 481, "cookies": false, "type": "", "demo": "sites\/create-duplicate-deployment.md", @@ -23559,7 +23695,7 @@ "x-appwrite": { "method": "createTemplateDeployment", "group": "deployments", - "weight": 490, + "weight": 474, "cookies": false, "type": "", "demo": "sites\/create-template-deployment.md", @@ -23681,7 +23817,7 @@ "x-appwrite": { "method": "createVcsDeployment", "group": "deployments", - "weight": 491, + "weight": 475, "cookies": false, "type": "", "demo": "sites\/create-vcs-deployment.md", @@ -23780,7 +23916,7 @@ "x-appwrite": { "method": "getDeployment", "group": "deployments", - "weight": 492, + "weight": 476, "cookies": false, "type": "", "demo": "sites\/get-deployment.md", @@ -23844,7 +23980,7 @@ "x-appwrite": { "method": "deleteDeployment", "group": "deployments", - "weight": 495, + "weight": 479, "cookies": false, "type": "", "demo": "sites\/delete-deployment.md", @@ -23913,7 +24049,7 @@ "x-appwrite": { "method": "getDeploymentDownload", "group": "deployments", - "weight": 496, + "weight": 480, "cookies": false, "type": "location", "demo": "sites\/get-deployment-download.md", @@ -24000,7 +24136,7 @@ "x-appwrite": { "method": "updateDeploymentStatus", "group": "deployments", - "weight": 498, + "weight": 482, "cookies": false, "type": "", "demo": "sites\/update-deployment-status.md", @@ -24069,7 +24205,7 @@ "x-appwrite": { "method": "listLogs", "group": "logs", - "weight": 500, + "weight": 484, "cookies": false, "type": "", "demo": "sites\/list-logs.md", @@ -24151,7 +24287,7 @@ "x-appwrite": { "method": "getLog", "group": "logs", - "weight": 499, + "weight": 483, "cookies": false, "type": "", "demo": "sites\/get-log.md", @@ -24217,7 +24353,7 @@ "x-appwrite": { "method": "deleteLog", "group": "logs", - "weight": 501, + "weight": 485, "cookies": false, "type": "", "demo": "sites\/delete-log.md", @@ -24286,7 +24422,7 @@ "x-appwrite": { "method": "listVariables", "group": "variables", - "weight": 504, + "weight": 488, "cookies": false, "type": "", "demo": "sites\/list-variables.md", @@ -24347,7 +24483,7 @@ "x-appwrite": { "method": "createVariable", "group": "variables", - "weight": 502, + "weight": 486, "cookies": false, "type": "", "demo": "sites\/create-variable.md", @@ -24439,7 +24575,7 @@ "x-appwrite": { "method": "getVariable", "group": "variables", - "weight": 503, + "weight": 487, "cookies": false, "type": "", "demo": "sites\/get-variable.md", @@ -24508,7 +24644,7 @@ "x-appwrite": { "method": "updateVariable", "group": "variables", - "weight": 505, + "weight": 489, "cookies": false, "type": "", "demo": "sites\/update-variable.md", @@ -24604,7 +24740,7 @@ "x-appwrite": { "method": "deleteVariable", "group": "variables", - "weight": 506, + "weight": 490, "cookies": false, "type": "", "demo": "sites\/delete-variable.md", @@ -24673,7 +24809,7 @@ "x-appwrite": { "method": "listBuckets", "group": "buckets", - "weight": 146, + "weight": 522, "cookies": false, "type": "", "demo": "storage\/list-buckets.md", @@ -24757,7 +24893,7 @@ "x-appwrite": { "method": "createBucket", "group": "buckets", - "weight": 145, + "weight": 520, "cookies": false, "type": "", "demo": "storage\/create-bucket.md", @@ -24828,7 +24964,8 @@ "type": "integer", "description": "Maximum file size allowed in bytes. Maximum allowed value is 30MB.", "default": {}, - "x-example": 1 + "x-example": 1, + "format": "int32" }, "allowedFileExtensions": { "type": "array", @@ -24841,7 +24978,7 @@ }, "compression": { "type": "string", - "description": "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", + "description": "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", "default": "none", "x-example": "none", "enum": [ @@ -24904,7 +25041,7 @@ "x-appwrite": { "method": "getBucket", "group": "buckets", - "weight": 147, + "weight": 521, "cookies": false, "type": "", "demo": "storage\/get-bucket.md", @@ -24966,7 +25103,7 @@ "x-appwrite": { "method": "updateBucket", "group": "buckets", - "weight": 148, + "weight": 523, "cookies": false, "type": "", "demo": "storage\/update-bucket.md", @@ -25039,7 +25176,8 @@ "type": "integer", "description": "Maximum file size allowed in bytes. Maximum allowed value is 30MB.", "default": {}, - "x-example": 1 + "x-example": 1, + "format": "int32" }, "allowedFileExtensions": { "type": "array", @@ -25052,7 +25190,7 @@ }, "compression": { "type": "string", - "description": "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", + "description": "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", "default": "none", "x-example": "none", "enum": [ @@ -25109,7 +25247,7 @@ "x-appwrite": { "method": "deleteBucket", "group": "buckets", - "weight": 149, + "weight": 524, "cookies": false, "type": "", "demo": "storage\/delete-bucket.md", @@ -25171,7 +25309,7 @@ "x-appwrite": { "method": "listFiles", "group": "files", - "weight": 151, + "weight": 527, "cookies": false, "type": "", "demo": "storage\/list-files.md", @@ -25266,7 +25404,7 @@ "x-appwrite": { "method": "createFile", "group": "files", - "weight": 150, + "weight": 525, "cookies": false, "type": "upload", "demo": "storage\/create-file.md", @@ -25359,7 +25497,7 @@ "x-appwrite": { "method": "getFile", "group": "files", - "weight": 152, + "weight": 526, "cookies": false, "type": "", "demo": "storage\/get-file.md", @@ -25432,13 +25570,13 @@ "x-appwrite": { "method": "updateFile", "group": "files", - "weight": 157, + "weight": 528, "cookies": false, "type": "", "demo": "storage\/update-file.md", - "rate-limit": 60, - "rate-time": 60, - "rate-key": "ip:{ip},method:{method},url:{url},userId:{userId}", + "rate-limit": 0, + "rate-time": 3600, + "rate-key": "url:{url},ip:{ip}", "scope": "files.write", "platforms": [ "console", @@ -25464,7 +25602,7 @@ "parameters": [ { "name": "bucketId", - "description": "Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https:\/\/appwrite.io\/docs\/server\/storage#createBucket).", + "description": "Bucket unique ID.", "required": true, "type": "string", "x-example": "", @@ -25472,7 +25610,7 @@ }, { "name": "fileId", - "description": "File unique ID.", + "description": "File ID.", "required": true, "type": "string", "x-example": "", @@ -25486,14 +25624,13 @@ "properties": { "name": { "type": "string", - "description": "Name of the file", + "description": "File name.", "default": null, - "x-example": "", - "x-nullable": true + "x-example": "" }, "permissions": { "type": "array", - "description": "An array of permission string. By default, the current permissions are inherited. [Learn more about permissions](https:\/\/appwrite.io\/docs\/permissions).", + "description": "An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https:\/\/appwrite.io\/docs\/permissions).", "default": null, "x-example": "[\"read(\"any\")\"]", "x-nullable": true, @@ -25526,7 +25663,7 @@ "x-appwrite": { "method": "deleteFile", "group": "files", - "weight": 158, + "weight": 529, "cookies": false, "type": "", "demo": "storage\/delete-file.md", @@ -25599,7 +25736,7 @@ "x-appwrite": { "method": "getFileDownload", "group": "files", - "weight": 154, + "weight": 531, "cookies": false, "type": "location", "demo": "storage\/get-file-download.md", @@ -25681,7 +25818,7 @@ "x-appwrite": { "method": "getFilePreview", "group": "files", - "weight": 153, + "weight": 530, "cookies": false, "type": "location", "demo": "storage\/get-file-preview.md", @@ -25891,7 +26028,7 @@ "x-appwrite": { "method": "getFileView", "group": "files", - "weight": 155, + "weight": 532, "cookies": false, "type": "location", "demo": "storage\/get-file-view.md", @@ -25973,7 +26110,7 @@ "x-appwrite": { "method": "list", "group": "tablesdb", - "weight": 386, + "weight": 344, "cookies": false, "type": "", "demo": "tablesdb\/list.md", @@ -26057,7 +26194,7 @@ "x-appwrite": { "method": "create", "group": "tablesdb", - "weight": 382, + "weight": 340, "cookies": false, "type": "", "demo": "tablesdb\/create.md", @@ -26142,7 +26279,7 @@ "x-appwrite": { "method": "listTransactions", "group": "transactions", - "weight": 445, + "weight": 403, "cookies": false, "type": "", "demo": "tablesdb\/list-transactions.md", @@ -26214,7 +26351,7 @@ "x-appwrite": { "method": "createTransaction", "group": "transactions", - "weight": 441, + "weight": 399, "cookies": false, "type": "", "demo": "tablesdb\/create-transaction.md", @@ -26257,7 +26394,8 @@ "type": "integer", "description": "Seconds before the transaction expires.", "default": 300, - "x-example": 60 + "x-example": 60, + "format": "int32" } } } @@ -26289,7 +26427,7 @@ "x-appwrite": { "method": "getTransaction", "group": "transactions", - "weight": 442, + "weight": 400, "cookies": false, "type": "", "demo": "tablesdb\/get-transaction.md", @@ -26357,7 +26495,7 @@ "x-appwrite": { "method": "updateTransaction", "group": "transactions", - "weight": 443, + "weight": 401, "cookies": false, "type": "", "demo": "tablesdb\/update-transaction.md", @@ -26441,7 +26579,7 @@ "x-appwrite": { "method": "deleteTransaction", "group": "transactions", - "weight": 444, + "weight": 402, "cookies": false, "type": "", "demo": "tablesdb\/delete-transaction.md", @@ -26511,7 +26649,7 @@ "x-appwrite": { "method": "createOperations", "group": "transactions", - "weight": 446, + "weight": 404, "cookies": false, "type": "", "demo": "tablesdb\/create-operations.md", @@ -26597,7 +26735,7 @@ "x-appwrite": { "method": "get", "group": "tablesdb", - "weight": 383, + "weight": 341, "cookies": false, "type": "", "demo": "tablesdb\/get.md", @@ -26659,7 +26797,7 @@ "x-appwrite": { "method": "update", "group": "tablesdb", - "weight": 384, + "weight": 342, "cookies": false, "type": "", "demo": "tablesdb\/update.md", @@ -26712,10 +26850,7 @@ "default": true, "x-example": false } - }, - "required": [ - "name" - ] + } } } ] @@ -26740,7 +26875,7 @@ "x-appwrite": { "method": "delete", "group": "tablesdb", - "weight": 385, + "weight": 343, "cookies": false, "type": "", "demo": "tablesdb\/delete.md", @@ -26802,7 +26937,7 @@ "x-appwrite": { "method": "listTables", "group": "tables", - "weight": 393, + "weight": 351, "cookies": false, "type": "", "demo": "tablesdb\/list-tables.md", @@ -26897,7 +27032,7 @@ "x-appwrite": { "method": "createTable", "group": "tables", - "weight": 389, + "weight": 347, "cookies": false, "type": "", "demo": "tablesdb\/create-table.md", @@ -27027,7 +27162,7 @@ "x-appwrite": { "method": "getTable", "group": "tables", - "weight": 390, + "weight": 348, "cookies": false, "type": "", "demo": "tablesdb\/get-table.md", @@ -27100,7 +27235,7 @@ "x-appwrite": { "method": "updateTable", "group": "tables", - "weight": 391, + "weight": 349, "cookies": false, "type": "", "demo": "tablesdb\/update-table.md", @@ -27180,10 +27315,7 @@ "default": true, "x-example": false } - }, - "required": [ - "name" - ] + } } } ] @@ -27208,7 +27340,7 @@ "x-appwrite": { "method": "deleteTable", "group": "tables", - "weight": 392, + "weight": 350, "cookies": false, "type": "", "demo": "tablesdb\/delete-table.md", @@ -27281,7 +27413,7 @@ "x-appwrite": { "method": "listColumns", "group": "columns", - "weight": 398, + "weight": 356, "cookies": false, "type": "", "demo": "tablesdb\/list-columns.md", @@ -27377,7 +27509,7 @@ "x-appwrite": { "method": "createBooleanColumn", "group": "columns", - "weight": 399, + "weight": 357, "cookies": false, "type": "", "demo": "tablesdb\/create-boolean-column.md", @@ -27490,7 +27622,7 @@ "x-appwrite": { "method": "updateBooleanColumn", "group": "columns", - "weight": 400, + "weight": 358, "cookies": false, "type": "", "demo": "tablesdb\/update-boolean-column.md", @@ -27605,7 +27737,7 @@ "x-appwrite": { "method": "createDatetimeColumn", "group": "columns", - "weight": 401, + "weight": 359, "cookies": false, "type": "", "demo": "tablesdb\/create-datetime-column.md", @@ -27718,7 +27850,7 @@ "x-appwrite": { "method": "updateDatetimeColumn", "group": "columns", - "weight": 402, + "weight": 360, "cookies": false, "type": "", "demo": "tablesdb\/update-datetime-column.md", @@ -27833,7 +27965,7 @@ "x-appwrite": { "method": "createEmailColumn", "group": "columns", - "weight": 403, + "weight": 361, "cookies": false, "type": "", "demo": "tablesdb\/create-email-column.md", @@ -27902,6 +28034,7 @@ "description": "Default value for column when not provided. Cannot be set when column is required.", "default": null, "x-example": "email@example.com", + "format": "email", "x-nullable": true }, "array": { @@ -27946,7 +28079,7 @@ "x-appwrite": { "method": "updateEmailColumn", "group": "columns", - "weight": 404, + "weight": 362, "cookies": false, "type": "", "demo": "tablesdb\/update-email-column.md", @@ -28016,6 +28149,7 @@ "description": "Default value for column when not provided. Cannot be set when column is required.", "default": null, "x-example": "email@example.com", + "format": "email", "x-nullable": true }, "newKey": { @@ -28061,7 +28195,7 @@ "x-appwrite": { "method": "createEnumColumn", "group": "columns", - "weight": 405, + "weight": 363, "cookies": false, "type": "", "demo": "tablesdb\/create-enum-column.md", @@ -28184,7 +28318,7 @@ "x-appwrite": { "method": "updateEnumColumn", "group": "columns", - "weight": 406, + "weight": 364, "cookies": false, "type": "", "demo": "tablesdb\/update-enum-column.md", @@ -28309,7 +28443,7 @@ "x-appwrite": { "method": "createFloatColumn", "group": "columns", - "weight": 407, + "weight": 365, "cookies": false, "type": "", "demo": "tablesdb\/create-float-column.md", @@ -28378,6 +28512,7 @@ "description": "Minimum value", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "max": { @@ -28385,6 +28520,7 @@ "description": "Maximum value", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "default": { @@ -28392,6 +28528,7 @@ "description": "Default value. Cannot be set when required.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "array": { @@ -28436,7 +28573,7 @@ "x-appwrite": { "method": "updateFloatColumn", "group": "columns", - "weight": 408, + "weight": 366, "cookies": false, "type": "", "demo": "tablesdb\/update-float-column.md", @@ -28506,6 +28643,7 @@ "description": "Minimum value", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "max": { @@ -28513,6 +28651,7 @@ "description": "Maximum value", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "default": { @@ -28520,6 +28659,7 @@ "description": "Default value. Cannot be set when required.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "newKey": { @@ -28565,7 +28705,7 @@ "x-appwrite": { "method": "createIntegerColumn", "group": "columns", - "weight": 409, + "weight": 367, "cookies": false, "type": "", "demo": "tablesdb\/create-integer-column.md", @@ -28634,6 +28774,7 @@ "description": "Minimum value", "default": null, "x-example": null, + "format": "int64", "x-nullable": true }, "max": { @@ -28641,6 +28782,7 @@ "description": "Maximum value", "default": null, "x-example": null, + "format": "int64", "x-nullable": true }, "default": { @@ -28648,6 +28790,7 @@ "description": "Default value. Cannot be set when column is required.", "default": null, "x-example": null, + "format": "int64", "x-nullable": true }, "array": { @@ -28692,7 +28835,7 @@ "x-appwrite": { "method": "updateIntegerColumn", "group": "columns", - "weight": 410, + "weight": 368, "cookies": false, "type": "", "demo": "tablesdb\/update-integer-column.md", @@ -28762,6 +28905,7 @@ "description": "Minimum value", "default": null, "x-example": null, + "format": "int64", "x-nullable": true }, "max": { @@ -28769,6 +28913,7 @@ "description": "Maximum value", "default": null, "x-example": null, + "format": "int64", "x-nullable": true }, "default": { @@ -28776,6 +28921,7 @@ "description": "Default value. Cannot be set when column is required.", "default": null, "x-example": null, + "format": "int64", "x-nullable": true }, "newKey": { @@ -28821,7 +28967,7 @@ "x-appwrite": { "method": "createIpColumn", "group": "columns", - "weight": 411, + "weight": 369, "cookies": false, "type": "", "demo": "tablesdb\/create-ip-column.md", @@ -28934,7 +29080,7 @@ "x-appwrite": { "method": "updateIpColumn", "group": "columns", - "weight": 412, + "weight": 370, "cookies": false, "type": "", "demo": "tablesdb\/update-ip-column.md", @@ -29049,7 +29195,7 @@ "x-appwrite": { "method": "createLineColumn", "group": "columns", - "weight": 413, + "weight": 371, "cookies": false, "type": "", "demo": "tablesdb\/create-line-column.md", @@ -29156,7 +29302,7 @@ "x-appwrite": { "method": "updateLineColumn", "group": "columns", - "weight": 414, + "weight": 372, "cookies": false, "type": "", "demo": "tablesdb\/update-line-column.md", @@ -29270,7 +29416,7 @@ "x-appwrite": { "method": "createPointColumn", "group": "columns", - "weight": 415, + "weight": 373, "cookies": false, "type": "", "demo": "tablesdb\/create-point-column.md", @@ -29377,7 +29523,7 @@ "x-appwrite": { "method": "updatePointColumn", "group": "columns", - "weight": 416, + "weight": 374, "cookies": false, "type": "", "demo": "tablesdb\/update-point-column.md", @@ -29491,7 +29637,7 @@ "x-appwrite": { "method": "createPolygonColumn", "group": "columns", - "weight": 417, + "weight": 375, "cookies": false, "type": "", "demo": "tablesdb\/create-polygon-column.md", @@ -29598,7 +29744,7 @@ "x-appwrite": { "method": "updatePolygonColumn", "group": "columns", - "weight": 418, + "weight": 376, "cookies": false, "type": "", "demo": "tablesdb\/update-polygon-column.md", @@ -29712,7 +29858,7 @@ "x-appwrite": { "method": "createRelationshipColumn", "group": "columns", - "weight": 419, + "weight": 377, "cookies": false, "type": "", "demo": "tablesdb\/create-relationship-column.md", @@ -29853,7 +29999,7 @@ "x-appwrite": { "method": "createStringColumn", "group": "columns", - "weight": 421, + "weight": 379, "cookies": false, "type": "", "demo": "tablesdb\/create-string-column.md", @@ -29915,7 +30061,8 @@ "type": "integer", "description": "Column size for text columns, in number of characters.", "default": null, - "x-example": 1 + "x-example": 1, + "format": "int32" }, "required": { "type": "boolean", @@ -29979,7 +30126,7 @@ "x-appwrite": { "method": "updateStringColumn", "group": "columns", - "weight": 422, + "weight": 380, "cookies": false, "type": "", "demo": "tablesdb\/update-string-column.md", @@ -30056,6 +30203,7 @@ "description": "Maximum size of the string column.", "default": null, "x-example": 1, + "format": "int32", "x-nullable": true }, "newKey": { @@ -30101,7 +30249,7 @@ "x-appwrite": { "method": "createUrlColumn", "group": "columns", - "weight": 423, + "weight": 381, "cookies": false, "type": "", "demo": "tablesdb\/create-url-column.md", @@ -30170,6 +30318,7 @@ "description": "Default value for column when not provided. Cannot be set when column is required.", "default": null, "x-example": "https:\/\/example.com", + "format": "url", "x-nullable": true }, "array": { @@ -30214,7 +30363,7 @@ "x-appwrite": { "method": "updateUrlColumn", "group": "columns", - "weight": 424, + "weight": 382, "cookies": false, "type": "", "demo": "tablesdb\/update-url-column.md", @@ -30284,6 +30433,7 @@ "description": "Default value for column when not provided. Cannot be set when column is required.", "default": null, "x-example": "https:\/\/example.com", + "format": "url", "x-nullable": true }, "newKey": { @@ -30358,7 +30508,7 @@ "x-appwrite": { "method": "getColumn", "group": "columns", - "weight": 396, + "weight": 354, "cookies": false, "type": "", "demo": "tablesdb\/get-column.md", @@ -30433,7 +30583,7 @@ "x-appwrite": { "method": "deleteColumn", "group": "columns", - "weight": 397, + "weight": 355, "cookies": false, "type": "", "demo": "tablesdb\/delete-column.md", @@ -30515,7 +30665,7 @@ "x-appwrite": { "method": "updateRelationshipColumn", "group": "columns", - "weight": 420, + "weight": 378, "cookies": false, "type": "", "demo": "tablesdb\/update-relationship-column.md", @@ -30625,7 +30775,7 @@ "x-appwrite": { "method": "listIndexes", "group": "indexes", - "weight": 428, + "weight": 386, "cookies": false, "type": "", "demo": "tablesdb\/list-indexes.md", @@ -30719,7 +30869,7 @@ "x-appwrite": { "method": "createIndex", "group": "indexes", - "weight": 425, + "weight": 383, "cookies": false, "type": "", "demo": "tablesdb\/create-index.md", @@ -30859,7 +31009,7 @@ "x-appwrite": { "method": "getIndex", "group": "indexes", - "weight": 426, + "weight": 384, "cookies": false, "type": "", "demo": "tablesdb\/get-index.md", @@ -30934,7 +31084,7 @@ "x-appwrite": { "method": "deleteIndex", "group": "indexes", - "weight": 427, + "weight": 385, "cookies": false, "type": "", "demo": "tablesdb\/delete-index.md", @@ -31014,7 +31164,7 @@ "x-appwrite": { "method": "listRows", "group": "rows", - "weight": 437, + "weight": 395, "cookies": false, "type": "", "demo": "tablesdb\/list-rows.md", @@ -31119,7 +31269,7 @@ "x-appwrite": { "method": "createRow", "group": "rows", - "weight": 429, + "weight": 387, "cookies": false, "type": "", "demo": "tablesdb\/create-row.md", @@ -31305,7 +31455,7 @@ "x-appwrite": { "method": "upsertRows", "group": "rows", - "weight": 434, + "weight": 392, "cookies": false, "type": "", "demo": "tablesdb\/upsert-rows.md", @@ -31437,7 +31587,7 @@ "x-appwrite": { "method": "updateRows", "group": "rows", - "weight": 432, + "weight": 390, "cookies": false, "type": "", "demo": "tablesdb\/update-rows.md", @@ -31541,7 +31691,7 @@ "x-appwrite": { "method": "deleteRows", "group": "rows", - "weight": 436, + "weight": 394, "cookies": false, "type": "", "demo": "tablesdb\/delete-rows.md", @@ -31639,7 +31789,7 @@ "x-appwrite": { "method": "getRow", "group": "rows", - "weight": 430, + "weight": 388, "cookies": false, "type": "", "demo": "tablesdb\/get-row.md", @@ -31743,7 +31893,7 @@ "x-appwrite": { "method": "upsertRow", "group": "rows", - "weight": 433, + "weight": 391, "cookies": false, "type": "", "demo": "tablesdb\/upsert-row.md", @@ -31892,7 +32042,7 @@ "x-appwrite": { "method": "updateRow", "group": "rows", - "weight": 431, + "weight": 389, "cookies": false, "type": "", "demo": "tablesdb\/update-row.md", @@ -32003,7 +32153,7 @@ "x-appwrite": { "method": "deleteRow", "group": "rows", - "weight": 435, + "weight": 393, "cookies": false, "type": "", "demo": "tablesdb\/delete-row.md", @@ -32105,7 +32255,7 @@ "x-appwrite": { "method": "decrementRowColumn", "group": "rows", - "weight": 440, + "weight": 398, "cookies": false, "type": "", "demo": "tablesdb\/decrement-row-column.md", @@ -32179,13 +32329,15 @@ "type": "number", "description": "Value to increment the column by. The value must be a number.", "default": 1, - "x-example": null + "x-example": null, + "format": "float" }, "min": { "type": "number", "description": "Minimum value for the column. If the current value is lesser than this value, an exception will be thrown.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "transactionId": { @@ -32227,7 +32379,7 @@ "x-appwrite": { "method": "incrementRowColumn", "group": "rows", - "weight": 439, + "weight": 397, "cookies": false, "type": "", "demo": "tablesdb\/increment-row-column.md", @@ -32301,13 +32453,15 @@ "type": "number", "description": "Value to increment the column by. The value must be a number.", "default": 1, - "x-example": null + "x-example": null, + "format": "float" }, "max": { "type": "number", "description": "Maximum value for the column. If the current value is greater than this value, an error will be thrown.", "default": null, "x-example": null, + "format": "float", "x-nullable": true }, "transactionId": { @@ -32347,7 +32501,7 @@ "x-appwrite": { "method": "list", "group": "teams", - "weight": 162, + "weight": 110, "cookies": false, "type": "", "demo": "teams\/list.md", @@ -32434,7 +32588,7 @@ "x-appwrite": { "method": "create", "group": "teams", - "weight": 161, + "weight": 109, "cookies": false, "type": "", "demo": "teams\/create.md", @@ -32527,7 +32681,7 @@ "x-appwrite": { "method": "get", "group": "teams", - "weight": 163, + "weight": 111, "cookies": false, "type": "", "demo": "teams\/get.md", @@ -32592,7 +32746,7 @@ "x-appwrite": { "method": "updateName", "group": "teams", - "weight": 165, + "weight": 113, "cookies": false, "type": "", "demo": "teams\/update-name.md", @@ -32670,7 +32824,7 @@ "x-appwrite": { "method": "delete", "group": "teams", - "weight": 167, + "weight": 115, "cookies": false, "type": "", "demo": "teams\/delete.md", @@ -32735,7 +32889,7 @@ "x-appwrite": { "method": "listMemberships", "group": "memberships", - "weight": 169, + "weight": 117, "cookies": false, "type": "", "demo": "teams\/list-memberships.md", @@ -32830,7 +32984,7 @@ "x-appwrite": { "method": "createMembership", "group": "memberships", - "weight": 168, + "weight": 116, "cookies": false, "type": "", "demo": "teams\/create-membership.md", @@ -32878,7 +33032,8 @@ "type": "string", "description": "Email of the new team member.", "default": "", - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "userId": { "type": "string", @@ -32890,7 +33045,8 @@ "type": "string", "description": "Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", "default": "", - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" }, "roles": { "type": "array", @@ -32912,7 +33068,8 @@ "type": "string", "description": "URL to redirect the user back to your app from the invitation email. This parameter is not required when an API key is supplied. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.", "default": "", - "x-example": "https:\/\/example.com" + "x-example": "https:\/\/example.com", + "format": "url" }, "name": { "type": "string", @@ -32953,7 +33110,7 @@ "x-appwrite": { "method": "getMembership", "group": "memberships", - "weight": 170, + "weight": 118, "cookies": false, "type": "", "demo": "teams\/get-membership.md", @@ -33026,7 +33183,7 @@ "x-appwrite": { "method": "updateMembership", "group": "memberships", - "weight": 171, + "weight": 119, "cookies": false, "type": "", "demo": "teams\/update-membership.md", @@ -33122,7 +33279,7 @@ "x-appwrite": { "method": "deleteMembership", "group": "memberships", - "weight": 173, + "weight": 121, "cookies": false, "type": "", "demo": "teams\/delete-membership.md", @@ -33197,7 +33354,7 @@ "x-appwrite": { "method": "updateMembershipStatus", "group": "memberships", - "weight": 172, + "weight": 120, "cookies": false, "type": "", "demo": "teams\/update-membership-status.md", @@ -33294,7 +33451,7 @@ "x-appwrite": { "method": "getPrefs", "group": "teams", - "weight": 164, + "weight": 112, "cookies": false, "type": "", "demo": "teams\/get-prefs.md", @@ -33358,7 +33515,7 @@ "x-appwrite": { "method": "updatePrefs", "group": "teams", - "weight": 166, + "weight": 114, "cookies": false, "type": "", "demo": "teams\/update-prefs.md", @@ -33440,7 +33597,7 @@ "x-appwrite": { "method": "list", "group": "files", - "weight": 523, + "weight": 517, "cookies": false, "type": "", "demo": "tokens\/list.md", @@ -33530,7 +33687,7 @@ "x-appwrite": { "method": "createFileToken", "group": "files", - "weight": 521, + "weight": 515, "cookies": false, "type": "", "demo": "tokens\/create-file-token.md", @@ -33615,7 +33772,7 @@ "x-appwrite": { "method": "get", "group": "tokens", - "weight": 522, + "weight": 516, "cookies": false, "type": "", "demo": "tokens\/get.md", @@ -33676,7 +33833,7 @@ "x-appwrite": { "method": "update", "group": "tokens", - "weight": 524, + "weight": 518, "cookies": false, "type": "", "demo": "tokens\/update.md", @@ -33748,7 +33905,7 @@ "x-appwrite": { "method": "delete", "group": "tokens", - "weight": 525, + "weight": 519, "cookies": false, "type": "", "demo": "tokens\/delete.md", @@ -33809,7 +33966,7 @@ "x-appwrite": { "method": "list", "group": "users", - "weight": 184, + "weight": 132, "cookies": false, "type": "", "demo": "users\/list.md", @@ -33893,7 +34050,7 @@ "x-appwrite": { "method": "create", "group": "users", - "weight": 175, + "weight": 123, "cookies": false, "type": "", "demo": "users\/create.md", @@ -33937,6 +34094,7 @@ "description": "User email.", "default": null, "x-example": "email@example.com", + "format": "email", "x-nullable": true }, "phone": { @@ -33944,6 +34102,7 @@ "description": "Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.", "default": null, "x-example": "+12065550100", + "format": "phone", "x-nullable": true }, "password": { @@ -33993,7 +34152,7 @@ "x-appwrite": { "method": "createArgon2User", "group": "users", - "weight": 178, + "weight": 126, "cookies": false, "type": "", "demo": "users\/create-argon-2-user.md", @@ -34036,13 +34195,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using Argon2.", "default": null, - "x-example": "password" + "x-example": "password", + "format": "password" }, "name": { "type": "string", @@ -34087,7 +34248,7 @@ "x-appwrite": { "method": "createBcryptUser", "group": "users", - "weight": 176, + "weight": 124, "cookies": false, "type": "", "demo": "users\/create-bcrypt-user.md", @@ -34130,13 +34291,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using Bcrypt.", "default": null, - "x-example": "password" + "x-example": "password", + "format": "password" }, "name": { "type": "string", @@ -34179,7 +34342,7 @@ "x-appwrite": { "method": "listIdentities", "group": "identities", - "weight": 192, + "weight": 140, "cookies": false, "type": "", "demo": "users\/list-identities.md", @@ -34260,7 +34423,7 @@ "x-appwrite": { "method": "deleteIdentity", "group": "identities", - "weight": 215, + "weight": 163, "cookies": false, "type": "", "demo": "users\/delete-identity.md", @@ -34324,7 +34487,7 @@ "x-appwrite": { "method": "createMD5User", "group": "users", - "weight": 177, + "weight": 125, "cookies": false, "type": "", "demo": "users\/create-md-5-user.md", @@ -34367,13 +34530,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using MD5.", "default": null, - "x-example": "password" + "x-example": "password", + "format": "password" }, "name": { "type": "string", @@ -34418,7 +34583,7 @@ "x-appwrite": { "method": "createPHPassUser", "group": "users", - "weight": 180, + "weight": 128, "cookies": false, "type": "", "demo": "users\/create-ph-pass-user.md", @@ -34461,13 +34626,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using PHPass.", "default": null, - "x-example": "password" + "x-example": "password", + "format": "password" }, "name": { "type": "string", @@ -34512,7 +34679,7 @@ "x-appwrite": { "method": "createScryptUser", "group": "users", - "weight": 181, + "weight": 129, "cookies": false, "type": "", "demo": "users\/create-scrypt-user.md", @@ -34555,13 +34722,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using Scrypt.", "default": null, - "x-example": "password" + "x-example": "password", + "format": "password" }, "passwordSalt": { "type": "string", @@ -34573,25 +34742,29 @@ "type": "integer", "description": "Optional CPU cost used to hash password.", "default": null, - "x-example": null + "x-example": null, + "format": "int32" }, "passwordMemory": { "type": "integer", "description": "Optional memory cost used to hash password.", "default": null, - "x-example": null + "x-example": null, + "format": "int32" }, "passwordParallel": { "type": "integer", "description": "Optional parallelization cost used to hash password.", "default": null, - "x-example": null + "x-example": null, + "format": "int32" }, "passwordLength": { "type": "integer", "description": "Optional hash length used to hash password.", "default": null, - "x-example": null + "x-example": null, + "format": "int32" }, "name": { "type": "string", @@ -34641,7 +34814,7 @@ "x-appwrite": { "method": "createScryptModifiedUser", "group": "users", - "weight": 182, + "weight": 130, "cookies": false, "type": "", "demo": "users\/create-scrypt-modified-user.md", @@ -34684,13 +34857,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using Scrypt Modified.", "default": null, - "x-example": "password" + "x-example": "password", + "format": "password" }, "passwordSalt": { "type": "string", @@ -34756,7 +34931,7 @@ "x-appwrite": { "method": "createSHAUser", "group": "users", - "weight": 179, + "weight": 127, "cookies": false, "type": "", "demo": "users\/create-sha-user.md", @@ -34799,13 +34974,15 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" }, "password": { "type": "string", "description": "User password hashed using SHA.", "default": null, - "x-example": "password" + "x-example": "password", + "format": "password" }, "passwordVersion": { "type": "string", @@ -34869,7 +35046,7 @@ "x-appwrite": { "method": "get", "group": "users", - "weight": 185, + "weight": 133, "cookies": false, "type": "", "demo": "users\/get.md", @@ -34926,7 +35103,7 @@ "x-appwrite": { "method": "delete", "group": "users", - "weight": 213, + "weight": 161, "cookies": false, "type": "", "demo": "users\/delete.md", @@ -34990,7 +35167,7 @@ "x-appwrite": { "method": "updateEmail", "group": "users", - "weight": 198, + "weight": 146, "cookies": false, "type": "", "demo": "users\/update-email.md", @@ -35035,7 +35212,8 @@ "type": "string", "description": "User email.", "default": null, - "x-example": "email@example.com" + "x-example": "email@example.com", + "format": "email" } }, "required": [ @@ -35072,7 +35250,7 @@ "x-appwrite": { "method": "createJWT", "group": "sessions", - "weight": 216, + "weight": 164, "cookies": false, "type": "", "demo": "users\/create-jwt.md", @@ -35123,7 +35301,8 @@ "type": "integer", "description": "Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds.", "default": 900, - "x-example": 0 + "x-example": 0, + "format": "int32" } } } @@ -35157,7 +35336,7 @@ "x-appwrite": { "method": "updateLabels", "group": "users", - "weight": 194, + "weight": 142, "cookies": false, "type": "", "demo": "users\/update-labels.md", @@ -35240,7 +35419,7 @@ "x-appwrite": { "method": "listLogs", "group": "logs", - "weight": 190, + "weight": 138, "cookies": false, "type": "", "demo": "users\/list-logs.md", @@ -35323,7 +35502,7 @@ "x-appwrite": { "method": "listMemberships", "group": "memberships", - "weight": 189, + "weight": 137, "cookies": false, "type": "", "demo": "users\/list-memberships.md", @@ -35417,7 +35596,7 @@ "x-appwrite": { "method": "updateMfa", "group": "users", - "weight": 203, + "weight": 151, "cookies": false, "type": "", "demo": "users\/update-mfa.md", @@ -35556,7 +35735,7 @@ "x-appwrite": { "method": "deleteMfaAuthenticator", "group": "mfa", - "weight": 208, + "weight": 156, "cookies": false, "type": "", "demo": "users\/delete-mfa-authenticator.md", @@ -35691,7 +35870,7 @@ "x-appwrite": { "method": "listMfaFactors", "group": "mfa", - "weight": 204, + "weight": 152, "cookies": false, "type": "", "demo": "users\/list-mfa-factors.md", @@ -35811,7 +35990,7 @@ "x-appwrite": { "method": "getMfaRecoveryCodes", "group": "mfa", - "weight": 205, + "weight": 153, "cookies": false, "type": "", "demo": "users\/get-mfa-recovery-codes.md", @@ -35931,7 +36110,7 @@ "x-appwrite": { "method": "updateMfaRecoveryCodes", "group": "mfa", - "weight": 207, + "weight": 155, "cookies": false, "type": "", "demo": "users\/update-mfa-recovery-codes.md", @@ -36051,7 +36230,7 @@ "x-appwrite": { "method": "createMfaRecoveryCodes", "group": "mfa", - "weight": 206, + "weight": 154, "cookies": false, "type": "", "demo": "users\/create-mfa-recovery-codes.md", @@ -36173,7 +36352,7 @@ "x-appwrite": { "method": "updateName", "group": "users", - "weight": 196, + "weight": 144, "cookies": false, "type": "", "demo": "users\/update-name.md", @@ -36255,7 +36434,7 @@ "x-appwrite": { "method": "updatePassword", "group": "users", - "weight": 197, + "weight": 145, "cookies": false, "type": "", "demo": "users\/update-password.md", @@ -36337,7 +36516,7 @@ "x-appwrite": { "method": "updatePhone", "group": "users", - "weight": 199, + "weight": 147, "cookies": false, "type": "", "demo": "users\/update-phone.md", @@ -36382,7 +36561,8 @@ "type": "string", "description": "User phone number.", "default": null, - "x-example": "+12065550100" + "x-example": "+12065550100", + "format": "phone" } }, "required": [ @@ -36417,7 +36597,7 @@ "x-appwrite": { "method": "getPrefs", "group": "users", - "weight": 186, + "weight": 134, "cookies": false, "type": "", "demo": "users\/get-prefs.md", @@ -36479,7 +36659,7 @@ "x-appwrite": { "method": "updatePrefs", "group": "users", - "weight": 201, + "weight": 149, "cookies": false, "type": "", "demo": "users\/update-prefs.md", @@ -36559,7 +36739,7 @@ "x-appwrite": { "method": "listSessions", "group": "sessions", - "weight": 188, + "weight": 136, "cookies": false, "type": "", "demo": "users\/list-sessions.md", @@ -36630,7 +36810,7 @@ "x-appwrite": { "method": "createSession", "group": "sessions", - "weight": 209, + "weight": 157, "cookies": false, "type": "", "demo": "users\/create-session.md", @@ -36687,7 +36867,7 @@ "x-appwrite": { "method": "deleteSessions", "group": "sessions", - "weight": 212, + "weight": 160, "cookies": false, "type": "", "demo": "users\/delete-sessions.md", @@ -36746,7 +36926,7 @@ "x-appwrite": { "method": "deleteSession", "group": "sessions", - "weight": 211, + "weight": 159, "cookies": false, "type": "", "demo": "users\/delete-session.md", @@ -36818,7 +36998,7 @@ "x-appwrite": { "method": "updateStatus", "group": "users", - "weight": 193, + "weight": 141, "cookies": false, "type": "", "demo": "users\/update-status.md", @@ -36898,7 +37078,7 @@ "x-appwrite": { "method": "listTargets", "group": "targets", - "weight": 191, + "weight": 139, "cookies": false, "type": "", "demo": "users\/list-targets.md", @@ -36981,7 +37161,7 @@ "x-appwrite": { "method": "createTarget", "group": "targets", - "weight": 183, + "weight": 131, "cookies": false, "type": "", "demo": "users\/create-target.md", @@ -37094,7 +37274,7 @@ "x-appwrite": { "method": "getTarget", "group": "targets", - "weight": 187, + "weight": 135, "cookies": false, "type": "", "demo": "users\/get-target.md", @@ -37164,7 +37344,7 @@ "x-appwrite": { "method": "updateTarget", "group": "targets", - "weight": 202, + "weight": 150, "cookies": false, "type": "", "demo": "users\/update-target.md", @@ -37256,7 +37436,7 @@ "x-appwrite": { "method": "deleteTarget", "group": "targets", - "weight": 214, + "weight": 162, "cookies": false, "type": "", "demo": "users\/delete-target.md", @@ -37328,7 +37508,7 @@ "x-appwrite": { "method": "createToken", "group": "sessions", - "weight": 210, + "weight": 158, "cookies": false, "type": "", "demo": "users\/create-token.md", @@ -37373,13 +37553,15 @@ "type": "integer", "description": "Token length in characters. The default length is 6 characters", "default": 6, - "x-example": 4 + "x-example": 4, + "format": "int32" }, "expire": { "type": "integer", "description": "Token expiration period in seconds. The default expiration is 15 minutes.", "default": 900, - "x-example": 60 + "x-example": 60, + "format": "int32" } } } @@ -37413,7 +37595,7 @@ "x-appwrite": { "method": "updateEmailVerification", "group": "users", - "weight": 200, + "weight": 148, "cookies": false, "type": "", "demo": "users\/update-email-verification.md", @@ -37495,7 +37677,7 @@ "x-appwrite": { "method": "updatePhoneVerification", "group": "users", - "weight": 195, + "weight": 143, "cookies": false, "type": "", "demo": "users\/update-phone-verification.md", @@ -37615,7 +37797,7 @@ }, { "name": "console", - "description": "The Console service allows you to interact with console relevant informations." + "description": "The Console service allows you to interact with console relevant information." }, { "name": "migrations", @@ -38445,6 +38627,35 @@ "variables": "" } }, + "healthStatusList": { + "description": "Status List", + "type": "object", + "properties": { + "total": { + "type": "integer", + "description": "Total number of statuses that matched your query.", + "x-example": 5, + "format": "int32" + }, + "statuses": { + "type": "array", + "description": "List of statuses.", + "items": { + "type": "object", + "$ref": "#\/definitions\/healthStatus" + }, + "x-example": "" + } + }, + "required": [ + "total", + "statuses" + ], + "example": { + "total": 5, + "statuses": "" + } + }, "localeCodeList": { "description": "Locale codes list", "type": "object", @@ -39088,14 +39299,14 @@ "type": "integer", "description": "Minimum value to enforce for new documents.", "x-example": 1, - "format": "int32", + "format": "int64", "x-nullable": true }, "max": { "type": "integer", "description": "Maximum value to enforce for new documents.", "x-example": 10, - "format": "int32", + "format": "int64", "x-nullable": true }, "default": { @@ -40538,14 +40749,14 @@ "type": "integer", "description": "Minimum value to enforce for new documents.", "x-example": 1, - "format": "int32", + "format": "int64", "x-nullable": true }, "max": { "type": "integer", "description": "Maximum value to enforce for new documents.", "x-example": 10, - "format": "int32", + "format": "int64", "x-nullable": true }, "default": { @@ -43037,6 +43248,16 @@ "description": "Total number of chunks uploaded", "x-example": 17890, "format": "int32" + }, + "encryption": { + "type": "boolean", + "description": "Whether file contents are encrypted at rest.", + "x-example": true + }, + "compression": { + "type": "string", + "description": "Compression algorithm used for the file. Will be one of none, [gzip](https:\/\/en.wikipedia.org\/wiki\/Gzip), or [zstd](https:\/\/en.wikipedia.org\/wiki\/Zstd).", + "x-example": "gzip" } }, "required": [ @@ -43050,7 +43271,9 @@ "mimeType", "sizeOriginal", "chunksTotal", - "chunksUploaded" + "chunksUploaded", + "encryption", + "compression" ], "example": { "$id": "5e5ea5c16897e", @@ -43065,7 +43288,9 @@ "mimeType": "image\/png", "sizeOriginal": 17890, "chunksTotal": 17890, - "chunksUploaded": 17890 + "chunksUploaded": 17890, + "encryption": true, + "compression": "gzip" } }, "bucket": { @@ -43131,7 +43356,7 @@ }, "compression": { "type": "string", - "description": "Compression algorithm choosen for compression. Will be one of none, [gzip](https:\/\/en.wikipedia.org\/wiki\/Gzip), or [zstd](https:\/\/en.wikipedia.org\/wiki\/Zstd).", + "description": "Compression algorithm chosen for compression. Will be one of none, [gzip](https:\/\/en.wikipedia.org\/wiki\/Gzip), or [zstd](https:\/\/en.wikipedia.org\/wiki\/Zstd).", "x-example": "gzip" }, "encryption": { @@ -43148,6 +43373,12 @@ "type": "boolean", "description": "Image transformations are enabled.", "x-example": false + }, + "totalSize": { + "type": "integer", + "description": "Total size of this bucket in bytes.", + "x-example": 128, + "format": "int32" } }, "required": [ @@ -43163,7 +43394,8 @@ "compression", "encryption", "antivirus", - "transformations" + "transformations", + "totalSize" ], "example": { "$id": "5e5ea5c16897e", @@ -43183,7 +43415,8 @@ "compression": "gzip", "encryption": false, "antivirus": false, - "transformations": false + "transformations": false, + "totalSize": 128 } }, "resourceToken": { @@ -44121,13 +44354,14 @@ }, "status": { "type": "string", - "description": "The deployment status. Possible values are \"waiting\", \"processing\", \"building\", \"ready\", and \"failed\".", + "description": "The deployment status. Possible values are \"waiting\", \"processing\", \"building\", \"ready\", \"canceled\" and \"failed\".", "x-example": "ready", "enum": [ "waiting", "processing", "building", "ready", + "canceled", "failed" ] }, @@ -45207,7 +45441,7 @@ "status": { "type": "string", "description": "Status of delivery.", - "x-example": "Message status can be one of the following: draft, processing, scheduled, sent, or failed.", + "x-example": "processing", "enum": [ "draft", "processing", @@ -45253,7 +45487,7 @@ "subject": "Welcome to Appwrite", "content": "Hi there, welcome to Appwrite family." }, - "status": "Message status can be one of the following: draft, processing, scheduled, sent, or failed." + "status": "processing" } }, "topic": { diff --git a/app/config/variables.php b/app/config/variables.php index 653e959101..36f691e534 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -1285,6 +1285,15 @@ return [ 'category' => 'GraphQL', 'description' => '', 'variables' => [ + [ + 'name' => '_APP_GRAPHQL_INTROSPECTION', + 'description' => 'Enable or disable GraphQL introspection. Set to \'enabled\' to allow schema introspection, or \'disabled\' to block it. The default value is \'enabled\'.', + 'introduction' => '', + 'default' => 'enabled', + 'required' => false, + 'question' => '', + 'filter' => '' + ], [ 'name' => '_APP_GRAPHQL_MAX_BATCH_SIZE', 'description' => 'Maximum number of batched queries per request. The default value is 10.', diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index b740cbe87d..ce655bfe18 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -33,11 +33,11 @@ use Appwrite\Utopia\Database\Validator\CustomId; use Appwrite\Utopia\Database\Validator\Queries\Identities; use Appwrite\Utopia\Request; use Appwrite\Utopia\Response; +use libphonenumber\NumberParseException; use libphonenumber\PhoneNumberUtil; use MaxMind\Db\Reader; -use Utopia\Abuse\Abuse; use Utopia\App; -use Utopia\Audit\Audit as EventAudit; +use Utopia\Audit\Audit; use Utopia\Auth\Hashes\Sha; use Utopia\Auth\Proofs\Code as ProofsCode; use Utopia\Auth\Proofs\Password as ProofsPassword; @@ -68,6 +68,7 @@ use Utopia\Validator; use Utopia\Validator\ArrayList; use Utopia\Validator\Assoc; use Utopia\Validator\Boolean; +use Utopia\Validator\Range; use Utopia\Validator\Text; use Utopia\Validator\WhiteList; @@ -959,6 +960,7 @@ App::post('/v1/account/sessions/email') )) ->label('abuse-limit', 10) ->label('abuse-key', 'url:{url},email:{param-email}') + ->label('abuse-reset', [201]) ->param('email', '', new EmailValidator(), 'User email.') ->param('password', '', new Password(), 'User password. Must be at least 8 chars.') ->inject('request') @@ -1259,6 +1261,7 @@ App::post('/v1/account/sessions/token') )) ->label('abuse-limit', 10) ->label('abuse-key', 'ip:{ip},userId:{param-userId}') + ->label('abuse-reset', [201]) ->param('userId', '', new CustomId(), 'User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') ->param('secret', '', new Text(256), 'Secret of a token generated by login methods. For example, the `createMagicURLToken` or `createPhoneToken` methods.') ->inject('request') @@ -2651,6 +2654,7 @@ App::put('/v1/account/sessions/magic-url') )) ->label('abuse-limit', 10) ->label('abuse-key', 'ip:{ip},userId:{param-userId}') + ->label('abuse-reset', [201]) ->param('userId', '', new CustomId(), 'User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') ->param('secret', '', new Text(256), 'Valid verification token.') ->inject('request') @@ -2904,26 +2908,21 @@ App::post('/v1/account/tokens/phone') ->setRecipients([$phone]) ->setProviderType(MESSAGE_TYPE_SMS); - if (isset($plan['authPhone'])) { - $timelimit = $timelimit('organization:{organizationId}', $plan['authPhone'], 30 * 24 * 60 * 60); // 30 days - $timelimit - ->setParam('{organizationId}', $project->getAttribute('teamId')); + $helper = PhoneNumberUtil::getInstance(); + try { + $countryCode = $helper->parse($phone)->getCountryCode(); - $abuse = new Abuse($timelimit); - if ($abuse->check() && System::getEnv('_APP_OPTIONS_ABUSE', 'enabled') === 'enabled') { - $helper = PhoneNumberUtil::getInstance(); - $countryCode = $helper->parse($phone)->getCountryCode(); - - if (!empty($countryCode)) { - $queueForStatsUsage - ->addMetric(str_replace('{countryCode}', $countryCode, METRIC_AUTH_METHOD_PHONE_COUNTRY_CODE), 1); - } + if (!empty($countryCode)) { + $queueForStatsUsage + ->addMetric(str_replace('{countryCode}', $countryCode, METRIC_AUTH_METHOD_PHONE_COUNTRY_CODE), 1); } - $queueForStatsUsage - ->addMetric(METRIC_AUTH_METHOD_PHONE, 1) - ->setProject($project) - ->trigger(); + } catch (NumberParseException $e) { + // Ignore invalid phone number for country code stats } + $queueForStatsUsage + ->addMetric(METRIC_AUTH_METHOD_PHONE, 1) + ->setProject($project) + ->trigger(); } $token->setAttribute('secret', $secret); @@ -2963,20 +2962,22 @@ App::post('/v1/account/jwts') ], contentType: ContentType::JSON, )) - ->label('abuse-limit', 100) + ->param('duration', 900, new Range(0, 3600), 'Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds.', true) + ->label('abuse-limit', APP_LIMIT_WRITE_RATE_DEFAULT * 2) + ->label('abuse-time', APP_LIMIT_WRITE_RATE_PERIOD_DEFAULT) ->label('abuse-key', 'url:{url},userId:{userId}') ->inject('response') ->inject('user') ->inject('store') ->inject('proofForToken') - ->action(function (Response $response, User $user, Store $store, ProofsToken $proofForToken) { + ->action(function (int $duration, Response $response, User $user, Store $store, ProofsToken $proofForToken) { $sessionId = $user->sessionVerify($store->getProperty('secret', ''), $proofForToken); if (!$sessionId) { throw new Exception(Exception::USER_SESSION_NOT_FOUND); } - $jwt = new JWT(System::getEnv('_APP_OPENSSL_KEY_V1'), 'HS256', 900, 0); + $jwt = new JWT(System::getEnv('_APP_OPENSSL_KEY_V1'), 'HS256', $duration, 0); $response ->setStatusCode(Response::STATUS_CODE_CREATED) @@ -3040,7 +3041,8 @@ App::get('/v1/account/logs') ->inject('locale') ->inject('geodb') ->inject('dbForProject') - ->action(function (array $queries, bool $includeTotal, Response $response, Document $user, Locale $locale, Reader $geodb, Database $dbForProject) { + ->inject('audit') + ->action(function (array $queries, bool $includeTotal, Response $response, Document $user, Locale $locale, Reader $geodb, Database $dbForProject, Audit $audit) { try { $queries = Query::parseQueries($queries); @@ -3048,9 +3050,10 @@ App::get('/v1/account/logs') throw new Exception(Exception::GENERAL_QUERY_INVALID, $e->getMessage()); } - $audit = new EventAudit($dbForProject); - - $logs = $audit->getLogsByUser($user->getSequence(), $queries); + $grouped = Query::groupByType($queries); + $limit = $grouped['limit'] ?? 25; + $offset = $grouped['offset'] ?? 0; + $logs = $audit->getLogsByUser($user->getSequence(), offset: $offset, limit: $limit); $output = []; @@ -3079,7 +3082,7 @@ App::get('/v1/account/logs') } $response->dynamic(new Document([ - 'total' => $includeTotal ? $audit->countLogsByUser($user->getSequence(), $queries) : 0, + 'total' => $includeTotal ? $audit->countLogsByUser($user->getSequence()) : 0, 'logs' => $output, ]), Response::MODEL_LOG_LIST); }); @@ -4236,26 +4239,21 @@ App::post('/v1/account/verifications/phone') ->setRecipients([$user->getAttribute('phone')]) ->setProviderType(MESSAGE_TYPE_SMS); - if (isset($plan['authPhone'])) { - $timelimit = $timelimit('organization:{organizationId}', $plan['authPhone'], 30 * 24 * 60 * 60); // 30 days - $timelimit - ->setParam('{organizationId}', $project->getAttribute('teamId')); + $helper = PhoneNumberUtil::getInstance(); + try { + $countryCode = $helper->parse($phone)->getCountryCode(); - $abuse = new Abuse($timelimit); - if ($abuse->check() && System::getEnv('_APP_OPTIONS_ABUSE', 'enabled') === 'enabled') { - $helper = PhoneNumberUtil::getInstance(); - $countryCode = $helper->parse($phone)->getCountryCode(); - - if (!empty($countryCode)) { - $queueForStatsUsage - ->addMetric(str_replace('{countryCode}', $countryCode, METRIC_AUTH_METHOD_PHONE_COUNTRY_CODE), 1); - } + if (!empty($countryCode)) { + $queueForStatsUsage + ->addMetric(str_replace('{countryCode}', $countryCode, METRIC_AUTH_METHOD_PHONE_COUNTRY_CODE), 1); } - $queueForStatsUsage - ->addMetric(METRIC_AUTH_METHOD_PHONE, 1) - ->setProject($project) - ->trigger(); + } catch (NumberParseException $e) { + // Ignore invalid phone number for country code stats } + $queueForStatsUsage + ->addMetric(METRIC_AUTH_METHOD_PHONE, 1) + ->setProject($project) + ->trigger(); } $verification->setAttribute('secret', $secret); diff --git a/app/controllers/api/avatars.php b/app/controllers/api/avatars.php deleted file mode 100644 index 47ba0ba402..0000000000 --- a/app/controllers/api/avatars.php +++ /dev/null @@ -1,1498 +0,0 @@ -crop((int) $width, (int) $height); - $output = (empty($output)) ? $type : $output; - $data = $image->output($output, $quality); - $response - ->addHeader('Cache-Control', 'private, max-age=2592000') // 30 days - ->setContentType('image/png') - ->file($data); - unset($image); -}; - -$getUserGitHub = function (string $userId, Document $project, Database $dbForProject, Database $dbForPlatform, Authorization $authorization, ?Logger $logger) { - try { - $user = $authorization->skip(fn () => $dbForPlatform->getDocument('users', $userId)); - - $sessions = $user->getAttribute('sessions', []); - - $gitHubSession = null; - foreach ($sessions as $session) { - if ($session->getAttribute('provider', '') === 'github') { - $gitHubSession = $session; - break; - } - } - - if (empty($gitHubSession)) { - throw new Exception(Exception::USER_SESSION_NOT_FOUND, 'GitHub session not found.'); - } - - $provider = $gitHubSession->getAttribute('provider', ''); - $accessToken = $gitHubSession->getAttribute('providerAccessToken'); - $accessTokenExpiry = $gitHubSession->getAttribute('providerAccessTokenExpiry'); - $refreshToken = $gitHubSession->getAttribute('providerRefreshToken'); - - $appId = $project->getAttribute('oAuthProviders', [])[$provider . 'Appid'] ?? ''; - $appSecret = $project->getAttribute('oAuthProviders', [])[$provider . 'Secret'] ?? '{}'; - - $oAuthProviders = Config::getParam('oAuthProviders'); - $className = $oAuthProviders[$provider]['class']; - if (!\class_exists($className)) { - throw new Exception(Exception::PROJECT_PROVIDER_UNSUPPORTED); - } - - $oauth2 = new $className($appId, $appSecret, '', [], []); - - $isExpired = new \DateTime($accessTokenExpiry) < new \DateTime('now'); - if ($isExpired) { - try { - $oauth2->refreshTokens($refreshToken); - - $accessToken = $oauth2->getAccessToken(''); - $refreshToken = $oauth2->getRefreshToken(''); - - $verificationId = $oauth2->getUserID($accessToken); - - if (empty($verificationId)) { - throw new \Exception("Locked tokens."); // Race codition, handeled in catch - } - - $gitHubSession - ->setAttribute('providerAccessToken', $accessToken) - ->setAttribute('providerRefreshToken', $refreshToken) - ->setAttribute('providerAccessTokenExpiry', DateTime::addSeconds(new \DateTime(), (int)$oauth2->getAccessTokenExpiry(''))); - - $authorization->skip(fn () => $dbForProject->updateDocument('sessions', $gitHubSession->getId(), $gitHubSession)); - - $dbForProject->purgeCachedDocument('users', $user->getId()); - } catch (Throwable $err) { - $index = 0; - do { - $previousAccessToken = $gitHubSession->getAttribute('providerAccessToken'); - - $user = $authorization->skip(fn () => $dbForPlatform->getDocument('users', $userId)); - $sessions = $user->getAttribute('sessions', []); - - $gitHubSession = new Document(); - foreach ($sessions as $session) { - if ($session->getAttribute('provider', '') === 'github') { - $gitHubSession = $session; - break; - } - } - - $accessToken = $gitHubSession->getAttribute('providerAccessToken'); - - if ($accessToken !== $previousAccessToken) { - break; - } - - $index++; - \usleep(500000); - } while ($index < 10); - } - } - - $oauth2 = new $className($appId, $appSecret, '', [], []); - $githubUser = $oauth2->getUserSlug($accessToken); - $githubId = $oauth2->getUserID($accessToken); - - return [ - 'name' => $githubUser, - 'id' => $githubId - ]; - } catch (Exception $error) { - return []; - } -}; - -App::get('/v1/avatars/credit-cards/:code') - ->desc('Get credit card icon') - ->groups(['api', 'avatars']) - ->label('scope', 'avatars.read') - ->label('cache', true) - ->label('cache.resource', 'avatar/credit-card') - ->label('sdk', new Method( - namespace: 'avatars', - group: null, - name: 'getCreditCard', - description: '/docs/references/avatars/get-credit-card.md', - auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], - type: MethodType::LOCATION, - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_OK, - model: Response::MODEL_NONE, - ) - ], - contentType: ContentType::IMAGE_PNG - )) - ->param('code', '', new WhiteList(\array_keys(Config::getParam('avatar-credit-cards'))), 'Credit Card Code. Possible values: ' . \implode(', ', \array_keys(Config::getParam('avatar-credit-cards'))) . '.') - ->param('width', 100, new Range(0, 2000), 'Image width. Pass an integer between 0 to 2000. Defaults to 100.', true) - ->param('height', 100, new Range(0, 2000), 'Image height. Pass an integer between 0 to 2000. Defaults to 100.', true) - ->param('quality', -1, new Range(-1, 100), 'Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.', true) - ->inject('response') - ->action(fn (string $code, int $width, int $height, int $quality, Response $response) => $avatarCallback('credit-cards', $code, $width, $height, $quality, $response)); - -App::get('/v1/avatars/browsers/:code') - ->desc('Get browser icon') - ->groups(['api', 'avatars']) - ->label('scope', 'avatars.read') - ->label('cache', true) - ->label('cache.resource', 'avatar/browser') - ->label('sdk', new Method( - namespace: 'avatars', - group: null, - name: 'getBrowser', - description: '/docs/references/avatars/get-browser.md', - auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], - type: MethodType::LOCATION, - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_OK, - model: Response::MODEL_NONE, - ) - ], - contentType: ContentType::IMAGE_PNG - )) - ->param('code', '', new WhiteList(\array_keys(Config::getParam('avatar-browsers'))), 'Browser Code.') - ->param('width', 100, new Range(0, 2000), 'Image width. Pass an integer between 0 to 2000. Defaults to 100.', true) - ->param('height', 100, new Range(0, 2000), 'Image height. Pass an integer between 0 to 2000. Defaults to 100.', true) - ->param('quality', -1, new Range(-1, 100), 'Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.', true) - ->inject('response') - ->action(fn (string $code, int $width, int $height, int $quality, Response $response) => $avatarCallback('browsers', $code, $width, $height, $quality, $response)); - -App::get('/v1/avatars/flags/:code') - ->desc('Get country flag') - ->groups(['api', 'avatars']) - ->label('scope', 'avatars.read') - ->label('cache', true) - ->label('cache.resource', 'avatar/flag') - ->label('sdk', new Method( - namespace: 'avatars', - group: null, - name: 'getFlag', - description: '/docs/references/avatars/get-flag.md', - auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], - type: MethodType::LOCATION, - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_OK, - model: Response::MODEL_NONE, - ) - ], - contentType: ContentType::IMAGE_PNG - )) - ->param('code', '', new WhiteList(\array_keys(Config::getParam('avatar-flags'))), 'Country Code. ISO Alpha-2 country code format.') - ->param('width', 100, new Range(0, 2000), 'Image width. Pass an integer between 0 to 2000. Defaults to 100.', true) - ->param('height', 100, new Range(0, 2000), 'Image height. Pass an integer between 0 to 2000. Defaults to 100.', true) - ->param('quality', -1, new Range(-1, 100), 'Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.', true) - ->inject('response') - ->action(fn (string $code, int $width, int $height, int $quality, Response $response) => $avatarCallback('flags', $code, $width, $height, $quality, $response)); - -App::get('/v1/avatars/image') - ->desc('Get image from URL') - ->groups(['api', 'avatars']) - ->label('scope', 'avatars.read') - ->label('cache', true) - ->label('cache.resource', 'avatar/image') - ->label('sdk', new Method( - namespace: 'avatars', - group: null, - name: 'getImage', - description: '/docs/references/avatars/get-image.md', - auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], - type: MethodType::LOCATION, - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_OK, - model: Response::MODEL_NONE, - ) - ], - contentType: ContentType::IMAGE - )) - ->param('url', '', new URL(['http', 'https']), 'Image URL which you want to crop.') - ->param('width', 400, new Range(0, 2000), 'Resize preview image width, Pass an integer between 0 to 2000. Defaults to 400.', true) - ->param('height', 400, new Range(0, 2000), 'Resize preview image height, Pass an integer between 0 to 2000. Defaults to 400.', true) - ->inject('response') - ->action(function (string $url, int $width, int $height, Response $response) { - - $quality = 80; - $output = 'png'; - $type = 'png'; - - if (!\extension_loaded('imagick')) { - throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Imagick extension is missing'); - } - - $domain = new Domain(\parse_url($url, PHP_URL_HOST)); - - if (!$domain->isKnown()) { - throw new Exception(Exception::AVATAR_REMOTE_URL_FAILED); - } - - $client = new Client(); - try { - $res = $client - ->setAllowRedirects(false) - ->fetch($url); - } catch (\Throwable) { - throw new Exception(Exception::AVATAR_REMOTE_URL_FAILED); - } - - if ($res->getStatusCode() !== 200) { - throw new Exception(Exception::AVATAR_IMAGE_NOT_FOUND); - } - - try { - $image = new Image($res->getBody()); - } catch (\Throwable $exception) { - throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Unable to parse image'); - } - - $image->crop((int) $width, (int) $height); - $output = (empty($output)) ? $type : $output; - $data = $image->output($output, $quality); - - $response - ->addHeader('Cache-Control', 'private, max-age=2592000') // 30 days - ->setContentType('image/png') - ->file($data); - unset($image); - }); - -App::get('/v1/avatars/favicon') - ->desc('Get favicon') - ->groups(['api', 'avatars']) - ->label('scope', 'avatars.read') - ->label('cache', true) - ->label('cache.resource', 'avatar/favicon') - ->label('sdk', new Method( - namespace: 'avatars', - group: null, - name: 'getFavicon', - description: '/docs/references/avatars/get-favicon.md', - auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], - type: MethodType::LOCATION, - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_OK, - model: Response::MODEL_NONE, - ) - ], - contentType: ContentType::IMAGE - )) - ->param('url', '', new URL(['http', 'https']), 'Website URL which you want to fetch the favicon from.') - ->inject('response') - ->action(function (string $url, Response $response) { - - $width = 56; - $height = 56; - $quality = 80; - $output = 'png'; - $type = 'png'; - - if (!\extension_loaded('imagick')) { - throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Imagick extension is missing'); - } - - $domain = new Domain(\parse_url($url, PHP_URL_HOST)); - - if (!$domain->isKnown()) { - throw new Exception(Exception::AVATAR_REMOTE_URL_FAILED); - } - - $client = new Client(); - try { - $res = $client - ->setAllowRedirects(true) - ->setMaxRedirects(5) - ->setUserAgent(\sprintf( - APP_USERAGENT, - System::getEnv('_APP_VERSION', 'UNKNOWN'), - System::getEnv('_APP_EMAIL_SECURITY', System::getEnv('_APP_SYSTEM_SECURITY_EMAIL_ADDRESS', APP_EMAIL_SECURITY)) - )) - ->fetch($url); - } catch (\Throwable) { - throw new Exception(Exception::AVATAR_REMOTE_URL_FAILED); - } - - $doc = new DOMDocument(); - $doc->strictErrorChecking = false; - @$doc->loadHTML($res->getBody()); - - $links = $doc->getElementsByTagName('link') ?? []; - $outputHref = ''; - $outputExt = ''; - $space = 0; - - foreach ($links as $link) { /* @var $link DOMElement */ - $href = $link->getAttribute('href'); - $rel = $link->getAttribute('rel'); - $sizes = $link->getAttribute('sizes'); - $absolute = URLParse::unparse(\array_merge(\parse_url($url), \parse_url($href))); - - switch (\strtolower($rel)) { - case 'icon': - case 'shortcut icon': - //case 'apple-touch-icon': - $ext = \pathinfo(\parse_url($absolute, PHP_URL_PATH), PATHINFO_EXTENSION); - - switch ($ext) { - case 'svg': - // SVG icons are prioritized by assigning the maximum possible value. - $space = PHP_INT_MAX; - $outputHref = $absolute; - $outputExt = $ext; - break; - case 'ico': - case 'png': - case 'jpg': - case 'jpeg': - $size = \explode('x', \strtolower($sizes)); - - $sizeWidth = (int) ($size[0] ?? 0); - $sizeHeight = (int) ($size[1] ?? 0); - - if (($sizeWidth * $sizeHeight) >= $space) { - $space = $sizeWidth * $sizeHeight; - $outputHref = $absolute; - $outputExt = $ext; - } - - break; - } - - break; - } - } - - if (empty($outputHref) || empty($outputExt)) { - $default = \parse_url($url); - - $outputHref = $default['scheme'] . '://' . $default['host'] . '/favicon.ico'; - $outputExt = 'ico'; - } - - $domain = new Domain(\parse_url($outputHref, PHP_URL_HOST)); - - if (!$domain->isKnown()) { - throw new Exception(Exception::AVATAR_REMOTE_URL_FAILED); - } - - $client = new Client(); - try { - $res = $client - ->setAllowRedirects(true) - ->setMaxRedirects(5) - ->fetch($outputHref); - } catch (\Throwable) { - throw new Exception(Exception::AVATAR_REMOTE_URL_FAILED); - } - - if ($res->getStatusCode() !== 200) { - throw new Exception(Exception::AVATAR_ICON_NOT_FOUND); - } - - $data = $res->getBody(); - - if ('ico' === $outputExt) { // Skip crop, Imagick isn\'t supporting icon files - if ( - empty($data) || - stripos($data, 'addHeader('Cache-Control', 'private, max-age=2592000') // 30 days - ->setContentType('image/x-icon') - ->file($data); - return; - } - - if ('svg' === $outputExt) { // Skip crop, Imagick isn\'t supporting svg files - $sanitizer = new SvgSanitizer(); - $sanitizer->minify(true); - $cleanSvg = $sanitizer->sanitize($data); - if ($cleanSvg === false) { - throw new Exception(Exception::AVATAR_SVG_SANITIZATION_FAILED); - } - $response - ->addHeader('Cache-Control', 'private, max-age=2592000') // 30 days - ->setContentType('image/svg+xml') - ->file($cleanSvg); - return; - } - - $image = new Image($data); - $image->crop((int) $width, (int) $height); - $output = (empty($output)) ? $type : $output; - $data = $image->output($output, $quality); - - $response - ->addHeader('Cache-Control', 'private, max-age=2592000') // 30 days - ->setContentType('image/png') - ->file($data); - unset($image); - }); - -App::get('/v1/avatars/qr') - ->desc('Get QR code') - ->groups(['api', 'avatars']) - ->label('scope', 'avatars.read') - ->label('sdk', new Method( - namespace: 'avatars', - group: null, - name: 'getQR', - description: '/docs/references/avatars/get-qr.md', - auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], - type: MethodType::LOCATION, - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_OK, - model: Response::MODEL_NONE, - ) - ], - contentType: ContentType::IMAGE_PNG - )) - ->param('text', '', new Text(512), 'Plain text to be converted to QR code image.') - ->param('size', 400, new Range(1, 1000), 'QR code size. Pass an integer between 1 to 1000. Defaults to 400.', true) - ->param('margin', 1, new Range(0, 10), 'Margin from edge. Pass an integer between 0 to 10. Defaults to 1.', true) - ->param('download', false, new Boolean(true), 'Return resulting image with \'Content-Disposition: attachment \' headers for the browser to start downloading it. Pass 0 for no header, or 1 for otherwise. Default value is set to 0.', true) - ->inject('response') - ->action(function (string $text, int $size, int $margin, bool $download, Response $response) { - - $download = ($download === '1' || $download === 'true' || $download === 1 || $download === true); - $options = new QROptions([ - 'addQuietzone' => true, - 'quietzoneSize' => $margin, - 'outputType' => QRCode::OUTPUT_IMAGICK, - 'scale' => 15, - ]); - - $qrcode = new QRCode($options); - - if ($download) { - $response->addHeader('Content-Disposition', 'attachment; filename="qr.png"'); - } - - $image = new Image($qrcode->render($text)); - $image->crop((int) $size, (int) $size); - - $response - ->addHeader('Cache-Control', 'private, max-age=3888000') // 45 days - ->setContentType('image/png') - ->send($image->output('png', 90)); - }); - -App::get('/v1/avatars/initials') - ->desc('Get user initials') - ->groups(['api', 'avatars']) - ->label('scope', 'avatars.read') - ->label('cache.resource', 'avatar/initials') - ->label('sdk', new Method( - namespace: 'avatars', - group: null, - name: 'getInitials', - description: '/docs/references/avatars/get-initials.md', - auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], - type: MethodType::LOCATION, - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_OK, - model: Response::MODEL_NONE, - ) - ], - contentType: ContentType::IMAGE_PNG - )) - ->param('name', '', new Text(128), 'Full Name. When empty, current user name or email will be used. Max length: 128 chars.', true) - ->param('width', 500, new Range(0, 2000), 'Image width. Pass an integer between 0 to 2000. Defaults to 100.', true) - ->param('height', 500, new Range(0, 2000), 'Image height. Pass an integer between 0 to 2000. Defaults to 100.', true) - ->param('background', '', new HexColor(), 'Changes background color. By default a random color will be picked and stay will persistent to the given name.', true) - ->inject('response') - ->inject('user') - ->action(function (string $name, int $width, int $height, string $background, Response $response, Document $user) { - - $themes = [ - ['background' => '#FD366E'], // Default (Pink) - ['background' => '#FE9567'], // Orange - ['background' => '#7C67FE'], // Purple - ['background' => '#68A3FE'], // Blue - ['background' => '#85DBD8'], // Mint - ]; - - $name = (!empty($name)) ? $name : $user->getAttribute('name', $user->getAttribute('email', '')); - $words = \explode(' ', \strtoupper($name)); - // if there is no space, try to split by `_` underscore - $words = (count($words) == 1) ? \explode('_', \strtoupper($name)) : $words; - - $initials = ''; - $code = 0; - - foreach ($words as $key => $w) { - if (ctype_alnum($w[0] ?? '')) { - $initials .= $w[0]; - $code += ord($w[0]); - - if ($key == 1) { - break; - } - } - } - - $rand = \substr($code, -1); - - // Wrap rand value to avoid out of range - $rand = ($rand > \count($themes) - 1) ? $rand % \count($themes) : $rand; - - $background = (!empty($background)) ? '#' . $background : $themes[$rand]['background']; - - $image = new \Imagick(); - $punch = new \Imagick(); - $draw = new \ImagickDraw(); - $fontSize = \min($width, $height) / 2; - - $punch->newImage($width, $height, 'transparent'); - - $draw->setFont(__DIR__ . "/../../assets/fonts/inter-v8-latin-regular.woff2"); - $image->setFont(__DIR__ . "/../../assets/fonts/inter-v8-latin-regular.woff2"); - - $draw->setFillColor(new ImagickPixel('black')); - $draw->setFontSize($fontSize); - - $draw->setTextAlignment(\Imagick::ALIGN_CENTER); - $draw->annotation($width / 1.97, ($height / 2) + ($fontSize / 3), $initials); - - $punch->drawImage($draw); - $punch->negateImage(true, Imagick::CHANNEL_ALPHA); - - $image->newImage($width, $height, $background); - $image->setImageFormat("png"); - $image->compositeImage($punch, Imagick::COMPOSITE_COPYOPACITY, 0, 0); - - $response - ->addHeader('Cache-Control', 'private, max-age=3888000') // 45 days - ->setContentType('image/png') - ->file($image->getImageBlob()); - }); - -App::get('/v1/avatars/screenshots') - ->desc('Get webpage screenshot') - ->groups(['api', 'avatars']) - ->label('scope', 'avatars.read') - ->label('usage.metric', METRIC_AVATARS_SCREENSHOTS_GENERATED) - ->label('abuse-limit', 60) - ->label('cache', true) - ->label('cache.resourceType', 'avatar/screenshot') - ->label('cache.resource', 'screenshot/{request.url}/{request.width}/{request.height}/{request.scale}/{request.theme}/{request.userAgent}/{request.fullpage}/{request.locale}/{request.timezone}/{request.latitude}/{request.longitude}/{request.accuracy}/{request.touch}/{request.permissions}/{request.sleep}/{request.quality}/{request.output}') - ->label('sdk', new Method( - namespace: 'avatars', - group: null, - name: 'getScreenshot', - description: '/docs/references/avatars/get-screenshot.md', - auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], - type: MethodType::LOCATION, - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_OK, - model: Response::MODEL_NONE, - ) - ], - contentType: ContentType::IMAGE_PNG - )) - ->param('url', '', new URL(['http', 'https']), 'Website URL which you want to capture.', example: 'https://example.com') - ->param('headers', [], new Assoc(), 'HTTP headers to send with the browser request. Defaults to empty.', true, example: '{"Authorization":"Bearer token123","X-Custom-Header":"value"}') - ->param('viewportWidth', 1280, new Range(1, 1920), 'Browser viewport width. Pass an integer between 1 to 1920. Defaults to 1280.', true, example: '1920') - ->param('viewportHeight', 720, new Range(1, 1080), 'Browser viewport height. Pass an integer between 1 to 1080. Defaults to 720.', true, example: '1080') - ->param('scale', 1, new Range(0.1, 3, Range::TYPE_FLOAT), 'Browser scale factor. Pass a number between 0.1 to 3. Defaults to 1.', true, example: '2') - ->param('theme', 'light', new WhiteList(['light', 'dark']), 'Browser theme. Pass "light" or "dark". Defaults to "light".', true, example: 'dark') - ->param('userAgent', '', new Text(512), 'Custom user agent string. Defaults to browser default.', true, example: 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15') - ->param('fullpage', false, new Boolean(true), 'Capture full page scroll. Pass 0 for viewport only, or 1 for full page. Defaults to 0.', true, example: 'true') - ->param('locale', '', new Text(10), 'Browser locale (e.g., "en-US", "fr-FR"). Defaults to browser default.', true, example: 'en-US') - ->param('timezone', '', new WhiteList(timezone_identifiers_list()), 'IANA timezone identifier (e.g., "America/New_York", "Europe/London"). Defaults to browser default.', true, example: 'america/new_york') - ->param('latitude', 0, new Range(-90, 90, Range::TYPE_FLOAT), 'Geolocation latitude. Pass a number between -90 to 90. Defaults to 0.', true, example: '37.7749') - ->param('longitude', 0, new Range(-180, 180, Range::TYPE_FLOAT), 'Geolocation longitude. Pass a number between -180 to 180. Defaults to 0.', true, example: '-122.4194') - ->param('accuracy', 0, new Range(0, 100000, Range::TYPE_FLOAT), 'Geolocation accuracy in meters. Pass a number between 0 to 100000. Defaults to 0.', true, example: '100') - ->param('touch', false, new Boolean(true), 'Enable touch support. Pass 0 for no touch, or 1 for touch enabled. Defaults to 0.', true, example: 'true') - ->param('permissions', [], new ArrayList(new WhiteList(['geolocation', 'camera', 'microphone', 'notifications', 'midi', 'push', 'clipboard-read', 'clipboard-write', 'payment-handler', 'usb', 'bluetooth', 'accelerometer', 'gyroscope', 'magnetometer', 'ambient-light-sensor', 'background-sync', 'persistent-storage', 'screen-wake-lock', 'web-share', 'xr-spatial-tracking'])), 'Browser permissions to grant. Pass an array of permission names like ["geolocation", "camera", "microphone"]. Defaults to empty.', true, example: '["geolocation","notifications"]') - ->param('sleep', 0, new Range(0, 10), 'Wait time in seconds before taking the screenshot. Pass an integer between 0 to 10. Defaults to 0.', true, example: '3') - ->param('width', 0, new Range(0, 2000), 'Output image width. Pass 0 to use original width, or an integer between 1 to 2000. Defaults to 0 (original width).', true, example: '800') - ->param('height', 0, new Range(0, 2000), 'Output image height. Pass 0 to use original height, or an integer between 1 to 2000. Defaults to 0 (original height).', true, example: '600') - ->param('quality', -1, new Range(-1, 100), 'Screenshot quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.', true, example: '85') - ->param('output', '', new WhiteList(\array_keys(Config::getParam('storage-outputs')), true), 'Output format type (jpeg, jpg, png, gif and webp).', true, example: 'jpeg') - ->inject('response') - ->inject('queueForStatsUsage') - ->action(function (string $url, array $headers, int $viewportWidth, int $viewportHeight, float $scale, string $theme, string $userAgent, bool $fullpage, string $locale, string $timezone, float $latitude, float $longitude, float $accuracy, bool $touch, array $permissions, int $sleep, int $width, int $height, int $quality, string $output, Response $response, StatsUsage $queueForStatsUsage) { - - if (!\extension_loaded('imagick')) { - throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Imagick extension is missing'); - } - - $domain = new Domain(\parse_url($url, PHP_URL_HOST)); - - if (!$domain->isKnown()) { - throw new Exception(Exception::AVATAR_REMOTE_URL_FAILED); - } - - $client = new Client(); - $client->setTimeout(30); - $client->addHeader('content-type', Client::CONTENT_TYPE_APPLICATION_JSON); - - // Convert indexed array to empty array (should not happen due to Assoc validator) - if (is_array($headers) && count($headers) > 0 && array_keys($headers) === range(0, count($headers) - 1)) { - $headers = []; - } - - // Create a new object to ensure proper JSON serialization - $headersObject = new \stdClass(); - foreach ($headers as $key => $value) { - $headersObject->$key = $value; - } - - // Create the config with headers as an object - // The custom browser service accepts: url, theme, headers, sleep, viewport, userAgent, fullPage, locale, timezoneId, geolocation, hasTouch, scale - $config = [ - 'url' => $url, - 'theme' => $theme, - 'headers' => $headersObject, - 'sleep' => $sleep * 1000, // Convert seconds to milliseconds - 'waitUntil' => 'load', - 'viewport' => [ - 'width' => $viewportWidth, - 'height' => $viewportHeight - ] - ]; - - // Add scale if not default - if ($scale != 1) { - $config['deviceScaleFactor'] = $scale; - } - - // Add optional parameters that were set, preserving arrays as arrays - if (!empty($userAgent)) { - $config['userAgent'] = $userAgent; - } - - if ($fullpage) { - $config['fullPage'] = true; - } - - if (!empty($locale)) { - $config['locale'] = $locale; - } - - if (!empty($timezone)) { - $config['timezoneId'] = $timezone; - } - - // Add geolocation if any coordinates are provided - if ($latitude != 0 || $longitude != 0) { - $config['geolocation'] = [ - 'latitude' => $latitude, - 'longitude' => $longitude, - 'accuracy' => $accuracy - ]; - } - - if ($touch) { - $config['hasTouch'] = true; - } - - // Add permissions if provided (preserve as array) - if (!empty($permissions)) { - $config['permissions'] = $permissions; // Keep as array - } - - try { - $browserEndpoint = System::getEnv('_APP_BROWSER_HOST', 'http://appwrite-browser:3000/v1'); - - $fetchResponse = $client->fetch( - url: $browserEndpoint . '/screenshots', - method: 'POST', - body: $config - ); - - if ($fetchResponse->getStatusCode() >= 400) { - throw new Exception(Exception::AVATAR_REMOTE_URL_FAILED, 'Screenshot service failed: ' . $fetchResponse->getBody()); - } - - $screenshot = $fetchResponse->getBody(); - - if (empty($screenshot)) { - throw new Exception(Exception::AVATAR_IMAGE_NOT_FOUND, 'Screenshot not generated'); - } - - // Determine if image processing is needed - $needsProcessing = ($width > 0 || $height > 0) || $quality !== -1 || !empty($output); - - if ($needsProcessing) { - // Process image with cropping, quality adjustment, or format conversion - $image = new Image($screenshot); - - $image->crop($width, $height); - - $output = $output ?: 'png'; // Default to PNG if not specified - $resizedScreenshot = $image->output($output, $quality); - unset($image); - } else { - // Return original screenshot without processing - $resizedScreenshot = $screenshot; - $output = 'png'; // Screenshots are typically PNG by default - } - - // Set content type based on output format - $outputs = Config::getParam('storage-outputs'); - $contentType = $outputs[$output] ?? $outputs['png']; - - $queueForStatsUsage->addMetric(METRIC_AVATARS_SCREENSHOTS_GENERATED, 1); - - $response - ->addHeader('Cache-Control', 'private, max-age=2592000') // 30 days - ->setContentType($contentType) - ->file($resizedScreenshot); - - - } catch (\Throwable $th) { - throw new Exception(Exception::AVATAR_REMOTE_URL_FAILED, 'Screenshot generation failed: ' . $th->getMessage()); - } - }); - -App::get('/v1/cards/cloud') - ->desc('Get front Of Cloud Card') - ->groups(['api', 'avatars']) - ->label('scope', 'avatars.read') - ->label('cache', true) - ->label('cache.resourceType', 'cards/cloud') - ->label('cache.resource', 'card/{request.userId}') - ->label('docs', false) - ->label('origin', '*') - ->param('userId', '', new UID(), 'User ID.', true) - ->param('mock', '', new WhiteList(['employee', 'employee-2digit', 'hero', 'contributor', 'normal', 'platinum', 'normal-no-github', 'normal-long']), 'Mocking behaviour.', true) - ->param('width', 0, new Range(0, 512), 'Resize image width, Pass an integer between 0 to 512.', true) - ->param('height', 0, new Range(0, 320), 'Resize image height, Pass an integer between 0 to 320.', true) - ->inject('user') - ->inject('project') - ->inject('dbForProject') - ->inject('dbForPlatform') - ->inject('response') - ->inject('heroes') - ->inject('contributors') - ->inject('employees') - ->inject('logger') - ->inject('authorization') - ->action(function (string $userId, string $mock, int $width, int $height, Document $user, Document $project, Database $dbForProject, Database $dbForPlatform, Response $response, array $heroes, array $contributors, array $employees, ?Logger $logger, Authorization $authorization) use ($getUserGitHub) { - $user = $authorization->skip(fn () => $dbForPlatform->getDocument('users', $userId)); - - if ($user->isEmpty() && empty($mock)) { - throw new Exception(Exception::USER_NOT_FOUND); - } - - if (!$mock) { - $name = $user->getAttribute('name', 'Anonymous'); - $email = $user->getAttribute('email', ''); - $createdAt = new \DateTime($user->getCreatedAt()); - - $gitHub = $getUserGitHub($user->getId(), $project, $dbForProject, $dbForPlatform, $authorization, $logger); - $githubName = $gitHub['name'] ?? ''; - $githubId = $gitHub['id'] ?? ''; - - $isHero = \array_key_exists($email, $heroes); - $isContributor = \in_array($githubId, $contributors); - $isEmployee = \array_key_exists($email, $employees); - $employeeNumber = $isEmployee ? $employees[$email]['spot'] : ''; - - if ($isHero) { - $createdAt = new \DateTime($heroes[$email]['memberSince'] ?? ''); - } elseif ($isEmployee) { - $createdAt = new \DateTime($employees[$email]['memberSince'] ?? ''); - } - - if (!$isEmployee && !empty($githubName)) { - $employeeGitHub = \array_search(\strtolower($githubName), \array_map(fn ($employee) => \strtolower($employee['gitHub']) ?? '', $employees)); - if (!empty($employeeGitHub)) { - $isEmployee = true; - $employeeNumber = $isEmployee ? $employees[$employeeGitHub]['spot'] : ''; - $createdAt = new \DateTime($employees[$employeeGitHub]['memberSince'] ?? ''); - } - } - - $isPlatinum = $user->getSequence() % 100 === 0; - } else { - $name = $mock === 'normal-long' ? 'Sir First Walter O\'Brian Junior' : 'Walter O\'Brian'; - $createdAt = new \DateTime('now'); - $githubName = $mock === 'normal-no-github' ? '' : ($mock === 'normal-long' ? 'sir-first-walterobrian-junior' : 'walterobrian'); - $isHero = $mock === 'hero'; - $isContributor = $mock === 'contributor'; - $isEmployee = \str_starts_with($mock, 'employee'); - $employeeNumber = match ($mock) { - 'employee' => '1', - 'employee-2digit' => '18', - default => '' - }; - - $isPlatinum = $mock === 'platinum'; - } - - if ($isEmployee) { - $isContributor = false; - $isHero = false; - } - - if ($isHero) { - $isContributor = false; - $isEmployee = false; - } - - if ($isContributor) { - $isHero = false; - $isEmployee = false; - } - - $isGolden = $isEmployee || $isHero || $isContributor; - $isPlatinum = $isGolden ? false : $isPlatinum; - $memberSince = \strtoupper('Member since ' . $createdAt->format('M') . ' ' . $createdAt->format('d') . ', ' . $createdAt->format('o')); - - $imagePath = $isGolden ? 'front-golden.png' : ($isPlatinum ? 'front-platinum.png' : 'front.png'); - - $baseImage = new \Imagick(__DIR__ . '/../../../public/images/cards/cloud/' . $imagePath); - - if ($isEmployee) { - $image = new Imagick(__DIR__ . '/../../../public/images/cards/cloud/employee.png'); - $image->setGravity(Imagick::GRAVITY_CENTER); - $baseImage->compositeImage($image, Imagick::COMPOSITE_OVER, 793, 35); - - $text = new \ImagickDraw(); - $text->setTextAlignment(Imagick::ALIGN_CENTER); - $text->setFont(__DIR__ . '/../../../public/fonts/Inter-Bold.ttf'); - $text->setFillColor(new \ImagickPixel('#FFFADF')); - $text->setFontSize(\strlen($employeeNumber) <= 2 ? 54 : 48); - $text->setFontWeight(700); - $metricsText = $baseImage->queryFontMetrics($text, $employeeNumber); - - $hashtag = new \ImagickDraw(); - $hashtag->setTextAlignment(Imagick::ALIGN_CENTER); - $hashtag->setFont(__DIR__ . '/../../../public/fonts/Inter-Bold.ttf'); - $hashtag->setFillColor(new \ImagickPixel('#FFFADF')); - $hashtag->setFontSize(28); - $hashtag->setFontWeight(700); - $metricsHashtag = $baseImage->queryFontMetrics($hashtag, '#'); - - $startX = 898; - $totalWidth = $metricsHashtag['textWidth'] + 12 + $metricsText['textWidth']; - - $hashtagX = ($metricsHashtag['textWidth'] / 2); - $textX = $hashtagX + 12 + ($metricsText['textWidth'] / 2); - - $hashtagX -= $totalWidth / 2; - $textX -= $totalWidth / 2; - - $hashtagX += $startX; - $textX += $startX; - - $baseImage->annotateImage($hashtag, $hashtagX, 150, 0, '#'); - $baseImage->annotateImage($text, $textX, 150, 0, $employeeNumber); - } - - if ($isContributor) { - $image = new Imagick(__DIR__ . '/../../../public/images/cards/cloud/contributor.png'); - $image->setGravity(Imagick::GRAVITY_CENTER); - $baseImage->compositeImage($image, Imagick::COMPOSITE_OVER, 793, 34); - } - - if ($isHero) { - $image = new Imagick(__DIR__ . '/../../../public/images/cards/cloud/hero.png'); - $image->setGravity(Imagick::GRAVITY_CENTER); - $baseImage->compositeImage($image, Imagick::COMPOSITE_OVER, 793, 34); - } - - setlocale(LC_ALL, "en_US.utf8"); - // $name = \iconv("utf-8", "ascii//TRANSLIT", $name); - // $memberSince = \iconv("utf-8", "ascii//TRANSLIT", $memberSince); - // $githubName = \iconv("utf-8", "ascii//TRANSLIT", $githubName); - - $text = new \ImagickDraw(); - $text->setTextAlignment(Imagick::ALIGN_CENTER); - $text->setFont(__DIR__ . '/../../../public/fonts/Inter-Bold.ttf'); - $text->setFillColor(new \ImagickPixel('#FFFFFF')); - - if (\strlen($name) > 32) { - $name = \substr($name, 0, 32); - } - - if (\strlen($name) <= 23) { - $text->setFontSize(80); - $scalingDown = false; - } else { - $text->setFontSize(54); - $scalingDown = true; - } - $text->setFontWeight(700); - $baseImage->annotateImage($text, 512, 477, 0, $name); - - $text = new \ImagickDraw(); - $text->setTextAlignment(Imagick::ALIGN_CENTER); - $text->setFont(__DIR__ . '/../../../public/fonts/Inter-SemiBold.ttf'); - $text->setFillColor(new \ImagickPixel($isGolden || $isPlatinum ? '#FFFFFF' : '#FFB9CC')); - $text->setFontSize(27); - $text->setFontWeight(600); - $text->setTextKerning(1.08); - $baseImage->annotateImage($text, 512, 541, 0, \strtoupper($memberSince)); - - if (!empty($githubName)) { - $text = new \ImagickDraw(); - $text->setTextAlignment(Imagick::ALIGN_CENTER); - $text->setFont(__DIR__ . '/../../../public/fonts/Inter-Regular.ttf'); - $text->setFillColor(new \ImagickPixel('#FFFFFF')); - $text->setFontSize($scalingDown ? 28 : 32); - $text->setFontWeight(400); - $metrics = $baseImage->queryFontMetrics($text, $githubName); - - $baseImage->annotateImage($text, 512 + 20 + 4, 373 + ($scalingDown ? 2 : 0), 0, $githubName); - - $image = new Imagick(__DIR__ . '/../../../public/images/cards/cloud/github.png'); - $image->setGravity(Imagick::GRAVITY_CENTER); - $precisionFix = 5; - $baseImage->compositeImage($image, Imagick::COMPOSITE_OVER, 512 - ($metrics['textWidth'] / 2) - 20 - 4, 373 - ($metrics['textHeight'] - $precisionFix)); - } - - if (!empty($width) || !empty($height)) { - $baseImage->resizeImage($width, $height, Imagick::FILTER_LANCZOS, 1); - } - - $response - ->addHeader('Cache-Control', 'private, max-age=3888000') // 45 days - ->setContentType('image/png') - ->file($baseImage->getImageBlob()); - }); - -App::get('/v1/cards/cloud-back') - ->desc('Get back Of Cloud Card') - ->groups(['api', 'avatars']) - ->label('scope', 'avatars.read') - ->label('cache', true) - ->label('cache.resourceType', 'cards/cloud-back') - ->label('cache.resource', 'card-back/{request.userId}') - ->label('docs', false) - ->label('origin', '*') - ->param('userId', '', new UID(), 'User ID.', true) - ->param('mock', '', new WhiteList(['golden', 'normal', 'platinum']), 'Mocking behaviour.', true) - ->param('width', 0, new Range(0, 512), 'Resize image width, Pass an integer between 0 to 512.', true) - ->param('height', 0, new Range(0, 320), 'Resize image height, Pass an integer between 0 to 320.', true) - ->inject('user') - ->inject('project') - ->inject('dbForProject') - ->inject('dbForPlatform') - ->inject('response') - ->inject('heroes') - ->inject('contributors') - ->inject('employees') - ->inject('logger') - ->inject('authorization') - ->action(function (string $userId, string $mock, int $width, int $height, Document $user, Document $project, Database $dbForProject, Database $dbForPlatform, Response $response, array $heroes, array $contributors, array $employees, ?Logger $logger, Authorization $authorization) use ($getUserGitHub) { - $user = $authorization->skip(fn () => $dbForPlatform->getDocument('users', $userId)); - - if ($user->isEmpty() && empty($mock)) { - throw new Exception(Exception::USER_NOT_FOUND); - } - - if (!$mock) { - $userId = $user->getId(); - $email = $user->getAttribute('email', ''); - - $gitHub = $getUserGitHub($user->getId(), $project, $dbForProject, $dbForPlatform, $authorization, $logger); - $githubId = $gitHub['id'] ?? ''; - - $isHero = \array_key_exists($email, $heroes); - $isContributor = \in_array($githubId, $contributors); - $isEmployee = \array_key_exists($email, $employees); - - $isGolden = $isEmployee || $isHero || $isContributor; - $isPlatinum = $user->getSequence() % 100 === 0; - } else { - $userId = '63e0bcf3c3eb803ba530'; - - $isGolden = $mock === 'golden'; - $isPlatinum = $mock === 'platinum'; - } - - $userId = 'UID ' . $userId; - - $isPlatinum = $isGolden ? false : $isPlatinum; - - $imagePath = $isGolden ? 'back-golden.png' : ($isPlatinum ? 'back-platinum.png' : 'back.png'); - - $baseImage = new \Imagick(__DIR__ . '/../../../public/images/cards/cloud/' . $imagePath); - - setlocale(LC_ALL, "en_US.utf8"); - // $userId = \iconv("utf-8", "ascii//TRANSLIT", $userId); - - $text = new \ImagickDraw(); - $text->setTextAlignment(Imagick::ALIGN_CENTER); - $text->setFont(__DIR__ . '/../../../public/fonts/SourceCodePro-Regular.ttf'); - $text->setFillColor(new \ImagickPixel($isGolden ? '#664A1E' : ($isPlatinum ? '#555555' : '#E8E9F0'))); - $text->setFontSize(28); - $text->setFontWeight(400); - $baseImage->annotateImage($text, 512, 596, 0, $userId); - - if (!empty($width) || !empty($height)) { - $baseImage->resizeImage($width, $height, Imagick::FILTER_LANCZOS, 1); - } - - $response - ->addHeader('Cache-Control', 'private, max-age=3888000') // 45 days - ->setContentType('image/png') - ->file($baseImage->getImageBlob()); - }); - -App::get('/v1/cards/cloud-og') - ->desc('Get OG image From Cloud Card') - ->groups(['api', 'avatars']) - ->label('scope', 'avatars.read') - ->label('cache', true) - ->label('cache.resourceType', 'cards/cloud-og') - ->label('cache.resource', 'card-og/{request.userId}') - ->label('docs', false) - ->label('origin', '*') - ->param('userId', '', new UID(), 'User ID.', true) - ->param('mock', '', new WhiteList(['employee', 'employee-2digit', 'hero', 'contributor', 'normal', 'platinum', 'normal-no-github', 'normal-long', 'normal-long-right', 'normal-long-middle', 'normal-bg2', 'normal-bg3', 'normal-right', 'normal-middle', 'platinum-right', 'platinum-middle', 'hero-middle', 'hero-right', 'contributor-right', 'employee-right', 'contributor-middle', 'employee-middle', 'employee-2digit-middle', 'employee-2digit-right']), 'Mocking behaviour.', true) - ->param('width', 0, new Range(0, 1024), 'Resize image card width, Pass an integer between 0 to 1024.', true) - ->param('height', 0, new Range(0, 1024), 'Resize image card height, Pass an integer between 0 to 1024.', true) - ->inject('user') - ->inject('project') - ->inject('dbForProject') - ->inject('dbForPlatform') - ->inject('response') - ->inject('heroes') - ->inject('contributors') - ->inject('employees') - ->inject('logger') - ->inject('authorization') - ->action(function (string $userId, string $mock, int $width, int $height, Document $user, Document $project, Database $dbForProject, Database $dbForPlatform, Response $response, array $heroes, array $contributors, array $employees, ?Logger $logger, Authorization $authorization) use ($getUserGitHub) { - $user = $authorization->skip(fn () => $dbForPlatform->getDocument('users', $userId)); - - if ($user->isEmpty() && empty($mock)) { - throw new Exception(Exception::USER_NOT_FOUND); - } - - if (!$mock) { - $sequence = $user->getSequence(); - $bgVariation = $sequence % 3 === 0 ? '1' : ($sequence % 3 === 1 ? '2' : '3'); - $cardVariation = $sequence % 3 === 0 ? '1' : ($sequence % 3 === 1 ? '2' : '3'); - - $name = $user->getAttribute('name', 'Anonymous'); - $email = $user->getAttribute('email', ''); - $createdAt = new \DateTime($user->getCreatedAt()); - - $gitHub = $getUserGitHub($user->getId(), $project, $dbForProject, $dbForPlatform, $authorization, $logger); - $githubName = $gitHub['name'] ?? ''; - $githubId = $gitHub['id'] ?? ''; - - $isHero = \array_key_exists($email, $heroes); - $isContributor = \in_array($githubId, $contributors); - $isEmployee = \array_key_exists($email, $employees); - $employeeNumber = $isEmployee ? $employees[$email]['spot'] : ''; - - if ($isHero) { - $createdAt = new \DateTime($heroes[$email]['memberSince'] ?? ''); - } elseif ($isEmployee) { - $createdAt = new \DateTime($employees[$email]['memberSince'] ?? ''); - } - - if (!$isEmployee && !empty($githubName)) { - $employeeGitHub = \array_search(\strtolower($githubName), \array_map(fn ($employee) => \strtolower($employee['gitHub']) ?? '', $employees)); - if (!empty($employeeGitHub)) { - $isEmployee = true; - $employeeNumber = $isEmployee ? $employees[$employeeGitHub]['spot'] : ''; - $createdAt = new \DateTime($employees[$employeeGitHub]['memberSince'] ?? ''); - } - } - - $isPlatinum = $user->getSequence() % 100 === 0; - } else { - $bgVariation = \str_ends_with($mock, '-bg2') ? '2' : (\str_ends_with($mock, '-bg3') ? '3' : '1'); - $cardVariation = \str_ends_with($mock, '-right') ? '2' : (\str_ends_with($mock, '-middle') ? '3' : '1'); - $name = \str_starts_with($mock, 'normal-long') ? 'Sir First Walter O\'Brian Junior' : 'Walter O\'Brian'; - $createdAt = new \DateTime('now'); - $githubName = $mock === 'normal-no-github' ? '' : (\str_starts_with($mock, 'normal-long') ? 'sir-first-walterobrian-junior' : 'walterobrian'); - $isHero = \str_starts_with($mock, 'hero'); - $isContributor = \str_starts_with($mock, 'contributor'); - $isEmployee = \str_starts_with($mock, 'employee'); - $employeeNumber = match ($mock) { - 'employee' => '1', - 'employee-right' => '1', - 'employee-middle' => '1', - 'employee-2digit' => '18', - 'employee-2digit-right' => '18', - 'employee-2digit-middle' => '18', - default => '' - }; - - $isPlatinum = \str_starts_with($mock, 'platinum'); - } - - if ($isEmployee) { - $isContributor = false; - $isHero = false; - } - - if ($isHero) { - $isContributor = false; - $isEmployee = false; - } - - if ($isContributor) { - $isHero = false; - $isEmployee = false; - } - - $isGolden = $isEmployee || $isHero || $isContributor; - $isPlatinum = $isGolden ? false : $isPlatinum; - $memberSince = \strtoupper('Member since ' . $createdAt->format('M') . ' ' . $createdAt->format('d') . ', ' . $createdAt->format('o')); - - $baseImage = new \Imagick(__DIR__ . "/../../../public/images/cards/cloud/og-background{$bgVariation}.png"); - - $cardType = $isGolden ? '-golden' : ($isPlatinum ? '-platinum' : ''); - - $image = new Imagick(__DIR__ . "/../../../public/images/cards/cloud/og-card{$cardType}{$cardVariation}.png"); - $baseImage->compositeImage($image, Imagick::COMPOSITE_OVER, 1008 / 2 - $image->getImageWidth() / 2, 1008 / 2 - $image->getImageHeight() / 2); - - $imageLogo = new Imagick(__DIR__ . '/../../../public/images/cards/cloud/og-background-logo.png'); - $imageShadow = new Imagick(__DIR__ . "/../../../public/images/cards/cloud/og-shadow{$cardType}.png"); - if ($cardVariation === '1') { - $baseImage->compositeImage($imageLogo, Imagick::COMPOSITE_OVER, 32, 1008 - $imageLogo->getImageHeight() - 32); - $baseImage->compositeImage($imageShadow, Imagick::COMPOSITE_OVER, -450, 700); - } elseif ($cardVariation === '2') { - $baseImage->compositeImage($imageLogo, Imagick::COMPOSITE_OVER, 1008 - $imageLogo->getImageWidth() - 32, 1008 - $imageLogo->getImageHeight() - 32); - $baseImage->compositeImage($imageShadow, Imagick::COMPOSITE_OVER, -20, 710); - } else { - $baseImage->compositeImage($imageLogo, Imagick::COMPOSITE_OVER, 1008 - $imageLogo->getImageWidth() - 32, 1008 - $imageLogo->getImageHeight() - 32); - $baseImage->compositeImage($imageShadow, Imagick::COMPOSITE_OVER, -135, 710); - } - - if ($isEmployee) { - $file = $cardVariation === '3' ? 'employee-skew.png' : 'employee.png'; - $image = new Imagick(__DIR__ . '/../../../public/images/cards/cloud/' . $file); - $image->setGravity(Imagick::GRAVITY_CENTER); - - $hashtag = new \ImagickDraw(); - $hashtag->setTextAlignment(Imagick::ALIGN_LEFT); - $hashtag->setFont(__DIR__ . '/../../../public/fonts/Inter-Bold.ttf'); - $hashtag->setFillColor(new \ImagickPixel('#FFFADF')); - $hashtag->setFontSize(20); - $hashtag->setFontWeight(700); - - $text = new \ImagickDraw(); - $text->setTextAlignment(Imagick::ALIGN_LEFT); - $text->setFont(__DIR__ . '/../../../public/fonts/Inter-Bold.ttf'); - $text->setFillColor(new \ImagickPixel('#FFFADF')); - $text->setFontSize(\strlen($employeeNumber) <= 1 ? 36 : 28); - $text->setFontWeight(700); - - if ($cardVariation === '3') { - $hashtag->setFontSize(16); - $text->setFontSize(\strlen($employeeNumber) <= 1 ? 30 : 26); - - $hashtag->skewY(20); - $hashtag->skewX(20); - $text->skewY(20); - $text->skewX(20); - } - - $metricsHashtag = $baseImage->queryFontMetrics($hashtag, '#'); - $metricsText = $baseImage->queryFontMetrics($text, $employeeNumber); - - $group = new Imagick(); - $groupWidth = $metricsHashtag['textWidth'] + 6 + $metricsText['textWidth']; - - if ($cardVariation === '1') { - $group->newImage($groupWidth, $metricsText['textHeight'], '#00000000'); - $group->annotateImage($hashtag, 0, $metricsText['textHeight'], 0, '#'); - $group->annotateImage($text, $metricsHashtag['textWidth'] + 6, $metricsText['textHeight'], 0, $employeeNumber); - - $image->resizeImage(120, 120, Imagick::FILTER_LANCZOS, 1); - $image->rotateImage(new ImagickPixel('#00000000'), -20); - $baseImage->compositeImage($image, Imagick::COMPOSITE_OVER, 612, 203); - - $group->rotateImage(new ImagickPixel('#00000000'), -22); - - if (\strlen($employeeNumber) <= 1) { - $baseImage->compositeImage($group, Imagick::COMPOSITE_OVER, 660, 245); - } else { - $baseImage->compositeImage($group, Imagick::COMPOSITE_OVER, 655, 247); - } - } elseif ($cardVariation === '2') { - $group->newImage($groupWidth, $metricsText['textHeight'], '#00000000'); - $group->annotateImage($hashtag, 0, $metricsText['textHeight'], 0, '#'); - $group->annotateImage($text, $metricsHashtag['textWidth'] + 6, $metricsText['textHeight'], 0, $employeeNumber); - - $image->resizeImage(120, 120, Imagick::FILTER_LANCZOS, 1); - $image->rotateImage(new ImagickPixel('#00000000'), 30); - $baseImage->compositeImage($image, Imagick::COMPOSITE_OVER, 715, 425); - - $group->rotateImage(new ImagickPixel('#00000000'), 32); - - if (\strlen($employeeNumber) <= 1) { - $baseImage->compositeImage($group, Imagick::COMPOSITE_OVER, 775, 465); - } else { - $baseImage->compositeImage($group, Imagick::COMPOSITE_OVER, 767, 470); - } - } else { - $group->newImage(300, 300, '#00000000'); - - $hashtag->annotation(0, $metricsText['textHeight'], '#'); - $text->annotation($metricsHashtag['textWidth'] + 2, $metricsText['textHeight'], $employeeNumber); - - $group->drawImage($hashtag); - $group->drawImage($text); - - $baseImage->compositeImage($image, Imagick::COMPOSITE_OVER, 640, 293); - - if (\strlen($employeeNumber) <= 1) { - $baseImage->compositeImage($group, Imagick::COMPOSITE_OVER, 670, 317); - } else { - $baseImage->compositeImage($group, Imagick::COMPOSITE_OVER, 663, 322); - } - } - } - - if ($isContributor) { - $file = $cardVariation === '3' ? 'contributor-skew.png' : 'contributor.png'; - $image = new Imagick(__DIR__ . '/../../../public/images/cards/cloud/' . $file); - $image->setGravity(Imagick::GRAVITY_CENTER); - - if ($cardVariation === '1') { - $image->resizeImage(120, 120, Imagick::FILTER_LANCZOS, 1); - $image->rotateImage(new ImagickPixel('#00000000'), -20); - $baseImage->compositeImage($image, Imagick::COMPOSITE_OVER, 612, 203); - } elseif ($cardVariation === '2') { - $image->resizeImage(120, 120, Imagick::FILTER_LANCZOS, 1); - $image->rotateImage(new ImagickPixel('#00000000'), 30); - $baseImage->compositeImage($image, Imagick::COMPOSITE_OVER, 715, 425); - } else { - $baseImage->compositeImage($image, Imagick::COMPOSITE_OVER, 640, 293); - } - } - - if ($isHero) { - $file = $cardVariation === '3' ? 'hero-skew.png' : 'hero.png'; - $image = new Imagick(__DIR__ . '/../../../public/images/cards/cloud/' . $file); - $image->setGravity(Imagick::GRAVITY_CENTER); - - if ($cardVariation === '1') { - $image->resizeImage(120, 120, Imagick::FILTER_LANCZOS, 1); - $image->rotateImage(new ImagickPixel('#00000000'), -20); - $baseImage->compositeImage($image, Imagick::COMPOSITE_OVER, 612, 203); - } elseif ($cardVariation === '2') { - $image->resizeImage(120, 120, Imagick::FILTER_LANCZOS, 1); - $image->rotateImage(new ImagickPixel('#00000000'), 30); - $baseImage->compositeImage($image, Imagick::COMPOSITE_OVER, 715, 425); - } else { - $baseImage->compositeImage($image, Imagick::COMPOSITE_OVER, 640, 293); - } - } - - setlocale(LC_ALL, "en_US.utf8"); - // $name = \iconv("utf-8", "ascii//TRANSLIT", $name); - // $memberSince = \iconv("utf-8", "ascii//TRANSLIT", $memberSince); - // $githubName = \iconv("utf-8", "ascii//TRANSLIT", $githubName); - - $textName = new \ImagickDraw(); - $textName->setTextAlignment(Imagick::ALIGN_CENTER); - $textName->setFont(__DIR__ . '/../../../public/fonts/Inter-Bold.ttf'); - $textName->setFillColor(new \ImagickPixel('#FFFFFF')); - - if (\strlen($name) > 32) { - $name = \substr($name, 0, 32); - } - - if ($cardVariation === '1') { - if (\strlen($name) <= 23) { - $scalingDown = false; - $textName->setFontSize(54); - } else { - $scalingDown = true; - $textName->setFontSize(36); - } - } elseif ($cardVariation === '2') { - if (\strlen($name) <= 23) { - $scalingDown = false; - $textName->setFontSize(50); - } else { - $scalingDown = true; - $textName->setFontSize(34); - } - } else { - if (\strlen($name) <= 23) { - $scalingDown = false; - $textName->setFontSize(44); - } else { - $scalingDown = true; - $textName->setFontSize(32); - } - } - - $textName->setFontWeight(700); - - $textMember = new \ImagickDraw(); - $textMember->setTextAlignment(Imagick::ALIGN_CENTER); - $textMember->setFont(__DIR__ . '/../../../public/fonts/Inter-Medium.ttf'); - $textMember->setFillColor(new \ImagickPixel($isGolden || $isPlatinum ? '#FFFFFF' : '#FFB9CC')); - $textMember->setFontWeight(500); - $textMember->setTextKerning(1.12); - - if ($cardVariation === '1') { - $textMember->setFontSize(21); - - $baseImage->annotateImage($textName, 550, 600, -22, $name); - $baseImage->annotateImage($textMember, 585, 635, -22, $memberSince); - } elseif ($cardVariation === '2') { - $textMember->setFontSize(20); - - $baseImage->annotateImage($textName, 435, 590, 31.37, $name); - $baseImage->annotateImage($textMember, 412, 628, 31.37, $memberSince); - } else { - $textMember->setFontSize(16); - - $textName->skewY(20); - $textName->skewX(20); - $textName->annotation(320, 700, $name); - - $textMember->skewY(20); - $textMember->skewX(20); - $textMember->annotation(330, 735, $memberSince); - - $baseImage->drawImage($textName); - $baseImage->drawImage($textMember); - } - - if (!empty($githubName)) { - $text = new \ImagickDraw(); - $text->setTextAlignment(Imagick::ALIGN_LEFT); - $text->setFont(__DIR__ . '/../../../public/fonts/Inter-Regular.ttf'); - $text->setFillColor(new \ImagickPixel('#FFFFFF')); - $text->setFontSize($scalingDown ? 16 : 20); - $text->setFontWeight(400); - - if ($cardVariation === '1') { - $metrics = $baseImage->queryFontMetrics($text, $githubName); - - $group = new Imagick(); - $groupWidth = $metrics['textWidth'] + 32 + 4; - $group->newImage($groupWidth, $metrics['textHeight'] + 10, '#00000000'); - $image = new Imagick(__DIR__ . '/../../../public/images/cards/cloud/github.png'); - $image->setGravity(Imagick::GRAVITY_CENTER); - $image->resizeImage(32, 32, Imagick::FILTER_LANCZOS, 1); - $precisionFix = -1; - - $group->compositeImage($image, Imagick::COMPOSITE_OVER, 0, 0); - $group->annotateImage($text, 32 + 4, $metrics['textHeight'] - $precisionFix, 0, $githubName); - - $group->rotateImage(new ImagickPixel('#00000000'), -22); - $x = 510 - $group->getImageWidth() / 2; - $y = 530 - $group->getImageHeight() / 2; - $baseImage->compositeImage($group, Imagick::COMPOSITE_OVER, $x, $y); - } elseif ($cardVariation === '2') { - $metrics = $baseImage->queryFontMetrics($text, $githubName); - - $group = new Imagick(); - $groupWidth = $metrics['textWidth'] + 32 + 4; - $group->newImage($groupWidth, $metrics['textHeight'] + 10, '#00000000'); - $image = new Imagick(__DIR__ . '/../../../public/images/cards/cloud/github.png'); - $image->setGravity(Imagick::GRAVITY_CENTER); - $image->resizeImage(32, 32, Imagick::FILTER_LANCZOS, 1); - $precisionFix = -1; - - $group->compositeImage($image, Imagick::COMPOSITE_OVER, 0, 0); - $group->annotateImage($text, 32 + 4, $metrics['textHeight'] - $precisionFix, 0, $githubName); - - $group->rotateImage(new ImagickPixel('#00000000'), 31.11); - $x = 485 - $group->getImageWidth() / 2; - $y = 530 - $group->getImageHeight() / 2; - $baseImage->compositeImage($group, Imagick::COMPOSITE_OVER, $x, $y); - } else { - $text->skewY(20); - $text->skewX(20); - $text->setTextAlignment(\Imagick::ALIGN_CENTER); - - $text->annotation(320 + 15 + 2, 640, $githubName); - $metrics = $baseImage->queryFontMetrics($text, $githubName); - - $image = new Imagick(__DIR__ . '/../../../public/images/cards/cloud/github-skew.png'); - $image->setGravity(Imagick::GRAVITY_CENTER); - $baseImage->compositeImage($image, Imagick::COMPOSITE_OVER, 512 - ($metrics['textWidth'] / 2), 518 + \strlen($githubName) * 1.3); - - $baseImage->drawImage($text); - } - } - - if (!empty($width) || !empty($height)) { - $baseImage->resizeImage($width, $height, Imagick::FILTER_LANCZOS, 1); - } - - $response - ->addHeader('Cache-Control', 'private, max-age=3888000') // 45 days - ->setContentType('image/png') - ->file($baseImage->getImageBlob()); - }); diff --git a/app/controllers/api/console.php b/app/controllers/api/console.php deleted file mode 100644 index 5bc8325794..0000000000 --- a/app/controllers/api/console.php +++ /dev/null @@ -1,147 +0,0 @@ -groups(['console']) - ->inject('project') - ->action(function (Document $project) { - if ($project->getId() !== 'console') { - throw new Exception(Exception::GENERAL_ACCESS_FORBIDDEN); - } - }); - - -App::get('/v1/console/variables') - ->desc('Get variables') - ->groups(['api', 'projects']) - ->label('scope', 'projects.read') - ->label('sdk', new Method( - namespace: 'console', - group: 'console', - name: 'variables', - description: '/docs/references/console/variables.md', - auth: [AuthType::ADMIN], - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_OK, - model: Response::MODEL_CONSOLE_VARIABLES, - ) - ], - contentType: ContentType::JSON - )) - ->inject('response') - ->action(function (Response $response) { - $validator = new Domain(System::getEnv('_APP_DOMAIN_TARGET_CNAME')); - $isCNAMEValid = !empty(System::getEnv('_APP_DOMAIN_TARGET_CNAME', '')) && $validator->isKnown() && !$validator->isTest(); - - $validator = new IP(IP::V4); - $isAValid = !empty(System::getEnv('_APP_DOMAIN_TARGET_A', '')) && ($validator->isValid(System::getEnv('_APP_DOMAIN_TARGET_A'))); - - $validator = new IP(IP::V6); - $isAAAAValid = !empty(System::getEnv('_APP_DOMAIN_TARGET_AAAA', '')) && $validator->isValid(System::getEnv('_APP_DOMAIN_TARGET_AAAA')); - - $isDomainEnabled = $isAAAAValid || $isAValid || $isCNAMEValid; - - $isVcsEnabled = !empty(System::getEnv('_APP_VCS_GITHUB_APP_NAME', '')) - && !empty(System::getEnv('_APP_VCS_GITHUB_PRIVATE_KEY', '')) - && !empty(System::getEnv('_APP_VCS_GITHUB_APP_ID', '')) - && !empty(System::getEnv('_APP_VCS_GITHUB_CLIENT_ID', '')) - && !empty(System::getEnv('_APP_VCS_GITHUB_CLIENT_SECRET', '')); - - $isAssistantEnabled = !empty(System::getEnv('_APP_ASSISTANT_OPENAI_API_KEY', '')); - - $variables = new Document([ - '_APP_DOMAIN_TARGET_CNAME' => System::getEnv('_APP_DOMAIN_TARGET_CNAME'), - '_APP_DOMAIN_TARGET_AAAA' => System::getEnv('_APP_DOMAIN_TARGET_AAAA'), - '_APP_DOMAIN_TARGET_A' => System::getEnv('_APP_DOMAIN_TARGET_A'), - // Combine CAA domain with most common flags and tag (no parameters) - '_APP_DOMAIN_TARGET_CAA' => '0 issue "' . System::getEnv('_APP_DOMAIN_TARGET_CAA') . '"', - '_APP_STORAGE_LIMIT' => +System::getEnv('_APP_STORAGE_LIMIT'), - '_APP_COMPUTE_BUILD_TIMEOUT' => +System::getEnv('_APP_COMPUTE_BUILD_TIMEOUT'), - '_APP_COMPUTE_SIZE_LIMIT' => +System::getEnv('_APP_COMPUTE_SIZE_LIMIT'), - '_APP_USAGE_STATS' => System::getEnv('_APP_USAGE_STATS'), - '_APP_VCS_ENABLED' => $isVcsEnabled, - '_APP_DOMAIN_ENABLED' => $isDomainEnabled, - '_APP_ASSISTANT_ENABLED' => $isAssistantEnabled, - '_APP_DOMAIN_SITES' => System::getEnv('_APP_DOMAIN_SITES'), - '_APP_DOMAIN_FUNCTIONS' => System::getEnv('_APP_DOMAIN_FUNCTIONS'), - '_APP_OPTIONS_FORCE_HTTPS' => System::getEnv('_APP_OPTIONS_FORCE_HTTPS'), - '_APP_DOMAINS_NAMESERVERS' => System::getEnv('_APP_DOMAINS_NAMESERVERS'), - ]); - - $response->dynamic($variables, Response::MODEL_CONSOLE_VARIABLES); - }); - -App::post('/v1/console/assistant') - ->desc('Create assistant query') - ->groups(['api', 'assistant']) - ->label('scope', 'assistant.read') - ->label('sdk', new Method( - namespace: 'assistant', - group: 'console', - name: 'chat', - description: '/docs/references/assistant/chat.md', - auth: [AuthType::ADMIN], - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_OK, - model: Response::MODEL_NONE, - ) - ], - contentType: ContentType::TEXT - )) - ->label('abuse-limit', 15) - ->label('abuse-key', 'userId:{userId}') - ->param('prompt', '', new Text(2000), 'Prompt. A string containing questions asked to the AI assistant.') - ->inject('response') - ->action(function (string $prompt, Response $response) { - $ch = curl_init('http://appwrite-assistant:3003/v1/models/assistant/prompt'); - $responseHeaders = []; - $query = json_encode(['prompt' => $prompt]); - $headers = ['accept: text/event-stream']; - $handleEvent = function ($ch, $data) use ($response) { - $response->chunk($data); - - return \strlen($data); - }; - - curl_setopt($ch, CURLOPT_WRITEFUNCTION, $handleEvent); - - curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST'); - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); - curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); - curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0); - curl_setopt($ch, CURLOPT_TIMEOUT, 9000); - curl_setopt($ch, CURLOPT_HEADERFUNCTION, function ($curl, $header) use (&$responseHeaders) { - $len = strlen($header); - $header = explode(':', $header, 2); - - if (count($header) < 2) { // ignore invalid headers - return $len; - } - - $responseHeaders[strtolower(trim($header[0]))] = trim($header[1]); - - return $len; - }); - - curl_setopt($ch, CURLOPT_POSTFIELDS, $query); - - curl_exec($ch); - - curl_close($ch); - - $response->chunk('', true); - }); diff --git a/app/controllers/api/graphql.php b/app/controllers/api/graphql.php index e0cc4181db..c577b3bc3e 100644 --- a/app/controllers/api/graphql.php +++ b/app/controllers/api/graphql.php @@ -224,8 +224,11 @@ function execute( $flags = DebugFlag::INCLUDE_DEBUG_MESSAGE | DebugFlag::INCLUDE_TRACE; $validations = GraphQL::getStandardValidationRules(); - if (System::getEnv('_APP_OPTIONS_ABUSE', 'enabled') !== 'disabled') { + if (System::getEnv('_APP_GRAPHQL_INTROSPECTION', 'enabled') === 'disabled') { $validations[] = new DisableIntrospection(); + } + + if (System::getEnv('_APP_OPTIONS_ABUSE', 'enabled') !== 'disabled') { $validations[] = new QueryComplexity($maxComplexity); $validations[] = new QueryDepth($maxDepth); } diff --git a/app/controllers/api/health.php b/app/controllers/api/health.php deleted file mode 100644 index 3e6a10a34e..0000000000 --- a/app/controllers/api/health.php +++ /dev/null @@ -1,1052 +0,0 @@ -desc('Get HTTP') - ->groups(['api', 'health']) - ->label('scope', 'health.read') - ->label('sdk', new Method( - namespace: 'health', - group: 'health', - name: 'get', - description: '/docs/references/health/get.md', - auth: [AuthType::ADMIN, AuthType::KEY], - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_OK, - model: Response::MODEL_HEALTH_STATUS, - ) - ], - contentType: ContentType::JSON - )) - ->inject('response') - ->action(function (Response $response) { - - $output = [ - 'name' => 'http', - 'status' => 'pass', - 'ping' => 0 - ]; - - $response->dynamic(new Document($output), Response::MODEL_HEALTH_STATUS); - }); - -App::get('/v1/health/version') - ->desc('Get version') - ->groups(['api', 'health']) - ->label('scope', 'public') - ->inject('response') - ->action(function (Response $response) { - $response->dynamic(new Document([ 'version' => APP_VERSION_STABLE ]), Response::MODEL_HEALTH_VERSION); - }); - -App::get('/v1/health/db') - ->desc('Get DB') - ->groups(['api', 'health']) - ->label('scope', 'health.read') - ->label('sdk', new Method( - namespace: 'health', - group: 'health', - name: 'getDB', - description: '/docs/references/health/get-db.md', - auth: [AuthType::ADMIN, AuthType::KEY], - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_OK, - model: Response::MODEL_HEALTH_STATUS, - ) - ], - contentType: ContentType::JSON - )) - ->inject('response') - ->inject('pools') - ->action(function (Response $response, Group $pools) { - $output = []; - $failures = []; - - $configs = [ - 'Console.DB' => Config::getParam('pools-console'), - 'Projects.DB' => Config::getParam('pools-database'), - ]; - - foreach ($configs as $key => $config) { - foreach ($config as $database) { - try { - $adapter = new DatabasePool($pools->get($database)); - - $checkStart = \microtime(true); - - if ($adapter->ping()) { - $output[] = new Document([ - 'name' => $key . " ($database)", - 'status' => 'pass', - 'ping' => \round((\microtime(true) - $checkStart) * 1000) - ]); - } else { - $failures[] = $database; - } - } catch (\Throwable) { - $failures[] = $database; - } - } - } - - // Only throw error if ALL databases failed (no successful pings) - // This allows partial failures in environments where not all DBs are ready - if (!empty($failures)) { - throw new Exception(Exception::GENERAL_SERVER_ERROR, 'DB failure on: ' . implode(", ", $failures)); - } - - $response->dynamic(new Document([ - 'statuses' => $output, - 'total' => count($output), - ]), Response::MODEL_HEALTH_STATUS_LIST); - }); - -App::get('/v1/health/cache') - ->desc('Get cache') - ->groups(['api', 'health']) - ->label('scope', 'health.read') - ->label('sdk', new Method( - namespace: 'health', - group: 'health', - name: 'getCache', - description: '/docs/references/health/get-cache.md', - auth: [AuthType::ADMIN, AuthType::KEY], - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_OK, - model: Response::MODEL_HEALTH_STATUS, - ) - ], - contentType: ContentType::JSON - )) - ->inject('response') - ->inject('pools') - ->action(function (Response $response, Group $pools) { - $output = []; - $failures = []; - - $configs = [ - 'Cache' => Config::getParam('pools-cache'), - ]; - - foreach ($configs as $key => $config) { - foreach ($config as $cache) { - try { - $adapter = new CachePool($pools->get($cache)); - - $checkStart = \microtime(true); - - if ($adapter->ping()) { - $output[] = new Document([ - 'name' => $key . " ($cache)", - 'status' => 'pass', - 'ping' => \round((\microtime(true) - $checkStart) * 1000) - ]); - } else { - $failures[] = $cache; - } - } catch (\Throwable) { - $failures[] = $cache; - } - } - } - - if (!empty($failures)) { - throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Cache failure on: ' . implode(", ", $failures)); - } - - $response->dynamic(new Document([ - 'statuses' => $output, - 'total' => count($output), - ]), Response::MODEL_HEALTH_STATUS_LIST); - }); - -App::get('/v1/health/pubsub') - ->desc('Get pubsub') - ->groups(['api', 'health']) - ->label('scope', 'health.read') - ->label('sdk', new Method( - namespace: 'health', - group: 'health', - name: 'getPubSub', - description: '/docs/references/health/get-pubsub.md', - auth: [AuthType::ADMIN, AuthType::KEY], - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_OK, - model: Response::MODEL_HEALTH_STATUS, - ) - ], - contentType: ContentType::JSON - )) - ->inject('response') - ->inject('pools') - ->action(function (Response $response, Group $pools) { - $output = []; - $failures = []; - - $configs = [ - 'PubSub' => Config::getParam('pools-pubsub'), - ]; - - foreach ($configs as $key => $config) { - foreach ($config as $pubsub) { - try { - $adapter = new PubSubPool($pools->get($pubsub)); - - $checkStart = \microtime(true); - - if ($adapter->ping()) { - $output[] = new Document([ - 'name' => $key . " ($pubsub)", - 'status' => 'pass', - 'ping' => \round((\microtime(true) - $checkStart) * 1000) - ]); - } else { - $failures[] = $pubsub; - } - } catch (\Throwable) { - $failures[] = $pubsub; - } - } - } - - if (!empty($failures)) { - throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Pubsub failure on: ' . implode(", ", $failures)); - } - - $response->dynamic(new Document([ - 'statuses' => $output, - 'total' => count($output), - ]), Response::MODEL_HEALTH_STATUS_LIST); - }); - -App::get('/v1/health/time') - ->desc('Get time') - ->groups(['api', 'health']) - ->label('scope', 'health.read') - ->label('sdk', new Method( - namespace: 'health', - group: 'health', - name: 'getTime', - description: '/docs/references/health/get-time.md', - auth: [AuthType::ADMIN, AuthType::KEY], - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_OK, - model: Response::MODEL_HEALTH_TIME, - ) - ], - contentType: ContentType::JSON - )) - ->inject('response') - ->action(function (Response $response) { - - /* - * Code from: @see https://www.beliefmedia.com.au/query-ntp-time-server - */ - $host = 'time.google.com'; // https://developers.google.com/time/ - $gap = 60; // Allow [X] seconds gap - - /* Create a socket and connect to NTP server */ - $sock = \socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); - - \socket_connect($sock, $host, 123); - - /* Send request */ - $msg = "\010" . \str_repeat("\0", 47); - - \socket_send($sock, $msg, \strlen($msg), 0); - - /* Receive response and close socket */ - \socket_recv($sock, $recv, 48, MSG_WAITALL); - \socket_close($sock); - - /* Interpret response */ - $data = \unpack('N12', $recv); - $timestamp = \sprintf('%u', $data[9]); - - /* NTP is number of seconds since 0000 UT on 1 January 1900 - Unix time is seconds since 0000 UT on 1 January 1970 */ - $timestamp -= 2208988800; - - $diff = ($timestamp - \time()); - - if ($diff > $gap || $diff < ($gap * -1)) { - throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Server time gaps detected'); - } - - $output = [ - 'remoteTime' => $timestamp, - 'localTime' => \time(), - 'diff' => $diff - ]; - - $response->dynamic(new Document($output), Response::MODEL_HEALTH_TIME); - }); - -App::get('/v1/health/queue/webhooks') - ->desc('Get webhooks queue') - ->groups(['api', 'health']) - ->label('scope', 'health.read') - ->label('sdk', new Method( - namespace: 'health', - group: 'queue', - name: 'getQueueWebhooks', - description: '/docs/references/health/get-queue-webhooks.md', - auth: [AuthType::ADMIN, AuthType::KEY], - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_OK, - model: Response::MODEL_HEALTH_QUEUE, - ) - ], - contentType: ContentType::JSON - )) - ->param('threshold', 5000, new Integer(true), 'Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.', true) - ->inject('queueForWebhooks') - ->inject('response') - ->action(function (int|string $threshold, Webhook $queueForWebhooks, Response $response) { - $threshold = \intval($threshold); - - $size = $queueForWebhooks->getSize(); - - if ($size >= $threshold) { - throw new Exception(Exception::HEALTH_QUEUE_SIZE_EXCEEDED, "Queue size threshold hit. Current size is {$size} and threshold is {$threshold}."); - } - - $response->dynamic(new Document([ 'size' => $size ]), Response::MODEL_HEALTH_QUEUE); - }); - -App::get('/v1/health/queue/logs') - ->desc('Get logs queue') - ->groups(['api', 'health']) - ->label('scope', 'health.read') - ->label('sdk', new Method( - namespace: 'health', - group: 'queue', - name: 'getQueueLogs', - description: '/docs/references/health/get-queue-logs.md', - auth: [AuthType::ADMIN, AuthType::KEY], - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_OK, - model: Response::MODEL_HEALTH_QUEUE, - ) - ], - contentType: ContentType::JSON - )) - ->param('threshold', 5000, new Integer(true), 'Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.', true) - ->inject('queueForAudits') - ->inject('response') - ->action(function (int|string $threshold, Audit $queueForAudits, Response $response) { - $threshold = \intval($threshold); - - $size = $queueForAudits->getSize(); - - if ($size >= $threshold) { - throw new Exception(Exception::HEALTH_QUEUE_SIZE_EXCEEDED, "Queue size threshold hit. Current size is {$size} and threshold is {$threshold}."); - } - - $response->dynamic(new Document([ 'size' => $size ]), Response::MODEL_HEALTH_QUEUE); - }); - -App::get('/v1/health/certificate') - ->desc('Get the SSL certificate for a domain') - ->groups(['api', 'health']) - ->label('scope', 'health.read') - ->label('sdk', new Method( - namespace: 'health', - group: 'health', - name: 'getCertificate', - description: '/docs/references/health/get-certificate.md', - auth: [AuthType::ADMIN, AuthType::KEY], - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_OK, - model: Response::MODEL_HEALTH_CERTIFICATE, - ) - ], - contentType: ContentType::JSON - )) - ->param('domain', null, new Multiple([new AnyOf([new URL(), new Domain()]), new PublicDomain()]), Multiple::TYPE_STRING, 'Domain name') - ->inject('response') - ->action(function (string $domain, Response $response) { - if (filter_var($domain, FILTER_VALIDATE_URL)) { - $domain = parse_url($domain, PHP_URL_HOST); - } - - $sslContext = stream_context_create([ - "ssl" => [ - "capture_peer_cert" => true - ] - ]); - $sslSocket = stream_socket_client("ssl://" . $domain . ":443", $errno, $errstr, 30, STREAM_CLIENT_CONNECT, $sslContext); - if (!$sslSocket) { - throw new Exception(Exception::HEALTH_INVALID_HOST); - } - - $streamContextParams = stream_context_get_params($sslSocket); - $peerCertificate = $streamContextParams['options']['ssl']['peer_certificate']; - $certificatePayload = openssl_x509_parse($peerCertificate); - - - $sslExpiration = $certificatePayload['validTo_time_t']; - $status = $sslExpiration < time() ? 'fail' : 'pass'; - - if ($status === 'fail') { - throw new Exception(Exception::HEALTH_CERTIFICATE_EXPIRED); - } - - $response->dynamic(new Document([ - 'name' => $certificatePayload['name'], - 'subjectSN' => $certificatePayload['subject']['CN'], - 'issuerOrganisation' => $certificatePayload['issuer']['O'], - 'validFrom' => $certificatePayload['validFrom_time_t'], - 'validTo' => $certificatePayload['validTo_time_t'], - 'signatureTypeSN' => $certificatePayload['signatureTypeSN'], - ]), Response::MODEL_HEALTH_CERTIFICATE); - }); - -App::get('/v1/health/queue/certificates') - ->desc('Get certificates queue') - ->groups(['api', 'health']) - ->label('scope', 'health.read') - ->label('sdk', new Method( - namespace: 'health', - group: 'queue', - name: 'getQueueCertificates', - description: '/docs/references/health/get-queue-certificates.md', - auth: [AuthType::ADMIN, AuthType::KEY], - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_OK, - model: Response::MODEL_HEALTH_QUEUE, - ) - ], - contentType: ContentType::JSON - )) - ->param('threshold', 5000, new Integer(true), 'Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.', true) - ->inject('queueForCertificates') - ->inject('response') - ->action(function (int|string $threshold, Certificate $queueForCertificates, Response $response) { - $threshold = \intval($threshold); - - $size = $queueForCertificates->getSize(); - - if ($size >= $threshold) { - throw new Exception(Exception::HEALTH_QUEUE_SIZE_EXCEEDED, "Queue size threshold hit. Current size is {$size} and threshold is {$threshold}."); - } - - $response->dynamic(new Document([ 'size' => $size ]), Response::MODEL_HEALTH_QUEUE); - }); - -App::get('/v1/health/queue/builds') - ->desc('Get builds queue') - ->groups(['api', 'health']) - ->label('scope', 'health.read') - ->label('sdk', new Method( - namespace: 'health', - group: 'queue', - name: 'getQueueBuilds', - description: '/docs/references/health/get-queue-builds.md', - auth: [AuthType::ADMIN, AuthType::KEY], - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_OK, - model: Response::MODEL_HEALTH_QUEUE, - ) - ], - contentType: ContentType::JSON - )) - ->param('threshold', 5000, new Integer(true), 'Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.', true) - ->inject('queueForBuilds') - ->inject('response') - ->action(function (int|string $threshold, Build $queueForBuilds, Response $response) { - $threshold = \intval($threshold); - - $size = $queueForBuilds->getSize(); - - if ($size >= $threshold) { - throw new Exception(Exception::HEALTH_QUEUE_SIZE_EXCEEDED, "Queue size threshold hit. Current size is {$size} and threshold is {$threshold}."); - } - - $response->dynamic(new Document([ 'size' => $size ]), Response::MODEL_HEALTH_QUEUE); - }); - -App::get('/v1/health/queue/databases') - ->desc('Get databases queue') - ->groups(['api', 'health']) - ->label('scope', 'health.read') - ->label('sdk', new Method( - namespace: 'health', - group: 'queue', - name: 'getQueueDatabases', - description: '/docs/references/health/get-queue-databases.md', - auth: [AuthType::ADMIN, AuthType::KEY], - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_OK, - model: Response::MODEL_HEALTH_QUEUE, - ) - ], - contentType: ContentType::JSON - )) - ->param('name', 'database_db_main', new Text(256), 'Queue name for which to check the queue size', true) - ->param('threshold', 5000, new Integer(true), 'Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.', true) - ->inject('queueForDatabase') - ->inject('response') - ->action(function (string $name, int|string $threshold, Database $queueForDatabase, Response $response) { - $threshold = \intval($threshold); - $size = $queueForDatabase->setQueue($name)->getSize(); - - if ($size >= $threshold) { - throw new Exception(Exception::HEALTH_QUEUE_SIZE_EXCEEDED, "Queue size threshold hit. Current size is {$size} and threshold is {$threshold}."); - } - - $response->dynamic(new Document([ 'size' => $size ]), Response::MODEL_HEALTH_QUEUE); - }); - -App::get('/v1/health/queue/deletes') - ->desc('Get deletes queue') - ->groups(['api', 'health']) - ->label('scope', 'health.read') - ->label('sdk', new Method( - namespace: 'health', - group: 'queue', - name: 'getQueueDeletes', - description: '/docs/references/health/get-queue-deletes.md', - auth: [AuthType::ADMIN, AuthType::KEY], - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_OK, - model: Response::MODEL_HEALTH_QUEUE, - ) - ], - contentType: ContentType::JSON - )) - ->param('threshold', 5000, new Integer(true), 'Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.', true) - ->inject('queueForDeletes') - ->inject('response') - ->action(function (int|string $threshold, Delete $queueForDeletes, Response $response) { - $threshold = \intval($threshold); - - $size = $queueForDeletes->getSize(); - - if ($size >= $threshold) { - throw new Exception(Exception::HEALTH_QUEUE_SIZE_EXCEEDED, "Queue size threshold hit. Current size is {$size} and threshold is {$threshold}."); - } - - $response->dynamic(new Document([ 'size' => $size ]), Response::MODEL_HEALTH_QUEUE); - }); - -App::get('/v1/health/queue/mails') - ->desc('Get mails queue') - ->groups(['api', 'health']) - ->label('scope', 'health.read') - ->label('sdk', new Method( - namespace: 'health', - group: 'queue', - name: 'getQueueMails', - description: '/docs/references/health/get-queue-mails.md', - auth: [AuthType::ADMIN, AuthType::KEY], - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_OK, - model: Response::MODEL_HEALTH_QUEUE, - ) - ], - contentType: ContentType::JSON - )) - ->param('threshold', 5000, new Integer(true), 'Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.', true) - ->inject('queueForMails') - ->inject('response') - ->action(function (int|string $threshold, Mail $queueForMails, Response $response) { - $threshold = \intval($threshold); - - $size = $queueForMails->getSize(); - - if ($size >= $threshold) { - throw new Exception(Exception::HEALTH_QUEUE_SIZE_EXCEEDED, "Queue size threshold hit. Current size is {$size} and threshold is {$threshold}."); - } - - $response->dynamic(new Document([ 'size' => $size ]), Response::MODEL_HEALTH_QUEUE); - }); - -App::get('/v1/health/queue/messaging') - ->desc('Get messaging queue') - ->groups(['api', 'health']) - ->label('scope', 'health.read') - ->label('sdk', new Method( - namespace: 'health', - group: 'queue', - name: 'getQueueMessaging', - description: '/docs/references/health/get-queue-messaging.md', - auth: [AuthType::ADMIN, AuthType::KEY], - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_OK, - model: Response::MODEL_HEALTH_QUEUE, - ) - ], - contentType: ContentType::JSON - )) - ->param('threshold', 5000, new Integer(true), 'Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.', true) - ->inject('queueForMessaging') - ->inject('response') - ->action(function (int|string $threshold, Messaging $queueForMessaging, Response $response) { - $threshold = \intval($threshold); - - $size = $queueForMessaging->getSize(); - - if ($size >= $threshold) { - throw new Exception(Exception::HEALTH_QUEUE_SIZE_EXCEEDED, "Queue size threshold hit. Current size is {$size} and threshold is {$threshold}."); - } - - $response->dynamic(new Document([ 'size' => $size ]), Response::MODEL_HEALTH_QUEUE); - }); - -App::get('/v1/health/queue/migrations') - ->desc('Get migrations queue') - ->groups(['api', 'health']) - ->label('scope', 'health.read') - ->label('sdk', new Method( - namespace: 'health', - group: 'queue', - name: 'getQueueMigrations', - description: '/docs/references/health/get-queue-migrations.md', - auth: [AuthType::ADMIN, AuthType::KEY], - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_OK, - model: Response::MODEL_HEALTH_QUEUE, - ) - ], - contentType: ContentType::JSON - )) - ->param('threshold', 5000, new Integer(true), 'Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.', true) - ->inject('queueForMigrations') - ->inject('response') - ->action(function (int|string $threshold, Migration $queueForMigrations, Response $response) { - $threshold = \intval($threshold); - - $size = $queueForMigrations->getSize(); - - if ($size >= $threshold) { - throw new Exception(Exception::HEALTH_QUEUE_SIZE_EXCEEDED, "Queue size threshold hit. Current size is {$size} and threshold is {$threshold}."); - } - - $response->dynamic(new Document([ 'size' => $size ]), Response::MODEL_HEALTH_QUEUE); - }); - -App::get('/v1/health/queue/functions') - ->desc('Get functions queue') - ->groups(['api', 'health']) - ->label('scope', 'health.read') - ->label('sdk', new Method( - namespace: 'health', - group: 'queue', - name: 'getQueueFunctions', - description: '/docs/references/health/get-queue-functions.md', - auth: [AuthType::ADMIN, AuthType::KEY], - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_OK, - model: Response::MODEL_HEALTH_QUEUE, - ) - ], - contentType: ContentType::JSON - )) - ->param('threshold', 5000, new Integer(true), 'Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.', true) - ->inject('queueForFunctions') - ->inject('response') - ->action(function (int|string $threshold, Func $queueForFunctions, Response $response) { - $threshold = \intval($threshold); - - $size = $queueForFunctions->getSize(); - - if ($size >= $threshold) { - throw new Exception(Exception::HEALTH_QUEUE_SIZE_EXCEEDED, "Queue size threshold hit. Current size is {$size} and threshold is {$threshold}."); - } - - $response->dynamic(new Document([ 'size' => $size ]), Response::MODEL_HEALTH_QUEUE); - }); - -App::get('/v1/health/queue/stats-resources') - ->desc('Get stats resources queue') - ->groups(['api', 'health']) - ->label('scope', 'health.read') - ->label('sdk', new Method( - namespace: 'health', - group: 'queue', - name: 'getQueueStatsResources', - description: '/docs/references/health/get-queue-stats-resources.md', - auth: [AuthType::ADMIN, AuthType::KEY], - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_OK, - model: Response::MODEL_HEALTH_QUEUE, - ) - ], - contentType: ContentType::JSON - )) - ->param('threshold', 5000, new Integer(true), 'Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.', true) - ->inject('queueForStatsResources') - ->inject('response') - ->action(function (int|string $threshold, StatsResources $queueForStatsResources, Response $response) { - $threshold = \intval($threshold); - - $size = $queueForStatsResources->getSize(); - - if ($size >= $threshold) { - throw new Exception(Exception::HEALTH_QUEUE_SIZE_EXCEEDED, "Queue size threshold hit. Current size is {$size} and threshold is {$threshold}."); - } - - $response->dynamic(new Document([ 'size' => $size ]), Response::MODEL_HEALTH_QUEUE); - }); - -App::get('/v1/health/queue/stats-usage') - ->desc('Get stats usage queue') - ->groups(['api', 'health']) - ->label('scope', 'health.read') - ->label('sdk', new Method( - namespace: 'health', - group: 'queue', - name: 'getQueueUsage', - description: '/docs/references/health/get-queue-stats-usage.md', - auth: [AuthType::ADMIN, AuthType::KEY], - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_OK, - model: Response::MODEL_HEALTH_QUEUE, - ) - ], - contentType: ContentType::JSON - )) - ->param('threshold', 5000, new Integer(true), 'Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.', true) - ->inject('queueForStatsUsage') - ->inject('response') - ->action(function (int|string $threshold, StatsUsage $queueForStatsUsage, Response $response) { - $threshold = \intval($threshold); - - $size = $queueForStatsUsage->getSize(); - - if ($size >= $threshold) { - throw new Exception(Exception::HEALTH_QUEUE_SIZE_EXCEEDED, "Queue size threshold hit. Current size is {$size} and threshold is {$threshold}."); - } - - $response->dynamic(new Document([ 'size' => $size ]), Response::MODEL_HEALTH_QUEUE); - }); - -App::get('/v1/health/storage/local') - ->desc('Get local storage') - ->groups(['api', 'health']) - ->label('scope', 'health.read') - ->label('sdk', new Method( - namespace: 'health', - group: 'storage', - name: 'getStorageLocal', - description: '/docs/references/health/get-storage-local.md', - auth: [AuthType::ADMIN, AuthType::KEY], - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_OK, - model: Response::MODEL_HEALTH_STATUS, - ) - ], - contentType: ContentType::JSON - )) - ->inject('response') - ->action(function (Response $response) { - - $checkStart = \microtime(true); - - foreach ( - [ - 'Uploads' => APP_STORAGE_UPLOADS, - 'Cache' => APP_STORAGE_CACHE, - 'Config' => APP_STORAGE_CONFIG, - 'Certs' => APP_STORAGE_CERTIFICATES - ] as $key => $volume - ) { - $device = new Local($volume); - - if (!\is_readable($device->getRoot())) { - throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Device ' . $key . ' dir is not readable'); - } - - if (!\is_writable($device->getRoot())) { - throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Device ' . $key . ' dir is not writable'); - } - } - - $output = [ - 'status' => 'pass', - 'ping' => \round((\microtime(true) - $checkStart) * 1000) - ]; - - $response->dynamic(new Document($output), Response::MODEL_HEALTH_STATUS); - }); - -App::get('/v1/health/storage') - ->desc('Get storage') - ->groups(['api', 'health']) - ->label('scope', 'health.read') - ->label('sdk', new Method( - namespace: 'health', - group: 'storage', - name: 'getStorage', - description: '/docs/references/health/get-storage.md', - auth: [AuthType::ADMIN, AuthType::KEY], - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_OK, - model: Response::MODEL_HEALTH_STATUS, - ) - ], - contentType: ContentType::JSON - )) - ->inject('response') - ->inject('deviceForFiles') - ->inject('deviceForFunctions') - ->inject('deviceForSites') - ->inject('deviceForBuilds') - ->action(function (Response $response, Device $deviceForFiles, Device $deviceForFunctions, Device $deviceForSites, Device $deviceForBuilds) { - $devices = [$deviceForFiles, $deviceForFunctions, $deviceForSites, $deviceForBuilds]; - $checkStart = \microtime(true); - - foreach ($devices as $device) { - $uniqueFileName = \uniqid('health', true); - $filePath = $device->getPath($uniqueFileName); - - if (!$device->write($filePath, 'test', 'text/plain')) { - throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed writing test file to ' . $device->getRoot()); - } - - if ($device->read($filePath) !== 'test') { - throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed reading test file from ' . $device->getRoot()); - } - - if (!$device->delete($filePath)) { - throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed deleting test file from ' . $device->getRoot()); - } - } - - $output = [ - 'status' => 'pass', - 'ping' => \round((\microtime(true) - $checkStart) * 1000) - ]; - - $response->dynamic(new Document($output), Response::MODEL_HEALTH_STATUS); - }); - -App::get('/v1/health/anti-virus') - ->desc('Get antivirus') - ->groups(['api', 'health']) - ->label('scope', 'health.read') - ->label('sdk', new Method( - namespace: 'health', - group: 'health', - name: 'getAntivirus', - description: '/docs/references/health/get-storage-anti-virus.md', - auth: [AuthType::ADMIN, AuthType::KEY], - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_OK, - model: Response::MODEL_HEALTH_ANTIVIRUS, - ) - ], - contentType: ContentType::JSON - )) - ->inject('response') - ->action(function (Response $response) { - - $output = [ - 'status' => '', - 'version' => '' - ]; - - if (System::getEnv('_APP_STORAGE_ANTIVIRUS') === 'disabled') { // Check if scans are enabled - $output['status'] = 'disabled'; - $output['version'] = ''; - } else { - $antivirus = new Network( - System::getEnv('_APP_STORAGE_ANTIVIRUS_HOST', 'clamav'), - (int) System::getEnv('_APP_STORAGE_ANTIVIRUS_PORT', 3310) - ); - - try { - $output['version'] = @$antivirus->version(); - $output['status'] = (@$antivirus->ping()) ? 'pass' : 'fail'; - } catch (\Throwable $e) { - throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Antivirus is not available'); - } - } - - $response->dynamic(new Document($output), Response::MODEL_HEALTH_ANTIVIRUS); - }); - -App::get('/v1/health/queue/failed/:name') - ->desc('Get number of failed queue jobs') - ->groups(['api', 'health']) - ->label('scope', 'health.read') - ->label('sdk', new Method( - namespace: 'health', - group: 'queue', - name: 'getFailedJobs', - description: '/docs/references/health/get-failed-queue-jobs.md', - auth: [AuthType::ADMIN, AuthType::KEY], - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_OK, - model: Response::MODEL_HEALTH_QUEUE, - ) - ], - contentType: ContentType::JSON - )) - ->param('name', '', new WhiteList([ - Event::DATABASE_QUEUE_NAME, - Event::DELETE_QUEUE_NAME, - Event::AUDITS_QUEUE_NAME, - Event::MAILS_QUEUE_NAME, - Event::FUNCTIONS_QUEUE_NAME, - Event::STATS_RESOURCES_QUEUE_NAME, - Event::STATS_USAGE_QUEUE_NAME, - Event::WEBHOOK_QUEUE_NAME, - Event::CERTIFICATES_QUEUE_NAME, - Event::BUILDS_QUEUE_NAME, - Event::MESSAGING_QUEUE_NAME, - Event::MIGRATIONS_QUEUE_NAME - ]), 'The name of the queue') - ->param('threshold', 5000, new Integer(true), 'Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.', true) - ->inject('response') - ->inject('queueForDatabase') - ->inject('queueForDeletes') - ->inject('queueForAudits') - ->inject('queueForMails') - ->inject('queueForFunctions') - ->inject('queueForStatsResources') - ->inject('queueForStatsUsage') - ->inject('queueForWebhooks') - ->inject('queueForCertificates') - ->inject('queueForBuilds') - ->inject('queueForMessaging') - ->inject('queueForMigrations') - ->action(function ( - string $name, - int|string $threshold, - Response $response, - Database $queueForDatabase, - Delete $queueForDeletes, - Audit $queueForAudits, - Mail $queueForMails, - Func $queueForFunctions, - StatsResources $queueForStatsResources, - StatsUsage $queueForStatsUsage, - Webhook $queueForWebhooks, - Certificate $queueForCertificates, - Build $queueForBuilds, - Messaging $queueForMessaging, - Migration $queueForMigrations - ) { - $threshold = \intval($threshold); - - /** @var Event $queue */ - $queue = match ($name) { - Event::DATABASE_QUEUE_NAME => $queueForDatabase, - Event::DELETE_QUEUE_NAME => $queueForDeletes, - Event::AUDITS_QUEUE_NAME => $queueForAudits, - Event::MAILS_QUEUE_NAME => $queueForMails, - Event::FUNCTIONS_QUEUE_NAME => $queueForFunctions, - Event::STATS_RESOURCES_QUEUE_NAME => $queueForStatsResources, - Event::STATS_USAGE_QUEUE_NAME => $queueForStatsUsage, - Event::WEBHOOK_QUEUE_NAME => $queueForWebhooks, - Event::CERTIFICATES_QUEUE_NAME => $queueForCertificates, - Event::BUILDS_QUEUE_NAME => $queueForBuilds, - Event::MESSAGING_QUEUE_NAME => $queueForMessaging, - Event::MIGRATIONS_QUEUE_NAME => $queueForMigrations, - }; - $failed = $queue->getSize(failed: true); - - if ($failed >= $threshold) { - throw new Exception(Exception::HEALTH_QUEUE_SIZE_EXCEEDED, "Queue failed jobs threshold hit. Current size is {$failed} and threshold is {$threshold}."); - } - - $response->dynamic(new Document([ 'size' => $failed ]), Response::MODEL_HEALTH_QUEUE); - }); - -App::get('/v1/health/stats') // Currently only used internally -->desc('Get system stats') - ->groups(['api', 'health']) - ->label('scope', 'root') - ->label('docs', false) - ->inject('response') - ->inject('register') - ->inject('deviceForFiles') - ->action(function (Response $response, Registry $register, Device $deviceForFiles) { - - $cache = $register->get('cache'); - - $cacheStats = $cache->info(); - - $response - ->json([ - 'storage' => [ - 'used' => Storage::human($deviceForFiles->getDirectorySize($deviceForFiles->getRoot() . '/')), - 'partitionTotal' => Storage::human($deviceForFiles->getPartitionTotalSpace()), - 'partitionFree' => Storage::human($deviceForFiles->getPartitionFreeSpace()), - ], - 'cache' => [ - 'uptime' => $cacheStats['uptime_in_seconds'] ?? 0, - 'clients' => $cacheStats['connected_clients'] ?? 0, - 'hits' => $cacheStats['keyspace_hits'] ?? 0, - 'misses' => $cacheStats['keyspace_misses'] ?? 0, - 'memory_used' => $cacheStats['used_memory'] ?? 0, - 'memory_used_human' => $cacheStats['used_memory_human'] ?? 0, - 'memory_used_peak' => $cacheStats['used_memory_peak'] ?? 0, - 'memory_used_peak_human' => $cacheStats['used_memory_peak_human'] ?? 0, - ], - ]); - }); diff --git a/app/controllers/api/messaging.php b/app/controllers/api/messaging.php index 0eb9866173..6ac36fe3c0 100644 --- a/app/controllers/api/messaging.php +++ b/app/controllers/api/messaging.php @@ -1147,7 +1147,8 @@ App::get('/v1/messaging/providers/:providerId/logs') ->inject('dbForProject') ->inject('locale') ->inject('geodb') - ->action(function (string $providerId, array $queries, bool $includeTotal, Response $response, Database $dbForProject, Locale $locale, Reader $geodb) { + ->inject('audit') + ->action(function (string $providerId, array $queries, bool $includeTotal, Response $response, Database $dbForProject, Locale $locale, Reader $geodb, Audit $audit) { $provider = $dbForProject->getDocument('providers', $providerId); if ($provider->isEmpty()) { @@ -1160,9 +1161,12 @@ App::get('/v1/messaging/providers/:providerId/logs') throw new Exception(Exception::GENERAL_QUERY_INVALID, $e->getMessage()); } - $audit = new Audit($dbForProject); + $grouped = Query::groupByType($queries); + $limit = $grouped['limit'] ?? 25; + $offset = $grouped['offset'] ?? 0; + $resource = 'provider/' . $providerId; - $logs = $audit->getLogsByResource($resource, $queries); + $logs = $audit->getLogsByResource($resource, offset: $offset, limit: $limit); $output = []; foreach ($logs as $i => &$log) { @@ -1209,7 +1213,7 @@ App::get('/v1/messaging/providers/:providerId/logs') } $response->dynamic(new Document([ - 'total' => $includeTotal ? $audit->countLogsByResource($resource, $queries) : 0, + 'total' => $includeTotal ? $audit->countLogsByResource($resource) : 0, 'logs' => $output, ]), Response::MODEL_LOG_LIST); }); @@ -2552,7 +2556,8 @@ App::get('/v1/messaging/topics/:topicId/logs') ->inject('dbForProject') ->inject('locale') ->inject('geodb') - ->action(function (string $topicId, array $queries, bool $includeTotal, Response $response, Database $dbForProject, Locale $locale, Reader $geodb) { + ->inject('audit') + ->action(function (string $topicId, array $queries, bool $includeTotal, Response $response, Database $dbForProject, Locale $locale, Reader $geodb, Audit $audit) { $topic = $dbForProject->getDocument('topics', $topicId); if ($topic->isEmpty()) { @@ -2565,9 +2570,12 @@ App::get('/v1/messaging/topics/:topicId/logs') throw new Exception(Exception::GENERAL_QUERY_INVALID, $e->getMessage()); } - $audit = new Audit($dbForProject); + $grouped = Query::groupByType($queries); + $limit = $grouped['limit'] ?? 25; + $offset = $grouped['offset'] ?? 0; + $resource = 'topic/' . $topicId; - $logs = $audit->getLogsByResource($resource, $queries); + $logs = $audit->getLogsByResource($resource, offset: $offset, limit: $limit); $output = []; @@ -2615,7 +2623,7 @@ App::get('/v1/messaging/topics/:topicId/logs') } $response->dynamic(new Document([ - 'total' => $includeTotal ? $audit->countLogsByResource($resource, $queries) : 0, + 'total' => $includeTotal ? $audit->countLogsByResource($resource) : 0, 'logs' => $output, ]), Response::MODEL_LOG_LIST); }); @@ -2968,7 +2976,8 @@ App::get('/v1/messaging/subscribers/:subscriberId/logs') ->inject('dbForProject') ->inject('locale') ->inject('geodb') - ->action(function (string $subscriberId, array $queries, bool $includeTotal, Response $response, Database $dbForProject, Locale $locale, Reader $geodb) { + ->inject('audit') + ->action(function (string $subscriberId, array $queries, bool $includeTotal, Response $response, Database $dbForProject, Locale $locale, Reader $geodb, Audit $audit) { $subscriber = $dbForProject->getDocument('subscribers', $subscriberId); if ($subscriber->isEmpty()) { @@ -2981,9 +2990,12 @@ App::get('/v1/messaging/subscribers/:subscriberId/logs') throw new Exception(Exception::GENERAL_QUERY_INVALID, $e->getMessage()); } - $audit = new Audit($dbForProject); + $grouped = Query::groupByType($queries); + $limit = $grouped['limit'] ?? 25; + $offset = $grouped['offset'] ?? 0; + $resource = 'subscriber/' . $subscriberId; - $logs = $audit->getLogsByResource($resource, $queries); + $logs = $audit->getLogsByResource($resource, limit: $limit, offset: $offset); $output = []; @@ -3031,7 +3043,7 @@ App::get('/v1/messaging/subscribers/:subscriberId/logs') } $response->dynamic(new Document([ - 'total' => $includeTotal ? $audit->countLogsByResource($resource, $queries) : 0, + 'total' => $includeTotal ? $audit->countLogsByResource($resource) : 0, 'logs' => $output, ]), Response::MODEL_LOG_LIST); }); @@ -3767,7 +3779,8 @@ App::get('/v1/messaging/messages/:messageId/logs') ->inject('dbForProject') ->inject('locale') ->inject('geodb') - ->action(function (string $messageId, array $queries, bool $includeTotal, Response $response, Database $dbForProject, Locale $locale, Reader $geodb) { + ->inject('audit') + ->action(function (string $messageId, array $queries, bool $includeTotal, Response $response, Database $dbForProject, Locale $locale, Reader $geodb, Audit $audit) { $message = $dbForProject->getDocument('messages', $messageId); if ($message->isEmpty()) { @@ -3780,9 +3793,12 @@ App::get('/v1/messaging/messages/:messageId/logs') throw new Exception(Exception::GENERAL_QUERY_INVALID, $e->getMessage()); } - $audit = new Audit($dbForProject); + $grouped = Query::groupByType($queries); + $limit = $grouped['limit'] ?? 25; + $offset = $grouped['offset'] ?? 0; + $resource = 'message/' . $messageId; - $logs = $audit->getLogsByResource($resource, $queries); + $logs = $audit->getLogsByResource($resource, limit: $limit, offset: $offset); $output = []; @@ -3830,7 +3846,7 @@ App::get('/v1/messaging/messages/:messageId/logs') } $response->dynamic(new Document([ - 'total' => $includeTotal ? $audit->countLogsByResource($resource, $queries) : 0, + 'total' => $includeTotal ? $audit->countLogsByResource($resource) : 0, 'logs' => $output, ]), Response::MODEL_LOG_LIST); }); diff --git a/app/controllers/api/projects.php b/app/controllers/api/projects.php index 37f7fdbc8b..b0493ff38f 100644 --- a/app/controllers/api/projects.php +++ b/app/controllers/api/projects.php @@ -21,6 +21,7 @@ use Appwrite\Utopia\Request; use Appwrite\Utopia\Response; use PHPMailer\PHPMailer\PHPMailer; use Utopia\App; +use Utopia\Audit\Adapter\Database as AdapterDatabase; use Utopia\Audit\Audit; use Utopia\Cache\Cache; use Utopia\Config\Config; @@ -203,6 +204,7 @@ App::post('/v1/projects') 'accessedAt' => DateTime::now(), 'search' => implode(' ', [$projectId, $name]), 'database' => $dsn, + 'labels' => [], ])); } catch (Duplicate) { throw new Exception(Exception::PROJECT_ALREADY_EXISTS); @@ -225,6 +227,7 @@ App::post('/v1/projects') if (!$sharedTablesV2) { $adapter = new DatabasePool($pools->get($dsn->getHost())); $dbForProject = new Database($adapter, $cache); + $dbForProject->setDatabase(APP_DATABASE); if ($sharedTables) { $dbForProject @@ -247,13 +250,15 @@ App::post('/v1/projects') } if ($create || $projectTables) { - $audit = new Audit($dbForProject); + $adapter = new AdapterDatabase($dbForProject); + $audit = new Audit($adapter); $audit->setup(); } if (!$create && $sharedTablesV1) { - $attributes = \array_map(fn ($attribute) => new Document($attribute), Audit::ATTRIBUTES); - $indexes = \array_map(fn (array $index) => new Document($index), Audit::INDEXES); + $adapter = new AdapterDatabase($dbForProject); + $attributes = $adapter->getAttributeDocuments(); + $indexes = $adapter->getIndexDocuments(); $dbForProject->createDocument(Database::METADATA, new Document([ '$id' => ID::custom('audit'), '$permissions' => [Permission::create(Role::any())], @@ -294,7 +299,7 @@ App::post('/v1/projects') // Hook allowing instant project mirroring during migration // Outside of migration, hook is not registered and has no effect - $hooks->trigger('afterProjectCreation', [ $project, $pools, $cache ]); + $hooks->trigger('afterProjectCreation', [$project, $pools, $cache]); $response ->setStatusCode(Response::STATUS_CODE_CREATED) @@ -1497,8 +1502,12 @@ App::post('/v1/projects/:projectId/keys') Permission::update(Role::any()), Permission::delete(Role::any()), ], + // TODO: @hmacr Remove `projectInternalId` and `projectId` column writes before deleting the column. 'projectInternalId' => $project->getSequence(), 'projectId' => $project->getId(), + 'resourceInternalId' => $project->getSequence(), + 'resourceId' => $project->getId(), + 'resourceType' => 'projects', 'name' => $name, 'scopes' => $scopes, 'expire' => $expire, @@ -1546,7 +1555,8 @@ App::get('/v1/projects/:projectId/keys') } $keys = $dbForPlatform->find('keys', [ - Query::equal('projectInternalId', [$project->getSequence()]), + Query::equal('resourceType', ['projects']), + Query::equal('resourceInternalId', [$project->getSequence()]), Query::limit(5000), ]); @@ -1587,7 +1597,8 @@ App::get('/v1/projects/:projectId/keys/:keyId') $key = $dbForPlatform->findOne('keys', [ Query::equal('$id', [$keyId]), - Query::equal('projectInternalId', [$project->getSequence()]), + Query::equal('resourceType', ['projects']), + Query::equal('resourceInternalId', [$project->getSequence()]), ]); if ($key->isEmpty()) { @@ -1631,7 +1642,8 @@ App::put('/v1/projects/:projectId/keys/:keyId') $key = $dbForPlatform->findOne('keys', [ Query::equal('$id', [$keyId]), - Query::equal('projectInternalId', [$project->getSequence()]), + Query::equal('resourceType', ['projects']), + Query::equal('resourceInternalId', [$project->getSequence()]), ]); if ($key->isEmpty()) { @@ -1682,7 +1694,8 @@ App::delete('/v1/projects/:projectId/keys/:keyId') $key = $dbForPlatform->findOne('keys', [ Query::equal('$id', [$keyId]), - Query::equal('projectInternalId', [$project->getSequence()]), + Query::equal('resourceType', ['projects']), + Query::equal('resourceInternalId', [$project->getSequence()]), ]); if ($key->isEmpty()) { @@ -2079,6 +2092,7 @@ App::patch('/v1/projects/:projectId/smtp') if ($enabled) { $mail = new PHPMailer(true); $mail->isSMTP(); + $mail->SMTPAuth = (!empty($username) && !empty($password)); $mail->Username = $username; $mail->Password = $password; $mail->Host = $host; @@ -2094,7 +2108,7 @@ App::patch('/v1/projects/:projectId/smtp') throw new Exception('Connection is not valid.'); } } catch (Throwable $error) { - throw new Exception(Exception::PROJECT_SMTP_CONFIG_INVALID, 'Could not connect to SMTP server: ' . $error->getMessage()); + throw new Exception(Exception::PROJECT_SMTP_CONFIG_INVALID, $error->getMessage()); } } @@ -2665,7 +2679,7 @@ App::patch('/v1/projects/:projectId/auth/session-invalidation') $auths = $project->getAttribute('auths', []); $auths['invalidateSessions'] = $enabled; $dbForPlatform->updateDocument('projects', $project->getId(), $project - ->setAttribute('auths', $auths)); + ->setAttribute('auths', $auths)); $response->dynamic($project, Response::MODEL_PROJECT); }); diff --git a/app/controllers/api/storage.php b/app/controllers/api/storage.php deleted file mode 100644 index 051b75bd2c..0000000000 --- a/app/controllers/api/storage.php +++ /dev/null @@ -1,2052 +0,0 @@ -desc('Create bucket') - ->groups(['api', 'storage']) - ->label('scope', 'buckets.write') - ->label('resourceType', RESOURCE_TYPE_BUCKETS) - ->label('event', 'buckets.[bucketId].create') - ->label('audits.event', 'bucket.create') - ->label('audits.resource', 'bucket/{response.$id}') - ->label('sdk', new Method( - namespace: 'storage', - group: 'buckets', - name: 'createBucket', - description: '/docs/references/storage/create-bucket.md', - auth: [AuthType::ADMIN, AuthType::KEY], - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_CREATED, - model: Response::MODEL_BUCKET, - ) - ] - )) - ->param('bucketId', '', new CustomId(), '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.') - ->param('name', '', new Text(128), 'Bucket name') - ->param('permissions', null, new Nullable(new Permissions(APP_LIMIT_ARRAY_PARAMS_SIZE)), 'An array of permission strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).', true) - ->param('fileSecurity', false, new Boolean(true), '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).', true) - ->param('enabled', true, new Boolean(true), '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.', true) - ->param('maximumFileSize', fn (array $plan) => empty($plan['fileSize']) ? (int) System::getEnv('_APP_STORAGE_LIMIT', 0) : $plan['fileSize'] * 1000 * 1000, fn (array $plan) => new Range(1, empty($plan['fileSize']) ? (int) System::getEnv('_APP_STORAGE_LIMIT', 0) : $plan['fileSize'] * 1000 * 1000), 'Maximum file size allowed in bytes. Maximum allowed value is ' . Storage::human(System::getEnv('_APP_STORAGE_LIMIT', 0), 0) . '.', true, ['plan']) - ->param('allowedFileExtensions', [], new ArrayList(new Text(64), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Allowed file extensions. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' extensions are allowed, each 64 characters long.', true) - ->param('compression', Compression::NONE, new WhiteList([Compression::NONE, Compression::GZIP, Compression::ZSTD], true), 'Compression algorithm choosen for compression. Can be one of ' . Compression::NONE . ', [' . Compression::GZIP . '](https://en.wikipedia.org/wiki/Gzip), or [' . Compression::ZSTD . '](https://en.wikipedia.org/wiki/Zstd), For file size above ' . Storage::human(APP_STORAGE_READ_BUFFER, 0) . ' compression is skipped even if it\'s enabled', true) - ->param('encryption', true, new Boolean(true), 'Is encryption enabled? For file size above ' . Storage::human(APP_STORAGE_READ_BUFFER, 0) . ' encryption is skipped even if it\'s enabled', true) - ->param('antivirus', true, new Boolean(true), 'Is virus scanning enabled? For file size above ' . Storage::human(APP_LIMIT_ANTIVIRUS, 0) . ' AntiVirus scanning is skipped even if it\'s enabled', true) - ->param('transformations', true, new Boolean(true), 'Are image transformations enabled?', true) - ->inject('response') - ->inject('dbForProject') - ->inject('queueForEvents') - ->action(function (string $bucketId, string $name, ?array $permissions, bool $fileSecurity, bool $enabled, int $maximumFileSize, array $allowedFileExtensions, ?string $compression, ?bool $encryption, bool $antivirus, bool $transformations, Response $response, Database $dbForProject, Event $queueForEvents) { - - $bucketId = $bucketId === 'unique()' ? ID::unique() : $bucketId; - - // Map aggregate permissions into the multiple permissions they represent. - $permissions = Permission::aggregate($permissions) ?? []; - $compression ??= Compression::NONE; - $encryption ??= true; - try { - $files = (Config::getParam('collections', [])['buckets'] ?? [])['files'] ?? []; - if (empty($files)) { - throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Files collection is not configured.'); - } - - $attributes = []; - $indexes = []; - - foreach ($files['attributes'] as $attribute) { - $attributes[] = new Document([ - '$id' => $attribute['$id'], - 'type' => $attribute['type'], - 'size' => $attribute['size'], - 'required' => $attribute['required'], - 'signed' => $attribute['signed'], - 'array' => $attribute['array'], - 'filters' => $attribute['filters'], - 'default' => $attribute['default'] ?? null, - 'format' => $attribute['format'] ?? '' - ]); - } - - foreach ($files['indexes'] as $index) { - $indexes[] = new Document([ - '$id' => $index['$id'], - 'type' => $index['type'], - 'attributes' => $index['attributes'], - 'lengths' => $index['lengths'], - 'orders' => $index['orders'], - ]); - } - - $dbForProject->createDocument('buckets', new Document([ - '$id' => $bucketId, - '$collection' => 'buckets', - '$permissions' => $permissions, - 'name' => $name, - 'maximumFileSize' => $maximumFileSize, - 'allowedFileExtensions' => $allowedFileExtensions, - 'fileSecurity' => $fileSecurity, - 'enabled' => $enabled, - 'compression' => $compression, - 'encryption' => $encryption, - 'antivirus' => $antivirus, - 'transformations' => $transformations, - 'search' => implode(' ', [$bucketId, $name]), - ])); - - $bucket = $dbForProject->getDocument('buckets', $bucketId); - - $dbForProject->createCollection('bucket_' . $bucket->getSequence(), $attributes, $indexes, permissions: $permissions, documentSecurity: $fileSecurity); - } catch (DuplicateException) { - throw new Exception(Exception::STORAGE_BUCKET_ALREADY_EXISTS); - } - - $queueForEvents - ->setParam('bucketId', $bucket->getId()) - ; - - $response - ->setStatusCode(Response::STATUS_CODE_CREATED) - ->dynamic($bucket, Response::MODEL_BUCKET); - }); - -App::get('/v1/storage/buckets') - ->desc('List buckets') - ->groups(['api', 'storage']) - ->label('scope', 'buckets.read') - ->label('resourceType', RESOURCE_TYPE_BUCKETS) - ->label('sdk', new Method( - namespace: 'storage', - group: 'buckets', - name: 'listBuckets', - description: '/docs/references/storage/list-buckets.md', - auth: [AuthType::ADMIN, AuthType::KEY], - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_OK, - model: Response::MODEL_BUCKET_LIST, - ) - ] - )) - ->param('queries', [], new Buckets(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long. You may filter on the following attributes: ' . implode(', ', Buckets::ALLOWED_ATTRIBUTES), true) - ->param('search', '', new Text(256), 'Search term to filter your list results. Max length: 256 chars.', true) - ->param('total', true, new Boolean(true), 'When set to false, the total count returned will be 0 and will not be calculated.', true) - ->inject('response') - ->inject('dbForProject') - ->action(function (array $queries, string $search, bool $includeTotal, Response $response, Database $dbForProject) { - - try { - $queries = Query::parseQueries($queries); - } catch (QueryException $e) { - throw new Exception(Exception::GENERAL_QUERY_INVALID, $e->getMessage()); - } - - if (!empty($search)) { - $queries[] = Query::search('search', $search); - } - - /** - * Get cursor document if there was a cursor query, we use array_filter and reset for reference $cursor to $queries - */ - $cursor = \array_filter($queries, function ($query) { - return \in_array($query->getMethod(), [Query::TYPE_CURSOR_AFTER, Query::TYPE_CURSOR_BEFORE]); - }); - $cursor = reset($cursor); - if ($cursor) { - /** @var Query $cursor */ - - $validator = new Cursor(); - if (!$validator->isValid($cursor)) { - throw new Exception(Exception::GENERAL_QUERY_INVALID, $validator->getDescription()); - } - - $bucketId = $cursor->getValue(); - $cursorDocument = $dbForProject->getDocument('buckets', $bucketId); - - if ($cursorDocument->isEmpty()) { - throw new Exception(Exception::GENERAL_CURSOR_NOT_FOUND, "Bucket '{$bucketId}' for the 'cursor' value not found."); - } - - $cursor->setValue($cursorDocument); - } - - $filterQueries = Query::groupByType($queries)['filters']; - try { - $buckets = $dbForProject->find('buckets', $queries); - $total = $includeTotal ? $dbForProject->count('buckets', $filterQueries, APP_LIMIT_COUNT) : 0; - } catch (OrderException $e) { - throw new Exception(Exception::DATABASE_QUERY_ORDER_NULL, "The order attribute '{$e->getAttribute()}' had a null value. Cursor pagination requires all documents order attribute values are non-null."); - } catch (QueryException $e) { - throw new Exception(Exception::GENERAL_QUERY_INVALID, $e->getMessage()); - } - $response->dynamic(new Document([ - 'buckets' => $buckets, - 'total' => $total, - ]), Response::MODEL_BUCKET_LIST); - }); - -App::get('/v1/storage/buckets/:bucketId') - ->desc('Get bucket') - ->groups(['api', 'storage']) - ->label('scope', 'buckets.read') - ->label('resourceType', RESOURCE_TYPE_BUCKETS) - ->label('sdk', new Method( - namespace: 'storage', - group: 'buckets', - name: 'getBucket', - description: '/docs/references/storage/get-bucket.md', - auth: [AuthType::ADMIN, AuthType::KEY], - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_OK, - model: Response::MODEL_BUCKET, - ) - ] - )) - ->param('bucketId', '', new UID(), 'Bucket unique ID.') - ->inject('response') - ->inject('dbForProject') - ->action(function (string $bucketId, Response $response, Database $dbForProject) { - - $bucket = $dbForProject->getDocument('buckets', $bucketId); - - if ($bucket->isEmpty()) { - throw new Exception(Exception::STORAGE_BUCKET_NOT_FOUND); - } - - $response->dynamic($bucket, Response::MODEL_BUCKET); - }); - -App::put('/v1/storage/buckets/:bucketId') - ->desc('Update bucket') - ->groups(['api', 'storage']) - ->label('scope', 'buckets.write') - ->label('resourceType', RESOURCE_TYPE_BUCKETS) - ->label('event', 'buckets.[bucketId].update') - ->label('audits.event', 'bucket.update') - ->label('audits.resource', 'bucket/{response.$id}') - ->label('sdk', new Method( - namespace: 'storage', - group: 'buckets', - name: 'updateBucket', - description: '/docs/references/storage/update-bucket.md', - auth: [AuthType::ADMIN, AuthType::KEY], - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_OK, - model: Response::MODEL_BUCKET, - ) - ] - )) - ->param('bucketId', '', new UID(), 'Bucket unique ID.') - ->param('name', null, new Text(128), 'Bucket name', false) - ->param('permissions', null, new Nullable(new Permissions(APP_LIMIT_ARRAY_PARAMS_SIZE)), 'An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).', true) - ->param('fileSecurity', false, new Boolean(true), '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).', true) - ->param('enabled', true, new Boolean(true), '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.', true) - ->param('maximumFileSize', fn (array $plan) => empty($plan['fileSize']) ? (int) System::getEnv('_APP_STORAGE_LIMIT', 0) : $plan['fileSize'] * 1000 * 1000, fn (array $plan) => new Range(1, empty($plan['fileSize']) ? (int) System::getEnv('_APP_STORAGE_LIMIT', 0) : $plan['fileSize'] * 1000 * 1000), 'Maximum file size allowed in bytes. Maximum allowed value is ' . Storage::human(System::getEnv('_APP_STORAGE_LIMIT', 0), 0) . '.', true, ['plan']) - ->param('allowedFileExtensions', [], new ArrayList(new Text(64), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Allowed file extensions. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' extensions are allowed, each 64 characters long.', true) - ->param('compression', Compression::NONE, new WhiteList([Compression::NONE, Compression::GZIP, Compression::ZSTD], true), 'Compression algorithm choosen for compression. Can be one of ' . Compression::NONE . ', [' . Compression::GZIP . '](https://en.wikipedia.org/wiki/Gzip), or [' . Compression::ZSTD . '](https://en.wikipedia.org/wiki/Zstd), For file size above ' . Storage::human(APP_STORAGE_READ_BUFFER, 0) . ' compression is skipped even if it\'s enabled', true) - ->param('encryption', true, new Boolean(true), 'Is encryption enabled? For file size above ' . Storage::human(APP_STORAGE_READ_BUFFER, 0) . ' encryption is skipped even if it\'s enabled', true) - ->param('antivirus', true, new Boolean(true), 'Is virus scanning enabled? For file size above ' . Storage::human(APP_LIMIT_ANTIVIRUS, 0) . ' AntiVirus scanning is skipped even if it\'s enabled', true) - ->param('transformations', true, new Boolean(true), 'Are image transformations enabled?', true) - ->inject('response') - ->inject('dbForProject') - ->inject('queueForEvents') - ->action(function (string $bucketId, string $name, ?array $permissions, bool $fileSecurity, bool $enabled, ?int $maximumFileSize, array $allowedFileExtensions, ?string $compression, ?bool $encryption, bool $antivirus, bool $transformations, Response $response, Database $dbForProject, Event $queueForEvents) { - $bucket = $dbForProject->getDocument('buckets', $bucketId); - - if ($bucket->isEmpty()) { - throw new Exception(Exception::STORAGE_BUCKET_NOT_FOUND); - } - - $permissions ??= $bucket->getPermissions(); - $maximumFileSize ??= $bucket->getAttribute('maximumFileSize', (int) System::getEnv('_APP_STORAGE_LIMIT', 0)); - $allowedFileExtensions ??= $bucket->getAttribute('allowedFileExtensions', []); - $enabled ??= $bucket->getAttribute('enabled', true); - $encryption ??= $bucket->getAttribute('encryption', true); - $antivirus ??= $bucket->getAttribute('antivirus', true); - $compression ??= $bucket->getAttribute('compression', Compression::NONE); - $transformations ??= $bucket->getAttribute('transformations', true); - - // Map aggregate permissions into the multiple permissions they represent. - $permissions = Permission::aggregate($permissions); - - $bucket = $dbForProject->updateDocument('buckets', $bucket->getId(), $bucket - ->setAttribute('name', $name) - ->setAttribute('$permissions', $permissions) - ->setAttribute('maximumFileSize', $maximumFileSize) - ->setAttribute('allowedFileExtensions', $allowedFileExtensions) - ->setAttribute('fileSecurity', $fileSecurity) - ->setAttribute('enabled', $enabled) - ->setAttribute('encryption', $encryption) - ->setAttribute('compression', $compression) - ->setAttribute('antivirus', $antivirus) - ->setAttribute('transformations', $transformations)); - - $dbForProject->updateCollection('bucket_' . $bucket->getSequence(), $permissions, $fileSecurity); - - $queueForEvents - ->setParam('bucketId', $bucket->getId()); - - $response->dynamic($bucket, Response::MODEL_BUCKET); - }); - -App::delete('/v1/storage/buckets/:bucketId') - ->desc('Delete bucket') - ->groups(['api', 'storage']) - ->label('scope', 'buckets.write') - ->label('resourceType', RESOURCE_TYPE_BUCKETS) - ->label('audits.event', 'bucket.delete') - ->label('event', 'buckets.[bucketId].delete') - ->label('audits.resource', 'bucket/{request.bucketId}') - ->label('sdk', new Method( - namespace: 'storage', - group: 'buckets', - name: 'deleteBucket', - description: '/docs/references/storage/delete-bucket.md', - auth: [AuthType::ADMIN, AuthType::KEY], - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_NOCONTENT, - model: Response::MODEL_NONE, - ) - ], - contentType: ContentType::NONE - )) - ->param('bucketId', '', new UID(), 'Bucket unique ID.') - ->inject('response') - ->inject('dbForProject') - ->inject('queueForDeletes') - ->inject('queueForEvents') - ->action(function (string $bucketId, Response $response, Database $dbForProject, Delete $queueForDeletes, Event $queueForEvents) { - $bucket = $dbForProject->getDocument('buckets', $bucketId); - - if ($bucket->isEmpty()) { - throw new Exception(Exception::STORAGE_BUCKET_NOT_FOUND); - } - - if (!$dbForProject->deleteDocument('buckets', $bucketId)) { - throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to remove bucket from DB'); - } - - $queueForDeletes - ->setType(DELETE_TYPE_DOCUMENT) - ->setDocument($bucket); - - $queueForEvents - ->setParam('bucketId', $bucket->getId()) - ->setPayload($response->output($bucket, Response::MODEL_BUCKET)) - ; - - $response->noContent(); - }); - -App::post('/v1/storage/buckets/:bucketId/files') - ->alias('/v1/storage/files') - ->desc('Create file') - ->groups(['api', 'storage']) - ->label('scope', 'files.write') - ->label('resourceType', RESOURCE_TYPE_BUCKETS) - ->label('audits.event', 'file.create') - ->label('event', 'buckets.[bucketId].files.[fileId].create') - ->label('audits.resource', 'file/{response.$id}') - ->label('abuse-key', 'ip:{ip},method:{method},url:{url},userId:{userId},chunkId:{chunkId}') - ->label('abuse-limit', APP_LIMIT_WRITE_RATE_DEFAULT) - ->label('abuse-time', APP_LIMIT_WRITE_RATE_PERIOD_DEFAULT) - ->label('sdk', new Method( - namespace: 'storage', - group: 'files', - name: 'createFile', - description: '/docs/references/storage/create-file.md', - auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_CREATED, - model: Response::MODEL_FILE, - ) - ], - type: MethodType::UPLOAD, - requestType: ContentType::MULTIPART - )) - ->param('bucketId', '', new UID(), 'Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') - ->param('fileId', '', new CustomId(), 'File ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') - ->param('file', [], new File(), 'Binary file. Appwrite SDKs provide helpers to handle file input. [Learn about file input](https://appwrite.io/docs/products/storage/upload-download#input-file).', skipValidation: true) - ->param('permissions', null, new Nullable(new Permissions(APP_LIMIT_ARRAY_PARAMS_SIZE, [Database::PERMISSION_READ, Database::PERMISSION_UPDATE, Database::PERMISSION_DELETE, Database::PERMISSION_WRITE])), 'An array of permission strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).', true) - ->inject('request') - ->inject('response') - ->inject('dbForProject') - ->inject('user') - ->inject('queueForEvents') - ->inject('mode') - ->inject('deviceForFiles') - ->inject('deviceForLocal') - ->inject('authorization') - ->action(function (string $bucketId, string $fileId, mixed $file, ?array $permissions, Request $request, Response $response, Database $dbForProject, Document $user, Event $queueForEvents, string $mode, Device $deviceForFiles, Device $deviceForLocal, Authorization $authorization) { - - $bucket = $authorization->skip(fn () => $dbForProject->getDocument('buckets', $bucketId)); - - $isAPIKey = User::isApp($authorization->getRoles()); - $isPrivilegedUser = User::isPrivileged($authorization->getRoles()); - - if ($bucket->isEmpty() || (!$bucket->getAttribute('enabled') && !$isAPIKey && !$isPrivilegedUser)) { - throw new Exception(Exception::STORAGE_BUCKET_NOT_FOUND); - } - - if (!$authorization->isValid(new Input(Database::PERMISSION_CREATE, $bucket->getCreate()))) { - throw new Exception(Exception::USER_UNAUTHORIZED, $authorization->getDescription()); - } - - $allowedPermissions = [ - Database::PERMISSION_READ, - Database::PERMISSION_UPDATE, - Database::PERMISSION_DELETE, - ]; - - // Map aggregate permissions to into the set of individual permissions they represent. - $permissions = Permission::aggregate($permissions, $allowedPermissions); - - // Add permissions for current the user if none were provided. - if (\is_null($permissions)) { - $permissions = []; - if (!empty($user->getId())) { - foreach ($allowedPermissions as $permission) { - $permissions[] = (new Permission($permission, 'user', $user->getId()))->toString(); - } - } - } - - // Users can only manage their own roles, API keys and Admin users can manage any - $roles = $authorization->getRoles(); - if (!User::isApp($roles) && !User::isPrivileged($roles)) { - foreach (Database::PERMISSIONS as $type) { - foreach ($permissions as $permission) { - $permission = Permission::parse($permission); - if ($permission->getPermission() != $type) { - continue; - } - $role = (new Role( - $permission->getRole(), - $permission->getIdentifier(), - $permission->getDimension() - ))->toString(); - if (!$authorization->hasRole($role)) { - throw new Exception(Exception::USER_UNAUTHORIZED, 'Permissions must be one of: (' . \implode(', ', $roles) . ')'); - } - } - } - } - - $maximumFileSize = $bucket->getAttribute('maximumFileSize', 0); - if ($maximumFileSize > (int) System::getEnv('_APP_STORAGE_LIMIT', 0)) { - throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Maximum bucket file size is larger than _APP_STORAGE_LIMIT'); - } - - - $file = $request->getFiles('file'); - - // GraphQL multipart spec adds files with index keys - if (empty($file)) { - $file = $request->getFiles(0); - } - - if (empty($file)) { - throw new Exception(Exception::STORAGE_FILE_EMPTY); - } - - // Make sure we handle a single file and multiple files the same way - $fileName = (\is_array($file['name']) && isset($file['name'][0])) ? $file['name'][0] : $file['name']; - $fileTmpName = (\is_array($file['tmp_name']) && isset($file['tmp_name'][0])) ? $file['tmp_name'][0] : $file['tmp_name']; - $fileSize = (\is_array($file['size']) && isset($file['size'][0])) ? $file['size'][0] : $file['size']; - - $contentRange = $request->getHeader('content-range'); - $fileId = $fileId === 'unique()' ? ID::unique() : $fileId; - $chunk = 1; - $chunks = 1; - - if (!empty($contentRange)) { - $start = $request->getContentRangeStart(); - $end = $request->getContentRangeEnd(); - $fileSize = $request->getContentRangeSize(); - $fileId = $request->getHeader('x-appwrite-id', $fileId); - // TODO make `end >= $fileSize` in next breaking version - if (is_null($start) || is_null($end) || is_null($fileSize) || $end > $fileSize) { - throw new Exception(Exception::STORAGE_INVALID_CONTENT_RANGE); - } - - $idValidator = new UID(); - if (!$idValidator->isValid($fileId)) { - throw new Exception(Exception::STORAGE_INVALID_APPWRITE_ID); - } - - // TODO remove the condition that checks `$end === $fileSize` in next breaking version - if ($end === $fileSize - 1 || $end === $fileSize) { - //if it's a last chunks the chunk size might differ, so we set the $chunks and $chunk to -1 notify it's last chunk - $chunks = $chunk = -1; - } else { - // Calculate total number of chunks based on the chunk size i.e ($rangeEnd - $rangeStart) - $chunks = (int) ceil($fileSize / ($end + 1 - $start)); - $chunk = (int) ($start / ($end + 1 - $start)) + 1; - } - } - - /** - * Validators - */ - // Check if file type is allowed - $allowedFileExtensions = $bucket->getAttribute('allowedFileExtensions', []); - $fileExt = new FileExt($allowedFileExtensions); - if (!empty($allowedFileExtensions) && !$fileExt->isValid($fileName)) { - throw new Exception(Exception::STORAGE_FILE_TYPE_UNSUPPORTED, 'File extension not allowed'); - } - - // Check if file size is exceeding allowed limit - $fileSizeValidator = new FileSize($maximumFileSize); - if (!$fileSizeValidator->isValid($fileSize)) { - throw new Exception(Exception::STORAGE_INVALID_FILE_SIZE, 'File size not allowed'); - } - - $upload = new Upload(); - if (!$upload->isValid($fileTmpName)) { - throw new Exception(Exception::STORAGE_INVALID_FILE); - } - - // Save to storage - $fileSize ??= $deviceForLocal->getFileSize($fileTmpName); - $path = $deviceForFiles->getPath($fileId . '.' . \pathinfo($fileName, PATHINFO_EXTENSION)); - $path = str_ireplace($deviceForFiles->getRoot(), $deviceForFiles->getRoot() . DIRECTORY_SEPARATOR . $bucket->getId(), $path); // Add bucket id to path after root - - $file = $dbForProject->getDocument('bucket_' . $bucket->getSequence(), $fileId); - - $metadata = ['content_type' => $deviceForLocal->getFileMimeType($fileTmpName)]; - if (!$file->isEmpty()) { - $chunks = $file->getAttribute('chunksTotal', 1); - $uploaded = $file->getAttribute('chunksUploaded', 0); - $metadata = $file->getAttribute('metadata', []); - - if ($chunk === -1) { - $chunk = $chunks; - } - - if ($uploaded === $chunks) { - throw new Exception(Exception::STORAGE_FILE_ALREADY_EXISTS); - } - } - - $chunksUploaded = $deviceForFiles->upload($fileTmpName, $path, $chunk, $chunks, $metadata); - - if (empty($chunksUploaded)) { - throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed uploading file'); - } - - if ($chunksUploaded === $chunks) { - if (System::getEnv('_APP_STORAGE_ANTIVIRUS') === 'enabled' && $bucket->getAttribute('antivirus', true) && $fileSize <= APP_LIMIT_ANTIVIRUS && $deviceForFiles->getType() === Storage::DEVICE_LOCAL) { - $antivirus = new Network( - System::getEnv('_APP_STORAGE_ANTIVIRUS_HOST', 'clamav'), - (int) System::getEnv('_APP_STORAGE_ANTIVIRUS_PORT', 3310) - ); - - if (!$antivirus->fileScan($path)) { - $deviceForFiles->delete($path); - throw new Exception(Exception::STORAGE_INVALID_FILE); - } - } - - $mimeType = $deviceForFiles->getFileMimeType($path); // Get mime-type before compression and encryption - $fileHash = $deviceForFiles->getFileHash($path); // Get file hash before compression and encryption - $data = ''; - // Compression - $algorithm = $bucket->getAttribute('compression', Compression::NONE); - if ($fileSize <= APP_STORAGE_READ_BUFFER && $algorithm != Compression::NONE) { - $data = $deviceForFiles->read($path); - switch ($algorithm) { - case Compression::ZSTD: - $compressor = new Zstd(); - break; - case Compression::GZIP: - default: - $compressor = new GZIP(); - break; - } - $data = $compressor->compress($data); - } else { - // reset the algorithm to none as we do not compress the file - // if file size exceedes the APP_STORAGE_READ_BUFFER - // regardless the bucket compression algoorithm - $algorithm = Compression::NONE; - } - - if ($bucket->getAttribute('encryption', true) && $fileSize <= APP_STORAGE_READ_BUFFER) { - if (empty($data)) { - $data = $deviceForFiles->read($path); - } - $key = System::getEnv('_APP_OPENSSL_KEY_V1'); - $iv = OpenSSL::randomPseudoBytes(OpenSSL::cipherIVLength(OpenSSL::CIPHER_AES_128_GCM)); - $data = OpenSSL::encrypt($data, OpenSSL::CIPHER_AES_128_GCM, $key, 0, $iv, $tag); - } - - if (!empty($data)) { - if (!$deviceForFiles->write($path, $data, $mimeType)) { - throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to save file'); - } - } - - $sizeActual = $deviceForFiles->getFileSize($path); - - $openSSLVersion = null; - $openSSLCipher = null; - $openSSLTag = null; - $openSSLIV = null; - - if ($bucket->getAttribute('encryption', true) && $fileSize <= APP_STORAGE_READ_BUFFER) { - $openSSLVersion = '1'; - $openSSLCipher = OpenSSL::CIPHER_AES_128_GCM; - $openSSLTag = \bin2hex($tag); - $openSSLIV = \bin2hex($iv); - } - - if ($file->isEmpty()) { - $doc = new Document([ - '$id' => $fileId, - '$permissions' => $permissions, - 'bucketId' => $bucket->getId(), - 'bucketInternalId' => $bucket->getSequence(), - 'name' => $fileName, - 'path' => $path, - 'signature' => $fileHash, - 'mimeType' => $mimeType, - 'sizeOriginal' => $fileSize, - 'sizeActual' => $sizeActual, - 'algorithm' => $algorithm, - 'comment' => '', - 'chunksTotal' => $chunks, - 'chunksUploaded' => $chunksUploaded, - 'openSSLVersion' => $openSSLVersion, - 'openSSLCipher' => $openSSLCipher, - 'openSSLTag' => $openSSLTag, - 'openSSLIV' => $openSSLIV, - 'search' => implode(' ', [$fileId, $fileName]), - 'metadata' => $metadata, - ]); - - try { - $file = $dbForProject->createDocument('bucket_' . $bucket->getSequence(), $doc); - } catch (DuplicateException) { - throw new Exception(Exception::STORAGE_FILE_ALREADY_EXISTS); - } catch (NotFoundException) { - throw new Exception(Exception::STORAGE_BUCKET_NOT_FOUND); - } - } else { - $file = $file - ->setAttribute('$permissions', $permissions) - ->setAttribute('signature', $fileHash) - ->setAttribute('mimeType', $mimeType) - ->setAttribute('sizeActual', $sizeActual) - ->setAttribute('algorithm', $algorithm) - ->setAttribute('openSSLVersion', $openSSLVersion) - ->setAttribute('openSSLCipher', $openSSLCipher) - ->setAttribute('openSSLTag', $openSSLTag) - ->setAttribute('openSSLIV', $openSSLIV) - ->setAttribute('metadata', $metadata) - ->setAttribute('chunksUploaded', $chunksUploaded); - - /** - * Validate create permission and skip authorization in updateDocument - * Without this, the file creation will fail when user doesn't have update permission - * However as with chunk upload even if we are updating, we are essentially creating a file - * adding it's new chunk so we validate create permission instead of update - */ - if (!$authorization->isValid(new Input(Database::PERMISSION_CREATE, $bucket->getCreate()))) { - throw new Exception(Exception::USER_UNAUTHORIZED, $authorization->getDescription()); - } - $file = $authorization->skip(fn () => $dbForProject->updateDocument('bucket_' . $bucket->getSequence(), $fileId, $file)); - } - } else { - if ($file->isEmpty()) { - $doc = new Document([ - '$id' => ID::custom($fileId), - '$permissions' => $permissions, - 'bucketId' => $bucket->getId(), - 'bucketInternalId' => $bucket->getSequence(), - 'name' => $fileName, - 'path' => $path, - 'signature' => '', - 'mimeType' => '', - 'sizeOriginal' => $fileSize, - 'sizeActual' => 0, - 'algorithm' => '', - 'comment' => '', - 'chunksTotal' => $chunks, - 'chunksUploaded' => $chunksUploaded, - 'search' => implode(' ', [$fileId, $fileName]), - 'metadata' => $metadata, - ]); - - try { - $file = $dbForProject->createDocument('bucket_' . $bucket->getSequence(), $doc); - } catch (DuplicateException) { - throw new Exception(Exception::STORAGE_FILE_ALREADY_EXISTS); - } catch (NotFoundException) { - throw new Exception(Exception::STORAGE_BUCKET_NOT_FOUND); - } - } else { - $file = $file - ->setAttribute('chunksUploaded', $chunksUploaded) - ->setAttribute('metadata', $metadata); - - /** - * Validate create permission and skip authorization in updateDocument - * Without this, the file creation will fail when user doesn't have update permission - * However as with chunk upload even if we are updating, we are essentially creating a file - * adding it's new chunk so we validate create permission instead of update - */ - if (!$authorization->isValid(new Input(Database::PERMISSION_CREATE, $bucket->getCreate()))) { - throw new Exception(Exception::USER_UNAUTHORIZED, $authorization->getDescription()); - } - - try { - $file = $authorization->skip(fn () => $dbForProject->updateDocument('bucket_' . $bucket->getSequence(), $fileId, $file)); - } catch (NotFoundException) { - throw new Exception(Exception::STORAGE_BUCKET_NOT_FOUND); - } - } - } - - $queueForEvents - ->setParam('bucketId', $bucket->getId()) - ->setParam('fileId', $file->getId()) - ->setContext('bucket', $bucket); - - $metadata = null; // was causing leaks as it was passed by reference - - $response - ->setStatusCode(Response::STATUS_CODE_CREATED) - ->dynamic($file, Response::MODEL_FILE); - }); - -App::get('/v1/storage/buckets/:bucketId/files') - ->alias('/v1/storage/files') - ->desc('List files') - ->groups(['api', 'storage']) - ->label('scope', 'files.read') - ->label('resourceType', RESOURCE_TYPE_BUCKETS) - ->label('sdk', new Method( - namespace: 'storage', - group: 'files', - name: 'listFiles', - description: '/docs/references/storage/list-files.md', - auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_OK, - model: Response::MODEL_FILE_LIST, - ) - ] - )) - ->param('bucketId', '', new UID(), 'Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') - ->param('queries', [], new Files(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long. You may filter on the following attributes: ' . implode(', ', Files::ALLOWED_ATTRIBUTES), true) - ->param('search', '', new Text(256), 'Search term to filter your list results. Max length: 256 chars.', true) - ->param('total', true, new Boolean(true), 'When set to false, the total count returned will be 0 and will not be calculated.', true) - ->inject('response') - ->inject('dbForProject') - ->inject('authorization') - ->inject('mode') - ->action(function (string $bucketId, array $queries, string $search, bool $includeTotal, Response $response, Database $dbForProject, Authorization $authorization, string $mode) { - $bucket = $authorization->skip(fn () => $dbForProject->getDocument('buckets', $bucketId)); - - $isAPIKey = User::isApp($authorization->getRoles()); - $isPrivilegedUser = User::isPrivileged($authorization->getRoles()); - - if ($bucket->isEmpty() || (!$bucket->getAttribute('enabled') && !$isAPIKey && !$isPrivilegedUser)) { - throw new Exception(Exception::STORAGE_BUCKET_NOT_FOUND); - } - - $fileSecurity = $bucket->getAttribute('fileSecurity', false); - $valid = $authorization->isValid(new Input(Database::PERMISSION_READ, $bucket->getRead())); - if (!$fileSecurity && !$valid) { - throw new Exception(Exception::USER_UNAUTHORIZED, $authorization->getDescription()); - } - - $queries = Query::parseQueries($queries); - - if (!empty($search)) { - $queries[] = Query::search('search', $search); - } - - /** - * Get cursor document if there was a cursor query, we use array_filter and reset for reference $cursor to $queries - */ - $cursor = \array_filter($queries, function ($query) { - return \in_array($query->getMethod(), [Query::TYPE_CURSOR_AFTER, Query::TYPE_CURSOR_BEFORE]); - }); - $cursor = reset($cursor); - if ($cursor) { - /** @var Query $cursor */ - - $validator = new Cursor(); - if (!$validator->isValid($cursor)) { - throw new Exception(Exception::GENERAL_QUERY_INVALID, $validator->getDescription()); - } - - $fileId = $cursor->getValue(); - - if ($fileSecurity && !$valid) { - $cursorDocument = $dbForProject->getDocument('bucket_' . $bucket->getSequence(), $fileId); - } else { - $cursorDocument = $authorization->skip(fn () => $dbForProject->getDocument('bucket_' . $bucket->getSequence(), $fileId)); - } - - if ($cursorDocument->isEmpty()) { - throw new Exception(Exception::GENERAL_CURSOR_NOT_FOUND, "File '{$fileId}' for the 'cursor' value not found."); - } - - $cursor->setValue($cursorDocument); - } - - try { - if ($fileSecurity && !$valid) { - $files = $dbForProject->find('bucket_' . $bucket->getSequence(), $queries); - $total = $includeTotal ? $dbForProject->count('bucket_' . $bucket->getSequence(), $queries, APP_LIMIT_COUNT) : 0; - } else { - $files = $authorization->skip(fn () => $dbForProject->find('bucket_' . $bucket->getSequence(), $queries)); - $total = $includeTotal ? $authorization->skip(fn () => $dbForProject->count('bucket_' . $bucket->getSequence(), $queries, APP_LIMIT_COUNT)) : 0; - } - } catch (NotFoundException) { - throw new Exception(Exception::STORAGE_BUCKET_NOT_FOUND); - } catch (OrderException $e) { - throw new Exception(Exception::DATABASE_QUERY_ORDER_NULL, "The order attribute '{$e->getAttribute()}' had a null value. Cursor pagination requires all documents order attribute values are non-null."); - } catch (QueryException $e) { - throw new Exception(Exception::GENERAL_QUERY_INVALID, $e->getMessage()); - } - - $response->dynamic(new Document([ - 'files' => $files, - 'total' => $total, - ]), Response::MODEL_FILE_LIST); - }); - -App::get('/v1/storage/buckets/:bucketId/files/:fileId') - ->alias('/v1/storage/files/:fileId') - ->desc('Get file') - ->groups(['api', 'storage']) - ->label('scope', 'files.read') - ->label('resourceType', RESOURCE_TYPE_BUCKETS) - ->label('sdk', new Method( - namespace: 'storage', - group: 'files', - name: 'getFile', - description: '/docs/references/storage/get-file.md', - auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_OK, - model: Response::MODEL_FILE, - ) - ] - )) - ->param('bucketId', '', new UID(), 'Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') - ->param('fileId', '', new UID(), 'File ID.') - ->inject('response') - ->inject('dbForProject') - ->inject('authorization') - ->inject('mode') - ->action(function (string $bucketId, string $fileId, Response $response, Database $dbForProject, Authorization $authorization, string $mode) { - $bucket = $authorization->skip(fn () => $dbForProject->getDocument('buckets', $bucketId)); - - $isAPIKey = User::isApp($authorization->getRoles()); - $isPrivilegedUser = User::isPrivileged($authorization->getRoles()); - - if ($bucket->isEmpty() || (!$bucket->getAttribute('enabled') && !$isAPIKey && !$isPrivilegedUser)) { - throw new Exception(Exception::STORAGE_BUCKET_NOT_FOUND); - } - - $fileSecurity = $bucket->getAttribute('fileSecurity', false); - $valid = $authorization->isValid(new Input(Database::PERMISSION_READ, $bucket->getRead())); - if (!$fileSecurity && !$valid) { - throw new Exception(Exception::USER_UNAUTHORIZED, $authorization->getDescription()); - } - - if ($fileSecurity && !$valid) { - $file = $dbForProject->getDocument('bucket_' . $bucket->getSequence(), $fileId); - } else { - $file = $authorization->skip(fn () => $dbForProject->getDocument('bucket_' . $bucket->getSequence(), $fileId)); - } - - if ($file->isEmpty()) { - throw new Exception(Exception::STORAGE_FILE_NOT_FOUND); - } - - $response->dynamic($file, Response::MODEL_FILE); - }); - -App::get('/v1/storage/buckets/:bucketId/files/:fileId/preview') - ->alias('/v1/storage/files/:fileId/preview') - ->desc('Get file preview') - ->groups(['api', 'storage']) - ->label('scope', 'files.read') - ->label('resourceType', RESOURCE_TYPE_BUCKETS) - ->label('cache', true) - ->label('cache.resourceType', 'bucket/{request.bucketId}') - ->label('cache.resource', 'file/{request.fileId}') - ->label('sdk', new Method( - namespace: 'storage', - group: 'files', - name: 'getFilePreview', - description: '/docs/references/storage/get-file-preview.md', - auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_OK, - model: Response::MODEL_NONE - ) - ], - type: MethodType::LOCATION, - contentType: ContentType::IMAGE - )) - ->param('bucketId', '', new UID(), 'Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') - ->param('fileId', '', new UID(), 'File ID') - ->param('width', 0, new Range(0, 4000), 'Resize preview image width, Pass an integer between 0 to 4000.', true) - ->param('height', 0, new Range(0, 4000), 'Resize preview image height, Pass an integer between 0 to 4000.', true) - ->param('gravity', Image::GRAVITY_CENTER, new WhiteList(Image::getGravityTypes()), 'Image crop gravity. Can be one of ' . implode(",", Image::getGravityTypes()), true) - ->param('quality', -1, new Range(-1, 100), 'Preview image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.', true) - ->param('borderWidth', 0, new Range(0, 100), 'Preview image border in pixels. Pass an integer between 0 to 100. Defaults to 0.', true) - ->param('borderColor', '', new HexColor(), 'Preview image border color. Use a valid HEX color, no # is needed for prefix.', true) - ->param('borderRadius', 0, new Range(0, 4000), 'Preview image border radius in pixels. Pass an integer between 0 to 4000.', true) - ->param('opacity', 1, new Range(0, 1, Range::TYPE_FLOAT), 'Preview image opacity. Only works with images having an alpha channel (like png). Pass a number between 0 to 1.', true) - ->param('rotation', 0, new Range(-360, 360), 'Preview image rotation in degrees. Pass an integer between -360 and 360.', true) - ->param('background', '', new HexColor(), 'Preview image background color. Only works with transparent images (png). Use a valid HEX color, no # is needed for prefix.', true) - ->param('output', '', new WhiteList(\array_keys(Config::getParam('storage-outputs')), true), 'Output format type (jpeg, jpg, png, gif and webp).', true) - // NOTE: this is only for the sdk generator and is not used in the action below and is utilised in `resources.php` for `resourceToken`. - ->param('token', '', new Text(512), 'File token for accessing this file.', true) - ->inject('request') - ->inject('response') - ->inject('dbForProject') - ->inject('resourceToken') - ->inject('deviceForFiles') - ->inject('deviceForLocal') - ->inject('project') - ->inject('authorization') - ->action(function (string $bucketId, string $fileId, int $width, int $height, string $gravity, int $quality, int $borderWidth, string $borderColor, int $borderRadius, float $opacity, int $rotation, string $background, string $output, ?string $token, Request $request, Response $response, Database $dbForProject, Document $resourceToken, Device $deviceForFiles, Device $deviceForLocal, Document $project, Authorization $authorization) { - - if (!\extension_loaded('imagick')) { - throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Imagick extension is missing'); - } - - /* @type Document $bucket */ - $bucket = $authorization->skip(fn () => $dbForProject->getDocument('buckets', $bucketId)); - - $isAPIKey = User::isApp($authorization->getRoles()); - $isPrivilegedUser = User::isPrivileged($authorization->getRoles()); - - if ($bucket->isEmpty() || (!$bucket->getAttribute('enabled') && !$isAPIKey && !$isPrivilegedUser)) { - throw new Exception(Exception::STORAGE_BUCKET_NOT_FOUND); - } - - if (!$bucket->getAttribute('transformations', true) && !$isAPIKey && !$isPrivilegedUser) { - throw new Exception(Exception::STORAGE_BUCKET_TRANSFORMATIONS_DISABLED); - } - - $isToken = !$resourceToken->isEmpty() && $resourceToken->getAttribute('bucketInternalId') === $bucket->getSequence(); - $fileSecurity = $bucket->getAttribute('fileSecurity', false); - $valid = $authorization->isValid(new Input(Database::PERMISSION_READ, $bucket->getRead())); - if (!$fileSecurity && !$valid && !$isToken) { - throw new Exception(Exception::USER_UNAUTHORIZED, $authorization->getDescription()); - } - - if ($fileSecurity && !$valid && !$isToken) { - $file = $dbForProject->getDocument('bucket_' . $bucket->getSequence(), $fileId); - } else { - /* @type Document $file */ - $file = $authorization->skip(fn () => $dbForProject->getDocument('bucket_' . $bucket->getSequence(), $fileId)); - } - - if (!$resourceToken->isEmpty() && $resourceToken->getAttribute('fileInternalId') !== $file->getSequence()) { - throw new Exception(Exception::USER_UNAUTHORIZED); - } - - if ($file->isEmpty()) { - throw new Exception(Exception::STORAGE_FILE_NOT_FOUND); - } - - $inputs = Config::getParam('storage-inputs'); - $outputs = Config::getParam('storage-outputs'); - $fileLogos = Config::getParam('storage-logos'); - - $path = $file->getAttribute('path'); - $type = \strtolower(\pathinfo($path, PATHINFO_EXTENSION)); - $algorithm = $file->getAttribute('algorithm', Compression::NONE); - $cipher = $file->getAttribute('openSSLCipher'); - $mime = $file->getAttribute('mimeType'); - if (!\in_array($mime, $inputs) || $file->getAttribute('sizeActual') > (int) System::getEnv('_APP_STORAGE_PREVIEW_LIMIT', APP_STORAGE_READ_BUFFER)) { - if (!\in_array($mime, $inputs)) { - $path = (\array_key_exists($mime, $fileLogos)) ? $fileLogos[$mime] : $fileLogos['default']; - } else { - // it was an image but the file size exceeded the limit - $path = $fileLogos['default_image']; - } - - $algorithm = Compression::NONE; - $cipher = null; - $background = (empty($background)) ? 'eceff1' : $background; - $type = \strtolower(\pathinfo($path, PATHINFO_EXTENSION)); - $deviceForFiles = $deviceForLocal; - } - - if (!$deviceForFiles->exists($path)) { - throw new Exception(Exception::STORAGE_FILE_NOT_FOUND); - } - - if (empty($output)) { - // when file extension is provided but it's not one of our - // supported outputs we fallback to `jpg` - if (!empty($type) && !array_key_exists($type, $outputs)) { - $type = 'jpg'; - } - - // when file extension is not provided and the mime type is not one of our supported outputs - // we fallback to `jpg` output format - $output = empty($type) ? (array_search($mime, $outputs) ?? 'jpg') : $type; - } - - $startTime = \microtime(true); - - $source = $deviceForFiles->read($path); - - $downloadTime = \microtime(true) - $startTime; - - if (!empty($cipher)) { // Decrypt - $source = OpenSSL::decrypt( - $source, - $file->getAttribute('openSSLCipher'), - System::getEnv('_APP_OPENSSL_KEY_V' . $file->getAttribute('openSSLVersion')), - 0, - \hex2bin($file->getAttribute('openSSLIV')), - \hex2bin($file->getAttribute('openSSLTag')) - ); - } - - $decryptionTime = \microtime(true) - $startTime - $downloadTime; - - switch ($algorithm) { - case Compression::ZSTD: - $compressor = new Zstd(); - $source = $compressor->decompress($source); - break; - case Compression::GZIP: - $compressor = new GZIP(); - $source = $compressor->decompress($source); - break; - } - - $decompressionTime = \microtime(true) - $startTime - $downloadTime - $decryptionTime; - - try { - $image = new Image($source); - } catch (ImagickException $e) { - throw new Exception(Exception::STORAGE_FILE_TYPE_UNSUPPORTED, $e->getMessage()); - } - - $image->crop((int) $width, (int) $height, $gravity); - - if (!empty($opacity) || $opacity === 0) { - $image->setOpacity($opacity); - } - - if (!empty($background)) { - $image->setBackground('#' . $background); - } - - if (!empty($borderWidth)) { - $image->setBorder($borderWidth, '#' . $borderColor); - } - - if (!empty($borderRadius)) { - $image->setBorderRadius($borderRadius); - } - - if (!empty($rotation)) { - $image->setRotation(($rotation + 360) % 360); - } - - $data = $image->output($output, $quality); - - $renderingTime = \microtime(true) - $startTime - $downloadTime - $decryptionTime - $decompressionTime; - - $totalTime = \microtime(true) - $startTime; - - Console::info("File preview rendered,project=" . $project->getId() . ",bucket=" . $bucketId . ",file=" . $file->getId() . ",uri=" . $request->getURI() . ",total=" . $totalTime . ",rendering=" . $renderingTime . ",decryption=" . $decryptionTime . ",decompression=" . $decompressionTime . ",download=" . $downloadTime); - - $contentType = (\array_key_exists($output, $outputs)) ? $outputs[$output] : $outputs['jpg']; - - //Do not update transformedAt if it's a console user - if (!User::isPrivileged($authorization->getRoles())) { - $transformedAt = $file->getAttribute('transformedAt', ''); - if (DateTime::formatTz(DateTime::addSeconds(new \DateTime(), -APP_PROJECT_ACCESS)) > $transformedAt) { - $file->setAttribute('transformedAt', DateTime::now()); - $authorization->skip(fn () => $dbForProject->updateDocument('bucket_' . $file->getAttribute('bucketInternalId'), $file->getId(), $file)); - } - } - - $response - ->addHeader('Cache-Control', 'private, max-age=2592000') // 30 days - ->setContentType($contentType) - ->file($data); - - unset($image); - }); - -App::get('/v1/storage/buckets/:bucketId/files/:fileId/download') - ->alias('/v1/storage/files/:fileId/download') - ->desc('Get file for download') - ->groups(['api', 'storage']) - ->label('scope', 'files.read') - ->label('resourceType', RESOURCE_TYPE_BUCKETS) - ->label('sdk', new Method( - namespace: 'storage', - group: 'files', - name: 'getFileDownload', - description: '/docs/references/storage/get-file-download.md', - auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_OK, - model: Response::MODEL_NONE - ) - ], - type: MethodType::LOCATION, - contentType: ContentType::ANY, - )) - ->param('bucketId', '', new UID(), 'Storage bucket ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') - ->param('fileId', '', new UID(), 'File ID.') - // NOTE: this is only for the sdk generator and is not used in the action below and is utilised in `resources.php` for `resourceToken`. - ->param('token', '', new Text(512), 'File token for accessing this file.', true) - ->inject('request') - ->inject('response') - ->inject('dbForProject') - ->inject('authorization') - ->inject('mode') - ->inject('resourceToken') - ->inject('deviceForFiles') - ->action(function (string $bucketId, string $fileId, ?string $token, Request $request, Response $response, Database $dbForProject, Authorization $authorization, string $mode, Document $resourceToken, Device $deviceForFiles) { - /* @type Document $bucket */ - $bucket = $authorization->skip(fn () => $dbForProject->getDocument('buckets', $bucketId)); - - $isAPIKey = User::isApp($authorization->getRoles()); - $isPrivilegedUser = User::isPrivileged($authorization->getRoles()); - - if ($bucket->isEmpty() || (!$bucket->getAttribute('enabled') && !$isAPIKey && !$isPrivilegedUser)) { - throw new Exception(Exception::STORAGE_BUCKET_NOT_FOUND); - } - - $isToken = !$resourceToken->isEmpty() && $resourceToken->getAttribute('bucketInternalId') === $bucket->getSequence(); - $fileSecurity = $bucket->getAttribute('fileSecurity', false); - $valid = $authorization->isValid(new Input(Database::PERMISSION_READ, $bucket->getRead())); - if (!$fileSecurity && !$valid && !$isToken) { - throw new Exception(Exception::USER_UNAUTHORIZED, $authorization->getDescription()); - } - - if ($fileSecurity && !$valid && !$isToken) { - $file = $dbForProject->getDocument('bucket_' . $bucket->getSequence(), $fileId); - } else { - /* @type Document $file */ - $file = $authorization->skip(fn () => $dbForProject->getDocument('bucket_' . $bucket->getSequence(), $fileId)); - } - - if (!$resourceToken->isEmpty() && $resourceToken->getAttribute('fileInternalId') !== $file->getSequence()) { - throw new Exception(Exception::USER_UNAUTHORIZED, $authorization->getDescription()); - } - - if ($file->isEmpty()) { - throw new Exception(Exception::STORAGE_FILE_NOT_FOUND); - } - - $path = $file->getAttribute('path', ''); - - if (!$deviceForFiles->exists($path)) { - throw new Exception(Exception::STORAGE_FILE_NOT_FOUND, 'File not found in ' . $path); - } - - $size = $file->getAttribute('sizeOriginal', 0); - - $rangeHeader = $request->getHeader('range'); - if (!empty($rangeHeader)) { - $start = $request->getRangeStart(); - $end = $request->getRangeEnd(); - $unit = $request->getRangeUnit(); - - if ($end === null || $end - $start > APP_STORAGE_READ_BUFFER) { - $end = min(($start + MAX_OUTPUT_CHUNK_SIZE - 1), ($size - 1)); - } - - if ($unit !== 'bytes' || $start >= $end || $end >= $size) { - throw new Exception(Exception::STORAGE_INVALID_RANGE); - } - - $response - ->addHeader('Accept-Ranges', 'bytes') - ->addHeader('Content-Range', 'bytes ' . $start . '-' . $end . '/' . $size) - ->addHeader('Content-Length', $end - $start + 1) - ->setStatusCode(Response::STATUS_CODE_PARTIALCONTENT); - } - - $response - ->setContentType($file->getAttribute('mimeType')) - ->addHeader('Cache-Control', 'private, max-age=3888000') // 45 days - ->addHeader('X-Peak', \memory_get_peak_usage()) - ->addHeader('Content-Disposition', 'attachment; filename="' . $file->getAttribute('name', '') . '"') - ; - - $source = ''; - if (!empty($file->getAttribute('openSSLCipher'))) { // Decrypt - $source = $deviceForFiles->read($path); - $source = OpenSSL::decrypt( - $source, - $file->getAttribute('openSSLCipher'), - System::getEnv('_APP_OPENSSL_KEY_V' . $file->getAttribute('openSSLVersion')), - 0, - \hex2bin($file->getAttribute('openSSLIV')), - \hex2bin($file->getAttribute('openSSLTag')) - ); - } - - switch ($file->getAttribute('algorithm', Compression::NONE)) { - case Compression::ZSTD: - if (empty($source)) { - $source = $deviceForFiles->read($path); - } - $compressor = new Zstd(); - $source = $compressor->decompress($source); - break; - case Compression::GZIP: - if (empty($source)) { - $source = $deviceForFiles->read($path); - } - $compressor = new GZIP(); - $source = $compressor->decompress($source); - break; - } - - if (!empty($source)) { - if (!empty($rangeHeader)) { - $response->send(substr($source, $start, ($end - $start + 1))); - return; - } - $response->send($source); - return; - } - - if (!empty($rangeHeader)) { - $response->send($deviceForFiles->read($path, $start, ($end - $start + 1))); - return; - } - - if ($size > APP_STORAGE_READ_BUFFER) { - for ($i = 0; $i < ceil($size / MAX_OUTPUT_CHUNK_SIZE); $i++) { - $response->chunk( - $deviceForFiles->read( - $path, - ($i * MAX_OUTPUT_CHUNK_SIZE), - min(MAX_OUTPUT_CHUNK_SIZE, $size - ($i * MAX_OUTPUT_CHUNK_SIZE)) - ), - (($i + 1) * MAX_OUTPUT_CHUNK_SIZE) >= $size - ); - } - } else { - $response->send($deviceForFiles->read($path)); - } - }); - -App::get('/v1/storage/buckets/:bucketId/files/:fileId/view') - ->alias('/v1/storage/files/:fileId/view') - ->desc('Get file for view') - ->groups(['api', 'storage']) - ->label('scope', 'files.read') - ->label('resourceType', RESOURCE_TYPE_BUCKETS) - ->label('sdk', new Method( - namespace: 'storage', - group: 'files', - name: 'getFileView', - description: '/docs/references/storage/get-file-view.md', - auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_OK, - model: Response::MODEL_NONE, - ) - ], - type: MethodType::LOCATION, - contentType: ContentType::ANY, - )) - ->param('bucketId', '', new UID(), 'Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') - ->param('fileId', '', new UID(), 'File ID.') - // NOTE: this is only for the sdk generator and is not used in the action below and is utilised in `resources.php` for `resourceToken`. - ->param('token', '', new Text(512), 'File token for accessing this file.', true) - ->inject('response') - ->inject('request') - ->inject('dbForProject') - ->inject('mode') - ->inject('resourceToken') - ->inject('deviceForFiles') - ->inject('authorization') - ->action(function (string $bucketId, string $fileId, ?string $token, Response $response, Request $request, Database $dbForProject, string $mode, Document $resourceToken, Device $deviceForFiles, Authorization $authorization) { - /* @type Document $bucket */ - $bucket = $authorization->skip(fn () => $dbForProject->getDocument('buckets', $bucketId)); - - $isAPIKey = User::isApp($authorization->getRoles()); - $isPrivilegedUser = User::isPrivileged($authorization->getRoles()); - - if ($bucket->isEmpty() || (!$bucket->getAttribute('enabled') && !$isAPIKey && !$isPrivilegedUser)) { - throw new Exception(Exception::STORAGE_BUCKET_NOT_FOUND); - } - - $isToken = !$resourceToken->isEmpty() && $resourceToken->getAttribute('bucketInternalId') === $bucket->getSequence(); - $fileSecurity = $bucket->getAttribute('fileSecurity', false); - $valid = $authorization->isValid(new Input(Database::PERMISSION_READ, $bucket->getRead())); - if (!$fileSecurity && !$valid && !$isToken) { - throw new Exception(Exception::USER_UNAUTHORIZED, $authorization->getDescription()); - } - - if ($fileSecurity && !$valid && !$isToken) { - $file = $dbForProject->getDocument('bucket_' . $bucket->getSequence(), $fileId); - } else { - /* @type Document $file */ - $file = $authorization->skip(fn () => $dbForProject->getDocument('bucket_' . $bucket->getSequence(), $fileId)); - } - - if (!$resourceToken->isEmpty() && $resourceToken->getAttribute('fileInternalId') !== $file->getSequence()) { - throw new Exception(Exception::USER_UNAUTHORIZED, $authorization->getDescription()); - } - - if ($file->isEmpty()) { - throw new Exception(Exception::STORAGE_FILE_NOT_FOUND); - } - - $mimes = Config::getParam('storage-mimes'); - - $path = $file->getAttribute('path', ''); - - if (!$deviceForFiles->exists($path)) { - throw new Exception(Exception::STORAGE_FILE_NOT_FOUND, 'File not found in ' . $path); - } - - $contentType = 'text/plain'; - - if (\in_array($file->getAttribute('mimeType'), $mimes)) { - $contentType = $file->getAttribute('mimeType'); - } - - $size = $file->getAttribute('sizeOriginal', 0); - - $rangeHeader = $request->getHeader('range'); - if (!empty($rangeHeader)) { - $start = $request->getRangeStart(); - $end = $request->getRangeEnd(); - $unit = $request->getRangeUnit(); - - if ($end === null || $end - $start > APP_STORAGE_READ_BUFFER) { - $end = min(($start + APP_STORAGE_READ_BUFFER - 1), ($size - 1)); - } - - if ($unit != 'bytes' || $start >= $end || $end >= $size) { - throw new Exception(Exception::STORAGE_INVALID_RANGE); - } - - $response - ->addHeader('Accept-Ranges', 'bytes') - ->addHeader('Content-Range', "bytes $start-$end/$size") - ->addHeader('Content-Length', $end - $start + 1) - ->setStatusCode(Response::STATUS_CODE_PARTIALCONTENT); - } - - $response - ->setContentType($contentType) - ->addHeader('Content-Security-Policy', 'script-src none;') - ->addHeader('X-Content-Type-Options', 'nosniff') - ->addHeader('Content-Disposition', 'inline; filename="' . $file->getAttribute('name', '') . '"') - ->addHeader('Cache-Control', 'private, max-age=3888000') // 45 days - ->addHeader('X-Peak', \memory_get_peak_usage()) - ; - - $source = ''; - if (!empty($file->getAttribute('openSSLCipher'))) { // Decrypt - $source = $deviceForFiles->read($path); - $source = OpenSSL::decrypt( - $source, - $file->getAttribute('openSSLCipher'), - System::getEnv('_APP_OPENSSL_KEY_V' . $file->getAttribute('openSSLVersion')), - 0, - \hex2bin($file->getAttribute('openSSLIV')), - \hex2bin($file->getAttribute('openSSLTag')) - ); - } - - switch ($file->getAttribute('algorithm', Compression::NONE)) { - case Compression::ZSTD: - if (empty($source)) { - $source = $deviceForFiles->read($path); - } - $compressor = new Zstd(); - $source = $compressor->decompress($source); - break; - case Compression::GZIP: - if (empty($source)) { - $source = $deviceForFiles->read($path); - } - $compressor = new GZIP(); - $source = $compressor->decompress($source); - break; - } - - if (!empty($source)) { - if (!empty($rangeHeader)) { - $response->send(substr($source, $start, ($end - $start + 1))); - return; - } - $response->send($source); - return; - } - - if (!empty($rangeHeader)) { - $response->send($deviceForFiles->read($path, $start, ($end - $start + 1))); - return; - } - - $size = $deviceForFiles->getFileSize($path); - if ($size > APP_STORAGE_READ_BUFFER) { - for ($i = 0; $i < ceil($size / MAX_OUTPUT_CHUNK_SIZE); $i++) { - $response->chunk( - $deviceForFiles->read( - $path, - ($i * MAX_OUTPUT_CHUNK_SIZE), - min(MAX_OUTPUT_CHUNK_SIZE, $size - ($i * MAX_OUTPUT_CHUNK_SIZE)) - ), - (($i + 1) * MAX_OUTPUT_CHUNK_SIZE) >= $size - ); - } - } else { - $response->send($deviceForFiles->read($path)); - } - }); - -App::get('/v1/storage/buckets/:bucketId/files/:fileId/push') - ->desc('Get file for push notification') - ->groups(['api', 'storage']) - ->label('scope', 'public') - ->label('resourceType', RESOURCE_TYPE_BUCKETS) - ->param('bucketId', '', new UID(), 'Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') - ->param('fileId', '', new UID(), 'File ID.') - ->param('jwt', '', new Text(2048, 0), 'JSON Web Token to validate', true) - ->inject('response') - ->inject('request') - ->inject('dbForProject') - ->inject('dbForPlatform') - ->inject('project') - ->inject('mode') - ->inject('deviceForFiles') - ->inject('authorization') - ->action(function (string $bucketId, string $fileId, string $jwt, Response $response, Request $request, Database $dbForProject, Database $dbForPlatform, Document $project, string $mode, Device $deviceForFiles, Authorization $authorization) { - $decoder = new JWT(System::getEnv('_APP_OPENSSL_KEY_V1'), 'HS256', 3600, 0); - - try { - $decoded = $decoder->decode($jwt); - } catch (JWTException) { - throw new Exception(Exception::USER_UNAUTHORIZED); - } - - if ( - $decoded['projectId'] !== $project->getId() || - $decoded['bucketId'] !== $bucketId || - $decoded['fileId'] !== $fileId - ) { - throw new Exception(Exception::USER_UNAUTHORIZED); - } - - $isInternal = $decoded['internal'] ?? false; - $disposition = $decoded['disposition'] ?? 'inline'; - $dbForProject = $isInternal ? $dbForPlatform : $dbForProject; - - $isAPIKey = User::isApp($authorization->getRoles()); - $isPrivilegedUser = User::isPrivileged($authorization->getRoles()); - - $bucket = $authorization->skip(fn () => $dbForProject->getDocument('buckets', $bucketId)); - if ($bucket->isEmpty() || (!$bucket->getAttribute('enabled') && !$isAPIKey && !$isPrivilegedUser)) { - throw new Exception(Exception::STORAGE_BUCKET_NOT_FOUND); - } - - $file = $authorization->skip(fn () => $dbForProject->getDocument('bucket_' . $bucket->getSequence(), $fileId)); - if ($file->isEmpty()) { - throw new Exception(Exception::STORAGE_FILE_NOT_FOUND); - } - - $mimes = Config::getParam('storage-mimes'); - - $path = $file->getAttribute('path', ''); - if (!$deviceForFiles->exists($path)) { - throw new Exception(Exception::STORAGE_FILE_NOT_FOUND, 'File not found in ' . $path); - } - - $contentType = 'text/plain'; - - if (\in_array($file->getAttribute('mimeType'), $mimes)) { - $contentType = $file->getAttribute('mimeType'); - } - - $size = $file->getAttribute('sizeOriginal', 0); - - $rangeHeader = $request->getHeader('range'); - if (!empty($rangeHeader)) { - $start = $request->getRangeStart(); - $end = $request->getRangeEnd(); - $unit = $request->getRangeUnit(); - - if ($end === null || $end - $start > APP_STORAGE_READ_BUFFER) { - $end = min(($start + APP_STORAGE_READ_BUFFER - 1), ($size - 1)); - } - - if ($unit != 'bytes' || $start >= $end || $end >= $size) { - throw new Exception(Exception::STORAGE_INVALID_RANGE); - } - - $response - ->addHeader('Accept-Ranges', 'bytes') - ->addHeader('Content-Range', "bytes $start-$end/$size") - ->addHeader('Content-Length', $end - $start + 1) - ->setStatusCode(Response::STATUS_CODE_PARTIALCONTENT); - } - - $response - ->setContentType($contentType) - ->addHeader('Content-Security-Policy', 'script-src none;') - ->addHeader('X-Content-Type-Options', 'nosniff') - ->addHeader('Content-Disposition', $disposition . '; filename="' . $file->getAttribute('name', '') . '"') - ->addHeader('Cache-Control', 'private, max-age=3888000') // 45 days - ->addHeader('X-Peak', \memory_get_peak_usage()); - - $source = ''; - if (!empty($file->getAttribute('openSSLCipher'))) { // Decrypt - $source = $deviceForFiles->read($path); - $source = OpenSSL::decrypt( - $source, - $file->getAttribute('openSSLCipher'), - System::getEnv('_APP_OPENSSL_KEY_V' . $file->getAttribute('openSSLVersion')), - 0, - \hex2bin($file->getAttribute('openSSLIV')), - \hex2bin($file->getAttribute('openSSLTag')) - ); - } - - switch ($file->getAttribute('algorithm', Compression::NONE)) { - case Compression::ZSTD: - if (empty($source)) { - $source = $deviceForFiles->read($path); - } - $compressor = new Zstd(); - $source = $compressor->decompress($source); - break; - case Compression::GZIP: - if (empty($source)) { - $source = $deviceForFiles->read($path); - } - $compressor = new GZIP(); - $source = $compressor->decompress($source); - break; - } - - if (!empty($source)) { - if (!empty($rangeHeader)) { - $response->send(substr($source, $start, ($end - $start + 1))); - return; - } - $response->send($source); - return; - } - - if (!empty($rangeHeader)) { - $response->send($deviceForFiles->read($path, $start, ($end - $start + 1))); - return; - } - - $size = $deviceForFiles->getFileSize($path); - if ($size > APP_STORAGE_READ_BUFFER) { - for ($i = 0; $i < ceil($size / MAX_OUTPUT_CHUNK_SIZE); $i++) { - $response->chunk( - $deviceForFiles->read( - $path, - ($i * MAX_OUTPUT_CHUNK_SIZE), - min(MAX_OUTPUT_CHUNK_SIZE, $size - ($i * MAX_OUTPUT_CHUNK_SIZE)) - ), - (($i + 1) * MAX_OUTPUT_CHUNK_SIZE) >= $size - ); - } - } else { - $response->send($deviceForFiles->read($path)); - } - }); - -App::put('/v1/storage/buckets/:bucketId/files/:fileId') - ->alias('/v1/storage/files/:fileId') - ->desc('Update file') - ->groups(['api', 'storage']) - ->label('scope', 'files.write') - ->label('resourceType', RESOURCE_TYPE_BUCKETS) - ->label('event', 'buckets.[bucketId].files.[fileId].update') - ->label('audits.event', 'file.update') - ->label('audits.resource', 'file/{response.$id}') - ->label('abuse-key', 'ip:{ip},method:{method},url:{url},userId:{userId}') - ->label('abuse-limit', APP_LIMIT_WRITE_RATE_DEFAULT) - ->label('abuse-time', APP_LIMIT_WRITE_RATE_PERIOD_DEFAULT) - ->label('sdk', new Method( - namespace: 'storage', - group: 'files', - name: 'updateFile', - description: '/docs/references/storage/update-file.md', - auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_OK, - model: Response::MODEL_FILE, - ) - ] - )) - ->param('bucketId', '', new UID(), 'Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') - ->param('fileId', '', new UID(), 'File unique ID.') - ->param('name', null, new Nullable(new Text(255)), 'Name of the file', true) - ->param('permissions', null, new Nullable(new Permissions(APP_LIMIT_ARRAY_PARAMS_SIZE, [Database::PERMISSION_READ, Database::PERMISSION_UPDATE, Database::PERMISSION_DELETE, Database::PERMISSION_WRITE])), 'An array of permission string. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).', true) - ->inject('response') - ->inject('dbForProject') - ->inject('user') - ->inject('mode') - ->inject('queueForEvents') - ->inject('authorization') - ->action(function (string $bucketId, string $fileId, ?string $name, ?array $permissions, Response $response, Database $dbForProject, Document $user, string $mode, Event $queueForEvents, Authorization $authorization) { - - $bucket = $authorization->skip(fn () => $dbForProject->getDocument('buckets', $bucketId)); - - $isAPIKey = User::isApp($authorization->getRoles()); - $isPrivilegedUser = User::isPrivileged($authorization->getRoles()); - - if ($bucket->isEmpty() || (!$bucket->getAttribute('enabled') && !$isAPIKey && !$isPrivilegedUser)) { - throw new Exception(Exception::STORAGE_BUCKET_NOT_FOUND); - } - - $fileSecurity = $bucket->getAttribute('fileSecurity', false); - $valid = $authorization->isValid(new Input(Database::PERMISSION_UPDATE, $bucket->getUpdate())); - if (!$fileSecurity && !$valid) { - throw new Exception(Exception::USER_UNAUTHORIZED, $authorization->getDescription()); - } - - // Read permission should not be required for update - $file = $authorization->skip(fn () => $dbForProject->getDocument('bucket_' . $bucket->getSequence(), $fileId)); - - if ($file->isEmpty()) { - throw new Exception(Exception::STORAGE_FILE_NOT_FOUND); - } - - // Map aggregate permissions into the multiple permissions they represent. - $permissions = Permission::aggregate($permissions, [ - Database::PERMISSION_READ, - Database::PERMISSION_UPDATE, - Database::PERMISSION_DELETE, - ]); - - // Users can only manage their own roles, API keys and Admin users can manage any - $roles = $authorization->getRoles(); - if (!User::isApp($roles) && !User::isPrivileged($roles) && !\is_null($permissions)) { - foreach (Database::PERMISSIONS as $type) { - foreach ($permissions as $permission) { - $permission = Permission::parse($permission); - if ($permission->getPermission() != $type) { - continue; - } - $role = (new Role( - $permission->getRole(), - $permission->getIdentifier(), - $permission->getDimension() - ))->toString(); - if (!$authorization->hasRole($role)) { - throw new Exception(Exception::USER_UNAUTHORIZED, 'Permissions must be one of: (' . \implode(', ', $roles) . ')'); - } - } - } - } - - if (\is_null($permissions)) { - $permissions = $file->getPermissions() ?? []; - } - - $file->setAttribute('$permissions', $permissions); - - if (!is_null($name)) { - $file->setAttribute('name', $name); - } - - try { - if ($fileSecurity && !$valid) { - $file = $dbForProject->updateDocument('bucket_' . $bucket->getSequence(), $fileId, $file); - } else { - $file = $authorization->skip(fn () => $dbForProject->updateDocument('bucket_' . $bucket->getSequence(), $fileId, $file)); - } - } catch (NotFoundException) { - throw new Exception(Exception::STORAGE_BUCKET_NOT_FOUND); - } - - $queueForEvents - ->setParam('bucketId', $bucket->getId()) - ->setParam('fileId', $file->getId()) - ->setContext('bucket', $bucket) - ; - - $response->dynamic($file, Response::MODEL_FILE); - }); - -App::delete('/v1/storage/buckets/:bucketId/files/:fileId') - ->desc('Delete file') - ->groups(['api', 'storage']) - ->label('scope', 'files.write') - ->label('resourceType', RESOURCE_TYPE_BUCKETS) - ->label('event', 'buckets.[bucketId].files.[fileId].delete') - ->label('audits.event', 'file.delete') - ->label('audits.resource', 'file/{request.fileId}') - ->label('abuse-key', 'ip:{ip},method:{method},url:{url},userId:{userId}') - ->label('abuse-limit', APP_LIMIT_WRITE_RATE_DEFAULT) - ->label('abuse-time', APP_LIMIT_WRITE_RATE_PERIOD_DEFAULT) - ->label('sdk', new Method( - namespace: 'storage', - group: 'files', - name: 'deleteFile', - description: '/docs/references/storage/delete-file.md', - auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_NOCONTENT, - model: Response::MODEL_NONE, - ) - ], - contentType: ContentType::NONE - )) - ->param('bucketId', '', new UID(), 'Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') - ->param('fileId', '', new UID(), 'File ID.') - ->inject('response') - ->inject('dbForProject') - ->inject('queueForEvents') - ->inject('mode') - ->inject('deviceForFiles') - ->inject('queueForDeletes') - ->inject('authorization') - ->action(function (string $bucketId, string $fileId, Response $response, Database $dbForProject, Event $queueForEvents, string $mode, Device $deviceForFiles, Delete $queueForDeletes, Authorization $authorization) { - $bucket = $authorization->skip(fn () => $dbForProject->getDocument('buckets', $bucketId)); - - $isAPIKey = User::isApp($authorization->getRoles()); - $isPrivilegedUser = User::isPrivileged($authorization->getRoles()); - - if ($bucket->isEmpty() || (!$bucket->getAttribute('enabled') && !$isAPIKey && !$isPrivilegedUser)) { - throw new Exception(Exception::STORAGE_BUCKET_NOT_FOUND); - } - - $fileSecurity = $bucket->getAttribute('fileSecurity', false); - $valid = $authorization->isValid(new Input(Database::PERMISSION_DELETE, $bucket->getDelete())); - if (!$fileSecurity && !$valid) { - throw new Exception(Exception::USER_UNAUTHORIZED, $authorization->getDescription()); - } - - // Read permission should not be required for delete - $file = $authorization->skip(fn () => $dbForProject->getDocument('bucket_' . $bucket->getSequence(), $fileId)); - - if ($file->isEmpty()) { - throw new Exception(Exception::STORAGE_FILE_NOT_FOUND); - } - - // Make sure we don't delete the file before the document permission check occurs - $validFile = $authorization->isValid(new Input(Database::PERMISSION_DELETE, $file->getDelete())); - if ($fileSecurity && !$valid && !$validFile) { - throw new Exception(Exception::USER_UNAUTHORIZED, $authorization->getDescription()); - } - - $deviceDeleted = false; - if ($file->getAttribute('chunksTotal') !== $file->getAttribute('chunksUploaded')) { - $deviceDeleted = $deviceForFiles->abort( - $file->getAttribute('path'), - ($file->getAttribute('metadata', [])['uploadId'] ?? '') - ); - } else { - $deviceDeleted = $deviceForFiles->delete($file->getAttribute('path')); - } - - if ($deviceDeleted) { - $queueForDeletes - ->setType(DELETE_TYPE_CACHE_BY_RESOURCE) - ->setResourceType('bucket/' . $bucket->getId()) - ->setResource('file/' . $fileId) - ; - - try { - if ($fileSecurity && !$valid) { - $deleted = $dbForProject->deleteDocument('bucket_' . $bucket->getSequence(), $fileId); - } else { - $deleted = $authorization->skip(fn () => $dbForProject->deleteDocument('bucket_' . $bucket->getSequence(), $fileId)); - } - } catch (NotFoundException) { - throw new Exception(Exception::STORAGE_BUCKET_NOT_FOUND); - } - - if (!$deleted) { - throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to remove file from DB'); - } - } else { - throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to delete file from device'); - } - - $queueForEvents - ->setParam('bucketId', $bucket->getId()) - ->setParam('fileId', $file->getId()) - ->setContext('bucket', $bucket) - ->setPayload($response->output($file, Response::MODEL_FILE)) - ; - - $response->noContent(); - }); - -/** Storage usage */ -App::get('/v1/storage/usage') - ->desc('Get storage usage stats') - ->groups(['api', 'storage']) - ->label('scope', 'files.read') - ->label('resourceType', RESOURCE_TYPE_BUCKETS) - ->label('sdk', new Method( - namespace: 'storage', - group: null, - name: 'getUsage', - description: '/docs/references/storage/get-usage.md', - auth: [AuthType::ADMIN], - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_OK, - model: Response::MODEL_USAGE_STORAGE, - ) - ] - )) - ->param('range', '30d', new WhiteList(['24h', '30d', '90d'], true), 'Date range.', true) - ->inject('response') - ->inject('dbForProject') - ->inject('authorization') - ->action(function (string $range, Response $response, Database $dbForProject, Authorization $authorization) { - - $periods = Config::getParam('usage', []); - $stats = $usage = []; - $days = $periods[$range]; - $metrics = [ - METRIC_BUCKETS, - METRIC_FILES, - METRIC_FILES_STORAGE, - ]; - - $total = []; - $authorization->skip(function () use ($dbForProject, $days, $metrics, &$stats, &$total) { - foreach ($metrics as $metric) { - $result = $dbForProject->findOne('stats', [ - Query::equal('metric', [$metric]), - Query::equal('period', ['inf']) - ]); - - $stats[$metric]['total'] = $result['value'] ?? 0; - $limit = $days['limit']; - $period = $days['period']; - $results = $dbForProject->find('stats', [ - Query::equal('metric', [$metric]), - Query::equal('period', [$period]), - Query::limit($limit), - Query::orderDesc('time'), - ]); - $stats[$metric]['data'] = []; - foreach ($results as $result) { - $stats[$metric]['data'][$result->getAttribute('time')] = [ - 'value' => $result->getAttribute('value'), - ]; - } - } - }); - - $format = match ($days['period']) { - '1h' => 'Y-m-d\TH:00:00.000P', - '1d' => 'Y-m-d\T00:00:00.000P', - }; - - foreach ($metrics as $metric) { - $usage[$metric]['total'] = $stats[$metric]['total']; - $usage[$metric]['data'] = []; - $leap = time() - ($days['limit'] * $days['factor']); - while ($leap < time()) { - $leap += $days['factor']; - $formatDate = date($format, $leap); - $usage[$metric]['data'][] = [ - 'value' => $stats[$metric]['data'][$formatDate]['value'] ?? 0, - 'date' => $formatDate, - ]; - } - } - $response->dynamic(new Document([ - 'range' => $range, - 'bucketsTotal' => $usage[$metrics[0]]['total'], - 'filesTotal' => $usage[$metrics[1]]['total'], - 'filesStorageTotal' => $usage[$metrics[2]]['total'], - 'buckets' => $usage[$metrics[0]]['data'], - 'files' => $usage[$metrics[1]]['data'], - 'storage' => $usage[$metrics[2]]['data'], - ]), Response::MODEL_USAGE_STORAGE); - }); - -App::get('/v1/storage/:bucketId/usage') - ->desc('Get bucket usage stats') - ->groups(['api', 'storage']) - ->label('scope', 'files.read') - ->label('resourceType', RESOURCE_TYPE_BUCKETS) - ->label('sdk', new Method( - namespace: 'storage', - group: null, - name: 'getBucketUsage', - description: '/docs/references/storage/get-bucket-usage.md', - auth: [AuthType::ADMIN], - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_OK, - model: Response::MODEL_USAGE_BUCKETS, - ) - ] - )) - ->param('bucketId', '', new UID(), 'Bucket ID.') - ->param('range', '30d', new WhiteList(['24h', '30d', '90d'], true), 'Date range.', true) - ->inject('response') - ->inject('project') - ->inject('dbForProject') - ->inject('getLogsDB') - ->inject('authorization') - ->action(function (string $bucketId, string $range, Response $response, Document $project, Database $dbForProject, callable $getLogsDB, Authorization $authorization) { - - $dbForLogs = call_user_func($getLogsDB, $project); - $bucket = $dbForProject->getDocument('buckets', $bucketId); - - if ($bucket->isEmpty()) { - throw new Exception(Exception::STORAGE_BUCKET_NOT_FOUND); - } - - $periods = Config::getParam('usage', []); - $stats = $usage = []; - $days = $periods[$range]; - $metrics = [ - str_replace('{bucketInternalId}', $bucket->getSequence(), METRIC_BUCKET_ID_FILES), - str_replace('{bucketInternalId}', $bucket->getSequence(), METRIC_BUCKET_ID_FILES_STORAGE), - str_replace('{bucketInternalId}', $bucket->getSequence(), METRIC_BUCKET_ID_FILES_IMAGES_TRANSFORMED), - ]; - - $authorization->skip(function () use ($dbForProject, $dbForLogs, $bucket, $days, $metrics, &$stats) { - foreach ($metrics as $metric) { - $db = ($metric === str_replace('{bucketInternalId}', $bucket->getSequence(), METRIC_BUCKET_ID_FILES_IMAGES_TRANSFORMED)) - ? $dbForLogs - : $dbForProject; - - $result = $db->findOne('stats', [ - Query::equal('metric', [$metric]), - Query::equal('period', ['inf']) - ]); - - $stats[$metric]['total'] = $result['value'] ?? 0; - $limit = $days['limit']; - $period = $days['period']; - $results = $db->find('stats', [ - Query::equal('metric', [$metric]), - Query::equal('period', [$period]), - Query::limit($limit), - Query::orderDesc('time'), - ]); - $stats[$metric]['data'] = []; - foreach ($results as $result) { - $stats[$metric]['data'][$result->getAttribute('time')] = [ - 'value' => $result->getAttribute('value'), - ]; - } - } - }); - - - $format = match ($days['period']) { - '1h' => 'Y-m-d\TH:00:00.000P', - '1d' => 'Y-m-d\T00:00:00.000P', - }; - - foreach ($metrics as $metric) { - $usage[$metric]['total'] = $stats[$metric]['total']; - $usage[$metric]['data'] = []; - $leap = time() - ($days['limit'] * $days['factor']); - while ($leap < time()) { - $leap += $days['factor']; - $formatDate = date($format, $leap); - $usage[$metric]['data'][] = [ - 'value' => $stats[$metric]['data'][$formatDate]['value'] ?? 0, - 'date' => $formatDate, - ]; - } - } - - $response->dynamic(new Document([ - 'range' => $range, - 'filesTotal' => $usage[$metrics[0]]['total'], - 'filesStorageTotal' => $usage[$metrics[1]]['total'], - 'files' => $usage[$metrics[0]]['data'], - 'storage' => $usage[$metrics[1]]['data'], - 'imageTransformations' => $usage[$metrics[2]]['data'], - 'imageTransformationsTotal' => $usage[$metrics[2]]['total'], - ]), Response::MODEL_USAGE_BUCKETS); - }); diff --git a/app/controllers/api/teams.php b/app/controllers/api/teams.php index c948c9c990..2cee394a9c 100644 --- a/app/controllers/api/teams.php +++ b/app/controllers/api/teams.php @@ -23,9 +23,9 @@ use Appwrite\Utopia\Database\Validator\Queries\Memberships; use Appwrite\Utopia\Database\Validator\Queries\Teams; use Appwrite\Utopia\Request; use Appwrite\Utopia\Response; +use libphonenumber\NumberParseException; use libphonenumber\PhoneNumberUtil; use MaxMind\Db\Reader; -use Utopia\Abuse\Abuse; use Utopia\App; use Utopia\Audit\Audit; use Utopia\Auth\Proofs\Password; @@ -103,6 +103,7 @@ App::post('/v1/teams') Permission::update(Role::team($teamId, 'owner')), Permission::delete(Role::team($teamId, 'owner')), ], + 'labels' => [], 'name' => $name, 'total' => ($isPrivilegedUser || $isAppUser) ? 0 : 1, 'prefs' => new \stdClass(), @@ -801,26 +802,21 @@ App::post('/v1/teams/:teamId/memberships') ->setRecipients([$phone]) ->setProviderType('SMS'); - if (isset($plan['authPhone'])) { - $timelimit = $timelimit('organization:{organizationId}', $plan['authPhone'], 30 * 24 * 60 * 60); // 30 days - $timelimit - ->setParam('{organizationId}', $project->getAttribute('teamId')); + $helper = PhoneNumberUtil::getInstance(); + try { + $countryCode = $helper->parse($phone)->getCountryCode(); - $abuse = new Abuse($timelimit); - if ($abuse->check() && System::getEnv('_APP_OPTIONS_ABUSE', 'enabled') === 'enabled') { - $helper = PhoneNumberUtil::getInstance(); - $countryCode = $helper->parse($phone)->getCountryCode(); - - if (!empty($countryCode)) { - $queueForStatsUsage - ->addMetric(str_replace('{countryCode}', $countryCode, METRIC_AUTH_METHOD_PHONE_COUNTRY_CODE), 1); - } + if (!empty($countryCode)) { + $queueForStatsUsage + ->addMetric(str_replace('{countryCode}', $countryCode, METRIC_AUTH_METHOD_PHONE_COUNTRY_CODE), 1); } - $queueForStatsUsage - ->addMetric(METRIC_AUTH_METHOD_PHONE, 1) - ->setProject($project) - ->trigger(); + } catch (NumberParseException $e) { + // Ignore invalid phone number for country code stats } + $queueForStatsUsage + ->addMetric(METRIC_AUTH_METHOD_PHONE, 1) + ->setProject($project) + ->trigger(); } } @@ -1471,7 +1467,8 @@ App::get('/v1/teams/:teamId/logs') ->inject('dbForProject') ->inject('locale') ->inject('geodb') - ->action(function (string $teamId, array $queries, bool $includeTotal, Response $response, Database $dbForProject, Locale $locale, Reader $geodb) { + ->inject('audit') + ->action(function (string $teamId, array $queries, bool $includeTotal, Response $response, Database $dbForProject, Locale $locale, Reader $geodb, Audit $audit) { $team = $dbForProject->getDocument('teams', $teamId); @@ -1485,9 +1482,12 @@ App::get('/v1/teams/:teamId/logs') throw new Exception(Exception::GENERAL_QUERY_INVALID, $e->getMessage()); } - $audit = new Audit($dbForProject); + $grouped = Query::groupByType($queries); + $limit = $grouped['limit'] ?? 25; + $offset = $grouped['offset'] ?? 0; + $resource = 'team/' . $team->getId(); - $logs = $audit->getLogsByResource($resource, $queries); + $logs = $audit->getLogsByResource($resource, offset: $offset, limit: $limit); $output = []; @@ -1534,7 +1534,7 @@ App::get('/v1/teams/:teamId/logs') } } $response->dynamic(new Document([ - 'total' => $includeTotal ? $audit->countLogsByResource($resource, $queries) : 0, + 'total' => $includeTotal ? $audit->countLogsByResource($resource) : 0, 'logs' => $output, ]), Response::MODEL_LOG_LIST); }); diff --git a/app/controllers/api/users.php b/app/controllers/api/users.php index 747f77f564..a963284538 100644 --- a/app/controllers/api/users.php +++ b/app/controllers/api/users.php @@ -945,7 +945,8 @@ App::get('/v1/users/:userId/logs') ->inject('dbForProject') ->inject('locale') ->inject('geodb') - ->action(function (string $userId, array $queries, bool $includeTotal, Response $response, Database $dbForProject, Locale $locale, Reader $geodb) { + ->inject('audit') + ->action(function (string $userId, array $queries, bool $includeTotal, Response $response, Database $dbForProject, Locale $locale, Reader $geodb, Audit $audit) { $user = $dbForProject->getDocument('users', $userId); @@ -958,8 +959,11 @@ App::get('/v1/users/:userId/logs') throw new Exception(Exception::GENERAL_QUERY_INVALID, $e->getMessage()); } - $audit = new Audit($dbForProject); - $logs = $audit->getLogsByUser($user->getSequence(), $queries); + $grouped = Query::groupByType($queries); + $limit = $grouped['limit'] ?? 25; + $offset = $grouped['offset'] ?? 0; + + $logs = $audit->getLogsByUser($user->getSequence(), limit: $limit, offset: $offset); $output = []; foreach ($logs as $i => &$log) { $log['userAgent'] = (!empty($log['userAgent'])) ? $log['userAgent'] : 'UNKNOWN'; @@ -999,7 +1003,7 @@ App::get('/v1/users/:userId/logs') } $response->dynamic(new Document([ - 'total' => $includeTotal ? $audit->countLogsByUser($user->getSequence(), $queries) : 0, + 'total' => $includeTotal ? $audit->countLogsByUser($user->getSequence()) : 0, 'logs' => $output, ]), Response::MODEL_LOG_LIST); }); diff --git a/app/controllers/api/vcs.php b/app/controllers/api/vcs.php index 2270f4fd89..2bb9c17fd3 100644 --- a/app/controllers/api/vcs.php +++ b/app/controllers/api/vcs.php @@ -306,6 +306,7 @@ $createGitDeployments = function (GitHub $github, string $providerInstallationId 'resourceType' => $resourceCollection, 'entrypoint' => $resource->getAttribute('entrypoint', ''), 'buildCommands' => \implode(' && ', $commands), + 'startCommand' => $resource->getAttribute('startCommand', ''), 'buildOutput' => $resource->getAttribute('outputDirectory', ''), 'adapter' => $resource->getAttribute('adapter', ''), 'fallbackFile' => $resource->getAttribute('fallbackFile', ''), diff --git a/app/controllers/general.php b/app/controllers/general.php index 638df72419..8fc5a11503 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -6,6 +6,7 @@ use Ahc\Jwt\JWT; use Ahc\Jwt\JWTException; use Appwrite\Auth\Key; use Appwrite\Event\Certificate; +use Appwrite\Event\Delete as DeleteEvent; use Appwrite\Event\Event; use Appwrite\Event\Func; use Appwrite\Event\StatsUsage; @@ -59,7 +60,7 @@ Config::setParam('domainVerification', false); Config::setParam('cookieDomain', 'localhost'); Config::setParam('cookieSamesite', Response::COOKIE_SAMESITE_NONE); -function router(App $utopia, Database $dbForPlatform, callable $getProjectDB, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Event $queueForEvents, StatsUsage $queueForStatsUsage, Func $queueForFunctions, Executor $executor, Reader $geodb, callable $isResourceBlocked, array $platform, string $previewHostname, Authorization $authorization, ?Key $apiKey) +function router(App $utopia, Database $dbForPlatform, callable $getProjectDB, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Event $queueForEvents, StatsUsage $queueForStatsUsage, Func $queueForFunctions, Executor $executor, Reader $geodb, callable $isResourceBlocked, array $platform, string $previewHostname, Authorization $authorization, ?Key $apiKey, DeleteEvent $queueForDeletes, int $executionsRetentionCount) { $host = $request->getHostname() ?? ''; if (!empty($previewHostname)) { @@ -802,6 +803,20 @@ function router(App $utopia, Database $dbForPlatform, callable $getProjectDB, Sw ->setProject($project) ->trigger(); + /* cleanup */ + if ($executionsRetentionCount > 0 && ENABLE_EXECUTIONS_LIMIT_ON_ROUTE) { + $resourceType = $type === 'function' + ? RESOURCE_TYPE_FUNCTIONS + : RESOURCE_TYPE_SITES; + + $queueForDeletes + ->setProject($project) + ->setResourceType($resourceType) + ->setResource($resource->getSequence()) + ->setType(DELETE_TYPE_EXECUTIONS_LIMIT) + ->trigger(); + } + return true; } elseif ($type === 'api') { return false; @@ -812,8 +827,6 @@ function router(App $utopia, Database $dbForPlatform, callable $getProjectDB, Sw } else { throw new AppwriteException(AppwriteException::GENERAL_SERVER_ERROR, 'Unknown resource type ' . $type, view: $errorView); } - - return false; } App::init() @@ -863,7 +876,9 @@ App::init() ->inject('apiKey') ->inject('cors') ->inject('authorization') - ->action(function (App $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Document $project, Database $dbForPlatform, callable $getProjectDB, Locale $locale, array $localeCodes, Reader $geodb, StatsUsage $queueForStatsUsage, Event $queueForEvents, Func $queueForFunctions, Executor $executor, array $platform, callable $isResourceBlocked, string $previewHostname, Document $devKey, ?Key $apiKey, Cors $cors, Authorization $authorization) { + ->inject('queueForDeletes') + ->inject('executionsRetentionCount') + ->action(function (App $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Document $project, Database $dbForPlatform, callable $getProjectDB, Locale $locale, array $localeCodes, Reader $geodb, StatsUsage $queueForStatsUsage, Event $queueForEvents, Func $queueForFunctions, Executor $executor, array $platform, callable $isResourceBlocked, string $previewHostname, Document $devKey, ?Key $apiKey, Cors $cors, Authorization $authorization, DeleteEvent $queueForDeletes, int $executionsRetentionCount) { /* * Appwrite Router */ @@ -871,7 +886,7 @@ App::init() $platformHostnames = $platform['hostnames'] ?? []; // Only run Router when external domain if (!\in_array($hostname, $platformHostnames) || !empty($previewHostname)) { - if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $queueForStatsUsage, $queueForFunctions, $executor, $geodb, $isResourceBlocked, $platform, $previewHostname, $authorization, $apiKey)) { + if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $queueForStatsUsage, $queueForFunctions, $executor, $geodb, $isResourceBlocked, $platform, $previewHostname, $authorization, $apiKey, $queueForDeletes, $executionsRetentionCount)) { $utopia->getRoute()?->label('router', true); } } @@ -1034,7 +1049,7 @@ App::init() ->inject('dbForPlatform') ->inject('queueForCertificates') ->inject('platform') - ->inject('authorization') + ->inject('authorization') ->action(function (Request $request, Document $console, Database $dbForPlatform, Certificate $queueForCertificates, array $platform, Authorization $authorization) { $hostname = $request->getHostname(); $cache = Config::getParam('hostnames', []); @@ -1050,80 +1065,77 @@ App::init() if (empty($domain->get()) || !$domain->isKnown() || $domain->isTest()) { $cache[$domain->get()] = false; Config::setParam('hostnames', $cache); - Console::warning($domain->get() . ' is not a publicly accessible domain. Skipping SSL certificate generation.'); return; } if (str_starts_with($request->getURI(), '/.well-known/acme-challenge')) { - Console::warning('Skipping SSL certificates generation on ACME challenge.'); return; } // 3. Check if domain is a main domain if (!in_array($domain->get(), $platformHostnames)) { - Console::warning($domain->get() . ' is not a main domain. Skipping SSL certificate generation.'); return; } // 4. Check/create rule (requires DB access) - $authorization->disable(); - try { - // TODO: (@Meldiron) Remove after 1.7.x migration - $isMd5 = System::getEnv('_APP_RULES_FORMAT') === 'md5'; - $document = $isMd5 - ? $dbForPlatform->getDocument('rules', md5($domain->get())) - : $dbForPlatform->findOne('rules', [ - Query::equal('domain', [$domain->get()]), + $authorization->skip(function () use ($dbForPlatform, $domain, $console, $queueForCertificates, &$cache) { + try { + // TODO: (@Meldiron) Remove after 1.7.x migration + $isMd5 = System::getEnv('_APP_RULES_FORMAT') === 'md5'; + $document = $isMd5 + ? $dbForPlatform->getDocument('rules', md5($domain->get())) + : $dbForPlatform->findOne('rules', [ + Query::equal('domain', [$domain->get()]), + ]); + + if (!$document->isEmpty()) { + return; + } + + // 5. Create new rule + $owner = ''; + $fallback = System::getEnv('_APP_DOMAIN_FUNCTIONS_FALLBACK', ''); + $funcDomain = System::getEnv('_APP_DOMAIN_FUNCTIONS', ''); + $siteDomain = System::getEnv('_APP_DOMAIN_SITES', ''); + + if (!empty($fallback) && \str_ends_with($domain->get(), $fallback)) { + $funcDomain = $fallback; + } + + if ( + (!empty($funcDomain) && \str_ends_with($domain->get(), $funcDomain)) || + (!empty($siteDomain) && \str_ends_with($domain->get(), $siteDomain)) + ) { + $owner = 'Appwrite'; + } + + $ruleId = $isMd5 ? md5($domain->get()) : ID::unique(); + $document = new Document([ + '$id' => $ruleId, + 'domain' => $domain->get(), + 'type' => 'api', + 'status' => 'verifying', + 'projectId' => $console->getId(), + 'projectInternalId' => $console->getSequence(), + 'search' => implode(' ', [$ruleId, $domain->get()]), + 'owner' => $owner, + 'region' => $console->getAttribute('region') ]); - if (!$document->isEmpty()) { - return; + $dbForPlatform->createDocument('rules', $document); + + Console::info('Issuing a TLS certificate for the main domain (' . $domain->get() . ') in a few seconds...'); + $queueForCertificates + ->setDomain($document) + ->setSkipRenewCheck(true) + ->trigger(); + } catch (Duplicate $e) { + Console::info('Certificate already exists'); + } finally { + $cache[$domain->get()] = true; + Config::setParam('hostnames', $cache); } - - // 5. Create new rule - $owner = ''; - $fallback = System::getEnv('_APP_DOMAIN_FUNCTIONS_FALLBACK', ''); - $funcDomain = System::getEnv('_APP_DOMAIN_FUNCTIONS', ''); - $siteDomain = System::getEnv('_APP_DOMAIN_SITES', ''); - - if (!empty($fallback) && \str_ends_with($domain->get(), $fallback)) { - $funcDomain = $fallback; - } - - if ( - (!empty($funcDomain) && \str_ends_with($domain->get(), $funcDomain)) || - (!empty($siteDomain) && \str_ends_with($domain->get(), $siteDomain)) - ) { - $owner = 'Appwrite'; - } - - $ruleId = $isMd5 ? md5($domain->get()) : ID::unique(); - $document = new Document([ - '$id' => $ruleId, - 'domain' => $domain->get(), - 'type' => 'api', - 'status' => 'verifying', - 'projectId' => $console->getId(), - 'projectInternalId' => $console->getSequence(), - 'search' => implode(' ', [$ruleId, $domain->get()]), - 'owner' => $owner, - 'region' => $console->getAttribute('region') - ]); - - $dbForPlatform->createDocument('rules', $document); - - Console::info('Issuing a TLS certificate for the main domain (' . $domain->get() . ') in a few seconds...'); - $queueForCertificates - ->setDomain($document) - ->setSkipRenewCheck(true) - ->trigger(); - } catch (Duplicate $e) { - Console::info('Certificate already exists'); - } finally { - $cache[$domain->get()] = true; - Config::setParam('hostnames', $cache); - $authorization->reset(); - } + }); }); App::options() @@ -1147,14 +1159,16 @@ App::options() ->inject('apiKey') ->inject('cors') ->inject('authorization') - ->action(function (App $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Database $dbForPlatform, callable $getProjectDB, Event $queueForEvents, StatsUsage $queueForStatsUsage, Func $queueForFunctions, Executor $executor, Reader $geodb, callable $isResourceBlocked, array $platform, string $previewHostname, Document $project, Document $devKey, ?Key $apiKey, Cors $cors, Authorization $authorization) { + ->inject('queueForDeletes') + ->inject('executionsRetentionCount') + ->action(function (App $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Database $dbForPlatform, callable $getProjectDB, Event $queueForEvents, StatsUsage $queueForStatsUsage, Func $queueForFunctions, Executor $executor, Reader $geodb, callable $isResourceBlocked, array $platform, string $previewHostname, Document $project, Document $devKey, ?Key $apiKey, Cors $cors, Authorization $authorization, DeleteEvent $queueForDeletes, int $executionsRetentionCount) { /* * Appwrite Router */ $platformHostnames = $platform['hostnames'] ?? []; // Only run Router when external domain if (!in_array($request->getHostname(), $platformHostnames) || !empty($previewHostname)) { - if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $queueForStatsUsage, $queueForFunctions, $executor, $geodb, $isResourceBlocked, $platform, $previewHostname, $apiKey)) { + if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $queueForStatsUsage, $queueForFunctions, $executor, $geodb, $isResourceBlocked, $platform, $previewHostname, $authorization, $apiKey, $queueForDeletes, $executionsRetentionCount)) { $utopia->getRoute()?->label('router', true); } } @@ -1335,6 +1349,86 @@ App::error() $log->addExtra('trace', $error->getTraceAsString()); $log->addExtra('roles', $authorization->getRoles()); + try { + /* add queries to log */ + $queries = $request->getParam('queries', []); + if (!empty($queries) && is_array($queries)) { + $parsedQueries = Query::parseQueries($queries); + + // format query by removing sensitive values + $formatQuery = function (array $queryArray) use (&$formatQuery): ?array { + $method = $queryArray['method'] ?? ''; + $values = $queryArray['values'] ?? []; + $attribute = $queryArray['attribute'] ?? ''; + + if (!is_string($method) || $method === '') { + return null; + } + + // logical queries - recursively format nested queries + if (in_array($method, [Query::TYPE_AND, Query::TYPE_OR], true)) { + $nested = []; + foreach ($values as $nestedArray) { + if (is_array($nestedArray)) { + $formatted = $formatQuery($nestedArray); + if ($formatted !== null) { + $nested[] = $formatted; + } + } + } + return empty($nested) ? null : [$method => $nested]; + } + + // select - show selected attributes + if ($method === Query::TYPE_SELECT) { + $attributes = array_values(array_filter($values, 'is_string')); + return [$method => $attributes]; + } + + // pagination + if (in_array($method, [ + Query::TYPE_LIMIT, + Query::TYPE_OFFSET, + Query::TYPE_CURSOR_AFTER, + Query::TYPE_CURSOR_BEFORE + ], true)) { + return [$method => []]; + } + + // orders + if (in_array($method, [ + Query::TYPE_ORDER_DESC, + Query::TYPE_ORDER_ASC, + Query::TYPE_ORDER_RANDOM + ], true)) { + return [$method => !empty($attribute) ? [$attribute] : []]; + } + + // filter + if (!empty($attribute)) { + return [$method => [$attribute]]; + } + + // fallback + return [$method => []]; + }; + + $formattedQueries = []; + foreach ($parsedQueries as $query) { + $formatted = $formatQuery($query->toArray()); + if ($formatted !== null) { + $formattedQueries[] = $formatted; + } + } + + if (!empty($formattedQueries)) { + $log->addExtra('queries', $formattedQueries); + } + } + } catch (Throwable $_) { + // don't fail the error handler + } + $action = 'UNKNOWN_NAMESPACE.UNKNOWN.METHOD'; if (!empty($sdk)) { /** @var \Appwrite\SDK\Method $sdk */ @@ -1458,13 +1552,15 @@ App::get('/robots.txt') ->inject('previewHostname') ->inject('apiKey') ->inject('authorization') - ->action(function (App $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Database $dbForPlatform, callable $getProjectDB, Event $queueForEvents, StatsUsage $queueForStatsUsage, Func $queueForFunctions, Executor $executor, Reader $geodb, callable $isResourceBlocked, array $platform, string $previewHostname, ?Key $apiKey, Authorization $authorization) { + ->inject('queueForDeletes') + ->inject('executionsRetentionCount') + ->action(function (App $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Database $dbForPlatform, callable $getProjectDB, Event $queueForEvents, StatsUsage $queueForStatsUsage, Func $queueForFunctions, Executor $executor, Reader $geodb, callable $isResourceBlocked, array $platform, string $previewHostname, ?Key $apiKey, Authorization $authorization, DeleteEvent $queueForDeletes, int $executionsRetentionCount) { $platformHostnames = $platform['hostnames'] ?? []; if (in_array($request->getHostname(), $platformHostnames) || !empty($previewHostname)) { $template = new View(__DIR__ . '/../views/general/robots.phtml'); $response->text($template->render(false)); } else { - if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $queueForStatsUsage, $queueForFunctions, $executor, $geodb, $isResourceBlocked, $platform, $previewHostname, $authorization, $apiKey)) { + if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $queueForStatsUsage, $queueForFunctions, $executor, $geodb, $isResourceBlocked, $platform, $previewHostname, $authorization, $apiKey, $queueForDeletes, $executionsRetentionCount)) { $utopia->getRoute()?->label('router', true); } } @@ -1491,13 +1587,15 @@ App::get('/humans.txt') ->inject('previewHostname') ->inject('apiKey') ->inject('authorization') - ->action(function (App $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Database $dbForPlatform, callable $getProjectDB, Event $queueForEvents, StatsUsage $queueForStatsUsage, Func $queueForFunctions, Executor $executor, Reader $geodb, callable $isResourceBlocked, array $platform, string $previewHostname, ?Key $apiKey, Authorization $authorization) { + ->inject('queueForDeletes') + ->inject('executionsRetentionCount') + ->action(function (App $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Database $dbForPlatform, callable $getProjectDB, Event $queueForEvents, StatsUsage $queueForStatsUsage, Func $queueForFunctions, Executor $executor, Reader $geodb, callable $isResourceBlocked, array $platform, string $previewHostname, ?Key $apiKey, Authorization $authorization, DeleteEvent $queueForDeletes, int $executionsRetentionCount) { $platformHostnames = $platform['hostnames'] ?? []; if (in_array($request->getHostname(), $platformHostnames) || !empty($previewHostname)) { $template = new View(__DIR__ . '/../views/general/humans.phtml'); $response->text($template->render(false)); } else { - if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $queueForStatsUsage, $queueForFunctions, $executor, $geodb, $isResourceBlocked, $platform, $previewHostname, $authorization, $apiKey)) { + if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $queueForStatsUsage, $queueForFunctions, $executor, $geodb, $isResourceBlocked, $platform, $previewHostname, $authorization, $apiKey, $queueForDeletes, $executionsRetentionCount)) { $utopia->getRoute()?->label('router', true); } } diff --git a/app/controllers/mock.php b/app/controllers/mock.php index 6f092a5d19..fd7dae55b4 100644 --- a/app/controllers/mock.php +++ b/app/controllers/mock.php @@ -200,8 +200,12 @@ App::post('/v1/mock/api-key-unprefixed') Permission::update(Role::any()), Permission::delete(Role::any()), ], + // TODO: @hmacr Remove `projectInternalId` and `projectId` column writes before deleting the column. 'projectInternalId' => $project->getSequence(), 'projectId' => $project->getId(), + 'resourceInternalId' => $project->getSequence(), + 'resourceId' => $project->getId(), + 'resourceType' => 'projects', 'name' => 'Outdated key', 'scopes' => $scopes, 'expire' => null, diff --git a/app/controllers/shared/api.php b/app/controllers/shared/api.php index 586bcbd4be..fffe544330 100644 --- a/app/controllers/shared/api.php +++ b/app/controllers/shared/api.php @@ -10,12 +10,12 @@ use Appwrite\Event\Event; use Appwrite\Event\Func; use Appwrite\Event\Mail; use Appwrite\Event\Messaging; -use Appwrite\Event\Migration; use Appwrite\Event\Realtime; use Appwrite\Event\StatsUsage; use Appwrite\Event\Webhook; use Appwrite\Extend\Exception; use Appwrite\Extend\Exception as AppwriteException; +use Appwrite\Functions\EventProcessor; use Appwrite\SDK\Method; use Appwrite\Utopia\Database\Documents\User; use Appwrite\Utopia\Request; @@ -31,7 +31,6 @@ use Utopia\Database\Document; use Utopia\Database\Helpers\Role; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Authorization\Input; -use Utopia\Queue\Publisher; use Utopia\System\System; use Utopia\Telemetry\Adapter as Telemetry; use Utopia\Validator\WhiteList; @@ -75,151 +74,6 @@ $parseLabel = function (string $label, array $responsePayload, array $requestPar return $label; }; -/** - * This isolated event handling for `users.*.create` which is based on a `Database::EVENT_DOCUMENT_CREATE` listener may look odd, but it is **intentional**. - * - * Accounts can be created in many ways beyond `createAccount` - * (anonymous, OAuth, phone, etc.), and those flows are probably not covered in event tests; so we handle this here. - */ -$eventDatabaseListener = function (Document $project, Document $document, Response $response, Event $queueForEvents, Func $queueForFunctions, Webhook $queueForWebhooks, Realtime $queueForRealtime) { - // Only trigger events for user creation with the database listener. - if ($document->getCollection() !== 'users') { - return; - } - - $queueForEvents - ->setEvent('users.[userId].create') - ->setParam('userId', $document->getId()) - ->setPayload($response->output($document, Response::MODEL_USER)); - - // Trigger functions, webhooks, and realtime events - $queueForFunctions - ->from($queueForEvents) - ->trigger(); - - - /** Trigger webhooks events only if a project has them enabled */ - if (!empty($project->getAttribute('webhooks'))) { - $queueForWebhooks - ->from($queueForEvents) - ->trigger(); - } - - /** Trigger realtime events only for non console events */ - if ($queueForEvents->getProject()->getId() !== 'console') { - $queueForRealtime - ->from($queueForEvents) - ->trigger(); - } -}; - -$usageDatabaseListener = function (string $event, Document $document, StatsUsage $queueForStatsUsage) { - $value = 1; - - switch ($event) { - case Database::EVENT_DOCUMENT_DELETE: - $value = -1; - break; - case Database::EVENT_DOCUMENTS_DELETE: - $value = -1 * $document->getAttribute('modified', 0); - break; - case Database::EVENT_DOCUMENTS_CREATE: - $value = $document->getAttribute('modified', 0); - break; - case Database::EVENT_DOCUMENTS_UPSERT: - $value = $document->getAttribute('created', 0); - break; - } - - switch (true) { - case $document->getCollection() === 'teams': - $queueForStatsUsage->addMetric(METRIC_TEAMS, $value); // per project - break; - case $document->getCollection() === 'users': - $queueForStatsUsage->addMetric(METRIC_USERS, $value); // per project - if ($event === Database::EVENT_DOCUMENT_DELETE) { - $queueForStatsUsage->addReduce($document); - } - break; - case $document->getCollection() === 'sessions': // sessions - $queueForStatsUsage->addMetric(METRIC_SESSIONS, $value); //per project - break; - case $document->getCollection() === 'databases': // databases - $queueForStatsUsage->addMetric(METRIC_DATABASES, $value); // per project - - if ($event === Database::EVENT_DOCUMENT_DELETE) { - $queueForStatsUsage->addReduce($document); - } - break; - case str_starts_with($document->getCollection(), 'database_') && !str_contains($document->getCollection(), 'collection'): //collections - $parts = explode('_', $document->getCollection()); - $databaseInternalId = $parts[1] ?? 0; - $queueForStatsUsage - ->addMetric(METRIC_COLLECTIONS, $value) // per project - ->addMetric(str_replace('{databaseInternalId}', $databaseInternalId, METRIC_DATABASE_ID_COLLECTIONS), $value); - - if ($event === Database::EVENT_DOCUMENT_DELETE) { - $queueForStatsUsage->addReduce($document); - } - break; - case str_starts_with($document->getCollection(), 'database_') && str_contains($document->getCollection(), '_collection_'): //documents - $parts = explode('_', $document->getCollection()); - $databaseInternalId = $parts[1] ?? 0; - $collectionInternalId = $parts[3] ?? 0; - $queueForStatsUsage - ->addMetric(METRIC_DOCUMENTS, $value) // per project - ->addMetric(str_replace('{databaseInternalId}', $databaseInternalId, METRIC_DATABASE_ID_DOCUMENTS), $value) // per database - ->addMetric(str_replace(['{databaseInternalId}', '{collectionInternalId}'], [$databaseInternalId, $collectionInternalId], METRIC_DATABASE_ID_COLLECTION_ID_DOCUMENTS), $value); // per collection - break; - case $document->getCollection() === 'buckets': //buckets - $queueForStatsUsage - ->addMetric(METRIC_BUCKETS, $value); // per project - if ($event === Database::EVENT_DOCUMENT_DELETE) { - $queueForStatsUsage - ->addReduce($document); - } - break; - case str_starts_with($document->getCollection(), 'bucket_'): // files - $parts = explode('_', $document->getCollection()); - $bucketInternalId = $parts[1]; - $queueForStatsUsage - ->addMetric(METRIC_FILES, $value) // per project - ->addMetric(METRIC_FILES_STORAGE, $document->getAttribute('sizeOriginal') * $value) // per project - ->addMetric(str_replace('{bucketInternalId}', $bucketInternalId, METRIC_BUCKET_ID_FILES), $value) // per bucket - ->addMetric(str_replace('{bucketInternalId}', $bucketInternalId, METRIC_BUCKET_ID_FILES_STORAGE), $document->getAttribute('sizeOriginal') * $value); // per bucket - break; - case $document->getCollection() === 'functions': - $queueForStatsUsage - ->addMetric(METRIC_FUNCTIONS, $value); // per project - - if ($event === Database::EVENT_DOCUMENT_DELETE) { - $queueForStatsUsage - ->addReduce($document); - } - break; - case $document->getCollection() === 'sites': - $queueForStatsUsage - ->addMetric(METRIC_SITES, $value); // per project - - if ($event === Database::EVENT_DOCUMENT_DELETE) { - $queueForStatsUsage - ->addReduce($document); - } - break; - case $document->getCollection() === 'deployments': - $queueForStatsUsage - ->addMetric(METRIC_DEPLOYMENTS, $value) // per project - ->addMetric(METRIC_DEPLOYMENTS_STORAGE, $document->getAttribute('size') * $value) // per project - ->addMetric(str_replace(['{resourceType}'], [$document->getAttribute('resourceType')], METRIC_RESOURCE_TYPE_DEPLOYMENTS), $value) // per function - ->addMetric(str_replace(['{resourceType}'], [$document->getAttribute('resourceType')], METRIC_RESOURCE_TYPE_DEPLOYMENTS_STORAGE), $document->getAttribute('size') * $value) - ->addMetric(str_replace(['{resourceType}', '{resourceInternalId}'], [$document->getAttribute('resourceType'), $document->getAttribute('resourceInternalId')], METRIC_RESOURCE_TYPE_ID_DEPLOYMENTS), $value) // per function - ->addMetric(str_replace(['{resourceType}', '{resourceInternalId}'], [$document->getAttribute('resourceType'), $document->getAttribute('resourceInternalId')], METRIC_RESOURCE_TYPE_ID_DEPLOYMENTS_STORAGE), $document->getAttribute('size') * $value); - break; - default: - break; - } -}; - App::init() ->groups(['api']) ->inject('utopia') @@ -489,9 +343,6 @@ App::init() ->inject('response') ->inject('project') ->inject('user') - ->inject('publisher') - ->inject('publisherFunctions') - ->inject('publisherWebhooks') ->inject('queueForEvents') ->inject('queueForMessaging') ->inject('queueForAudits') @@ -501,7 +352,6 @@ App::init() ->inject('queueForStatsUsage') ->inject('queueForFunctions') ->inject('queueForMails') - ->inject('queueForMigrations') ->inject('dbForProject') ->inject('timelimit') ->inject('resourceToken') @@ -512,7 +362,7 @@ App::init() ->inject('telemetry') ->inject('platform') ->inject('authorization') - ->action(function (App $utopia, Request $request, Response $response, Document $project, Document $user, Publisher $publisher, Publisher $publisherFunctions, Publisher $publisherWebhooks, Event $queueForEvents, Messaging $queueForMessaging, Audit $queueForAudits, Delete $queueForDeletes, EventDatabase $queueForDatabase, Build $queueForBuilds, StatsUsage $queueForStatsUsage, Func $queueForFunctions, Mail $queueForMails, Migration $queueForMigrations, Database $dbForProject, callable $timelimit, Document $resourceToken, string $mode, ?Key $apiKey, array $plan, Document $devKey, Telemetry $telemetry, array $platform, Authorization $authorization) use ($usageDatabaseListener, $eventDatabaseListener) { + ->action(function (App $utopia, Request $request, Response $response, Document $project, Document $user, Event $queueForEvents, Messaging $queueForMessaging, Audit $queueForAudits, Delete $queueForDeletes, EventDatabase $queueForDatabase, Build $queueForBuilds, StatsUsage $queueForStatsUsage, Func $queueForFunctions, Mail $queueForMails, Database $dbForProject, callable $timelimit, Document $resourceToken, string $mode, ?Key $apiKey, array $plan, Document $devKey, Telemetry $telemetry, array $platform, Authorization $authorization) { $route = $utopia->getRoute(); @@ -632,28 +482,6 @@ App::init() $queueForBuilds->setPlatform($platform); $queueForMails->setPlatform($platform); - // Clone the queues, to prevent events triggered by the database listener - // from overwriting the events that are supposed to be triggered in the shutdown hook. - $queueForEventsClone = new Event($publisher); - $queueForFunctions = new Func($publisherFunctions); - $queueForWebhooks = new Webhook($publisherWebhooks); - $queueForRealtime = new Realtime(); - - $dbForProject - ->on(Database::EVENT_DOCUMENT_CREATE, 'calculate-usage', fn ($event, $document) => $usageDatabaseListener($event, $document, $queueForStatsUsage)) - ->on(Database::EVENT_DOCUMENT_DELETE, 'calculate-usage', fn ($event, $document) => $usageDatabaseListener($event, $document, $queueForStatsUsage)) - ->on(Database::EVENT_DOCUMENTS_CREATE, 'calculate-usage', fn ($event, $document) => $usageDatabaseListener($event, $document, $queueForStatsUsage)) - ->on(Database::EVENT_DOCUMENTS_DELETE, 'calculate-usage', fn ($event, $document) => $usageDatabaseListener($event, $document, $queueForStatsUsage)) - ->on(Database::EVENT_DOCUMENTS_UPSERT, 'calculate-usage', fn ($event, $document) => $usageDatabaseListener($event, $document, $queueForStatsUsage)) - ->on(Database::EVENT_DOCUMENT_CREATE, 'create-trigger-events', fn ($event, $document) => $eventDatabaseListener( - $project, - $document, - $response, - $queueForEventsClone->from($queueForEvents), - $queueForFunctions->from($queueForEvents), - $queueForWebhooks->from($queueForEvents), - $queueForRealtime->from($queueForEvents) - )); $useCache = $route->getLabel('cache', false); $storageCacheOperationsCounter = $telemetry->createCounter('storage.cache.operations.load'); @@ -817,7 +645,9 @@ App::shutdown() ->inject('queueForRealtime') ->inject('dbForProject') ->inject('authorization') - ->action(function (App $utopia, Request $request, Response $response, Document $project, Document $user, Event $queueForEvents, Audit $queueForAudits, StatsUsage $queueForStatsUsage, Delete $queueForDeletes, EventDatabase $queueForDatabase, Build $queueForBuilds, Messaging $queueForMessaging, Func $queueForFunctions, Event $queueForWebhooks, Realtime $queueForRealtime, Database $dbForProject, Authorization $authorization) use ($parseLabel) { + ->inject('timelimit') + ->inject('eventProcessor') + ->action(function (App $utopia, Request $request, Response $response, Document $project, User $user, Event $queueForEvents, Audit $queueForAudits, StatsUsage $queueForStatsUsage, Delete $queueForDeletes, EventDatabase $queueForDatabase, Build $queueForBuilds, Messaging $queueForMessaging, Func $queueForFunctions, Event $queueForWebhooks, Realtime $queueForRealtime, Database $dbForProject, Authorization $authorization, callable $timelimit, EventProcessor $eventProcessor) use ($parseLabel) { $responsePayload = $response->getPayload(); @@ -826,9 +656,15 @@ App::shutdown() $queueForEvents->setPayload($responsePayload); } - $queueForFunctions - ->from($queueForEvents) - ->trigger(); + // Get project and function/webhook events (cached) + $functionsEvents = $eventProcessor->getFunctionsEvents($project, $dbForProject); + $webhooksEvents = $eventProcessor->getWebhooksEvents($project); + + // Generate events for this operation + $generatedEvents = Event::generateEvents( + $queueForEvents->getEvent(), + $queueForEvents->getParams() + ); if ($project->getId() !== 'console') { $queueForRealtime @@ -836,21 +672,69 @@ App::shutdown() ->trigger(); } - /** Trigger webhooks events only if a project has them enabled - * A future optimisation is to only trigger webhooks if the webhook is "enabled" - * But it might have performance implications on the API due to the number of webhooks etc. - * Some profiling is needed to see if this is a problem. - */ - if (!empty($project->getAttribute('webhooks'))) { - $queueForWebhooks - ->from($queueForEvents) - ->trigger(); + // Only trigger functions if there are matching function events + if (!empty($functionsEvents)) { + foreach ($generatedEvents as $event) { + if (isset($functionsEvents[$event])) { + $queueForFunctions + ->from($queueForEvents) + ->trigger(); + break; + } + } + } + + // Only trigger webhooks if there are matching webhook events + if (!empty($webhooksEvents)) { + foreach ($generatedEvents as $event) { + if (isset($webhooksEvents[$event])) { + $queueForWebhooks + ->from($queueForEvents) + ->trigger(); + break; + } + } } } $route = $utopia->getRoute(); $requestParams = $route->getParamsValues(); + /** + * Abuse labels + */ + $abuseEnabled = System::getEnv('_APP_OPTIONS_ABUSE', 'enabled') !== 'disabled'; + $abuseResetCode = $route->getLabel('abuse-reset', []); + $abuseResetCode = \is_array($abuseResetCode) ? $abuseResetCode : [$abuseResetCode]; + + if ($abuseEnabled && \count($abuseResetCode) > 0 && \in_array($response->getStatusCode(), $abuseResetCode)) { + $abuseKeyLabel = $route->getLabel('abuse-key', 'url:{url},ip:{ip}'); + $abuseKeyLabel = (!is_array($abuseKeyLabel)) ? [$abuseKeyLabel] : $abuseKeyLabel; + + foreach ($abuseKeyLabel as $abuseKey) { + $start = $request->getContentRangeStart(); + $end = $request->getContentRangeEnd(); + $timeLimit = $timelimit($abuseKey, $route->getLabel('abuse-limit', 0), $route->getLabel('abuse-time', 3600)); + $timeLimit + ->setParam('{projectId}', $project->getId()) + ->setParam('{userId}', $user->getId()) + ->setParam('{userAgent}', $request->getUserAgent('')) + ->setParam('{ip}', $request->getIP()) + ->setParam('{url}', $request->getHostname() . $route->getPath()) + ->setParam('{method}', $request->getMethod()) + ->setParam('{chunkId}', (int)($start / ($end + 1 - $start))); + + foreach ($request->getParams() as $key => $value) { // Set request params as potential abuse keys + if (!empty($value)) { + $timeLimit->setParam('{param-' . $key . '}', (\is_array($value)) ? \json_encode($value) : $value); + } + } + + $abuse = new Abuse($timeLimit); + $abuse->reset(); + } + } + /** * Audit labels */ diff --git a/app/controllers/web/console.php b/app/controllers/web/console.php deleted file mode 100644 index c02e140270..0000000000 --- a/app/controllers/web/console.php +++ /dev/null @@ -1,43 +0,0 @@ -groups(['web']) - ->inject('request') - ->inject('response') - ->action(function (Request $request, Response $response) { - $response - ->addHeader('X-Frame-Options', 'SAMEORIGIN') // Avoid console and homepage from showing in iframes - ->addHeader('X-XSS-Protection', '1; mode=block; report=/v1/xss?url=' . \urlencode($request->getURI())) - ->addHeader('X-UA-Compatible', 'IE=Edge') // Deny IE browsers from going into quirks mode - ; - }); - -App::get('/') - ->alias('auth/*') - ->alias('/invite') - ->alias('/login') - ->alias('/mfa') - ->alias('/card/*') - ->alias('/recover') - ->alias('/register/*') - ->groups(['web']) - ->label('permission', 'public') - ->label('scope', 'home') - ->inject('request') - ->inject('response') - ->action(function (Request $request, Response $response) { - $url = parse_url($request->getURI()); - $target = "/console{$url['path']}"; - $params = $request->getParams(); - if (!empty($params)) { - $target .= "?" . \http_build_query($params); - } - if ($url['fragment'] ?? false) { - $target .= "#{$url['fragment']}"; - } - $response->redirect($target); - }); diff --git a/app/http.php b/app/http.php index 568571fad2..5d08c53eee 100644 --- a/app/http.php +++ b/app/http.php @@ -12,6 +12,8 @@ use Swoole\Process; use Swoole\Table; use Swoole\Timer; use Utopia\App; +use Utopia\Audit\Adapter\Database as AdapterDatabase; +use Utopia\Audit\Adapter\SQL as AuditAdapterSQL; use Utopia\Audit\Audit; use Utopia\CLI\Console; use Utopia\Compression\Compression; @@ -261,8 +263,9 @@ $http->on(Constant::EVENT_START, function (Server $http) use ($payloadSize, $reg createDatabase($app, 'dbForPlatform', 'appwrite', $collections['console'], $pools, function (Database $dbForPlatform) use ($collections, $app) { $authorization = $app->getResource('authorization'); - if ($dbForPlatform->getCollection(Audit::COLLECTION)->isEmpty()) { - $audit = new Audit($dbForPlatform); + if ($dbForPlatform->getCollection(AuditAdapterSQL::COLLECTION)->isEmpty()) { + $adapter = new AdapterDatabase($dbForPlatform); + $audit = new Audit($adapter); $audit->setup(); } @@ -390,8 +393,9 @@ $http->on(Constant::EVENT_START, function (Server $http) use ($payloadSize, $reg Console::success('[Setup] - Skip: metadata table already exists'); } - if ($dbForProject->getCollection(Audit::COLLECTION)->isEmpty()) { - $audit = new Audit($dbForProject); + if ($dbForProject->getCollection(AuditAdapterSQL::COLLECTION)->isEmpty()) { + $adapter = new AdapterDatabase($dbForProject); + $audit = new Audit($adapter); $audit->setup(); } diff --git a/app/init.php b/app/init.php index c32f1eb9a8..91a64a72ce 100644 --- a/app/init.php +++ b/app/init.php @@ -26,6 +26,7 @@ require_once __DIR__ . '/init/database/filters.php'; require_once __DIR__ . '/init/database/formats.php'; require_once __DIR__ . '/init/locales.php'; require_once __DIR__ . '/init/registers.php'; +require_once __DIR__ . '/init/models.php'; require_once __DIR__ . '/init/resources.php'; \stream_context_set_default([ // Set global user agent and http settings diff --git a/app/init/constants.php b/app/init/constants.php index 78b8e3a5ae..e05f31e078 100644 --- a/app/init/constants.php +++ b/app/init/constants.php @@ -44,7 +44,7 @@ const APP_RESOURCE_TOKEN_ACCESS = 24 * 60 * 60; // 24 hours const APP_FILE_ACCESS = 24 * 60 * 60; // 24 hours const APP_CACHE_UPDATE = 24 * 60 * 60; // 24 hours const APP_CACHE_BUSTER = 4321; -const APP_VERSION_STABLE = '1.8.0'; +const APP_VERSION_STABLE = '1.8.1'; const APP_DATABASE_ATTRIBUTE_EMAIL = 'email'; const APP_DATABASE_ATTRIBUTE_ENUM = 'enum'; const APP_DATABASE_ATTRIBUTE_IP = 'ip'; @@ -161,6 +161,9 @@ const ACTIVITY_TYPE_GUEST = 'guest'; const MFA_RECENT_DURATION = 1800; // 30 mins +// Database name +const APP_DATABASE = 'appwrite'; + // Database Reconnect const DATABASE_RECONNECT_SLEEP = 2; const DATABASE_RECONNECT_MAX_ATTEMPTS = 10; @@ -178,8 +181,10 @@ const BUILD_TYPE_DEPLOYMENT = 'deployment'; const BUILD_TYPE_RETRY = 'retry'; // Deletion Types -const DELETE_TYPE_DATABASES = 'databases'; +const ENABLE_EXECUTIONS_LIMIT_ON_ROUTE = false; + +const DELETE_TYPE_DATABASES = 'databases'; const DELETE_TYPE_DOCUMENT = 'document'; const DELETE_TYPE_COLLECTIONS = 'collections'; const DELETE_TYPE_TRANSACTION = 'transaction'; @@ -191,6 +196,7 @@ const DELETE_TYPE_DEPLOYMENTS = 'deployments'; const DELETE_TYPE_USERS = 'users'; const DELETE_TYPE_TEAM_PROJECTS = 'teams_projects'; const DELETE_TYPE_EXECUTIONS = 'executions'; +const DELETE_TYPE_EXECUTIONS_LIMIT = 'executionsLimit'; const DELETE_TYPE_AUDIT = 'audit'; const DELETE_TYPE_ABUSE = 'abuse'; const DELETE_TYPE_USAGE = 'usage'; diff --git a/app/init/database/filters.php b/app/init/database/filters.php index 2bff778017..2b2e17b6a9 100644 --- a/app/init/database/filters.php +++ b/app/init/database/filters.php @@ -135,7 +135,8 @@ Database::addFilter( function (mixed $value, Document $document, Database $database) { return $database->getAuthorization()->skip(fn () => $database ->find('keys', [ - Query::equal('projectInternalId', [$document->getSequence()]), + Query::equal('resourceType', ['projects']), + Query::equal('resourceInternalId', [$document->getSequence()]), Query::limit(APP_LIMIT_SUBQUERY), ])); } diff --git a/app/init/models.php b/app/init/models.php new file mode 100644 index 0000000000..fdfa0271b4 --- /dev/null +++ b/app/init/models.php @@ -0,0 +1,344 @@ +set('pools', function () { Config::setParam('pools-' . $key, $config); } + $reconnectAttempts = (int) System::getEnv('_APP_CONNECTIONS_RECONNECT_ATTEMPTS', 5); + $reconnectSleep = (int) System::getEnv('_APP_CONNECTIONS_RECONNECT_SLEEP', 2); + + $group->setReconnectAttempts($reconnectAttempts); + $group->setReconnectSleep($reconnectSleep); + return $group; }); @@ -360,6 +366,8 @@ $register->set('smtp', function () { $mail->SMTPSecure = System::getEnv('_APP_SMTP_SECURE', ''); $mail->SMTPAutoTLS = false; $mail->CharSet = 'UTF-8'; + $mail->Timeout = 10; /* Connection timeout */ + $mail->getSMTPInstance()->Timelimit = 30; /* Timeout for each individual SMTP command (e.g. HELO, EHLO, etc.) */ $from = \urldecode(System::getEnv('_APP_SYSTEM_EMAIL_NAME', APP_NAME . ' Server')); $email = System::getEnv('_APP_SYSTEM_EMAIL_ADDRESS', APP_EMAIL_TEAM); diff --git a/app/init/resources.php b/app/init/resources.php index 68ac5c90ca..fc0e0152d0 100644 --- a/app/init/resources.php +++ b/app/init/resources.php @@ -4,7 +4,7 @@ use Ahc\Jwt\JWT; use Ahc\Jwt\JWTException; use Appwrite\Auth\Key; use Appwrite\Databases\TransactionState; -use Appwrite\Event\Audit; +use Appwrite\Event\Audit as AuditEvent; use Appwrite\Event\Build; use Appwrite\Event\Certificate; use Appwrite\Event\Database as EventDatabase; @@ -15,10 +15,12 @@ use Appwrite\Event\Mail; use Appwrite\Event\Messaging; use Appwrite\Event\Migration; use Appwrite\Event\Realtime; +use Appwrite\Event\Screenshot; use Appwrite\Event\StatsResources; use Appwrite\Event\StatsUsage; use Appwrite\Event\Webhook; use Appwrite\Extend\Exception; +use Appwrite\Functions\EventProcessor; use Appwrite\GraphQL\Schema; use Appwrite\Network\Cors; use Appwrite\Network\Platform; @@ -30,6 +32,8 @@ use Appwrite\Utopia\Response; use Executor\Executor; use Utopia\Abuse\Adapters\TimeLimit\Redis as TimeLimitRedis; use Utopia\App; +use Utopia\Audit\Adapter\Database as AdapterDatabase; +use Utopia\Audit\Audit; use Utopia\Auth\Hashes\Argon2; use Utopia\Auth\Hashes\Sha; use Utopia\Auth\Proofs\Code; @@ -127,6 +131,9 @@ App::setResource('queueForMails', function (Publisher $publisher) { App::setResource('queueForBuilds', function (Publisher $publisher) { return new Build($publisher); }, ['publisher']); +App::setResource('queueForScreenshots', function (Publisher $publisher) { + return new Screenshot($publisher); +}, ['publisher']); App::setResource('queueForDatabase', function (Publisher $publisher) { return new EventDatabase($publisher); }, ['publisher']); @@ -146,11 +153,14 @@ App::setResource('queueForStatsUsage', function (Publisher $publisher) { return new StatsUsage($publisher); }, ['publisher']); App::setResource('queueForAudits', function (Publisher $publisher) { - return new Audit($publisher); + return new AuditEvent($publisher); }, ['publisher']); App::setResource('queueForFunctions', function (Publisher $publisher) { return new Func($publisher); }, ['publisher']); +App::setResource('eventProcessor', function () { + return new EventProcessor(); +}, []); App::setResource('queueForCertificates', function (Publisher $publisher) { return new Certificate($publisher); }, ['publisher']); @@ -275,6 +285,7 @@ App::setResource('cors', fn (array $allowedHostnames) => new Cors( 'X-Appwrite-ID', 'X-Appwrite-Timestamp', 'X-Appwrite-Session', + 'X-Appwrite-Platform', // for `$platform` injection and SDK generator // SDK generator 'X-SDK-Version', 'X-SDK-Name', @@ -510,7 +521,7 @@ App::setResource('authorization', function () { return new Authorization(); }, []); -App::setResource('dbForProject', function (Group $pools, Database $dbForPlatform, Cache $cache, Document $project, Authorization $authorization) { +App::setResource('dbForProject', function (Group $pools, Database $dbForPlatform, Cache $cache, Document $project, Response $response, Publisher $publisher, Publisher $publisherFunctions, Publisher $publisherWebhooks, Event $queueForEvents, Func $queueForFunctions, Webhook $queueForWebhooks, Realtime $queueForRealtime, StatsUsage $queueForStatsUsage, Authorization $authorization) { if ($project->isEmpty() || $project->getId() === 'console') { return $dbForPlatform; } @@ -526,6 +537,7 @@ App::setResource('dbForProject', function (Group $pools, Database $dbForPlatform $database = new Database($adapter, $cache); $database + ->setDatabase(APP_DATABASE) ->setAuthorization($authorization) ->setMetadata('host', \gethostname()) ->setMetadata('project', $project->getId()) @@ -547,8 +559,209 @@ App::setResource('dbForProject', function (Group $pools, Database $dbForPlatform ->setNamespace('_' . $project->getSequence()); } + /** + * This isolated event handling for `users.*.create` which is based on a `Database::EVENT_DOCUMENT_CREATE` listener may look odd, but it is **intentional**. + * + * Accounts can be created in many ways beyond `createAccount` + * (anonymous, OAuth, phone, etc.), and those flows are probably not covered in event tests; so we handle this here. + */ + $eventDatabaseListener = function (Document $project, Document $document, Response $response, Event $queueForEvents, Func $queueForFunctions, Webhook $queueForWebhooks, Realtime $queueForRealtime) { + // Only trigger events for user creation with the database listener. + if ($document->getCollection() !== 'users') { + return; + } + + $queueForEvents + ->setEvent('users.[userId].create') + ->setParam('userId', $document->getId()) + ->setPayload($response->output($document, Response::MODEL_USER)); + + // Trigger functions, webhooks, and realtime events + $queueForFunctions + ->from($queueForEvents) + ->trigger(); + + + /** Trigger webhooks events only if a project has them enabled */ + if (!empty($project->getAttribute('webhooks'))) { + $queueForWebhooks + ->from($queueForEvents) + ->trigger(); + } + + /** Trigger realtime events only for non console events */ + if ($queueForEvents->getProject()->getId() !== 'console') { + $queueForRealtime + ->from($queueForEvents) + ->trigger(); + } + }; + + /** + * Purge function events cache when functions are created, updated or deleted. + */ + $functionsEventsCacheListener = function (string $event, Document $document, Document $project, Database $dbForProject) { + + + if ($document->getCollection() !== 'functions') { + return; + } + + if ($project->isEmpty() || $project->getId() === 'console') { + return; + } + + $hostname = $dbForProject->getAdapter()->getHostname(); + $cacheKey = \sprintf( + '%s-cache-%s:%s:%s:project:%s:functions:events', + $dbForProject->getCacheName(), + $hostname ?? '', + $dbForProject->getNamespace(), + $dbForProject->getTenant(), + $project->getId() + ); + + $dbForProject->getCache()->purge($cacheKey); + }; + + $usageDatabaseListener = function (string $event, Document $document, StatsUsage $queueForStatsUsage) { + $value = 1; + + switch ($event) { + case Database::EVENT_DOCUMENT_DELETE: + $value = -1; + break; + case Database::EVENT_DOCUMENTS_DELETE: + $value = -1 * $document->getAttribute('modified', 0); + break; + case Database::EVENT_DOCUMENTS_CREATE: + $value = $document->getAttribute('modified', 0); + break; + case Database::EVENT_DOCUMENTS_UPSERT: + $value = $document->getAttribute('created', 0); + break; + } + + switch (true) { + case $document->getCollection() === 'teams': + $queueForStatsUsage->addMetric(METRIC_TEAMS, $value); // per project + break; + case $document->getCollection() === 'users': + $queueForStatsUsage->addMetric(METRIC_USERS, $value); // per project + if ($event === Database::EVENT_DOCUMENT_DELETE) { + $queueForStatsUsage->addReduce($document); + } + break; + case $document->getCollection() === 'sessions': // sessions + $queueForStatsUsage->addMetric(METRIC_SESSIONS, $value); //per project + break; + case $document->getCollection() === 'databases': // databases + $queueForStatsUsage->addMetric(METRIC_DATABASES, $value); // per project + + if ($event === Database::EVENT_DOCUMENT_DELETE) { + $queueForStatsUsage->addReduce($document); + } + break; + case str_starts_with($document->getCollection(), 'database_') && !str_contains($document->getCollection(), 'collection'): //collections + $parts = explode('_', $document->getCollection()); + $databaseInternalId = $parts[1] ?? 0; + $queueForStatsUsage + ->addMetric(METRIC_COLLECTIONS, $value) // per project + ->addMetric(str_replace('{databaseInternalId}', $databaseInternalId, METRIC_DATABASE_ID_COLLECTIONS), $value); + + if ($event === Database::EVENT_DOCUMENT_DELETE) { + $queueForStatsUsage->addReduce($document); + } + break; + case str_starts_with($document->getCollection(), 'database_') && str_contains($document->getCollection(), '_collection_'): //documents + $parts = explode('_', $document->getCollection()); + $databaseInternalId = $parts[1] ?? 0; + $collectionInternalId = $parts[3] ?? 0; + $queueForStatsUsage + ->addMetric(METRIC_DOCUMENTS, $value) // per project + ->addMetric(str_replace('{databaseInternalId}', $databaseInternalId, METRIC_DATABASE_ID_DOCUMENTS), $value) // per database + ->addMetric(str_replace(['{databaseInternalId}', '{collectionInternalId}'], [$databaseInternalId, $collectionInternalId], METRIC_DATABASE_ID_COLLECTION_ID_DOCUMENTS), $value); // per collection + break; + case $document->getCollection() === 'buckets': //buckets + $queueForStatsUsage + ->addMetric(METRIC_BUCKETS, $value); // per project + if ($event === Database::EVENT_DOCUMENT_DELETE) { + $queueForStatsUsage + ->addReduce($document); + } + break; + case str_starts_with($document->getCollection(), 'bucket_'): // files + $parts = explode('_', $document->getCollection()); + $bucketInternalId = $parts[1]; + $queueForStatsUsage + ->addMetric(METRIC_FILES, $value) // per project + ->addMetric(METRIC_FILES_STORAGE, $document->getAttribute('sizeOriginal') * $value) // per project + ->addMetric(str_replace('{bucketInternalId}', $bucketInternalId, METRIC_BUCKET_ID_FILES), $value) // per bucket + ->addMetric(str_replace('{bucketInternalId}', $bucketInternalId, METRIC_BUCKET_ID_FILES_STORAGE), $document->getAttribute('sizeOriginal') * $value); // per bucket + break; + case $document->getCollection() === 'functions': + $queueForStatsUsage + ->addMetric(METRIC_FUNCTIONS, $value); // per project + + if ($event === Database::EVENT_DOCUMENT_DELETE) { + $queueForStatsUsage + ->addReduce($document); + } + break; + case $document->getCollection() === 'sites': + $queueForStatsUsage + ->addMetric(METRIC_SITES, $value); // per project + + if ($event === Database::EVENT_DOCUMENT_DELETE) { + $queueForStatsUsage + ->addReduce($document); + } + break; + case $document->getCollection() === 'deployments': + $queueForStatsUsage + ->addMetric(METRIC_DEPLOYMENTS, $value) // per project + ->addMetric(METRIC_DEPLOYMENTS_STORAGE, $document->getAttribute('size') * $value) // per project + ->addMetric(str_replace(['{resourceType}'], [$document->getAttribute('resourceType')], METRIC_RESOURCE_TYPE_DEPLOYMENTS), $value) // per function + ->addMetric(str_replace(['{resourceType}'], [$document->getAttribute('resourceType')], METRIC_RESOURCE_TYPE_DEPLOYMENTS_STORAGE), $document->getAttribute('size') * $value) + ->addMetric(str_replace(['{resourceType}', '{resourceInternalId}'], [$document->getAttribute('resourceType'), $document->getAttribute('resourceInternalId')], METRIC_RESOURCE_TYPE_ID_DEPLOYMENTS), $value) // per function + ->addMetric(str_replace(['{resourceType}', '{resourceInternalId}'], [$document->getAttribute('resourceType'), $document->getAttribute('resourceInternalId')], METRIC_RESOURCE_TYPE_ID_DEPLOYMENTS_STORAGE), $document->getAttribute('size') * $value); + break; + default: + break; + } + }; + + // Clone the queues, to prevent events triggered by the database listener + // from overwriting the events that are supposed to be triggered in the shutdown hook. + $queueForEventsClone = new Event($publisher); + $queueForFunctions = new Func($publisherFunctions); + $queueForWebhooks = new Webhook($publisherWebhooks); + $queueForRealtime = new Realtime(); + + + $database + ->on(Database::EVENT_DOCUMENT_CREATE, 'calculate-usage', fn ($event, $document) => $usageDatabaseListener($event, $document, $queueForStatsUsage)) + ->on(Database::EVENT_DOCUMENT_DELETE, 'calculate-usage', fn ($event, $document) => $usageDatabaseListener($event, $document, $queueForStatsUsage)) + ->on(Database::EVENT_DOCUMENTS_CREATE, 'calculate-usage', fn ($event, $document) => $usageDatabaseListener($event, $document, $queueForStatsUsage)) + ->on(Database::EVENT_DOCUMENTS_DELETE, 'calculate-usage', fn ($event, $document) => $usageDatabaseListener($event, $document, $queueForStatsUsage)) + ->on(Database::EVENT_DOCUMENTS_UPSERT, 'calculate-usage', fn ($event, $document) => $usageDatabaseListener($event, $document, $queueForStatsUsage)) + ->on(Database::EVENT_DOCUMENT_CREATE, 'create-trigger-events', fn ($event, $document) => $eventDatabaseListener( + $project, + $document, + $response, + $queueForEventsClone->from($queueForEvents), + $queueForFunctions->from($queueForEvents), + $queueForWebhooks->from($queueForEvents), + $queueForRealtime->from($queueForEvents) + )) + ->on(Database::EVENT_DOCUMENT_CREATE, 'purge-function-events-cache', fn ($event, $document) => $functionsEventsCacheListener($event, $document, $project, $database)) + ->on(Database::EVENT_DOCUMENT_UPDATE, 'purge-function-events-cache', fn ($event, $document) => $functionsEventsCacheListener($event, $document, $project, $database)) + ->on(Database::EVENT_DOCUMENT_DELETE, 'purge-function-events-cache', fn ($event, $document) => $functionsEventsCacheListener($event, $document, $project, $database)) + ; + + return $database; -}, ['pools', 'dbForPlatform', 'cache', 'project', 'authorization']); +}, ['pools', 'dbForPlatform', 'cache', 'project', 'response', 'publisher', 'publisherFunctions', 'publisherWebhooks', 'queueForEvents', 'queueForFunctions', 'queueForWebhooks', 'queueForRealtime', 'queueForStatsUsage', 'authorization']); App::setResource('dbForPlatform', function (Group $pools, Cache $cache, Authorization $authorization) { @@ -556,6 +769,7 @@ App::setResource('dbForPlatform', function (Group $pools, Cache $cache, Authoriz $database = new Database($adapter, $cache); $database + ->setDatabase(APP_DATABASE) ->setAuthorization($authorization) ->setNamespace('_console') ->setMetadata('host', \gethostname()) @@ -585,6 +799,7 @@ App::setResource('getProjectDB', function (Group $pools, Database $dbForPlatform $configure = (function (Database $database) use ($project, $dsn, $authorization) { $database + ->setDatabase(APP_DATABASE) ->setAuthorization($authorization) ->setMetadata('host', \gethostname()) ->setMetadata('project', $project->getId()) @@ -636,6 +851,7 @@ App::setResource('getLogsDB', function (Group $pools, Cache $cache, Authorizatio $database = new Database($adapter, $cache); $database + ->setDatabase(APP_DATABASE) ->setAuthorization($authorization) ->setSharedTables(true) ->setNamespace('logsV1') @@ -651,6 +867,11 @@ App::setResource('getLogsDB', function (Group $pools, Cache $cache, Authorizatio }; }, ['pools', 'cache', 'authorization']); +App::setResource('audit', function ($dbForProject) { + $adapter = new AdapterDatabase($dbForProject); + return new Audit($adapter); +}, ['dbForProject']); + App::setResource('telemetry', fn () => new NoTelemetry()); App::setResource('cache', function (Group $pools, Telemetry $telemetry) { @@ -1140,3 +1361,11 @@ App::setResource('resourceToken', function ($project, $dbForProject, $request, A App::setResource('transactionState', function (Database $dbForProject, Authorization $authorization) { return new TransactionState($dbForProject, $authorization); }, ['dbForProject', 'authorization']); + +App::setResource('executionsRetentionCount', function (Document $project, array $plan) { + if ($project->getId() === 'console' || empty($plan)) { + return 0; + } + + return (int) ($plan['executionsRetentionCount'] ?? 100); +}, ['project', 'plan']); diff --git a/app/realtime.php b/app/realtime.php index 31e6015d92..eded4d79bc 100644 --- a/app/realtime.php +++ b/app/realtime.php @@ -29,6 +29,7 @@ use Utopia\Database\Adapter\Pool as DatabasePool; use Utopia\Database\Database; use Utopia\Database\DateTime; use Utopia\Database\Document; +use Utopia\Database\Exception\Query as QueryException; use Utopia\Database\Helpers\ID; use Utopia\Database\Helpers\Role; use Utopia\Database\Query; @@ -66,6 +67,7 @@ if (!function_exists('getConsoleDB')) { $adapter = new DatabasePool($pools->get('console')); $database = new Database($adapter, getCache()); $database + ->setDatabase(APP_DATABASE) ->setNamespace('_console') ->setMetadata('host', \gethostname()) ->setMetadata('project', '_console'); @@ -122,6 +124,7 @@ if (!function_exists('getProjectDB')) { } $database + ->setDatabase(APP_DATABASE) ->setMetadata('host', \gethostname()) ->setMetadata('project', $project->getId()); @@ -471,9 +474,10 @@ $server->onWorkerStart(function (int $workerId) use ($server, $register, $stats, $roles = $user->getRoles($database->getAuthorization()); $channels = $realtime->connections[$connection]['channels']; + $queries = $realtime->connections[$connection]['queries'] ?? []; $realtime->unsubscribe($connection); - $realtime->subscribe($projectId, $connection, $roles, $channels); + $realtime->subscribe($projectId, $connection, $roles, $channels, $queries); } } @@ -576,6 +580,11 @@ $server->onOpen(function (int $connection, SwooleRequest $request) use ($server, $roles = $user->getRoles($authorization); $channels = Realtime::convertChannels($request->getQuery('channels', []), $user->getId()); + try { + $queries = Realtime::convertQueries($request->getQuery('queries', [])); + } catch (QueryException $e) { + throw new Exception(Exception::REALTIME_POLICY_VIOLATION, $e->getMessage()); + } /** * Channels Check @@ -584,7 +593,7 @@ $server->onOpen(function (int $connection, SwooleRequest $request) use ($server, throw new Exception(Exception::REALTIME_POLICY_VIOLATION, 'Missing channels'); } - $realtime->subscribe($project->getId(), $connection, $roles, $channels); + $realtime->subscribe($project->getId(), $connection, $roles, $channels, $queries); $realtime->connections[$connection]['authorization'] = $authorization; @@ -594,6 +603,7 @@ $server->onOpen(function (int $connection, SwooleRequest $request) use ($server, 'type' => 'connected', 'data' => [ 'channels' => array_keys($channels), + 'queries' => $queries, 'user' => $user ] ])); @@ -728,7 +738,8 @@ $server->onMessage(function (int $connection, string $message) use ($server, $re // Preserve authorization before subscribe overwrites the connection array $authorization = $realtime->connections[$connection]['authorization'] ?? null; - $realtime->subscribe($realtime->connections[$connection]['projectId'], $connection, $roles, $channels); + $queries = $realtime->connections[$connection]['queries']; + $realtime->subscribe($realtime->connections[$connection]['projectId'], $connection, $roles, $channels, $queries); // Restore authorization after subscribe if ($authorization !== null) { diff --git a/app/views/install/compose.phtml b/app/views/install/compose.phtml index 34e0aee1ae..16af33ca3a 100644 --- a/app/views/install/compose.phtml +++ b/app/views/install/compose.phtml @@ -11,6 +11,7 @@ $httpsPort = $this->getParam('httpsPort', ''); $version = $this->getParam('version', ''); $organization = $this->getParam('organization', ''); $image = $this->getParam('image', ''); +$enableAssistant = $this->getParam('enableAssistant', false); ?>services: traefik: image: traefik:2.11 @@ -164,6 +165,7 @@ $image = $this->getParam('image', ''); - _APP_MAINTENANCE_RETENTION_SCHEDULES - _APP_SMS_PROVIDER - _APP_SMS_FROM + - _APP_GRAPHQL_INTROSPECTION - _APP_GRAPHQL_MAX_BATCH_SIZE - _APP_GRAPHQL_MAX_COMPLEXITY - _APP_GRAPHQL_MAX_DEPTH @@ -179,7 +181,7 @@ $image = $this->getParam('image', ''); appwrite-console: <<: *x-logging container_name: appwrite-console - image: /console:7.4.7 + image: /console:7.5.7 restart: unless-stopped networks: - appwrite @@ -848,6 +850,7 @@ $image = $this->getParam('image', ''); - _APP_DB_USER - _APP_DB_PASS + appwrite-assistant: image: appwrite/assistant:0.8.4 container_name: appwrite-assistant @@ -857,6 +860,7 @@ $image = $this->getParam('image', ''); - appwrite environment: - _APP_ASSISTANT_OPENAI_API_KEY + appwrite-browser: image: appwrite/browser:0.3.2 diff --git a/app/worker.php b/app/worker.php index 7bf184afda..39f0695bb3 100644 --- a/app/worker.php +++ b/app/worker.php @@ -14,6 +14,7 @@ use Appwrite\Event\Mail; use Appwrite\Event\Messaging; use Appwrite\Event\Migration; use Appwrite\Event\Realtime; +use Appwrite\Event\Screenshot; use Appwrite\Event\StatsUsage; use Appwrite\Event\Webhook; use Appwrite\Platform\Appwrite; @@ -21,6 +22,8 @@ use Appwrite\Utopia\Database\Documents\User; use Executor\Executor; use Swoole\Runtime; use Utopia\Abuse\Adapters\TimeLimit\Redis as TimeLimitRedis; +use Utopia\Audit\Adapter\Database as AdapterDatabase; +use Utopia\Audit\Audit as UtopiaAudit; use Utopia\Cache\Adapter\Pool as CachePool; use Utopia\Cache\Adapter\Sharding; use Utopia\Cache\Cache; @@ -62,6 +65,7 @@ Server::setResource('dbForPlatform', function (Cache $cache, Registry $register, $dbForPlatform = new Database($adapter, $cache); $dbForPlatform + ->setDatabase(APP_DATABASE) ->setAuthorization($authorization) ->setNamespace('_console') ->setDocumentType('users', User::class) @@ -115,6 +119,7 @@ Server::setResource('dbForProject', function (Cache $cache, Registry $register, } $database + ->setDatabase(APP_DATABASE) ->setAuthorization($authorization) ->setTimeout(APP_DATABASE_TIMEOUT_MILLISECONDS_WORKER); @@ -176,6 +181,7 @@ Server::setResource('getProjectDB', function (Group $pools, Database $dbForPlatf } $database + ->setDatabase(APP_DATABASE) ->setAuthorization($authorization) ->setTimeout(APP_DATABASE_TIMEOUT_MILLISECONDS_WORKER); @@ -195,6 +201,7 @@ Server::setResource('getLogsDB', function (Group $pools, Cache $cache, Authoriza $database = new Database($adapter, $cache); $database + ->setDatabase(APP_DATABASE) ->setAuthorization($authorization) ->setSharedTables(true) ->setNamespace('logsV1') @@ -321,6 +328,10 @@ Server::setResource('queueForBuilds', function (Publisher $publisher) { return new Build($publisher); }, ['publisher']); +Server::setResource('queueForScreenshots', function (Publisher $publisher) { + return new Screenshot($publisher); +}, ['publisher']); + Server::setResource('queueForDeletes', function (Publisher $publisher) { return new Delete($publisher); }, ['publisher']); @@ -466,6 +477,27 @@ Server::setResource('logError', function (Registry $register, Document $project) Server::setResource('executor', fn () => new Executor()); +Server::setResource('getAudit', function (Database $dbForPlatform, callable $getProjectDB) { + return function (Document $project) use ($dbForPlatform, $getProjectDB) { + if ($project->isEmpty() || $project->getId() === 'console') { + $adapter = new AdapterDatabase($dbForPlatform); + return new UtopiaAudit($adapter); + } + + $dbForProject = $getProjectDB($project); + $adapter = new AdapterDatabase($dbForProject); + return new UtopiaAudit($adapter); + }; +}, ['dbForPlatform', 'getProjectDB']); + +Server::setResource('executionsRetentionCount', function (Document $project, array $plan) { + if ($project->getId() === 'console' || empty($plan)) { + return 0; + } + + return (int) ($plan['executionsRetentionCount'] ?? 100); +}, ['project', 'plan']); + $pools = $register->get('pools'); $platform = new Appwrite(); $args = $platform->getEnv('argv'); @@ -546,9 +578,4 @@ $worker Console::error('[Error] Line: ' . $error->getLine()); }); -$worker->workerStart() - ->action(function () use ($workerName) { - Console::info("Worker $workerName started"); - }); - $worker->start(); diff --git a/bin/doctor b/bin/doctor index b2a4547156..16a693381c 100755 --- a/bin/doctor +++ b/bin/doctor @@ -1,3 +1,3 @@ #!/bin/sh -php /usr/src/code/app/cli.php doctor $@ \ No newline at end of file +exec php /usr/src/code/app/cli.php doctor "$@" diff --git a/bin/install b/bin/install index e669e91e6b..115f088014 100755 --- a/bin/install +++ b/bin/install @@ -1,3 +1,3 @@ #!/bin/sh -php /usr/src/code/app/cli.php install $@ \ No newline at end of file +exec php /usr/src/code/app/cli.php install "$@" \ No newline at end of file diff --git a/bin/interval b/bin/interval new file mode 100644 index 0000000000..c7afa68c51 --- /dev/null +++ b/bin/interval @@ -0,0 +1,3 @@ +#!/bin/sh + +exec php /usr/src/code/app/cli.php interval "$@" \ No newline at end of file diff --git a/bin/maintenance b/bin/maintenance index 099551cb32..2311a834e0 100644 --- a/bin/maintenance +++ b/bin/maintenance @@ -1,3 +1,3 @@ #!/bin/sh -php /usr/src/code/app/cli.php maintenance $@ \ No newline at end of file +exec php /usr/src/code/app/cli.php maintenance "$@" \ No newline at end of file diff --git a/bin/migrate b/bin/migrate index 28ebbd19e7..6527f1f8f8 100755 --- a/bin/migrate +++ b/bin/migrate @@ -1,3 +1,3 @@ #!/bin/sh -php /usr/src/code/app/cli.php migrate $@ \ No newline at end of file +exec php /usr/src/code/app/cli.php migrate "$@" \ No newline at end of file diff --git a/bin/queue-count-failed b/bin/queue-count-failed index ca8f2b4291..904514e4c2 100644 --- a/bin/queue-count-failed +++ b/bin/queue-count-failed @@ -1,3 +1,3 @@ #!/bin/sh -php /usr/src/code/app/cli.php queue-count --type=failed $@ \ No newline at end of file +exec php /usr/src/code/app/cli.php queue-count --type=failed "$@" \ No newline at end of file diff --git a/bin/queue-count-processing b/bin/queue-count-processing index 325d86111d..2bc906d3d0 100644 --- a/bin/queue-count-processing +++ b/bin/queue-count-processing @@ -1,3 +1,3 @@ #!/bin/sh -php /usr/src/code/app/cli.php queue-count --type=processing $@ \ No newline at end of file +exec php /usr/src/code/app/cli.php queue-count --type=processing "$@" \ No newline at end of file diff --git a/bin/queue-count-success b/bin/queue-count-success index 34fc54b4c1..71cafa990b 100644 --- a/bin/queue-count-success +++ b/bin/queue-count-success @@ -1,3 +1,3 @@ #!/bin/sh -php /usr/src/code/app/cli.php queue-count --type=success $@ \ No newline at end of file +exec php /usr/src/code/app/cli.php queue-count --type=success "$@" \ No newline at end of file diff --git a/bin/queue-retry b/bin/queue-retry index f9473e6b07..357917915d 100644 --- a/bin/queue-retry +++ b/bin/queue-retry @@ -1,3 +1,3 @@ #!/bin/sh -php /usr/src/code/app/cli.php queue-retry $@ \ No newline at end of file +exec php /usr/src/code/app/cli.php queue-retry "$@" \ No newline at end of file diff --git a/bin/realtime b/bin/realtime index e43dc269e0..2022808e2a 100644 --- a/bin/realtime +++ b/bin/realtime @@ -1,3 +1,3 @@ #!/bin/sh -php /usr/src/code/app/realtime.php $@ \ No newline at end of file +exec php /usr/src/code/app/realtime.php "$@" \ No newline at end of file diff --git a/bin/schedule-executions b/bin/schedule-executions index f239cad206..b15fad0e69 100644 --- a/bin/schedule-executions +++ b/bin/schedule-executions @@ -1,3 +1,3 @@ #!/bin/sh -php /usr/src/code/app/cli.php schedule-executions $@ \ No newline at end of file +exec php /usr/src/code/app/cli.php schedule-executions "$@" \ No newline at end of file diff --git a/bin/schedule-functions b/bin/schedule-functions index 10edbe8226..3183b24351 100644 --- a/bin/schedule-functions +++ b/bin/schedule-functions @@ -1,3 +1,3 @@ #!/bin/sh -php /usr/src/code/app/cli.php schedule-functions $@ \ No newline at end of file +exec php /usr/src/code/app/cli.php schedule-functions "$@" \ No newline at end of file diff --git a/bin/schedule-messages b/bin/schedule-messages index fa7219f6ea..08f7c7b5f5 100644 --- a/bin/schedule-messages +++ b/bin/schedule-messages @@ -1,3 +1,3 @@ #!/bin/sh -php /usr/src/code/app/cli.php schedule-messages $@ \ No newline at end of file +exec php /usr/src/code/app/cli.php schedule-messages "$@" \ No newline at end of file diff --git a/bin/screenshot b/bin/screenshot index 4d8ceb998f..ee6f0932cc 100755 --- a/bin/screenshot +++ b/bin/screenshot @@ -1,3 +1,3 @@ #!/bin/sh -php /usr/src/code/app/cli.php screenshot $@ \ No newline at end of file +exec php /usr/src/code/app/cli.php screenshot "$@" \ No newline at end of file diff --git a/bin/sdks b/bin/sdks index ab73414829..f5ae6a186d 100644 --- a/bin/sdks +++ b/bin/sdks @@ -1,3 +1,3 @@ #!/bin/sh -php /usr/src/code/app/cli.php sdks $@ \ No newline at end of file +exec php /usr/src/code/app/cli.php sdks "$@" \ No newline at end of file diff --git a/bin/specs b/bin/specs index e77d1487d4..ffc0fc22e8 100644 --- a/bin/specs +++ b/bin/specs @@ -1,3 +1,3 @@ #!/bin/sh -php /usr/src/code/app/cli.php specs $@ \ No newline at end of file +exec php /usr/src/code/app/cli.php specs "$@" \ No newline at end of file diff --git a/bin/ssl b/bin/ssl index 83dcf6a026..99748bb27d 100755 --- a/bin/ssl +++ b/bin/ssl @@ -1,3 +1,3 @@ #!/bin/sh -php /usr/src/code/app/cli.php ssl $@ \ No newline at end of file +exec php /usr/src/code/app/cli.php ssl "$@" \ No newline at end of file diff --git a/bin/stats-resources b/bin/stats-resources index 3104bab896..622a3b2b05 100644 --- a/bin/stats-resources +++ b/bin/stats-resources @@ -1,3 +1,3 @@ #!/bin/sh -php /usr/src/code/app/cli.php stats-resources $@ \ No newline at end of file +exec php /usr/src/code/app/cli.php stats-resources "$@" \ No newline at end of file diff --git a/bin/test b/bin/test index a2153fc536..0c0ec83efe 100755 --- a/bin/test +++ b/bin/test @@ -1,3 +1,3 @@ #!/bin/sh -/usr/src/code/vendor/bin/phpunit --configuration /usr/src/code/phpunit.xml $@ \ No newline at end of file +exec /usr/src/code/vendor/bin/phpunit --configuration /usr/src/code/phpunit.xml "$@" \ No newline at end of file diff --git a/bin/upgrade b/bin/upgrade index ce32b9ca30..df5f60216b 100755 --- a/bin/upgrade +++ b/bin/upgrade @@ -1,3 +1,3 @@ #!/bin/sh -php /usr/src/code/app/cli.php upgrade $@ \ No newline at end of file +exec php /usr/src/code/app/cli.php upgrade "$@" \ No newline at end of file diff --git a/bin/vars b/bin/vars index 19e3f1ebf2..d7bb615117 100644 --- a/bin/vars +++ b/bin/vars @@ -1,3 +1,3 @@ #!/bin/sh -php /usr/src/code/app/cli.php vars $@ \ No newline at end of file +exec php /usr/src/code/app/cli.php vars "$@" \ No newline at end of file diff --git a/bin/worker-audits b/bin/worker-audits index 3df65d65e8..b7eb47f417 100644 --- a/bin/worker-audits +++ b/bin/worker-audits @@ -1,3 +1,3 @@ #!/bin/sh -php /usr/src/code/app/worker.php audits $@ \ No newline at end of file +exec php /usr/src/code/app/worker.php audits "$@" \ No newline at end of file diff --git a/bin/worker-builds b/bin/worker-builds index 3400111cb5..a646625678 100644 --- a/bin/worker-builds +++ b/bin/worker-builds @@ -1,3 +1,3 @@ #!/bin/sh -php /usr/src/code/app/worker.php builds $@ \ No newline at end of file +exec php /usr/src/code/app/worker.php builds "$@" \ No newline at end of file diff --git a/bin/worker-certificates b/bin/worker-certificates index 901688c4c8..33be1a3c9b 100755 --- a/bin/worker-certificates +++ b/bin/worker-certificates @@ -1,3 +1,3 @@ #!/bin/sh -php /usr/src/code/app/worker.php certificates $@ \ No newline at end of file +exec php /usr/src/code/app/worker.php certificates "$@" \ No newline at end of file diff --git a/bin/worker-databases b/bin/worker-databases index 61e09aa9f1..32822ed068 100644 --- a/bin/worker-databases +++ b/bin/worker-databases @@ -1,3 +1,3 @@ #!/bin/sh -php /usr/src/code/app/worker.php databases $@ +exec php /usr/src/code/app/worker.php databases "$@" diff --git a/bin/worker-deletes b/bin/worker-deletes index 7c9793e6cb..00c216f2e9 100644 --- a/bin/worker-deletes +++ b/bin/worker-deletes @@ -1,3 +1,3 @@ #!/bin/sh -php /usr/src/code/app/worker.php deletes $@ \ No newline at end of file +exec php /usr/src/code/app/worker.php deletes "$@" \ No newline at end of file diff --git a/bin/worker-functions b/bin/worker-functions index 4757b1b72a..c24cb08821 100644 --- a/bin/worker-functions +++ b/bin/worker-functions @@ -1,3 +1,3 @@ #!/bin/sh -php /usr/src/code/app/worker.php functions $@ \ No newline at end of file +exec php /usr/src/code/app/worker.php functions "$@" \ No newline at end of file diff --git a/bin/worker-mails b/bin/worker-mails index fee8a96da7..3b1415f45f 100644 --- a/bin/worker-mails +++ b/bin/worker-mails @@ -1,3 +1,3 @@ #!/bin/sh -php /usr/src/code/app/worker.php mails $@ \ No newline at end of file +exec php /usr/src/code/app/worker.php mails "$@" \ No newline at end of file diff --git a/bin/worker-messaging b/bin/worker-messaging index e6edf80f06..34e85ac485 100644 --- a/bin/worker-messaging +++ b/bin/worker-messaging @@ -1,3 +1,3 @@ #!/bin/sh -php /usr/src/code/app/worker.php messaging $@ \ No newline at end of file +exec php /usr/src/code/app/worker.php messaging "$@" \ No newline at end of file diff --git a/bin/worker-migrations b/bin/worker-migrations index 32d4aef468..3fa669edc6 100644 --- a/bin/worker-migrations +++ b/bin/worker-migrations @@ -1,3 +1,3 @@ #!/bin/sh -php /usr/src/code/app/worker.php migrations $@ \ No newline at end of file +exec php /usr/src/code/app/worker.php migrations "$@" \ No newline at end of file diff --git a/bin/worker-screenshots b/bin/worker-screenshots new file mode 100644 index 0000000000..0252556075 --- /dev/null +++ b/bin/worker-screenshots @@ -0,0 +1,3 @@ +#!/bin/sh + +exec php /usr/src/code/app/worker.php screenshots "$@" \ No newline at end of file diff --git a/bin/worker-stats-resources b/bin/worker-stats-resources index 9c5d2bebff..44bfa6e15f 100644 --- a/bin/worker-stats-resources +++ b/bin/worker-stats-resources @@ -1,3 +1,3 @@ #!/bin/sh -php /usr/src/code/app/worker.php stats-resources $@ \ No newline at end of file +exec php /usr/src/code/app/worker.php stats-resources "$@" \ No newline at end of file diff --git a/bin/worker-stats-usage b/bin/worker-stats-usage index 2c267d805e..544ea71ee3 100644 --- a/bin/worker-stats-usage +++ b/bin/worker-stats-usage @@ -1,3 +1,3 @@ #!/bin/sh -php /usr/src/code/app/worker.php stats-usage $@ \ No newline at end of file +exec php /usr/src/code/app/worker.php stats-usage "$@" \ No newline at end of file diff --git a/bin/worker-webhooks b/bin/worker-webhooks index 93f8027a81..e3c9e9471e 100644 --- a/bin/worker-webhooks +++ b/bin/worker-webhooks @@ -1,3 +1,3 @@ #!/bin/sh -php /usr/src/code/app/worker.php webhooks $@ \ No newline at end of file +exec php /usr/src/code/app/worker.php webhooks "$@" \ No newline at end of file diff --git a/composer.json b/composer.json index e0e763588a..f5bab03697 100644 --- a/composer.json +++ b/composer.json @@ -47,32 +47,32 @@ "appwrite/php-clamav": "2.0.*", "utopia-php/abuse": "1.*", "utopia-php/analytics": "0.10.*", - "utopia-php/audit": "1.*", + "utopia-php/audit": "2.*", "utopia-php/auth": "0.5.*", "utopia-php/cache": "0.13.*", "utopia-php/cli": "0.15.*", - "utopia-php/config": "1.*.*", + "utopia-php/config": "1.*", "utopia-php/database": "4.*", "utopia-php/detector": "0.2.*", - "utopia-php/domains": "0.9.*", + "utopia-php/domains": "0.11.*", "utopia-php/emails": "0.6.*", - "utopia-php/dns": "1.4.*", + "utopia-php/dns": "1.5.*", "utopia-php/dsn": "0.2.1", "utopia-php/framework": "0.33.*", - "utopia-php/fetch": "0.4.*", + "utopia-php/fetch": "0.5.*", "utopia-php/image": "0.8.*", "utopia-php/locale": "0.8.*", "utopia-php/logger": "0.6.*", "utopia-php/messaging": "0.20.*", - "utopia-php/migration": "1.3.*", + "utopia-php/migration": "1.*", "utopia-php/orchestration": "0.9.*", "utopia-php/platform": "0.7.*", "utopia-php/pools": "0.8.*", "utopia-php/preloader": "0.2.*", - "utopia-php/queue": "0.11.*", + "utopia-php/queue": "0.15.*", "utopia-php/registry": "0.5.*", "utopia-php/storage": "0.18.*", - "utopia-php/swoole": "0.8.*", + "utopia-php/swoole": "1.*", "utopia-php/system": "0.9.*", "utopia-php/telemetry": "0.1.*", "utopia-php/vcs": "0.13.*", diff --git a/composer.lock b/composer.lock index 0ac488570a..662623c701 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "99b8126a83fa0cb257df7c34ff2fdef5", + "content-hash": "33da844fdf5648d1d1a027dfb6ae42bc", "packages": [ { "name": "adhocore/jwt", @@ -69,16 +69,16 @@ }, { "name": "appwrite/appwrite", - "version": "15.1.0", + "version": "19.1.0", "source": { "type": "git", "url": "https://github.com/appwrite/sdk-for-php.git", - "reference": "c438b3885071ac7c0329199dce5e6f6a24dd215b" + "reference": "8738e812062f899c85b2598eef43d6a247f08a56" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/appwrite/sdk-for-php/zipball/c438b3885071ac7c0329199dce5e6f6a24dd215b", - "reference": "c438b3885071ac7c0329199dce5e6f6a24dd215b", + "url": "https://api.github.com/repos/appwrite/sdk-for-php/zipball/8738e812062f899c85b2598eef43d6a247f08a56", + "reference": "8738e812062f899c85b2598eef43d6a247f08a56", "shasum": "" }, "require": { @@ -87,7 +87,7 @@ "php": ">=7.1.0" }, "require-dev": { - "mockery/mockery": "^1.6.6", + "mockery/mockery": "^1.6.12", "phpunit/phpunit": "^10" }, "type": "library", @@ -104,10 +104,10 @@ "support": { "email": "team@appwrite.io", "issues": "https://github.com/appwrite/sdk-for-php/issues", - "source": "https://github.com/appwrite/sdk-for-php/tree/15.1.0", + "source": "https://github.com/appwrite/sdk-for-php/tree/19.1.0", "url": "https://appwrite.io/support" }, - "time": "2025-08-01T04:50:51+00:00" + "time": "2025-12-18T08:07:43+00:00" }, { "name": "appwrite/php-clamav", @@ -756,16 +756,16 @@ }, { "name": "google/protobuf", - "version": "v4.33.2", + "version": "v4.33.4", "source": { "type": "git", "url": "https://github.com/protocolbuffers/protobuf-php.git", - "reference": "fbd96b7bf1343f4b0d8fb358526c7ba4d72f1318" + "reference": "22d28025cda0d223a2e48c2e16c5284ecc9f5402" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/fbd96b7bf1343f4b0d8fb358526c7ba4d72f1318", - "reference": "fbd96b7bf1343f4b0d8fb358526c7ba4d72f1318", + "url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/22d28025cda0d223a2e48c2e16c5284ecc9f5402", + "reference": "22d28025cda0d223a2e48c2e16c5284ecc9f5402", "shasum": "" }, "require": { @@ -794,9 +794,71 @@ "proto" ], "support": { - "source": "https://github.com/protocolbuffers/protobuf-php/tree/v4.33.2" + "source": "https://github.com/protocolbuffers/protobuf-php/tree/v4.33.4" }, - "time": "2025-12-05T22:12:22+00:00" + "time": "2026-01-12T17:58:43+00:00" + }, + { + "name": "halaxa/json-machine", + "version": "1.2.6", + "source": { + "type": "git", + "url": "https://github.com/halaxa/json-machine.git", + "reference": "8bf0b0ff6ff60ab480778eaa5ad7d505b442c2d4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/halaxa/json-machine/zipball/8bf0b0ff6ff60ab480778eaa5ad7d505b442c2d4", + "reference": "8bf0b0ff6ff60ab480778eaa5ad7d505b442c2d4", + "shasum": "" + }, + "require": { + "php": "7.2 - 8.5" + }, + "require-dev": { + "ext-json": "*", + "friendsofphp/php-cs-fixer": "^3.0", + "phpstan/phpstan": "^1.10", + "phpunit/phpunit": "^8.0" + }, + "suggest": { + "ext-json": "To run JSON Machine out of the box without custom decoders.", + "guzzlehttp/guzzle": "To run example with GuzzleHttp" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions.php" + ], + "psr-4": { + "JsonMachine\\": "src/" + }, + "exclude-from-classmap": [ + "src/autoloader.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Filip Halaxa", + "email": "filip@halaxa.cz" + } + ], + "description": "Efficient, easy-to-use and fast JSON pull parser", + "support": { + "issues": "https://github.com/halaxa/json-machine/issues", + "source": "https://github.com/halaxa/json-machine/tree/1.2.6" + }, + "funding": [ + { + "url": "https://ko-fi.com/G2G57KTE4", + "type": "other" + } + ], + "time": "2025-12-05T14:53:09+00:00" }, { "name": "league/csv", @@ -1236,16 +1298,16 @@ }, { "name": "open-telemetry/api", - "version": "1.7.1", + "version": "1.8.0", "source": { "type": "git", "url": "https://github.com/opentelemetry-php/api.git", - "reference": "45bda7efa8fcdd9bdb0daa2f26c8e31f062f49d4" + "reference": "df5197c6fd0ddd8e9883b87de042d9341300e2ad" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/api/zipball/45bda7efa8fcdd9bdb0daa2f26c8e31f062f49d4", - "reference": "45bda7efa8fcdd9bdb0daa2f26c8e31f062f49d4", + "url": "https://api.github.com/repos/opentelemetry-php/api/zipball/df5197c6fd0ddd8e9883b87de042d9341300e2ad", + "reference": "df5197c6fd0ddd8e9883b87de042d9341300e2ad", "shasum": "" }, "require": { @@ -1255,7 +1317,7 @@ "symfony/polyfill-php82": "^1.26" }, "conflict": { - "open-telemetry/sdk": "<=1.0.8" + "open-telemetry/sdk": "<=1.11" }, "type": "library", "extra": { @@ -1302,7 +1364,7 @@ "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2025-10-19T10:49:48+00:00" + "time": "2026-01-21T04:14:03+00:00" }, { "name": "open-telemetry/context", @@ -1365,16 +1427,16 @@ }, { "name": "open-telemetry/exporter-otlp", - "version": "1.3.3", + "version": "1.3.4", "source": { "type": "git", "url": "https://github.com/opentelemetry-php/exporter-otlp.git", - "reference": "07b02bc71838463f6edcc78d3485c04b48fb263d" + "reference": "62e680d587beb42e5247aa6ecd89ad1ca406e8ca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/exporter-otlp/zipball/07b02bc71838463f6edcc78d3485c04b48fb263d", - "reference": "07b02bc71838463f6edcc78d3485c04b48fb263d", + "url": "https://api.github.com/repos/opentelemetry-php/exporter-otlp/zipball/62e680d587beb42e5247aa6ecd89ad1ca406e8ca", + "reference": "62e680d587beb42e5247aa6ecd89ad1ca406e8ca", "shasum": "" }, "require": { @@ -1425,7 +1487,7 @@ "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2025-11-13T08:04:37+00:00" + "time": "2026-01-15T09:31:34+00:00" }, { "name": "open-telemetry/gen-otlp-protobuf", @@ -1492,16 +1554,16 @@ }, { "name": "open-telemetry/sdk", - "version": "1.10.0", + "version": "1.12.0", "source": { "type": "git", "url": "https://github.com/opentelemetry-php/sdk.git", - "reference": "3dfc3d1ad729ec7eb25f1b9a4ae39fe779affa99" + "reference": "7f1bd524465c1ca42755a9ef1143ba09913f5be0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/sdk/zipball/3dfc3d1ad729ec7eb25f1b9a4ae39fe779affa99", - "reference": "3dfc3d1ad729ec7eb25f1b9a4ae39fe779affa99", + "url": "https://api.github.com/repos/opentelemetry-php/sdk/zipball/7f1bd524465c1ca42755a9ef1143ba09913f5be0", + "reference": "7f1bd524465c1ca42755a9ef1143ba09913f5be0", "shasum": "" }, "require": { @@ -1542,7 +1604,7 @@ ] }, "branch-alias": { - "dev-main": "1.9.x-dev" + "dev-main": "1.12.x-dev" } }, "autoload": { @@ -1585,20 +1647,20 @@ "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2025-11-25T10:59:15+00:00" + "time": "2026-01-21T04:14:03+00:00" }, { "name": "open-telemetry/sem-conv", - "version": "1.37.0", + "version": "1.38.0", "source": { "type": "git", "url": "https://github.com/opentelemetry-php/sem-conv.git", - "reference": "8da7ec497c881e39afa6657d72586e27efbd29a1" + "reference": "e613bc640a407def4991b8a936a9b27edd9a3240" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/sem-conv/zipball/8da7ec497c881e39afa6657d72586e27efbd29a1", - "reference": "8da7ec497c881e39afa6657d72586e27efbd29a1", + "url": "https://api.github.com/repos/opentelemetry-php/sem-conv/zipball/e613bc640a407def4991b8a936a9b27edd9a3240", + "reference": "e613bc640a407def4991b8a936a9b27edd9a3240", "shasum": "" }, "require": { @@ -1638,11 +1700,11 @@ ], "support": { "chat": "https://app.slack.com/client/T08PSQ7BQ/C01NFPCV44V", - "docs": "https://opentelemetry.io/docs/php", + "docs": "https://opentelemetry.io/docs/languages/php", "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2025-09-03T12:08:10+00:00" + "time": "2026-01-21T04:14:03+00:00" }, { "name": "paragonie/constant_time_encoding", @@ -2673,16 +2735,16 @@ }, { "name": "symfony/http-client", - "version": "v7.4.1", + "version": "v7.4.4", "source": { "type": "git", "url": "https://github.com/symfony/http-client.git", - "reference": "26cc224ea7103dda90e9694d9e139a389092d007" + "reference": "d63c23357d74715a589454c141c843f0172bec6c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client/zipball/26cc224ea7103dda90e9694d9e139a389092d007", - "reference": "26cc224ea7103dda90e9694d9e139a389092d007", + "url": "https://api.github.com/repos/symfony/http-client/zipball/d63c23357d74715a589454c141c843f0172bec6c", + "reference": "d63c23357d74715a589454c141c843f0172bec6c", "shasum": "" }, "require": { @@ -2750,7 +2812,7 @@ "http" ], "support": { - "source": "https://github.com/symfony/http-client/tree/v7.4.1" + "source": "https://github.com/symfony/http-client/tree/v7.4.4" }, "funding": [ { @@ -2770,7 +2832,7 @@ "type": "tidelift" } ], - "time": "2025-12-04T21:12:57+00:00" + "time": "2026-01-23T16:34:22+00:00" }, { "name": "symfony/http-client-contracts", @@ -3455,24 +3517,25 @@ }, { "name": "utopia-php/abuse", - "version": "1.0.2", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/utopia-php/abuse.git", - "reference": "611fa66a97e87c0dbbc133a717d970da7a5ca828" + "reference": "15cd5dbefa4453e8a2d90649a7078e242966ac3f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/abuse/zipball/611fa66a97e87c0dbbc133a717d970da7a5ca828", - "reference": "611fa66a97e87c0dbbc133a717d970da7a5ca828", + "url": "https://api.github.com/repos/utopia-php/abuse/zipball/15cd5dbefa4453e8a2d90649a7078e242966ac3f", + "reference": "15cd5dbefa4453e8a2d90649a7078e242966ac3f", "shasum": "" }, "require": { + "appwrite/appwrite": "19.*", "ext-curl": "*", "ext-pdo": "*", "ext-redis": "*", "php": ">=8.0", - "utopia-php/database": "*" + "utopia-php/database": "4.*" }, "require-dev": { "laravel/pint": "1.*", @@ -3500,9 +3563,9 @@ ], "support": { "issues": "https://github.com/utopia-php/abuse/issues", - "source": "https://github.com/utopia-php/abuse/tree/1.0.2" + "source": "https://github.com/utopia-php/abuse/tree/1.2.1" }, - "time": "2025-10-20T07:18:33+00:00" + "time": "2026-01-15T02:09:49+00:00" }, { "name": "utopia-php/analytics", @@ -3552,21 +3615,23 @@ }, { "name": "utopia-php/audit", - "version": "1.0.3", + "version": "2.1.0", "source": { "type": "git", "url": "https://github.com/utopia-php/audit.git", - "reference": "15656acfddb9d6f03c395b73673fc66c793c10a5" + "reference": "8e0540aa939968418ee3ad2b2c305992a771e142" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/audit/zipball/15656acfddb9d6f03c395b73673fc66c793c10a5", - "reference": "15656acfddb9d6f03c395b73673fc66c793c10a5", + "url": "https://api.github.com/repos/utopia-php/audit/zipball/8e0540aa939968418ee3ad2b2c305992a771e142", + "reference": "8e0540aa939968418ee3ad2b2c305992a771e142", "shasum": "" }, "require": { "php": ">=8.0", - "utopia-php/database": "4.*" + "utopia-php/database": "4.*", + "utopia-php/fetch": "0.5.*", + "utopia-php/validators": "0.2.*" }, "require-dev": { "laravel/pint": "1.*", @@ -3593,9 +3658,9 @@ ], "support": { "issues": "https://github.com/utopia-php/audit/issues", - "source": "https://github.com/utopia-php/audit/tree/1.0.3" + "source": "https://github.com/utopia-php/audit/tree/2.1.0" }, - "time": "2025-11-04T11:27:42+00:00" + "time": "2026-01-22T12:40:48+00:00" }, { "name": "utopia-php/auth", @@ -3896,16 +3961,16 @@ }, { "name": "utopia-php/database", - "version": "4.3.0", + "version": "4.6.2", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "fe7a1326ad623609e65587fe8c01a630a7075fee" + "reference": "53394759c44067e9db4660635765e2056f83788c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/fe7a1326ad623609e65587fe8c01a630a7075fee", - "reference": "fe7a1326ad623609e65587fe8c01a630a7075fee", + "url": "https://api.github.com/repos/utopia-php/database/zipball/53394759c44067e9db4660635765e2056f83788c", + "reference": "53394759c44067e9db4660635765e2056f83788c", "shasum": "" }, "require": { @@ -3948,9 +4013,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/4.3.0" + "source": "https://github.com/utopia-php/database/tree/4.6.2" }, - "time": "2025-11-14T03:43:10+00:00" + "time": "2026-01-22T07:14:12+00:00" }, { "name": "utopia-php/detector", @@ -3999,22 +4064,22 @@ }, { "name": "utopia-php/dns", - "version": "1.4.1", + "version": "1.5.3", "source": { "type": "git", "url": "https://github.com/utopia-php/dns.git", - "reference": "5daf8b683dad877491c4df84c6be24850b2f363b" + "reference": "a1f490ba425b1a5128e7aaa24eff560900812d21" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/dns/zipball/5daf8b683dad877491c4df84c6be24850b2f363b", - "reference": "5daf8b683dad877491c4df84c6be24850b2f363b", + "url": "https://api.github.com/repos/utopia-php/dns/zipball/a1f490ba425b1a5128e7aaa24eff560900812d21", + "reference": "a1f490ba425b1a5128e7aaa24eff560900812d21", "shasum": "" }, "require": { "php": ">=8.3", - "utopia-php/console": "0.0.*", - "utopia-php/domains": "0.9.*", + "utopia-php/domains": "0.11.*", + "utopia-php/span": "1.0.*", "utopia-php/telemetry": "*", "utopia-php/validators": "0.*" }, @@ -4050,22 +4115,22 @@ ], "support": { "issues": "https://github.com/utopia-php/dns/issues", - "source": "https://github.com/utopia-php/dns/tree/1.4.1" + "source": "https://github.com/utopia-php/dns/tree/1.5.3" }, - "time": "2025-12-17T09:09:08+00:00" + "time": "2026-01-13T11:39:38+00:00" }, { "name": "utopia-php/domains", - "version": "0.9.2", + "version": "0.11.1", "source": { "type": "git", "url": "https://github.com/utopia-php/domains.git", - "reference": "52b654f8a0e170bfa2e54cb47755b256822477c7" + "reference": "63fc5b9b58a32a5efd426510bbab4199db24593b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/domains/zipball/52b654f8a0e170bfa2e54cb47755b256822477c7", - "reference": "52b654f8a0e170bfa2e54cb47755b256822477c7", + "url": "https://api.github.com/repos/utopia-php/domains/zipball/63fc5b9b58a32a5efd426510bbab4199db24593b", + "reference": "63fc5b9b58a32a5efd426510bbab4199db24593b", "shasum": "" }, "require": { @@ -4112,9 +4177,9 @@ ], "support": { "issues": "https://github.com/utopia-php/domains/issues", - "source": "https://github.com/utopia-php/domains/tree/0.9.2" + "source": "https://github.com/utopia-php/domains/tree/0.11.1" }, - "time": "2025-11-26T12:16:36+00:00" + "time": "2026-01-23T09:28:08+00:00" }, { "name": "utopia-php/dsn", @@ -4165,23 +4230,23 @@ }, { "name": "utopia-php/emails", - "version": "0.6.3", + "version": "0.6.5", "source": { "type": "git", "url": "https://github.com/utopia-php/emails.git", - "reference": "9524d7f7bd1651a06fef8a3d964f774b04fe2918" + "reference": "178e57a0f9a24139500c94ce73d166800197b6cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/emails/zipball/9524d7f7bd1651a06fef8a3d964f774b04fe2918", - "reference": "9524d7f7bd1651a06fef8a3d964f774b04fe2918", + "url": "https://api.github.com/repos/utopia-php/emails/zipball/178e57a0f9a24139500c94ce73d166800197b6cf", + "reference": "178e57a0f9a24139500c94ce73d166800197b6cf", "shasum": "" }, "require": { "php": ">=8.0", "utopia-php/cli": "^0.15", - "utopia-php/domains": "^0.9", - "utopia-php/fetch": "^0.4", + "utopia-php/domains": "^0.11", + "utopia-php/fetch": "^0.5", "utopia-php/validators": "0.*" }, "require-dev": { @@ -4219,26 +4284,26 @@ ], "support": { "issues": "https://github.com/utopia-php/emails/issues", - "source": "https://github.com/utopia-php/emails/tree/0.6.3" + "source": "https://github.com/utopia-php/emails/tree/0.6.5" }, - "time": "2025-11-26T12:27:47+00:00" + "time": "2026-01-13T09:55:59+00:00" }, { "name": "utopia-php/fetch", - "version": "0.4.2", + "version": "0.5.1", "source": { "type": "git", "url": "https://github.com/utopia-php/fetch.git", - "reference": "83986d1be75a2fae4e684107fe70dd78a8e19b77" + "reference": "a96a010e1c273f3888765449687baf58cbc61fcd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/fetch/zipball/83986d1be75a2fae4e684107fe70dd78a8e19b77", - "reference": "83986d1be75a2fae4e684107fe70dd78a8e19b77", + "url": "https://api.github.com/repos/utopia-php/fetch/zipball/a96a010e1c273f3888765449687baf58cbc61fcd", + "reference": "a96a010e1c273f3888765449687baf58cbc61fcd", "shasum": "" }, "require": { - "php": ">=8.0" + "php": ">=8.1" }, "require-dev": { "laravel/pint": "^1.5.0", @@ -4258,29 +4323,29 @@ "description": "A simple library that provides an interface for making HTTP Requests.", "support": { "issues": "https://github.com/utopia-php/fetch/issues", - "source": "https://github.com/utopia-php/fetch/tree/0.4.2" + "source": "https://github.com/utopia-php/fetch/tree/0.5.1" }, - "time": "2025-04-25T13:48:02+00:00" + "time": "2025-12-18T16:25:10+00:00" }, { "name": "utopia-php/framework", - "version": "0.33.35", + "version": "0.33.37", "source": { "type": "git", "url": "https://github.com/utopia-php/http.git", - "reference": "82b139fb04f30045db51b0d322224f222da32313" + "reference": "30a119d76531d89da9240496940c84fcd9e1758b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/http/zipball/82b139fb04f30045db51b0d322224f222da32313", - "reference": "82b139fb04f30045db51b0d322224f222da32313", + "url": "https://api.github.com/repos/utopia-php/http/zipball/30a119d76531d89da9240496940c84fcd9e1758b", + "reference": "30a119d76531d89da9240496940c84fcd9e1758b", "shasum": "" }, "require": { "php": ">=8.3", "utopia-php/compression": "0.1.*", "utopia-php/telemetry": "0.1.*", - "utopia-php/validators": "0.1.*" + "utopia-php/validators": "0.2.*" }, "require-dev": { "laravel/pint": "1.*", @@ -4306,9 +4371,9 @@ ], "support": { "issues": "https://github.com/utopia-php/http/issues", - "source": "https://github.com/utopia-php/http/tree/0.33.35" + "source": "https://github.com/utopia-php/http/tree/0.33.37" }, - "time": "2025-12-12T08:33:52+00:00" + "time": "2026-01-13T10:10:21+00:00" }, { "name": "utopia-php/image", @@ -4513,22 +4578,23 @@ }, { "name": "utopia-php/migration", - "version": "1.3.5", + "version": "1.4.6", "source": { "type": "git", "url": "https://github.com/utopia-php/migration.git", - "reference": "6f366f1d4ac2796e59a97d1ba28cedc355e7122e" + "reference": "f358db6fb6a01d855bbed39e283387069e4f277d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/migration/zipball/6f366f1d4ac2796e59a97d1ba28cedc355e7122e", - "reference": "6f366f1d4ac2796e59a97d1ba28cedc355e7122e", + "url": "https://api.github.com/repos/utopia-php/migration/zipball/f358db6fb6a01d855bbed39e283387069e4f277d", + "reference": "f358db6fb6a01d855bbed39e283387069e4f277d", "shasum": "" }, "require": { - "appwrite/appwrite": "15.*", + "appwrite/appwrite": "19.*", "ext-curl": "*", "ext-openssl": "*", + "halaxa/json-machine": "^1.2", "php": ">=8.1", "utopia-php/console": "0.0.*", "utopia-php/database": "4.*", @@ -4562,9 +4628,9 @@ ], "support": { "issues": "https://github.com/utopia-php/migration/issues", - "source": "https://github.com/utopia-php/migration/tree/1.3.5" + "source": "https://github.com/utopia-php/migration/tree/1.4.6" }, - "time": "2025-11-25T11:18:29+00:00" + "time": "2026-01-20T11:07:17+00:00" }, { "name": "utopia-php/mongo", @@ -4679,16 +4745,16 @@ }, { "name": "utopia-php/platform", - "version": "0.7.13", + "version": "0.7.14", "source": { "type": "git", "url": "https://github.com/utopia-php/platform.git", - "reference": "77a863a920122e2c6a6bc6ee5548d366a3f4c6c7" + "reference": "9f18ce63f1425ae2dae57468200e4a5d1239d57b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/platform/zipball/77a863a920122e2c6a6bc6ee5548d366a3f4c6c7", - "reference": "77a863a920122e2c6a6bc6ee5548d366a3f4c6c7", + "url": "https://api.github.com/repos/utopia-php/platform/zipball/9f18ce63f1425ae2dae57468200e4a5d1239d57b", + "reference": "9f18ce63f1425ae2dae57468200e4a5d1239d57b", "shasum": "" }, "require": { @@ -4697,7 +4763,7 @@ "php": ">=8.0", "utopia-php/cli": "0.15.*", "utopia-php/framework": "0.33.*", - "utopia-php/queue": "0.11.*" + "utopia-php/queue": "0.15.*" }, "require-dev": { "laravel/pint": "1.*", @@ -4724,9 +4790,9 @@ ], "support": { "issues": "https://github.com/utopia-php/platform/issues", - "source": "https://github.com/utopia-php/platform/tree/0.7.13" + "source": "https://github.com/utopia-php/platform/tree/0.7.14" }, - "time": "2025-12-08T10:02:40+00:00" + "time": "2026-01-06T15:39:45+00:00" }, { "name": "utopia-php/pools", @@ -4835,23 +4901,23 @@ }, { "name": "utopia-php/queue", - "version": "0.11.2", + "version": "0.15.0", "source": { "type": "git", "url": "https://github.com/utopia-php/queue.git", - "reference": "a854f7c4abc18e0eca55fc5608cd7088d71eb19f" + "reference": "6abb268ba7ec00dea4e5201b007776ea1bce9242" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/queue/zipball/a854f7c4abc18e0eca55fc5608cd7088d71eb19f", - "reference": "a854f7c4abc18e0eca55fc5608cd7088d71eb19f", + "url": "https://api.github.com/repos/utopia-php/queue/zipball/6abb268ba7ec00dea4e5201b007776ea1bce9242", + "reference": "6abb268ba7ec00dea4e5201b007776ea1bce9242", "shasum": "" }, "require": { "php": ">=8.3", "php-amqplib/php-amqplib": "^3.7", - "utopia-php/cli": "0.15.*", - "utopia-php/fetch": "0.4.*", + "utopia-php/console": "0.0.*", + "utopia-php/fetch": "0.5.*", "utopia-php/framework": "0.33.*", "utopia-php/pools": "0.8.*", "utopia-php/telemetry": "*" @@ -4895,9 +4961,9 @@ ], "support": { "issues": "https://github.com/utopia-php/queue/issues", - "source": "https://github.com/utopia-php/queue/tree/0.11.2" + "source": "https://github.com/utopia-php/queue/tree/0.15.0" }, - "time": "2025-12-17T09:32:35+00:00" + "time": "2026-01-06T12:41:51+00:00" }, { "name": "utopia-php/registry", @@ -4951,6 +5017,49 @@ }, "time": "2021-03-10T10:45:22+00:00" }, + { + "name": "utopia-php/span", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/utopia-php/span.git", + "reference": "f2f6c499ded3a776e8019902e83d140ff0f89693" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/utopia-php/span/zipball/f2f6c499ded3a776e8019902e83d140ff0f89693", + "reference": "f2f6c499ded3a776e8019902e83d140ff0f89693", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "laravel/pint": "^1.0", + "phpstan/phpstan": "^2.0", + "phpunit/phpunit": "^10.0", + "swoole/ide-helper": "^5.0" + }, + "suggest": { + "ext-swoole": "Required for coroutine-based storage" + }, + "type": "library", + "autoload": { + "psr-4": { + "Utopia\\Span\\": "src/Span/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Simple span tracing library for PHP with coroutine support", + "support": { + "issues": "https://github.com/utopia-php/span/issues", + "source": "https://github.com/utopia-php/span/tree/1.0.0" + }, + "time": "2026-01-12T20:05:10+00:00" + }, { "name": "utopia-php/storage", "version": "0.18.18", @@ -5011,22 +5120,22 @@ }, { "name": "utopia-php/swoole", - "version": "0.8.5", + "version": "1.0.0", "source": { "type": "git", "url": "https://github.com/utopia-php/swoole.git", - "reference": "e42b6b8e44c457a7b35d8a857d7af1d67d667c58" + "reference": "95a937acb393dbf95cccba239d55886e2848ab0b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/swoole/zipball/e42b6b8e44c457a7b35d8a857d7af1d67d667c58", - "reference": "e42b6b8e44c457a7b35d8a857d7af1d67d667c58", + "url": "https://api.github.com/repos/utopia-php/swoole/zipball/95a937acb393dbf95cccba239d55886e2848ab0b", + "reference": "95a937acb393dbf95cccba239d55886e2848ab0b", "shasum": "" }, "require": { "ext-swoole": "*", "php": ">=8.0", - "utopia-php/framework": "0.33.35" + "utopia-php/framework": "0.33.37" }, "require-dev": { "laravel/pint": "1.2.*", @@ -5056,9 +5165,9 @@ ], "support": { "issues": "https://github.com/utopia-php/swoole/issues", - "source": "https://github.com/utopia-php/swoole/tree/0.8.5" + "source": "https://github.com/utopia-php/swoole/tree/1.0.0" }, - "time": "2025-12-15T14:03:23+00:00" + "time": "2026-01-14T14:00:11+00:00" }, { "name": "utopia-php/system", @@ -5168,16 +5277,16 @@ }, { "name": "utopia-php/validators", - "version": "0.1.0", + "version": "0.2.0", "source": { "type": "git", "url": "https://github.com/utopia-php/validators.git", - "reference": "5c57d5b6cf964f8981807c1d3ea8df620c869080" + "reference": "30b6030a5b100fc1dff34506e5053759594b2a20" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/validators/zipball/5c57d5b6cf964f8981807c1d3ea8df620c869080", - "reference": "5c57d5b6cf964f8981807c1d3ea8df620c869080", + "url": "https://api.github.com/repos/utopia-php/validators/zipball/30b6030a5b100fc1dff34506e5053759594b2a20", + "reference": "30b6030a5b100fc1dff34506e5053759594b2a20", "shasum": "" }, "require": { @@ -5185,7 +5294,7 @@ }, "require-dev": { "laravel/pint": "1.*", - "phpstan/phpstan": "1.*", + "phpstan/phpstan": "2.*", "phpunit/phpunit": "11.*" }, "type": "library", @@ -5207,9 +5316,9 @@ ], "support": { "issues": "https://github.com/utopia-php/validators/issues", - "source": "https://github.com/utopia-php/validators/tree/0.1.0" + "source": "https://github.com/utopia-php/validators/tree/0.2.0" }, - "time": "2025-11-18T11:05:46+00:00" + "time": "2026-01-13T09:16:51+00:00" }, { "name": "utopia-php/vcs", @@ -5436,16 +5545,16 @@ "packages-dev": [ { "name": "appwrite/sdk-generator", - "version": "1.5.9", + "version": "1.8.21", "source": { "type": "git", "url": "https://github.com/appwrite/sdk-generator.git", - "reference": "ee434aa00a9185380b9a39bb46bf86d7104d3a93" + "reference": "1b47b2c794811c565f8b5e7eeaa19f749bcbeb6b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/ee434aa00a9185380b9a39bb46bf86d7104d3a93", - "reference": "ee434aa00a9185380b9a39bb46bf86d7104d3a93", + "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/1b47b2c794811c565f8b5e7eeaa19f749bcbeb6b", + "reference": "1b47b2c794811c565f8b5e7eeaa19f749bcbeb6b", "shasum": "" }, "require": { @@ -5481,9 +5590,9 @@ "description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms", "support": { "issues": "https://github.com/appwrite/sdk-generator/issues", - "source": "https://github.com/appwrite/sdk-generator/tree/1.5.9" + "source": "https://github.com/appwrite/sdk-generator/tree/1.8.21" }, - "time": "2025-11-25T05:22:25+00:00" + "time": "2026-01-26T04:42:33+00:00" }, { "name": "doctrine/annotations", @@ -5710,16 +5819,16 @@ }, { "name": "laravel/pint", - "version": "v1.26.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/laravel/pint.git", - "reference": "69dcca060ecb15e4b564af63d1f642c81a241d6f" + "reference": "c67b4195b75491e4dfc6b00b1c78b68d86f54c90" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/pint/zipball/69dcca060ecb15e4b564af63d1f642c81a241d6f", - "reference": "69dcca060ecb15e4b564af63d1f642c81a241d6f", + "url": "https://api.github.com/repos/laravel/pint/zipball/c67b4195b75491e4dfc6b00b1c78b68d86f54c90", + "reference": "c67b4195b75491e4dfc6b00b1c78b68d86f54c90", "shasum": "" }, "require": { @@ -5730,9 +5839,9 @@ "php": "^8.2.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.90.0", - "illuminate/view": "^12.40.1", - "larastan/larastan": "^3.8.0", + "friendsofphp/php-cs-fixer": "^3.92.4", + "illuminate/view": "^12.44.0", + "larastan/larastan": "^3.8.1", "laravel-zero/framework": "^12.0.4", "mockery/mockery": "^1.6.12", "nunomaduro/termwind": "^2.3.3", @@ -5773,7 +5882,7 @@ "issues": "https://github.com/laravel/pint/issues", "source": "https://github.com/laravel/pint" }, - "time": "2025-11-25T21:15:52+00:00" + "time": "2026-01-05T16:49:17+00:00" }, { "name": "matthiasmullie/minify", @@ -7930,16 +8039,16 @@ }, { "name": "symfony/console", - "version": "v8.0.1", + "version": "v8.0.4", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "fcb73f69d655b48fcb894a262f074218df08bd58" + "reference": "ace03c4cf9805080ff40cbeec69fca180c339a3b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/fcb73f69d655b48fcb894a262f074218df08bd58", - "reference": "fcb73f69d655b48fcb894a262f074218df08bd58", + "url": "https://api.github.com/repos/symfony/console/zipball/ace03c4cf9805080ff40cbeec69fca180c339a3b", + "reference": "ace03c4cf9805080ff40cbeec69fca180c339a3b", "shasum": "" }, "require": { @@ -7996,7 +8105,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v8.0.1" + "source": "https://github.com/symfony/console/tree/v8.0.4" }, "funding": [ { @@ -8016,7 +8125,7 @@ "type": "tidelift" } ], - "time": "2025-12-05T15:25:33+00:00" + "time": "2026-01-13T13:06:50+00:00" }, { "name": "symfony/filesystem", @@ -8090,16 +8199,16 @@ }, { "name": "symfony/finder", - "version": "v8.0.0", + "version": "v8.0.4", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "7598dd5770580fa3517ec83e8da0c9b9e01f4291" + "reference": "42e48eb02e07d5f3771d194d67da117eb824c8c1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/7598dd5770580fa3517ec83e8da0c9b9e01f4291", - "reference": "7598dd5770580fa3517ec83e8da0c9b9e01f4291", + "url": "https://api.github.com/repos/symfony/finder/zipball/42e48eb02e07d5f3771d194d67da117eb824c8c1", + "reference": "42e48eb02e07d5f3771d194d67da117eb824c8c1", "shasum": "" }, "require": { @@ -8134,7 +8243,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v8.0.0" + "source": "https://github.com/symfony/finder/tree/v8.0.4" }, "funding": [ { @@ -8154,7 +8263,7 @@ "type": "tidelift" } ], - "time": "2025-11-05T14:36:47+00:00" + "time": "2026-01-12T12:37:40+00:00" }, { "name": "symfony/options-resolver", @@ -8559,16 +8668,16 @@ }, { "name": "symfony/process", - "version": "v8.0.0", + "version": "v8.0.4", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "a0a750500c4ce900d69ba4e9faf16f82c10ee149" + "reference": "10df72602d88c0a3fa685b822976a052611dd607" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/a0a750500c4ce900d69ba4e9faf16f82c10ee149", - "reference": "a0a750500c4ce900d69ba4e9faf16f82c10ee149", + "url": "https://api.github.com/repos/symfony/process/zipball/10df72602d88c0a3fa685b822976a052611dd607", + "reference": "10df72602d88c0a3fa685b822976a052611dd607", "shasum": "" }, "require": { @@ -8600,7 +8709,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v8.0.0" + "source": "https://github.com/symfony/process/tree/v8.0.4" }, "funding": [ { @@ -8620,20 +8729,20 @@ "type": "tidelift" } ], - "time": "2025-10-16T16:25:44+00:00" + "time": "2026-01-23T11:07:10+00:00" }, { "name": "symfony/string", - "version": "v8.0.1", + "version": "v8.0.4", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "ba65a969ac918ce0cc3edfac6cdde847eba231dc" + "reference": "758b372d6882506821ed666032e43020c4f57194" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/ba65a969ac918ce0cc3edfac6cdde847eba231dc", - "reference": "ba65a969ac918ce0cc3edfac6cdde847eba231dc", + "url": "https://api.github.com/repos/symfony/string/zipball/758b372d6882506821ed666032e43020c4f57194", + "reference": "758b372d6882506821ed666032e43020c4f57194", "shasum": "" }, "require": { @@ -8690,7 +8799,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v8.0.1" + "source": "https://github.com/symfony/string/tree/v8.0.4" }, "funding": [ { @@ -8710,7 +8819,7 @@ "type": "tidelift" } ], - "time": "2025-12-01T09:13:36+00:00" + "time": "2026-01-12T12:37:40+00:00" }, { "name": "textalk/websocket", diff --git a/docker-compose.yml b/docker-compose.yml index 57007c4efc..0de7cc73c6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -112,6 +112,7 @@ services: - _APP_EDITION - _APP_WORKER_PER_CORE - _APP_LOCALE + - _APP_COMPRESSION_ENABLED - _APP_COMPRESSION_MIN_SIZE_BYTES - _APP_CONSOLE_WHITELIST_ROOT - _APP_CONSOLE_WHITELIST_EMAILS @@ -200,6 +201,7 @@ services: - _APP_MAINTENANCE_RETENTION_SCHEDULES - _APP_SMS_PROVIDER - _APP_SMS_FROM + - _APP_GRAPHQL_INTROSPECTION - _APP_GRAPHQL_MAX_BATCH_SIZE - _APP_GRAPHQL_MAX_COMPLEXITY - _APP_GRAPHQL_MAX_DEPTH @@ -230,7 +232,7 @@ services: appwrite-console: <<: *x-logging container_name: appwrite-console - image: appwrite/console:7.4.11 + image: appwrite/console:7.5.7 restart: unless-stopped networks: - appwrite @@ -466,14 +468,12 @@ services: - appwrite-functions:/storage/functions:rw - appwrite-sites:/storage/sites:rw - appwrite-builds:/storage/builds:rw - - appwrite-uploads:/storage/uploads:rw - ./app:/usr/src/code/app - ./src:/usr/src/code/src depends_on: - redis - mariadb environment: - - _APP_BROWSER_HOST - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -529,6 +529,65 @@ services: extra_hosts: - "host.docker.internal:host-gateway" + appwrite-worker-screenshots: + entrypoint: worker-screenshots + <<: *x-logging + container_name: appwrite-worker-screenshots + image: appwrite-dev + networks: + - appwrite + volumes: + - appwrite-uploads:/storage/uploads:rw + - ./app:/usr/src/code/app + - ./src:/usr/src/code/src + depends_on: + - redis + - mariadb + environment: + # Specific + - _APP_BROWSER_HOST + # Basic + - _APP_ENV + - _APP_WORKER_PER_CORE + - _APP_LOGGING_CONFIG + # Database + - _APP_OPENSSL_KEY_V1 + - _APP_REDIS_HOST + - _APP_REDIS_PORT + - _APP_REDIS_USER + - _APP_REDIS_PASS + - _APP_DB_HOST + - _APP_DB_PORT + - _APP_DB_SCHEMA + - _APP_DB_USER + - _APP_DB_PASS + - _APP_DATABASE_SHARED_TABLES + # Storage + - _APP_STORAGE_DEVICE + - _APP_STORAGE_S3_ACCESS_KEY + - _APP_STORAGE_S3_SECRET + - _APP_STORAGE_S3_REGION + - _APP_STORAGE_S3_BUCKET + - _APP_STORAGE_S3_ENDPOINT + - _APP_STORAGE_DO_SPACES_ACCESS_KEY + - _APP_STORAGE_DO_SPACES_SECRET + - _APP_STORAGE_DO_SPACES_REGION + - _APP_STORAGE_DO_SPACES_BUCKET + - _APP_STORAGE_BACKBLAZE_ACCESS_KEY + - _APP_STORAGE_BACKBLAZE_SECRET + - _APP_STORAGE_BACKBLAZE_REGION + - _APP_STORAGE_BACKBLAZE_BUCKET + - _APP_STORAGE_LINODE_ACCESS_KEY + - _APP_STORAGE_LINODE_SECRET + - _APP_STORAGE_LINODE_REGION + - _APP_STORAGE_LINODE_BUCKET + - _APP_STORAGE_WASABI_ACCESS_KEY + - _APP_STORAGE_WASABI_SECRET + - _APP_STORAGE_WASABI_REGION + - _APP_STORAGE_WASABI_BUCKET + extra_hosts: + - "host.docker.internal:host-gateway" + appwrite-worker-certificates: entrypoint: worker-certificates <<: *x-logging @@ -555,6 +614,7 @@ services: - _APP_DOMAIN_TARGET_CAA - _APP_DNS - _APP_DOMAIN_FUNCTIONS + - _APP_DOMAIN_SITES - _APP_EMAIL_CERTIFICATES - _APP_REDIS_HOST - _APP_REDIS_PORT @@ -579,9 +639,12 @@ services: - ./app:/usr/src/code/app - ./src:/usr/src/code/src depends_on: - - redis - - mariadb - - openruntimes-executor + redis: + condition: service_started + mariadb: + condition: service_started + openruntimes-executor: + condition: service_healthy environment: - _APP_ENV - _APP_WORKER_PER_CORE @@ -753,6 +816,7 @@ services: - ./app:/usr/src/code/app - ./src:/usr/src/code/src depends_on: + - mariadb - redis environment: - _APP_ENV @@ -785,6 +849,44 @@ services: - _APP_MAINTENANCE_START_TIME - _APP_DATABASE_SHARED_TABLES + appwrite-task-interval: + entrypoint: interval + <<: *x-logging + container_name: appwrite-task-interval + image: appwrite-dev + networks: + - appwrite + volumes: + - ./app:/usr/src/code/app + - ./src:/usr/src/code/src + depends_on: + - mariadb + - redis + environment: + - _APP_ENV + - _APP_WORKER_PER_CORE + - _APP_DOMAIN + - _APP_DOMAIN_TARGET_CNAME + - _APP_DOMAIN_TARGET_AAAA + - _APP_DOMAIN_TARGET_A + - _APP_DOMAIN_TARGET_CAA + - _APP_DNS + - _APP_DOMAIN_FUNCTIONS + - _APP_DOMAIN_SITES + - _APP_OPENSSL_KEY_V1 + - _APP_REDIS_HOST + - _APP_REDIS_PORT + - _APP_REDIS_USER + - _APP_REDIS_PASS + - _APP_DB_HOST + - _APP_DB_PORT + - _APP_DB_SCHEMA + - _APP_DB_USER + - _APP_DB_PASS + - _APP_DATABASE_SHARED_TABLES + - _APP_INTERVAL_DOMAIN_VERIFICATION + - _APP_INTERVAL_CLEANUP_STALE_EXECUTIONS + appwrite-task-stats-resources: container_name: appwrite-task-stats-resources entrypoint: stats-resources @@ -1027,27 +1129,12 @@ services: - OPR_EXECUTOR_STORAGE_WASABI_SECRET=$_APP_STORAGE_WASABI_SECRET - OPR_EXECUTOR_STORAGE_WASABI_REGION=$_APP_STORAGE_WASABI_REGION - OPR_EXECUTOR_STORAGE_WASABI_BUCKET=$_APP_STORAGE_WASABI_BUCKET - - openruntimes-proxy: - container_name: openruntimes-proxy - hostname: proxy - <<: *x-logging - stop_signal: SIGINT - image: openruntimes/proxy:0.5.5 - networks: - - appwrite - - runtimes - environment: - - OPR_PROXY_WORKER_PER_CORE=$_APP_WORKER_PER_CORE - - OPR_PROXY_ENV=$_APP_ENV - - OPR_PROXY_EXECUTOR_SECRET=$_APP_EXECUTOR_SECRET - - OPR_PROXY_SECRET=$_APP_EXECUTOR_SECRET - - OPR_PROXY_LOGGING_CONFIG=$_APP_LOGGING_CONFIG - - OPR_PROXY_ALGORITHM=random - - OPR_PROXY_EXECUTORS=exc1 - - OPR_PROXY_HEALTHCHECK_INTERVAL=10000 - - OPR_PROXY_MAX_TIMEOUT=600 - - OPR_PROXY_HEALTHCHECK=enabled + healthcheck: + test: ["CMD-SHELL", "curl -fsS -H \"Authorization: Bearer $$OPR_EXECUTOR_SECRET\" http://localhost/v1/health >/dev/null"] + interval: 5s + timeout: 3s + retries: 20 + start_period: 5s mariadb: image: mariadb:10.11 # fix issues when upgrading using: mysql_upgrade -u root -p @@ -1131,6 +1218,9 @@ services: - "traefik.http.routers.appwrite_maildev_https.rule=Host(`mail.localhost`)" - "traefik.http.routers.appwrite_maildev_https.service=appwrite_maildev" - "traefik.http.routers.appwrite_maildev_https.tls=true" + environment: + - MAILDEV_INCOMING_USER=${_APP_SMTP_USERNAME} + - MAILDEV_INCOMING_PASS=${_APP_SMTP_PASSWORD} request-catcher-webhook: # used mainly for dev tests (mock HTTP webhook) image: appwrite/requestcatcher:1.0.0 diff --git a/docs/examples/1.8.x/console-cli/examples/health/get-queue-audits.md b/docs/examples/1.8.x/console-cli/examples/health/get-queue-audits.md new file mode 100644 index 0000000000..f228f092a5 --- /dev/null +++ b/docs/examples/1.8.x/console-cli/examples/health/get-queue-audits.md @@ -0,0 +1 @@ +appwrite health get-queue-audits diff --git a/docs/examples/1.8.x/console-cli/examples/projects/update-labels.md b/docs/examples/1.8.x/console-cli/examples/projects/update-labels.md new file mode 100644 index 0000000000..841dc4ee94 --- /dev/null +++ b/docs/examples/1.8.x/console-cli/examples/projects/update-labels.md @@ -0,0 +1,3 @@ +appwrite projects update-labels \ + --project-id \ + --labels one two three diff --git a/docs/references/health/get-queue-audits.md b/docs/references/health/get-queue-audits.md new file mode 100644 index 0000000000..75010cc2f4 --- /dev/null +++ b/docs/references/health/get-queue-audits.md @@ -0,0 +1 @@ +Get the number of audit logs that are waiting to be processed in the Appwrite internal queue server. \ No newline at end of file diff --git a/docs/sdks/cli/CHANGELOG.md b/docs/sdks/cli/CHANGELOG.md index 9f1f02bbd0..342761e070 100644 --- a/docs/sdks/cli/CHANGELOG.md +++ b/docs/sdks/cli/CHANGELOG.md @@ -1,5 +1,63 @@ # Change Log +## 13.1.0 + +- Mark `appwrite generate` command as stable +- Improve permissions param to be a typesafe callback +- Fix relationship handling in generated code +- Fix `appwrite client` properly hanlding `--key` parameter +- Fix `init site` not working on Windows + +## 13.1.0-rc.3 + +- Allow generation of server side CRUD operations on databases and tables +- Fix npm distribution failing due to missing template files in bundle + +## 13.1.0-rc.2 + +- Update generated `databases` services to automatically initialize a client instance +- Update generator to use handlebars templates + +## 13.1.0-rc.1 + +- Feat: `appwrite generate` command to create a fully typesafe SDK for your Appwrite project +- Chore: improve creation of columns during table creation by passing them directly instead of creating them one by one +- Improved config validation by adding extra rules in zod schema + +## 13.0.1 + +- Fix `project init` command leading to Cannot convert to BigInt error +- Fix filter out unwanted attributes being pulled in the config file + +## 13.0.0 + +- Mark release as stable +- Feat: add pull sync on destruction of remote resources (+ confirmation) +- Fix: refine zod schema to check string size +- Validate using zod schema during push cli command +- Maintain order of keys in local config + +## 13.0.0-rc.5 + +- Fix push all command not working correctly + +## 13.0.0-rc.4 + +- Fix CLI ES module import issues + +## 13.0.0-rc.3 + +- Add `Schema` class for programmatically pushing and pulling appwrite config +- Add client side db generation using `schema.db.generate()` command + +## 13.0.0-rc.2 + +- Fixes a lot of typescript errors throughout the codebase + +## 13.0.0-rc.1 + +- Migrates codebase from JavaScript to TypeScript + ## 12.0.1 Fix type generation for `point`, `lineString` and `polygon` columns diff --git a/docs/sdks/dart/CHANGELOG.md b/docs/sdks/dart/CHANGELOG.md index b370394c8b..9f5ade774a 100644 --- a/docs/sdks/dart/CHANGELOG.md +++ b/docs/sdks/dart/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## 20.1.1 + +* Fix boolean parameter not handled correctly in Client requests + ## 20.1.0 * Added ability to create columns and indexes synchronously while creating a table diff --git a/docs/sdks/flutter/CHANGELOG.md b/docs/sdks/flutter/CHANGELOG.md index 834c926977..3be014dfc5 100644 --- a/docs/sdks/flutter/CHANGELOG.md +++ b/docs/sdks/flutter/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## 20.3.3 + +* Fix boolean parameter not handled correctly in Client requests + ## 20.3.2 * Fix OAuth2 browser infinite redirect issue diff --git a/docs/sdks/markdown/CHANGELOG.md b/docs/sdks/markdown/CHANGELOG.md new file mode 100644 index 0000000000..bbfc68354e --- /dev/null +++ b/docs/sdks/markdown/CHANGELOG.md @@ -0,0 +1,5 @@ +# Change Log + +## 0.1.0 + +* Initial release diff --git a/src/Appwrite/Certificates/Adapter.php b/src/Appwrite/Certificates/Adapter.php index ab673e9cfe..47d865ad08 100644 --- a/src/Appwrite/Certificates/Adapter.php +++ b/src/Appwrite/Certificates/Adapter.php @@ -8,6 +8,10 @@ interface Adapter { public function issueCertificate(string $certName, string $domain, ?string $domainType): ?string; + public function isInstantGeneration(string $domain, ?string $domainType): bool; + + public function getCertificateStatus(string $domain, ?string $domainType): string; + public function isRenewRequired(string $domain, ?string $domainType, Log $log): bool; public function deleteCertificate(string $domain): void; diff --git a/src/Appwrite/Certificates/Exception/CertificateStatus.php b/src/Appwrite/Certificates/Exception/CertificateStatus.php new file mode 100644 index 0000000000..ca15a95ed8 --- /dev/null +++ b/src/Appwrite/Certificates/Exception/CertificateStatus.php @@ -0,0 +1,10 @@ + 'pushTotal', default => throw new Exception('Invalid target provider type'), }; - $database->decreaseDocumentAttribute( - 'topics', - $topicId, - $totalAttribute, - min: 0 - ); + + try { + $database->decreaseDocumentAttribute( + 'topics', + $topicId, + $totalAttribute, + min: 0 + ); + } catch (LimitException $e) { + Console::error("Delete subscribers decreaseDocumentAttribute (topicId={$topicId}): {$e->getMessage()}"); + } } } ); diff --git a/src/Appwrite/Event/Audit.php b/src/Appwrite/Event/Audit.php index dd48093dc5..b26083b013 100644 --- a/src/Appwrite/Event/Audit.php +++ b/src/Appwrite/Event/Audit.php @@ -3,6 +3,7 @@ namespace Appwrite\Event; use Utopia\Queue\Publisher; +use Utopia\System\System; class Audit extends Event { @@ -19,8 +20,8 @@ class Audit extends Event parent::__construct($publisher); $this - ->setQueue(Event::AUDITS_QUEUE_NAME) - ->setClass(Event::AUDITS_CLASS_NAME); + ->setQueue(System::getEnv('_APP_AUDITS_QUEUE_NAME', Event::AUDITS_QUEUE_NAME)) + ->setClass(System::getEnv('_APP_AUDITS_CLASS_NAME', Event::AUDITS_CLASS_NAME)); } /** diff --git a/src/Appwrite/Event/Build.php b/src/Appwrite/Event/Build.php index 38f423829e..4eaf108f15 100644 --- a/src/Appwrite/Event/Build.php +++ b/src/Appwrite/Event/Build.php @@ -5,6 +5,7 @@ namespace Appwrite\Event; use Utopia\Config\Config; use Utopia\Database\Document; use Utopia\Queue\Publisher; +use Utopia\System\System; class Build extends Event { @@ -18,8 +19,8 @@ class Build extends Event parent::__construct($publisher); $this - ->setQueue(Event::BUILDS_QUEUE_NAME) - ->setClass(Event::BUILDS_CLASS_NAME); + ->setQueue(System::getEnv('_APP_BUILDS_QUEUE_NAME', Event::BUILDS_QUEUE_NAME)) + ->setClass(System::getEnv('_APP_BUILDS_CLASS_NAME', Event::BUILDS_CLASS_NAME)); } /** diff --git a/src/Appwrite/Event/Certificate.php b/src/Appwrite/Event/Certificate.php index 00875c7a4a..5f8fe0408c 100644 --- a/src/Appwrite/Event/Certificate.php +++ b/src/Appwrite/Event/Certificate.php @@ -4,10 +4,14 @@ namespace Appwrite\Event; use Utopia\Database\Document; use Utopia\Queue\Publisher; +use Utopia\System\System; class Certificate extends Event { + public const string ACTION_DOMAIN_VERIFICATION = 'verification'; + public const string ACTION_GENERATION = 'generation'; protected bool $skipRenewCheck = false; + protected string $action = self::ACTION_GENERATION; protected ?Document $domain = null; protected ?string $validationDomain = null; @@ -16,8 +20,8 @@ class Certificate extends Event parent::__construct($publisher); $this - ->setQueue(Event::CERTIFICATES_QUEUE_NAME) - ->setClass(Event::CERTIFICATES_CLASS_NAME); + ->setQueue(System::getEnv('_APP_CERTIFICATES_QUEUE_NAME', Event::CERTIFICATES_QUEUE_NAME)) + ->setClass(System::getEnv('_APP_CERTIFICATES_CLASS_NAME', Event::CERTIFICATES_CLASS_NAME)); } /** @@ -90,6 +94,28 @@ class Certificate extends Event return $this->skipRenewCheck; } + /** + * Set action for this certificate event. + * + * @param string $action + * @return self + */ + public function setAction(string $action): self + { + $this->action = $action; + return $this; + } + + /** + * Get action for this certificate event. + * + * @return string + */ + public function getAction(): string + { + return $this->action; + } + /** * Prepare the payload for the event @@ -102,7 +128,8 @@ class Certificate extends Event 'project' => $this->project, 'domain' => $this->domain, 'skipRenewCheck' => $this->skipRenewCheck, - 'validationDomain' => $this->validationDomain + 'validationDomain' => $this->validationDomain, + 'action' => $this->action ]; } } diff --git a/src/Appwrite/Event/Database.php b/src/Appwrite/Event/Database.php index eac30ac07e..4e8e1fdea9 100644 --- a/src/Appwrite/Event/Database.php +++ b/src/Appwrite/Event/Database.php @@ -5,6 +5,7 @@ namespace Appwrite\Event; use Utopia\Database\Document; use Utopia\DSN\DSN; use Utopia\Queue\Publisher; +use Utopia\System\System; class Database extends Event { @@ -24,7 +25,7 @@ class Database extends Event { parent::__construct($publisher); - $this->setClass(Event::DATABASE_CLASS_NAME); + $this->setClass(System::getEnv('_APP_DATABASE_CLASS_NAME', Event::DATABASE_CLASS_NAME)); } /** diff --git a/src/Appwrite/Event/Delete.php b/src/Appwrite/Event/Delete.php index 450be306d7..6747acb03f 100644 --- a/src/Appwrite/Event/Delete.php +++ b/src/Appwrite/Event/Delete.php @@ -4,6 +4,7 @@ namespace Appwrite\Event; use Utopia\Database\Document; use Utopia\Queue\Publisher; +use Utopia\System\System; class Delete extends Event { @@ -20,8 +21,8 @@ class Delete extends Event parent::__construct($publisher); $this - ->setQueue(Event::DELETE_QUEUE_NAME) - ->setClass(Event::DELETE_CLASS_NAME); + ->setQueue(System::getEnv('_APP_DELETE_QUEUE_NAME', Event::DELETE_QUEUE_NAME)) + ->setClass(System::getEnv('_APP_DELETE_CLASS_NAME', Event::DELETE_CLASS_NAME)); } /** diff --git a/src/Appwrite/Event/Event.php b/src/Appwrite/Event/Event.php index c7bb22f715..9805ab7830 100644 --- a/src/Appwrite/Event/Event.php +++ b/src/Appwrite/Event/Event.php @@ -39,6 +39,9 @@ class Event public const BUILDS_QUEUE_NAME = 'v1-builds'; public const BUILDS_CLASS_NAME = 'BuildsV1'; + public const SCREENSHOTS_QUEUE_NAME = 'v1-screenshots'; + public const SCREENSHOTS_CLASS_NAME = 'ScreenshotsV1'; + public const MESSAGING_QUEUE_NAME = 'v1-messaging'; public const MESSAGING_CLASS_NAME = 'MessagingV1'; diff --git a/src/Appwrite/Event/Func.php b/src/Appwrite/Event/Func.php index c9622a9ce0..8d8c51b540 100644 --- a/src/Appwrite/Event/Func.php +++ b/src/Appwrite/Event/Func.php @@ -5,6 +5,7 @@ namespace Appwrite\Event; use Utopia\Config\Config; use Utopia\Database\Document; use Utopia\Queue\Publisher; +use Utopia\System\System; class Func extends Event { @@ -25,8 +26,8 @@ class Func extends Event parent::__construct($publisher); $this - ->setQueue(Event::FUNCTIONS_QUEUE_NAME) - ->setClass(Event::FUNCTIONS_CLASS_NAME); + ->setQueue(System::getEnv('_APP_FUNCTIONS_QUEUE_NAME', Event::FUNCTIONS_QUEUE_NAME)) + ->setClass(System::getEnv('_APP_FUNCTIONS_CLASS_NAME', Event::FUNCTIONS_CLASS_NAME)); } /** diff --git a/src/Appwrite/Event/Mail.php b/src/Appwrite/Event/Mail.php index ed96f6f93a..3cfe8f8a87 100644 --- a/src/Appwrite/Event/Mail.php +++ b/src/Appwrite/Event/Mail.php @@ -4,6 +4,7 @@ namespace Appwrite\Event; use Utopia\Config\Config; use Utopia\Queue\Publisher; +use Utopia\System\System; class Mail extends Event { @@ -24,8 +25,8 @@ class Mail extends Event parent::__construct($publisher); $this - ->setQueue(Event::MAILS_QUEUE_NAME) - ->setClass(Event::MAILS_CLASS_NAME); + ->setQueue(System::getEnv('_APP_MAILS_QUEUE_NAME', Event::MAILS_QUEUE_NAME)) + ->setClass(System::getEnv('_APP_MAILS_CLASS_NAME', Event::MAILS_CLASS_NAME)); } /** diff --git a/src/Appwrite/Event/Messaging.php b/src/Appwrite/Event/Messaging.php index f4c72c7d72..8c13185e0b 100644 --- a/src/Appwrite/Event/Messaging.php +++ b/src/Appwrite/Event/Messaging.php @@ -4,6 +4,7 @@ namespace Appwrite\Event; use Utopia\Database\Document; use Utopia\Queue\Publisher; +use Utopia\System\System; class Messaging extends Event { @@ -19,8 +20,8 @@ class Messaging extends Event parent::__construct($publisher); $this - ->setQueue(Event::MESSAGING_QUEUE_NAME) - ->setClass(Event::MESSAGING_CLASS_NAME); + ->setQueue(System::getEnv('_APP_MESSAGING_QUEUE_NAME', Event::MESSAGING_QUEUE_NAME)) + ->setClass(System::getEnv('_APP_MESSAGING_CLASS_NAME', Event::MESSAGING_CLASS_NAME)); } /** diff --git a/src/Appwrite/Event/Migration.php b/src/Appwrite/Event/Migration.php index a224d4f4c3..89f49f0876 100644 --- a/src/Appwrite/Event/Migration.php +++ b/src/Appwrite/Event/Migration.php @@ -5,6 +5,7 @@ namespace Appwrite\Event; use Utopia\Config\Config; use Utopia\Database\Document; use Utopia\Queue\Publisher; +use Utopia\System\System; class Migration extends Event { @@ -16,8 +17,8 @@ class Migration extends Event parent::__construct($publisher); $this - ->setQueue(Event::MIGRATIONS_QUEUE_NAME) - ->setClass(Event::MIGRATIONS_CLASS_NAME); + ->setQueue(System::getEnv('_APP_MIGRATIONS_QUEUE_NAME', Event::MIGRATIONS_QUEUE_NAME)) + ->setClass(System::getEnv('_APP_MIGRATIONS_CLASS_NAME', Event::MIGRATIONS_CLASS_NAME)); } /** diff --git a/src/Appwrite/Event/Screenshot.php b/src/Appwrite/Event/Screenshot.php new file mode 100644 index 0000000000..acacf2b872 --- /dev/null +++ b/src/Appwrite/Event/Screenshot.php @@ -0,0 +1,50 @@ +setQueue(System::getEnv('_APP_SCREENSHOTS_QUEUE_NAME', Event::SCREENSHOTS_QUEUE_NAME)) + ->setClass(System::getEnv('_APP_SCREENSHOTS_CLASS_NAME', Event::SCREENSHOTS_CLASS_NAME)); + } + + public function setDeploymentId(string $deploymentId): self + { + $this->deploymentId = $deploymentId; + + return $this; + } + + protected function preparePayload(): array + { + $platform = $this->platform; + if (empty($platform)) { + $platform = Config::getParam('platform', []); + } + + return [ + 'project' => $this->project, + 'deploymentId' => $this->deploymentId, + 'platform' => $platform, + ]; + } + + public function reset(): self + { + $this->deploymentId = ''; + parent::reset(); + + return $this; + } +} diff --git a/src/Appwrite/Event/StatsResources.php b/src/Appwrite/Event/StatsResources.php index c4f7ac1690..07f23feda8 100644 --- a/src/Appwrite/Event/StatsResources.php +++ b/src/Appwrite/Event/StatsResources.php @@ -3,6 +3,7 @@ namespace Appwrite\Event; use Utopia\Queue\Publisher; +use Utopia\System\System; class StatsResources extends Event { @@ -13,8 +14,8 @@ class StatsResources extends Event parent::__construct($publisher); $this - ->setQueue(Event::STATS_RESOURCES_QUEUE_NAME) - ->setClass(Event::STATS_RESOURCES_CLASS_NAME); + ->setQueue(System::getEnv('_APP_STATS_RESOURCES_QUEUE_NAME', Event::STATS_RESOURCES_QUEUE_NAME)) + ->setClass(System::getEnv('_APP_STATS_RESOURCES_CLASS_NAME', Event::STATS_RESOURCES_CLASS_NAME)); } /** diff --git a/src/Appwrite/Event/StatsUsage.php b/src/Appwrite/Event/StatsUsage.php index f6b1d695f4..47ba5a3ea0 100644 --- a/src/Appwrite/Event/StatsUsage.php +++ b/src/Appwrite/Event/StatsUsage.php @@ -4,6 +4,7 @@ namespace Appwrite\Event; use Utopia\Database\Document; use Utopia\Queue\Publisher; +use Utopia\System\System; class StatsUsage extends Event { @@ -18,8 +19,8 @@ class StatsUsage extends Event parent::__construct($publisher); $this - ->setQueue(Event::STATS_USAGE_QUEUE_NAME) - ->setClass(Event::STATS_USAGE_CLASS_NAME); + ->setQueue(System::getEnv('_APP_STATS_USAGE_QUEUE_NAME', Event::STATS_USAGE_QUEUE_NAME)) + ->setClass(System::getEnv('_APP_STATS_USAGE_CLASS_NAME', Event::STATS_USAGE_CLASS_NAME)); } /** diff --git a/src/Appwrite/Event/Webhook.php b/src/Appwrite/Event/Webhook.php index 5cc65758ee..f6d16c8b14 100644 --- a/src/Appwrite/Event/Webhook.php +++ b/src/Appwrite/Event/Webhook.php @@ -3,6 +3,7 @@ namespace Appwrite\Event; use Utopia\Queue\Publisher; +use Utopia\System\System; class Webhook extends Event { @@ -11,8 +12,8 @@ class Webhook extends Event parent::__construct($publisher); $this - ->setQueue(Event::WEBHOOK_QUEUE_NAME) - ->setClass(Event::WEBHOOK_CLASS_NAME); + ->setQueue(System::getEnv('_APP_WEBHOOK_QUEUE_NAME', Event::WEBHOOK_QUEUE_NAME)) + ->setClass(System::getEnv('_APP_WEBHOOK_CLASS_NAME', Event::WEBHOOK_CLASS_NAME)); } /** diff --git a/src/Appwrite/Functions/EventProcessor.php b/src/Appwrite/Functions/EventProcessor.php new file mode 100644 index 0000000000..8ed841d30d --- /dev/null +++ b/src/Appwrite/Functions/EventProcessor.php @@ -0,0 +1,106 @@ + + */ + public function getFunctionsEvents(?Document $project, Database $dbForProject): array + { + if ($project === null || + $project->isEmpty() || + $project->getId() === 'console') { + return []; + } + + $hostname = $dbForProject->getAdapter()->getHostname(); + $cacheKey = \sprintf( + '%s-cache-%s:%s:%s:project:%s:functions:events', + $dbForProject->getCacheName(), + $hostname ?? '', + $dbForProject->getNamespace(), + $dbForProject->getTenant(), + $project->getId() + ); + + $ttl = 3600; // 1 hour cache TTL + $cachedFunctionEvents = $dbForProject->getCache()->load($cacheKey, $ttl); + + if ($cachedFunctionEvents !== false) { + return \json_decode($cachedFunctionEvents, true) ?? []; + } + + try { + $events = []; + $limit = 100; + $sum = 100; + $offset = 0; + + while ($sum >= $limit) { + $functions = $dbForProject->find('functions', [ + Query::select(['$id', 'events']), + Query::limit($limit), + Query::offset($offset), + Query::orderAsc('$sequence'), + ]); + + $sum = \count($functions); + $offset = $offset + $limit; + + foreach ($functions as $function) { + $functionEvents = $function->getAttribute('events', []); + if (!empty($functionEvents)) { + $events = array_merge($events, $functionEvents); + } + } + } + + $uniqueEvents = \array_flip(\array_unique($events)); + $dbForProject->getCache()->save($cacheKey, \json_encode($uniqueEvents)); + + return $uniqueEvents; + } catch (\Throwable $e) { + return []; + } + } + + /** + * Get webhook events for a project from the project's webhooks attribute + * @param Document|null $project + * @return array + */ + public function getWebhooksEvents(?Document $project): array + { + if ($project === null || $project->isEmpty() || $project->getId() === 'console') { + return []; + } + + $webhooks = $project->getAttribute('webhooks', []); + if (empty($webhooks)) { + return []; + } + + $events = []; + foreach ($webhooks as $webhook) { + if ($webhook->getAttribute('enabled', false) !== true) { + continue; + } + + $webhookEvents = $webhook->getAttribute('events', []); + if (!empty($webhookEvents)) { + $events = array_merge($events, $webhookEvents); + } + } + + return \array_flip(\array_unique($events)); + } +} diff --git a/src/Appwrite/Messaging/Adapter/Realtime.php b/src/Appwrite/Messaging/Adapter/Realtime.php index 35b8089668..9e03a7aaf7 100644 --- a/src/Appwrite/Messaging/Adapter/Realtime.php +++ b/src/Appwrite/Messaging/Adapter/Realtime.php @@ -4,10 +4,13 @@ namespace Appwrite\Messaging\Adapter; use Appwrite\Messaging\Adapter as MessagingAdapter; use Appwrite\PubSub\Adapter\Pool as PubSubPool; +use Appwrite\Utopia\Database\RuntimeQuery; use Utopia\Database\DateTime; use Utopia\Database\Document; +use Utopia\Database\Exception\Query as QueryException; use Utopia\Database\Helpers\ID; use Utopia\Database\Helpers\Role; +use Utopia\Database\Query; class Realtime extends MessagingAdapter { @@ -51,9 +54,10 @@ class Realtime extends MessagingAdapter * @param mixed $identifier * @param array $roles * @param array $channels + * @param array $queries * @return void */ - public function subscribe(string $projectId, mixed $identifier, array $roles, array $channels): void + public function subscribe(string $projectId, mixed $identifier, array $roles, array $channels, array $queries = []): void { if (!isset($this->subscriptions[$projectId])) { // Init Project $this->subscriptions[$projectId] = []; @@ -72,7 +76,8 @@ class Realtime extends MessagingAdapter $this->connections[$identifier] = [ 'projectId' => $projectId, 'roles' => $roles, - 'channels' => $channels + 'channels' => $channels, + 'queries' => $queries ]; } @@ -206,7 +211,14 @@ class Realtime extends MessagingAdapter /** * To prevent duplicates, we save the connections as array keys. */ - $receivers[$id] = 0; + $queries = $this->connections[$id]['queries'] ?? []; + $payload = $event['data']['payload'] ?? []; + if ( + empty($queries) || + !empty(RuntimeQuery::filter($queries, $payload)) + ) { + $receivers[$id] = 0; + } } break; } @@ -245,6 +257,34 @@ class Realtime extends MessagingAdapter return $channels; } + /** + * Converts the queries from the Query Params into an array. + * @param array $queries + * @return array + */ + public static function convertQueries(array $queries): array + { + $queries = Query::parseQueries($queries); + $stack = $queries; + $allowedMethods = implode(', ', RuntimeQuery::ALLOWED_QUERIES); + while (!empty($stack)) { + /** `@var` Query $query */ + $query = array_pop($stack); + $method = $query->getMethod(); + if (!in_array($method, RuntimeQuery::ALLOWED_QUERIES, true)) { + $unsupportedMethod = $method; + throw new QueryException( + "Query method '{$unsupportedMethod}' is not supported in Realtime queries. Allowed query methods are: {$allowedMethods}" + ); + } + if (in_array($method, [Query::TYPE_AND, Query::TYPE_OR], true)) { + $stack = array_merge($stack, $query->getValues()); + } + } + + return $queries; + } + /** * Create channels array based on the event name and payload. * diff --git a/src/Appwrite/Migration/Migration.php b/src/Appwrite/Migration/Migration.php index 4d2db6a3dc..ea51225ba6 100644 --- a/src/Appwrite/Migration/Migration.php +++ b/src/Appwrite/Migration/Migration.php @@ -90,6 +90,7 @@ abstract class Migration '1.7.3' => 'V22', '1.7.4' => 'V22', '1.8.0' => 'V23', + '1.8.1' => 'V23', ]; /** diff --git a/src/Appwrite/Migration/Version/V23.php b/src/Appwrite/Migration/Version/V23.php index c7be832626..64a45fc9b2 100644 --- a/src/Appwrite/Migration/Version/V23.php +++ b/src/Appwrite/Migration/Version/V23.php @@ -139,7 +139,7 @@ class V23 extends Migration } catch (\Throwable $th) { Console::warning("Failed to migration error attribute size in collection {$id}: {$th->getMessage()}"); } - + break; case 'buckets': try { $this->createAttributeFromCollection($this->dbForProject, $id, 'transformations'); @@ -148,6 +148,21 @@ class V23 extends Migration } $this->dbForProject->purgeCachedCollection($id); break; + case 'users': + $attributes = [ + 'emailCanonical', + 'emailIsFree', + 'emailIsDisposable', + 'emailIsCorporate', + 'emailIsCanonical', + ]; + try { + $this->createAttributesFromCollection($this->dbForProject, $id, $attributes); + } catch (\Throwable $th) { + Console::warning('Failed to create attributes "' . \implode(', ', $attributes) . "\" in collection {$id}: {$th->getMessage()}"); + } + $this->dbForProject->purgeCachedCollection($id); + break; default: break; } diff --git a/src/Appwrite/Platform/AGENTS.md b/src/Appwrite/Platform/AGENTS.md new file mode 100644 index 0000000000..09bb7b784e --- /dev/null +++ b/src/Appwrite/Platform/AGENTS.md @@ -0,0 +1,67 @@ +# Modules AGENTS.md + +> Before reading this file, also read Appwrite's base [AGENTS.md](../../../AGENTS.md). + +Modules are the building blocks of the Appwrite platform. They are responsible for handling specific tasks, defining background workers, and providing API endpoints. Each module should have its own directory within the `src/Appwrite/Platform/Modules` directory. + +Generally-speaking, each service is its own module, but there are some exceptions. The goal is to always put related code that achieves a specific goal under one roof. + +## Structure and Naming Conventions + +When adding a module, always add a new directory under `src/Appwrite/Platform/Modules`. The directory name should be PascalCase, and if possible, use only one word. For example, `User`, `Database`, `Storage`, etc. Avoid using shorthands, unless they are standardized, such as `DB`, `JWT`, or `SMTP`. + +A module consists of: + +- `Module.php` - Simple register class registering all module's services (from `Services` directory) +- `Workers` directory - Contains behavior for module-specific workers +- `Tasks` directory - Contains behavior for module-specific CLI tasks +- `Http` directory - Contains HTTP endpoints for the module +- `Services` directory - Contains register classes for all relevant types of services + +Inside module, the `Services` directory can contain: + +- `Http.php` - Register HTTP endpoints and hooks from `Http` directory +- `Workers.php` - Register workers from `Workers` directory +- `Tasks.php` - Register CLI tasks from `Tasks` directory + +> After implementing a module, make sure to register it in `src/Appwrite/Platform/Appwrite.php`. + +### HTTP directory structure + +Inside module's `Http` directory, there are multiple rules to follow: + +1. Directly in `Http` directory, there should only be directories for services (and hooks, check point number 2). If a module is a single service, it's okay to only have one directory, with the same name as the service, for example `src/Appwrite/Platform/Modules/Account/Http/Account`. An example with multiple services is `src/Appwrite/Platform/Modules/Databases/Http/Databases` and `src/Appwrite/Platform/Modules/Databases/Http/TablesDB`. + +2. Hooks should live in `Hooks` directory, under `Init`, `Shutdown`, or `Error` directories, inside `Http` directory. For example, an init hook to prevent unauthorized access might live in `src/Appwrite/Platform/Modules/Functions/Http/Hooks/Init/Authentication.php`. + +3. Inside `Http` directories for services, file names can only be `Get.php`, `Update.php`, `Create.php`, `Delete.php` or `XList.php`. We call it `XList`, because `List` is a reserved keyword and PHP would not like that. Never use any other words! Let's say you want a method to be `blockUser`, tempting to add `Users/Block.php`, instead, think of the resource and property it affects. Better naming would be `Users/Status/Update.php` (update user's status). Doing so also nicely reflects in the HTTP endpoint, `PATCH /v1/users/:userId/status`. + +4. It's allowed to nest directories in `Http` service directories. For example, if you want to create a new deployment for a function based on a template, an endpoint might live in `src/Appwrite/Platform/Modules/Functions/Http/Functions/Deployments/Template/Create.php`. In this example, notice functions and deployments are resources, and template is property - both resources and properties can be nested, and have separate directories. + +### Sample module directory structure + +```bash +src/Appwrite/Platform/Modules/Functions +├── Module.php +├── Workers +│ └── Builds.php +├── Tasks +│ └── Block.php +├── Http +│ └── Functions +│ ├── Create.php +│ ├── XList.php +│ ├── Update.php +│ ├── Delete.php +│ ├── Get.php +│ └── Deployments +│ ├── XList.php +│ ├── Delete.php +│ ├── Get.php +│ └── Template +│ └── Create.php +└── Services + ├── Http.php + ├── Workers.php + └── Tasks.php +``` \ No newline at end of file diff --git a/src/Appwrite/Platform/Action.php b/src/Appwrite/Platform/Action.php index 5699a67ff2..ba93225a77 100644 --- a/src/Appwrite/Platform/Action.php +++ b/src/Appwrite/Platform/Action.php @@ -2,8 +2,6 @@ namespace Appwrite\Platform; -use Appwrite\Utopia\Request; -use Appwrite\Utopia\Response; use Swoole\Coroutine as Co; use Utopia\CLI\Console; use Utopia\Database\Database; @@ -22,9 +20,9 @@ class Action extends UtopiaAction protected mixed $logError; protected array $filters = [ - 'subQueryKeys', 'subQueryWebhooks', 'subQueryPlatforms', 'subQueryProjectVariables', 'subQueryBlocks', 'subQueryDevKeys', // Project + 'subQueryKeys', 'subQueryWebhooks', 'subQueryPlatforms', 'subQueryBlocks', 'subQueryDevKeys', // Project 'subQueryAuthenticators', 'subQuerySessions', 'subQueryTokens', 'subQueryChallenges', 'subQueryMemberships', 'subQueryTargets', 'subQueryTopicTargets',// Users - 'subQueryVariables', // Sites + 'subQueryVariables', 'subQueryProjectVariables' // Sites / Functions ]; /** @@ -107,9 +105,11 @@ class Action extends UtopiaAction } } - public function disableSubqueries() + public function disableSubqueries(array $filters = []): void { - $filters = $this->filters; + if (empty($filters)) { + $filters = $this->filters; + } foreach ($filters as $filter) { Database::addFilter( @@ -159,45 +159,4 @@ class Action extends UtopiaAction Console::info("[" . DateTime::now() . "] " . $method . ' ' . $type . ' ' . $project->getSequence() . ' ' . $project->getId() . ' ' . $collectionId . ' ' . $log); } } - - - /** - * Helper to apply (request) select queries to response model. - * - * This prevents default values of rules to be presnet for not-selected attributes - * - * @param Request $request - * @param Document $document - * @return void - */ - public function applySelectQueries(Request $request, Response $response, string $model): void - { - $queries = $request->getParam('queries', []); - - $queries = Query::parseQueries($queries); - $selectQueries = Query::groupByType($queries)['selections'] ?? []; - - // No select queries means no filtering out - if (empty($selectQueries)) { - return; - } - - $attributes = []; - foreach ($selectQueries as $query) { - foreach ($query->getValues() as $attribute) { - $attributes[] = $attribute; - } - } - - $responseModel = $response->getModel($model); - foreach ($responseModel->getRules() as $ruleName => $rule) { - if (\str_starts_with($ruleName, '$')) { - continue; - } - - if (!\in_array($ruleName, $attributes)) { - $responseModel->removeRule($ruleName); - } - } - } } diff --git a/src/Appwrite/Platform/Appwrite.php b/src/Appwrite/Platform/Appwrite.php index 4aa135c4f1..35347b4023 100644 --- a/src/Appwrite/Platform/Appwrite.php +++ b/src/Appwrite/Platform/Appwrite.php @@ -3,13 +3,16 @@ namespace Appwrite\Platform; use Appwrite\Platform\Modules\Account; +use Appwrite\Platform\Modules\Avatars; use Appwrite\Platform\Modules\Console; use Appwrite\Platform\Modules\Core; use Appwrite\Platform\Modules\Databases; use Appwrite\Platform\Modules\Functions; +use Appwrite\Platform\Modules\Health; use Appwrite\Platform\Modules\Projects; use Appwrite\Platform\Modules\Proxy; use Appwrite\Platform\Modules\Sites; +use Appwrite\Platform\Modules\Storage; use Appwrite\Platform\Modules\Tokens; use Utopia\Platform\Platform; @@ -19,12 +22,15 @@ class Appwrite extends Platform { parent::__construct(new Core()); $this->addModule(new Account\Module()); + $this->addModule(new Avatars\Module()); $this->addModule(new Databases\Module()); $this->addModule(new Projects\Module()); $this->addModule(new Functions\Module()); + $this->addModule(new Health\Module()); $this->addModule(new Sites\Module()); $this->addModule(new Console\Module()); $this->addModule(new Proxy\Module()); $this->addModule(new Tokens\Module()); + $this->addModule(new Storage\Module()); } } diff --git a/src/Appwrite/Platform/Modules/Account/Http/Account/MFA/Challenges/Create.php b/src/Appwrite/Platform/Modules/Account/Http/Account/MFA/Challenges/Create.php index 4dc50a8ec7..517963bbda 100644 --- a/src/Appwrite/Platform/Modules/Account/Http/Account/MFA/Challenges/Create.php +++ b/src/Appwrite/Platform/Modules/Account/Http/Account/MFA/Challenges/Create.php @@ -17,8 +17,8 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Template\Template; use Appwrite\Utopia\Request; use Appwrite\Utopia\Response; +use libphonenumber\NumberParseException; use libphonenumber\PhoneNumberUtil; -use Utopia\Abuse\Abuse; use Utopia\Auth\Proofs\Code as ProofsCode; use Utopia\Auth\Proofs\Token as ProofsToken; use Utopia\Database\Database; @@ -196,26 +196,21 @@ class Create extends Action ->setRecipients([$phone]) ->setProviderType(MESSAGE_TYPE_SMS); - if (isset($plan['authPhone'])) { - $timelimit = $timelimit('organization:{organizationId}', $plan['authPhone'], 30 * 24 * 60 * 60); // 30 days - $timelimit - ->setParam('{organizationId}', $project->getAttribute('teamId')); + $helper = PhoneNumberUtil::getInstance(); + try { + $countryCode = $helper->parse($phone)->getCountryCode(); - $abuse = new Abuse($timelimit); - if ($abuse->check() && System::getEnv('_APP_OPTIONS_ABUSE', 'enabled') === 'enabled') { - $helper = PhoneNumberUtil::getInstance(); - $countryCode = $helper->parse($phone)->getCountryCode(); - - if (!empty($countryCode)) { - $queueForStatsUsage - ->addMetric(str_replace('{countryCode}', $countryCode, METRIC_AUTH_METHOD_PHONE_COUNTRY_CODE), 1); - } + if (!empty($countryCode)) { + $queueForStatsUsage + ->addMetric(str_replace('{countryCode}', $countryCode, METRIC_AUTH_METHOD_PHONE_COUNTRY_CODE), 1); } - $queueForStatsUsage - ->addMetric(METRIC_AUTH_METHOD_PHONE, 1) - ->setProject($project) - ->trigger(); + } catch (NumberParseException $e) { + // Ignore invalid phone number for country code stats } + $queueForStatsUsage + ->addMetric(METRIC_AUTH_METHOD_PHONE, 1) + ->setProject($project) + ->trigger(); break; case Type::EMAIL: if (empty(System::getEnv('_APP_SMTP_HOST'))) { diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Action.php b/src/Appwrite/Platform/Modules/Avatars/Http/Action.php new file mode 100644 index 0000000000..bf7d01764f --- /dev/null +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Action.php @@ -0,0 +1,158 @@ +crop((int) $width, (int) $height); + $output = (empty($output)) ? $type : $output; + $data = $image->output($output, $quality); + $response + ->addHeader('Cache-Control', 'private, max-age=2592000') // 30 days + ->setContentType('image/png') + ->file($data); + unset($image); + } + + protected function getUserGitHub(string $userId, Document $project, Database $dbForProject, Database $dbForPlatform, ?Logger $logger, Authorization $authorization): array + { + try { + $user = $authorization->skip(fn () => $dbForPlatform->getDocument('users', $userId)); + + $sessions = $user->getAttribute('sessions', []); + + $gitHubSession = null; + foreach ($sessions as $session) { + if ($session->getAttribute('provider', '') === 'github') { + $gitHubSession = $session; + break; + } + } + + if (empty($gitHubSession)) { + throw new Exception(Exception::USER_SESSION_NOT_FOUND, 'GitHub session not found.'); + } + + $provider = $gitHubSession->getAttribute('provider', ''); + $accessToken = $gitHubSession->getAttribute('providerAccessToken'); + $accessTokenExpiry = $gitHubSession->getAttribute('providerAccessTokenExpiry'); + $refreshToken = $gitHubSession->getAttribute('providerRefreshToken'); + + $appId = $project->getAttribute('oAuthProviders', [])[$provider . 'Appid'] ?? ''; + $appSecret = $project->getAttribute('oAuthProviders', [])[$provider . 'Secret'] ?? '{}'; + + $oAuthProviders = Config::getParam('oAuthProviders'); + $className = $oAuthProviders[$provider]['class']; + if (!\class_exists($className)) { + throw new Exception(Exception::PROJECT_PROVIDER_UNSUPPORTED); + } + + $oauth2 = new $className($appId, $appSecret, '', [], []); + + $isExpired = new \DateTime($accessTokenExpiry) < new \DateTime('now'); + if ($isExpired) { + try { + $oauth2->refreshTokens($refreshToken); + + $accessToken = $oauth2->getAccessToken(''); + $refreshToken = $oauth2->getRefreshToken(''); + + $verificationId = $oauth2->getUserID($accessToken); + + if (empty($verificationId)) { + throw new \Exception("Locked tokens."); // Race codition, handeled in catch + } + + $gitHubSession + ->setAttribute('providerAccessToken', $accessToken) + ->setAttribute('providerRefreshToken', $refreshToken) + ->setAttribute('providerAccessTokenExpiry', DateTime::addSeconds(new \DateTime(), (int)$oauth2->getAccessTokenExpiry(''))); + + $authorization->skip(fn () => $dbForProject->updateDocument('sessions', $gitHubSession->getId(), $gitHubSession)); + + $dbForProject->purgeCachedDocument('users', $user->getId()); + } catch (Throwable $err) { + $index = 0; + do { + $previousAccessToken = $gitHubSession->getAttribute('providerAccessToken'); + + $user = $authorization->skip(fn () => $dbForPlatform->getDocument('users', $userId)); + $sessions = $user->getAttribute('sessions', []); + + $gitHubSession = new Document(); + foreach ($sessions as $session) { + if ($session->getAttribute('provider', '') === 'github') { + $gitHubSession = $session; + break; + } + } + + $accessToken = $gitHubSession->getAttribute('providerAccessToken'); + + if ($accessToken !== $previousAccessToken) { + break; + } + + $index++; + \usleep(500000); + } while ($index < 10); + } + } + + $oauth2 = new $className($appId, $appSecret, '', [], []); + $githubUser = $oauth2->getUserSlug($accessToken); + $githubId = $oauth2->getUserID($accessToken); + + return [ + 'name' => $githubUser, + 'id' => $githubId + ]; + } catch (Exception $error) { + return []; + } + } +} diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php new file mode 100644 index 0000000000..637ea647ef --- /dev/null +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php @@ -0,0 +1,64 @@ +setHttpMethod(UtopiaAction::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/avatars/browsers/:code') + ->desc('Get browser icon') + ->groups(['api', 'avatars']) + ->label('scope', 'avatars.read') + ->label('cache', true) + ->label('cache.resource', 'avatar/browser') + ->label('sdk', new Method( + namespace: 'avatars', + group: null, + name: 'getBrowser', + description: '/docs/references/avatars/get-browser.md', + auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], + type: MethodType::LOCATION, + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_NONE, + ) + ], + contentType: ContentType::IMAGE_PNG + )) + ->param('code', '', new WhiteList(\array_keys(Config::getParam('avatar-browsers'))), 'Browser Code.') + ->param('width', 100, new Range(0, 2000), 'Image width. Pass an integer between 0 to 2000. Defaults to 100.', true) + ->param('height', 100, new Range(0, 2000), 'Image height. Pass an integer between 0 to 2000. Defaults to 100.', true) + ->param('quality', -1, new Range(-1, 100), 'Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.', true) + ->inject('response') + ->callback($this->action(...)); + } + + public function action(string $code, int $width, int $height, int $quality, Response $response) + { + $this->avatar('browsers', $code, $width, $height, $quality, $response); + } +} diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Cards/Cloud/Back/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Cards/Cloud/Back/Get.php new file mode 100644 index 0000000000..a6a013ef21 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Cards/Cloud/Back/Get.php @@ -0,0 +1,116 @@ +setHttpMethod(UtopiaAction::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/cards/cloud-back') + ->desc('Get back Of Cloud Card') + ->groups(['api', 'avatars']) + ->label('scope', 'avatars.read') + ->label('cache', true) + ->label('cache.resourceType', 'cards/cloud-back') + ->label('cache.resource', 'card-back/{request.userId}') + ->label('docs', false) + ->label('origin', '*') + ->param('userId', '', new UID(), 'User ID.', true) + ->param('mock', '', new WhiteList(['golden', 'normal', 'platinum']), 'Mocking behaviour.', true) + ->param('width', 0, new Range(0, 512), 'Resize image width, Pass an integer between 0 to 512.', true) + ->param('height', 0, new Range(0, 320), 'Resize image height, Pass an integer between 0 to 320.', true) + ->inject('user') + ->inject('project') + ->inject('dbForProject') + ->inject('dbForPlatform') + ->inject('response') + ->inject('heroes') + ->inject('contributors') + ->inject('employees') + ->inject('logger') + ->inject('authorization') + ->callback($this->action(...)); + } + + public function action(string $userId, string $mock, int $width, int $height, Document $user, Document $project, Database $dbForProject, Database $dbForPlatform, Response $response, array $heroes, array $contributors, array $employees, ?Logger $logger, Authorization $authorization) + { + $user = $authorization->skip(fn () => $dbForPlatform->getDocument('users', $userId)); + + if ($user->isEmpty() && empty($mock)) { + throw new Exception(Exception::USER_NOT_FOUND); + } + + if (!$mock) { + $userId = $user->getId(); + $email = $user->getAttribute('email', ''); + + $gitHub = $this->getUserGitHub($user->getId(), $project, $dbForProject, $dbForPlatform, $logger, $authorization); + $githubId = $gitHub['id'] ?? ''; + + $isHero = \array_key_exists($email, $heroes); + $isContributor = \in_array($githubId, $contributors); + $isEmployee = \array_key_exists($email, $employees); + + $isGolden = $isEmployee || $isHero || $isContributor; + $isPlatinum = $user->getSequence() % 100 === 0; + } else { + $userId = '63e0bcf3c3eb803ba530'; + + $isGolden = $mock === 'golden'; + $isPlatinum = $mock === 'platinum'; + } + + $userId = 'UID ' . $userId; + + $isPlatinum = $isGolden ? false : $isPlatinum; + + $imagePath = $isGolden ? 'back-golden.png' : ($isPlatinum ? 'back-platinum.png' : 'back.png'); + + $baseImage = new Imagick($this->getAppRoot() . '/public/images/cards/cloud/' . $imagePath); + + setlocale(LC_ALL, "en_US.utf8"); + // $userId = \iconv("utf-8", "ascii//TRANSLIT", $userId); + + $text = new ImagickDraw(); + $text->setTextAlignment(Imagick::ALIGN_CENTER); + $text->setFont($this->getAppRoot() . '/public/fonts/SourceCodePro-Regular.ttf'); + $text->setFillColor(new ImagickPixel($isGolden ? '#664A1E' : ($isPlatinum ? '#555555' : '#E8E9F0'))); + $text->setFontSize(28); + $text->setFontWeight(400); + $baseImage->annotateImage($text, 512, 596, 0, $userId); + + if (!empty($width) || !empty($height)) { + $baseImage->resizeImage($width, $height, Imagick::FILTER_LANCZOS, 1); + } + + $response + ->addHeader('Cache-Control', 'private, max-age=3888000') // 45 days + ->setContentType('image/png') + ->file($baseImage->getImageBlob()); + } +} diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Cards/Cloud/Front/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Cards/Cloud/Front/Get.php new file mode 100644 index 0000000000..f8e7a35b05 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Cards/Cloud/Front/Get.php @@ -0,0 +1,245 @@ +setHttpMethod(UtopiaAction::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/cards/cloud') + ->desc('Get front Of Cloud Card') + ->groups(['api', 'avatars']) + ->label('scope', 'avatars.read') + ->label('cache', true) + ->label('cache.resourceType', 'cards/cloud') + ->label('cache.resource', 'card/{request.userId}') + ->label('docs', false) + ->label('origin', '*') + ->param('userId', '', new UID(), 'User ID.', true) + ->param('mock', '', new WhiteList(['employee', 'employee-2digit', 'hero', 'contributor', 'normal', 'platinum', 'normal-no-github', 'normal-long']), 'Mocking behaviour.', true) + ->param('width', 0, new Range(0, 512), 'Resize image width, Pass an integer between 0 to 512.', true) + ->param('height', 0, new Range(0, 320), 'Resize image height, Pass an integer between 0 to 320.', true) + ->inject('user') + ->inject('project') + ->inject('dbForProject') + ->inject('dbForPlatform') + ->inject('response') + ->inject('heroes') + ->inject('contributors') + ->inject('employees') + ->inject('logger') + ->inject('authorization') + ->callback($this->action(...)); + } + + public function action(string $userId, string $mock, int $width, int $height, Document $user, Document $project, Database $dbForProject, Database $dbForPlatform, Response $response, array $heroes, array $contributors, array $employees, ?Logger $logger, Authorization $authorization) + { + $user = $authorization->skip(fn () => $dbForPlatform->getDocument('users', $userId)); + + if ($user->isEmpty() && empty($mock)) { + throw new Exception(Exception::USER_NOT_FOUND); + } + + if (!$mock) { + $name = $user->getAttribute('name', 'Anonymous'); + $email = $user->getAttribute('email', ''); + $createdAt = new \DateTime($user->getCreatedAt()); + + $gitHub = $this->getUserGitHub($user->getId(), $project, $dbForProject, $dbForPlatform, $logger, $authorization); + $githubName = $gitHub['name'] ?? ''; + $githubId = $gitHub['id'] ?? ''; + + $isHero = \array_key_exists($email, $heroes); + $isContributor = \in_array($githubId, $contributors); + $isEmployee = \array_key_exists($email, $employees); + $employeeNumber = $isEmployee ? $employees[$email]['spot'] : ''; + + if ($isHero) { + $createdAt = new \DateTime($heroes[$email]['memberSince'] ?? ''); + } elseif ($isEmployee) { + $createdAt = new \DateTime($employees[$email]['memberSince'] ?? ''); + } + + if (!$isEmployee && !empty($githubName)) { + $employeeGitHub = \array_search(\strtolower($githubName), \array_map(fn ($employee) => \strtolower($employee['gitHub']) ?? '', $employees)); + if (!empty($employeeGitHub)) { + $isEmployee = true; + $employeeNumber = $isEmployee ? $employees[$employeeGitHub]['spot'] : ''; + $createdAt = new \DateTime($employees[$employeeGitHub]['memberSince'] ?? ''); + } + } + + $isPlatinum = $user->getSequence() % 100 === 0; + } else { + $name = $mock === 'normal-long' ? 'Sir First Walter O\'Brian Junior' : 'Walter O\'Brian'; + $createdAt = new \DateTime('now'); + $githubName = $mock === 'normal-no-github' ? '' : ($mock === 'normal-long' ? 'sir-first-walterobrian-junior' : 'walterobrian'); + $isHero = $mock === 'hero'; + $isContributor = $mock === 'contributor'; + $isEmployee = \str_starts_with($mock, 'employee'); + $employeeNumber = match ($mock) { + 'employee' => '1', + 'employee-2digit' => '18', + default => '' + }; + + $isPlatinum = $mock === 'platinum'; + } + + if ($isEmployee) { + $isContributor = false; + $isHero = false; + } + + if ($isHero) { + $isContributor = false; + $isEmployee = false; + } + + if ($isContributor) { + $isHero = false; + $isEmployee = false; + } + + $isGolden = $isEmployee || $isHero || $isContributor; + $isPlatinum = $isGolden ? false : $isPlatinum; + $memberSince = \strtoupper('Member since ' . $createdAt->format('M') . ' ' . $createdAt->format('d') . ', ' . $createdAt->format('o')); + + $imagePath = $isGolden ? 'front-golden.png' : ($isPlatinum ? 'front-platinum.png' : 'front.png'); + + $baseImage = new Imagick($this->getAppRoot() . '/public/images/cards/cloud/' . $imagePath); + + if ($isEmployee) { + $image = new Imagick($this->getAppRoot() . '/public/images/cards/cloud/employee.png'); + $image->setGravity(Imagick::GRAVITY_CENTER); + $baseImage->compositeImage($image, Imagick::COMPOSITE_OVER, 793, 35); + + $text = new ImagickDraw(); + $text->setTextAlignment(Imagick::ALIGN_CENTER); + $text->setFont($this->getAppRoot() . '/public/fonts/Inter-Bold.ttf'); + $text->setFillColor(new ImagickPixel('#FFFADF')); + $text->setFontSize(\strlen($employeeNumber) <= 2 ? 54 : 48); + $text->setFontWeight(700); + $metricsText = $baseImage->queryFontMetrics($text, $employeeNumber); + + $hashtag = new ImagickDraw(); + $hashtag->setTextAlignment(Imagick::ALIGN_CENTER); + $hashtag->setFont($this->getAppRoot() . '/public/fonts/Inter-Bold.ttf'); + $hashtag->setFillColor(new ImagickPixel('#FFFADF')); + $hashtag->setFontSize(28); + $hashtag->setFontWeight(700); + $metricsHashtag = $baseImage->queryFontMetrics($hashtag, '#'); + + $startX = 898; + $totalWidth = $metricsHashtag['textWidth'] + 12 + $metricsText['textWidth']; + + $hashtagX = ($metricsHashtag['textWidth'] / 2); + $textX = $hashtagX + 12 + ($metricsText['textWidth'] / 2); + + $hashtagX -= $totalWidth / 2; + $textX -= $totalWidth / 2; + + $hashtagX += $startX; + $textX += $startX; + + $baseImage->annotateImage($hashtag, $hashtagX, 150, 0, '#'); + $baseImage->annotateImage($text, $textX, 150, 0, $employeeNumber); + } + + if ($isContributor) { + $image = new Imagick($this->getAppRoot() . '/public/images/cards/cloud/contributor.png'); + $image->setGravity(Imagick::GRAVITY_CENTER); + $baseImage->compositeImage($image, Imagick::COMPOSITE_OVER, 793, 34); + } + + if ($isHero) { + $image = new Imagick($this->getAppRoot() . '/public/images/cards/cloud/hero.png'); + $image->setGravity(Imagick::GRAVITY_CENTER); + $baseImage->compositeImage($image, Imagick::COMPOSITE_OVER, 793, 34); + } + + setlocale(LC_ALL, "en_US.utf8"); + // $name = \iconv("utf-8", "ascii//TRANSLIT", $name); + // $memberSince = \iconv("utf-8", "ascii//TRANSLIT", $memberSince); + // $githubName = \iconv("utf-8", "ascii//TRANSLIT", $githubName); + + $text = new ImagickDraw(); + $text->setTextAlignment(Imagick::ALIGN_CENTER); + $text->setFont($this->getAppRoot() . '/public/fonts/Inter-Bold.ttf'); + $text->setFillColor(new ImagickPixel('#FFFFFF')); + + if (\strlen($name) > 32) { + $name = \substr($name, 0, 32); + } + + if (\strlen($name) <= 23) { + $text->setFontSize(80); + $scalingDown = false; + } else { + $text->setFontSize(54); + $scalingDown = true; + } + $text->setFontWeight(700); + $baseImage->annotateImage($text, 512, 477, 0, $name); + + $text = new ImagickDraw(); + $text->setTextAlignment(Imagick::ALIGN_CENTER); + $text->setFont($this->getAppRoot() . '/public/fonts/Inter-SemiBold.ttf'); + $text->setFillColor(new ImagickPixel($isGolden || $isPlatinum ? '#FFFFFF' : '#FFB9CC')); + $text->setFontSize(27); + $text->setFontWeight(600); + $text->setTextKerning(1.08); + $baseImage->annotateImage($text, 512, 541, 0, \strtoupper($memberSince)); + + if (!empty($githubName)) { + $text = new ImagickDraw(); + $text->setTextAlignment(Imagick::ALIGN_CENTER); + $text->setFont($this->getAppRoot() . '/public/fonts/Inter-Regular.ttf'); + $text->setFillColor(new ImagickPixel('#FFFFFF')); + $text->setFontSize($scalingDown ? 28 : 32); + $text->setFontWeight(400); + $metrics = $baseImage->queryFontMetrics($text, $githubName); + + $baseImage->annotateImage($text, 512 + 20 + 4, 373 + ($scalingDown ? 2 : 0), 0, $githubName); + + $image = new Imagick($this->getAppRoot() . '/public/images/cards/cloud/github.png'); + $image->setGravity(Imagick::GRAVITY_CENTER); + $precisionFix = 5; + $baseImage->compositeImage($image, Imagick::COMPOSITE_OVER, 512 - ($metrics['textWidth'] / 2) - 20 - 4, 373 - ($metrics['textHeight'] - $precisionFix)); + } + + if (!empty($width) || !empty($height)) { + $baseImage->resizeImage($width, $height, Imagick::FILTER_LANCZOS, 1); + } + + $response + ->addHeader('Cache-Control', 'private, max-age=3888000') // 45 days + ->setContentType('image/png') + ->file($baseImage->getImageBlob()); + } +} diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Cards/Cloud/OG/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Cards/Cloud/OG/Get.php new file mode 100644 index 0000000000..37776a3466 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Cards/Cloud/OG/Get.php @@ -0,0 +1,428 @@ +setHttpMethod(UtopiaAction::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/cards/cloud-og') + ->desc('Get OG image From Cloud Card') + ->groups(['api', 'avatars']) + ->label('scope', 'avatars.read') + ->label('cache', true) + ->label('cache.resourceType', 'cards/cloud-og') + ->label('cache.resource', 'card-og/{request.userId}') + ->label('docs', false) + ->label('origin', '*') + ->param('userId', '', new UID(), 'User ID.', true) + ->param('mock', '', new WhiteList(['employee', 'employee-2digit', 'hero', 'contributor', 'normal', 'platinum', 'normal-no-github', 'normal-long', 'normal-long-right', 'normal-long-middle', 'normal-bg2', 'normal-bg3', 'normal-right', 'normal-middle', 'platinum-right', 'platinum-middle', 'hero-middle', 'hero-right', 'contributor-right', 'employee-right', 'contributor-middle', 'employee-middle', 'employee-2digit-middle', 'employee-2digit-right']), 'Mocking behaviour.', true) + ->param('width', 0, new Range(0, 1024), 'Resize image card width, Pass an integer between 0 to 1024.', true) + ->param('height', 0, new Range(0, 1024), 'Resize image card height, Pass an integer between 0 to 1024.', true) + ->inject('user') + ->inject('project') + ->inject('dbForProject') + ->inject('dbForPlatform') + ->inject('response') + ->inject('heroes') + ->inject('contributors') + ->inject('employees') + ->inject('logger') + ->inject('authorization') + ->callback($this->action(...)); + } + + public function action(string $userId, string $mock, int $width, int $height, Document $user, Document $project, Database $dbForProject, Database $dbForPlatform, Response $response, array $heroes, array $contributors, array $employees, ?Logger $logger, Authorization $authorization) + { + $user = $authorization->skip(fn () => $dbForPlatform->getDocument('users', $userId)); + + if ($user->isEmpty() && empty($mock)) { + throw new Exception(Exception::USER_NOT_FOUND); + } + + if (!$mock) { + $sequence = $user->getSequence(); + $bgVariation = $sequence % 3 === 0 ? '1' : ($sequence % 3 === 1 ? '2' : '3'); + $cardVariation = $sequence % 3 === 0 ? '1' : ($sequence % 3 === 1 ? '2' : '3'); + + $name = $user->getAttribute('name', 'Anonymous'); + $email = $user->getAttribute('email', ''); + $createdAt = new \DateTime($user->getCreatedAt()); + + $gitHub = $this->getUserGitHub($user->getId(), $project, $dbForProject, $dbForPlatform, $logger, $authorization); + $githubName = $gitHub['name'] ?? ''; + $githubId = $gitHub['id'] ?? ''; + + $isHero = \array_key_exists($email, $heroes); + $isContributor = \in_array($githubId, $contributors); + $isEmployee = \array_key_exists($email, $employees); + $employeeNumber = $isEmployee ? $employees[$email]['spot'] : ''; + + if ($isHero) { + $createdAt = new \DateTime($heroes[$email]['memberSince'] ?? ''); + } elseif ($isEmployee) { + $createdAt = new \DateTime($employees[$email]['memberSince'] ?? ''); + } + + if (!$isEmployee && !empty($githubName)) { + $employeeGitHub = \array_search(\strtolower($githubName), \array_map(fn ($employee) => \strtolower($employee['gitHub']) ?? '', $employees)); + if (!empty($employeeGitHub)) { + $isEmployee = true; + $employeeNumber = $isEmployee ? $employees[$employeeGitHub]['spot'] : ''; + $createdAt = new \DateTime($employees[$employeeGitHub]['memberSince'] ?? ''); + } + } + + $isPlatinum = $user->getSequence() % 100 === 0; + } else { + $bgVariation = \str_ends_with($mock, '-bg2') ? '2' : (\str_ends_with($mock, '-bg3') ? '3' : '1'); + $cardVariation = \str_ends_with($mock, '-right') ? '2' : (\str_ends_with($mock, '-middle') ? '3' : '1'); + $name = \str_starts_with($mock, 'normal-long') ? 'Sir First Walter O\'Brian Junior' : 'Walter O\'Brian'; + $createdAt = new \DateTime('now'); + $githubName = $mock === 'normal-no-github' ? '' : (\str_starts_with($mock, 'normal-long') ? 'sir-first-walterobrian-junior' : 'walterobrian'); + $isHero = \str_starts_with($mock, 'hero'); + $isContributor = \str_starts_with($mock, 'contributor'); + $isEmployee = \str_starts_with($mock, 'employee'); + $employeeNumber = match ($mock) { + 'employee' => '1', + 'employee-right' => '1', + 'employee-middle' => '1', + 'employee-2digit' => '18', + 'employee-2digit-right' => '18', + 'employee-2digit-middle' => '18', + default => '' + }; + + $isPlatinum = \str_starts_with($mock, 'platinum'); + } + + if ($isEmployee) { + $isContributor = false; + $isHero = false; + } + + if ($isHero) { + $isContributor = false; + $isEmployee = false; + } + + if ($isContributor) { + $isHero = false; + $isEmployee = false; + } + + $isGolden = $isEmployee || $isHero || $isContributor; + $isPlatinum = $isGolden ? false : $isPlatinum; + $memberSince = \strtoupper('Member since ' . $createdAt->format('M') . ' ' . $createdAt->format('d') . ', ' . $createdAt->format('o')); + + $baseImage = new Imagick($this->getAppRoot() . "/public/images/cards/cloud/og-background{$bgVariation}.png"); + + $cardType = $isGolden ? '-golden' : ($isPlatinum ? '-platinum' : ''); + + $image = new Imagick($this->getAppRoot() . "/public/images/cards/cloud/og-card{$cardType}{$cardVariation}.png"); + $baseImage->compositeImage($image, Imagick::COMPOSITE_OVER, 1008 / 2 - $image->getImageWidth() / 2, 1008 / 2 - $image->getImageHeight() / 2); + + $imageLogo = new Imagick($this->getAppRoot() . '/public/images/cards/cloud/og-background-logo.png'); + $imageShadow = new Imagick($this->getAppRoot() . "/public/images/cards/cloud/og-shadow{$cardType}.png"); + if ($cardVariation === '1') { + $baseImage->compositeImage($imageLogo, Imagick::COMPOSITE_OVER, 32, 1008 - $imageLogo->getImageHeight() - 32); + $baseImage->compositeImage($imageShadow, Imagick::COMPOSITE_OVER, -450, 700); + } elseif ($cardVariation === '2') { + $baseImage->compositeImage($imageLogo, Imagick::COMPOSITE_OVER, 1008 - $imageLogo->getImageWidth() - 32, 1008 - $imageLogo->getImageHeight() - 32); + $baseImage->compositeImage($imageShadow, Imagick::COMPOSITE_OVER, -20, 710); + } else { + $baseImage->compositeImage($imageLogo, Imagick::COMPOSITE_OVER, 1008 - $imageLogo->getImageWidth() - 32, 1008 - $imageLogo->getImageHeight() - 32); + $baseImage->compositeImage($imageShadow, Imagick::COMPOSITE_OVER, -135, 710); + } + + if ($isEmployee) { + $file = $cardVariation === '3' ? 'employee-skew.png' : 'employee.png'; + $image = new Imagick($this->getAppRoot() . '/public/images/cards/cloud/' . $file); + $image->setGravity(Imagick::GRAVITY_CENTER); + + $hashtag = new ImagickDraw(); + $hashtag->setTextAlignment(Imagick::ALIGN_LEFT); + $hashtag->setFont($this->getAppRoot() . '/public/fonts/Inter-Bold.ttf'); + $hashtag->setFillColor(new ImagickPixel('#FFFADF')); + $hashtag->setFontSize(20); + $hashtag->setFontWeight(700); + + $text = new ImagickDraw(); + $text->setTextAlignment(Imagick::ALIGN_LEFT); + $text->setFont($this->getAppRoot() . '/public/fonts/Inter-Bold.ttf'); + $text->setFillColor(new ImagickPixel('#FFFADF')); + $text->setFontSize(\strlen($employeeNumber) <= 1 ? 36 : 28); + $text->setFontWeight(700); + + if ($cardVariation === '3') { + $hashtag->setFontSize(16); + $text->setFontSize(\strlen($employeeNumber) <= 1 ? 30 : 26); + + $hashtag->skewY(20); + $hashtag->skewX(20); + $text->skewY(20); + $text->skewX(20); + } + + $metricsHashtag = $baseImage->queryFontMetrics($hashtag, '#'); + $metricsText = $baseImage->queryFontMetrics($text, $employeeNumber); + + $group = new Imagick(); + $groupWidth = $metricsHashtag['textWidth'] + 6 + $metricsText['textWidth']; + + if ($cardVariation === '1') { + $group->newImage($groupWidth, $metricsText['textHeight'], '#00000000'); + $group->annotateImage($hashtag, 0, $metricsText['textHeight'], 0, '#'); + $group->annotateImage($text, $metricsHashtag['textWidth'] + 6, $metricsText['textHeight'], 0, $employeeNumber); + + $image->resizeImage(120, 120, Imagick::FILTER_LANCZOS, 1); + $image->rotateImage(new ImagickPixel('#00000000'), -20); + $baseImage->compositeImage($image, Imagick::COMPOSITE_OVER, 612, 203); + + $group->rotateImage(new ImagickPixel('#00000000'), -22); + + if (\strlen($employeeNumber) <= 1) { + $baseImage->compositeImage($group, Imagick::COMPOSITE_OVER, 660, 245); + } else { + $baseImage->compositeImage($group, Imagick::COMPOSITE_OVER, 655, 247); + } + } elseif ($cardVariation === '2') { + $group->newImage($groupWidth, $metricsText['textHeight'], '#00000000'); + $group->annotateImage($hashtag, 0, $metricsText['textHeight'], 0, '#'); + $group->annotateImage($text, $metricsHashtag['textWidth'] + 6, $metricsText['textHeight'], 0, $employeeNumber); + + $image->resizeImage(120, 120, Imagick::FILTER_LANCZOS, 1); + $image->rotateImage(new ImagickPixel('#00000000'), 30); + $baseImage->compositeImage($image, Imagick::COMPOSITE_OVER, 715, 425); + + $group->rotateImage(new ImagickPixel('#00000000'), 32); + + if (\strlen($employeeNumber) <= 1) { + $baseImage->compositeImage($group, Imagick::COMPOSITE_OVER, 775, 465); + } else { + $baseImage->compositeImage($group, Imagick::COMPOSITE_OVER, 767, 470); + } + } else { + $group->newImage(300, 300, '#00000000'); + + $hashtag->annotation(0, $metricsText['textHeight'], '#'); + $text->annotation($metricsHashtag['textWidth'] + 2, $metricsText['textHeight'], $employeeNumber); + + $group->drawImage($hashtag); + $group->drawImage($text); + + $baseImage->compositeImage($image, Imagick::COMPOSITE_OVER, 640, 293); + + if (\strlen($employeeNumber) <= 1) { + $baseImage->compositeImage($group, Imagick::COMPOSITE_OVER, 670, 317); + } else { + $baseImage->compositeImage($group, Imagick::COMPOSITE_OVER, 663, 322); + } + } + } + + if ($isContributor) { + $file = $cardVariation === '3' ? 'contributor-skew.png' : 'contributor.png'; + $image = new Imagick($this->getAppRoot() . '/public/images/cards/cloud/' . $file); + $image->setGravity(Imagick::GRAVITY_CENTER); + + if ($cardVariation === '1') { + $image->resizeImage(120, 120, Imagick::FILTER_LANCZOS, 1); + $image->rotateImage(new ImagickPixel('#00000000'), -20); + $baseImage->compositeImage($image, Imagick::COMPOSITE_OVER, 612, 203); + } elseif ($cardVariation === '2') { + $image->resizeImage(120, 120, Imagick::FILTER_LANCZOS, 1); + $image->rotateImage(new ImagickPixel('#00000000'), 30); + $baseImage->compositeImage($image, Imagick::COMPOSITE_OVER, 715, 425); + } else { + $baseImage->compositeImage($image, Imagick::COMPOSITE_OVER, 640, 293); + } + } + + if ($isHero) { + $file = $cardVariation === '3' ? 'hero-skew.png' : 'hero.png'; + $image = new Imagick($this->getAppRoot() . '/public/images/cards/cloud/' . $file); + $image->setGravity(Imagick::GRAVITY_CENTER); + + if ($cardVariation === '1') { + $image->resizeImage(120, 120, Imagick::FILTER_LANCZOS, 1); + $image->rotateImage(new ImagickPixel('#00000000'), -20); + $baseImage->compositeImage($image, Imagick::COMPOSITE_OVER, 612, 203); + } elseif ($cardVariation === '2') { + $image->resizeImage(120, 120, Imagick::FILTER_LANCZOS, 1); + $image->rotateImage(new ImagickPixel('#00000000'), 30); + $baseImage->compositeImage($image, Imagick::COMPOSITE_OVER, 715, 425); + } else { + $baseImage->compositeImage($image, Imagick::COMPOSITE_OVER, 640, 293); + } + } + + setlocale(LC_ALL, "en_US.utf8"); + // $name = \iconv("utf-8", "ascii//TRANSLIT", $name); + // $memberSince = \iconv("utf-8", "ascii//TRANSLIT", $memberSince); + // $githubName = \iconv("utf-8", "ascii//TRANSLIT", $githubName); + + $textName = new ImagickDraw(); + $textName->setTextAlignment(Imagick::ALIGN_CENTER); + $textName->setFont($this->getAppRoot() . '/public/fonts/Inter-Bold.ttf'); + $textName->setFillColor(new ImagickPixel('#FFFFFF')); + + if (\strlen($name) > 32) { + $name = \substr($name, 0, 32); + } + + if ($cardVariation === '1') { + if (\strlen($name) <= 23) { + $scalingDown = false; + $textName->setFontSize(54); + } else { + $scalingDown = true; + $textName->setFontSize(36); + } + } elseif ($cardVariation === '2') { + if (\strlen($name) <= 23) { + $scalingDown = false; + $textName->setFontSize(50); + } else { + $scalingDown = true; + $textName->setFontSize(34); + } + } else { + if (\strlen($name) <= 23) { + $scalingDown = false; + $textName->setFontSize(44); + } else { + $scalingDown = true; + $textName->setFontSize(32); + } + } + + $textName->setFontWeight(700); + + $textMember = new ImagickDraw(); + $textMember->setTextAlignment(Imagick::ALIGN_CENTER); + $textMember->setFont($this->getAppRoot() . '/public/fonts/Inter-Medium.ttf'); + $textMember->setFillColor(new ImagickPixel($isGolden || $isPlatinum ? '#FFFFFF' : '#FFB9CC')); + $textMember->setFontWeight(500); + $textMember->setTextKerning(1.12); + + if ($cardVariation === '1') { + $textMember->setFontSize(21); + + $baseImage->annotateImage($textName, 550, 600, -22, $name); + $baseImage->annotateImage($textMember, 585, 635, -22, $memberSince); + } elseif ($cardVariation === '2') { + $textMember->setFontSize(20); + + $baseImage->annotateImage($textName, 435, 590, 31.37, $name); + $baseImage->annotateImage($textMember, 412, 628, 31.37, $memberSince); + } else { + $textMember->setFontSize(16); + + $textName->skewY(20); + $textName->skewX(20); + $textName->annotation(320, 700, $name); + + $textMember->skewY(20); + $textMember->skewX(20); + $textMember->annotation(330, 735, $memberSince); + + $baseImage->drawImage($textName); + $baseImage->drawImage($textMember); + } + + if (!empty($githubName)) { + $text = new ImagickDraw(); + $text->setTextAlignment(Imagick::ALIGN_LEFT); + $text->setFont($this->getAppRoot() . '/public/fonts/Inter-Regular.ttf'); + $text->setFillColor(new ImagickPixel('#FFFFFF')); + $text->setFontSize($scalingDown ? 16 : 20); + $text->setFontWeight(400); + + if ($cardVariation === '1') { + $metrics = $baseImage->queryFontMetrics($text, $githubName); + + $group = new Imagick(); + $groupWidth = $metrics['textWidth'] + 32 + 4; + $group->newImage($groupWidth, $metrics['textHeight'] + 10, '#00000000'); + $image = new Imagick($this->getAppRoot() . '/public/images/cards/cloud/github.png'); + $image->setGravity(Imagick::GRAVITY_CENTER); + $image->resizeImage(32, 32, Imagick::FILTER_LANCZOS, 1); + $precisionFix = -1; + + $group->compositeImage($image, Imagick::COMPOSITE_OVER, 0, 0); + $group->annotateImage($text, 32 + 4, $metrics['textHeight'] - $precisionFix, 0, $githubName); + + $group->rotateImage(new ImagickPixel('#00000000'), -22); + $x = 510 - $group->getImageWidth() / 2; + $y = 530 - $group->getImageHeight() / 2; + $baseImage->compositeImage($group, Imagick::COMPOSITE_OVER, $x, $y); + } elseif ($cardVariation === '2') { + $metrics = $baseImage->queryFontMetrics($text, $githubName); + + $group = new Imagick(); + $groupWidth = $metrics['textWidth'] + 32 + 4; + $group->newImage($groupWidth, $metrics['textHeight'] + 10, '#00000000'); + $image = new Imagick($this->getAppRoot() . '/public/images/cards/cloud/github.png'); + $image->setGravity(Imagick::GRAVITY_CENTER); + $image->resizeImage(32, 32, Imagick::FILTER_LANCZOS, 1); + $precisionFix = -1; + + $group->compositeImage($image, Imagick::COMPOSITE_OVER, 0, 0); + $group->annotateImage($text, 32 + 4, $metrics['textHeight'] - $precisionFix, 0, $githubName); + + $group->rotateImage(new ImagickPixel('#00000000'), 31.11); + $x = 485 - $group->getImageWidth() / 2; + $y = 530 - $group->getImageHeight() / 2; + $baseImage->compositeImage($group, Imagick::COMPOSITE_OVER, $x, $y); + } else { + $text->skewY(20); + $text->skewX(20); + $text->setTextAlignment(Imagick::ALIGN_CENTER); + + $text->annotation(320 + 15 + 2, 640, $githubName); + $metrics = $baseImage->queryFontMetrics($text, $githubName); + + $image = new Imagick($this->getAppRoot() . '/public/images/cards/cloud/github-skew.png'); + $image->setGravity(Imagick::GRAVITY_CENTER); + $baseImage->compositeImage($image, Imagick::COMPOSITE_OVER, 512 - ($metrics['textWidth'] / 2), 518 + \strlen($githubName) * 1.3); + + $baseImage->drawImage($text); + } + } + + if (!empty($width) || !empty($height)) { + $baseImage->resizeImage($width, $height, Imagick::FILTER_LANCZOS, 1); + } + + $response + ->addHeader('Cache-Control', 'private, max-age=3888000') // 45 days + ->setContentType('image/png') + ->file($baseImage->getImageBlob()); + } +} diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/CreditCards/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/CreditCards/Get.php new file mode 100644 index 0000000000..87357f14c7 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Avatars/Http/CreditCards/Get.php @@ -0,0 +1,64 @@ +setHttpMethod(UtopiaAction::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/avatars/credit-cards/:code') + ->desc('Get credit card icon') + ->groups(['api', 'avatars']) + ->label('scope', 'avatars.read') + ->label('cache', true) + ->label('cache.resource', 'avatar/credit-card') + ->label('sdk', new Method( + namespace: 'avatars', + group: null, + name: 'getCreditCard', + description: '/docs/references/avatars/get-credit-card.md', + auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], + type: MethodType::LOCATION, + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_NONE, + ) + ], + contentType: ContentType::IMAGE_PNG + )) + ->param('code', '', new WhiteList(\array_keys(Config::getParam('avatar-credit-cards'))), 'Credit Card Code. Possible values: ' . \implode(', ', \array_keys(Config::getParam('avatar-credit-cards'))) . '.') + ->param('width', 100, new Range(0, 2000), 'Image width. Pass an integer between 0 to 2000. Defaults to 100.', true) + ->param('height', 100, new Range(0, 2000), 'Image height. Pass an integer between 0 to 2000. Defaults to 100.', true) + ->param('quality', -1, new Range(-1, 100), 'Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.', true) + ->inject('response') + ->callback($this->action(...)); + } + + public function action(string $code, int $width, int $height, int $quality, Response $response) + { + $this->avatar('credit-cards', $code, $width, $height, $quality, $response); + } +} diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php new file mode 100644 index 0000000000..0a4d652d0e --- /dev/null +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php @@ -0,0 +1,216 @@ +setHttpMethod(UtopiaAction::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/avatars/favicon') + ->desc('Get favicon') + ->groups(['api', 'avatars']) + ->label('scope', 'avatars.read') + ->label('cache', true) + ->label('cache.resource', 'avatar/favicon') + ->label('sdk', new Method( + namespace: 'avatars', + group: null, + name: 'getFavicon', + description: '/docs/references/avatars/get-favicon.md', + auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], + type: MethodType::LOCATION, + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_NONE, + ) + ], + contentType: ContentType::IMAGE + )) + ->param('url', '', new URL(['http', 'https']), 'Website URL which you want to fetch the favicon from.') + ->inject('response') + ->callback($this->action(...)); + } + + public function action(string $url, Response $response) + { + $width = 56; + $height = 56; + $quality = 80; + $output = 'png'; + $type = 'png'; + + if (!\extension_loaded('imagick')) { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Imagick extension is missing'); + } + + $domain = new Domain(\parse_url($url, PHP_URL_HOST)); + + if (!$domain->isKnown()) { + throw new Exception(Exception::AVATAR_REMOTE_URL_FAILED); + } + + $client = new Client(); + try { + $res = $client + ->setAllowRedirects(true) + ->setMaxRedirects(5) + ->setUserAgent(\sprintf( + APP_USERAGENT, + System::getEnv('_APP_VERSION', 'UNKNOWN'), + System::getEnv('_APP_EMAIL_SECURITY', System::getEnv('_APP_SYSTEM_SECURITY_EMAIL_ADDRESS', APP_EMAIL_SECURITY)) + )) + ->fetch($url); + } catch (\Throwable) { + throw new Exception(Exception::AVATAR_REMOTE_URL_FAILED); + } + + $doc = new DOMDocument(); + $doc->strictErrorChecking = false; + @$doc->loadHTML($res->getBody()); + + $links = $doc->getElementsByTagName('link') ?? []; + $outputHref = ''; + $outputExt = ''; + $space = 0; + + foreach ($links as $link) { /* @var $link DOMElement */ + $href = $link->getAttribute('href'); + $rel = $link->getAttribute('rel'); + $sizes = $link->getAttribute('sizes'); + $absolute = URLParse::unparse(\array_merge(\parse_url($url), \parse_url($href))); + + switch (\strtolower($rel)) { + case 'icon': + case 'shortcut icon': + //case 'apple-touch-icon': + $ext = \pathinfo(\parse_url($absolute, PHP_URL_PATH), PATHINFO_EXTENSION); + + switch ($ext) { + case 'svg': + // SVG icons are prioritized by assigning the maximum possible value. + $space = PHP_INT_MAX; + $outputHref = $absolute; + $outputExt = $ext; + break; + case 'ico': + case 'png': + case 'jpg': + case 'jpeg': + $size = \explode('x', \strtolower($sizes)); + + $sizeWidth = (int) ($size[0] ?? 0); + $sizeHeight = (int) ($size[1] ?? 0); + + if (($sizeWidth * $sizeHeight) >= $space) { + $space = $sizeWidth * $sizeHeight; + $outputHref = $absolute; + $outputExt = $ext; + } + + break; + } + + break; + } + } + + if (empty($outputHref) || empty($outputExt)) { + $default = \parse_url($url); + + $outputHref = $default['scheme'] . '://' . $default['host'] . '/favicon.ico'; + $outputExt = 'ico'; + } + + $domain = new Domain(\parse_url($outputHref, PHP_URL_HOST)); + + if (!$domain->isKnown()) { + throw new Exception(Exception::AVATAR_REMOTE_URL_FAILED); + } + + $client = new Client(); + try { + $res = $client + ->setAllowRedirects(true) + ->setMaxRedirects(5) + ->fetch($outputHref); + } catch (\Throwable) { + throw new Exception(Exception::AVATAR_REMOTE_URL_FAILED); + } + + if ($res->getStatusCode() !== 200) { + throw new Exception(Exception::AVATAR_ICON_NOT_FOUND); + } + + $data = $res->getBody(); + + if ('ico' === $outputExt) { // Skip crop, Imagick isn\'t supporting icon files + if ( + empty($data) || + stripos($data, 'addHeader('Cache-Control', 'private, max-age=2592000') // 30 days + ->setContentType('image/x-icon') + ->file($data); + return; + } + + if ('svg' === $outputExt) { // Skip crop, Imagick isn\'t supporting svg files + $sanitizer = new SvgSanitizer(); + $sanitizer->minify(true); + $cleanSvg = $sanitizer->sanitize($data); + if ($cleanSvg === false) { + throw new Exception(Exception::AVATAR_SVG_SANITIZATION_FAILED); + } + $response + ->addHeader('Cache-Control', 'private, max-age=2592000') // 30 days + ->setContentType('image/svg+xml') + ->file($cleanSvg); + return; + } + + $image = new Image($data); + $image->crop((int) $width, (int) $height); + $output = (empty($output)) ? $type : $output; + $data = $image->output($output, $quality); + + $response + ->addHeader('Cache-Control', 'private, max-age=2592000') // 30 days + ->setContentType('image/png') + ->file($data); + unset($image); + } +} diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php new file mode 100644 index 0000000000..8230b15f50 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php @@ -0,0 +1,64 @@ +setHttpMethod(UtopiaAction::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/avatars/flags/:code') + ->desc('Get country flag') + ->groups(['api', 'avatars']) + ->label('scope', 'avatars.read') + ->label('cache', true) + ->label('cache.resource', 'avatar/flag') + ->label('sdk', new Method( + namespace: 'avatars', + group: null, + name: 'getFlag', + description: '/docs/references/avatars/get-flag.md', + auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], + type: MethodType::LOCATION, + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_NONE, + ) + ], + contentType: ContentType::IMAGE_PNG + )) + ->param('code', '', new WhiteList(\array_keys(Config::getParam('avatar-flags'))), 'Country Code. ISO Alpha-2 country code format.') + ->param('width', 100, new Range(0, 2000), 'Image width. Pass an integer between 0 to 2000. Defaults to 100.', true) + ->param('height', 100, new Range(0, 2000), 'Image height. Pass an integer between 0 to 2000. Defaults to 100.', true) + ->param('quality', -1, new Range(-1, 100), 'Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.', true) + ->inject('response') + ->callback($this->action(...)); + } + + public function action(string $code, int $width, int $height, int $quality, Response $response) + { + $this->avatar('flags', $code, $width, $height, $quality, $response); + } +} diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php new file mode 100644 index 0000000000..eb56ddf0b2 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php @@ -0,0 +1,107 @@ +setHttpMethod(UtopiaAction::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/avatars/image') + ->desc('Get image from URL') + ->groups(['api', 'avatars']) + ->label('scope', 'avatars.read') + ->label('cache', true) + ->label('cache.resource', 'avatar/image') + ->label('sdk', new Method( + namespace: 'avatars', + group: null, + name: 'getImage', + description: '/docs/references/avatars/get-image.md', + auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], + type: MethodType::LOCATION, + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_NONE, + ) + ], + contentType: ContentType::IMAGE + )) + ->param('url', '', new URL(['http', 'https']), 'Image URL which you want to crop.') + ->param('width', 400, new Range(0, 2000), 'Resize preview image width, Pass an integer between 0 to 2000. Defaults to 400.', true) + ->param('height', 400, new Range(0, 2000), 'Resize preview image height, Pass an integer between 0 to 2000. Defaults to 400.', true) + ->inject('response') + ->callback($this->action(...)); + } + + public function action(string $url, int $width, int $height, Response $response) + { + $quality = 80; + $output = 'png'; + $type = 'png'; + + if (!\extension_loaded('imagick')) { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Imagick extension is missing'); + } + + $domain = new Domain(\parse_url($url, PHP_URL_HOST)); + + if (!$domain->isKnown()) { + throw new Exception(Exception::AVATAR_REMOTE_URL_FAILED); + } + + $client = new Client(); + try { + $res = $client + ->setAllowRedirects(false) + ->fetch($url); + } catch (\Throwable) { + throw new Exception(Exception::AVATAR_REMOTE_URL_FAILED); + } + + if ($res->getStatusCode() !== 200) { + throw new Exception(Exception::AVATAR_IMAGE_NOT_FOUND); + } + + try { + $image = new Image($res->getBody()); + } catch (\Throwable $exception) { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Unable to parse image'); + } + + $image->crop((int) $width, (int) $height); + $output = (empty($output)) ? $type : $output; + $data = $image->output($output, $quality); + + $response + ->addHeader('Cache-Control', 'private, max-age=2592000') // 30 days + ->setContentType('image/png') + ->file($data); + unset($image); + } +} diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php new file mode 100644 index 0000000000..8278a43ea3 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php @@ -0,0 +1,127 @@ +setHttpMethod(UtopiaAction::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/avatars/initials') + ->desc('Get user initials') + ->groups(['api', 'avatars']) + ->label('scope', 'avatars.read') + ->label('cache.resource', 'avatar/initials') + ->label('sdk', new Method( + namespace: 'avatars', + group: null, + name: 'getInitials', + description: '/docs/references/avatars/get-initials.md', + auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], + type: MethodType::LOCATION, + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_NONE, + ) + ], + contentType: ContentType::IMAGE_PNG + )) + ->param('name', '', new Text(128), 'Full Name. When empty, current user name or email will be used. Max length: 128 chars.', true) + ->param('width', 500, new Range(0, 2000), 'Image width. Pass an integer between 0 to 2000. Defaults to 100.', true) + ->param('height', 500, new Range(0, 2000), 'Image height. Pass an integer between 0 to 2000. Defaults to 100.', true) + ->param('background', '', new HexColor(), 'Changes background color. By default a random color will be picked and stay will persistent to the given name.', true) + ->inject('response') + ->inject('user') + ->callback($this->action(...)); + } + + public function action(string $name, int $width, int $height, string $background, Response $response, Document $user) + { + $themes = [ + ['background' => '#FD366E'], // Default (Pink) + ['background' => '#FE9567'], // Orange + ['background' => '#7C67FE'], // Purple + ['background' => '#68A3FE'], // Blue + ['background' => '#85DBD8'], // Mint + ]; + + $name = (!empty($name)) ? $name : $user->getAttribute('name', $user->getAttribute('email', '')); + $words = \explode(' ', \strtoupper($name)); + // if there is no space, try to split by `_` underscore + $words = (count($words) == 1) ? \explode('_', \strtoupper($name)) : $words; + + $initials = ''; + $code = 0; + + foreach ($words as $key => $w) { + if (ctype_alnum($w[0] ?? '')) { + $initials .= $w[0]; + $code += ord($w[0]); + + if ($key == 1) { + break; + } + } + } + + $rand = \substr($code, -1); + + $rand = ($rand > \count($themes) - 1) ? $rand % \count($themes) : $rand; + + $background = (!empty($background)) ? '#' . $background : $themes[$rand]['background']; + + $image = new Imagick(); + $punch = new Imagick(); + $draw = new ImagickDraw(); + $fontSize = \min($width, $height) / 2; + + $punch->newImage($width, $height, 'transparent'); + + $draw->setFont($this->getAppRoot() . '/app/assets/fonts/inter-v8-latin-regular.woff2'); + $image->setFont($this->getAppRoot() . '/app/assets/fonts/inter-v8-latin-regular.woff2'); + + $draw->setFillColor(new ImagickPixel('black')); + $draw->setFontSize($fontSize); + + $draw->setTextAlignment(Imagick::ALIGN_CENTER); + $draw->annotation($width / 1.97, ($height / 2) + ($fontSize / 3), $initials); + + $punch->drawImage($draw); + $punch->negateImage(true, Imagick::CHANNEL_ALPHA); + + $image->newImage($width, $height, $background); + $image->setImageFormat("png"); + $image->compositeImage($punch, Imagick::COMPOSITE_COPYOPACITY, 0, 0); + + $response + ->addHeader('Cache-Control', 'private, max-age=3888000') // 45 days + ->setContentType('image/png') + ->file($image->getImageBlob()); + } +} diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php new file mode 100644 index 0000000000..27fd8708d9 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php @@ -0,0 +1,85 @@ +setHttpMethod(UtopiaAction::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/avatars/qr') + ->desc('Get QR code') + ->groups(['api', 'avatars']) + ->label('scope', 'avatars.read') + ->label('sdk', new Method( + namespace: 'avatars', + group: null, + name: 'getQR', + description: '/docs/references/avatars/get-qr.md', + auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], + type: MethodType::LOCATION, + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_NONE, + ) + ], + contentType: ContentType::IMAGE_PNG + )) + ->param('text', '', new Text(512), 'Plain text to be converted to QR code image.') + ->param('size', 400, new Range(1, 1000), 'QR code size. Pass an integer between 1 to 1000. Defaults to 400.', true) + ->param('margin', 1, new Range(0, 10), 'Margin from edge. Pass an integer between 0 to 10. Defaults to 1.', true) + ->param('download', false, new Boolean(true), 'Return resulting image with \'Content-Disposition: attachment \' headers for the browser to start downloading it. Pass 0 for no header, or 1 for otherwise. Default value is set to 0.', true) + ->inject('response') + ->callback($this->action(...)); + } + + public function action(string $text, int $size, int $margin, bool $download, Response $response) + { + $download = ($download === '1' || $download === 'true' || $download === 1 || $download === true); + $options = new QROptions([ + 'addQuietzone' => true, + 'quietzoneSize' => $margin, + 'outputType' => QRCode::OUTPUT_IMAGICK, + 'scale' => 15, + ]); + + $qrcode = new QRCode($options); + + if ($download) { + $response->addHeader('Content-Disposition', 'attachment; filename="qr.png"'); + } + + $image = new Image($qrcode->render($text)); + $image->crop((int) $size, (int) $size); + + $response + ->addHeader('Cache-Control', 'private, max-age=3888000') // 45 days + ->setContentType('image/png') + ->send($image->output('png', 90)); + } +} diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Screenshots/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Screenshots/Get.php new file mode 100644 index 0000000000..b6fd354ee3 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Screenshots/Get.php @@ -0,0 +1,225 @@ +setHttpMethod(UtopiaAction::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/avatars/screenshots') + ->desc('Get webpage screenshot') + ->groups(['api', 'avatars']) + ->label('scope', 'avatars.read') + ->label('usage.metric', METRIC_AVATARS_SCREENSHOTS_GENERATED) + ->label('abuse-limit', 60) + ->label('cache', true) + ->label('cache.resourceType', 'avatar/screenshot') + ->label('cache.resource', 'screenshot/{request.url}/{request.width}/{request.height}/{request.scale}/{request.theme}/{request.userAgent}/{request.fullpage}/{request.locale}/{request.timezone}/{request.latitude}/{request.longitude}/{request.accuracy}/{request.touch}/{request.permissions}/{request.sleep}/{request.quality}/{request.output}') + ->label('sdk', new Method( + namespace: 'avatars', + group: null, + name: 'getScreenshot', + description: '/docs/references/avatars/get-screenshot.md', + auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], + type: MethodType::LOCATION, + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_NONE, + ) + ], + contentType: ContentType::IMAGE_PNG + )) + ->param('url', '', new URL(['http', 'https']), 'Website URL which you want to capture.', example: 'https://example.com') + ->param('headers', [], new Assoc(), 'HTTP headers to send with the browser request. Defaults to empty.', true, example: '{"Authorization":"Bearer token123","X-Custom-Header":"value"}') + ->param('viewportWidth', 1280, new Range(1, 1920), 'Browser viewport width. Pass an integer between 1 to 1920. Defaults to 1280.', true, example: '1920') + ->param('viewportHeight', 720, new Range(1, 1080), 'Browser viewport height. Pass an integer between 1 to 1080. Defaults to 720.', true, example: '1080') + ->param('scale', 1, new Range(0.1, 3, Range::TYPE_FLOAT), 'Browser scale factor. Pass a number between 0.1 to 3. Defaults to 1.', true, example: '2') + ->param('theme', 'light', new WhiteList(['light', 'dark']), 'Browser theme. Pass "light" or "dark". Defaults to "light".', true, example: 'dark') + ->param('userAgent', '', new Text(512), 'Custom user agent string. Defaults to browser default.', true, example: 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15') + ->param('fullpage', false, new Boolean(true), 'Capture full page scroll. Pass 0 for viewport only, or 1 for full page. Defaults to 0.', true, example: 'true') + ->param('locale', '', new Text(10), 'Browser locale (e.g., "en-US", "fr-FR"). Defaults to browser default.', true, example: 'en-US') + ->param('timezone', '', new WhiteList(timezone_identifiers_list()), 'IANA timezone identifier (e.g., "America/New_York", "Europe/London"). Defaults to browser default.', true, example: 'america/new_york') + ->param('latitude', 0, new Range(-90, 90, Range::TYPE_FLOAT), 'Geolocation latitude. Pass a number between -90 to 90. Defaults to 0.', true, example: '37.7749') + ->param('longitude', 0, new Range(-180, 180, Range::TYPE_FLOAT), 'Geolocation longitude. Pass a number between -180 to 180. Defaults to 0.', true, example: '-122.4194') + ->param('accuracy', 0, new Range(0, 100000, Range::TYPE_FLOAT), 'Geolocation accuracy in meters. Pass a number between 0 to 100000. Defaults to 0.', true, example: '100') + ->param('touch', false, new Boolean(true), 'Enable touch support. Pass 0 for no touch, or 1 for touch enabled. Defaults to 0.', true, example: 'true') + ->param('permissions', [], new ArrayList(new WhiteList(['geolocation', 'camera', 'microphone', 'notifications', 'midi', 'push', 'clipboard-read', 'clipboard-write', 'payment-handler', 'usb', 'bluetooth', 'accelerometer', 'gyroscope', 'magnetometer', 'ambient-light-sensor', 'background-sync', 'persistent-storage', 'screen-wake-lock', 'web-share', 'xr-spatial-tracking'])), 'Browser permissions to grant. Pass an array of permission names like ["geolocation", "camera", "microphone"]. Defaults to empty.', true, example: '["geolocation","notifications"]') + ->param('sleep', 0, new Range(0, 10), 'Wait time in seconds before taking the screenshot. Pass an integer between 0 to 10. Defaults to 0.', true, example: '3') + ->param('width', 0, new Range(0, 2000), 'Output image width. Pass 0 to use original width, or an integer between 1 to 2000. Defaults to 0 (original width).', true, example: '800') + ->param('height', 0, new Range(0, 2000), 'Output image height. Pass 0 to use original height, or an integer between 1 to 2000. Defaults to 0 (original height).', true, example: '600') + ->param('quality', -1, new Range(-1, 100), 'Screenshot quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.', true, example: '85') + ->param('output', '', new WhiteList(\array_keys(Config::getParam('storage-outputs')), true), 'Output format type (jpeg, jpg, png, gif and webp).', true, example: 'jpeg') + ->inject('response') + ->inject('queueForStatsUsage') + ->callback($this->action(...)); + } + + public function action(string $url, array $headers, int $viewportWidth, int $viewportHeight, float $scale, string $theme, string $userAgent, bool $fullpage, string $locale, string $timezone, float $latitude, float $longitude, float $accuracy, bool $touch, array $permissions, int $sleep, int $width, int $height, int $quality, string $output, Response $response, StatsUsage $queueForStatsUsage) + { + if (!\extension_loaded('imagick')) { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Imagick extension is missing'); + } + + $domain = new Domain(\parse_url($url, PHP_URL_HOST)); + + if (!$domain->isKnown()) { + throw new Exception(Exception::AVATAR_REMOTE_URL_FAILED); + } + + $client = new Client(); + $client->setTimeout(30 * 1000); // 30 seconds + $client->addHeader('content-type', Client::CONTENT_TYPE_APPLICATION_JSON); + + // Convert indexed array to empty array (should not happen due to Assoc validator) + if (is_array($headers) && count($headers) > 0 && array_keys($headers) === range(0, count($headers) - 1)) { + $headers = []; + } + + // Create a new object to ensure proper JSON serialization + $headersObject = new \stdClass(); + foreach ($headers as $key => $value) { + $headersObject->$key = $value; + } + + // Create the config with headers as an object + // The custom browser service accepts: url, theme, headers, sleep, viewport, userAgent, fullPage, locale, timezoneId, geolocation, hasTouch, scale + $config = [ + 'url' => $url, + 'theme' => $theme, + 'headers' => $headersObject, + 'sleep' => $sleep * 1000, // Convert seconds to milliseconds + 'waitUntil' => 'load', + 'viewport' => [ + 'width' => $viewportWidth, + 'height' => $viewportHeight + ] + ]; + + // Add scale if not default + if ($scale != 1) { + $config['deviceScaleFactor'] = $scale; + } + + // Add optional parameters that were set, preserving arrays as arrays + if (!empty($userAgent)) { + $config['userAgent'] = $userAgent; + } + + if ($fullpage) { + $config['fullPage'] = true; + } + + if (!empty($locale)) { + $config['locale'] = $locale; + } + + if (!empty($timezone)) { + $config['timezoneId'] = $timezone; + } + + // Add geolocation if any coordinates are provided + if ($latitude != 0 || $longitude != 0) { + $config['geolocation'] = [ + 'latitude' => $latitude, + 'longitude' => $longitude, + 'accuracy' => $accuracy + ]; + } + + if ($touch) { + $config['hasTouch'] = true; + } + + // Add permissions if provided (preserve as array) + if (!empty($permissions)) { + $config['permissions'] = $permissions; // Keep as array + } + + try { + $browserEndpoint = System::getEnv('_APP_BROWSER_HOST', 'http://appwrite-browser:3000/v1'); + + $fetchResponse = $client->fetch( + url: $browserEndpoint . '/screenshots', + method: 'POST', + body: $config + ); + + if ($fetchResponse->getStatusCode() >= 400) { + throw new Exception(Exception::AVATAR_REMOTE_URL_FAILED, 'Screenshot service failed: ' . $fetchResponse->getBody()); + } + + $screenshot = $fetchResponse->getBody(); + + if (empty($screenshot)) { + throw new Exception(Exception::AVATAR_IMAGE_NOT_FOUND, 'Screenshot not generated'); + } + + // Determine if image processing is needed + $needsProcessing = ($width > 0 || $height > 0) || $quality !== -1 || !empty($output); + + if ($needsProcessing) { + // Process image with cropping, quality adjustment, or format conversion + $image = new Image($screenshot); + + $image->crop($width, $height); + + $output = $output ?: 'png'; // Default to PNG if not specified + $resizedScreenshot = $image->output($output, $quality); + unset($image); + } else { + // Return original screenshot without processing + $resizedScreenshot = $screenshot; + $output = 'png'; // Screenshots are typically PNG by default + } + + // Set content type based on output format + $outputs = Config::getParam('storage-outputs'); + $contentType = $outputs[$output] ?? $outputs['png']; + + $queueForStatsUsage->addMetric(METRIC_AVATARS_SCREENSHOTS_GENERATED, 1); + + $response + ->addHeader('Cache-Control', 'private, max-age=2592000') // 30 days + ->setContentType($contentType) + ->file($resizedScreenshot); + + + } catch (\Throwable $th) { + throw new Exception(Exception::AVATAR_REMOTE_URL_FAILED, 'Screenshot generation failed: ' . $th->getMessage()); + } + } +} diff --git a/src/Appwrite/Platform/Modules/Avatars/Module.php b/src/Appwrite/Platform/Modules/Avatars/Module.php new file mode 100644 index 0000000000..187bd96905 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Avatars/Module.php @@ -0,0 +1,14 @@ +addService('http', new Http()); + } +} diff --git a/src/Appwrite/Platform/Modules/Avatars/Services/Http.php b/src/Appwrite/Platform/Modules/Avatars/Services/Http.php new file mode 100644 index 0000000000..c52edb6a05 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Avatars/Services/Http.php @@ -0,0 +1,36 @@ +type = Service::TYPE_HTTP; + + $this->addAction(GetCreditCard::getName(), new GetCreditCard()); + $this->addAction(GetBrowser::getName(), new GetBrowser()); + $this->addAction(GetFlag::getName(), new GetFlag()); + $this->addAction(GetImage::getName(), new GetImage()); + $this->addAction(GetFavicon::getName(), new GetFavicon()); + $this->addAction(GetQR::getName(), new GetQR()); + $this->addAction(GetInitials::getName(), new GetInitials()); + $this->addAction(GetScreenshot::getName(), new GetScreenshot()); + $this->addAction(GetCloudCard::getName(), new GetCloudCard()); + $this->addAction(GetCloudCardBack::getName(), new GetCloudCardBack()); + $this->addAction(GetCloudCardOG::getName(), new GetCloudCardOG()); + } +} diff --git a/src/Appwrite/Platform/Modules/Compute/Base.php b/src/Appwrite/Platform/Modules/Compute/Base.php index 33b69dd589..749a9fe87a 100644 --- a/src/Appwrite/Platform/Modules/Compute/Base.php +++ b/src/Appwrite/Platform/Modules/Compute/Base.php @@ -107,6 +107,7 @@ class Base extends Action 'resourceType' => 'functions', 'entrypoint' => $entrypoint, 'buildCommands' => $function->getAttribute('commands', ''), + 'startCommand' => $function->getAttribute('startCommand', ''), 'type' => 'vcs', 'installationId' => $installation->getId(), 'installationInternalId' => $installation->getSequence(), @@ -203,6 +204,7 @@ class Base extends Action 'resourceInternalId' => $site->getSequence(), 'resourceType' => 'sites', 'buildCommands' => implode(' && ', $commands), + 'startCommand' => $site->getAttribute('startCommand', ''), 'buildOutput' => $site->getAttribute('outputDirectory', ''), 'adapter' => $site->getAttribute('adapter', ''), 'fallbackFile' => $site->getAttribute('fallbackFile', ''), diff --git a/src/Appwrite/Platform/Modules/Console/Http/Assistant/Create.php b/src/Appwrite/Platform/Modules/Console/Http/Assistant/Create.php new file mode 100644 index 0000000000..554456b041 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Console/Http/Assistant/Create.php @@ -0,0 +1,92 @@ +setHttpMethod(Action::HTTP_REQUEST_METHOD_POST) + ->setHttpPath('/v1/console/assistant') + ->desc('Create assistant query') + ->groups(['api', 'assistant']) + ->label('scope', 'assistant.read') + ->label('sdk', new Method( + namespace: 'assistant', + group: 'console', + name: 'chat', + description: '/docs/references/assistant/chat.md', + auth: [AuthType::ADMIN], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_NONE, + ) + ], + contentType: ContentType::TEXT + )) + ->label('abuse-limit', 15) + ->label('abuse-key', 'userId:{userId}') + ->param('prompt', '', new Text(2000), 'Prompt. A string containing questions asked to the AI assistant.') + ->inject('response') + ->callback($this->action(...)); + } + + public function action(string $prompt, Response $response) + { + $ch = curl_init('http://appwrite-assistant:3003/v1/models/assistant/prompt'); + $responseHeaders = []; + $query = json_encode(['prompt' => $prompt]); + $headers = ['accept: text/event-stream']; + $handleEvent = function ($ch, $data) use ($response) { + $response->chunk($data); + + return \strlen($data); + }; + + curl_setopt($ch, CURLOPT_WRITEFUNCTION, $handleEvent); + + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST'); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); + curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0); + curl_setopt($ch, CURLOPT_TIMEOUT, 9000); + curl_setopt($ch, CURLOPT_HEADERFUNCTION, function ($curl, $header) use (&$responseHeaders) { + $len = strlen($header); + $header = explode(':', $header, 2); + + if (count($header) < 2) { // ignore invalid headers + return $len; + } + + $responseHeaders[strtolower(trim($header[0]))] = trim($header[1]); + + return $len; + }); + + curl_setopt($ch, CURLOPT_POSTFIELDS, $query); + + curl_exec($ch); + + curl_close($ch); + + $response->chunk('', true); + } +} diff --git a/src/Appwrite/Platform/Modules/Console/Http/Init/API.php b/src/Appwrite/Platform/Modules/Console/Http/Init/API.php new file mode 100644 index 0000000000..824ef4c3d5 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Console/Http/Init/API.php @@ -0,0 +1,28 @@ +setType(Action::TYPE_INIT) + ->groups(['console']) + ->inject('project') + ->callback(function (Document $project) { + if ($project->getId() !== 'console') { + throw new Exception(Exception::GENERAL_ACCESS_FORBIDDEN); + } + }); + } +} diff --git a/src/Appwrite/Platform/Modules/Console/Http/Init/Web.php b/src/Appwrite/Platform/Modules/Console/Http/Init/Web.php new file mode 100644 index 0000000000..587610883a --- /dev/null +++ b/src/Appwrite/Platform/Modules/Console/Http/Init/Web.php @@ -0,0 +1,31 @@ +setType(Action::TYPE_INIT) + ->groups(['web']) + ->inject('request') + ->inject('response') + ->callback(function (Request $request, Response $response) { + $response + ->addHeader('X-Frame-Options', 'SAMEORIGIN') // Avoid console and homepage from showing in iframes + ->addHeader('X-XSS-Protection', '1; mode=block; report=/v1/xss?url=' . \urlencode($request->getURI())) + ->addHeader('X-UA-Compatible', 'IE=Edge') // Deny IE browsers from going into quirks mode + ; + }); + } +} diff --git a/src/Appwrite/Platform/Modules/Console/Http/Redirects/Auth/Get.php b/src/Appwrite/Platform/Modules/Console/Http/Redirects/Auth/Get.php new file mode 100644 index 0000000000..f88486d6bb --- /dev/null +++ b/src/Appwrite/Platform/Modules/Console/Http/Redirects/Auth/Get.php @@ -0,0 +1,18 @@ +setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath($this->getPath()) + ->groups(['web']) + ->label('permission', 'public') + ->label('scope', 'home') + ->inject('request') + ->inject('response') + ->callback($this->action(...)); + } + + public function action(Request $request, Response $response): void + { + $url = parse_url($request->getURI()); + $target = "/console{$url['path']}"; + $params = $request->getParams(); + if (!empty($params)) { + $target .= "?" . \http_build_query($params); + } + if ($url['fragment'] ?? false) { + $target .= "#{$url['fragment']}"; + } + + $response->redirect($target); + } +} diff --git a/src/Appwrite/Platform/Modules/Console/Http/Redirects/Card/Get.php b/src/Appwrite/Platform/Modules/Console/Http/Redirects/Card/Get.php new file mode 100644 index 0000000000..c98c125f4e --- /dev/null +++ b/src/Appwrite/Platform/Modules/Console/Http/Redirects/Card/Get.php @@ -0,0 +1,18 @@ +setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/console/variables') + ->desc('Get variables') + ->groups(['api', 'projects']) + ->label('scope', 'projects.read') + ->label('sdk', new Method( + namespace: 'console', + group: 'console', + name: 'variables', + description: '/docs/references/console/variables.md', + auth: [AuthType::ADMIN], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_CONSOLE_VARIABLES, + ) + ], + contentType: ContentType::JSON + )) + ->inject('response') + ->callback($this->action(...)); + } + + public function action(Response $response) + { + $validator = new Domain(System::getEnv('_APP_DOMAIN_TARGET_CNAME')); + $isCNAMEValid = !empty(System::getEnv('_APP_DOMAIN_TARGET_CNAME', '')) && $validator->isKnown() && !$validator->isTest(); + + $validator = new IP(IP::V4); + $isAValid = !empty(System::getEnv('_APP_DOMAIN_TARGET_A', '')) && ($validator->isValid(System::getEnv('_APP_DOMAIN_TARGET_A'))); + + $validator = new IP(IP::V6); + $isAAAAValid = !empty(System::getEnv('_APP_DOMAIN_TARGET_AAAA', '')) && $validator->isValid(System::getEnv('_APP_DOMAIN_TARGET_AAAA')); + + $isDomainEnabled = $isAAAAValid || $isAValid || $isCNAMEValid; + + $isVcsEnabled = !empty(System::getEnv('_APP_VCS_GITHUB_APP_NAME', '')) + && !empty(System::getEnv('_APP_VCS_GITHUB_PRIVATE_KEY', '')) + && !empty(System::getEnv('_APP_VCS_GITHUB_APP_ID', '')) + && !empty(System::getEnv('_APP_VCS_GITHUB_CLIENT_ID', '')) + && !empty(System::getEnv('_APP_VCS_GITHUB_CLIENT_SECRET', '')); + + $isAssistantEnabled = !empty(System::getEnv('_APP_ASSISTANT_OPENAI_API_KEY', '')); + + $variables = new Document([ + '_APP_DOMAIN_TARGET_CNAME' => System::getEnv('_APP_DOMAIN_TARGET_CNAME'), + '_APP_DOMAIN_TARGET_AAAA' => System::getEnv('_APP_DOMAIN_TARGET_AAAA'), + '_APP_DOMAIN_TARGET_A' => System::getEnv('_APP_DOMAIN_TARGET_A'), + '_APP_DOMAIN_TARGET_CAA' => '0 issue "' . System::getEnv('_APP_DOMAIN_TARGET_CAA') . '"', + '_APP_STORAGE_LIMIT' => +System::getEnv('_APP_STORAGE_LIMIT'), + '_APP_COMPUTE_BUILD_TIMEOUT' => +System::getEnv('_APP_COMPUTE_BUILD_TIMEOUT'), + '_APP_COMPUTE_SIZE_LIMIT' => +System::getEnv('_APP_COMPUTE_SIZE_LIMIT'), + '_APP_USAGE_STATS' => System::getEnv('_APP_USAGE_STATS'), + '_APP_VCS_ENABLED' => $isVcsEnabled, + '_APP_DOMAIN_ENABLED' => $isDomainEnabled, + '_APP_ASSISTANT_ENABLED' => $isAssistantEnabled, + '_APP_DOMAIN_SITES' => System::getEnv('_APP_DOMAIN_SITES'), + '_APP_DOMAIN_FUNCTIONS' => System::getEnv('_APP_DOMAIN_FUNCTIONS'), + '_APP_OPTIONS_FORCE_HTTPS' => System::getEnv('_APP_OPTIONS_FORCE_HTTPS'), + '_APP_DOMAINS_NAMESERVERS' => System::getEnv('_APP_DOMAINS_NAMESERVERS'), + ]); + + $response->dynamic($variables, Response::MODEL_CONSOLE_VARIABLES); + } +} diff --git a/src/Appwrite/Platform/Modules/Console/Services/Http.php b/src/Appwrite/Platform/Modules/Console/Services/Http.php index 6221db6a96..f3ca6218f2 100644 --- a/src/Appwrite/Platform/Modules/Console/Services/Http.php +++ b/src/Appwrite/Platform/Modules/Console/Services/Http.php @@ -2,7 +2,19 @@ namespace Appwrite\Platform\Modules\Console\Services; +use Appwrite\Platform\Modules\Console\Http\Assistant\Create as CreateAssistantQuery; +use Appwrite\Platform\Modules\Console\Http\Init\API; +use Appwrite\Platform\Modules\Console\Http\Init\Web; +use Appwrite\Platform\Modules\Console\Http\Redirects\Auth\Get as RedirectAuth; +use Appwrite\Platform\Modules\Console\Http\Redirects\Card\Get as RedirectCard; +use Appwrite\Platform\Modules\Console\Http\Redirects\Invite\Get as RedirectInvite; +use Appwrite\Platform\Modules\Console\Http\Redirects\Login\Get as RedirectLogin; +use Appwrite\Platform\Modules\Console\Http\Redirects\MFA\Get as RedirectMFA; +use Appwrite\Platform\Modules\Console\Http\Redirects\Recover\Get as RedirectRecover; +use Appwrite\Platform\Modules\Console\Http\Redirects\Register\Get as RedirectRegister; +use Appwrite\Platform\Modules\Console\Http\Redirects\Root\Get as RedirectRoot; use Appwrite\Platform\Modules\Console\Http\Resources\Get as GetResourceAvailability; +use Appwrite\Platform\Modules\Console\Http\Variables\Get as GetVariables; use Utopia\Platform\Service; class Http extends Service @@ -10,7 +22,23 @@ class Http extends Service public function __construct() { $this->type = Service::TYPE_HTTP; - // Resources + + // API and Web init hooks! + $this->addAction(API::getName(), new API()); + $this->addAction(Web::getName(), new Web()); + + $this->addAction(GetVariables::getName(), new GetVariables()); + $this->addAction(CreateAssistantQuery::getName(), new CreateAssistantQuery()); $this->addAction(GetResourceAvailability::getName(), new GetResourceAvailability()); + + // web redirects to /console + $this->addAction(RedirectRoot::getName(), new RedirectRoot()); + $this->addAction(RedirectAuth::getName(), new RedirectAuth()); + $this->addAction(RedirectInvite::getName(), new RedirectInvite()); + $this->addAction(RedirectLogin::getName(), new RedirectLogin()); + $this->addAction(RedirectMFA::getName(), new RedirectMFA()); + $this->addAction(RedirectCard::getName(), new RedirectCard()); + $this->addAction(RedirectRecover::getName(), new RedirectRecover()); + $this->addAction(RedirectRegister::getName(), new RedirectRegister()); } } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Integer/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Integer/Create.php index 58ded9b78a..0989bb2904 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Integer/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Integer/Create.php @@ -67,9 +67,9 @@ class Create extends Action ->param('collectionId', '', new UID(), 'Collection ID.') ->param('key', '', new Key(), 'Attribute Key.') ->param('required', null, new Boolean(), 'Is attribute required?') - ->param('min', null, new Nullable(new Integer()), 'Minimum value', true) - ->param('max', null, new Nullable(new Integer()), 'Maximum value', true) - ->param('default', null, new Nullable(new Integer()), 'Default value. Cannot be set when attribute is required.', true) + ->param('min', null, new Nullable(new Integer(false, 64)), 'Minimum value', true) + ->param('max', null, new Nullable(new Integer(false, 64)), 'Maximum value', true) + ->param('default', null, new Nullable(new Integer(false, 64)), 'Default value. Cannot be set when attribute is required.', true) ->param('array', false, new Boolean(), 'Is attribute an array?', true) ->inject('response') ->inject('dbForProject') diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Integer/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Integer/Update.php index 84a43018d1..57797d3e03 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Integer/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Integer/Update.php @@ -65,9 +65,9 @@ class Update extends Action ->param('collectionId', '', new UID(), 'Collection ID.') ->param('key', '', new Key(), 'Attribute Key.') ->param('required', null, new Boolean(), 'Is attribute required?') - ->param('min', null, new Nullable(new Integer()), 'Minimum value', true) - ->param('max', null, new Nullable(new Integer()), 'Maximum value', true) - ->param('default', null, new Nullable(new Integer()), 'Default value. Cannot be set when attribute is required.') + ->param('min', null, new Nullable(new Integer(false, 64)), 'Minimum value', true) + ->param('max', null, new Nullable(new Integer(false, 64)), 'Maximum value', true) + ->param('default', null, new Nullable(new Integer(false, 64)), 'Default value. Cannot be set when attribute is required.') ->param('newKey', null, new Nullable(new Key()), 'New Attribute Key.', true) ->inject('response') ->inject('dbForProject') diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php index 89cc14056a..d0e9539ad4 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php @@ -186,7 +186,13 @@ class Create extends Action $dbForProject->getAdapter()->getSupportForVectors(), $dbForProject->getAdapter()->getSupportForAttributes(), $dbForProject->getAdapter()->getSupportForMultipleFulltextIndexes(), - $dbForProject->getAdapter()->getSupportForIdenticalIndexes() + $dbForProject->getAdapter()->getSupportForIdenticalIndexes(), + $dbForProject->getAdapter()->getSupportForObjectIndexes(), + $dbForProject->getAdapter()->getSupportForTrigramIndex(), + $dbForProject->getAdapter()->getSupportForSpatialAttributes(), + $dbForProject->getAdapter()->getSupportForIndex(), + $dbForProject->getAdapter()->getSupportForUniqueIndex(), + $dbForProject->getAdapter()->getSupportForFulltextIndex(), ); foreach ($collectionIndexes as $indexDoc) { diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Action.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Action.php index 1df947f8c3..3159eed5e3 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Action.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Action.php @@ -4,6 +4,7 @@ namespace Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Documen use Appwrite\Event\Event; use Appwrite\Extend\Exception; +use Appwrite\Functions\EventProcessor; use Appwrite\Platform\Modules\Databases\Http\Databases\Action as DatabasesAction; use Appwrite\Utopia\Database\Validator\CustomId; use Utopia\Database\Database; @@ -379,6 +380,8 @@ abstract class Action extends DatabasesAction * @param Event $queueForRealtime * @param Event $queueForFunctions * @param Event $queueForWebhooks + * @param Database $dbForProject + * @param EventProcessor $eventProcessor * @return void */ protected function triggerBulk( @@ -389,7 +392,9 @@ abstract class Action extends DatabasesAction Event $queueForEvents, Event $queueForRealtime, Event $queueForFunctions, - Event $queueForWebhooks + Event $queueForWebhooks, + Database $dbForProject, + EventProcessor $eventProcessor ): void { $queueForEvents ->setEvent($event) @@ -399,6 +404,11 @@ abstract class Action extends DatabasesAction ->setParam('tableId', $collection->getId()) ->setContext($this->getCollectionsEventsContext(), $collection); + // Get project and function events (cached) + $project = $queueForEvents->getProject(); + $functionsEvents = $eventProcessor->getFunctionsEvents($project, $dbForProject); + $webhooksEvents = $eventProcessor->getWebhooksEvents($project); + foreach ($documents as $document) { $queueForEvents ->setParam('documentId', $document->getId()) @@ -409,13 +419,34 @@ abstract class Action extends DatabasesAction ->from($queueForEvents) ->trigger(); - $queueForFunctions - ->from($queueForEvents) - ->trigger(); + // Generate events for this document operation + $generatedEvents = Event::generateEvents( + $queueForEvents->getEvent(), + $queueForEvents->getParams() + ); - $queueForWebhooks - ->from($queueForEvents) - ->trigger(); + + if (!empty($functionsEvents)) { + foreach ($generatedEvents as $event) { + if (isset($functionsEvents[$event])) { + $queueForFunctions + ->from($queueForEvents) + ->trigger(); + break; + } + } + } + + if (!empty($webhooksEvents)) { + foreach ($generatedEvents as $event) { + if (isset($webhooksEvents[$event])) { + $queueForWebhooks + ->from($queueForEvents) + ->trigger(); + break; + } + } + } } $queueForEvents->reset(); diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Decrement.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Decrement.php index ddc7779da1..16b7bd1b25 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Decrement.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Decrement.php @@ -178,6 +178,7 @@ class Decrement extends Action value: $value, min: $min ); + $document->setAttribute('$databaseId', $database->getId()); $document->setAttribute('$' . $this->getCollectionsEventsContext() . 'Id', $collectionId); } catch (ConflictException) { throw new Exception($this->getConflictException()); diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Increment.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Increment.php index 9d4381a3ce..7adae7633b 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Increment.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Increment.php @@ -178,6 +178,7 @@ class Increment extends Action value: $value, max: $max ); + $document->setAttribute('$databaseId', $database->getId()); $document->setAttribute('$' . $this->getCollectionsEventsContext() . 'Id', $collectionId); } catch (ConflictException) { throw new Exception($this->getConflictException()); diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Delete.php index 070ee09450..a3d3535065 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Delete.php @@ -5,6 +5,7 @@ namespace Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Documen use Appwrite\Event\Event; use Appwrite\Event\StatsUsage; use Appwrite\Extend\Exception; +use Appwrite\Functions\EventProcessor; use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Documents\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\ContentType; @@ -81,10 +82,11 @@ class Delete extends Action ->inject('queueForFunctions') ->inject('queueForWebhooks') ->inject('plan') + ->inject('eventProcessor') ->callback($this->action(...)); } - public function action(string $databaseId, string $collectionId, array $queries, ?string $transactionId, UtopiaResponse $response, Database $dbForProject, StatsUsage $queueForStatsUsage, Event $queueForEvents, Event $queueForRealtime, Event $queueForFunctions, Event $queueForWebhooks, array $plan): void + public function action(string $databaseId, string $collectionId, array $queries, ?string $transactionId, UtopiaResponse $response, Database $dbForProject, StatsUsage $queueForStatsUsage, Event $queueForEvents, Event $queueForRealtime, Event $queueForFunctions, Event $queueForWebhooks, array $plan, EventProcessor $eventProcessor): void { $database = $dbForProject->getDocument('databases', $databaseId); if ($database->isEmpty()) { @@ -203,7 +205,9 @@ class Delete extends Action $queueForEvents, $queueForRealtime, $queueForFunctions, - $queueForWebhooks + $queueForWebhooks, + $dbForProject, + $eventProcessor ); } } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Update.php index 192b10c956..fdc49b1901 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Update.php @@ -5,6 +5,7 @@ namespace Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Documen use Appwrite\Event\Event; use Appwrite\Event\StatsUsage; use Appwrite\Extend\Exception; +use Appwrite\Functions\EventProcessor; use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Documents\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\ContentType; @@ -85,10 +86,11 @@ class Update extends Action ->inject('queueForFunctions') ->inject('queueForWebhooks') ->inject('plan') + ->inject('eventProcessor') ->callback($this->action(...)); } - public function action(string $databaseId, string $collectionId, string|array $data, array $queries, ?string $transactionId, UtopiaResponse $response, Database $dbForProject, StatsUsage $queueForStatsUsage, Event $queueForEvents, Event $queueForRealtime, Event $queueForFunctions, Event $queueForWebhooks, array $plan): void + public function action(string $databaseId, string $collectionId, string|array $data, array $queries, ?string $transactionId, UtopiaResponse $response, Database $dbForProject, StatsUsage $queueForStatsUsage, Event $queueForEvents, Event $queueForRealtime, Event $queueForFunctions, Event $queueForWebhooks, array $plan, EventProcessor $eventProcessor): void { $data = \is_string($data) ? \json_decode($data, true) @@ -234,7 +236,9 @@ class Update extends Action $queueForEvents, $queueForRealtime, $queueForFunctions, - $queueForWebhooks + $queueForWebhooks, + $dbForProject, + $eventProcessor ); } } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Upsert.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Upsert.php index 45db6cc96b..00e4663171 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Upsert.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Upsert.php @@ -5,6 +5,7 @@ namespace Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Documen use Appwrite\Event\Event; use Appwrite\Event\StatsUsage; use Appwrite\Extend\Exception; +use Appwrite\Functions\EventProcessor; use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Documents\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\ContentType; @@ -83,10 +84,11 @@ class Upsert extends Action ->inject('queueForFunctions') ->inject('queueForWebhooks') ->inject('plan') + ->inject('eventProcessor') ->callback($this->action(...)); } - public function action(string $databaseId, string $collectionId, array $documents, ?string $transactionId, UtopiaResponse $response, Database $dbForProject, StatsUsage $queueForStatsUsage, Event $queueForEvents, Event $queueForRealtime, Event $queueForFunctions, Event $queueForWebhooks, array $plan): void + public function action(string $databaseId, string $collectionId, array $documents, ?string $transactionId, UtopiaResponse $response, Database $dbForProject, StatsUsage $queueForStatsUsage, Event $queueForEvents, Event $queueForRealtime, Event $queueForFunctions, Event $queueForWebhooks, array $plan, EventProcessor $eventProcessor): void { $database = $dbForProject->getDocument('databases', $databaseId); if ($database->isEmpty()) { @@ -209,7 +211,9 @@ class Upsert extends Action $queueForEvents, $queueForRealtime, $queueForFunctions, - $queueForWebhooks + $queueForWebhooks, + $dbForProject, + $eventProcessor ); } } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Create.php index eebe59796e..624d3c48ff 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Create.php @@ -5,6 +5,7 @@ namespace Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Documen use Appwrite\Event\Event; use Appwrite\Event\StatsUsage; use Appwrite\Extend\Exception; +use Appwrite\Functions\EventProcessor; use Appwrite\SDK\AuthType; use Appwrite\SDK\ContentType; use Appwrite\SDK\Deprecated; @@ -134,9 +135,10 @@ class Create extends Action ->inject('queueForWebhooks') ->inject('plan') ->inject('authorization') + ->inject('eventProcessor') ->callback($this->action(...)); } - public function action(string $databaseId, string $documentId, string $collectionId, string|array $data, ?array $permissions, ?array $documents, ?string $transactionId, UtopiaResponse $response, Database $dbForProject, Document $user, Event $queueForEvents, StatsUsage $queueForStatsUsage, Event $queueForRealtime, Event $queueForFunctions, Event $queueForWebhooks, array $plan, Authorization $authorization): void + public function action(string $databaseId, string $documentId, string $collectionId, string|array $data, ?array $permissions, ?array $documents, ?string $transactionId, UtopiaResponse $response, Database $dbForProject, Document $user, Event $queueForEvents, StatsUsage $queueForStatsUsage, Event $queueForRealtime, Event $queueForFunctions, Event $queueForWebhooks, array $plan, Authorization $authorization, EventProcessor $eventProcessor): void { $data = \is_string($data) ? \json_decode($data, true) @@ -229,7 +231,7 @@ class Create extends Action // Add permissions for current the user if none were provided. if (\is_null($permissions)) { $permissions = []; - if (!empty($user->getId())) { + if (!empty($user->getId()) && !$isPrivilegedUser) { foreach ($allowedPermissions as $permission) { $permissions[] = (new Permission($permission, 'user', $user->getId()))->toString(); } @@ -501,7 +503,9 @@ class Create extends Action $queueForEvents, $queueForRealtime, $queueForFunctions, - $queueForWebhooks + $queueForWebhooks, + $dbForProject, + $eventProcessor ); return; } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Logs/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Logs/XList.php index c7b775c7f5..2f5579f0ca 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Logs/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Logs/XList.php @@ -73,10 +73,11 @@ class XList extends Action ->inject('locale') ->inject('geodb') ->inject('authorization') + ->inject('audit') ->callback($this->action(...)); } - public function action(string $databaseId, string $collectionId, string $documentId, array $queries, UtopiaResponse $response, Database $dbForProject, Locale $locale, Reader $geodb, Authorization $authorization): void + public function action(string $databaseId, string $collectionId, string $documentId, array $queries, UtopiaResponse $response, Database $dbForProject, Locale $locale, Reader $geodb, Authorization $authorization, Audit $audit): void { $database = $authorization->skip(fn () => $dbForProject->getDocument('databases', $databaseId)); if ($database->isEmpty()) { @@ -99,12 +100,16 @@ class XList extends Action throw new Exception(Exception::GENERAL_QUERY_INVALID, $e->getMessage()); } - $audit = new Audit($dbForProject); $type = $this->getCollectionsEventsContext(); $context = $this->getContext(); $resource = "database/$databaseId/$type/$collectionId/$context/{$document->getId()}"; - $logs = $audit->getLogsByResource($resource, $queries); + + $grouped = Query::groupByType($queries); + $limit = $grouped['limit'] ?? 25; + $offset = $grouped['offset'] ?? 0; + + $logs = $audit->getLogsByResource($resource, limit: $limit, offset: $offset); $output = []; @@ -153,7 +158,7 @@ class XList extends Action $response->dynamic(new Document([ 'logs' => $output, - 'total' => $audit->countLogsByResource($resource, $queries), + 'total' => $audit->countLogsByResource($resource), ]), $this->getResponseModel()); } } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Create.php index 5b035a8688..7995c19af7 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Create.php @@ -199,7 +199,13 @@ class Create extends Action $dbForProject->getAdapter()->getSupportForVectors(), $dbForProject->getAdapter()->getSupportForAttributes(), $dbForProject->getAdapter()->getSupportForMultipleFulltextIndexes(), - $dbForProject->getAdapter()->getSupportForIdenticalIndexes() + $dbForProject->getAdapter()->getSupportForIdenticalIndexes(), + $dbForProject->getAdapter()->getSupportForObjectIndexes(), + $dbForProject->getAdapter()->getSupportForTrigramIndex(), + $dbForProject->getAdapter()->getSupportForSpatialAttributes(), + $dbForProject->getAdapter()->getSupportForIndex(), + $dbForProject->getAdapter()->getSupportForUniqueIndex(), + $dbForProject->getAdapter()->getSupportForFulltextIndex(), ); if (!$validator->isValid($index)) { diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Logs/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Logs/XList.php index efdb937aa8..0b6e47a798 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Logs/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Logs/XList.php @@ -72,10 +72,11 @@ class XList extends Action ->inject('locale') ->inject('geodb') ->inject('authorization') + ->inject('audit') ->callback($this->action(...)); } - public function action(string $databaseId, string $collectionId, array $queries, UtopiaResponse $response, Database $dbForProject, Locale $locale, Reader $geodb, Authorization $authorization): void + public function action(string $databaseId, string $collectionId, array $queries, UtopiaResponse $response, Database $dbForProject, Locale $locale, Reader $geodb, Authorization $authorization, Audit $audit): void { $database = $authorization->skip(fn () => $dbForProject->getDocument('databases', $databaseId)); @@ -96,10 +97,13 @@ class XList extends Action throw new Exception(Exception::GENERAL_QUERY_INVALID, $e->getMessage()); } - $audit = new Audit($dbForProject); + $grouped = Query::groupByType($queries); + $limit = $grouped['limit'] ?? 25; + $offset = $grouped['offset'] ?? 0; + $context = $this->getContext(); $resource = "database/$databaseId/$context/$collectionId"; - $logs = $audit->getLogsByResource($resource, $queries); + $logs = $audit->getLogsByResource($resource, limit: $limit, offset: $offset); $output = []; @@ -148,7 +152,7 @@ class XList extends Action $response->dynamic(new Document([ 'logs' => $output, - 'total' => $audit->countLogsByResource($resource, $queries), + 'total' => $audit->countLogsByResource($resource), ]), $this->getResponseModel()); } } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Update.php index 304ce5c88e..a2d696813b 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Update.php @@ -64,7 +64,7 @@ class Update extends Action )) ->param('databaseId', '', new UID(), 'Database ID.') ->param('collectionId', '', new UID(), 'Collection ID.') - ->param('name', null, new Text(128), 'Collection name. Max length: 128 chars.') + ->param('name', null, new Text(128), 'Collection name. Max length: 128 chars.', true) ->param('permissions', null, new Nullable(new Permissions(APP_LIMIT_ARRAY_PARAMS_SIZE)), 'An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).', true) ->param('documentSecurity', false, new Boolean(true), 'Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions).', true) ->param('enabled', true, new Boolean(), 'Is collection enabled? When set to \'disabled\', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled.', true) @@ -75,7 +75,7 @@ class Update extends Action ->callback($this->action(...)); } - public function action(string $databaseId, string $collectionId, string $name, ?array $permissions, bool $documentSecurity, bool $enabled, UtopiaResponse $response, Database $dbForProject, Event $queueForEvents, Authorization $authorization): void + public function action(string $databaseId, string $collectionId, ?string $name, ?array $permissions, bool $documentSecurity, bool $enabled, UtopiaResponse $response, Database $dbForProject, Event $queueForEvents, Authorization $authorization): void { $database = $authorization->skip(fn () => $dbForProject->getDocument('databases', $databaseId)); if ($database->isEmpty()) { @@ -87,6 +87,12 @@ class Update extends Action throw new Exception($this->getNotFoundException(), params: [$collectionId]); } + if ($name) { + $collection = $collection->setAttribute('name', $name); + } + + $searchName = $name ?? $collection->getAttribute('name'); + $permissions ??= $collection->getPermissions(); // Map aggregate permissions into the multiple permissions they represent. @@ -98,11 +104,10 @@ class Update extends Action 'database_' . $database->getSequence(), $collectionId, $collection - ->setAttribute('name', $name) ->setAttribute('$permissions', $permissions) ->setAttribute('documentSecurity', $documentSecurity) ->setAttribute('enabled', $enabled) - ->setAttribute('search', \implode(' ', [$collectionId, $name])) + ->setAttribute('search', \implode(' ', [$collectionId, $searchName])) ); $dbForProject->updateCollection('database_' . $database->getSequence() . '_collection_' . $collection->getSequence(), $permissions, $documentSecurity); diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Logs/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Logs/XList.php index a794ec325e..319f07db1c 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Logs/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Logs/XList.php @@ -67,10 +67,11 @@ class XList extends Action ->inject('dbForProject') ->inject('locale') ->inject('geodb') + ->inject('audit') ->callback($this->action(...)); } - public function action(string $databaseId, array $queries, UtopiaResponse $response, Database $dbForProject, Locale $locale, Reader $geodb): void + public function action(string $databaseId, array $queries, UtopiaResponse $response, Database $dbForProject, Locale $locale, Reader $geodb, Audit $audit): void { $database = $dbForProject->getDocument('databases', $databaseId); @@ -84,9 +85,13 @@ class XList extends Action throw new Exception(Exception::GENERAL_QUERY_INVALID, $e->getMessage()); } - $audit = new Audit($dbForProject); + + $grouped = Query::groupByType($queries); + $limit = $grouped['limit'] ?? 25; + $offset = $grouped['offset'] ?? 0; + $resource = 'database/' . $databaseId; - $logs = $audit->getLogsByResource($resource, $queries); + $logs = $audit->getLogsByResource($resource, limit: $limit, offset: $offset); $output = []; @@ -133,7 +138,7 @@ class XList extends Action } $response->dynamic(new Document([ - 'total' => $audit->countLogsByResource($resource, $queries), + 'total' => $audit->countLogsByResource($resource), 'logs' => $output, ]), UtopiaResponse::MODEL_LOG_LIST); } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Update.php index e4f1051464..eca92da313 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Update.php @@ -7,6 +7,7 @@ use Appwrite\Event\Delete; use Appwrite\Event\Event; use Appwrite\Event\StatsUsage; use Appwrite\Extend\Exception; +use Appwrite\Functions\EventProcessor; use Appwrite\SDK\AuthType; use Appwrite\SDK\ContentType; use Appwrite\SDK\Method; @@ -77,6 +78,7 @@ class Update extends Action ->inject('queueForFunctions') ->inject('queueForWebhooks') ->inject('authorization') + ->inject('eventProcessor') ->callback($this->action(...)); } @@ -94,6 +96,7 @@ class Update extends Action * @param Event $queueForRealtime * @param Event $queueForFunctions * @param Event $queueForWebhooks + * @param EventProcessor $eventProcessor * @return void * @throws ConflictException * @throws Exception @@ -103,7 +106,7 @@ class Update extends Action * @throws Structure * @throws \Utopia\Exception */ - public function action(string $transactionId, bool $commit, bool $rollback, UtopiaResponse $response, Database $dbForProject, Document $user, TransactionState $transactionState, Delete $queueForDeletes, Event $queueForEvents, StatsUsage $queueForStatsUsage, Event $queueForRealtime, Event $queueForFunctions, Event $queueForWebhooks, Authorization $authorization): void + public function action(string $transactionId, bool $commit, bool $rollback, UtopiaResponse $response, Database $dbForProject, Document $user, TransactionState $transactionState, Delete $queueForDeletes, Event $queueForEvents, StatsUsage $queueForStatsUsage, Event $queueForRealtime, Event $queueForFunctions, Event $queueForWebhooks, Authorization $authorization, EventProcessor $eventProcessor): void { if (!$commit && !$rollback) { throw new Exception(Exception::GENERAL_BAD_REQUEST, 'Either commit or rollback must be true'); @@ -371,6 +374,11 @@ class Update extends Action $queueForEvents->setEvent($eventString); + // Get project and function/webhook events (cached) + $project = $queueForEvents->getProject(); + $functionsEvents = $eventProcessor->getFunctionsEvents($project, $dbForProject); + $webhooksEvents = $eventProcessor->getWebhooksEvents($project); + foreach ($documentsToTrigger as $doc) { $payload = $doc->getArrayCopy(); $payload['$tableId'] = $collection->getId(); @@ -381,9 +389,33 @@ class Update extends Action ->setParam('rowId', $doc->getId()) ->setPayload($payload); + // Generate events for this document operation + $generatedEvents = Event::generateEvents( + $queueForEvents->getEvent(), + $queueForEvents->getParams() + ); + $queueForRealtime->from($queueForEvents)->trigger(); - $queueForFunctions->from($queueForEvents)->trigger(); - $queueForWebhooks->from($queueForEvents)->trigger(); + + // Only trigger functions if there are matching function events + if (!empty($functionsEvents)) { + foreach ($generatedEvents as $event) { + if (isset($functionsEvents[$event])) { + $queueForFunctions->from($queueForEvents)->trigger(); + break; + } + } + } + + // Only trigger webhooks if there are matching webhook events + if (!empty($webhooksEvents)) { + foreach ($generatedEvents as $event) { + if (isset($webhooksEvents[$event])) { + $queueForWebhooks->from($queueForEvents)->trigger(); + break; + } + } + } } $queueForEvents->reset(); diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Update.php index 231b13deee..3a073079e0 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Update.php @@ -57,7 +57,7 @@ class Update extends Action ), ]) ->param('databaseId', '', new UID(), 'Database ID.') - ->param('name', null, new Text(128), 'Database name. Max length: 128 chars.') + ->param('name', null, new Text(128), 'Database name. Max length: 128 chars.', true) ->param('enabled', true, new Boolean(), 'Is database enabled? When set to \'disabled\', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled.', true) ->inject('response') ->inject('dbForProject') @@ -65,7 +65,7 @@ class Update extends Action ->callback($this->action(...)); } - public function action(string $databaseId, string $name, bool $enabled, UtopiaResponse $response, Database $dbForProject, Event $queueForEvents): void + public function action(string $databaseId, ?string $name, bool $enabled, UtopiaResponse $response, Database $dbForProject, Event $queueForEvents): void { $database = $dbForProject->getDocument('databases', $databaseId); @@ -73,10 +73,15 @@ class Update extends Action throw new Exception(Exception::DATABASE_NOT_FOUND, params: [$databaseId]); } + if ($name) { + $database = $database->setAttribute('name', $name); + } + + $searchName = $name ?? $database->getAttribute('name'); + $database = $dbForProject->updateDocument('databases', $databaseId, $database - ->setAttribute('name', $name) ->setAttribute('enabled', $enabled) - ->setAttribute('search', implode(' ', [$databaseId, $name]))); + ->setAttribute('search', implode(' ', [$databaseId, $searchName]))); $queueForEvents->setParam('databaseId', $database->getId()); diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Logs/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Logs/XList.php index 53476dbae1..88745555d9 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Logs/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Logs/XList.php @@ -62,10 +62,11 @@ class XList extends Action ->inject('dbForProject') ->inject('locale') ->inject('geodb') + ->inject('audit') ->callback($this->action(...)); } - public function action(string $databaseId, array $queries, UtopiaResponse $response, Database $dbForProject, Locale $locale, Reader $geodb): void + public function action(string $databaseId, array $queries, UtopiaResponse $response, Database $dbForProject, Locale $locale, Reader $geodb, Audit $audit): void { $database = $dbForProject->getDocument('databases', $databaseId); @@ -79,9 +80,12 @@ class XList extends Action throw new Exception(Exception::GENERAL_QUERY_INVALID, $e->getMessage()); } - $audit = new Audit($dbForProject); + $grouped = Query::groupByType($queries); + $limit = $grouped['limit'] ?? 25; + $offset = $grouped['offset'] ?? 0; + $resource = 'database/' . $databaseId; - $logs = $audit->getLogsByResource($resource, $queries); + $logs = $audit->getLogsByResource($resource, limit: $limit, offset: $offset); $output = []; @@ -128,7 +132,7 @@ class XList extends Action } $response->dynamic(new Document([ - 'total' => $audit->countLogsByResource($resource, $queries), + 'total' => $audit->countLogsByResource($resource), 'logs' => $output, ]), UtopiaResponse::MODEL_LOG_LIST); } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Integer/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Integer/Create.php index 45e0cc6f60..f590e8bdbb 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Integer/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Integer/Create.php @@ -55,9 +55,9 @@ class Create extends IntegerCreate ->param('tableId', '', new UID(), 'Table ID.') ->param('key', '', new Key(), 'Column Key.') ->param('required', null, new Boolean(), 'Is column required?') - ->param('min', null, new Nullable(new Integer()), 'Minimum value', true) - ->param('max', null, new Nullable(new Integer()), 'Maximum value', true) - ->param('default', null, new Nullable(new Integer()), 'Default value. Cannot be set when column is required.', true) + ->param('min', null, new Nullable(new Integer(false, 64)), 'Minimum value', true) + ->param('max', null, new Nullable(new Integer(false, 64)), 'Maximum value', true) + ->param('default', null, new Nullable(new Integer(false, 64)), 'Default value. Cannot be set when column is required.', true) ->param('array', false, new Boolean(), 'Is column an array?', true) ->inject('response') ->inject('dbForProject') diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Integer/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Integer/Update.php index f1f4ebb4a9..83b6f1bfc6 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Integer/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Integer/Update.php @@ -57,9 +57,9 @@ class Update extends IntegerUpdate ->param('tableId', '', new UID(), 'Table ID.') ->param('key', '', new Key(), 'Column Key.') ->param('required', null, new Boolean(), 'Is column required?') - ->param('min', null, new Nullable(new Integer()), 'Minimum value', true) - ->param('max', null, new Nullable(new Integer()), 'Maximum value', true) - ->param('default', null, new Nullable(new Integer()), 'Default value. Cannot be set when column is required.') + ->param('min', null, new Nullable(new Integer(false, 64)), 'Minimum value', true) + ->param('max', null, new Nullable(new Integer(false, 64)), 'Maximum value', true) + ->param('default', null, new Nullable(new Integer(false, 64)), 'Default value. Cannot be set when column is required.') ->param('newKey', null, new Nullable(new Key()), 'New Column Key.', true) ->inject('response') ->inject('dbForProject') diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Logs/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Logs/XList.php index f9111287c3..79691436e4 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Logs/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Logs/XList.php @@ -51,6 +51,7 @@ class XList extends CollectionLogXList ->inject('locale') ->inject('geodb') ->inject('authorization') + ->inject('audit') ->callback($this->action(...)); } } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Delete.php index b9896d282d..45e5b84774 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Delete.php @@ -66,7 +66,7 @@ class Delete extends DocumentsDelete ->inject('queueForFunctions') ->inject('queueForWebhooks') ->inject('plan') - ->inject('authorization') + ->inject('eventProcessor') ->callback($this->action(...)); } } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Update.php index f4ccea1698..3062186624 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Update.php @@ -68,7 +68,7 @@ class Update extends DocumentsUpdate ->inject('queueForFunctions') ->inject('queueForWebhooks') ->inject('plan') - ->inject('authorization') + ->inject('eventProcessor') ->callback($this->action(...)); } } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Upsert.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Upsert.php index 69a687d92f..3f837917c8 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Upsert.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Upsert.php @@ -68,7 +68,7 @@ class Upsert extends DocumentsUpsert ->inject('queueForFunctions') ->inject('queueForWebhooks') ->inject('plan') - ->inject('authorization') + ->inject('eventProcessor') ->callback($this->action(...)); } } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Create.php index c70ed71378..0f28a561ed 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Create.php @@ -112,6 +112,7 @@ class Create extends DocumentCreate ->inject('queueForWebhooks') ->inject('plan') ->inject('authorization') + ->inject('eventProcessor') ->callback($this->action(...)); } } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Logs/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Logs/XList.php index 5117e77ea9..86bfcfec85 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Logs/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Logs/XList.php @@ -52,6 +52,7 @@ class XList extends DocumentLogXList ->inject('locale') ->inject('geodb') ->inject('authorization') + ->inject('audit') ->callback($this->action(...)); } } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Update.php index 0d3bc9afc1..32376eaea1 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Update.php @@ -55,7 +55,7 @@ class Update extends CollectionUpdate )) ->param('databaseId', '', new UID(), 'Database ID.') ->param('tableId', '', new UID(), 'Table ID.') - ->param('name', null, new Text(128), 'Table name. Max length: 128 chars.') + ->param('name', null, new Text(128), 'Table name. Max length: 128 chars.', true) ->param('permissions', null, new Nullable(new Permissions(APP_LIMIT_ARRAY_PARAMS_SIZE)), 'An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).', true) ->param('rowSecurity', false, new Boolean(true), 'Enables configuring permissions for individual rows. A user needs one of row or table-level permissions to access a row. [Learn more about permissions](https://appwrite.io/docs/permissions).', true) ->param('enabled', true, new Boolean(), 'Is table enabled? When set to \'disabled\', users cannot access the table but Server SDKs with and API key can still read and write to the table. No data is lost when this is toggled.', true) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Transactions/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Transactions/Update.php index 8be28ce9f7..807e96800e 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Transactions/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Transactions/Update.php @@ -61,6 +61,7 @@ class Update extends TransactionsUpdate ->inject('queueForFunctions') ->inject('queueForWebhooks') ->inject('authorization') + ->inject('eventProcessor') ->callback($this->action(...)); } } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Update.php index 3a45c94814..81cb9c781c 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Update.php @@ -47,7 +47,7 @@ class Update extends DatabaseUpdate contentType: ContentType::JSON )) ->param('databaseId', '', new UID(), 'Database ID.') - ->param('name', null, new Text(128), 'Database name. Max length: 128 chars.') + ->param('name', null, new Text(128), 'Database name. Max length: 128 chars.', true) ->param('enabled', true, new Boolean(), 'Is database enabled? When set to \'disabled\', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled.', true) ->inject('response') ->inject('dbForProject') diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Create.php index c5ae08728d..97c669b9fb 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Create.php @@ -246,6 +246,7 @@ class Create extends Action 'resourceType' => 'functions', 'entrypoint' => $entrypoint, 'buildCommands' => $commands, + 'startCommand' => $function->getAttribute('startCommand', ''), 'sourcePath' => $path, 'sourceSize' => $fileSize, 'totalSize' => $fileSize, @@ -283,6 +284,7 @@ class Create extends Action 'resourceType' => 'functions', 'entrypoint' => $entrypoint, 'buildCommands' => $commands, + 'startCommand' => $function->getAttribute('startCommand', ''), 'sourcePath' => $path, 'sourceSize' => $fileSize, 'totalSize' => $fileSize, diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Duplicate/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Duplicate/Create.php index 42bf625d78..11d9c77b0e 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Duplicate/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Duplicate/Create.php @@ -104,6 +104,7 @@ class Create extends Action 'totalSize' => $deployment->getAttribute('sourceSize', 0), 'entrypoint' => $function->getAttribute('entrypoint'), 'buildCommands' => $function->getAttribute('commands', ''), + 'startCommand' => $function->getAttribute('startCommand', ''), 'buildStartedAt' => null, 'buildEndedAt' => null, 'buildDuration' => null, diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Template/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Template/Create.php index acfaa965ac..d4bf7446fb 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Template/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Template/Create.php @@ -159,6 +159,7 @@ class Create extends Base 'resourceType' => 'functions', 'entrypoint' => $function->getAttribute('entrypoint', ''), 'buildCommands' => $function->getAttribute('commands', ''), + 'startCommand' => $function->getAttribute('startCommand', ''), 'providerRepositoryName' => $repository, 'providerRepositoryOwner' => $owner, 'providerRepositoryUrl' => $repositoryUrl, diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/XList.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/XList.php index 2717e99ee0..55711495e9 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/XList.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/XList.php @@ -10,6 +10,7 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Database\Validator\Queries\Deployments; use Appwrite\Utopia\Request; use Appwrite\Utopia\Response; +use Appwrite\Utopia\Response\Filters\ListSelection; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Exception\Order as OrderException; @@ -119,7 +120,9 @@ class XList extends Base $cursor->setValue($cursorDocument); } - $filterQueries = Query::groupByType($queries)['filters']; + $grouped = Query::groupByType($queries); + $filterQueries = $grouped['filters']; + $selectQueries = $grouped['selections'] ?? []; try { $results = $dbForProject->find('deployments', $queries); @@ -128,7 +131,8 @@ class XList extends Base throw new Exception(Exception::DATABASE_QUERY_ORDER_NULL, "The order attribute '{$e->getAttribute()}' had a null value. Cursor pagination requires all documents order attribute values are non-null."); } - $this->applySelectQueries($request, $response, Response::MODEL_DEPLOYMENT); + $response->addFilter(new ListSelection($selectQueries, 'deployments')); + $response->dynamic(new Document([ 'deployments' => $results, 'total' => $total, diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php index 1a265298d3..6d2048b233 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php @@ -3,6 +3,7 @@ namespace Appwrite\Platform\Modules\Functions\Http\Executions; use Ahc\Jwt\JWT; +use Appwrite\Event\Delete as DeleteEvent; use Appwrite\Event\Event; use Appwrite\Event\Func; use Appwrite\Event\StatsUsage; @@ -62,7 +63,6 @@ class Create extends Base ->label('scope', 'execution.write') ->label('resourceType', RESOURCE_TYPE_FUNCTIONS) ->label('event', 'functions.[functionId].executions.[executionId].create') - ->label('resourceType', RESOURCE_TYPE_FUNCTIONS) ->label('sdk', new Method( namespace: 'functions', group: 'executions', @@ -101,6 +101,8 @@ class Create extends Base ->inject('executor') ->inject('platform') ->inject('authorization') + ->inject('queueForDeletes') + ->inject('executionsRetentionCount') ->callback($this->action(...)); } @@ -127,6 +129,8 @@ class Create extends Base Executor $executor, array $platform, Authorization $authorization, + DeleteEvent $queueForDeletes, + int $executionsRetentionCount, ) { $async = \strval($async) === 'true' || \strval($async) === '1'; @@ -164,6 +168,7 @@ class Create extends Base throw new Exception($validator->getDescription(), 400); } + /* @var Document $function */ $function = $authorization->skip(fn () => $dbForProject->getDocument('functions', $functionId)); $isAPIKey = User::isApp($authorization->getRoles()); @@ -340,6 +345,13 @@ class Create extends Base $execution = $authorization->skip(fn () => $dbForProject->createDocument('executions', $execution)); } + $this->enqueueDeletes( + $project, + $function->getSequence(), + $executionsRetentionCount, + $queueForDeletes + ); + return $response ->setStatusCode(Response::STATUS_CODE_ACCEPTED) ->dynamic($execution, Response::MODEL_EXECUTION); @@ -513,8 +525,32 @@ class Create extends Base } } + $this->enqueueDeletes( + $project, + $function->getSequence(), + $executionsRetentionCount, + $queueForDeletes + ); + $response ->setStatusCode(Response::STATUS_CODE_CREATED) ->dynamic($execution, Response::MODEL_EXECUTION); } + + private function enqueueDeletes( + Document $project, + string $resourceId, + int $executionsRetentionCount, + DeleteEvent $queueForDeletes + ): void { + /* cleanup */ + if ($executionsRetentionCount > 0 && ENABLE_EXECUTIONS_LIMIT_ON_ROUTE) { + $queueForDeletes + ->setProject($project) + ->setResource($resourceId) + ->setResourceType(RESOURCE_TYPE_FUNCTIONS) + ->setType(DELETE_TYPE_EXECUTIONS_LIMIT) + ->trigger(); + } + } } diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php index 6ad488283e..79c6afb92b 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php @@ -223,6 +223,8 @@ class Create extends Base 'entrypoint' => $entrypoint, 'commands' => $commands, 'scopes' => $scopes, + 'deploymentRetention' => 0, + 'startCommand' => '', 'search' => implode(' ', [$functionId, $name, $runtime]), 'version' => 'v5', 'installationId' => $installation->getId(), @@ -233,7 +235,9 @@ class Create extends Base 'providerBranch' => $providerBranch, 'providerRootDirectory' => $providerRootDirectory, 'providerSilentMode' => $providerSilentMode, - 'specification' => $specification + 'specification' => $specification, + 'buildSpecification' => $specification, + 'runtimeSpecification' => $specification, ])); } catch (DuplicateException) { throw new Exception(Exception::FUNCTION_ALREADY_EXISTS); @@ -343,6 +347,7 @@ class Create extends Base 'resourceType' => 'functions', 'entrypoint' => $function->getAttribute('entrypoint', ''), 'buildCommands' => $function->getAttribute('commands', ''), + 'startCommand' => $function->getAttribute('startCommand', ''), 'type' => 'manual', 'activate' => true, ])); diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php index 55c5b30418..f73e7ed8b8 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php @@ -261,6 +261,8 @@ class Update extends Base 'entrypoint' => $entrypoint, 'commands' => $commands, 'scopes' => $scopes, + 'deploymentRetention' => 0, + 'startCommand' => '', 'installationId' => $installation->getId(), 'installationInternalId' => $installation->getSequence(), 'providerRepositoryId' => $providerRepositoryId, @@ -270,6 +272,8 @@ class Update extends Base 'providerRootDirectory' => $providerRootDirectory, 'providerSilentMode' => $providerSilentMode, 'specification' => $specification, + 'buildSpecification' => $specification, + 'runtimeSpecification' => $specification, 'search' => implode(' ', [$functionId, $name, $runtime]), ]))); diff --git a/src/Appwrite/Platform/Modules/Functions/Services/Workers.php b/src/Appwrite/Platform/Modules/Functions/Services/Workers.php index 61256b6bf9..2acb31ad8a 100644 --- a/src/Appwrite/Platform/Modules/Functions/Services/Workers.php +++ b/src/Appwrite/Platform/Modules/Functions/Services/Workers.php @@ -3,6 +3,7 @@ namespace Appwrite\Platform\Modules\Functions\Services; use Appwrite\Platform\Modules\Functions\Workers\Builds; +use Appwrite\Platform\Modules\Functions\Workers\Screenshots; use Utopia\Platform\Service; class Workers extends Service @@ -11,5 +12,6 @@ class Workers extends Service { $this->type = Service::TYPE_WORKER; $this->addAction(Builds::getName(), new Builds()); + $this->addAction(Screenshots::getName(), new Screenshots()); } } diff --git a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php index 49568d9e49..8f041dd57b 100644 --- a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php +++ b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php @@ -6,10 +6,9 @@ use Ahc\Jwt\JWT; use Appwrite\Event\Event; use Appwrite\Event\Func; use Appwrite\Event\Realtime; +use Appwrite\Event\Screenshot; use Appwrite\Event\StatsUsage; use Appwrite\Event\Webhook; -use Appwrite\Permission; -use Appwrite\Role; use Appwrite\Utopia\Response\Model\Deployment; use Appwrite\Vcs\Comment; use Exception; @@ -25,23 +24,18 @@ use Utopia\Database\Exception\Conflict; use Utopia\Database\Exception\Duplicate; use Utopia\Database\Exception\Restricted; use Utopia\Database\Exception\Structure; -use Utopia\Database\Helpers\ID; use Utopia\Database\Query; use Utopia\Detector\Detection\Rendering\SSR; use Utopia\Detector\Detection\Rendering\XStatic; use Utopia\Detector\Detector\Rendering; -use Utopia\Fetch\Client as FetchClient; use Utopia\Logger\Log; use Utopia\Platform\Action; use Utopia\Queue\Message; -use Utopia\Storage\Compression\Compression; use Utopia\Storage\Device; use Utopia\Storage\Device\Local; use Utopia\System\System; use Utopia\VCS\Adapter\Git\GitHub; -use function Swoole\Coroutine\batch; - class Builds extends Action { public static function getName(): string @@ -61,6 +55,7 @@ class Builds extends Action ->inject('project') ->inject('dbForPlatform') ->inject('queueForEvents') + ->inject('queueForScreenshots') ->inject('queueForWebhooks') ->inject('queueForFunctions') ->inject('queueForRealtime') @@ -82,6 +77,7 @@ class Builds extends Action * @param Document $project * @param Database $dbForPlatform * @param Event $queueForEvents + * @param Screenshot $queueForScreenshots * @param Webhook $queueForWebhooks * @param Func $queueForFunctions * @param Realtime $queueForRealtime @@ -102,6 +98,7 @@ class Builds extends Action Document $project, Database $dbForPlatform, Event $queueForEvents, + Screenshot $queueForScreenshots, Webhook $queueForWebhooks, Func $queueForFunctions, Realtime $queueForRealtime, @@ -142,6 +139,7 @@ class Builds extends Action $deviceForFunctions, $deviceForSites, $deviceForFiles, + $queueForScreenshots, $queueForWebhooks, $queueForFunctions, $queueForRealtime, @@ -171,6 +169,7 @@ class Builds extends Action * @param Device $deviceForFunctions * @param Device $deviceForSites * @param Device $deviceForFiles + * @param Screenshot $queueForScreenshots * @param Webhook $queueForWebhooks * @param Func $queueForFunctions * @param Realtime $queueForRealtime @@ -195,6 +194,7 @@ class Builds extends Action Device $deviceForFunctions, Device $deviceForSites, Device $deviceForFiles, + Screenshot $queueForScreenshots, Webhook $queueForWebhooks, Func $queueForFunctions, Realtime $queueForRealtime, @@ -912,187 +912,6 @@ class Builds extends Action Console::log('Build details stored'); $this->afterBuildSuccess($queueForRealtime, $dbForProject, $deployment, $runtime, $adapter); - $logs = $deployment->getAttribute('buildLogs', ''); - - /** Screenshot site */ - if ($resource->getCollection() === 'sites') { - Console::log('Site screenshot started'); - - $date = \date('H:i:s'); - $logs .= "[$date] [appwrite] Screenshot capturing started. \n"; - $deployment->setAttribute('buildLogs', $logs); - $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), $deployment); - $queueForRealtime - ->setPayload($deployment->getArrayCopy()) - ->trigger(); - - try { - $rule = $dbForPlatform->findOne('rules', [ - Query::equal("projectInternalId", [$project->getSequence()]), - Query::equal("type", ["deployment"]), - Query::equal('deploymentInternalId', [$deployment->getSequence()]), - ]); - - if ($rule->isEmpty()) { - throw new \Exception("Rule for build not found"); - } - - $client = new FetchClient(); - $client->setTimeout(\intval($resource->getAttribute('timeout', '15'))); - $client->addHeader('content-type', FetchClient::CONTENT_TYPE_APPLICATION_JSON); - - $bucket = $dbForPlatform->getDocument('buckets', 'screenshots'); - - $configs = [ - 'screenshotLight' => [ - 'headers' => [ 'x-appwrite-hostname' => $rule->getAttribute('domain') ], - 'url' => 'http://appwrite/?appwrite-preview=1&appwrite-theme=light', - 'theme' => 'light' - ], - 'screenshotDark' => [ - 'headers' => [ 'x-appwrite-hostname' => $rule->getAttribute('domain') ], - 'url' => 'http://appwrite/?appwrite-preview=1&appwrite-theme=dark', - 'theme' => 'dark' - ], - ]; - - $jwtObj = new JWT(System::getEnv('_APP_OPENSSL_KEY_V1'), 'HS256', 900, 0); - $apiKey = $jwtObj->encode([ - 'hostnameOverride' => true, - 'disabledMetrics' => [ - METRIC_EXECUTIONS, - METRIC_EXECUTIONS_COMPUTE, - METRIC_EXECUTIONS_MB_SECONDS, - METRIC_NETWORK_REQUESTS, - METRIC_NETWORK_INBOUND, - METRIC_NETWORK_OUTBOUND, - str_replace(["{resourceType}"], [RESOURCE_TYPE_SITES], METRIC_RESOURCE_TYPE_EXECUTIONS), - str_replace(["{resourceType}"], [RESOURCE_TYPE_SITES], METRIC_RESOURCE_TYPE_EXECUTIONS_COMPUTE), - str_replace(["{resourceType}"], [RESOURCE_TYPE_SITES], METRIC_RESOURCE_TYPE_EXECUTIONS_MB_SECONDS), - str_replace(["{resourceType}", "{resourceInternalId}"], [RESOURCE_TYPE_SITES, $resource->getSequence()], METRIC_RESOURCE_TYPE_ID_EXECUTIONS), - str_replace(["{resourceType}", "{resourceInternalId}"], [RESOURCE_TYPE_SITES, $resource->getSequence()], METRIC_RESOURCE_TYPE_ID_EXECUTIONS_COMPUTE), - str_replace(["{resourceType}", "{resourceInternalId}"], [RESOURCE_TYPE_SITES, $resource->getSequence()], METRIC_RESOURCE_TYPE_ID_EXECUTIONS_MB_SECONDS), - ], - 'bannerDisabled' => true, - 'projectCheckDisabled' => true, - 'previewAuthDisabled' => true, - 'deploymentStatusIgnored' => true - ]); - - $screenshotError = null; - $screenshots = batch(\array_map(function ($key) use ($configs, $apiKey, $resource, $client, &$screenshotError) { - return function () use ($key, $configs, $apiKey, $resource, $client, &$screenshotError) { - try { - $config = $configs[$key]; - - $config['headers'] = \array_merge($config['headers'] ?? [], [ - 'x-appwrite-key' => API_KEY_DYNAMIC . '_' . $apiKey - ]); - $config['sleep'] = 3000; - - $frameworks = Config::getParam('frameworks', []); - $framework = $frameworks[$resource->getAttribute('framework', '')] ?? null; - if (!is_null($framework)) { - $config['sleep'] = $framework['screenshotSleep']; - } - - $browserEndpoint = System::getEnv('_APP_BROWSER_HOST', 'http://appwrite-browser:3000/v1'); - $fetchResponse = $client->fetch( - url: $browserEndpoint . '/screenshots', - method: 'POST', - body: $config - ); - - if ($fetchResponse->getStatusCode() >= 400) { - throw new \Exception($fetchResponse->getBody()); - } - - $screenshot = $fetchResponse->getBody(); - - return ['key' => $key, 'screenshot' => $screenshot]; - } catch (\Throwable $th) { - $screenshotError = $th->getMessage(); - return; - } - }; - }, \array_keys($configs))); - - if (!\is_null($screenshotError)) { - throw new \Exception($screenshotError); - } - - $mimeType = "image/png"; - - foreach ($screenshots as $data) { - $key = $data['key']; - $screenshot = $data['screenshot']; - - $fileId = ID::unique(); - $fileName = $fileId . '.png'; - $path = $deviceForFiles->getPath($fileName); - $path = str_ireplace($deviceForFiles->getRoot(), $deviceForFiles->getRoot() . DIRECTORY_SEPARATOR . $bucket->getId(), $path); // Add bucket id to path after root - $success = $deviceForFiles->write($path, $screenshot, $mimeType); - - if (!$success) { - throw new \Exception("Screenshot failed to save"); - } - - $teamId = $project->getAttribute('teamId', ''); - $file = new Document([ - '$id' => $fileId, - '$permissions' => [ - Permission::read(Role::team(ID::custom($teamId))), - ], - 'bucketId' => $bucket->getId(), - 'bucketInternalId' => $bucket->getSequence(), - 'name' => $fileName, - 'path' => $path, - 'signature' => $deviceForFiles->getFileHash($path), - 'mimeType' => $mimeType, - 'sizeOriginal' => \strlen($screenshot), - 'sizeActual' => $deviceForFiles->getFileSize($path), - 'algorithm' => Compression::NONE, - 'comment' => '', - 'chunksTotal' => 1, - 'chunksUploaded' => 1, - 'openSSLVersion' => null, - 'openSSLCipher' => null, - 'openSSLTag' => null, - 'openSSLIV' => null, - 'search' => implode(' ', [$fileId, $fileName]), - 'metadata' => ['content_type' => $mimeType], - ]); - - $dbForPlatform->createDocument('bucket_' . $bucket->getSequence(), $file); - - $deployment->setAttribute($key, $fileId); - } - - $logs = $deployment->getAttribute('buildLogs', ''); - $date = \date('H:i:s'); - $logs .= "[$date] [appwrite] Screenshot capturing finished. \n"; - - $deployment->setAttribute('buildLogs', $logs); - $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), $deployment); - - $queueForRealtime - ->setPayload($deployment->getArrayCopy()) - ->trigger(); - } catch (\Throwable $th) { - Console::warning("Screenshot failed to generate:"); - Console::warning($th->getMessage()); - Console::warning($th->getTraceAsString()); - - $logs = $deployment->getAttribute('buildLogs', ''); - $date = \date('H:i:s'); - $logs .= "[$date] [appwrite] Screenshot capturing failed. Deployment will continue. \n"; - - $deployment->setAttribute('buildLogs', $logs); - $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), $deployment); - } - - Console::log('Site screenshot finished'); - } $logs = $deployment->getAttribute('buildLogs', ''); $date = \date('H:i:s'); @@ -1113,6 +932,16 @@ class Builds extends Action $this->runGitAction('ready', $github, $providerCommitHash, $owner, $repositoryName, $project, $resource, $deployment->getId(), $dbForProject, $dbForPlatform, $queueForRealtime, $platform); } + /** Screenshot site */ + if ($resource->getCollection() === 'sites') { + $queueForScreenshots + ->setDeploymentId($deployment->getId()) + ->setProject($project) + ->trigger(); + + Console::log('Site screenshot queued'); + } + /** Set auto deploy */ $activateBuild = false; if ($deployment->getAttribute('activate') === true) { @@ -1170,8 +999,6 @@ class Builds extends Action 'live' => true, 'deploymentId' => $deployment->getId(), 'deploymentInternalId' => $deployment->getSequence(), - 'deploymentScreenshotDark' => $deployment->getAttribute('screenshotDark', ''), - 'deploymentScreenshotLight' => $deployment->getAttribute('screenshotLight', ''), 'deploymentCreatedAt' => $deployment->getCreatedAt(), ])); $queries = [ @@ -1196,6 +1023,11 @@ class Builds extends Action Console::log('Deployment activated'); } + $this->afterDeploymentSuccess( + $project, + $deployment, + ); + // Send realtime event after updating the associated resource so that Console will have the resource's deployment details when re-fetching. $queueForRealtime ->setPayload($deployment->getArrayCopy()) @@ -1264,9 +1096,10 @@ class Builds extends Action $endTime = DateTime::now(); $durationEnd = \microtime(true); - $deployment->setAttribute('buildEndedAt', $endTime); - $deployment->setAttribute('buildDuration', \intval(\ceil($durationEnd - $durationStart))); - $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), $deployment); + $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), new Document([ + 'buildEndedAt' => $endTime, + 'buildDuration' => \intval(\ceil($durationEnd - $durationStart)), + ])); $queueForRealtime ->setPayload($deployment->getArrayCopy()) ->trigger(); @@ -1427,6 +1260,26 @@ class Builds extends Action } } + /** + * Hook to run after deployment is activated + * + * @param Document $project + * @param Document $deployment + * @return void + */ + protected function afterDeploymentSuccess( + Document $project, + Document $deployment, + ): void { + if (!($project instanceof Document)) { + throw new Exception('project must be an instance of Document'); + } + + if (!($deployment instanceof Document)) { + throw new Exception('deployment must be an instance of Document'); + } + } + protected function getRuntime(Document $resource, string $version): array { $runtimes = Config::getParam($version === 'v2' ? 'runtimes-v2' : 'runtimes', []); diff --git a/src/Appwrite/Platform/Modules/Functions/Workers/Screenshots.php b/src/Appwrite/Platform/Modules/Functions/Workers/Screenshots.php new file mode 100644 index 0000000000..ca89532307 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Functions/Workers/Screenshots.php @@ -0,0 +1,281 @@ +desc('Screenshots worker') + ->groups(['screenshots']) + ->inject('message') + ->inject('queueForRealtime') + ->inject('dbForPlatform') + ->inject('dbForProject') + ->inject('project') + ->inject('deviceForFiles') + ->callback($this->action(...)); + } + + public function action( + Message $message, + Realtime $queueForRealtime, + Database $dbForPlatform, + Database $dbForProject, + Document $project, + Device $deviceForFiles + ): void { + Console::log('Screenshot action started'); + + $payload = $message->getPayload() ?? []; + + if (empty($payload)) { + throw new \Exception('Missing payload'); + } + + Console::log('Site screenshot started'); + + $deploymentId = $payload['deploymentId'] ?? null; + $deployment = $dbForProject->getDocument('deployments', $deploymentId); + + if ($deployment->isEmpty()) { + throw new \Exception('Deployment not found'); + } + + $siteId = $deployment->getAttribute('resourceId'); + $site = $dbForProject->getDocument('sites', $siteId); + + if ($site->isEmpty()) { + throw new \Exception('Site not found'); + } + + // Realtime preparation + $event = "sites.[siteId].deployments.[deploymentId].update"; + $queueForRealtime + ->setSubscribers(['console']) + ->setProject($project) + ->setEvent($event) + ->setParam('siteId', $site->getId()) + ->setParam('deploymentId', $deployment->getId()); + + $date = \date('H:i:s'); + $this->appendToLogs($dbForProject, $deployment->getId(), $queueForRealtime, "[$date] [appwrite] Screenshot capturing started. \n"); + + try { + $rule = $dbForPlatform->findOne('rules', [ + Query::equal("projectInternalId", [$project->getSequence()]), + Query::equal("type", ["deployment"]), + Query::equal('deploymentInternalId', [$deployment->getSequence()]), + ]); + + if ($rule->isEmpty()) { + throw new \Exception("Rule for deployment not found"); + } + + $client = new FetchClient(); + $client->setTimeout(\intval($site->getAttribute('timeout', '15')) * 1000); + $client->addHeader('content-type', FetchClient::CONTENT_TYPE_APPLICATION_JSON); + + $bucket = $dbForPlatform->getDocument('buckets', 'screenshots'); + + if ($bucket->isEmpty()) { + throw new \Exception('Bucket not found'); + } + + $configs = [ + 'screenshotLight' => [ + 'headers' => [ 'x-appwrite-hostname' => $rule->getAttribute('domain') ], + 'url' => 'http://appwrite/?appwrite-preview=1&appwrite-theme=light', + 'theme' => 'light' + ], + 'screenshotDark' => [ + 'headers' => [ 'x-appwrite-hostname' => $rule->getAttribute('domain') ], + 'url' => 'http://appwrite/?appwrite-preview=1&appwrite-theme=dark', + 'theme' => 'dark' + ], + ]; + + $jwtObj = new JWT(System::getEnv('_APP_OPENSSL_KEY_V1'), 'HS256', 900, 0); + $apiKey = $jwtObj->encode([ + 'hostnameOverride' => true, + 'disabledMetrics' => [ + METRIC_EXECUTIONS, + METRIC_EXECUTIONS_COMPUTE, + METRIC_EXECUTIONS_MB_SECONDS, + METRIC_NETWORK_REQUESTS, + METRIC_NETWORK_INBOUND, + METRIC_NETWORK_OUTBOUND, + str_replace(["{resourceType}"], [RESOURCE_TYPE_SITES], METRIC_RESOURCE_TYPE_EXECUTIONS), + str_replace(["{resourceType}"], [RESOURCE_TYPE_SITES], METRIC_RESOURCE_TYPE_EXECUTIONS_COMPUTE), + str_replace(["{resourceType}"], [RESOURCE_TYPE_SITES], METRIC_RESOURCE_TYPE_EXECUTIONS_MB_SECONDS), + str_replace(["{resourceType}", "{resourceInternalId}"], [RESOURCE_TYPE_SITES, $site->getSequence()], METRIC_RESOURCE_TYPE_ID_EXECUTIONS), + str_replace(["{resourceType}", "{resourceInternalId}"], [RESOURCE_TYPE_SITES, $site->getSequence()], METRIC_RESOURCE_TYPE_ID_EXECUTIONS_COMPUTE), + str_replace(["{resourceType}", "{resourceInternalId}"], [RESOURCE_TYPE_SITES, $site->getSequence()], METRIC_RESOURCE_TYPE_ID_EXECUTIONS_MB_SECONDS), + ], + 'bannerDisabled' => true, + 'projectCheckDisabled' => true, + 'previewAuthDisabled' => true, + 'deploymentStatusIgnored' => true + ]); + + $screenshotError = null; + $screenshots = batch(\array_map(function ($key) use ($configs, $apiKey, $site, $client, &$screenshotError) { + return function () use ($key, $configs, $apiKey, $site, $client, &$screenshotError) { + try { + $config = $configs[$key]; + + $config['headers'] = \array_merge($config['headers'] ?? [], [ + 'x-appwrite-key' => API_KEY_DYNAMIC . '_' . $apiKey + ]); + $config['sleep'] = 3000; + + $frameworks = Config::getParam('frameworks', []); + $framework = $frameworks[$site->getAttribute('framework', '')] ?? null; + if (!is_null($framework)) { + $config['sleep'] = $framework['screenshotSleep']; + } + + $browserEndpoint = System::getEnv('_APP_BROWSER_HOST', 'http://appwrite-browser:3000/v1'); + $fetchResponse = $client->fetch( + url: $browserEndpoint . '/screenshots', + method: 'POST', + body: $config + ); + + if ($fetchResponse->getStatusCode() >= 400) { + throw new \Exception($fetchResponse->getBody()); + } + + $screenshot = $fetchResponse->getBody(); + + return ['key' => $key, 'screenshot' => $screenshot]; + } catch (\Throwable $th) { + $screenshotError = $th->getMessage(); + return; + } + }; + }, \array_keys($configs))); + + if (!\is_null($screenshotError)) { + throw new \Exception($screenshotError); + } + + $mimeType = "image/png"; + $updates = new Document([]); + + foreach ($screenshots as $data) { + $key = $data['key']; + $screenshot = $data['screenshot']; + + $fileId = ID::unique(); + $fileName = $fileId . '.png'; + $path = $deviceForFiles->getPath($fileName); + $path = str_ireplace($deviceForFiles->getRoot(), $deviceForFiles->getRoot() . DIRECTORY_SEPARATOR . $bucket->getId(), $path); // Add bucket id to path after root + $success = $deviceForFiles->write($path, $screenshot, $mimeType); + + if (!$success) { + throw new \Exception("Screenshot failed to save"); + } + + $teamId = $project->getAttribute('teamId', ''); + $file = new Document([ + '$id' => $fileId, + '$permissions' => [ + Permission::read(Role::team(ID::custom($teamId))), + ], + 'bucketId' => $bucket->getId(), + 'bucketInternalId' => $bucket->getSequence(), + 'name' => $fileName, + 'path' => $path, + 'signature' => $deviceForFiles->getFileHash($path), + 'mimeType' => $mimeType, + 'sizeOriginal' => \strlen($screenshot), + 'sizeActual' => $deviceForFiles->getFileSize($path), + 'algorithm' => Compression::NONE, + 'comment' => '', + 'chunksTotal' => 1, + 'chunksUploaded' => 1, + 'openSSLVersion' => null, + 'openSSLCipher' => null, + 'openSSLTag' => null, + 'openSSLIV' => null, + 'search' => implode(' ', [$fileId, $fileName]), + 'metadata' => ['content_type' => $mimeType], + ]); + + $dbForPlatform->createDocument('bucket_' . $bucket->getSequence(), $file); + + $updates->setAttribute($key, $fileId); + } + + $date = \date('H:i:s'); + $this->appendToLogs($dbForProject, $deployment->getId(), $queueForRealtime, "[$date] [appwrite] Screenshot capturing finished. \n"); + + // Apply screenshot properties + $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), $updates); + + $queueForRealtime + ->setPayload($deployment->getArrayCopy()) + ->trigger(); + + $site = $dbForProject->updateDocument('sites', $site->getId(), new Document([ + 'deploymentScreenshotDark' => $deployment->getAttribute('screenshotDark', ''), + 'deploymentScreenshotLight' => $deployment->getAttribute('screenshotLight', ''), + ])); + } catch (\Throwable $th) { + Console::warning("Screenshot failed to generate:"); + Console::warning($th->getMessage()); + Console::warning($th->getTraceAsString()); + + $date = \date('H:i:s'); + $this->appendToLogs($dbForProject, $deployment->getId(), $queueForRealtime, "[$date] [appwrite] Screenshot capturing failed. Deployment will continue. \n"); + + throw $th; + } + } + + protected function appendToLogs(Database $dbForProject, string $deploymentId, Realtime $queueForRealtime, string $logs) + { + $deployment = $dbForProject->getDocument('deployments', $deploymentId); + + $buildLogs = $deployment->getAttribute('buildLogs', ''); + $buildLogs .= $logs; + + $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), new Document([ + 'buildLogs' => $buildLogs + ])); + + $queueForRealtime + ->setPayload($deployment->getArrayCopy()) + ->trigger(); + } +} diff --git a/src/Appwrite/Platform/Modules/Health/Http/Health/AntiVirus/Get.php b/src/Appwrite/Platform/Modules/Health/Http/Health/AntiVirus/Get.php new file mode 100644 index 0000000000..1ebdff4317 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Health/Http/Health/AntiVirus/Get.php @@ -0,0 +1,78 @@ +setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/health/anti-virus') + ->desc('Get antivirus') + ->groups(['api', 'health']) + ->label('scope', 'health.read') + ->label('sdk', new Method( + namespace: 'health', + group: 'health', + name: 'getAntivirus', + description: '/docs/references/health/get-storage-anti-virus.md', + auth: [AuthType::ADMIN, AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_HEALTH_ANTIVIRUS, + ) + ], + contentType: ContentType::JSON + )) + ->inject('response') + ->callback($this->action(...)); + } + + public function action(Response $response): void + { + $output = [ + 'status' => '', + 'version' => '', + ]; + + if (System::getEnv('_APP_STORAGE_ANTIVIRUS') === 'disabled') { + $output['status'] = 'disabled'; + $output['version'] = ''; + } else { + $antivirus = new Network( + System::getEnv('_APP_STORAGE_ANTIVIRUS_HOST', 'clamav'), + (int) System::getEnv('_APP_STORAGE_ANTIVIRUS_PORT', 3310) + ); + + try { + $output['version'] = @$antivirus->version(); + $output['status'] = (@$antivirus->ping()) ? 'pass' : 'fail'; + } catch (\Throwable) { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Antivirus is not available'); + } + } + + $response->dynamic(new Document($output), Response::MODEL_HEALTH_ANTIVIRUS); + } +} diff --git a/src/Appwrite/Platform/Modules/Health/Http/Health/Cache/Get.php b/src/Appwrite/Platform/Modules/Health/Http/Health/Cache/Get.php new file mode 100644 index 0000000000..bf7c3c4889 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Health/Http/Health/Cache/Get.php @@ -0,0 +1,94 @@ +setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/health/cache') + ->desc('Get cache') + ->groups(['api', 'health']) + ->label('scope', 'health.read') + ->label('sdk', new Method( + namespace: 'health', + group: 'health', + name: 'getCache', + description: '/docs/references/health/get-cache.md', + auth: [AuthType::ADMIN, AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_HEALTH_STATUS_LIST, + ) + ], + contentType: ContentType::JSON + )) + ->inject('response') + ->inject('pools') + ->callback($this->action(...)); + } + + public function action(Response $response, Group $pools): void + { + $output = []; + $failures = []; + + $configs = [ + 'Cache' => Config::getParam('pools-cache'), + ]; + + foreach ($configs as $key => $config) { + foreach ($config as $cache) { + try { + $adapter = new CachePool($pools->get($cache)); + + $checkStart = \microtime(true); + + if ($adapter->ping()) { + $output[] = new Document([ + 'name' => $key . " ($cache)", + 'status' => 'pass', + 'ping' => \round((\microtime(true) - $checkStart) * 1000), + ]); + } else { + $failures[] = $cache; + } + } catch (\Throwable) { + $failures[] = $cache; + } + } + } + + if (!empty($failures)) { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Cache failure on: ' . \implode(', ', $failures)); + } + + $response->dynamic(new Document([ + 'statuses' => $output, + 'total' => \count($output), + ]), Response::MODEL_HEALTH_STATUS_LIST); + } +} diff --git a/src/Appwrite/Platform/Modules/Health/Http/Health/Certificate/Get.php b/src/Appwrite/Platform/Modules/Health/Http/Health/Certificate/Get.php new file mode 100644 index 0000000000..60cf5d00d4 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Health/Http/Health/Certificate/Get.php @@ -0,0 +1,120 @@ +setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/health/certificate') + ->desc('Get the SSL certificate for a domain') + ->groups(['api', 'health']) + ->label('scope', 'health.read') + ->label('sdk', new Method( + namespace: 'health', + group: 'health', + name: 'getCertificate', + description: '/docs/references/health/get-certificate.md', + auth: [AuthType::ADMIN, AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_HEALTH_CERTIFICATE, + ) + ], + contentType: ContentType::JSON + )) + ->param('domain', null, new Multiple([new AnyOf([new URL(), new Domain()]), new PublicDomain()]), Multiple::TYPE_STRING, 'Domain name') + ->inject('response') + ->callback($this->action(...)); + } + + public function action(string $domain, Response $response): void + { + if (filter_var($domain, FILTER_VALIDATE_URL)) { + $domain = parse_url($domain, PHP_URL_HOST); + } + + $sslContext = stream_context_create([ + 'ssl' => [ + 'capture_peer_cert' => true, + 'SNI_enabled' => true, + 'peer_name' => $domain, + ], + ]); + + $sslSocket = @stream_socket_client('ssl://' . $domain . ':443', $errno, $errstr, 30, STREAM_CLIENT_CONNECT, $sslContext); + + if (!$sslSocket) { + throw new Exception(Exception::HEALTH_INVALID_HOST, 'Failed to connect to host: (' . ($errno ?? 'unknown') . ') ' . ($errstr ?? 'unknown')); + } + + try { + $streamContextParams = stream_context_get_params($sslSocket); + $peerCertificate = $streamContextParams['options']['ssl']['peer_certificate'] ?? null; + + if ($peerCertificate === null) { + throw new Exception(Exception::HEALTH_INVALID_HOST, 'Peer certificate not available for ' . $domain); + } + + $certificatePayload = @openssl_x509_parse($peerCertificate); + if ($certificatePayload === false || !\is_array($certificatePayload)) { + throw new Exception(Exception::HEALTH_INVALID_HOST, 'Failed to parse peer certificate for ' . $domain); + } + + $validFrom = $certificatePayload['validFrom_time_t'] ?? null; + $validTo = $certificatePayload['validTo_time_t'] ?? null; + + if ($validFrom === null || $validTo === null) { + throw new Exception(Exception::HEALTH_INVALID_HOST, 'Certificate missing validity period for ' . $domain); + } + + $sslExpiration = $validTo; + $status = $sslExpiration < time() ? 'fail' : 'pass'; + + if ($status === 'fail') { + throw new Exception(Exception::HEALTH_CERTIFICATE_EXPIRED); + } + + $name = $certificatePayload['name'] ?? null; + if (empty($name) && !empty($certificatePayload['subject']['CN'])) { + $name = '/CN=' . $certificatePayload['subject']['CN']; + } + + $response->dynamic(new Document([ + 'name' => $name ?? '', + 'subjectSN' => $certificatePayload['subject']['CN'] ?? '', + 'issuerOrganisation' => $certificatePayload['issuer']['O'] ?? '', + 'validFrom' => $validFrom, + 'validTo' => $validTo, + 'signatureTypeSN' => $certificatePayload['signatureTypeSN'] ?? '', + ]), Response::MODEL_HEALTH_CERTIFICATE); + } finally { + @fclose($sslSocket); + } + } +} diff --git a/src/Appwrite/Platform/Modules/Health/Http/Health/DB/Get.php b/src/Appwrite/Platform/Modules/Health/Http/Health/DB/Get.php new file mode 100644 index 0000000000..f24de7eeca --- /dev/null +++ b/src/Appwrite/Platform/Modules/Health/Http/Health/DB/Get.php @@ -0,0 +1,100 @@ +setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/health/db') + ->desc('Get DB') + ->groups(['api', 'health']) + ->label('scope', 'health.read') + ->label('sdk', new Method( + namespace: 'health', + group: 'health', + name: 'getDB', + description: '/docs/references/health/get-db.md', + auth: [AuthType::ADMIN, AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_HEALTH_STATUS_LIST, + ) + ], + contentType: ContentType::JSON + )) + ->inject('response') + ->inject('pools') + ->inject('authorization') + ->callback($this->action(...)); + } + + public function action(Response $response, Group $pools, Authorization $authorization): void + { + $output = []; + $failures = []; + + $configs = [ + 'Console.DB' => Config::getParam('pools-console'), + 'Projects.DB' => Config::getParam('pools-database'), + ]; + + foreach ($configs as $key => $config) { + foreach ($config as $database) { + try { + $adapter = new DatabasePool($pools->get($database)); + $adapter->setAuthorization($authorization); + + $checkStart = \microtime(true); + + if ($adapter->ping()) { + $output[] = new Document([ + 'name' => $key . " ($database)", + 'status' => 'pass', + 'ping' => \round((\microtime(true) - $checkStart) * 1000) + ]); + } else { + $failures[] = $database; + } + } catch (\Throwable) { + $failures[] = $database; + } + } + } + + // Only throw error if ALL databases failed (no successful pings) + // This allows partial failures in environments where not all DBs are ready + if (!empty($failures)) { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'DB failure on: ' . implode(", ", $failures)); + } + + $response->dynamic(new Document([ + 'statuses' => $output, + 'total' => count($output), + ]), Response::MODEL_HEALTH_STATUS_LIST); + } +} diff --git a/src/Appwrite/Platform/Modules/Health/Http/Health/Get.php b/src/Appwrite/Platform/Modules/Health/Http/Health/Get.php new file mode 100644 index 0000000000..818e122054 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Health/Http/Health/Get.php @@ -0,0 +1,57 @@ +setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/health') + ->desc('Get HTTP') + ->groups(['api', 'health']) + ->label('scope', 'health.read') + ->label('sdk', new Method( + namespace: 'health', + group: 'health', + name: 'get', + description: '/docs/references/health/get.md', + auth: [AuthType::ADMIN, AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_HEALTH_STATUS, + ) + ], + contentType: ContentType::JSON + )) + ->inject('response') + ->callback($this->action(...)); + } + + public function action(Response $response): void + { + $response->dynamic(new Document([ + 'name' => 'http', + 'status' => 'pass', + 'ping' => 0, + ]), Response::MODEL_HEALTH_STATUS); + } +} diff --git a/src/Appwrite/Platform/Modules/Health/Http/Health/PubSub/Get.php b/src/Appwrite/Platform/Modules/Health/Http/Health/PubSub/Get.php new file mode 100644 index 0000000000..68cd36d1ba --- /dev/null +++ b/src/Appwrite/Platform/Modules/Health/Http/Health/PubSub/Get.php @@ -0,0 +1,94 @@ +setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/health/pubsub') + ->desc('Get pubsub') + ->groups(['api', 'health']) + ->label('scope', 'health.read') + ->label('sdk', new Method( + namespace: 'health', + group: 'health', + name: 'getPubSub', + description: '/docs/references/health/get-pubsub.md', + auth: [AuthType::ADMIN, AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_HEALTH_STATUS_LIST, + ) + ], + contentType: ContentType::JSON + )) + ->inject('response') + ->inject('pools') + ->callback($this->action(...)); + } + + public function action(Response $response, Group $pools): void + { + $output = []; + $failures = []; + + $configs = [ + 'PubSub' => Config::getParam('pools-pubsub'), + ]; + + foreach ($configs as $key => $config) { + foreach ($config as $pubsub) { + try { + $adapter = new PubSubPool($pools->get($pubsub)); + + $checkStart = \microtime(true); + + if ($adapter->ping()) { + $output[] = new Document([ + 'name' => $key . " ($pubsub)", + 'status' => 'pass', + 'ping' => \round((\microtime(true) - $checkStart) * 1000), + ]); + } else { + $failures[] = $pubsub; + } + } catch (\Throwable) { + $failures[] = $pubsub; + } + } + } + + if (!empty($failures)) { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Pubsub failure on: ' . \implode(', ', $failures)); + } + + $response->dynamic(new Document([ + 'statuses' => $output, + 'total' => \count($output), + ]), Response::MODEL_HEALTH_STATUS_LIST); + } +} diff --git a/src/Appwrite/Platform/Modules/Health/Http/Health/Queue/Audits/Get.php b/src/Appwrite/Platform/Modules/Health/Http/Health/Queue/Audits/Get.php new file mode 100644 index 0000000000..e01e89641d --- /dev/null +++ b/src/Appwrite/Platform/Modules/Health/Http/Health/Queue/Audits/Get.php @@ -0,0 +1,60 @@ +setHttpMethod(Base::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/health/queue/audits') + ->desc('Get audits queue') + ->groups(['api', 'health']) + ->label('scope', 'health.read') + ->label('sdk', new Method( + namespace: 'health', + group: 'queue', + name: 'getQueueAudits', + description: '/docs/references/health/get-queue-audits.md', + auth: [AuthType::ADMIN, AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_HEALTH_QUEUE, + ) + ], + contentType: ContentType::JSON + )) + ->param('threshold', 5000, new Integer(true), 'Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.', true) + ->inject('queueForAudits') + ->inject('response') + ->callback($this->action(...)); + } + + public function action(int|string $threshold, Audit $queueForAudits, Response $response): void + { + $threshold = (int) $threshold; + + $size = $queueForAudits->getSize(); + + $this->assertQueueThreshold($size, $threshold); + + $response->dynamic(new Document(['size' => $size]), Response::MODEL_HEALTH_QUEUE); + } +} diff --git a/src/Appwrite/Platform/Modules/Health/Http/Health/Queue/Base.php b/src/Appwrite/Platform/Modules/Health/Http/Health/Queue/Base.php new file mode 100644 index 0000000000..d5cf87a0cd --- /dev/null +++ b/src/Appwrite/Platform/Modules/Health/Http/Health/Queue/Base.php @@ -0,0 +1,20 @@ += $threshold) { + $context = $failed ? 'failed jobs' : 'jobs'; + throw new Exception(Exception::HEALTH_QUEUE_SIZE_EXCEEDED, "Queue {$context} threshold hit. Current value is {$size} and threshold is {$threshold}."); + } + } +} diff --git a/src/Appwrite/Platform/Modules/Health/Http/Health/Queue/Builds/Get.php b/src/Appwrite/Platform/Modules/Health/Http/Health/Queue/Builds/Get.php new file mode 100644 index 0000000000..8ae7c8687a --- /dev/null +++ b/src/Appwrite/Platform/Modules/Health/Http/Health/Queue/Builds/Get.php @@ -0,0 +1,60 @@ +setHttpMethod(Base::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/health/queue/builds') + ->desc('Get builds queue') + ->groups(['api', 'health']) + ->label('scope', 'health.read') + ->label('sdk', new Method( + namespace: 'health', + group: 'queue', + name: 'getQueueBuilds', + description: '/docs/references/health/get-queue-builds.md', + auth: [AuthType::ADMIN, AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_HEALTH_QUEUE, + ) + ], + contentType: ContentType::JSON + )) + ->param('threshold', 5000, new Integer(true), 'Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.', true) + ->inject('queueForBuilds') + ->inject('response') + ->callback($this->action(...)); + } + + public function action(int|string $threshold, Build $queueForBuilds, Response $response): void + { + $threshold = (int) $threshold; + + $size = $queueForBuilds->getSize(); + + $this->assertQueueThreshold($size, $threshold); + + $response->dynamic(new Document(['size' => $size]), Response::MODEL_HEALTH_QUEUE); + } +} diff --git a/src/Appwrite/Platform/Modules/Health/Http/Health/Queue/Certificates/Get.php b/src/Appwrite/Platform/Modules/Health/Http/Health/Queue/Certificates/Get.php new file mode 100644 index 0000000000..6724f25094 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Health/Http/Health/Queue/Certificates/Get.php @@ -0,0 +1,60 @@ +setHttpMethod(Base::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/health/queue/certificates') + ->desc('Get certificates queue') + ->groups(['api', 'health']) + ->label('scope', 'health.read') + ->label('sdk', new Method( + namespace: 'health', + group: 'queue', + name: 'getQueueCertificates', + description: '/docs/references/health/get-queue-certificates.md', + auth: [AuthType::ADMIN, AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_HEALTH_QUEUE, + ) + ], + contentType: ContentType::JSON + )) + ->param('threshold', 5000, new Integer(true), 'Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.', true) + ->inject('queueForCertificates') + ->inject('response') + ->callback($this->action(...)); + } + + public function action(int|string $threshold, Certificate $queueForCertificates, Response $response): void + { + $threshold = (int) $threshold; + + $size = $queueForCertificates->getSize(); + + $this->assertQueueThreshold($size, $threshold); + + $response->dynamic(new Document(['size' => $size]), Response::MODEL_HEALTH_QUEUE); + } +} diff --git a/src/Appwrite/Platform/Modules/Health/Http/Health/Queue/Databases/Get.php b/src/Appwrite/Platform/Modules/Health/Http/Health/Queue/Databases/Get.php new file mode 100644 index 0000000000..213bd8b36c --- /dev/null +++ b/src/Appwrite/Platform/Modules/Health/Http/Health/Queue/Databases/Get.php @@ -0,0 +1,61 @@ +setHttpMethod(Base::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/health/queue/databases') + ->desc('Get databases queue') + ->groups(['api', 'health']) + ->label('scope', 'health.read') + ->label('sdk', new Method( + namespace: 'health', + group: 'queue', + name: 'getQueueDatabases', + description: '/docs/references/health/get-queue-databases.md', + auth: [AuthType::ADMIN, AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_HEALTH_QUEUE, + ) + ], + contentType: ContentType::JSON + )) + ->param('name', 'database_db_main', new Text(256), 'Queue name for which to check the queue size', true) + ->param('threshold', 5000, new Integer(true), 'Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.', true) + ->inject('queueForDatabase') + ->inject('response') + ->callback($this->action(...)); + } + + public function action(string $name, int|string $threshold, Database $queueForDatabase, Response $response): void + { + $threshold = (int) $threshold; + $size = $queueForDatabase->setQueue($name)->getSize(); + + $this->assertQueueThreshold($size, $threshold); + + $response->dynamic(new Document(['size' => $size]), Response::MODEL_HEALTH_QUEUE); + } +} diff --git a/src/Appwrite/Platform/Modules/Health/Http/Health/Queue/Deletes/Get.php b/src/Appwrite/Platform/Modules/Health/Http/Health/Queue/Deletes/Get.php new file mode 100644 index 0000000000..816583fc47 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Health/Http/Health/Queue/Deletes/Get.php @@ -0,0 +1,60 @@ +setHttpMethod(Base::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/health/queue/deletes') + ->desc('Get deletes queue') + ->groups(['api', 'health']) + ->label('scope', 'health.read') + ->label('sdk', new Method( + namespace: 'health', + group: 'queue', + name: 'getQueueDeletes', + description: '/docs/references/health/get-queue-deletes.md', + auth: [AuthType::ADMIN, AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_HEALTH_QUEUE, + ) + ], + contentType: ContentType::JSON + )) + ->param('threshold', 5000, new Integer(true), 'Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.', true) + ->inject('queueForDeletes') + ->inject('response') + ->callback($this->action(...)); + } + + public function action(int|string $threshold, Delete $queueForDeletes, Response $response): void + { + $threshold = (int) $threshold; + + $size = $queueForDeletes->getSize(); + + $this->assertQueueThreshold($size, $threshold); + + $response->dynamic(new Document(['size' => $size]), Response::MODEL_HEALTH_QUEUE); + } +} diff --git a/src/Appwrite/Platform/Modules/Health/Http/Health/Queue/Failed/Get.php b/src/Appwrite/Platform/Modules/Health/Http/Health/Queue/Failed/Get.php new file mode 100644 index 0000000000..dc84d0ee37 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Health/Http/Health/Queue/Failed/Get.php @@ -0,0 +1,133 @@ +setHttpMethod(Base::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/health/queue/failed/:name') + ->desc('Get number of failed queue jobs') + ->groups(['api', 'health']) + ->label('scope', 'health.read') + ->label('sdk', new Method( + namespace: 'health', + group: 'queue', + name: 'getFailedJobs', + description: '/docs/references/health/get-failed-queue-jobs.md', + auth: [AuthType::ADMIN, AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_HEALTH_QUEUE, + ) + ], + contentType: ContentType::JSON + )) + ->param('name', '', new WhiteList([ + System::getEnv('_APP_DATABASE_QUEUE_NAME', Event::DATABASE_QUEUE_NAME), + System::getEnv('_APP_DELETE_QUEUE_NAME', Event::DELETE_QUEUE_NAME), + System::getEnv('_APP_AUDITS_QUEUE_NAME', Event::AUDITS_QUEUE_NAME), + System::getEnv('_APP_MAILS_QUEUE_NAME', Event::MAILS_QUEUE_NAME), + System::getEnv('_APP_FUNCTIONS_QUEUE_NAME', Event::FUNCTIONS_QUEUE_NAME), + System::getEnv('_APP_STATS_RESOURCES_QUEUE_NAME', Event::STATS_RESOURCES_QUEUE_NAME), + System::getEnv('_APP_STATS_USAGE_QUEUE_NAME', Event::STATS_USAGE_QUEUE_NAME), + System::getEnv('_APP_WEBHOOK_QUEUE_NAME', Event::WEBHOOK_QUEUE_NAME), + System::getEnv('_APP_CERTIFICATES_QUEUE_NAME', Event::CERTIFICATES_QUEUE_NAME), + System::getEnv('_APP_BUILDS_QUEUE_NAME', Event::BUILDS_QUEUE_NAME), + System::getEnv('_APP_SCREENSHOTS_QUEUE_NAME', Event::SCREENSHOTS_QUEUE_NAME), + System::getEnv('_APP_MESSAGING_QUEUE_NAME', Event::MESSAGING_QUEUE_NAME), + System::getEnv('_APP_MIGRATIONS_QUEUE_NAME', Event::MIGRATIONS_QUEUE_NAME), + ]), 'The name of the queue') + ->param('threshold', 5000, new Integer(true), 'Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.', true) + ->inject('response') + ->inject('queueForDatabase') + ->inject('queueForDeletes') + ->inject('queueForAudits') + ->inject('queueForMails') + ->inject('queueForFunctions') + ->inject('queueForStatsResources') + ->inject('queueForStatsUsage') + ->inject('queueForWebhooks') + ->inject('queueForCertificates') + ->inject('queueForBuilds') + ->inject('queueForMessaging') + ->inject('queueForMigrations') + ->inject('queueForScreenshots') + ->callback($this->action(...)); + } + + public function action( + string $name, + int|string $threshold, + Response $response, + Database $queueForDatabase, + Delete $queueForDeletes, + Audit $queueForAudits, + Mail $queueForMails, + Func $queueForFunctions, + StatsResources $queueForStatsResources, + StatsUsage $queueForStatsUsage, + Webhook $queueForWebhooks, + Certificate $queueForCertificates, + Build $queueForBuilds, + Messaging $queueForMessaging, + Migration $queueForMigrations, + Screenshot $queueForScreenshots, + ): void { + $threshold = (int) $threshold; + + $queue = match ($name) { + System::getEnv('_APP_DATABASE_QUEUE_NAME', Event::DATABASE_QUEUE_NAME) => $queueForDatabase, + System::getEnv('_APP_DELETE_QUEUE_NAME', Event::DELETE_QUEUE_NAME) => $queueForDeletes, + System::getEnv('_APP_AUDITS_QUEUE_NAME', Event::AUDITS_QUEUE_NAME) => $queueForAudits, + System::getEnv('_APP_MAILS_QUEUE_NAME', Event::MAILS_QUEUE_NAME) => $queueForMails, + System::getEnv('_APP_FUNCTIONS_QUEUE_NAME', Event::FUNCTIONS_QUEUE_NAME) => $queueForFunctions, + System::getEnv('_APP_STATS_RESOURCES_QUEUE_NAME', Event::STATS_RESOURCES_QUEUE_NAME) => $queueForStatsResources, + System::getEnv('_APP_STATS_USAGE_QUEUE_NAME', Event::STATS_USAGE_QUEUE_NAME) => $queueForStatsUsage, + System::getEnv('_APP_WEBHOOK_QUEUE_NAME', Event::WEBHOOK_QUEUE_NAME) => $queueForWebhooks, + System::getEnv('_APP_CERTIFICATES_QUEUE_NAME', Event::CERTIFICATES_QUEUE_NAME) => $queueForCertificates, + System::getEnv('_APP_BUILDS_QUEUE_NAME', Event::BUILDS_QUEUE_NAME) => $queueForBuilds, + System::getEnv('_APP_SCREENSHOTS_QUEUE_NAME', Event::SCREENSHOTS_QUEUE_NAME) => $queueForScreenshots, + System::getEnv('_APP_MESSAGING_QUEUE_NAME', Event::MESSAGING_QUEUE_NAME) => $queueForMessaging, + System::getEnv('_APP_MIGRATIONS_QUEUE_NAME', Event::MIGRATIONS_QUEUE_NAME) => $queueForMigrations, + }; + $failed = $queue->getSize(failed: true); + + $this->assertQueueThreshold($failed, $threshold, true); + + $response->dynamic(new Document(['size' => $failed]), Response::MODEL_HEALTH_QUEUE); + } +} diff --git a/src/Appwrite/Platform/Modules/Health/Http/Health/Queue/Functions/Get.php b/src/Appwrite/Platform/Modules/Health/Http/Health/Queue/Functions/Get.php new file mode 100644 index 0000000000..1d10b8d1a0 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Health/Http/Health/Queue/Functions/Get.php @@ -0,0 +1,60 @@ +setHttpMethod(Base::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/health/queue/functions') + ->desc('Get functions queue') + ->groups(['api', 'health']) + ->label('scope', 'health.read') + ->label('sdk', new Method( + namespace: 'health', + group: 'queue', + name: 'getQueueFunctions', + description: '/docs/references/health/get-queue-functions.md', + auth: [AuthType::ADMIN, AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_HEALTH_QUEUE, + ) + ], + contentType: ContentType::JSON + )) + ->param('threshold', 5000, new Integer(true), 'Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.', true) + ->inject('queueForFunctions') + ->inject('response') + ->callback($this->action(...)); + } + + public function action(int|string $threshold, Func $queueForFunctions, Response $response): void + { + $threshold = (int) $threshold; + + $size = $queueForFunctions->getSize(); + + $this->assertQueueThreshold($size, $threshold); + + $response->dynamic(new Document(['size' => $size]), Response::MODEL_HEALTH_QUEUE); + } +} diff --git a/src/Appwrite/Platform/Modules/Health/Http/Health/Queue/Logs/Get.php b/src/Appwrite/Platform/Modules/Health/Http/Health/Queue/Logs/Get.php new file mode 100644 index 0000000000..dd05aebc39 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Health/Http/Health/Queue/Logs/Get.php @@ -0,0 +1,60 @@ +setHttpMethod(Base::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/health/queue/logs') + ->desc('Get logs queue') + ->groups(['api', 'health']) + ->label('scope', 'health.read') + ->label('sdk', new Method( + namespace: 'health', + group: 'queue', + name: 'getQueueLogs', + description: '/docs/references/health/get-queue-logs.md', + auth: [AuthType::ADMIN, AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_HEALTH_QUEUE, + ) + ], + contentType: ContentType::JSON + )) + ->param('threshold', 5000, new Integer(true), 'Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.', true) + ->inject('queueForAudits') + ->inject('response') + ->callback($this->action(...)); + } + + public function action(int|string $threshold, Audit $queueForAudits, Response $response): void + { + $threshold = (int) $threshold; + + $size = $queueForAudits->getSize(); + + $this->assertQueueThreshold($size, $threshold); + + $response->dynamic(new Document(['size' => $size]), Response::MODEL_HEALTH_QUEUE); + } +} diff --git a/src/Appwrite/Platform/Modules/Health/Http/Health/Queue/Mails/Get.php b/src/Appwrite/Platform/Modules/Health/Http/Health/Queue/Mails/Get.php new file mode 100644 index 0000000000..3b9c06b5f9 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Health/Http/Health/Queue/Mails/Get.php @@ -0,0 +1,60 @@ +setHttpMethod(Base::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/health/queue/mails') + ->desc('Get mails queue') + ->groups(['api', 'health']) + ->label('scope', 'health.read') + ->label('sdk', new Method( + namespace: 'health', + group: 'queue', + name: 'getQueueMails', + description: '/docs/references/health/get-queue-mails.md', + auth: [AuthType::ADMIN, AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_HEALTH_QUEUE, + ) + ], + contentType: ContentType::JSON + )) + ->param('threshold', 5000, new Integer(true), 'Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.', true) + ->inject('queueForMails') + ->inject('response') + ->callback($this->action(...)); + } + + public function action(int|string $threshold, Mail $queueForMails, Response $response): void + { + $threshold = (int) $threshold; + + $size = $queueForMails->getSize(); + + $this->assertQueueThreshold($size, $threshold); + + $response->dynamic(new Document(['size' => $size]), Response::MODEL_HEALTH_QUEUE); + } +} diff --git a/src/Appwrite/Platform/Modules/Health/Http/Health/Queue/Messaging/Get.php b/src/Appwrite/Platform/Modules/Health/Http/Health/Queue/Messaging/Get.php new file mode 100644 index 0000000000..db2d7d7172 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Health/Http/Health/Queue/Messaging/Get.php @@ -0,0 +1,60 @@ +setHttpMethod(Base::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/health/queue/messaging') + ->desc('Get messaging queue') + ->groups(['api', 'health']) + ->label('scope', 'health.read') + ->label('sdk', new Method( + namespace: 'health', + group: 'queue', + name: 'getQueueMessaging', + description: '/docs/references/health/get-queue-messaging.md', + auth: [AuthType::ADMIN, AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_HEALTH_QUEUE, + ) + ], + contentType: ContentType::JSON + )) + ->param('threshold', 5000, new Integer(true), 'Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.', true) + ->inject('queueForMessaging') + ->inject('response') + ->callback($this->action(...)); + } + + public function action(int|string $threshold, Messaging $queueForMessaging, Response $response): void + { + $threshold = (int) $threshold; + + $size = $queueForMessaging->getSize(); + + $this->assertQueueThreshold($size, $threshold); + + $response->dynamic(new Document(['size' => $size]), Response::MODEL_HEALTH_QUEUE); + } +} diff --git a/src/Appwrite/Platform/Modules/Health/Http/Health/Queue/Migrations/Get.php b/src/Appwrite/Platform/Modules/Health/Http/Health/Queue/Migrations/Get.php new file mode 100644 index 0000000000..4faca7d8a4 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Health/Http/Health/Queue/Migrations/Get.php @@ -0,0 +1,60 @@ +setHttpMethod(Base::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/health/queue/migrations') + ->desc('Get migrations queue') + ->groups(['api', 'health']) + ->label('scope', 'health.read') + ->label('sdk', new Method( + namespace: 'health', + group: 'queue', + name: 'getQueueMigrations', + description: '/docs/references/health/get-queue-migrations.md', + auth: [AuthType::ADMIN, AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_HEALTH_QUEUE, + ) + ], + contentType: ContentType::JSON + )) + ->param('threshold', 5000, new Integer(true), 'Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.', true) + ->inject('queueForMigrations') + ->inject('response') + ->callback($this->action(...)); + } + + public function action(int|string $threshold, Migration $queueForMigrations, Response $response): void + { + $threshold = (int) $threshold; + + $size = $queueForMigrations->getSize(); + + $this->assertQueueThreshold($size, $threshold); + + $response->dynamic(new Document(['size' => $size]), Response::MODEL_HEALTH_QUEUE); + } +} diff --git a/src/Appwrite/Platform/Modules/Health/Http/Health/Queue/StatsResources/Get.php b/src/Appwrite/Platform/Modules/Health/Http/Health/Queue/StatsResources/Get.php new file mode 100644 index 0000000000..57605298fd --- /dev/null +++ b/src/Appwrite/Platform/Modules/Health/Http/Health/Queue/StatsResources/Get.php @@ -0,0 +1,60 @@ +setHttpMethod(Base::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/health/queue/stats-resources') + ->desc('Get stats resources queue') + ->groups(['api', 'health']) + ->label('scope', 'health.read') + ->label('sdk', new Method( + namespace: 'health', + group: 'queue', + name: 'getQueueStatsResources', + description: '/docs/references/health/get-queue-stats-resources.md', + auth: [AuthType::ADMIN, AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_HEALTH_QUEUE, + ) + ], + contentType: ContentType::JSON + )) + ->param('threshold', 5000, new Integer(true), 'Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.', true) + ->inject('queueForStatsResources') + ->inject('response') + ->callback($this->action(...)); + } + + public function action(int|string $threshold, StatsResources $queueForStatsResources, Response $response): void + { + $threshold = (int) $threshold; + + $size = $queueForStatsResources->getSize(); + + $this->assertQueueThreshold($size, $threshold); + + $response->dynamic(new Document(['size' => $size]), Response::MODEL_HEALTH_QUEUE); + } +} diff --git a/src/Appwrite/Platform/Modules/Health/Http/Health/Queue/StatsUsage/Get.php b/src/Appwrite/Platform/Modules/Health/Http/Health/Queue/StatsUsage/Get.php new file mode 100644 index 0000000000..10678efbc3 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Health/Http/Health/Queue/StatsUsage/Get.php @@ -0,0 +1,60 @@ +setHttpMethod(Base::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/health/queue/stats-usage') + ->desc('Get stats usage queue') + ->groups(['api', 'health']) + ->label('scope', 'health.read') + ->label('sdk', new Method( + namespace: 'health', + group: 'queue', + name: 'getQueueUsage', + description: '/docs/references/health/get-queue-stats-usage.md', + auth: [AuthType::ADMIN, AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_HEALTH_QUEUE, + ) + ], + contentType: ContentType::JSON + )) + ->param('threshold', 5000, new Integer(true), 'Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.', true) + ->inject('queueForStatsUsage') + ->inject('response') + ->callback($this->action(...)); + } + + public function action(int|string $threshold, StatsUsage $queueForStatsUsage, Response $response): void + { + $threshold = (int) $threshold; + + $size = $queueForStatsUsage->getSize(); + + $this->assertQueueThreshold($size, $threshold); + + $response->dynamic(new Document(['size' => $size]), Response::MODEL_HEALTH_QUEUE); + } +} diff --git a/src/Appwrite/Platform/Modules/Health/Http/Health/Queue/Webhooks/Get.php b/src/Appwrite/Platform/Modules/Health/Http/Health/Queue/Webhooks/Get.php new file mode 100644 index 0000000000..3eef1818a7 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Health/Http/Health/Queue/Webhooks/Get.php @@ -0,0 +1,60 @@ +setHttpMethod(Base::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/health/queue/webhooks') + ->desc('Get webhooks queue') + ->groups(['api', 'health']) + ->label('scope', 'health.read') + ->label('sdk', new Method( + namespace: 'health', + group: 'queue', + name: 'getQueueWebhooks', + description: '/docs/references/health/get-queue-webhooks.md', + auth: [AuthType::ADMIN, AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_HEALTH_QUEUE, + ) + ], + contentType: ContentType::JSON + )) + ->param('threshold', 5000, new Integer(true), 'Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.', true) + ->inject('queueForWebhooks') + ->inject('response') + ->callback($this->action(...)); + } + + public function action(int|string $threshold, Webhook $queueForWebhooks, Response $response): void + { + $threshold = (int) $threshold; + + $size = $queueForWebhooks->getSize(); + + $this->assertQueueThreshold($size, $threshold); + + $response->dynamic(new Document(['size' => $size]), Response::MODEL_HEALTH_QUEUE); + } +} diff --git a/src/Appwrite/Platform/Modules/Health/Http/Health/Stats/Get.php b/src/Appwrite/Platform/Modules/Health/Http/Health/Stats/Get.php new file mode 100644 index 0000000000..0d845ebba0 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Health/Http/Health/Stats/Get.php @@ -0,0 +1,60 @@ +setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/health/stats') + ->desc('Get system stats') + ->groups(['api', 'health']) + ->label('scope', 'root') + ->label('docs', false) + ->inject('response') + ->inject('register') + ->inject('deviceForFiles') + ->callback($this->action(...)); + } + + public function action(Response $response, Registry $register, Device $deviceForFiles): void + { + $cache = $register->get('cache'); + + $cacheStats = $cache->info(); + + $response->json([ + 'storage' => [ + 'used' => Storage::human($deviceForFiles->getDirectorySize($deviceForFiles->getRoot() . '/')), + 'partitionTotal' => Storage::human($deviceForFiles->getPartitionTotalSpace()), + 'partitionFree' => Storage::human($deviceForFiles->getPartitionFreeSpace()), + ], + 'cache' => [ + 'uptime' => $cacheStats['uptime_in_seconds'] ?? 0, + 'clients' => $cacheStats['connected_clients'] ?? 0, + 'hits' => $cacheStats['keyspace_hits'] ?? 0, + 'misses' => $cacheStats['keyspace_misses'] ?? 0, + 'memory_used' => $cacheStats['used_memory'] ?? 0, + 'memory_used_human' => $cacheStats['used_memory_human'] ?? 0, + 'memory_used_peak' => $cacheStats['used_memory_peak'] ?? 0, + 'memory_used_peak_human' => $cacheStats['used_memory_peak_human'] ?? 0, + ], + ]); + } +} diff --git a/src/Appwrite/Platform/Modules/Health/Http/Health/Storage/Get.php b/src/Appwrite/Platform/Modules/Health/Http/Health/Storage/Get.php new file mode 100644 index 0000000000..52468cab5a --- /dev/null +++ b/src/Appwrite/Platform/Modules/Health/Http/Health/Storage/Get.php @@ -0,0 +1,97 @@ +setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/health/storage') + ->desc('Get storage') + ->groups(['api', 'health']) + ->label('scope', 'health.read') + ->label('sdk', new Method( + namespace: 'health', + group: 'storage', + name: 'getStorage', + description: '/docs/references/health/get-storage.md', + auth: [AuthType::ADMIN, AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_HEALTH_STATUS, + ) + ], + contentType: ContentType::JSON + )) + ->inject('response') + ->inject('deviceForFiles') + ->inject('deviceForFunctions') + ->inject('deviceForSites') + ->inject('deviceForBuilds') + ->callback($this->action(...)); + } + + public function action(Response $response, Device $deviceForFiles, Device $deviceForFunctions, Device $deviceForSites, Device $deviceForBuilds): void + { + $devices = [$deviceForFiles, $deviceForFunctions, $deviceForSites, $deviceForBuilds]; + $checkStart = \microtime(true); + + foreach ($devices as $device) { + $uniqueFileName = \uniqid('health', true); + $filePath = $device->getPath($uniqueFileName); + + if (!$device->write($filePath, 'test', 'text/plain')) { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed writing test file to ' . $device->getRoot()); + } + + $readError = null; + try { + if ($device->read($filePath) !== 'test') { + $readError = new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed reading test file from ' . $device->getRoot()); + } + } catch (\Throwable $e) { + $readError = $e; + } finally { + // Always attempt to clean up test file + if (!$device->delete($filePath)) { + if ($readError !== null) { + // If read already failed, wrap delete error but preserve original + \error_log('Failed deleting test file from ' . $device->getRoot() . ' during read error recovery'); + } else { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed deleting test file from ' . $device->getRoot()); + } + } + // Re-throw read error if it occurred + if ($readError !== null) { + throw $readError; + } + } + } + + $response->dynamic(new Document([ + 'status' => 'pass', + 'ping' => \round((\microtime(true) - $checkStart) * 1000), + ]), Response::MODEL_HEALTH_STATUS); + } +} diff --git a/src/Appwrite/Platform/Modules/Health/Http/Health/Storage/Local/Get.php b/src/Appwrite/Platform/Modules/Health/Http/Health/Storage/Local/Get.php new file mode 100644 index 0000000000..9e24d9f8ff --- /dev/null +++ b/src/Appwrite/Platform/Modules/Health/Http/Health/Storage/Local/Get.php @@ -0,0 +1,79 @@ +setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/health/storage/local') + ->desc('Get local storage') + ->groups(['api', 'health']) + ->label('scope', 'health.read') + ->label('sdk', new Method( + namespace: 'health', + group: 'storage', + name: 'getStorageLocal', + description: '/docs/references/health/get-storage-local.md', + auth: [AuthType::ADMIN, AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_HEALTH_STATUS, + ) + ], + contentType: ContentType::JSON + )) + ->inject('response') + ->callback($this->action(...)); + } + + public function action(Response $response): void + { + $checkStart = \microtime(true); + + foreach ( + [ + 'Uploads' => APP_STORAGE_UPLOADS, + 'Cache' => APP_STORAGE_CACHE, + 'Config' => APP_STORAGE_CONFIG, + 'Certs' => APP_STORAGE_CERTIFICATES, + ] as $key => $volume + ) { + $device = new Local($volume); + + if (!\is_readable($device->getRoot())) { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Device ' . $key . ' dir is not readable'); + } + + if (!\is_writable($device->getRoot())) { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Device ' . $key . ' dir is not writable'); + } + } + + $response->dynamic(new Document([ + 'status' => 'pass', + 'ping' => \round((\microtime(true) - $checkStart) * 1000), + ]), Response::MODEL_HEALTH_STATUS); + } +} diff --git a/src/Appwrite/Platform/Modules/Health/Http/Health/Time/Get.php b/src/Appwrite/Platform/Modules/Health/Http/Health/Time/Get.php new file mode 100644 index 0000000000..b79553321f --- /dev/null +++ b/src/Appwrite/Platform/Modules/Health/Http/Health/Time/Get.php @@ -0,0 +1,107 @@ +setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/health/time') + ->desc('Get time') + ->groups(['api', 'health']) + ->label('scope', 'health.read') + ->label('sdk', new Method( + namespace: 'health', + group: 'health', + name: 'getTime', + description: '/docs/references/health/get-time.md', + auth: [AuthType::ADMIN, AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_HEALTH_TIME, + ) + ], + contentType: ContentType::JSON + )) + ->inject('response') + ->callback($this->action(...)); + } + + public function action(Response $response): void + { + $host = 'time.google.com'; + $gap = 60; + + $sock = \socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); + + if ($sock === false) { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to create socket: ' . \socket_strerror(\socket_last_error())); + } + + try { + if (!\socket_connect($sock, $host, 123)) { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to connect to time server: ' . \socket_strerror(\socket_last_error($sock))); + } + + // Set receive timeout to prevent hanging + if (!\socket_set_option($sock, SOL_SOCKET, SO_RCVTIMEO, ['sec' => 5, 'usec' => 0])) { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to set socket timeout: ' . \socket_strerror(\socket_last_error($sock))); + } + + $msg = "\010" . \str_repeat("\0", 47); + + $sent = \socket_send($sock, $msg, \strlen($msg), 0); + if ($sent === false) { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to send NTP request: ' . \socket_strerror(\socket_last_error($sock))); + } + + $recv = false; + if (!\socket_recv($sock, $recv, 48, MSG_WAITALL)) { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to receive NTP response: ' . \socket_strerror(\socket_last_error($sock))); + } + + if ($recv === false || \strlen($recv) !== 48) { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Invalid NTP response: received ' . (\is_string($recv) ? \strlen($recv) : 'no') . ' bytes instead of 48'); + } + + $data = \unpack('N12', $recv); + $timestamp = \sprintf('%u', $data[9]); + + $timestamp -= 2208988800; + + $diff = ($timestamp - \time()); + + if ($diff > $gap || $diff < ($gap * -1)) { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Server time gaps detected'); + } + + $response->dynamic(new Document([ + 'remoteTime' => $timestamp, + 'localTime' => \time(), + 'diff' => $diff, + ]), Response::MODEL_HEALTH_TIME); + } finally { + \socket_close($sock); + } + } +} diff --git a/src/Appwrite/Platform/Modules/Health/Http/Health/Version/Get.php b/src/Appwrite/Platform/Modules/Health/Http/Health/Version/Get.php new file mode 100644 index 0000000000..302a953971 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Health/Http/Health/Version/Get.php @@ -0,0 +1,35 @@ +setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/health/version') + ->desc('Get version') + ->groups(['api', 'health']) + ->label('scope', 'public') + ->inject('response') + ->callback($this->action(...)); + } + + public function action(Response $response): void + { + $response->dynamic(new Document(['version' => APP_VERSION_STABLE]), Response::MODEL_HEALTH_VERSION); + } +} diff --git a/src/Appwrite/Platform/Modules/Health/Module.php b/src/Appwrite/Platform/Modules/Health/Module.php new file mode 100644 index 0000000000..7aaee2ddca --- /dev/null +++ b/src/Appwrite/Platform/Modules/Health/Module.php @@ -0,0 +1,14 @@ +addService('http', new Http()); + } +} diff --git a/src/Appwrite/Platform/Modules/Health/Services/Http.php b/src/Appwrite/Platform/Modules/Health/Services/Http.php new file mode 100644 index 0000000000..54c6f9ad6d --- /dev/null +++ b/src/Appwrite/Platform/Modules/Health/Services/Http.php @@ -0,0 +1,66 @@ +type = Service::TYPE_HTTP; + + $this->addAction(GetHealth::getName(), new GetHealth()); + $this->addAction(GetHealthVersion::getName(), new GetHealthVersion()); + $this->addAction(GetDB::getName(), new GetDB()); + $this->addAction(GetCache::getName(), new GetCache()); + $this->addAction(GetPubSub::getName(), new GetPubSub()); + $this->addAction(GetTime::getName(), new GetTime()); + $this->addAction(GetCertificate::getName(), new GetCertificate()); + $this->addAction(GetStorageLocal::getName(), new GetStorageLocal()); + $this->addAction(GetStorage::getName(), new GetStorage()); + $this->addAction(GetAntivirus::getName(), new GetAntivirus()); + + $this->addAction(GetQueueAudits::getName(), new GetQueueAudits()); + $this->addAction(GetQueueWebhooks::getName(), new GetQueueWebhooks()); + $this->addAction(GetQueueLogs::getName(), new GetQueueLogs()); + $this->addAction(GetQueueCertificates::getName(), new GetQueueCertificates()); + $this->addAction(GetQueueBuilds::getName(), new GetQueueBuilds()); + $this->addAction(GetQueueDatabases::getName(), new GetQueueDatabases()); + $this->addAction(GetQueueDeletes::getName(), new GetQueueDeletes()); + $this->addAction(GetQueueMails::getName(), new GetQueueMails()); + $this->addAction(GetQueueMessaging::getName(), new GetQueueMessaging()); + $this->addAction(GetQueueMigrations::getName(), new GetQueueMigrations()); + $this->addAction(GetQueueFunctions::getName(), new GetQueueFunctions()); + $this->addAction(GetQueueStatsResources::getName(), new GetQueueStatsResources()); + $this->addAction(GetQueueUsage::getName(), new GetQueueUsage()); + $this->addAction(GetFailedJobs::getName(), new GetFailedJobs()); + + $this->addAction(GetStats::getName(), new GetStats()); + } +} diff --git a/src/Appwrite/Platform/Modules/Projects/Http/Projects/Labels/Update.php b/src/Appwrite/Platform/Modules/Projects/Http/Projects/Labels/Update.php new file mode 100644 index 0000000000..1a06c1ee84 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Projects/Http/Projects/Labels/Update.php @@ -0,0 +1,86 @@ +setHttpMethod(Action::HTTP_REQUEST_METHOD_PUT) + ->setHttpPath('/v1/projects/:projectId/labels') + ->desc('Update project labels') + ->groups(['api', 'projects']) + ->label('scope', 'projects.write') + ->label('sdk', new Method( + namespace: 'projects', + group: 'projects', + name: 'updateLabels', + description: <<param('projectId', '', new UID(), 'Project unique ID.') + ->param('labels', [], new ArrayList(new Text(36, allowList: [...Text::NUMBERS, ...Text::ALPHABET_UPPER, ...Text::ALPHABET_LOWER]), APP_LIMIT_ARRAY_LABELS_SIZE), 'Array of project labels. Replaces the previous labels. Maximum of ' . APP_LIMIT_ARRAY_LABELS_SIZE . ' labels are allowed, each up to 36 alphanumeric characters long.') + ->inject('response') + ->inject('dbForPlatform') + ->callback($this->action(...)); + } + + /** + * @param array $labels + */ + public function action( + string $projectId, + array $labels, + Response $response, + Database $dbForPlatform + ): void { + $project = $dbForPlatform->getDocument('projects', $projectId); + + if ($project->isEmpty()) { + throw new Exception(Exception::PROJECT_NOT_FOUND); + } + + $project->setAttribute('labels', (array) \array_values(\array_unique($labels))); + + $project = $dbForPlatform->updateDocument('projects', $project->getId(), $project); + + $response->dynamic($project, Response::MODEL_PROJECT); + } +} diff --git a/src/Appwrite/Platform/Modules/Projects/Http/Projects/XList.php b/src/Appwrite/Platform/Modules/Projects/Http/Projects/XList.php index 692b467282..7269582a15 100644 --- a/src/Appwrite/Platform/Modules/Projects/Http/Projects/XList.php +++ b/src/Appwrite/Platform/Modules/Projects/Http/Projects/XList.php @@ -3,19 +3,22 @@ namespace Appwrite\Platform\Modules\Projects\Http\Projects; use Appwrite\Extend\Exception; +use Appwrite\Platform\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\ContentType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Database\Validator\Queries\Projects; +use Appwrite\Utopia\Request; use Appwrite\Utopia\Response; +use Appwrite\Utopia\Response\Filters\ListSelection; +use Utopia\Config\Config; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Exception\Order; use Utopia\Database\Exception\Query as QueryException; use Utopia\Database\Query; use Utopia\Database\Validator\Query\Cursor; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\Validator; use Utopia\Validator\Boolean; @@ -24,6 +27,10 @@ use Utopia\Validator\Text; class XList extends Action { use HTTP; + + // cached mapping of columns to their subQuery filters + private static ?array $attributeToSubQueryFilters = null; + public static function getName() { return 'listProjects'; @@ -61,12 +68,13 @@ class XList extends Action ->param('queries', [], $this->getQueriesValidator(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long. You may filter on the following attributes: ' . implode(', ', Projects::ALLOWED_ATTRIBUTES), true) ->param('search', '', new Text(256), 'Search term to filter your list results. Max length: 256 chars.', true) ->param('total', true, new Boolean(true), 'When set to false, the total count returned will be 0 and will not be calculated.', true) + ->inject('request') ->inject('response') ->inject('dbForPlatform') ->callback($this->action(...)); } - public function action(array $queries, string $search, bool $includeTotal, Response $response, Database $dbForPlatform) + public function action(array $queries, string $search, bool $includeTotal, Request $request, Response $response, Database $dbForPlatform) { try { $queries = Query::parseQueries($queries); @@ -103,16 +111,90 @@ class XList extends Action $cursor->setValue($cursorDocument); } - $filterQueries = Query::groupByType($queries)['filters']; try { - $projects = $dbForPlatform->find('projects', $queries); + $selectQueries = Query::groupByType($queries)['selections'] ?? []; + $filterQueries = Query::groupByType($queries)['filters']; + + $projects = $this->find($dbForPlatform, $queries, $selectQueries); $total = $includeTotal ? $dbForPlatform->count('projects', $filterQueries, APP_LIMIT_COUNT) : 0; } catch (Order $e) { throw new Exception(Exception::DATABASE_QUERY_ORDER_NULL, "The order attribute '{$e->getAttribute()}' had a null value. Cursor pagination requires all documents order attribute values are non-null."); } + + $response->addFilter(new ListSelection($selectQueries, 'projects')); + $response->dynamic(new Document([ 'projects' => $projects, 'total' => $total, ]), Response::MODEL_PROJECT_LIST); } + + // Build mapping of columns to their subQuery filters + private static function getAttributeToSubQueryFilters(): array + { + if (self::$attributeToSubQueryFilters !== null) { + return self::$attributeToSubQueryFilters; + } + + self::$attributeToSubQueryFilters = []; + + $collections = Config::getParam('collections', []); + $projectAttributes = $collections['platform']['projects']['attributes'] ?? []; + + foreach ($projectAttributes as $attribute) { + $attributeId = $attribute['$id'] ?? null; + $filters = $attribute['filters'] ?? []; + + if ($attributeId === null || empty($filters)) { + continue; + } + + // extract only subQuery filters + $subQueryFilters = \array_filter($filters, function ($filter) { + return \str_starts_with($filter, 'subQuery'); + }); + + if (!empty($subQueryFilters)) { + self::$attributeToSubQueryFilters[$attributeId] = \array_values($subQueryFilters); + } + } + + return self::$attributeToSubQueryFilters; + } + + private function find(Database $dbForPlatform, array $queries, array $selectQueries): array + { + if (empty($selectQueries)) { + return $dbForPlatform->find('projects', $queries); + } + + $selectedAttributes = []; + foreach ($selectQueries as $query) { + foreach ($query->getValues() as $value) { + $selectedAttributes[] = $value; + } + } + + if (\in_array('*', $selectedAttributes)) { + return $dbForPlatform->find('projects', $queries); + } + + $filtersToSkipMap = []; + $selectedAttributesMap = \array_flip($selectedAttributes); + $attributeToSubQueryFilters = self::getAttributeToSubQueryFilters(); + + foreach ($attributeToSubQueryFilters as $attributeName => $subQueryFilters) { + if (!isset($selectedAttributesMap[$attributeName])) { + foreach ($subQueryFilters as $filter) { + $filtersToSkipMap[$filter] = true; + } + } + } + + $filtersToSkip = \array_keys($filtersToSkipMap); + + return empty($filtersToSkip) + ? $dbForPlatform->find('projects', $queries) + : $dbForPlatform->skipFilters(fn () => $dbForPlatform->find('projects', $queries), $filtersToSkip); + } } diff --git a/src/Appwrite/Platform/Modules/Projects/Services/Http.php b/src/Appwrite/Platform/Modules/Projects/Services/Http.php index 2a0dd0aa60..cce05a9570 100644 --- a/src/Appwrite/Platform/Modules/Projects/Services/Http.php +++ b/src/Appwrite/Platform/Modules/Projects/Services/Http.php @@ -7,6 +7,7 @@ use Appwrite\Platform\Modules\Projects\Http\DevKeys\Delete as DeleteDevKey; use Appwrite\Platform\Modules\Projects\Http\DevKeys\Get as GetDevKey; use Appwrite\Platform\Modules\Projects\Http\DevKeys\Update as UpdateDevKey; use Appwrite\Platform\Modules\Projects\Http\DevKeys\XList as ListDevKeys; +use Appwrite\Platform\Modules\Projects\Http\Projects\Labels\Update as UpdateProjectLabels; use Appwrite\Platform\Modules\Projects\Http\Projects\XList as ListProjects; use Utopia\Platform\Service; @@ -22,5 +23,6 @@ class Http extends Service $this->addAction(DeleteDevKey::getName(), new DeleteDevKey()); $this->addAction(ListProjects::getName(), new ListProjects()); + $this->addAction(UpdateProjectLabels::getName(), new UpdateProjectLabels()); } } diff --git a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Action.php b/src/Appwrite/Platform/Modules/Proxy/Action.php similarity index 99% rename from src/Appwrite/Platform/Modules/Proxy/Http/Rules/Action.php rename to src/Appwrite/Platform/Modules/Proxy/Action.php index 5ec5b8b8f5..c3fa535a5c 100644 --- a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Action.php +++ b/src/Appwrite/Platform/Modules/Proxy/Action.php @@ -1,6 +1,6 @@ $rule->getAttribute('domain'), 'domainType' => $rule->getAttribute('deploymentResourceType', $rule->getAttribute('type')), ])) + ->setAction(Certificate::ACTION_GENERATION) ->trigger(); } diff --git a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Function/Create.php b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Function/Create.php index 13ee6b9cb5..ea0fb69050 100644 --- a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Function/Create.php +++ b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Function/Create.php @@ -5,7 +5,7 @@ namespace Appwrite\Platform\Modules\Proxy\Http\Rules\Function; use Appwrite\Event\Certificate; use Appwrite\Event\Event; use Appwrite\Extend\Exception; -use Appwrite\Platform\Modules\Proxy\Http\Rules\Action; +use Appwrite\Platform\Modules\Proxy\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; @@ -143,6 +143,7 @@ class Create extends Action 'domain' => $rule->getAttribute('domain'), 'domainType' => $rule->getAttribute('deploymentResourceType', $rule->getAttribute('type')), ])) + ->setAction(Certificate::ACTION_GENERATION) ->trigger(); } diff --git a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Get.php b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Get.php index 4581cb3d08..4c17fdc460 100644 --- a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Get.php +++ b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Get.php @@ -3,6 +3,7 @@ namespace Appwrite\Platform\Modules\Proxy\Http\Rules; use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Proxy\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; diff --git a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Redirect/Create.php b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Redirect/Create.php index 7ddd501d51..f21374b49a 100644 --- a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Redirect/Create.php +++ b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Redirect/Create.php @@ -5,7 +5,7 @@ namespace Appwrite\Platform\Modules\Proxy\Http\Rules\Redirect; use Appwrite\Event\Certificate; use Appwrite\Event\Event; use Appwrite\Extend\Exception; -use Appwrite\Platform\Modules\Proxy\Http\Rules\Action; +use Appwrite\Platform\Modules\Proxy\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; @@ -147,6 +147,7 @@ class Create extends Action 'domain' => $rule->getAttribute('domain'), 'domainType' => $rule->getAttribute('deploymentResourceType', $rule->getAttribute('type')), ])) + ->setAction(Certificate::ACTION_GENERATION) ->trigger(); } diff --git a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Site/Create.php b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Site/Create.php index 7aff9e7e8a..26bd453eb3 100644 --- a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Site/Create.php +++ b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Site/Create.php @@ -5,7 +5,7 @@ namespace Appwrite\Platform\Modules\Proxy\Http\Rules\Site; use Appwrite\Event\Certificate; use Appwrite\Event\Event; use Appwrite\Extend\Exception; -use Appwrite\Platform\Modules\Proxy\Http\Rules\Action; +use Appwrite\Platform\Modules\Proxy\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; @@ -143,6 +143,7 @@ class Create extends Action 'domain' => $rule->getAttribute('domain'), 'domainType' => $rule->getAttribute('deploymentResourceType', $rule->getAttribute('type')), ])) + ->setAction(Certificate::ACTION_GENERATION) ->trigger(); } diff --git a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Verification/Update.php b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Verification/Update.php index e09c4a6eba..7266e8d183 100644 --- a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Verification/Update.php +++ b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Verification/Update.php @@ -5,7 +5,7 @@ namespace Appwrite\Platform\Modules\Proxy\Http\Rules\Verification; use Appwrite\Event\Certificate; use Appwrite\Event\Event; use Appwrite\Extend\Exception; -use Appwrite\Platform\Modules\Proxy\Http\Rules\Action; +use Appwrite\Platform\Modules\Proxy\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; diff --git a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/XList.php b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/XList.php index 198bf55a6f..e160b71060 100644 --- a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/XList.php +++ b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/XList.php @@ -3,6 +3,7 @@ namespace Appwrite\Platform\Modules\Proxy\Http\Rules; use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Proxy\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php index 3de0322d6e..e752e97494 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php @@ -253,6 +253,7 @@ class Create extends Action 'resourceId' => $site->getId(), 'resourceType' => 'sites', 'buildCommands' => \implode(' && ', $commands), + 'startCommand' => $site->getAttribute('startCommand', ''), 'buildOutput' => $outputDirectory, 'adapter' => $site->getAttribute('adapter', ''), 'fallbackFile' => $site->getAttribute('fallbackFile', ''), @@ -320,6 +321,7 @@ class Create extends Action 'resourceId' => $site->getId(), 'resourceType' => 'sites', 'buildCommands' => \implode(' && ', $commands), + 'startCommand' => $site->getAttribute('startCommand', ''), 'buildOutput' => $outputDirectory, 'adapter' => $site->getAttribute('adapter', ''), 'fallbackFile' => $site->getAttribute('fallbackFile', ''), diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Duplicate/Create.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Duplicate/Create.php index 9554e2aa14..5656eb09ab 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Duplicate/Create.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Duplicate/Create.php @@ -119,6 +119,7 @@ class Create extends Action 'sourcePath' => $destination, 'totalSize' => $deployment->getAttribute('sourceSize', 0), 'buildCommands' => \implode(' && ', $commands), + 'startCommand' => $site->getAttribute('startCommand', ''), 'buildOutput' => $site->getAttribute('outputDirectory', ''), 'adapter' => $site->getAttribute('adapter', ''), 'fallbackFile' => $site->getAttribute('fallbackFile', ''), diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Template/Create.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Template/Create.php index 30d5e779c1..aa78061057 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Template/Create.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Template/Create.php @@ -166,6 +166,7 @@ class Create extends Base 'resourceInternalId' => $site->getSequence(), 'resourceType' => 'sites', 'buildCommands' => \implode(' && ', $commands), + 'startCommand' => $site->getAttribute('startCommand', ''), 'buildOutput' => $site->getAttribute('outputDirectory', ''), 'providerRepositoryName' => $repository, 'providerRepositoryOwner' => $owner, diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/XList.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/XList.php index b7f9386f06..73e5ea4d77 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/XList.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/XList.php @@ -10,6 +10,7 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Database\Validator\Queries\Deployments; use Appwrite\Utopia\Request; use Appwrite\Utopia\Response; +use Appwrite\Utopia\Response\Filters\ListSelection; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Exception\Order as OrderException; @@ -119,7 +120,9 @@ class XList extends Base $cursor->setValue($cursorDocument); } - $filterQueries = Query::groupByType($queries)['filters']; + $grouped = Query::groupByType($queries); + $filterQueries = $grouped['filters']; + $selectQueries = $grouped['selections'] ?? []; try { $results = $dbForProject->find('deployments', $queries); @@ -128,7 +131,8 @@ class XList extends Base throw new Exception(Exception::DATABASE_QUERY_ORDER_NULL, "The order attribute '{$e->getAttribute()}' had a null value. Cursor pagination requires all documents order attribute values are non-null."); } - $this->applySelectQueries($request, $response, Response::MODEL_DEPLOYMENT); + $response->addFilter(new ListSelection($selectQueries, 'deployments')); + $response->dynamic(new Document([ 'deployments' => $results, 'total' => $total, diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Create.php b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Create.php index 76a11ff736..b48cfeb73f 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Create.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Create.php @@ -150,6 +150,8 @@ class Create extends Base 'timeout' => $timeout, 'installCommand' => $installCommand, 'buildCommand' => $buildCommand, + 'deploymentRetention' => 0, + 'startCommand' => '', 'outputDirectory' => $outputDirectory, 'search' => implode(' ', [$siteId, $name, $framework]), 'fallbackFile' => $fallbackFile, @@ -162,6 +164,8 @@ class Create extends Base 'providerRootDirectory' => $providerRootDirectory, 'providerSilentMode' => $providerSilentMode, 'specification' => $specification, + 'buildSpecification' => $specification, + 'runtimeSpecification' => $specification, 'buildRuntime' => $buildRuntime, 'adapter' => $adapter, ])); diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php index 8c48aff586..b4b720537d 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php @@ -254,6 +254,8 @@ class Update extends Base 'timeout' => $timeout, 'installCommand' => $installCommand, 'buildCommand' => $buildCommand, + 'deploymentRetention' => 0, + 'startCommand' => '', 'outputDirectory' => $outputDirectory, 'installationId' => $installation->getId(), 'installationInternalId' => $installation->getSequence(), @@ -264,6 +266,8 @@ class Update extends Base 'providerRootDirectory' => $providerRootDirectory, 'providerSilentMode' => $providerSilentMode, 'specification' => $specification, + 'buildSpecification' => $specification, + 'runtimeSpecification' => $specification, 'search' => implode(' ', [$siteId, $name, $framework]), 'buildRuntime' => $buildRuntime, 'adapter' => $adapter, diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Create.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Create.php new file mode 100644 index 0000000000..c78402e5a4 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Create.php @@ -0,0 +1,166 @@ +setHttpMethod(Action::HTTP_REQUEST_METHOD_POST) + ->setHttpPath('/v1/storage/buckets') + ->desc('Create bucket') + ->groups(['api', 'storage']) + ->label('scope', 'buckets.write') + ->label('resourceType', RESOURCE_TYPE_BUCKETS) + ->label('event', 'buckets.[bucketId].create') + ->label('audits.event', 'bucket.create') + ->label('audits.resource', 'bucket/{response.$id}') + ->label('sdk', new Method( + namespace: 'storage', + group: 'buckets', + name: 'createBucket', + description: '/docs/references/storage/create-bucket.md', + auth: [AuthType::ADMIN, AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_CREATED, + model: Response::MODEL_BUCKET, + ) + ] + )) + ->param('bucketId', '', new CustomId(), '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.') + ->param('name', '', new Text(128), 'Bucket name') + ->param('permissions', null, new Nullable(new \Utopia\Database\Validator\Permissions(APP_LIMIT_ARRAY_PARAMS_SIZE)), 'An array of permission strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).', true) + ->param('fileSecurity', false, new Boolean(true), '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).', true) + ->param('enabled', true, new Boolean(true), '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.', true) + ->param('maximumFileSize', fn (array $plan) => empty($plan['fileSize']) ? (int) System::getEnv('_APP_STORAGE_LIMIT', 0) : $plan['fileSize'] * 1000 * 1000, fn (array $plan) => new Range(1, empty($plan['fileSize']) ? (int) System::getEnv('_APP_STORAGE_LIMIT', 0) : $plan['fileSize'] * 1000 * 1000), 'Maximum file size allowed in bytes. Maximum allowed value is ' . Storage::human(System::getEnv('_APP_STORAGE_LIMIT', 0), 0) . '.', true, ['plan']) + ->param('allowedFileExtensions', [], new ArrayList(new Text(64), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Allowed file extensions. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' extensions are allowed, each 64 characters long.', true) + ->param('compression', Compression::NONE, new WhiteList([Compression::NONE, Compression::GZIP, Compression::ZSTD], true), 'Compression algorithm chosen for compression. Can be one of ' . Compression::NONE . ', [' . Compression::GZIP . '](https://en.wikipedia.org/wiki/Gzip), or [' . Compression::ZSTD . '](https://en.wikipedia.org/wiki/Zstd), For file size above ' . Storage::human(APP_STORAGE_READ_BUFFER, 0) . ' compression is skipped even if it\'s enabled', true) + ->param('encryption', true, new Boolean(true), 'Is encryption enabled? For file size above ' . Storage::human(APP_STORAGE_READ_BUFFER, 0) . ' encryption is skipped even if it\'s enabled', true) + ->param('antivirus', true, new Boolean(true), 'Is virus scanning enabled? For file size above ' . Storage::human(APP_LIMIT_ANTIVIRUS, 0) . ' AntiVirus scanning is skipped even if it\'s enabled', true) + ->param('transformations', true, new Boolean(true), 'Are image transformations enabled?', true) + ->inject('response') + ->inject('dbForProject') + ->inject('queueForEvents') + ->callback($this->action(...)); + } + + public function action( + string $bucketId, + string $name, + ?array $permissions, + bool $fileSecurity, + bool $enabled, + int $maximumFileSize, + array $allowedFileExtensions, + ?string $compression, + ?bool $encryption, + bool $antivirus, + bool $transformations, + Response $response, + Database $dbForProject, + Event $queueForEvents + ) { + $bucketId = $bucketId === 'unique()' ? ID::unique() : $bucketId; + + // Map aggregate permissions into the multiple permissions they represent. + $permissions = Permission::aggregate($permissions) ?? []; + $compression ??= Compression::NONE; + $encryption ??= true; + try { + $files = (Config::getParam('collections', [])['buckets'] ?? [])['files'] ?? []; + if (empty($files)) { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Files collection is not configured.'); + } + + $attributes = []; + $indexes = []; + + foreach ($files['attributes'] as $attribute) { + $attributes[] = new Document([ + '$id' => $attribute['$id'], + 'type' => $attribute['type'], + 'size' => $attribute['size'], + 'required' => $attribute['required'], + 'signed' => $attribute['signed'], + 'array' => $attribute['array'], + 'filters' => $attribute['filters'], + 'default' => $attribute['default'] ?? null, + 'format' => $attribute['format'] ?? '' + ]); + } + + foreach ($files['indexes'] as $index) { + $indexes[] = new Document([ + '$id' => $index['$id'], + 'type' => $index['type'], + 'attributes' => $index['attributes'], + 'lengths' => $index['lengths'], + 'orders' => $index['orders'], + ]); + } + + $dbForProject->createDocument('buckets', new Document([ + '$id' => $bucketId, + '$collection' => 'buckets', + '$permissions' => $permissions, + 'name' => $name, + 'maximumFileSize' => $maximumFileSize, + 'allowedFileExtensions' => $allowedFileExtensions, + 'fileSecurity' => $fileSecurity, + 'enabled' => $enabled, + 'compression' => $compression, + 'encryption' => $encryption, + 'antivirus' => $antivirus, + 'transformations' => $transformations, + 'search' => implode(' ', [$bucketId, $name]), + ])); + + $bucket = $dbForProject->getDocument('buckets', $bucketId); + + $dbForProject->createCollection('bucket_' . $bucket->getSequence(), $attributes, $indexes, permissions: $permissions, documentSecurity: $fileSecurity); + } catch (DuplicateException) { + throw new Exception(Exception::STORAGE_BUCKET_ALREADY_EXISTS); + } + + $queueForEvents + ->setParam('bucketId', $bucket->getId()); + + $response + ->setStatusCode(Response::STATUS_CODE_CREATED) + ->dynamic($bucket, Response::MODEL_BUCKET); + } +} diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Delete.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Delete.php new file mode 100644 index 0000000000..9523f55e12 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Delete.php @@ -0,0 +1,89 @@ +setHttpMethod(Action::HTTP_REQUEST_METHOD_DELETE) + ->setHttpPath('/v1/storage/buckets/:bucketId') + ->desc('Delete bucket') + ->groups(['api', 'storage']) + ->label('scope', 'buckets.write') + ->label('resourceType', RESOURCE_TYPE_BUCKETS) + ->label('audits.event', 'bucket.delete') + ->label('event', 'buckets.[bucketId].delete') + ->label('audits.resource', 'bucket/{request.bucketId}') + ->label('sdk', new Method( + namespace: 'storage', + group: 'buckets', + name: 'deleteBucket', + description: '/docs/references/storage/delete-bucket.md', + auth: [AuthType::ADMIN, AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_NOCONTENT, + model: Response::MODEL_NONE, + ) + ], + contentType: ContentType::NONE + )) + ->param('bucketId', '', new UID(), 'Bucket unique ID.') + ->inject('response') + ->inject('dbForProject') + ->inject('queueForDeletes') + ->inject('queueForEvents') + ->callback($this->action(...)); + } + + public function action( + string $bucketId, + Response $response, + Database $dbForProject, + DeleteEvent $queueForDeletes, + Event $queueForEvents + ) { + $bucket = $dbForProject->getDocument('buckets', $bucketId); + + if ($bucket->isEmpty()) { + throw new Exception(Exception::STORAGE_BUCKET_NOT_FOUND); + } + + if (!$dbForProject->deleteDocument('buckets', $bucketId)) { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to remove bucket from DB'); + } + + $queueForDeletes + ->setType(DELETE_TYPE_DOCUMENT) + ->setDocument($bucket); + + $queueForEvents + ->setParam('bucketId', $bucket->getId()) + ->setPayload($response->output($bucket, Response::MODEL_BUCKET)) + ; + + $response->noContent(); + } +} diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Create.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Create.php new file mode 100644 index 0000000000..4757461a98 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Create.php @@ -0,0 +1,467 @@ +setHttpMethod(Action::HTTP_REQUEST_METHOD_POST) + ->setHttpPath('/v1/storage/buckets/:bucketId/files') + ->desc('Create file') + ->groups(['api', 'storage']) + ->label('scope', 'files.write') + ->label('resourceType', RESOURCE_TYPE_BUCKETS) + ->label('audits.event', 'file.create') + ->label('event', 'buckets.[bucketId].files.[fileId].create') + ->label('audits.resource', 'file/{response.$id}') + ->label('abuse-key', 'ip:{ip},method:{method},url:{url},userId:{userId},chunkId:{chunkId}') + ->label('abuse-limit', APP_LIMIT_WRITE_RATE_DEFAULT) + ->label('abuse-time', APP_LIMIT_WRITE_RATE_PERIOD_DEFAULT) + ->label('sdk', new Method( + namespace: 'storage', + group: 'files', + name: 'createFile', + description: '/docs/references/storage/create-file.md', + auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_CREATED, + model: Response::MODEL_FILE, + ) + ], + type: MethodType::UPLOAD, + requestType: ContentType::MULTIPART + )) + ->param('bucketId', '', new UID(), 'Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') + ->param('fileId', '', new CustomId(), 'File ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') + ->param('file', [], new File(), 'Binary file. Appwrite SDKs provide helpers to handle file input. [Learn about file input](https://appwrite.io/docs/products/storage/upload-download#input-file).', skipValidation: true) + ->param('permissions', null, new Nullable(new Permissions(APP_LIMIT_ARRAY_PARAMS_SIZE, [Database::PERMISSION_READ, Database::PERMISSION_UPDATE, Database::PERMISSION_DELETE, Database::PERMISSION_WRITE])), 'An array of permission strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).', true) + ->inject('request') + ->inject('response') + ->inject('dbForProject') + ->inject('user') + ->inject('queueForEvents') + ->inject('mode') + ->inject('deviceForFiles') + ->inject('deviceForLocal') + ->inject('authorization') + ->callback($this->action(...)); + } + + public function action( + string $bucketId, + string $fileId, + mixed $file, + ?array $permissions, + Request $request, + Response $response, + Database $dbForProject, + Document $user, + Event $queueForEvents, + string $mode, + Device $deviceForFiles, + Device $deviceForLocal, + Authorization $authorization + ) { + $bucket = $authorization->skip(fn () => $dbForProject->getDocument('buckets', $bucketId)); + + $isAPIKey = User::isApp($authorization->getRoles()); + $isPrivilegedUser = User::isPrivileged($authorization->getRoles()); + + if ($bucket->isEmpty() || (!$bucket->getAttribute('enabled') && !$isAPIKey && !$isPrivilegedUser)) { + throw new Exception(Exception::STORAGE_BUCKET_NOT_FOUND); + } + + if (!$authorization->isValid(new Input(Database::PERMISSION_CREATE, $bucket->getCreate()))) { + throw new Exception(Exception::USER_UNAUTHORIZED, $authorization->getDescription()); + } + + $allowedPermissions = [ + Database::PERMISSION_READ, + Database::PERMISSION_UPDATE, + Database::PERMISSION_DELETE, + ]; + + // Map aggregate permissions to into the set of individual permissions they represent. + $permissions = Permission::aggregate($permissions, $allowedPermissions); + + // Add permissions for current the user if none were provided. + if (\is_null($permissions)) { + $permissions = []; + if (!empty($user->getId()) && !$isPrivilegedUser) { + foreach ($allowedPermissions as $permission) { + $permissions[] = (new Permission($permission, 'user', $user->getId()))->toString(); + } + } + } + + // Users can only manage their own roles, API keys and Admin users can manage any + $roles = $authorization->getRoles(); + if (!$isAPIKey && !$isPrivilegedUser) { + foreach (\Utopia\Database\Database::PERMISSIONS as $type) { + foreach ($permissions as $permission) { + $permission = Permission::parse($permission); + if ($permission->getPermission() != $type) { + continue; + } + $role = (new Role( + $permission->getRole(), + $permission->getIdentifier(), + $permission->getDimension() + ))->toString(); + if (!$authorization->hasRole($role)) { + throw new Exception(Exception::USER_UNAUTHORIZED, 'Permissions must be one of: (' . \implode(', ', $roles) . ')'); + } + } + } + } + + $maximumFileSize = $bucket->getAttribute('maximumFileSize', 0); + if ($maximumFileSize > (int) System::getEnv('_APP_STORAGE_LIMIT', 0)) { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Maximum bucket file size is larger than _APP_STORAGE_LIMIT'); + } + + $file = $request->getFiles('file'); + + // GraphQL multipart spec adds files with index keys + if (empty($file)) { + $file = $request->getFiles(0); + } + + if (empty($file)) { + throw new Exception(Exception::STORAGE_FILE_EMPTY); + } + + // Make sure we handle a single file and multiple files the same way + $fileName = (\is_array($file['name']) && isset($file['name'][0])) ? $file['name'][0] : $file['name']; + $fileTmpName = (\is_array($file['tmp_name']) && isset($file['tmp_name'][0])) ? $file['tmp_name'][0] : $file['tmp_name']; + $fileSize = (\is_array($file['size']) && isset($file['size'][0])) ? $file['size'][0] : $file['size']; + + $contentRange = $request->getHeader('content-range'); + $fileId = $fileId === 'unique()' ? ID::unique() : $fileId; + $chunk = 1; + $chunks = 1; + + if (!empty($contentRange)) { + $start = $request->getContentRangeStart(); + $end = $request->getContentRangeEnd(); + $fileSize = $request->getContentRangeSize(); + $fileId = $request->getHeader('x-appwrite-id', $fileId); + // TODO make `end >= $fileSize` in next breaking version + if (is_null($start) || is_null($end) || is_null($fileSize) || $end > $fileSize) { + throw new Exception(Exception::STORAGE_INVALID_CONTENT_RANGE); + } + + $idValidator = new UID(); + if (!$idValidator->isValid($fileId)) { + throw new Exception(Exception::STORAGE_INVALID_APPWRITE_ID); + } + + // TODO remove the condition that checks `$end === $fileSize` in next breaking version + if ($end === $fileSize - 1 || $end === $fileSize) { + //if it's a last chunks the chunk size might differ, so we set the $chunks and $chunk to -1 notify it's last chunk + $chunks = $chunk = -1; + } else { + // Calculate total number of chunks based on the chunk size i.e ($rangeEnd - $rangeStart) + $chunks = (int) ceil($fileSize / ($end + 1 - $start)); + $chunk = (int) ($start / ($end + 1 - $start)) + 1; + } + } + + /** + * Validators + */ + // Check if file type is allowed + $allowedFileExtensions = $bucket->getAttribute('allowedFileExtensions', []); + $fileExt = new FileExt($allowedFileExtensions); + if (!empty($allowedFileExtensions) && !$fileExt->isValid($fileName)) { + throw new Exception(Exception::STORAGE_FILE_TYPE_UNSUPPORTED, 'File extension not allowed'); + } + + // Check if file size is exceeding allowed limit + $fileSizeValidator = new FileSize($maximumFileSize); + if (!$fileSizeValidator->isValid($fileSize)) { + throw new Exception(Exception::STORAGE_INVALID_FILE_SIZE, 'File size not allowed'); + } + + $upload = new Upload(); + if (!$upload->isValid($fileTmpName)) { + throw new Exception(Exception::STORAGE_INVALID_FILE); + } + + // Save to storage + $fileSize ??= $deviceForLocal->getFileSize($fileTmpName); + $path = $deviceForFiles->getPath($fileId . '.' . \pathinfo($fileName, PATHINFO_EXTENSION)); + $path = str_ireplace($deviceForFiles->getRoot(), $deviceForFiles->getRoot() . DIRECTORY_SEPARATOR . $bucket->getId(), $path); // Add bucket id to path after root + + $file = $dbForProject->getDocument('bucket_' . $bucket->getSequence(), $fileId); + + $metadata = ['content_type' => $deviceForLocal->getFileMimeType($fileTmpName)]; + if (!$file->isEmpty()) { + $chunks = $file->getAttribute('chunksTotal', 1); + $uploaded = $file->getAttribute('chunksUploaded', 0); + $metadata = $file->getAttribute('metadata', []); + + if ($chunk === -1) { + $chunk = $chunks; + } + + if ($uploaded === $chunks) { + throw new Exception(Exception::STORAGE_FILE_ALREADY_EXISTS); + } + } + + $chunksUploaded = $deviceForFiles->upload($fileTmpName, $path, $chunk, $chunks, $metadata); + + if (empty($chunksUploaded)) { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed uploading file'); + } + + if ($chunksUploaded === $chunks) { + if (System::getEnv('_APP_STORAGE_ANTIVIRUS') === 'enabled' && $bucket->getAttribute('antivirus', true) && $fileSize <= APP_LIMIT_ANTIVIRUS && $deviceForFiles->getType() === Storage::DEVICE_LOCAL) { + $antivirus = new Network( + System::getEnv('_APP_STORAGE_ANTIVIRUS_HOST', 'clamav'), + (int) System::getEnv('_APP_STORAGE_ANTIVIRUS_PORT', 3310) + ); + + if (!$antivirus->fileScan($path)) { + $deviceForFiles->delete($path); + throw new Exception(Exception::STORAGE_INVALID_FILE); + } + } + + $mimeType = $deviceForFiles->getFileMimeType($path); // Get mime-type before compression and encryption + $fileHash = $deviceForFiles->getFileHash($path); // Get file hash before compression and encryption + $data = ''; + // Compression + $algorithm = $bucket->getAttribute('compression', Compression::NONE); + if ($fileSize <= APP_STORAGE_READ_BUFFER && $algorithm != Compression::NONE) { + $data = $deviceForFiles->read($path); + switch ($algorithm) { + case Compression::ZSTD: + $compressor = new Zstd(); + break; + case Compression::GZIP: + default: + $compressor = new GZIP(); + break; + } + $data = $compressor->compress($data); + } else { + // reset the algorithm to none as we do not compress the file + // if file size exceedes the APP_STORAGE_READ_BUFFER + // regardless the bucket compression algoorithm + $algorithm = Compression::NONE; + } + + if ($bucket->getAttribute('encryption', true) && $fileSize <= APP_STORAGE_READ_BUFFER) { + if (empty($data)) { + $data = $deviceForFiles->read($path); + } + $key = System::getEnv('_APP_OPENSSL_KEY_V1'); + $iv = OpenSSL::randomPseudoBytes(OpenSSL::cipherIVLength(OpenSSL::CIPHER_AES_128_GCM)); + $data = OpenSSL::encrypt($data, OpenSSL::CIPHER_AES_128_GCM, $key, 0, $iv, $tag); + } + + if (!empty($data)) { + if (!$deviceForFiles->write($path, $data, $mimeType)) { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to save file'); + } + } + + $sizeActual = $deviceForFiles->getFileSize($path); + + $openSSLVersion = null; + $openSSLCipher = null; + $openSSLTag = null; + $openSSLIV = null; + + if ($bucket->getAttribute('encryption', true) && $fileSize <= APP_STORAGE_READ_BUFFER) { + $openSSLVersion = '1'; + $openSSLCipher = OpenSSL::CIPHER_AES_128_GCM; + $openSSLTag = \bin2hex($tag); + $openSSLIV = \bin2hex($iv); + } + + if ($file->isEmpty()) { + $doc = new Document([ + '$id' => $fileId, + '$permissions' => $permissions, + 'bucketId' => $bucket->getId(), + 'bucketInternalId' => $bucket->getSequence(), + 'name' => $fileName, + 'path' => $path, + 'signature' => $fileHash, + 'mimeType' => $mimeType, + 'sizeOriginal' => $fileSize, + 'sizeActual' => $sizeActual, + 'algorithm' => $algorithm, + 'comment' => '', + 'chunksTotal' => $chunks, + 'chunksUploaded' => $chunksUploaded, + 'openSSLVersion' => $openSSLVersion, + 'openSSLCipher' => $openSSLCipher, + 'openSSLTag' => $openSSLTag, + 'openSSLIV' => $openSSLIV, + 'search' => implode(' ', [$fileId, $fileName]), + 'metadata' => $metadata, + ]); + + try { + $file = $dbForProject->createDocument('bucket_' . $bucket->getSequence(), $doc); + } catch (DuplicateException) { + throw new Exception(Exception::STORAGE_FILE_ALREADY_EXISTS); + } catch (NotFoundException) { + throw new Exception(Exception::STORAGE_BUCKET_NOT_FOUND); + } + } else { + $file = $file + ->setAttribute('$permissions', $permissions) + ->setAttribute('signature', $fileHash) + ->setAttribute('mimeType', $mimeType) + ->setAttribute('sizeActual', $sizeActual) + ->setAttribute('algorithm', $algorithm) + ->setAttribute('openSSLVersion', $openSSLVersion) + ->setAttribute('openSSLCipher', $openSSLCipher) + ->setAttribute('openSSLTag', $openSSLTag) + ->setAttribute('openSSLIV', $openSSLIV) + ->setAttribute('metadata', $metadata) + ->setAttribute('chunksUploaded', $chunksUploaded); + + /** + * Validate create permission and skip authorization in updateDocument + * Without this, the file creation will fail when user doesn't have update permission + * However as with chunk upload even if we are updating, we are essentially creating a file + * adding it's new chunk so we validate create permission instead of update + */ + if (!$authorization->isValid(new Input(Database::PERMISSION_CREATE, $bucket->getCreate()))) { + throw new Exception(Exception::USER_UNAUTHORIZED); + } + $file = $authorization->skip(fn () => $dbForProject->updateDocument('bucket_' . $bucket->getSequence(), $fileId, $file)); + } + + // Trigger after create success hook + $this->afterCreateSuccess($file); + } else { + if ($file->isEmpty()) { + $doc = new Document([ + '$id' => ID::custom($fileId), + '$permissions' => $permissions, + 'bucketId' => $bucket->getId(), + 'bucketInternalId' => $bucket->getSequence(), + 'name' => $fileName, + 'path' => $path, + 'signature' => '', + 'mimeType' => '', + 'sizeOriginal' => $fileSize, + 'sizeActual' => 0, + 'algorithm' => '', + 'comment' => '', + 'chunksTotal' => $chunks, + 'chunksUploaded' => $chunksUploaded, + 'search' => implode(' ', [$fileId, $fileName]), + 'metadata' => $metadata, + ]); + + try { + $file = $dbForProject->createDocument('bucket_' . $bucket->getSequence(), $doc); + } catch (DuplicateException) { + throw new Exception(Exception::STORAGE_FILE_ALREADY_EXISTS); + } catch (NotFoundException) { + throw new Exception(Exception::STORAGE_BUCKET_NOT_FOUND); + } + } else { + $file = $file + ->setAttribute('chunksUploaded', $chunksUploaded) + ->setAttribute('metadata', $metadata); + + /** + * Validate create permission and skip authorization in updateDocument + * Without this, the file creation will fail when user doesn't have update permission + * However as with chunk upload even if we are updating, we are essentially creating a file + * adding it's new chunk so we validate create permission instead of update + */ + if (!$authorization->isValid(new Input(Database::PERMISSION_CREATE, $bucket->getCreate()))) { + throw new Exception(Exception::USER_UNAUTHORIZED); + } + + try { + $file = $authorization->skip(fn () => $dbForProject->updateDocument('bucket_' . $bucket->getSequence(), $fileId, $file)); + } catch (NotFoundException) { + throw new Exception(Exception::STORAGE_BUCKET_NOT_FOUND); + } + } + } + + $queueForEvents + ->setParam('bucketId', $bucket->getId()) + ->setParam('fileId', $file->getId()) + ->setContext('bucket', $bucket); + + $metadata = null; // was causing leaks as it was passed by reference + + $response + ->setStatusCode(Response::STATUS_CODE_CREATED) + ->dynamic($file, Response::MODEL_FILE); + } + + /** + * Hook to run after file is created successfully + * + * @param Document $file + * @return void + */ + protected function afterCreateSuccess(Document $file) + { + if (!($file instanceof Document)) { + throw new Exception('file must be an instance of document'); + } + } +} diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Delete.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Delete.php new file mode 100644 index 0000000000..ca376842e2 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Delete.php @@ -0,0 +1,152 @@ +setHttpMethod(Action::HTTP_REQUEST_METHOD_DELETE) + ->setHttpPath('/v1/storage/buckets/:bucketId/files/:fileId') + ->desc('Delete file') + ->groups(['api', 'storage']) + ->label('scope', 'files.write') + ->label('resourceType', RESOURCE_TYPE_BUCKETS) + ->label('event', 'buckets.[bucketId].files.[fileId].delete') + ->label('audits.event', 'file.delete') + ->label('audits.resource', 'file/{request.fileId}') + ->label('abuse-key', 'ip:{ip},method:{method},url:{url},userId:{userId}') + ->label('abuse-limit', APP_LIMIT_WRITE_RATE_DEFAULT) + ->label('abuse-time', APP_LIMIT_WRITE_RATE_PERIOD_DEFAULT) + ->label('sdk', new Method( + namespace: 'storage', + group: 'files', + name: 'deleteFile', + description: '/docs/references/storage/delete-file.md', + auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_NOCONTENT, + model: Response::MODEL_NONE, + ) + ], + contentType: ContentType::NONE + )) + ->param('bucketId', '', new UID(), 'Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') + ->param('fileId', '', new UID(), 'File ID.') + ->inject('response') + ->inject('dbForProject') + ->inject('queueForEvents') + ->inject('deviceForFiles') + ->inject('queueForDeletes') + ->inject('authorization') + ->callback($this->action(...)); + } + + public function action( + string $bucketId, + string $fileId, + Response $response, + Database $dbForProject, + Event $queueForEvents, + Device $deviceForFiles, + DeleteEvent $queueForDeletes, + Authorization $authorization + ) { + $bucket = $authorization->skip(fn () => $dbForProject->getDocument('buckets', $bucketId)); + + $isAPIKey = User::isApp($authorization->getRoles()); + $isPrivilegedUser = User::isPrivileged($authorization->getRoles()); + + if ($bucket->isEmpty() || (!$bucket->getAttribute('enabled') && !$isAPIKey && !$isPrivilegedUser)) { + throw new Exception(Exception::STORAGE_BUCKET_NOT_FOUND); + } + + $fileSecurity = $bucket->getAttribute('fileSecurity', false); + $valid = $authorization->isValid(new Input(Database::PERMISSION_DELETE, $bucket->getDelete())); + if (!$fileSecurity && !$valid) { + throw new Exception(Exception::USER_UNAUTHORIZED, $authorization->getDescription()); + } + + // Read permission should not be required for delete + $file = $authorization->skip(fn () => $dbForProject->getDocument('bucket_' . $bucket->getSequence(), $fileId)); + + if ($file->isEmpty()) { + throw new Exception(Exception::STORAGE_FILE_NOT_FOUND); + } + + // Make sure we don't delete the file before the document permission check occurs + if ($fileSecurity && !$valid && !$authorization->isValid(new Input(Database::PERMISSION_DELETE, $file->getDelete()))) { + throw new Exception(Exception::USER_UNAUTHORIZED, $authorization->getDescription()); + } + + $deviceDeleted = false; + if ($file->getAttribute('chunksTotal') !== $file->getAttribute('chunksUploaded')) { + $deviceDeleted = $deviceForFiles->abort( + $file->getAttribute('path'), + ($file->getAttribute('metadata', [])['uploadId'] ?? '') + ); + } else { + $deviceDeleted = $deviceForFiles->delete($file->getAttribute('path')); + } + + if ($deviceDeleted) { + $queueForDeletes + ->setType(DELETE_TYPE_CACHE_BY_RESOURCE) + ->setResourceType('bucket/' . $bucket->getId()) + ->setResource('file/' . $fileId) + ; + + try { + if ($fileSecurity && !$valid) { + $deleted = $dbForProject->deleteDocument('bucket_' . $bucket->getSequence(), $fileId); + } else { + $deleted = $authorization->skip(fn () => $dbForProject->deleteDocument('bucket_' . $bucket->getSequence(), $fileId)); + } + } catch (NotFoundException) { + throw new Exception(Exception::STORAGE_BUCKET_NOT_FOUND); + } + + if (!$deleted) { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to remove file from DB'); + } + } else { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to delete file from device'); + } + + $queueForEvents + ->setParam('bucketId', $bucket->getId()) + ->setParam('fileId', $file->getId()) + ->setContext('bucket', $bucket) + ->setPayload($response->output($file, Response::MODEL_FILE)) + ; + + $response->noContent(); + } +} diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php new file mode 100644 index 0000000000..bbceff51ec --- /dev/null +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php @@ -0,0 +1,215 @@ +setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/storage/buckets/:bucketId/files/:fileId/download') + ->desc('Get file for download') + ->groups(['api', 'storage']) + ->label('scope', 'files.read') + ->label('resourceType', RESOURCE_TYPE_BUCKETS) + ->label('sdk', new Method( + namespace: 'storage', + group: 'files', + name: 'getFileDownload', + description: '/docs/references/storage/get-file-download.md', + auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_NONE, + ) + ], + contentType: ContentType::ANY, + type: MethodType::LOCATION + )) + ->param('bucketId', '', new UID(), 'Storage bucket ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') + ->param('fileId', '', new UID(), 'File ID.') + // NOTE: this is only for the sdk generator and is not used in the action below and is utilised in `resources.php` for `resourceToken`. + ->param('token', '', new Text(512), 'File token for accessing this file.', true) + ->inject('request') + ->inject('response') + ->inject('dbForProject') + ->inject('mode') + ->inject('resourceToken') + ->inject('deviceForFiles') + ->inject('authorization') + ->callback($this->action(...)); + } + + public function action( + string $bucketId, + string $fileId, + ?string $token, + Request $request, + Response $response, + Database $dbForProject, + string $mode, + Document $resourceToken, + Device $deviceForFiles, + Authorization $authorization, + ) { + /* @type Document $bucket */ + $bucket = $authorization->skip(fn () => $dbForProject->getDocument('buckets', $bucketId)); + + $isAPIKey = User::isApp($authorization->getRoles()); + $isPrivilegedUser = User::isPrivileged($authorization->getRoles()); + + if ($bucket->isEmpty() || (!$bucket->getAttribute('enabled') && !$isAPIKey && !$isPrivilegedUser)) { + throw new Exception(Exception::STORAGE_BUCKET_NOT_FOUND); + } + + $isToken = !$resourceToken->isEmpty() && $resourceToken->getAttribute('bucketInternalId') === $bucket->getSequence(); + $fileSecurity = $bucket->getAttribute('fileSecurity', false); + $valid = $authorization->isValid(new Input(Database::PERMISSION_READ, $bucket->getRead())); + if (!$fileSecurity && !$valid && !$isToken) { + throw new Exception(Exception::USER_UNAUTHORIZED, $authorization->getDescription()); + } + + if ($fileSecurity && !$valid && !$isToken) { + $file = $dbForProject->getDocument('bucket_' . $bucket->getSequence(), $fileId); + } else { + /* @type Document $file */ + $file = $authorization->skip(fn () => $dbForProject->getDocument('bucket_' . $bucket->getSequence(), $fileId)); + } + + if (!$resourceToken->isEmpty() && $resourceToken->getAttribute('fileInternalId') !== $file->getSequence()) { + throw new Exception(Exception::USER_UNAUTHORIZED); + } + + if ($file->isEmpty()) { + throw new Exception(Exception::STORAGE_FILE_NOT_FOUND); + } + + $path = $file->getAttribute('path', ''); + + if (!$deviceForFiles->exists($path)) { + throw new Exception(Exception::STORAGE_FILE_NOT_FOUND, 'File not found in ' . $path); + } + + $size = $file->getAttribute('sizeOriginal', 0); + + $rangeHeader = $request->getHeader('range'); + if (!empty($rangeHeader)) { + $start = $request->getRangeStart(); + $end = $request->getRangeEnd(); + $unit = $request->getRangeUnit(); + + if ($end === null || $end - $start > APP_STORAGE_READ_BUFFER) { + $end = min(($start + MAX_OUTPUT_CHUNK_SIZE - 1), ($size - 1)); + } + + if ($unit !== 'bytes' || $start >= $end || $end >= $size) { + throw new Exception(Exception::STORAGE_INVALID_RANGE); + } + + $response + ->addHeader('Accept-Ranges', 'bytes') + ->addHeader('Content-Range', 'bytes ' . $start . '-' . $end . '/' . $size) + ->addHeader('Content-Length', $end - $start + 1) + ->setStatusCode(Response::STATUS_CODE_PARTIALCONTENT); + } + + $response + ->setContentType($file->getAttribute('mimeType')) + ->addHeader('Cache-Control', 'private, max-age=3888000') // 45 days + ->addHeader('X-Peak', \memory_get_peak_usage()) + ->addHeader('Content-Disposition', 'attachment; filename="' . $file->getAttribute('name', '') . '"') + ; + + $source = ''; + if (!empty($file->getAttribute('openSSLCipher'))) { // Decrypt + $source = $deviceForFiles->read($path); + $source = OpenSSL::decrypt( + $source, + $file->getAttribute('openSSLCipher'), + System::getEnv('_APP_OPENSSL_KEY_V' . $file->getAttribute('openSSLVersion')), + 0, + \hex2bin($file->getAttribute('openSSLIV')), + \hex2bin($file->getAttribute('openSSLTag')) + ); + } + + switch ($file->getAttribute('algorithm', Compression::NONE)) { + case Compression::ZSTD: + if (empty($source)) { + $source = $deviceForFiles->read($path); + } + $compressor = new Zstd(); + $source = $compressor->decompress($source); + break; + case Compression::GZIP: + if (empty($source)) { + $source = $deviceForFiles->read($path); + } + $compressor = new GZIP(); + $source = $compressor->decompress($source); + break; + } + + if (!empty($source)) { + if (!empty($rangeHeader)) { + $response->send(substr($source, $start, ($end - $start + 1))); + return; + } + $response->send($source); + return; + } + + if (!empty($rangeHeader)) { + $response->send($deviceForFiles->read($path, $start, ($end - $start + 1))); + return; + } + + if ($size > APP_STORAGE_READ_BUFFER) { + for ($i = 0; $i < ceil($size / MAX_OUTPUT_CHUNK_SIZE); $i++) { + $response->chunk( + $deviceForFiles->read( + $path, + ($i * MAX_OUTPUT_CHUNK_SIZE), + min(MAX_OUTPUT_CHUNK_SIZE, $size - ($i * MAX_OUTPUT_CHUNK_SIZE)) + ), + (($i + 1) * MAX_OUTPUT_CHUNK_SIZE) >= $size + ); + } + } else { + $response->send($deviceForFiles->read($path)); + } + } +} diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Get.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Get.php new file mode 100644 index 0000000000..caaab29efc --- /dev/null +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Get.php @@ -0,0 +1,91 @@ +setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/storage/buckets/:bucketId/files/:fileId') + ->desc('Get file') + ->groups(['api', 'storage']) + ->label('scope', 'files.read') + ->label('resourceType', RESOURCE_TYPE_BUCKETS) + ->label('sdk', new Method( + namespace: 'storage', + group: 'files', + name: 'getFile', + description: '/docs/references/storage/get-file.md', + auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_FILE, + ) + ] + )) + ->param('bucketId', '', new UID(), 'Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') + ->param('fileId', '', new UID(), 'File ID.') + ->inject('response') + ->inject('dbForProject') + ->inject('authorization') + ->callback($this->action(...)); + } + + public function action( + string $bucketId, + string $fileId, + Response $response, + Database $dbForProject, + Authorization $authorization + ) { + $bucket = $authorization->skip(fn () => $dbForProject->getDocument('buckets', $bucketId)); + + $isAPIKey = User::isApp($authorization->getRoles()); + $isPrivilegedUser = User::isPrivileged($authorization->getRoles()); + + if ($bucket->isEmpty() || (!$bucket->getAttribute('enabled') && !$isAPIKey && !$isPrivilegedUser)) { + throw new Exception(Exception::STORAGE_BUCKET_NOT_FOUND); + } + + $fileSecurity = $bucket->getAttribute('fileSecurity', false); + $valid = $authorization->isValid(new Input(Database::PERMISSION_READ, $bucket->getRead())); + if (!$fileSecurity && !$valid) { + throw new Exception(Exception::USER_UNAUTHORIZED, $authorization->getDescription()); + } + + if ($fileSecurity && !$valid) { + $file = $dbForProject->getDocument('bucket_' . $bucket->getSequence(), $fileId); + } else { + $file = $authorization->skip(fn () => $dbForProject->getDocument('bucket_' . $bucket->getSequence(), $fileId)); + } + + if ($file->isEmpty()) { + throw new Exception(Exception::STORAGE_FILE_NOT_FOUND); + } + + $response->dynamic($file, Response::MODEL_FILE); + } +} diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php new file mode 100644 index 0000000000..7ab3e713bc --- /dev/null +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php @@ -0,0 +1,289 @@ +setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/storage/buckets/:bucketId/files/:fileId/preview') + ->desc('Get file preview') + ->groups(['api', 'storage']) + ->label('scope', 'files.read') + ->label('resourceType', RESOURCE_TYPE_BUCKETS) + ->label('cache', true) + ->label('cache.resourceType', 'bucket/{request.bucketId}') + ->label('cache.resource', 'file/{request.fileId}') + ->label('sdk', new Method( + namespace: 'storage', + group: 'files', + name: 'getFilePreview', + description: '/docs/references/storage/get-file-preview.md', + auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_NONE + ) + ], + type: MethodType::LOCATION, + contentType: ContentType::IMAGE + )) + ->param('bucketId', '', new UID(), 'Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') + ->param('fileId', '', new UID(), 'File ID') + ->param('width', 0, new Range(0, 4000), 'Resize preview image width, Pass an integer between 0 to 4000.', true) + ->param('height', 0, new Range(0, 4000), 'Resize preview image height, Pass an integer between 0 to 4000.', true) + ->param('gravity', Image::GRAVITY_CENTER, new WhiteList(Image::getGravityTypes()), 'Image crop gravity. Can be one of ' . implode(",", Image::getGravityTypes()), true) + ->param('quality', -1, new Range(-1, 100), 'Preview image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.', true) + ->param('borderWidth', 0, new Range(0, 100), 'Preview image border in pixels. Pass an integer between 0 to 100. Defaults to 0.', true) + ->param('borderColor', '', new HexColor(), 'Preview image border color. Use a valid HEX color, no # is needed for prefix.', true) + ->param('borderRadius', 0, new Range(0, 4000), 'Preview image border radius in pixels. Pass an integer between 0 to 4000.', true) + ->param('opacity', 1, new Range(0, 1, Range::TYPE_FLOAT), 'Preview image opacity. Only works with images having an alpha channel (like png). Pass a number between 0 to 1.', true) + ->param('rotation', 0, new Range(-360, 360), 'Preview image rotation in degrees. Pass an integer between -360 and 360.', true) + ->param('background', '', new HexColor(), 'Preview image background color. Only works with transparent images (png). Use a valid HEX color, no # is needed for prefix.', true) + ->param('output', '', new WhiteList(\array_keys(Config::getParam('storage-outputs')), true), 'Output format type (jpeg, jpg, png, gif and webp).', true) + // NOTE: this is only for the sdk generator and is not used in the action below and is utilised in `resources.php` for `resourceToken`. + ->param('token', '', new Text(512), 'File token for accessing this file.', true) + ->inject('request') + ->inject('response') + ->inject('dbForProject') + ->inject('resourceToken') + ->inject('deviceForFiles') + ->inject('deviceForLocal') + ->inject('project') + ->inject('authorization') + ->callback($this->action(...)); + } + + public function action( + string $bucketId, + string $fileId, + int $width, + int $height, + string $gravity, + int $quality, + int $borderWidth, + string $borderColor, + int $borderRadius, + float $opacity, + int $rotation, + string $background, + string $output, + ?string $token, + Request $request, + Response $response, + Database $dbForProject, + Document $resourceToken, + Device $deviceForFiles, + Device $deviceForLocal, + Document $project, + Authorization $authorization + ) { + + if (!\extension_loaded('imagick')) { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Imagick extension is missing'); + } + + /* @type Document $bucket */ + $bucket = $authorization->skip(fn () => $dbForProject->getDocument('buckets', $bucketId)); + + $isAPIKey = User::isApp($authorization->getRoles()); + $isPrivilegedUser = User::isPrivileged($authorization->getRoles()); + + if ($bucket->isEmpty() || (!$bucket->getAttribute('enabled') && !$isAPIKey && !$isPrivilegedUser)) { + throw new Exception(Exception::STORAGE_BUCKET_NOT_FOUND); + } + + if (!$bucket->getAttribute('transformations', true) && !$isAPIKey && !$isPrivilegedUser) { + throw new Exception(Exception::STORAGE_BUCKET_TRANSFORMATIONS_DISABLED); + } + + $isToken = !$resourceToken->isEmpty() && $resourceToken->getAttribute('bucketInternalId') === $bucket->getSequence(); + $fileSecurity = $bucket->getAttribute('fileSecurity', false); + $valid = $authorization->isValid(new Input(Database::PERMISSION_READ, $bucket->getRead())); + if (!$fileSecurity && !$valid && !$isToken) { + throw new Exception(Exception::USER_UNAUTHORIZED, $authorization->getDescription()); + } + + if ($fileSecurity && !$valid && !$isToken) { + $file = $dbForProject->getDocument('bucket_' . $bucket->getSequence(), $fileId); + } else { + /* @type Document $file */ + $file = $authorization->skip(fn () => $dbForProject->getDocument('bucket_' . $bucket->getSequence(), $fileId)); + } + + if (!$resourceToken->isEmpty() && $resourceToken->getAttribute('fileInternalId') !== $file->getSequence()) { + throw new Exception(Exception::USER_UNAUTHORIZED); + } + + if ($file->isEmpty()) { + throw new Exception(Exception::STORAGE_FILE_NOT_FOUND); + } + + $inputs = Config::getParam('storage-inputs'); + $outputs = Config::getParam('storage-outputs'); + $fileLogos = Config::getParam('storage-logos'); + + $path = $file->getAttribute('path'); + $type = \strtolower(\pathinfo($path, PATHINFO_EXTENSION)); + $algorithm = $file->getAttribute('algorithm', Compression::NONE); + $cipher = $file->getAttribute('openSSLCipher'); + $mime = $file->getAttribute('mimeType'); + if (!\in_array($mime, $inputs) || $file->getAttribute('sizeActual') > (int) System::getEnv('_APP_STORAGE_PREVIEW_LIMIT', APP_STORAGE_READ_BUFFER)) { + if (!\in_array($mime, $inputs)) { + $path = (\array_key_exists($mime, $fileLogos)) ? $fileLogos[$mime] : $fileLogos['default']; + } else { + // it was an image but the file size exceeded the limit + $path = $fileLogos['default_image']; + } + + $algorithm = Compression::NONE; + $cipher = null; + $background = (empty($background)) ? 'eceff1' : $background; + $type = \strtolower(\pathinfo($path, PATHINFO_EXTENSION)); + $deviceForFiles = $deviceForLocal; + } + + if (!$deviceForFiles->exists($path)) { + throw new Exception(Exception::STORAGE_FILE_NOT_FOUND); + } + + if (empty($output)) { + // when file extension is provided but it's not one of our + // supported outputs we fallback to `jpg` + if (!empty($type) && !array_key_exists($type, $outputs)) { + $type = 'jpg'; + } + + // when file extension is not provided and the mime type is not one of our supported outputs + // we fallback to `jpg` output format + $output = empty($type) ? (array_search($mime, $outputs) ?? 'jpg') : $type; + } + + $startTime = \microtime(true); + + $source = $deviceForFiles->read($path); + + $downloadTime = \microtime(true) - $startTime; + + if (!empty($cipher)) { // Decrypt + $source = OpenSSL::decrypt( + $source, + $file->getAttribute('openSSLCipher'), + System::getEnv('_APP_OPENSSL_KEY_V' . $file->getAttribute('openSSLVersion')), + 0, + \hex2bin($file->getAttribute('openSSLIV')), + \hex2bin($file->getAttribute('openSSLTag')) + ); + } + + $decryptionTime = \microtime(true) - $startTime - $downloadTime; + + switch ($algorithm) { + case Compression::ZSTD: + $compressor = new Zstd(); + $source = $compressor->decompress($source); + break; + case Compression::GZIP: + $compressor = new GZIP(); + $source = $compressor->decompress($source); + break; + } + + $decompressionTime = \microtime(true) - $startTime - $downloadTime - $decryptionTime; + + try { + $image = new Image($source); + } catch (\Exception $e) { + throw new Exception(Exception::STORAGE_FILE_TYPE_UNSUPPORTED, $e->getMessage()); + } + + $image->crop((int) $width, (int) $height, $gravity); + + if (!empty($opacity) || $opacity === 0) { + $image->setOpacity($opacity); + } + + if (!empty($background)) { + $image->setBackground('#' . $background); + } + + if (!empty($borderWidth)) { + $image->setBorder($borderWidth, '#' . $borderColor); + } + + if (!empty($borderRadius)) { + $image->setBorderRadius($borderRadius); + } + + if (!empty($rotation)) { + $image->setRotation(($rotation + 360) % 360); + } + + $data = $image->output($output, $quality); + + $renderingTime = \microtime(true) - $startTime - $downloadTime - $decryptionTime - $decompressionTime; + + $totalTime = \microtime(true) - $startTime; + + Console::info("File preview rendered,project=" . $project->getId() . ",bucket=" . $bucketId . ",file=" . $file->getId() . ",uri=" . $request->getURI() . ",total=" . $totalTime . ",rendering=" . $renderingTime . ",decryption=" . $decryptionTime . ",decompression=" . $decompressionTime . ",download=" . $downloadTime); + + $contentType = (\array_key_exists($output, $outputs)) ? $outputs[$output] : $outputs['jpg']; + + //Do not update transformedAt if it's a console user + if (!User::isPrivileged($authorization->getRoles())) { + $transformedAt = $file->getAttribute('transformedAt', ''); + if (DateTime::formatTz(DateTime::addSeconds(new \DateTime(), -APP_PROJECT_ACCESS)) > $transformedAt) { + $file->setAttribute('transformedAt', DateTime::now()); + $authorization->skip(fn () => $dbForProject->updateDocument('bucket_' . $file->getAttribute('bucketInternalId'), $file->getId(), $file)); + } + } + + $response + ->addHeader('Cache-Control', 'private, max-age=2592000') // 30 days + ->setContentType($contentType) + ->file($data); + + unset($image); + } +} diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Push/Get.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Push/Get.php new file mode 100644 index 0000000000..516343e23f --- /dev/null +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Push/Get.php @@ -0,0 +1,209 @@ +setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/storage/buckets/:bucketId/files/:fileId/push') + ->desc('Get file for push notification') + ->groups(['api', 'storage']) + ->label('scope', 'public') + ->label('resourceType', RESOURCE_TYPE_BUCKETS) + ->param('bucketId', '', new UID(), 'Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') + ->param('fileId', '', new UID(), 'File ID.') + ->param('jwt', '', new Text(2048, 0), 'JSON Web Token to validate', true) + ->inject('response') + ->inject('request') + ->inject('dbForProject') + ->inject('dbForPlatform') + ->inject('project') + ->inject('mode') + ->inject('deviceForFiles') + ->inject('authorization') + ->callback($this->action(...)); + } + + public function action( + string $bucketId, + string $fileId, + string $jwt, + Response $response, + Request $request, + Database $dbForProject, + Database $dbForPlatform, + Document $project, + string $mode, + Device $deviceForFiles, + Authorization $authorization + ) { + $decoder = new JWT(System::getEnv('_APP_OPENSSL_KEY_V1'), 'HS256', 3600, 0); + + try { + $decoded = $decoder->decode($jwt); + } catch (JWTException) { + throw new Exception(Exception::USER_UNAUTHORIZED); + } + + if ( + $decoded['projectId'] !== $project->getId() || + $decoded['bucketId'] !== $bucketId || + $decoded['fileId'] !== $fileId + ) { + throw new Exception(Exception::USER_UNAUTHORIZED); + } + + $isInternal = $decoded['internal'] ?? false; + $disposition = $decoded['disposition'] ?? 'inline'; + $dbForProject = $isInternal ? $dbForPlatform : $dbForProject; + + $isAPIKey = User::isApp($authorization->getRoles()); + $isPrivilegedUser = User::isPrivileged($authorization->getRoles()); + + $bucket = $authorization->skip(fn () => $dbForProject->getDocument('buckets', $bucketId)); + if ($bucket->isEmpty() || (!$bucket->getAttribute('enabled') && !$isAPIKey && !$isPrivilegedUser)) { + throw new Exception(Exception::STORAGE_BUCKET_NOT_FOUND); + } + + $file = $authorization->skip(fn () => $dbForProject->getDocument('bucket_' . $bucket->getSequence(), $fileId)); + if ($file->isEmpty()) { + throw new Exception(Exception::STORAGE_FILE_NOT_FOUND); + } + + $mimes = Config::getParam('storage-mimes'); + + $path = $file->getAttribute('path', ''); + + if (!$deviceForFiles->exists($path)) { + throw new Exception(Exception::STORAGE_FILE_NOT_FOUND, 'File not found in ' . $path); + } + + $contentType = 'text/plain'; + + if (\in_array($file->getAttribute('mimeType'), $mimes)) { + $contentType = $file->getAttribute('mimeType'); + } + + $size = $file->getAttribute('sizeOriginal', 0); + + $rangeHeader = $request->getHeader('range'); + if (!empty($rangeHeader)) { + $start = $request->getRangeStart(); + $end = $request->getRangeEnd(); + $unit = $request->getRangeUnit(); + + if ($end === null || $end - $start > APP_STORAGE_READ_BUFFER) { + $end = min(($start + APP_STORAGE_READ_BUFFER - 1), ($size - 1)); + } + + if ($unit != 'bytes' || $start >= $end || $end >= $size) { + throw new Exception(Exception::STORAGE_INVALID_RANGE); + } + + $response + ->addHeader('Accept-Ranges', 'bytes') + ->addHeader('Content-Range', "bytes $start-$end/$size") + ->addHeader('Content-Length', $end - $start + 1) + ->setStatusCode(Response::STATUS_CODE_PARTIALCONTENT); + } + + $response + ->setContentType($contentType) + ->addHeader('Content-Security-Policy', 'script-src none;') + ->addHeader('X-Content-Type-Options', 'nosniff') + ->addHeader('Content-Disposition', $disposition . '; filename="' . $file->getAttribute('name', '') . '"') + ->addHeader('Cache-Control', 'private, max-age=3888000') // 45 days + ->addHeader('X-Peak', \memory_get_peak_usage()); + + $source = ''; + if (!empty($file->getAttribute('openSSLCipher'))) { // Decrypt + $source = $deviceForFiles->read($path); + $source = OpenSSL::decrypt( + $source, + $file->getAttribute('openSSLCipher'), + System::getEnv('_APP_OPENSSL_KEY_V' . $file->getAttribute('openSSLVersion')), + 0, + \hex2bin($file->getAttribute('openSSLIV')), + \hex2bin($file->getAttribute('openSSLTag')) + ); + } + + switch ($file->getAttribute('algorithm', Compression::NONE)) { + case Compression::ZSTD: + if (empty($source)) { + $source = $deviceForFiles->read($path); + } + $compressor = new Zstd(); + $source = $compressor->decompress($source); + break; + case Compression::GZIP: + if (empty($source)) { + $source = $deviceForFiles->read($path); + } + $compressor = new GZIP(); + $source = $compressor->decompress($source); + break; + } + + if (!empty($source)) { + if (!empty($rangeHeader)) { + $response->send(substr($source, $start, ($end - $start + 1))); + return; + } + $response->send($source); + return; + } + + if (!empty($rangeHeader)) { + $response->send($deviceForFiles->read($path, $start, ($end - $start + 1))); + return; + } + + $size = $deviceForFiles->getFileSize($path); + if ($size > APP_STORAGE_READ_BUFFER) { + for ($i = 0; $i < ceil($size / MAX_OUTPUT_CHUNK_SIZE); $i++) { + $response->chunk( + $deviceForFiles->read( + $path, + ($i * MAX_OUTPUT_CHUNK_SIZE), + min(MAX_OUTPUT_CHUNK_SIZE, $size - ($i * MAX_OUTPUT_CHUNK_SIZE)) + ), + (($i + 1) * MAX_OUTPUT_CHUNK_SIZE) >= $size + ); + } + } else { + $response->send($deviceForFiles->read($path)); + } + } +} diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Update.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Update.php new file mode 100644 index 0000000000..57856c1564 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Update.php @@ -0,0 +1,158 @@ +setHttpMethod(Action::HTTP_REQUEST_METHOD_PUT) + ->setHttpPath('/v1/storage/buckets/:bucketId/files/:fileId') + ->desc('Update file') + ->groups(['api', 'storage']) + ->label('scope', 'files.write') + ->label('resourceType', RESOURCE_TYPE_BUCKETS) + ->label('event', 'buckets.[bucketId].files.[fileId].update') + ->label('audits.event', 'file.update') + ->label('audits.resource', 'file/{response.$id}') + ->label('sdk', new Method( + namespace: 'storage', + group: 'files', + name: 'updateFile', + description: '/docs/references/storage/update-file.md', + auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_FILE, + ) + ] + )) + ->param('bucketId', '', new UID(), 'Bucket unique ID.') + ->param('fileId', '', new UID(), 'File ID.') + ->param('name', null, new Text(128), 'File name.', true) + ->param('permissions', null, new Nullable(new Permissions(APP_LIMIT_ARRAY_PARAMS_SIZE)), 'An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).', true) + ->inject('response') + ->inject('dbForProject') + ->inject('queueForEvents') + ->inject('authorization') + ->callback($this->action(...)); + } + + public function action( + string $bucketId, + string $fileId, + ?string $name, + ?array $permissions, + Response $response, + Database $dbForProject, + Event $queueForEvents, + Authorization $authorization + ) { + $bucket = $authorization->skip(fn () => $dbForProject->getDocument('buckets', $bucketId)); + + $isAPIKey = User::isApp($authorization->getRoles()); + $isPrivilegedUser = User::isPrivileged($authorization->getRoles()); + + if ($bucket->isEmpty() || (!$bucket->getAttribute('enabled') && !$isAPIKey && !$isPrivilegedUser)) { + throw new Exception(Exception::STORAGE_BUCKET_NOT_FOUND); + } + + $fileSecurity = $bucket->getAttribute('fileSecurity', false); + $valid = $authorization->isValid(new Input(Database::PERMISSION_UPDATE, $bucket->getUpdate())); + if (!$fileSecurity && !$valid) { + throw new Exception(Exception::USER_UNAUTHORIZED, $authorization->getDescription()); + } + + // Read permission should not be required for update + $file = $authorization->skip(fn () => $dbForProject->getDocument('bucket_' . $bucket->getSequence(), $fileId)); + + if ($file->isEmpty()) { + throw new Exception(Exception::STORAGE_FILE_NOT_FOUND); + } + + // Map aggregate permissions into the multiple permissions they represent. + $permissions = Permission::aggregate($permissions, [ + Database::PERMISSION_READ, + Database::PERMISSION_UPDATE, + Database::PERMISSION_DELETE, + ]); + + // Users can only manage their own roles, API keys and Admin users can manage any + $roles = $authorization->getRoles(); + if (!User::isApp($roles) && !User::isPrivileged($roles) && !\is_null($permissions)) { + foreach (Database::PERMISSIONS as $type) { + foreach ($permissions as $permission) { + $permission = Permission::parse($permission); + if ($permission->getPermission() != $type) { + continue; + } + $role = (new Role( + $permission->getRole(), + $permission->getIdentifier(), + $permission->getDimension() + ))->toString(); + if (!$authorization->hasRole($role)) { + throw new Exception(Exception::USER_UNAUTHORIZED, 'Permissions must be one of: (' . \implode(', ', $roles) . ')'); + } + } + } + } + + if (\is_null($permissions)) { + $permissions = $file->getPermissions() ?? []; + } + + $file->setAttribute('$permissions', $permissions); + + if (!is_null($name)) { + $file->setAttribute('name', $name); + } + + try { + if ($fileSecurity && !$valid) { + $file = $dbForProject->updateDocument('bucket_' . $bucket->getSequence(), $fileId, $file); + } else { + $file = $authorization->skip(fn () => $dbForProject->updateDocument('bucket_' . $bucket->getSequence(), $fileId, $file)); + } + } catch (NotFoundException) { + throw new Exception(Exception::STORAGE_BUCKET_NOT_FOUND); + } + + $queueForEvents + ->setParam('bucketId', $bucket->getId()) + ->setParam('fileId', $file->getId()) + ->setContext('bucket', $bucket) + ; + + $response->dynamic($file, Response::MODEL_FILE); + } +} diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php new file mode 100644 index 0000000000..3874fedacf --- /dev/null +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php @@ -0,0 +1,227 @@ +setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/storage/buckets/:bucketId/files/:fileId/view') + ->desc('Get file for view') + ->groups(['api', 'storage']) + ->label('scope', 'files.read') + ->label('resourceType', RESOURCE_TYPE_BUCKETS) + ->label('sdk', new Method( + namespace: 'storage', + group: 'files', + name: 'getFileView', + description: '/docs/references/storage/get-file-view.md', + auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_NONE, + ) + ], + contentType: ContentType::ANY, + type: MethodType::LOCATION + )) + ->param('bucketId', '', new UID(), 'Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') + ->param('fileId', '', new UID(), 'File ID.') + // NOTE: this is only for the sdk generator and is not used in the action below and is utilised in `resources.php` for `resourceToken`. + ->param('token', '', new Text(512), 'File token for accessing this file.', true) + ->inject('response') + ->inject('request') + ->inject('dbForProject') + ->inject('mode') + ->inject('resourceToken') + ->inject('deviceForFiles') + ->inject('authorization') + ->callback($this->action(...)); + } + + public function action( + string $bucketId, + string $fileId, + ?string $token, + Response $response, + Request $request, + Database $dbForProject, + string $mode, + Document $resourceToken, + Device $deviceForFiles, + Authorization $authorization + ) { + /* @type Document $bucket */ + $bucket = $authorization->skip(fn () => $dbForProject->getDocument('buckets', $bucketId)); + + $isAPIKey = User::isApp($authorization->getRoles()); + $isPrivilegedUser = User::isPrivileged($authorization->getRoles()); + + if ($bucket->isEmpty() || (!$bucket->getAttribute('enabled') && !$isAPIKey && !$isPrivilegedUser)) { + throw new Exception(Exception::STORAGE_BUCKET_NOT_FOUND); + } + + $isToken = !$resourceToken->isEmpty() && $resourceToken->getAttribute('bucketInternalId') === $bucket->getSequence(); + $fileSecurity = $bucket->getAttribute('fileSecurity', false); + $valid = $authorization->isValid(new Input(Database::PERMISSION_READ, $bucket->getRead())); + if (!$fileSecurity && !$valid && !$isToken) { + throw new Exception(Exception::USER_UNAUTHORIZED, $authorization->getDescription()); + } + + if ($fileSecurity && !$valid && !$isToken) { + $file = $dbForProject->getDocument('bucket_' . $bucket->getSequence(), $fileId); + } else { + /* @type Document $file */ + $file = $authorization->skip(fn () => $dbForProject->getDocument('bucket_' . $bucket->getSequence(), $fileId)); + } + + if (!$resourceToken->isEmpty() && $resourceToken->getAttribute('fileInternalId') !== $file->getSequence()) { + throw new Exception(Exception::USER_UNAUTHORIZED); + } + + if ($file->isEmpty()) { + throw new Exception(Exception::STORAGE_FILE_NOT_FOUND); + } + + $mimes = Config::getParam('storage-mimes'); + + $path = $file->getAttribute('path', ''); + + if (!$deviceForFiles->exists($path)) { + throw new Exception(Exception::STORAGE_FILE_NOT_FOUND, 'File not found in ' . $path); + } + + $contentType = 'text/plain'; + + if (\in_array($file->getAttribute('mimeType'), $mimes)) { + $contentType = $file->getAttribute('mimeType'); + } + + $size = $file->getAttribute('sizeOriginal', 0); + + $rangeHeader = $request->getHeader('range'); + if (!empty($rangeHeader)) { + $start = $request->getRangeStart(); + $end = $request->getRangeEnd(); + $unit = $request->getRangeUnit(); + + if ($end === null || $end - $start > APP_STORAGE_READ_BUFFER) { + $end = min(($start + APP_STORAGE_READ_BUFFER - 1), ($size - 1)); + } + + if ($unit != 'bytes' || $start >= $end || $end >= $size) { + throw new Exception(Exception::STORAGE_INVALID_RANGE); + } + + $response + ->addHeader('Accept-Ranges', 'bytes') + ->addHeader('Content-Range', "bytes $start-$end/$size") + ->addHeader('Content-Length', $end - $start + 1) + ->setStatusCode(Response::STATUS_CODE_PARTIALCONTENT); + } + + $response + ->setContentType($contentType) + ->addHeader('Content-Security-Policy', 'script-src none;') + ->addHeader('X-Content-Type-Options', 'nosniff') + ->addHeader('Content-Disposition', 'inline; filename="' . $file->getAttribute('name', '') . '"') + ->addHeader('Cache-Control', 'private, max-age=3888000') // 45 days + ->addHeader('X-Peak', \memory_get_peak_usage()) + ; + + $source = ''; + if (!empty($file->getAttribute('openSSLCipher'))) { // Decrypt + $source = $deviceForFiles->read($path); + $source = OpenSSL::decrypt( + $source, + $file->getAttribute('openSSLCipher'), + System::getEnv('_APP_OPENSSL_KEY_V' . $file->getAttribute('openSSLVersion')), + 0, + \hex2bin($file->getAttribute('openSSLIV')), + \hex2bin($file->getAttribute('openSSLTag')) + ); + } + + switch ($file->getAttribute('algorithm', Compression::NONE)) { + case Compression::ZSTD: + if (empty($source)) { + $source = $deviceForFiles->read($path); + } + $compressor = new Zstd(); + $source = $compressor->decompress($source); + break; + case Compression::GZIP: + if (empty($source)) { + $source = $deviceForFiles->read($path); + } + $compressor = new GZIP(); + $source = $compressor->decompress($source); + break; + } + + if (!empty($source)) { + if (!empty($rangeHeader)) { + $response->send(substr($source, $start, ($end - $start + 1))); + return; + } + $response->send($source); + return; + } + + if (!empty($rangeHeader)) { + $response->send($deviceForFiles->read($path, $start, ($end - $start + 1))); + return; + } + + $size = $deviceForFiles->getFileSize($path); + if ($size > APP_STORAGE_READ_BUFFER) { + for ($i = 0; $i < ceil($size / MAX_OUTPUT_CHUNK_SIZE); $i++) { + $response->chunk( + $deviceForFiles->read( + $path, + ($i * MAX_OUTPUT_CHUNK_SIZE), + min(MAX_OUTPUT_CHUNK_SIZE, $size - ($i * MAX_OUTPUT_CHUNK_SIZE)) + ), + (($i + 1) * MAX_OUTPUT_CHUNK_SIZE) >= $size + ); + } + } else { + $response->send($deviceForFiles->read($path)); + } + } +} diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/XList.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/XList.php new file mode 100644 index 0000000000..3663b56fab --- /dev/null +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/XList.php @@ -0,0 +1,157 @@ +setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/storage/buckets/:bucketId/files') + ->desc('List files') + ->groups(['api', 'storage']) + ->label('scope', 'files.read') + ->label('resourceType', RESOURCE_TYPE_BUCKETS) + ->label('sdk', new Method( + namespace: 'storage', + group: 'files', + name: 'listFiles', + description: '/docs/references/storage/list-files.md', + auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_FILE_LIST, + ) + ] + )) + ->param('bucketId', '', new UID(), 'Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') + ->param('queries', [], new Files(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long. You may filter on the following attributes: ' . implode(', ', Files::ALLOWED_ATTRIBUTES), true) + ->param('search', '', new Text(256), 'Search term to filter your list results. Max length: 256 chars.', true) + ->param('total', true, new Boolean(true), 'When set to false, the total count returned will be 0 and will not be calculated.', true) + ->inject('response') + ->inject('dbForProject') + ->inject('mode') + ->inject('authorization') + ->callback($this->action(...)); + } + + public function action( + string $bucketId, + array $queries, + string $search, + bool $includeTotal, + Response $response, + Database $dbForProject, + string $mode, + Authorization $authorization + ) { + $bucket = $authorization->skip(fn () => $dbForProject->getDocument('buckets', $bucketId)); + + $isAPIKey = User::isApp($authorization->getRoles()); + $isPrivilegedUser = User::isPrivileged($authorization->getRoles()); + + if ($bucket->isEmpty() || (!$bucket->getAttribute('enabled') && !$isAPIKey && !$isPrivilegedUser)) { + throw new Exception(Exception::STORAGE_BUCKET_NOT_FOUND); + } + + $fileSecurity = $bucket->getAttribute('fileSecurity', false); + $valid = $authorization->isValid(new Input(Database::PERMISSION_READ, $bucket->getRead())); + if (!$fileSecurity && !$valid) { + throw new Exception(Exception::USER_UNAUTHORIZED, $authorization->getDescription()); + } + + try { + $queries = Query::parseQueries($queries); + } catch (QueryException $e) { + throw new Exception(Exception::GENERAL_QUERY_INVALID, $e->getMessage()); + } + + if (!empty($search)) { + $queries[] = Query::search('search', $search); + } + + /** + * Get cursor document if there was a cursor query, we use array_filter and reset for reference $cursor to $queries + */ + $cursor = \array_filter($queries, function ($query) { + return \in_array($query->getMethod(), [Query::TYPE_CURSOR_AFTER, Query::TYPE_CURSOR_BEFORE]); + }); + $cursor = reset($cursor); + if ($cursor) { + /** @var Query $cursor */ + + $validator = new Cursor(); + if (!$validator->isValid($cursor)) { + throw new Exception(Exception::GENERAL_QUERY_INVALID, $validator->getDescription()); + } + + $fileId = $cursor->getValue(); + + if ($fileSecurity && !$valid) { + $cursorDocument = $dbForProject->getDocument('bucket_' . $bucket->getSequence(), $fileId); + } else { + $cursorDocument = $authorization->skip(fn () => $dbForProject->getDocument('bucket_' . $bucket->getSequence(), $fileId)); + } + + if ($cursorDocument->isEmpty()) { + throw new Exception(Exception::GENERAL_CURSOR_NOT_FOUND, "File '{$fileId}' for the 'cursor' value not found."); + } + + $cursor->setValue($cursorDocument); + } + + $filterQueries = Query::groupByType($queries)['filters']; + + try { + if ($fileSecurity && !$valid) { + $files = $dbForProject->find('bucket_' . $bucket->getSequence(), $queries); + $total = $includeTotal ? $dbForProject->count('bucket_' . $bucket->getSequence(), $filterQueries, APP_LIMIT_COUNT) : 0; + } else { + $files = $authorization->skip(fn () => $dbForProject->find('bucket_' . $bucket->getSequence(), $queries)); + $total = $includeTotal ? $authorization->skip(fn () => $dbForProject->count('bucket_' . $bucket->getSequence(), $filterQueries, APP_LIMIT_COUNT)) : 0; + } + } catch (NotFoundException) { + throw new Exception(Exception::STORAGE_BUCKET_NOT_FOUND); + } catch (OrderException $e) { + throw new Exception(Exception::DATABASE_QUERY_ORDER_NULL, "The order attribute '{$e->getAttribute()}' had a null value. Cursor pagination requires all documents order attribute values are non-null."); + } catch (QueryException $e) { + throw new Exception(Exception::GENERAL_QUERY_INVALID, $e->getMessage()); + } + + $response->dynamic(new Document([ + 'files' => $files, + 'total' => $total, + ]), Response::MODEL_FILE_LIST); + } +} diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Get.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Get.php new file mode 100644 index 0000000000..4e75de27c8 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Get.php @@ -0,0 +1,99 @@ +setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/storage/buckets/:bucketId') + ->desc('Get bucket') + ->groups(['api', 'storage']) + ->label('scope', 'buckets.read') + ->label('resourceType', RESOURCE_TYPE_BUCKETS) + ->label('sdk', new Method( + namespace: 'storage', + group: 'buckets', + name: 'getBucket', + description: '/docs/references/storage/get-bucket.md', + auth: [AuthType::ADMIN, AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_BUCKET, + ) + ] + )) + ->param('bucketId', '', new UID(), 'Bucket unique ID.') + ->inject('response') + ->inject('dbForProject') + ->inject('project') + ->inject('getLogsDB') + ->inject('authorization') + ->callback($this->action(...)); + } + + public function action( + string $bucketId, + Response $response, + Database $dbForProject, + Document $project, + callable $getLogsDB, + Authorization $authorization, + ): void { + $bucket = $dbForProject->getDocument('buckets', $bucketId); + + if ($bucket->isEmpty()) { + throw new Exception(Exception::STORAGE_BUCKET_NOT_FOUND); + } + + $metric = str_replace( + '{bucketInternalId}', + $bucket->getSequence(), + METRIC_BUCKET_ID_FILES_STORAGE + ); + + $statsDocId = md5('_inf_' . $metric); + + $totalSize = 0; + + try { + $dbForLogs = $getLogsDB($project); + $storageStats = $authorization->skip(fn () => $dbForLogs->getDocument( + 'stats', + $statsDocId, + [Query::select(['value'])] + )); + + $totalSize = $storageStats->getAttribute('value', 0); + } catch (\Throwable) { + // Stats may not be available, default to 0 + } + + $bucket->setAttribute('totalSize', $totalSize); + + $response->dynamic($bucket, Response::MODEL_BUCKET); + } +} diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Update.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Update.php new file mode 100644 index 0000000000..9dd5a29967 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Update.php @@ -0,0 +1,131 @@ +setHttpMethod(Action::HTTP_REQUEST_METHOD_PUT) + ->setHttpPath('/v1/storage/buckets/:bucketId') + ->desc('Update bucket') + ->groups(['api', 'storage']) + ->label('scope', 'buckets.write') + ->label('resourceType', RESOURCE_TYPE_BUCKETS) + ->label('event', 'buckets.[bucketId].update') + ->label('audits.event', 'bucket.update') + ->label('audits.resource', 'bucket/{response.$id}') + ->label('sdk', new Method( + namespace: 'storage', + group: 'buckets', + name: 'updateBucket', + description: '/docs/references/storage/update-bucket.md', + auth: [AuthType::ADMIN, AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_BUCKET, + ) + ] + )) + ->param('bucketId', '', new UID(), 'Bucket unique ID.') + ->param('name', null, new Text(128), 'Bucket name', false) + ->param('permissions', null, new Nullable(new Permissions(APP_LIMIT_ARRAY_PARAMS_SIZE)), 'An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).', true) + ->param('fileSecurity', false, new Boolean(true), '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).', true) + ->param('enabled', true, new Boolean(true), '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.', true) + ->param('maximumFileSize', fn (array $plan) => empty($plan['fileSize']) ? (int) System::getEnv('_APP_STORAGE_LIMIT', 0) : $plan['fileSize'] * 1000 * 1000, fn (array $plan) => new Range(1, empty($plan['fileSize']) ? (int) System::getEnv('_APP_STORAGE_LIMIT', 0) : $plan['fileSize'] * 1000 * 1000), 'Maximum file size allowed in bytes. Maximum allowed value is ' . Storage::human(System::getEnv('_APP_STORAGE_LIMIT', 0), 0) . '.', true, ['plan']) + ->param('allowedFileExtensions', [], new ArrayList(new Text(64), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Allowed file extensions. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' extensions are allowed, each 64 characters long.', true) + ->param('compression', Compression::NONE, new WhiteList([Compression::NONE, Compression::GZIP, Compression::ZSTD], true), 'Compression algorithm chosen for compression. Can be one of ' . Compression::NONE . ', [' . Compression::GZIP . '](https://en.wikipedia.org/wiki/Gzip), or [' . Compression::ZSTD . '](https://en.wikipedia.org/wiki/Zstd), For file size above ' . Storage::human(APP_STORAGE_READ_BUFFER, 0) . ' compression is skipped even if it\'s enabled', true) + ->param('encryption', true, new Boolean(true), 'Is encryption enabled? For file size above ' . Storage::human(APP_STORAGE_READ_BUFFER, 0) . ' encryption is skipped even if it\'s enabled', true) + ->param('antivirus', true, new Boolean(true), 'Is virus scanning enabled? For file size above ' . Storage::human(APP_LIMIT_ANTIVIRUS, 0) . ' AntiVirus scanning is skipped even if it\'s enabled', true) + ->param('transformations', true, new Boolean(true), 'Are image transformations enabled?', true) + ->inject('response') + ->inject('dbForProject') + ->inject('queueForEvents') + ->callback($this->action(...)); + } + + public function action( + string $bucketId, + string $name, + ?array $permissions, + bool $fileSecurity, + bool $enabled, + ?int $maximumFileSize, + array $allowedFileExtensions, + ?string $compression, + ?bool $encryption, + bool $antivirus, + bool $transformations, + Response $response, + Database $dbForProject, + Event $queueForEvents + ) { + $bucket = $dbForProject->getDocument('buckets', $bucketId); + + if ($bucket->isEmpty()) { + throw new Exception(Exception::STORAGE_BUCKET_NOT_FOUND); + } + + $permissions ??= $bucket->getPermissions(); + $maximumFileSize ??= $bucket->getAttribute('maximumFileSize', (int) System::getEnv('_APP_STORAGE_LIMIT', 0)); + $allowedFileExtensions ??= $bucket->getAttribute('allowedFileExtensions', []); + $enabled ??= $bucket->getAttribute('enabled', true); + $encryption ??= $bucket->getAttribute('encryption', true); + $antivirus ??= $bucket->getAttribute('antivirus', true); + $compression ??= $bucket->getAttribute('compression', Compression::NONE); + $transformations ??= $bucket->getAttribute('transformations', true); + + // Map aggregate permissions into the multiple permissions they represent. + $permissions = Permission::aggregate($permissions); + + $bucket = $dbForProject->updateDocument('buckets', $bucket->getId(), $bucket + ->setAttribute('name', $name) + ->setAttribute('$permissions', $permissions) + ->setAttribute('maximumFileSize', $maximumFileSize) + ->setAttribute('allowedFileExtensions', $allowedFileExtensions) + ->setAttribute('fileSecurity', $fileSecurity) + ->setAttribute('enabled', $enabled) + ->setAttribute('encryption', $encryption) + ->setAttribute('compression', $compression) + ->setAttribute('antivirus', $antivirus) + ->setAttribute('transformations', $transformations)); + + $dbForProject->updateCollection('bucket_' . $bucket->getSequence(), $permissions, $fileSecurity); + + $queueForEvents + ->setParam('bucketId', $bucket->getId()); + + $response->dynamic($bucket, Response::MODEL_BUCKET); + } +} diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/XList.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/XList.php new file mode 100644 index 0000000000..601d9b5321 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/XList.php @@ -0,0 +1,168 @@ +setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/storage/buckets') + ->desc('List buckets') + ->groups(['api', 'storage']) + ->label('scope', 'buckets.read') + ->label('resourceType', RESOURCE_TYPE_BUCKETS) + ->label('sdk', new Method( + namespace: 'storage', + group: 'buckets', + name: 'listBuckets', + description: '/docs/references/storage/list-buckets.md', + auth: [AuthType::ADMIN, AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_BUCKET_LIST, + ) + ] + )) + ->param('queries', [], new Buckets(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long. You may filter on the following attributes: ' . implode(', ', Buckets::ALLOWED_ATTRIBUTES), true) + ->param('search', '', new Text(256), 'Search term to filter your list results. Max length: 256 chars.', true) + ->param('total', true, new Boolean(true), 'When set to false, the total count returned will be 0 and will not be calculated.', true) + ->inject('response') + ->inject('dbForProject') + ->inject('project') + ->inject('getLogsDB') + ->inject('authorization') + ->callback($this->action(...)); + } + + public function action( + array $queries, + string $search, + bool $includeTotal, + Response $response, + Database $dbForProject, + Document $project, + callable $getLogsDB, + Authorization $authorization + ) { + try { + $queries = Query::parseQueries($queries); + } catch (QueryException $e) { + throw new Exception(Exception::GENERAL_QUERY_INVALID, $e->getMessage()); + } + + if (!empty($search)) { + $queries[] = Query::search('search', $search); + } + + /** + * Get cursor document if there was a cursor query, we use array_filter and reset for reference $cursor to $queries + */ + $cursor = \array_filter($queries, function ($query) { + return \in_array($query->getMethod(), [Query::TYPE_CURSOR_AFTER, Query::TYPE_CURSOR_BEFORE]); + }); + $cursor = reset($cursor); + if ($cursor) { + /** @var Query $cursor */ + + $validator = new Cursor(); + if (!$validator->isValid($cursor)) { + throw new Exception(Exception::GENERAL_QUERY_INVALID, $validator->getDescription()); + } + + $bucketId = $cursor->getValue(); + $cursorDocument = $dbForProject->getDocument('buckets', $bucketId); + + if ($cursorDocument->isEmpty()) { + throw new Exception(Exception::GENERAL_CURSOR_NOT_FOUND, "Bucket '{$bucketId}' for the 'cursor' value not found."); + } + + $cursor->setValue($cursorDocument); + } + + $filterQueries = Query::groupByType($queries)['filters']; + try { + $buckets = $dbForProject->find('buckets', $queries); + $total = $includeTotal ? $dbForProject->count('buckets', $filterQueries, APP_LIMIT_COUNT) : 0; + } catch (OrderException $e) { + throw new Exception(Exception::DATABASE_QUERY_ORDER_NULL, "The order attribute '{$e->getAttribute()}' had a null value. Cursor pagination requires all documents order attribute values are non-null."); + } catch (QueryException $e) { + throw new Exception(Exception::GENERAL_QUERY_INVALID, $e->getMessage()); + } + + if (!empty($buckets)) { + $bucketByStatsId = []; + + foreach ($buckets as $bucket) { + $metric = str_replace( + '{bucketInternalId}', + $bucket->getSequence(), + METRIC_BUCKET_ID_FILES_STORAGE + ); + + $statId = md5('_inf_' . $metric); + + $bucketByStatsId[$statId] = $bucket; + + // set a default + $bucket->setAttribute('totalSize', 0); + } + + try { + $dbForLogs = $getLogsDB($project); + + /* @var array $stats */ + $stats = $authorization->skip(function () use ($dbForLogs, $bucketByStatsId) { + $statsIds = array_keys($bucketByStatsId); + + return $dbForLogs->find('stats', [ + Query::equal('$id', $statsIds), + Query::select(['value']), + ]); + }); + + foreach ($stats as $stat) { + $bucket = $bucketByStatsId[$stat->getId()]; + + if ($bucket) { + $bucket->setAttribute('totalSize', $stat->getAttribute('value', 0)); + } + } + } catch (\Throwable) { + // Stats may not be available, default to 0 + } + } + + $response->dynamic(new Document([ + 'buckets' => $buckets, + 'total' => $total, + ]), Response::MODEL_BUCKET_LIST); + } +} diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Usage/Get.php b/src/Appwrite/Platform/Modules/Storage/Http/Usage/Get.php new file mode 100644 index 0000000000..a7bda355da --- /dev/null +++ b/src/Appwrite/Platform/Modules/Storage/Http/Usage/Get.php @@ -0,0 +1,138 @@ +setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/storage/:bucketId/usage') + ->desc('Get bucket usage stats') + ->groups(['api', 'storage']) + ->label('scope', 'files.read') + ->label('resourceType', RESOURCE_TYPE_BUCKETS) + ->label('sdk', new Method( + namespace: 'storage', + group: null, + name: 'getBucketUsage', + description: '/docs/references/storage/get-bucket-usage.md', + auth: [AuthType::ADMIN], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_USAGE_BUCKETS, + ) + ] + )) + ->param('bucketId', '', new UID(), 'Bucket ID.') + ->param('range', '30d', new WhiteList(['24h', '30d', '90d'], true), 'Date range.', true) + ->inject('response') + ->inject('project') + ->inject('dbForProject') + ->inject('getLogsDB') + ->inject('authorization') + ->callback($this->action(...)); + } + + public function action(string $bucketId, string $range, Response $response, Document $project, Database $dbForProject, callable $getLogsDB, Authorization $authorization) + { + $dbForLogs = call_user_func($getLogsDB, $project); + $bucket = $dbForProject->getDocument('buckets', $bucketId); + + if ($bucket->isEmpty()) { + throw new Exception(Exception::STORAGE_BUCKET_NOT_FOUND); + } + + $periods = Config::getParam('usage', []); + $stats = $usage = []; + $days = $periods[$range]; + $metrics = [ + str_replace('{bucketInternalId}', $bucket->getSequence(), METRIC_BUCKET_ID_FILES), + str_replace('{bucketInternalId}', $bucket->getSequence(), METRIC_BUCKET_ID_FILES_STORAGE), + str_replace('{bucketInternalId}', $bucket->getSequence(), METRIC_BUCKET_ID_FILES_IMAGES_TRANSFORMED), + ]; + + $authorization->skip(function () use ($dbForProject, $dbForLogs, $bucket, $days, $metrics, &$stats) { + foreach ($metrics as $metric) { + $db = ($metric === str_replace('{bucketInternalId}', $bucket->getSequence(), METRIC_BUCKET_ID_FILES_IMAGES_TRANSFORMED)) + ? $dbForLogs + : $dbForProject; + + $result = $db->findOne('stats', [ + Query::equal('metric', [$metric]), + Query::equal('period', ['inf']) + ]); + + $stats[$metric]['total'] = $result['value'] ?? 0; + $limit = $days['limit']; + $period = $days['period']; + $results = $db->find('stats', [ + Query::equal('metric', [$metric]), + Query::equal('period', [$period]), + Query::limit($limit), + Query::orderDesc('time'), + ]); + $stats[$metric]['data'] = []; + foreach ($results as $result) { + $stats[$metric]['data'][$result->getAttribute('time')] = [ + 'value' => $result->getAttribute('value'), + ]; + } + } + }); + + + $format = match ($days['period']) { + '1h' => 'Y-m-d\\TH:00:00.000P', + '1d' => 'Y-m-d\\T00:00:00.000P', + }; + + foreach ($metrics as $metric) { + $usage[$metric]['total'] = $stats[$metric]['total']; + $usage[$metric]['data'] = []; + $leap = time() - ($days['limit'] * $days['factor']); + while ($leap < time()) { + $leap += $days['factor']; + $formatDate = date($format, $leap); + $usage[$metric]['data'][] = [ + 'value' => $stats[$metric]['data'][$formatDate]['value'] ?? 0, + 'date' => $formatDate, + ]; + } + } + + $response->dynamic(new Document([ + 'range' => $range, + 'filesTotal' => $usage[$metrics[0]]['total'], + 'filesStorageTotal' => $usage[$metrics[1]]['total'], + 'files' => $usage[$metrics[0]]['data'], + 'storage' => $usage[$metrics[1]]['data'], + 'imageTransformations' => $usage[$metrics[2]]['data'], + 'imageTransformationsTotal' => $usage[$metrics[2]]['total'], + ]), Response::MODEL_USAGE_BUCKETS); + } +} diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Usage/XList.php b/src/Appwrite/Platform/Modules/Storage/Http/Usage/XList.php new file mode 100644 index 0000000000..44fdd54e8c --- /dev/null +++ b/src/Appwrite/Platform/Modules/Storage/Http/Usage/XList.php @@ -0,0 +1,121 @@ +setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/storage/usage') + ->desc('Get storage usage stats') + ->groups(['api', 'storage']) + ->label('scope', 'files.read') + ->label('resourceType', RESOURCE_TYPE_BUCKETS) + ->label('sdk', new Method( + namespace: 'storage', + group: null, + name: 'getUsage', + description: '/docs/references/storage/get-usage.md', + auth: [AuthType::ADMIN], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_USAGE_STORAGE, + ) + ] + )) + ->param('range', '30d', new WhiteList(['24h', '30d', '90d'], true), 'Date range.', true) + ->inject('response') + ->inject('dbForProject') + ->inject('authorization') + ->callback($this->action(...)); + } + + public function action(string $range, Response $response, Database $dbForProject, Authorization $authorization) + { + $periods = Config::getParam('usage', []); + $stats = $usage = []; + $days = $periods[$range]; + $metrics = [ + METRIC_BUCKETS, + METRIC_FILES, + METRIC_FILES_STORAGE, + ]; + + $authorization->skip(function () use ($dbForProject, $days, $metrics, &$stats) { + foreach ($metrics as $metric) { + $result = $dbForProject->findOne('stats', [ + Query::equal('metric', [$metric]), + Query::equal('period', ['inf']) + ]); + + $stats[$metric]['total'] = $result['value'] ?? 0; + $limit = $days['limit']; + $period = $days['period']; + $results = $dbForProject->find('stats', [ + Query::equal('metric', [$metric]), + Query::equal('period', [$period]), + Query::limit($limit), + Query::orderDesc('time'), + ]); + $stats[$metric]['data'] = []; + foreach ($results as $result) { + $stats[$metric]['data'][$result->getAttribute('time')] = [ + 'value' => $result->getAttribute('value'), + ]; + } + } + }); + + $format = match ($days['period']) { + '1h' => 'Y-m-d\\TH:00:00.000P', + '1d' => 'Y-m-d\\T00:00:00.000P', + }; + + foreach ($metrics as $metric) { + $usage[$metric]['total'] = $stats[$metric]['total']; + $usage[$metric]['data'] = []; + $leap = time() - ($days['limit'] * $days['factor']); + while ($leap < time()) { + $leap += $days['factor']; + $formatDate = date($format, $leap); + $usage[$metric]['data'][] = [ + 'value' => $stats[$metric]['data'][$formatDate]['value'] ?? 0, + 'date' => $formatDate, + ]; + } + } + + $response->dynamic(new Document([ + 'range' => $range, + 'bucketsTotal' => $usage[$metrics[0]]['total'], + 'filesTotal' => $usage[$metrics[1]]['total'], + 'filesStorageTotal' => $usage[$metrics[2]]['total'], + 'buckets' => $usage[$metrics[0]]['data'], + 'files' => $usage[$metrics[1]]['data'], + 'storage' => $usage[$metrics[2]]['data'], + ]), Response::MODEL_USAGE_STORAGE); + } +} diff --git a/src/Appwrite/Platform/Modules/Storage/Module.php b/src/Appwrite/Platform/Modules/Storage/Module.php new file mode 100644 index 0000000000..59eb9e87a6 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Storage/Module.php @@ -0,0 +1,14 @@ +addService('http', new Http()); + } +} diff --git a/src/Appwrite/Platform/Modules/Storage/Services/Http.php b/src/Appwrite/Platform/Modules/Storage/Services/Http.php new file mode 100644 index 0000000000..95fe160f8b --- /dev/null +++ b/src/Appwrite/Platform/Modules/Storage/Services/Http.php @@ -0,0 +1,51 @@ +type = Service::TYPE_HTTP; + + // Buckets + $this->addAction(CreateBucket::getName(), new CreateBucket()); + $this->addAction(GetBucket::getName(), new GetBucket()); + $this->addAction(ListBuckets::getName(), new ListBuckets()); + $this->addAction(UpdateBucket::getName(), new UpdateBucket()); + $this->addAction(DeleteBucket::getName(), new DeleteBucket()); + + // Files + $this->addAction(CreateFile::getName(), new CreateFile()); + $this->addAction(GetFile::getName(), new GetFile()); + $this->addAction(ListFiles::getName(), new ListFiles()); + $this->addAction(UpdateFile::getName(), new UpdateFile()); + $this->addAction(DeleteFile::getName(), new DeleteFile()); + $this->addAction(GetFilePreview::getName(), new GetFilePreview()); + $this->addAction(GetFileDownload::getName(), new GetFileDownload()); + $this->addAction(GetFileView::getName(), new GetFileView()); + $this->addAction(GetFileForPush::getName(), new GetFileForPush()); + + // Usage + $this->addAction(ListUsage::getName(), new ListUsage()); + $this->addAction(GetBucketUsage::getName(), new GetBucketUsage()); + } +} diff --git a/src/Appwrite/Platform/Services/Tasks.php b/src/Appwrite/Platform/Services/Tasks.php index 3ada193cf7..941530d7ed 100644 --- a/src/Appwrite/Platform/Services/Tasks.php +++ b/src/Appwrite/Platform/Services/Tasks.php @@ -4,6 +4,7 @@ namespace Appwrite\Platform\Services; use Appwrite\Platform\Tasks\Doctor; use Appwrite\Platform\Tasks\Install; +use Appwrite\Platform\Tasks\Interval; use Appwrite\Platform\Tasks\Maintenance; use Appwrite\Platform\Tasks\Migrate; use Appwrite\Platform\Tasks\QueueRetry; @@ -28,6 +29,7 @@ class Tasks extends Service $this ->addAction(Doctor::getName(), new Doctor()) ->addAction(Install::getName(), new Install()) + ->addAction(Interval::getName(), new Interval()) ->addAction(Maintenance::getName(), new Maintenance()) ->addAction(Migrate::getName(), new Migrate()) ->addAction(QueueRetry::getName(), new QueueRetry()) diff --git a/src/Appwrite/Platform/Tasks/Install.php b/src/Appwrite/Platform/Tasks/Install.php index b210a020b9..e51ea3188a 100644 --- a/src/Appwrite/Platform/Tasks/Install.php +++ b/src/Appwrite/Platform/Tasks/Install.php @@ -148,11 +148,63 @@ class Install extends Action $httpsPort = ($httpsPort) ? $httpsPort : $defaultHTTPSPort; } + $enableAssistant = false; + $assistantExistsInOldCompose = false; + + if ($data !== false && isset($compose)) { + try { + $assistantService = $compose->getService('appwrite-assistant'); + $assistantExistsInOldCompose = $assistantService !== null; + } catch (\Throwable) { + // assistant service doesn't exist, keep default false + } + } + + if ($interactive == 'Y' && Console::isInteractive()) { + $prompt = 'Add Appwrite Assistant? (Y/n)' . ($assistantExistsInOldCompose ? ' [Currently enabled]' : ''); + $answer = Console::confirm($prompt); + + if (empty($answer)) { + $enableAssistant = $assistantExistsInOldCompose; + } else { + $enableAssistant = \strtolower($answer) === 'y'; + } + } elseif ($assistantExistsInOldCompose) { + $enableAssistant = true; + } + $input = []; $password = new Password(); $token = new Token(); foreach ($vars as $var) { + if ($var['name'] === '_APP_ASSISTANT_OPENAI_API_KEY') { + if (!$enableAssistant) { + $input[$var['name']] = ''; + continue; + } + + // key already exists + if (!empty($var['default'])) { + $input[$var['name']] = $var['default']; + continue; + } + + // if assistant enabled and no key, ask for it + if (Console::isInteractive() && $interactive === 'Y') { + $input[$var['name']] = Console::confirm('Enter your OpenAI API key for Appwrite Assistant:'); + if (empty($input[$var['name']])) { + Console::warning('No API key provided. Assistant will be disabled.'); + $enableAssistant = false; + $input[$var['name']] = ''; + } + continue; + } + + $input[$var['name']] = ''; + continue; + } + if (!empty($var['filter']) && ($interactive !== 'Y' || !Console::isInteractive())) { if ($data && $var['default'] !== null) { $input[$var['name']] = $var['default']; @@ -199,7 +251,8 @@ class Install extends Action ->setParam('httpsPort', $httpsPort) ->setParam('version', APP_VERSION_STABLE) ->setParam('organization', $organization) - ->setParam('image', $image); + ->setParam('image', $image) + ->setParam('enableAssistant', $enableAssistant); $templateForEnv->setParam('vars', $input); diff --git a/src/Appwrite/Platform/Tasks/Interval.php b/src/Appwrite/Platform/Tasks/Interval.php new file mode 100644 index 0000000000..0985447c2e --- /dev/null +++ b/src/Appwrite/Platform/Tasks/Interval.php @@ -0,0 +1,126 @@ +desc('Schedules tasks on regular intervals by publishing them to our queues') + ->inject('dbForPlatform') + ->inject('getProjectDB') + ->inject('queueForCertificates') + ->callback($this->action(...)); + } + + public function action(Database $dbForPlatform, callable $getProjectDB, Certificate $queueForCertificates): void + { + Console::title('Interval V1'); + Console::success(APP_NAME . ' interval process v1 has started'); + + $intervalDomainVerification = (int) System::getEnv('_APP_INTERVAL_DOMAIN_VERIFICATION', '60'); // 1 minute + $intervalCleanupStaleExecutions = (int) System::getEnv('_APP_INTERVAL_CLEANUP_STALE_EXECUTIONS', '300'); // 5 minutes + + \go(function () use ($dbForPlatform, $queueForCertificates, $intervalDomainVerification) { + Console::loop(function () use ($dbForPlatform, $queueForCertificates) { + $this->verifyDomain($dbForPlatform, $queueForCertificates); + }, $intervalDomainVerification); + }); + + \go(function () use ($dbForPlatform, $getProjectDB, $intervalCleanupStaleExecutions) { + Console::loop(function () use ($dbForPlatform, $getProjectDB) { + $this->cleanupStaleExecutions($dbForPlatform, $getProjectDB); + }, $intervalCleanupStaleExecutions); + }); + } + + private function verifyDomain(Database $dbForPlatform, Certificate $queueForCertificates): void + { + $time = DatabaseDateTime::now(); + $fromTime = new DateTime('-3 days'); // Max 3 days old + + $rules = $dbForPlatform->find('rules', [ + Query::createdAfter(DatabaseDateTime::format($fromTime)), + Query::equal('status', [RULE_STATUS_CREATED]), // Created but not verified yet + Query::orderAsc('$updatedAt'), // Pick the ones waiting for another attempt for longest + Query::equal('region', [System::getEnv('_APP_REGION', 'default')]), // Only current region + Query::limit(30), // Reasonable pagination limit, processable within a minute + ]); + + if (\count($rules) === 0) { + Console::info("[{$time}] No rules for domain verification."); + return; // No rules to verify + } + + Console::info("[{$time}] Found " . \count($rules) . " rules for domain verification, scheduling jobs."); + + foreach ($rules as $rule) { + $queueForCertificates + ->setDomain(new Document([ + 'domain' => $rule->getAttribute('domain'), + 'domainType' => $rule->getAttribute('deploymentResourceType', $rule->getAttribute('type')), + ])) + ->setAction(Certificate::ACTION_DOMAIN_VERIFICATION) + ->trigger(); + } + } + + private function cleanupStaleExecutions(Database $dbForPlatform, callable $getProjectDB): void + { + $time = DatabaseDateTime::now(); + $staleThreshold = DatabaseDateTime::addSeconds(new DateTime(), -1200); // 20 minutes ago + + Console::info("[{$time}] Starting cleanup of stale executions"); + + $dbForPlatform->foreach( + 'projects', + function (Document $project) use ($getProjectDB, $time, $staleThreshold) { + try { + $dbForProject = $getProjectDB($project); + + $staleExecutions = $dbForProject->find('executions', [ + Query::equal('status', ['processing']), + Query::lessThan('$createdAt', $staleThreshold), + Query::limit(100), + ]); + + if (\count($staleExecutions) === 0) { + return; + } + + Console::info("[{$time}] Found " . \count($staleExecutions) . " stale executions in project {$project->getId()}"); + + foreach ($staleExecutions as $execution) { + $execution->setAttribute('status', 'failed'); + $execution->setAttribute('errors', 'Execution timed out'); + $dbForProject->updateDocument('executions', $execution->getId(), $execution); + } + } catch (\Throwable $th) { + Console::error("[{$time}] Failed to cleanup stale executions for project {$project->getId()}: " . $th->getMessage()); + } + }, + [ + Query::equal('region', [System::getEnv('_APP_REGION', 'default')]), + Query::limit(100), + ] + ); + + Console::info("[{$time}] Completed cleanup of stale executions"); + } +} diff --git a/src/Appwrite/Platform/Tasks/Maintenance.php b/src/Appwrite/Platform/Tasks/Maintenance.php index 9c88bc4d4e..c0914c6544 100644 --- a/src/Appwrite/Platform/Tasks/Maintenance.php +++ b/src/Appwrite/Platform/Tasks/Maintenance.php @@ -125,33 +125,36 @@ class Maintenance extends Action Query::limit(200), // Limit 200 comes from LetsEncrypt (300 orders per 3 hours, keeping some for new domains) ]); + if (\count($certificates) === 0) { + Console::info("[{$time}] No certificates for renewal."); + return; + } - if (\count($certificates) > 0) { - Console::info("[{$time}] Found " . \count($certificates) . " certificates for renewal, scheduling jobs."); + Console::info("[{$time}] Found " . \count($certificates) . " certificates for renewal, scheduling jobs."); - // TODO: (@Meldiron) Remove after 1.7.x migration - $isMd5 = System::getEnv('_APP_RULES_FORMAT') === 'md5'; + $isMd5 = System::getEnv('_APP_RULES_FORMAT') === 'md5'; + $appRegion = System::getEnv('_APP_REGION', 'default'); - foreach ($certificates as $certificate) { - $domain = $certificate->getAttribute('domain'); - $rule = $isMd5 - ? $dbForPlatform->getDocument('rules', md5($domain)) - : $dbForPlatform->findOne('rules', [ + foreach ($certificates as $certificate) { + $domain = $certificate->getAttribute('domain'); + $rule = $isMd5 ? + $dbForPlatform->getDocument('rules', md5($domain)) : + $dbForPlatform->findOne('rules', [ Query::equal('domain', [$domain]), + Query::limit(1) ]); - if ($rule->isEmpty() || $rule->getAttribute('region') !== System::getEnv('_APP_REGION', 'default')) { - continue; - } - - $queueForCertificate - ->setDomain(new Document([ - 'domain' => $certificate->getAttribute('domain') - ])) - ->trigger(); + if ($rule->isEmpty() || $rule->getAttribute('region') !== $appRegion) { + continue; } - } else { - Console::info("[{$time}] No certificates for renewal."); + + $queueForCertificate + ->setDomain(new Document([ + 'domain' => $rule->getAttribute('domain'), + 'domainType' => $rule->getAttribute('deploymentResourceType', $rule->getAttribute('type')), + ])) + ->setAction(Certificate::ACTION_GENERATION) + ->trigger(); } } diff --git a/src/Appwrite/Platform/Tasks/SDKs.php b/src/Appwrite/Platform/Tasks/SDKs.php index 70def20328..013fae1193 100644 --- a/src/Appwrite/Platform/Tasks/SDKs.php +++ b/src/Appwrite/Platform/Tasks/SDKs.php @@ -12,6 +12,7 @@ use Appwrite\SDK\Language\Flutter; use Appwrite\SDK\Language\Go; use Appwrite\SDK\Language\GraphQL; use Appwrite\SDK\Language\Kotlin; +use Appwrite\SDK\Language\Markdown; use Appwrite\SDK\Language\Node; use Appwrite\SDK\Language\PHP; use Appwrite\SDK\Language\Python; @@ -31,11 +32,37 @@ use Utopia\Validator\WhiteList; class SDKs extends Action { + protected array $supportedSDKS = [ + 'web', + 'cli', + 'php', + 'nodejs', + 'deno', + 'python', + 'ruby', + 'flutter', + 'react-native', + 'dart', + 'go', + 'swift', + 'apple', + 'dotnet', + 'android', + 'graphql', + 'rest', + 'markdown', + ]; + public static function getName(): string { return 'sdks'; } + public static function getPlatforms(): array + { + return Specs::getPlatforms(); + } + public function __construct() { $this @@ -44,7 +71,6 @@ class SDKs extends Action ->param('sdk', null, new Nullable(new Text(256)), 'Selected SDK', optional: true) ->param('version', null, new Nullable(new Text(256)), 'Selected SDK', optional: true) ->param('git', null, new Nullable(new WhiteList(['yes', 'no'])), 'Should we use git push?', optional: true) - ->param('production', null, new Nullable(new WhiteList(['yes', 'no'])), 'Should we push to production?', optional: true) ->param('message', null, new Nullable(new Text(256)), 'Commit Message', optional: true) ->param('release', null, new Nullable(new WhiteList(['yes', 'no'])), 'Should we create releases?', optional: true) ->param('commit', null, new Nullable(new WhiteList(['yes', 'no'])), 'Actually create releases (yes) or dry-run (no)?', optional: true) @@ -52,11 +78,14 @@ class SDKs extends Action ->callback($this->action(...)); } - public function action(?string $selectedPlatform, ?string $selectedSDK, ?string $version, ?string $git, ?string $production, ?string $message, ?string $release, ?string $commit, ?string $sdks): void + public function action(?string $selectedPlatform, ?string $selectedSDK, ?string $version, ?string $git, ?string $message, ?string $release, ?string $commit, ?string $sdks): void { if (!$sdks) { - $selectedPlatform ??= Console::confirm('Choose Platform ("' . APP_SDK_PLATFORM_CLIENT . '", "' . APP_SDK_PLATFORM_SERVER . '", "' . APP_SDK_PLATFORM_CONSOLE . '" or "*" for all):'); + $selectedPlatform ??= Console::confirm('Choose Platform ("' . implode('", "', static::getPlatforms()) . '" or "*" for all):'); $selectedSDK ??= \strtolower(Console::confirm('Choose SDK ("*" for all):')); + if ($selectedSDK !== '*' && !\in_array($selectedSDK, $this->supportedSDKS)) { + throw new \Exception('Unknown SDK "' . $selectedSDK . '" given. Options are: ' . implode(', ', $this->supportedSDKS)); + } } else { $sdks = explode(',', $sdks); } @@ -70,15 +99,9 @@ class SDKs extends Action $git = ($git === 'yes'); $prUrls = []; - $createPr = false; if ($git) { - $production ??= Console::confirm('Type "Appwrite" to push code to production git repos'); - $production = $production === 'Appwrite'; $message ??= Console::confirm('Please enter your commit message:'); - - $createPr = Console::confirm('Should we create pull request automatically? (yes/no)'); - $createPr = ($createPr === 'yes'); } } @@ -133,7 +156,7 @@ class SDKs extends Action $target = \realpath(__DIR__ . '/../../../../app') . '/sdks/git/' . $language['key'] . '/'; $readme = \realpath(__DIR__ . '/../../../../docs/sdks/' . $language['key'] . '/README.md'); $readme = ($readme) ? \file_get_contents($readme) : ''; - $gettingStarted = \realpath(__DIR__ . '/../../../../docs/sdks/' . $language['key'] . '/GETTING_STARTED.md'); + $gettingStarted = $language['gettingStarted'] ?? \realpath(__DIR__ . '/../../../../docs/sdks/' . $language['key'] . '/GETTING_STARTED.md'); $gettingStarted = ($gettingStarted) ? \file_get_contents($gettingStarted) : ''; $examples = \realpath(__DIR__ . '/../../../../docs/sdks/' . $language['key'] . '/EXAMPLES.md'); $examples = ($examples) ? \file_get_contents($examples) : ''; @@ -188,8 +211,8 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND break; case 'php': $config = new PHP(); - $config->setComposerVendor('appwrite'); - $config->setComposerPackage('appwrite'); + $config->setComposerVendor($language['composerVendor'] ?? 'appwrite'); + $config->setComposerPackage($language['composerPackage'] ?? 'appwrite'); break; case 'nodejs': $config = new Node(); @@ -254,6 +277,10 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND case 'rest': $config = new REST(); break; + case 'markdown': + $config = new Markdown(); + $config->setNPMPackage('@appwrite.io/docs'); + break; default: throw new \Exception('Language "' . $language['key'] . '" not supported'); } @@ -374,9 +401,9 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND $sdk ->setName($language['name']) - ->setNamespace('io appwrite') - ->setDescription("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 {$language['name']} 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)") - ->setShortDescription('Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API') + ->setNamespace($language['namespace'] ?? 'appwrite') + ->setDescription($language['description'] ?? "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 {$language['name']} 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)") + ->setShortDescription($language['shortDescription'] ?? 'Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API') ->setLicense($license) ->setLicenseContent($licenseContent) ->setVersion($language['version']) @@ -401,7 +428,8 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ->setDefaultHeaders([ 'X-Appwrite-Response-Format' => '1.8.0', ]) - ->setExclude($language['exclude'] ?? []); + ->setExclude($language['exclude'] ?? []) + ->setTest(false); // Make sure we have a clean slate. // Otherwise, all files in this dir will be pushed, @@ -417,10 +445,6 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND $gitUrl = $language['gitUrl']; $gitBranch = $language['gitBranch']; - if (!$production) { - $gitUrl = 'git@github.com:aw-tests/' . $language['gitRepoName'] . '.git'; - } - $repoBranch = $language['repoBranch'] ?? 'main'; if ($git && !empty($gitUrl)) { \exec('rm -rf ' . $target . ' && \ @@ -440,23 +464,17 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND git rm -rf --cached . && \ git clean -fdx -e .git -e .github && \ cp -r ' . $result . '/. ' . $target . '/ && \ - (test -d /tmp/.github-backup-$$ && cp -r /tmp/.github-backup-$$/.github . && rm -rf /tmp/.github-backup-$$ || true) && \ + (test -d /tmp/.github-backup-$$ && cp -rn /tmp/.github-backup-$$/.github . && rm -rf /tmp/.github-backup-$$ || true) && \ git add -A && \ git commit -m "' . $message . '" && \ git push -u origin ' . $gitBranch . ' '); Console::success("Pushed {$language['name']} SDK to {$gitUrl}"); - if ($createPr) { + if ($git) { $prTitle = "feat: {$language['name']} SDK update for version {$language['version']}"; $prBody = "This PR contains updates to the {$language['name']} SDK for version {$language['version']}."; - - $repoName = $language['gitRepoName']; - if (!$production) { - $repoName = 'aw-tests/' . $language['gitRepoName']; - } else { - $repoName = $language['gitUserName'] . '/' . $language['gitRepoName']; - } + $repoName = $language['gitUserName'] . '/' . $language['gitRepoName']; Console::info("Creating pull request for {$language['name']} SDK..."); diff --git a/src/Appwrite/Platform/Tasks/Specs.php b/src/Appwrite/Platform/Tasks/Specs.php index 7869c14471..c64e1b49d4 100644 --- a/src/Appwrite/Platform/Tasks/Specs.php +++ b/src/Appwrite/Platform/Tasks/Specs.php @@ -66,7 +66,7 @@ class Specs extends Action * * @return array */ - protected function getPlatforms(): array + public static function getPlatforms(): array { return [ APP_SDK_PLATFORM_CLIENT, @@ -199,6 +199,12 @@ class Specs extends Action 'description' => '', 'in' => 'header', ], + 'Cookie' => [ + 'type' => 'apiKey', + 'name' => 'Cookie', + 'description' => 'The user cookie to authenticate with', + 'in' => 'header', + ], ], ]; } @@ -239,7 +245,7 @@ class Specs extends Action App::setResource('dbForPlatform', fn () => new Database(new MySQL(''), new Cache(new None()))); App::setResource('dbForProject', fn () => new Database(new MySQL(''), new Cache(new None()))); - $platforms = $this->getPlatforms(); + $platforms = static::getPlatforms(); $authCounts = $this->getAuthCounts(); $keys = $this->getKeys(); diff --git a/src/Appwrite/Platform/Workers/Audits.php b/src/Appwrite/Platform/Workers/Audits.php index be542e7811..91dbb7cb00 100644 --- a/src/Appwrite/Platform/Workers/Audits.php +++ b/src/Appwrite/Platform/Workers/Audits.php @@ -4,7 +4,6 @@ namespace Appwrite\Platform\Workers; use Exception; use Throwable; -use Utopia\Audit\Audit; use Utopia\CLI\Console; use Utopia\Database\Document; use Utopia\Database\Exception\Authorization; @@ -42,8 +41,8 @@ class Audits extends Action $this ->desc('Audits worker') ->inject('message') - ->inject('getProjectDB') ->inject('project') + ->inject('getAudit') ->callback($this->action(...)); $this->lastTriggeredTime = time(); @@ -54,13 +53,14 @@ class Audits extends Action * @param Message $message * @param callable $getProjectDB * @param Document $project + * @param callable $getAudit * @return Commit|NoCommit * @throws Throwable * @throws \Utopia\Database\Exception * @throws Authorization * @throws Structure */ - public function action(Message $message, callable $getProjectDB, Document $project): Commit|NoCommit + public function action(Message $message, Document $project, callable $getAudit): Commit|NoCommit { $payload = $message->getPayload() ?? []; @@ -102,7 +102,7 @@ class Audits extends Action 'mode' => $mode, 'data' => $auditPayload, ], - 'timestamp' => date("Y-m-d H:i:s", $message->getTimestamp()), + 'time' => date("Y-m-d H:i:s", $message->getTimestamp()), ]; if (isset($this->logs[$project->getSequence()])) { @@ -135,8 +135,7 @@ class Audits extends Action Console::log('Processing Project "' . $sequence . '" batch with ' . count($projectLogs['logs']) . ' events'); $projectDocument = $projectLogs['project']; - $dbForProject = $getProjectDB($projectDocument); - $audit = new Audit($dbForProject); + $audit = $getAudit($projectDocument); $audit->logBatch($projectLogs['logs']); Console::success('Audit logs processed successfully'); diff --git a/src/Appwrite/Platform/Workers/Certificates.php b/src/Appwrite/Platform/Workers/Certificates.php index 9dc6322163..bfa6bf87c7 100644 --- a/src/Appwrite/Platform/Workers/Certificates.php +++ b/src/Appwrite/Platform/Workers/Certificates.php @@ -3,12 +3,14 @@ namespace Appwrite\Platform\Workers; use Appwrite\Certificates\Adapter as CertificatesAdapter; +use Appwrite\Event\Certificate; use Appwrite\Event\Event; use Appwrite\Event\Func; use Appwrite\Event\Mail; use Appwrite\Event\Realtime; use Appwrite\Event\Webhook; -use Appwrite\Network\Validator\DNS; +use Appwrite\Extend\Exception as AppwriteException; +use Appwrite\Platform\Modules\Proxy\Action; use Appwrite\Template\Template; use Appwrite\Utopia\Response\Model\Rule; use Exception; @@ -19,18 +21,16 @@ use Utopia\Database\DateTime; use Utopia\Database\Document; use Utopia\Database\Exception\Authorization; use Utopia\Database\Exception\Conflict; +use Utopia\Database\Exception\NotFound; use Utopia\Database\Exception\Structure; use Utopia\Database\Helpers\ID; use Utopia\Database\Query; -use Utopia\DNS\Message\Record; +use Utopia\Database\Validator\Authorization as ValidatorAuthorization; use Utopia\Domains\Domain; use Utopia\Locale\Locale; use Utopia\Logger\Log; -use Utopia\Platform\Action; use Utopia\Queue\Message; use Utopia\System\System; -use Utopia\Validator\AnyOf; -use Utopia\Validator\IP; class Certificates extends Action { @@ -42,8 +42,10 @@ class Certificates extends Action /** * @throws Exception */ - public function __construct() + public function __construct(...$params) { + parent::__construct(...$params); + $this ->desc('Certificates worker') ->inject('message') @@ -53,9 +55,11 @@ class Certificates extends Action ->inject('queueForWebhooks') ->inject('queueForFunctions') ->inject('queueForRealtime') + ->inject('queueForCertificates') ->inject('log') ->inject('certificates') ->inject('plan') + ->inject('authorization') ->callback($this->action(...)); } @@ -67,8 +71,11 @@ class Certificates extends Action * @param Webhook $queueForWebhooks * @param Func $queueForFunctions * @param Realtime $queueForRealtime + * @param Certificate $queueForCertificates * @param Log $log * @param CertificatesAdapter $certificates + * @param array $plan + * @param ValidatorAuthorization $authorization * @return void * @throws Throwable * @throws \Utopia\Database\Exception @@ -81,9 +88,11 @@ class Certificates extends Action Webhook $queueForWebhooks, Func $queueForFunctions, Realtime $queueForRealtime, + Certificate $queueForCertificates, Log $log, CertificatesAdapter $certificates, - array $plan + array $plan, + ValidatorAuthorization $authorization, ): void { $payload = $message->getPayload() ?? []; @@ -93,14 +102,99 @@ class Certificates extends Action $document = new Document($payload['domain'] ?? []); $domain = new Domain($document->getAttribute('domain', '')); + $domainType = $document->getAttribute('domainType'); $skipRenewCheck = $payload['skipRenewCheck'] ?? false; $validationDomain = $payload['validationDomain'] ?? null; + $action = $payload['action'] ?? Certificate::ACTION_GENERATION; $log->addTag('domain', $domain->get()); - $domainType = $document->getAttribute('domainType'); + switch ($action) { + case Certificate::ACTION_DOMAIN_VERIFICATION: + $this->handleDomainVerificationAction($domain, $dbForPlatform, $queueForEvents, $queueForWebhooks, $queueForFunctions, $queueForRealtime, $queueForCertificates, $log, $authorization, $validationDomain); + break; - $this->execute($domain, $domainType, $dbForPlatform, $queueForMails, $queueForEvents, $queueForWebhooks, $queueForFunctions, $queueForRealtime, $log, $certificates, $skipRenewCheck, $plan, $validationDomain); + case Certificate::ACTION_GENERATION: + $this->handleCertificateGenerationAction($domain, $domainType, $dbForPlatform, $queueForMails, $queueForEvents, $queueForWebhooks, $queueForFunctions, $queueForRealtime, $log, $certificates, $authorization, $skipRenewCheck, $plan, $validationDomain); + break; + + default: + throw new Exception('Invalid action: ' . $action); + } + } + + /** + * @param Domain $domain + * @param Database $dbForPlatform + * @param Event $queueForEvents + * @param Webhook $queueForWebhooks + * @param Func $queueForFunctions + * @param Realtime $queueForRealtime + * @param Certificate $queueForCertificates + * @param Log $log + * @param ValidatorAuthorization $authorization + * @param string|null $validationDomain + * @return void + * @throws \Utopia\Database\Exception + * @throws NotFound + * @throws \Utopia\Database\Exception\Query + */ + private function handleDomainVerificationAction( + Domain $domain, + Database $dbForPlatform, + Event $queueForEvents, + Webhook $queueForWebhooks, + Func $queueForFunctions, + Realtime $queueForRealtime, + Certificate $queueForCertificates, + Log $log, + ValidatorAuthorization $authorization, + ?string $validationDomain = null + ): void { + // Get rule + $rule = System::getEnv('_APP_RULES_FORMAT') === 'md5' + ? $authorization->skip(fn () => $dbForPlatform->getDocument('rules', md5($domain->get()))) + : $authorization->skip(fn () => $dbForPlatform->findOne('rules', [ + Query::equal('domain', [$domain->get()]), + Query::limit(1), + ])); + + // Skip if rule is not desired state (created but not verified yet). + if ($rule->getAttribute('status', '') !== RULE_STATUS_CREATED) { + Console::warning('Domain verification for ' . $rule->getAttribute('domain', '') . ' is not needed.'); + return; + } + + Console::info('Domain verification for ' . $rule->getAttribute('domain', '') . ' started.'); + + try { + // Verify DNS records + $this->validateDomain($rule, $domain, $log, $validationDomain); + // Reset logs and status for the rule + $rule->setAttribute('logs', ''); + $rule->setAttribute('status', RULE_STATUS_CERTIFICATE_GENERATING); + + Console::success('Domain verification succeeded.'); + } catch (AppwriteException $err) { + Console::warning('Domain verification failed: ' . $err->getMessage()); + $rule->setAttribute('logs', $err->getMessage()); + } finally { + // Update rule and emit events + $this->updateRuleAndSendEvents($rule, $dbForPlatform, $queueForEvents, $queueForWebhooks, $queueForFunctions, $queueForRealtime); + } + + // Issue a TLS certificate when domain is verified + if ($rule->getAttribute('status', '') === RULE_STATUS_CERTIFICATE_GENERATING) { + $queueForCertificates + ->setDomain(new Document([ + 'domain' => $rule->getAttribute('domain'), + 'domainType' => $rule->getAttribute('deploymentResourceType', $rule->getAttribute('type')), + ])) + ->setAction(Certificate::ACTION_GENERATION) + ->trigger(); + + Console::success('Certificate generation triggered successfully.'); + } } /** @@ -109,17 +203,25 @@ class Certificates extends Action * @param Database $dbForPlatform * @param Mail $queueForMails * @param Event $queueForEvents + * @param Webhook $queueForWebhooks * @param Func $queueForFunctions * @param Realtime $queueForRealtime + * @param Log $log * @param CertificatesAdapter $certificates + * @param ValidatorAuthorization $authorization * @param bool $skipRenewCheck * @param array $plan * @param string|null $validationDomain * @return void + * @throws Authorization + * @throws Conflict + * @throws NotFound + * @throws Structure * @throws Throwable * @throws \Utopia\Database\Exception + * @throws \Utopia\Database\Exception\Query */ - private function execute( + private function handleCertificateGenerationAction( Domain $domain, ?string $domainType, Database $dbForPlatform, @@ -130,6 +232,7 @@ class Certificates extends Action Realtime $queueForRealtime, Log $log, CertificatesAdapter $certificates, + ValidatorAuthorization $authorization, bool $skipRenewCheck = false, array $plan = [], ?string $validationDomain = null @@ -163,26 +266,42 @@ class Certificates extends Action * Note: Renewals are checked and scheduled from maintenance worker */ - // Get current certificate - $certificate = $dbForPlatform->findOne('certificates', [Query::equal('domain', [$domain->get()])]); + // Get rule document for domain + // TODO: (@Meldiron) Remove after 1.7.x migration + $rule = System::getEnv('_APP_RULES_FORMAT') === 'md5' + ? $authorization->skip(fn () => $dbForPlatform->getDocument('rules', md5($domain->get()))) + : $authorization->skip(fn () => $dbForPlatform->findOne('rules', [ + Query::equal('domain', [$domain->get()]), + Query::limit(1), + ])); - // If we don't have certificate for domain yet, let's create new document. At the end we save it + // Rule not found (or) not in the expected state + if ($rule->isEmpty() || !\in_array($rule->getAttribute('status'), [RULE_STATUS_CERTIFICATE_GENERATING, RULE_STATUS_VERIFIED])) { + Console::warning('Certificate generation for ' . $domain->get() . ' is skipped as the associated rule is either empty or not in the expected state.'); + return; + } + + // Get associated certificate for the rule + $certificate = $dbForPlatform->getDocument('certificates', $rule->getAttribute('certificateId') ?? ''); + + // If we don't have certificate for the rule yet, let's create one. if ($certificate->isEmpty()) { $certificate = new Document(); $certificate->setAttribute('domain', $domain->get()); } - $success = false; - try { $date = \date('H:i:s'); $certificate->setAttribute('logs', "\033[90m[{$date}] \033[97mCertificate generation started. \033[0m\n"); + // Persist ASAP so that logs are reset in retry flow and user can see the latest logs on Console. + $certificate = $this->upsertCertificate($rule, $certificate, $dbForPlatform); + // Ensure certificate is associated with the rule + $rule->setAttribute('certificateId', $certificate->getId()); + // Validate domain and DNS records. Skip if job is forced if (!$skipRenewCheck) { - $mainDomain = $validationDomain ?? $this->getMainDomain(); - $isMainDomain = !isset($mainDomain) || $domain->get() === $mainDomain; - $this->validateDomain($domain, $isMainDomain, $log); + $this->validateDomain($rule, $domain, $log, $validationDomain); // If certificate exists already, double-check expiry date. Skip if job is forced if (!$certificates->isRenewRequired($domain->get(), $domainType, $log)) { @@ -191,85 +310,171 @@ class Certificates extends Action } } - // Prepare unique cert name. Using this helps prevent miss-match in configuration when renewing certificates. + // Prepare unique cert name. Using this helps prevent mismatch in configuration when renewing certificates. $certName = ID::unique(); $renewDate = $certificates->issueCertificate($certName, $domain->get(), $domainType); - // Command succeeded, store all data into document - $certificate->setAttribute('logs', 'Certificate successfully generated.'); + // If certificate is generated instantly, we can mark the rule as 'verified'. + if ($certificates->isInstantGeneration($domain->get(), $domainType)) { + $rule->setAttribute('status', RULE_STATUS_VERIFIED); + $certificate->setAttribute('logs', 'Certificate successfully generated.'); + } - // Update certificate info stored in database - $certificate->setAttribute('renewDate', $renewDate); - $certificate->setAttribute('attempts', 0); - $certificate->setAttribute('issueDate', DateTime::now()); - $success = true; + $certificate->setAttributes([ + 'attempts' => 0, // Reset attempts count + 'issueDate' => DateTime::now(), // Store current time as issue date + 'renewDate' => $renewDate, + ]); } catch (Throwable $e) { $logs = $e->getMessage(); $currentLogs = $certificate->getAttribute('logs', ''); $date = \date('H:i:s'); $errorMessage = "\033[90m[{$date}] \033[31mCertificate generation failed: \033[0m\n"; - $certificate->setAttribute('logs', $currentLogs . $errorMessage . \mb_strcut($logs, 0, 500000));// Limit to 500kb + $attempts = $certificate->getAttribute('attempts', 0) + 1; // Increase attempts count - // Increase attempts count - $attempts = $certificate->getAttribute('attempts', 0) + 1; - $certificate->setAttribute('attempts', $attempts); + // Update attributes on certificate document + $certificate->setAttributes([ + 'logs' => $currentLogs . $errorMessage . \mb_strcut($logs, 0, 500000), // Limit to 500kb + 'attempts' => $attempts, + 'renewDate' => DateTime::now(), // Store current time as renew date to ensure another attempt in next maintenance cycle. + ]); - // Store current time as renew date to ensure another attempt in next maintenance cycle. - $certificate->setAttribute('renewDate', DateTime::now()); + // Mark rule as 'unverified' + $rule->setAttribute('status', RULE_STATUS_CERTIFICATE_GENERATION_FAILED); // Send email to security email $this->notifyError($domain->get(), $e->getMessage(), $attempts, $queueForMails, $plan); throw $e; } finally { - // All actions result in new updatedAt date + // All actions result in new 'updated' date $certificate->setAttribute('updated', DateTime::now()); + // Save certificate document to database + $this->upsertCertificate($rule, $certificate, $dbForPlatform); - // Save all changes we made to certificate document into database - $this->saveCertificateDocument($domain->get(), $certificate, $success, $dbForPlatform, $queueForEvents, $queueForWebhooks, $queueForFunctions, $queueForRealtime); + // Ensure certificate is associated with the rule + $rule->setAttribute('certificateId', $certificate->getId()); + // Update rule and emit events + $this->updateRuleAndSendEvents($rule, $dbForPlatform, $queueForEvents, $queueForWebhooks, $queueForFunctions, $queueForRealtime); } } /** - * Save certificate data into database. + * Save certificate data to database. * - * @param string $domain Domain name that certificate is for + * @param Document $rule Rule associated with the domain * @param Document $certificate Certificate document that we need to save - * @param bool $success * @param Database $dbForPlatform Database connection for console - * @param Event $queueForEvents - * @param Func $queueForFunctions - * @param Realtime $queueForRealtime - * @return void + * @return Document * @throws \Utopia\Database\Exception * @throws Authorization * @throws Conflict * @throws Structure */ - private function saveCertificateDocument( - string $domain, + private function upsertCertificate( + Document $rule, Document $certificate, - bool $success, + Database $dbForPlatform, + ): Document { + // Decide whether update (or) insert is needed + $existingCertificate = $dbForPlatform->getDocument('certificates', $rule->getAttribute('certificateId') ?? ''); + + if ($existingCertificate->isEmpty()) { + $certificate->removeAttribute('$sequence'); + $certificate = $dbForPlatform->createDocument('certificates', $certificate); + } else { + $certificate = new Document(\array_merge($existingCertificate->getArrayCopy(), $certificate->getArrayCopy())); + $certificate = $dbForPlatform->updateDocument('certificates', $certificate->getId(), $certificate); + } + + return $certificate; + } + + /** + * Update all existing domain documents so they have relation to correct certificate document. + * This solves issues: + * - when adding a domain for which there is already a certificate + * - when renew creates new document? It might? + * - overall makes it more reliable + * + * @param Document $rule Rule document that is affected by new certificate + * @param Database $dbForPlatform Database connection for console + * @param Event $queueForEvents Event publisher for events + * @param Webhook $queueForWebhooks Webhook publisher for webhooks + * @param Func $queueForFunctions Function publisher for functions + * @param Realtime $queueForRealtime Realtime publisher for realtime events + * + * @return void + */ + protected function updateRuleAndSendEvents( + Document $rule, Database $dbForPlatform, Event $queueForEvents, Webhook $queueForWebhooks, Func $queueForFunctions, Realtime $queueForRealtime ): void { - // Check if update or insert required - $certificateDocument = $dbForPlatform->findOne('certificates', [Query::equal('domain', [$domain])]); - if (!$certificateDocument->isEmpty()) { - // Merge new data with current data - $certificate = new Document(\array_merge($certificateDocument->getArrayCopy(), $certificate->getArrayCopy())); - $certificate = $dbForPlatform->updateDocument('certificates', $certificate->getId(), $certificate); - } else { - $certificate->removeAttribute('$sequence'); - $certificate = $dbForPlatform->createDocument('certificates', $certificate); + $rule = $dbForPlatform->updateDocument('rules', $rule->getId(), $rule); + $projectId = $rule->getAttribute('projectId'); + + // Skip events for console project (triggered by auto-ssl generation for 1 click setups) + if ($projectId === 'console') { + return; } - $certificateId = $certificate->getId(); - $this->updateDomainDocuments($certificateId, $domain, $success, $dbForPlatform, $queueForEvents, $queueForWebhooks, $queueForFunctions, $queueForRealtime); + $project = $dbForPlatform->getDocument('projects', $projectId); + if ($project->isEmpty()) { + return; + } + + $ruleModel = new Rule(); + $queueForEvents + ->setProject($project) + ->setEvent('rules.[ruleId].update') + ->setParam('ruleId', $rule->getId()) + ->setPayload($rule->getArrayCopy(array_keys($ruleModel->getRules()))); + + /** Trigger Webhook */ + $queueForWebhooks + ->from($queueForEvents) + ->trigger(); + + /** Trigger Functions */ + $queueForFunctions + ->from($queueForEvents) + ->trigger(); + + /** Trigger Realtime Events */ + $queueForRealtime + ->setSubscribers(['console', $projectId]) + ->from($queueForEvents) + ->trigger(); + } + + /** + * Internal domain validation functionality to prevent unnecessary attempts. We check: + * - Domain needs to be public and valid (prevents NFT domains that are not supported) + * - Domain must have proper DNS record + * + * @param Document $rule Rule to validate + * @param Domain $domain Domain to validate + * @param Log $log Logger for adding metrics + * @param string|null $validationDomain Override for main domain check + * + * @return void + * @throws Exception + */ + private function validateDomain(Document $rule, Domain $domain, Log $log, ?string $validationDomain = null): void + { + $mainDomain = $validationDomain ?? $this->getMainDomain(); + $isMainDomain = !isset($mainDomain) || $domain->get() === $mainDomain; + if (!$isMainDomain) { + $this->verifyRule($rule, $log); + } else { + // Main domain validation + // TODO: Would be awesome to check A/AAAA record here. Maybe dry run? + } } /** @@ -288,74 +493,7 @@ class Certificates extends Action } /** - * Internal domain validation functionality to prevent unnecessary attempts. We check: - * - Domain needs to be public and valid (prevents NFT domains that are not supported) - * - Domain must have proper DNS record - * - * @param Domain $domain Domain which we validate - * @param bool $isMainDomain In case of master domain, we look for different DNS configurations - * - * @return void - * @throws Exception - */ - private function validateDomain(Domain $domain, bool $isMainDomain, Log $log): void - { - if (empty($domain->get())) { - throw new Exception('Missing certificate domain.'); - } - - if (!$domain->isKnown() || $domain->isTest()) { - throw new Exception('Unknown public suffix for domain.'); - } - - if (!$isMainDomain) { - $validationStart = \microtime(true); - - $validators = []; - $targetCNAME = new Domain(System::getEnv('_APP_DOMAIN_TARGET_CNAME', '')); - if ($targetCNAME->isKnown() && !$targetCNAME->isTest()) { - $validators[] = new DNS($targetCNAME->get(), Record::TYPE_CNAME); - } - if ((new IP(IP::V4))->isValid(System::getEnv('_APP_DOMAIN_TARGET_A', ''))) { - $validators[] = new DNS(System::getEnv('_APP_DOMAIN_TARGET_A', ''), Record::TYPE_A); - } - if ((new IP(IP::V6))->isValid(System::getEnv('_APP_DOMAIN_TARGET_AAAA', ''))) { - $validators[] = new DNS(System::getEnv('_APP_DOMAIN_TARGET_AAAA', ''), Record::TYPE_AAAA); - } - - // Validate if domain target is properly configured - if (empty($validators)) { - throw new Exception('At least one of domain targets environment variable must be configured.'); - } - - // Verify domain with DNS records - $validator = new AnyOf($validators, AnyOf::TYPE_STRING); - if (!$validator->isValid($domain->get())) { - $log->addExtra('dnsTiming', \strval(\microtime(true) - $validationStart)); - $log->addTag('dnsDomain', $domain->get()); - throw new Exception('Failed to verify domain DNS records.'); - } - - // Ensure CAA won't block certificate issuance - if (!empty(System::getEnv('_APP_DOMAIN_TARGET_CAA', ''))) { - $validationStart = \microtime(true); - $validator = new DNS(System::getEnv('_APP_DOMAIN_TARGET_CAA', ''), Record::TYPE_CAA); - if (!$validator->isValid($domain->get())) { - $log->addExtra('dnsTimingCaa', \strval(\microtime(true) - $validationStart)); - $log->addTag('dnsDomain', $domain->get()); - $error = $validator->getDescription(); - $log->addExtra('dnsResponse', \is_array($error) ? \json_encode($error) : \strval($error)); - throw new Exception('Failed to verify domain DNS records. CAA records do not allow Appwrite\'s certificate issuer.'); - } - } - } else { - // Main domain validation - // TODO: Would be awesome to check A/AAAA record here. Maybe dry run? - } - } - - /** - * Method to make sure information about error is delivered to admnistrator. + * Method to make sure information about error is delivered to administrator. * * @param string $domain Domain that caused the error * @param string $errorMessage Verbose error message @@ -406,78 +544,4 @@ class Certificates extends Action ->setRecipient(System::getEnv('_APP_EMAIL_CERTIFICATES', System::getEnv('_APP_SYSTEM_SECURITY_EMAIL_ADDRESS'))) ->trigger(); } - - /** - * Update all existing domain documents so they have relation to correct certificate document. - * This solved issues: - * - when adding a domain for which there is already a certificate - * - when renew creates new document? It might? - * - overall makes it more reliable - * - * @param string $certificateId ID of a new or updated certificate document - * @param string $domain Domain that is affected by new certificate - * @param bool $success Was certificate generation successful? - * - * @return void - */ - private function updateDomainDocuments( - string $certificateId, - string $domain, - bool $success, - Database $dbForPlatform, - Event $queueForEvents, - Webhook $queueForWebhooks, - Func $queueForFunctions, - Realtime $queueForRealtime - ): void { - // TODO: (@Meldiron) Remove after 1.7.x migration - $isMd5 = System::getEnv('_APP_RULES_FORMAT') === 'md5'; - $rule = $isMd5 - ? $dbForPlatform->getDocument('rules', md5($domain)) - : $dbForPlatform->findOne('rules', [ - Query::equal('domain', [$domain]), - ]); - - if (!$rule->isEmpty()) { - $rule->setAttribute('certificateId', $certificateId); - $rule->setAttribute('status', $success ? 'verified' : 'unverified'); - $dbForPlatform->updateDocument('rules', $rule->getId(), $rule); - - $projectId = $rule->getAttribute('projectId'); - - // Skip events for console project (triggered by auto-ssl generation for 1 click setups) - if ($projectId === 'console') { - return; - } - - $project = $dbForPlatform->getDocument('projects', $projectId); - - if ($project->isEmpty()) { - return; - } - - $ruleModel = new Rule(); - $queueForEvents - ->setProject($project) - ->setEvent('rules.[ruleId].update') - ->setParam('ruleId', $rule->getId()) - ->setPayload($rule->getArrayCopy(array_keys($ruleModel->getRules()))); - - /** Trigger Webhook */ - $queueForWebhooks - ->from($queueForEvents) - ->trigger(); - - /** Trigger Functions */ - $queueForFunctions - ->from($queueForEvents) - ->trigger(); - - /** Trigger Realtime Events */ - $queueForRealtime - ->from($queueForEvents) - ->setSubscribers(['console', $projectId]) - ->trigger(); - } - } } diff --git a/src/Appwrite/Platform/Workers/Deletes.php b/src/Appwrite/Platform/Workers/Deletes.php index 247044f4c3..654b083a98 100644 --- a/src/Appwrite/Platform/Workers/Deletes.php +++ b/src/Appwrite/Platform/Workers/Deletes.php @@ -9,6 +9,7 @@ use Appwrite\Extend\Exception; use Executor\Executor; use Throwable; use Utopia\Abuse\Adapters\TimeLimit\Database as AbuseDatabase; +use Utopia\Audit\Adapter\SQL; use Utopia\Audit\Audit; use Utopia\Cache\Adapter\Filesystem; use Utopia\Cache\Cache; @@ -29,6 +30,8 @@ use Utopia\Queue\Message; use Utopia\Storage\Device; use Utopia\System\System; +use function Swoole\Coroutine\batch; + class Deletes extends Action { protected array $selects = ['$sequence', '$id', '$collection', '$permissions', '$updatedAt']; @@ -58,8 +61,10 @@ class Deletes extends Action ->inject('certificates') ->inject('executor') ->inject('executionRetention') + ->inject('executionsRetentionCount') ->inject('auditRetention') ->inject('log') + ->inject('getAudit') ->callback($this->action(...)); } @@ -81,8 +86,10 @@ class Deletes extends Action CertificatesAdapter $certificates, Executor $executor, string $executionRetention, + int $executionsRetentionCount, string $auditRetention, - Log $log + Log $log, + callable $getAudit, ): void { $payload = $message->getPayload() ?? []; @@ -141,9 +148,22 @@ class Deletes extends Action case DELETE_TYPE_EXECUTIONS: $this->deleteExecutionLogs($project, $getProjectDB, $executionRetention); break; + case DELETE_TYPE_EXECUTIONS_LIMIT: + $resourceInternalId = $payload['resource'] ?? null; + $resourceType = $payload['resourceType'] ?? null; + if ($resourceInternalId) { + $this->deleteExecutionsByLimit( + $project, + $getProjectDB, + $executionsRetentionCount, + $resourceInternalId, + $resourceType + ); + } + break; case DELETE_TYPE_AUDIT: if (!$project->isEmpty()) { - $this->deleteAuditLogs($project, $getProjectDB, $auditRetention); + $this->deleteAuditLogs($project, $getAudit, $auditRetention); } break; case DELETE_TYPE_REALTIME: @@ -181,8 +201,8 @@ class Deletes extends Action break; case DELETE_TYPE_MAINTENANCE: $this->deleteExpiredTargets($project, $getProjectDB); - $this->deleteExecutionLogs($project, $getProjectDB, $executionRetention); - $this->deleteAuditLogs($project, $getProjectDB, $auditRetention); + $this->deleteExecutionLogs($project, $getProjectDB, $executionRetention, $executionsRetentionCount); + $this->deleteAuditLogs($project, $getAudit, $auditRetention); $this->deleteUsageStats($project, $getProjectDB, $getLogsDB, $hourlyUsageRetentionDatetime); $this->deleteExpiredSessions($project, $getProjectDB); $this->deleteExpiredTransactions($project, $getProjectDB); @@ -196,16 +216,15 @@ class Deletes extends Action * @param Database $dbForPlatform * @param callable $getProjectDB * @param string $datetime - * @param Document|null $document * @return void * @throws Conflict * @throws Restricted * @throws Structure - * @throws DatabaseException + * @throws DatabaseException|Exception */ private function deleteSchedules(Database $dbForPlatform, callable $getProjectDB, string $datetime): void { - // Temporarly accepting both 'fra' and 'default' + // Temporarily accepting both 'fra' and 'default' // When all migrated, only use _APP_REGION with 'default' as default value $regions = [System::getEnv('_APP_REGION', 'default')]; if (!in_array('default', $regions)) { @@ -510,124 +529,136 @@ class Deletes extends Action $dsn = new DSN('mysql://' . $document->getAttribute('database', 'console')); } - $dbForProject = $getProjectDB($document); - - $projectCollectionIds = [ - ...\array_keys(Config::getParam('collections', [])['projects']), - Audit::COLLECTION, - AbuseDatabase::COLLECTION, - ]; - - $sharedTables = \explode(',', System::getEnv('_APP_DATABASE_SHARED_TABLES', '')); - $sharedTablesV1 = \explode(',', System::getEnv('_APP_DATABASE_SHARED_TABLES_V1', '')); - - $projectTables = !\in_array($dsn->getHost(), $sharedTables); - $sharedTablesV1 = \in_array($dsn->getHost(), $sharedTablesV1); - $sharedTablesV2 = !$projectTables && !$sharedTablesV1; - /** * @var $dbForProject Database */ - $dbForProject->foreach(Database::METADATA, function (Document $collection) use ($dbForProject, $projectTables, $projectCollectionIds) { - try { - if ($projectTables || !\in_array($collection->getId(), $projectCollectionIds)) { - $dbForProject->deleteCollection($collection->getId()); - } else { - $this->deleteByGroup( - $collection->getId(), - [ - Query::orderAsc() - ], - database: $dbForProject - ); + $dbForProject = $getProjectDB($document); + + try { + /** + * Disable validation because of Cursor validation on $id underscores + */ + $dbForProject->disableValidation(); + + + $projectCollectionIds = [ + ...\array_keys(Config::getParam('collections', [])['projects']), + SQL::COLLECTION, + AbuseDatabase::COLLECTION, + ]; + + $sharedTables = \explode(',', System::getEnv('_APP_DATABASE_SHARED_TABLES', '')); + $sharedTablesV1 = \explode(',', System::getEnv('_APP_DATABASE_SHARED_TABLES_V1', '')); + + $projectTables = !\in_array($dsn->getHost(), $sharedTables); + $sharedTablesV1 = \in_array($dsn->getHost(), $sharedTablesV1); + $sharedTablesV2 = !$projectTables && !$sharedTablesV1; + + $dbForProject->foreach(Database::METADATA, function (Document $collection) use ($dbForProject, $projectTables, $projectCollectionIds) { + try { + if ($projectTables || !\in_array($collection->getId(), $projectCollectionIds)) { + $dbForProject->deleteCollection($collection->getId()); + } else { + $this->deleteByGroup( + $collection->getId(), + [ + Query::orderAsc() + ], + database: $dbForProject + ); + } + } catch (Throwable $e) { + Console::error('Error deleting ' . $collection->getId() . ' ' . $e->getMessage()); } - } catch (Throwable $e) { - Console::error('Error deleting ' . $collection->getId() . ' ' . $e->getMessage()); + }); + + // Delete Platforms + $this->deleteByGroup('platforms', [ + Query::equal('projectInternalId', [$projectInternalId]), + Query::orderAsc() + ], $dbForPlatform); + + // Delete project and function rules + $this->deleteByGroup('rules', [ + Query::equal('projectInternalId', [$projectInternalId]), + Query::orderAsc() + ], $dbForPlatform, function (Document $document) use ($dbForPlatform, $certificates) { + $this->deleteRule($dbForPlatform, $document, $certificates); + }); + + // Delete Keys + $this->deleteByGroup('keys', [ + Query::equal('resourceType', ['projects']), + Query::equal('resourceInternalId', [$projectInternalId]), + Query::orderAsc() + ], $dbForPlatform); + + // Delete Webhooks + $this->deleteByGroup('webhooks', [ + Query::equal('projectInternalId', [$projectInternalId]), + Query::orderAsc() + ], $dbForPlatform); + + // Delete VCS Installations + $this->deleteByGroup('installations', [ + Query::equal('projectInternalId', [$projectInternalId]), + Query::orderAsc() + ], $dbForPlatform); + + // Delete VCS Repositories + $this->deleteByGroup('repositories', [ + Query::equal('projectInternalId', [$projectInternalId]), + Query::orderAsc() + ], $dbForPlatform); + + // Delete VCS comments + $this->deleteByGroup('vcsComments', [ + Query::equal('projectInternalId', [$projectInternalId]), + Query::orderAsc() + ], $dbForPlatform); + + // Delete Schedules + $this->deleteByGroup('schedules', [ + Query::equal('projectId', [$projectId]), + Query::orderAsc() + ], $dbForPlatform); + + // Delete metadata table + if ($projectTables) { + $dbForProject->deleteCollection(Database::METADATA); + } elseif ($sharedTablesV1) { + $this->deleteByGroup( + Database::METADATA, + [ + Query::orderAsc() + ], + $dbForProject + ); + } elseif ($sharedTablesV2) { + $queries = \array_map( + fn ($id) => Query::notEqual('$id', $id), + $projectCollectionIds + ); + + $queries[] = Query::orderAsc(); + + $this->deleteByGroup( + Database::METADATA, + $queries, + $dbForProject + ); } - }); - // Delete Platforms - $this->deleteByGroup('platforms', [ - Query::equal('projectInternalId', [$projectInternalId]), - Query::orderAsc() - ], $dbForPlatform); + // Delete all storage directories + $deviceForFiles->delete($deviceForFiles->getRoot(), true); + $deviceForSites->delete($deviceForSites->getRoot(), true); + $deviceForFunctions->delete($deviceForFunctions->getRoot(), true); + $deviceForBuilds->delete($deviceForBuilds->getRoot(), true); + $deviceForCache->delete($deviceForCache->getRoot(), true); - // Delete project and function rules - $this->deleteByGroup('rules', [ - Query::equal('projectInternalId', [$projectInternalId]), - Query::orderAsc() - ], $dbForPlatform, function (Document $document) use ($dbForPlatform, $certificates) { - $this->deleteRule($dbForPlatform, $document, $certificates); - }); - - // Delete Keys - $this->deleteByGroup('keys', [ - Query::equal('projectInternalId', [$projectInternalId]), - Query::orderAsc() - ], $dbForPlatform); - - // Delete Webhooks - $this->deleteByGroup('webhooks', [ - Query::equal('projectInternalId', [$projectInternalId]), - Query::orderAsc() - ], $dbForPlatform); - - // Delete VCS Installations - $this->deleteByGroup('installations', [ - Query::equal('projectInternalId', [$projectInternalId]), - Query::orderAsc() - ], $dbForPlatform); - - // Delete VCS Repositories - $this->deleteByGroup('repositories', [ - Query::equal('projectInternalId', [$projectInternalId]), - Query::orderAsc() - ], $dbForPlatform); - - // Delete VCS comments - $this->deleteByGroup('vcsComments', [ - Query::equal('projectInternalId', [$projectInternalId]), - Query::orderAsc() - ], $dbForPlatform); - - // Delete Schedules - $this->deleteByGroup('schedules', [ - Query::equal('projectId', [$projectId]), - Query::orderAsc() - ], $dbForPlatform); - - // Delete metadata table - if ($projectTables) { - $dbForProject->deleteCollection(Database::METADATA); - } elseif ($sharedTablesV1) { - $this->deleteByGroup( - Database::METADATA, - [ - Query::orderAsc() - ], - $dbForProject - ); - } elseif ($sharedTablesV2) { - $queries = \array_map( - fn ($id) => Query::notEqual('$id', $id), - $projectCollectionIds - ); - - $queries[] = Query::orderAsc(); - - $this->deleteByGroup( - Database::METADATA, - $queries, - $dbForProject - ); + } finally { + $dbForProject->enableValidation(); } - - // Delete all storage directories - $deviceForFiles->delete($deviceForFiles->getRoot(), true); - $deviceForSites->delete($deviceForSites->getRoot(), true); - $deviceForFunctions->delete($deviceForFunctions->getRoot(), true); - $deviceForBuilds->delete($deviceForBuilds->getRoot(), true); - $deviceForCache->delete($deviceForCache->getRoot(), true); } /** @@ -679,14 +710,16 @@ class Deletes extends Action } /** - * @param database $dbForPlatform + * @param Document $project * @param callable $getProjectDB * @param string $datetime + * @param int|null $executionsRetentionCount * @return void - * @throws Exception + * @throws Exception|DatabaseException */ - private function deleteExecutionLogs(Document $project, callable $getProjectDB, string $datetime): void + private function deleteExecutionLogs(Document $project, callable $getProjectDB, string $datetime, ?int $executionsRetentionCount = 0): void { + /** @var Database $dbForProject */ $dbForProject = $getProjectDB($project); // Delete Executions @@ -696,10 +729,85 @@ class Deletes extends Action Query::orderDesc('$createdAt'), Query::orderDesc(), ], $dbForProject); + + /* delete based on custom retention, if any */ + $this->deleteExecutionsByLimit($project, $getProjectDB, $executionsRetentionCount); } /** - * @param Database $dbForPlatform + * @param Document $project + * @param callable $getProjectDB + * @param int|null $executionsRetentionCount + * @param string|null $resourceInternalId + * @param string|null $resourceType + * @return void + * @throws DatabaseException + */ + protected function deleteExecutionsByLimit( + Document $project, + callable $getProjectDB, + ?int $executionsRetentionCount = 0, + ?string $resourceInternalId = null, + ?string $resourceType = null + ): void { + if ($executionsRetentionCount <= 0) { + return; + } + + /** @var Database $dbForProject */ + $dbForProject = $getProjectDB($project); + + /* delete log for a given $resourceInternalId */ + $delete = function (Database $dbForProject, string $resourceInternalId, string $resourceType) use ($executionsRetentionCount) { + // get the execution at position `N+1` + $execution = $dbForProject->findOne('executions', [ + Query::select(['$createdAt']), + Query::equal('resourceInternalId', [$resourceInternalId]), + Query::equal('resourceType', [$resourceType]), + Query::orderDesc('$createdAt'), + Query::offset($executionsRetentionCount), + ]); + + if (!$execution->isEmpty()) { + // delete everything older + $cutoffTime = $execution->getAttribute('$createdAt'); + + $this->deleteByGroup('executions', [ + Query::select([...$this->selects, '$createdAt']), + Query::equal('resourceInternalId', [$resourceInternalId]), + Query::equal('resourceType', [$resourceType]), + Query::lessThan('$createdAt', $cutoffTime), + Query::orderDesc('$createdAt'), + Query::orderDesc(), + ], $dbForProject); + } + }; + + if (!empty($resourceInternalId)) { + // fast path, no need to list anything! + $delete($dbForProject, $resourceInternalId, $resourceType); + } else { + $processResource = function (string $type) use ($dbForProject, $delete, $resourceType) { + $this->listByGroup( + collection: $type, + queries: [Query::select(['$id', '$sequence'])], + database: $dbForProject, + callback: function (Document $resource) use ($dbForProject, $delete, $type) { + $delete($dbForProject, $resource->getSequence(), $type); + } + ); + }; + + /* perform processing in parallel */ + batch([ + fn () => $processResource(RESOURCE_TYPE_SITES), + fn () => $processResource(RESOURCE_TYPE_FUNCTIONS), + ]); + } + } + + /** + * @param Document $project * @param callable $getProjectDB * @return void * @throws Exception|Throwable @@ -771,26 +879,22 @@ class Deletes extends Action } /** - * @param Database $dbForPlatform - * @param callable $getProjectDB + * @param Document $project + * @param callable $getAudit * @param string $auditRetention * @return void * @throws Exception */ - private function deleteAuditLogs(Document $project, callable $getProjectDB, string $auditRetention): void + private function deleteAuditLogs(Document $project, callable $getAudit, string $auditRetention): void { $projectId = $project->getId(); - $dbForProject = $getProjectDB($project); + /** @var Audit $audit */ + $audit = $getAudit($project); try { - $this->deleteByGroup(Audit::COLLECTION, [ - Query::select([...$this->selects, 'time']), - Query::lessThan('time', $auditRetention), - Query::orderDesc('time'), - Query::orderAsc(), - ], $dbForProject); - } catch (DatabaseException $e) { - Console::error('Failed to delete audit logs for project ' . $projectId . ': ' . $e->getMessage()); + $audit->cleanup(new \DateTime($auditRetention)); + } catch (Throwable $th) { + Console::error('Failed to delete audit logs for project ' . $projectId . ': ' . $th->getMessage()); } } diff --git a/src/Appwrite/Platform/Workers/Functions.php b/src/Appwrite/Platform/Workers/Functions.php index 2e0649b151..e053efa021 100644 --- a/src/Appwrite/Platform/Workers/Functions.php +++ b/src/Appwrite/Platform/Workers/Functions.php @@ -8,6 +8,7 @@ use Appwrite\Event\Func; use Appwrite\Event\Realtime; use Appwrite\Event\StatsUsage; use Appwrite\Event\Webhook; +use Appwrite\Extend\Exception as AppwriteException; use Appwrite\Utopia\Response\Model\Execution; use Exception; use Executor\Executor; @@ -121,14 +122,16 @@ class Functions extends Action $log->addTag('type', $type); if (!empty($events)) { - $limit = 30; - $sum = 30; + $limit = 100; + $sum = 100; $offset = 0; while ($sum >= $limit) { $functions = $dbForProject->find('functions', [ + Query::select(['$id', 'events']), // Skip variables subqueries + Query::contains('events', $events), Query::limit($limit), Query::offset($offset), - Query::orderAsc('name'), + Query::orderAsc('$sequence'), ]); $sum = \count($functions); @@ -146,6 +149,11 @@ class Functions extends Action continue; } + /** + * get variables subqueries cached + */ + $function = $dbForProject->getDocument('functions', $function->getId()); + Console::success('Iterating function: ' . $function->getAttribute('name')); $this->execute( @@ -455,7 +463,11 @@ class Functions extends Action if ($execution->getAttribute('status') !== 'processing') { $execution->setAttribute('status', 'processing'); - $execution = $dbForProject->updateDocument('executions', $executionId, $execution); + try { + $execution = $dbForProject->updateDocument('executions', $executionId, $execution); + } catch (\Throwable $e) { + $log->addExtra('updateError', $e->getMessage()); + } } $durationStart = \microtime(true); @@ -598,6 +610,13 @@ class Functions extends Action $error = $th->getMessage(); $errorCode = $th->getCode(); } finally { + /** Update execution status */ + try { + $execution = $dbForProject->updateDocument('executions', $executionId, $execution); + } catch (\Throwable $e) { + $log->addExtra('updateError', $e->getMessage()); + } + /** Trigger usage queue */ $queueForStatsUsage ->setProject($project) @@ -614,8 +633,6 @@ class Functions extends Action ; } - $execution = $dbForProject->updateDocument('executions', $executionId, $execution); - $executionModel = new Execution(); $realtimeExecution = $executionModel->filter(new Document($execution->getArrayCopy())); $realtimeExecution = $realtimeExecution->getArrayCopy(\array_keys($executionModel->getRules())); @@ -645,7 +662,11 @@ class Functions extends Action ->trigger(); if (!empty($error)) { - throw new Exception($error, $errorCode); + throw new AppwriteException( + AppwriteException::GENERAL_SERVER_ERROR, + $error ?: 'Function execution failed with no error message', + $errorCode + ); } } } diff --git a/src/Appwrite/Platform/Workers/Mails.php b/src/Appwrite/Platform/Workers/Mails.php index 01448620f3..b1f17fc648 100644 --- a/src/Appwrite/Platform/Workers/Mails.php +++ b/src/Appwrite/Platform/Workers/Mails.php @@ -68,7 +68,8 @@ class Mails extends Action throw new Exception('Skipped mail processing. No SMTP configuration has been set.'); } - $log->addTag('type', empty($smtp) ? 'cloud' : 'smtp'); + $type = empty($smtp) ? 'cloud' : 'smtp'; + $log->addTag('type', $type); $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https'; $hostname = System::getEnv('_APP_CONSOLE_DOMAIN'); @@ -182,6 +183,9 @@ class Mails extends Action try { $mail->send(); } catch (\Throwable $error) { + if ($type === 'smtp') { + throw new Exception('Error sending mail: ' . $error->getMessage(), 401); + } throw new Exception('Error sending mail: ' . $error->getMessage(), 500); } } @@ -209,6 +213,8 @@ class Mails extends Action $mail->SMTPSecure = $smtp['secure']; $mail->SMTPAutoTLS = false; $mail->CharSet = 'UTF-8'; + $mail->Timeout = 10; /* Connection timeout */ + $mail->getSMTPInstance()->Timelimit = 30; /* Timeout for each individual SMTP command (e.g. HELO, EHLO, etc.) */ $mail->setFrom($smtp['senderEmail'], $smtp['senderName']); diff --git a/src/Appwrite/Platform/Workers/Migrations.php b/src/Appwrite/Platform/Workers/Migrations.php index dffc714834..6ef2f1899c 100644 --- a/src/Appwrite/Platform/Workers/Migrations.php +++ b/src/Appwrite/Platform/Workers/Migrations.php @@ -112,10 +112,18 @@ class Migrations extends Action $events = $payload['events'] ?? []; $migration = new Document($payload['migration'] ?? []); + if ($migration->isEmpty()) { + throw new \Exception('Migration not found'); + } + if ($project->getId() === 'console') { return; } + if ($project->isEmpty()) { + throw new \Exception('Project not found'); + } + $this->dbForProject = $dbForProject; $this->dbForPlatform = $dbForPlatform; $this->project = $project; @@ -208,7 +216,8 @@ class Migrations extends Action default => throw new \Exception('Invalid source type'), }; - $this->sourceReport = $migrationSource->report(); + $resources = $migration->getAttribute('resources', []); + $this->sourceReport = $migrationSource->report($resources); return $migrationSource; } @@ -320,7 +329,8 @@ class Migrations extends Action array $platform, Authorization $authorization, ): void { - $project = $this->dbForPlatform->getDocument('projects', $this->project->getId()); + $project = $this->project; + $tempAPIKey = $this->generateAPIKey($project); $transfer = $source = $destination = null; @@ -371,10 +381,10 @@ class Migrations extends Action $migration->getAttribute('resourceId'), $migration->getAttribute('resourceType') ); - } - $destination->shutdown(); - $source->shutdown(); + $destination->shutdown(); + $source->shutdown(); + } $sourceErrors = $source->getErrors(); $destinationErrors = $destination->getErrors(); @@ -394,62 +404,59 @@ class Migrations extends Action Console::error('Line: ' . $th->getLine()); Console::error($th->getTraceAsString()); - if (! $migration->isEmpty()) { - $migration->setAttribute('status', 'failed'); - $migration->setAttribute('stage', 'finished'); + $migration->setAttribute('status', 'failed'); + $migration->setAttribute('stage', 'finished'); - call_user_func($this->logError, $th, 'appwrite-worker', 'appwrite-queue-'.self::getName(), [ - 'migrationId' => $migration->getId(), - 'source' => $migration->getAttribute('source') ?? '', - 'destination' => $migration->getAttribute('destination') ?? '', - ]); + call_user_func($this->logError, $th, 'appwrite-worker', 'appwrite-queue-'.self::getName(), [ + 'migrationId' => $migration->getId(), + 'source' => $migration->getAttribute('source') ?? '', + 'destination' => $migration->getAttribute('destination') ?? '', + ]); - return; - } - - if ($transfer) { - $sourceErrors = $source->getErrors(); - $destinationErrors = $destination->getErrors(); - $migration->setAttribute('errors', $this->sanitizeErrors($sourceErrors, $destinationErrors)); - } } finally { - $this->updateMigrationDocument($migration, $project, $queueForRealtime); + try { + $this->updateMigrationDocument($migration, $project, $queueForRealtime); - if ($migration->getAttribute('status', '') === 'failed') { - Console::error('Migration('.$migration->getSequence().':'.$migration->getId().') failed, Project('.$this->project->getSequence().':'.$this->project->getId().')'); + if ($migration->getAttribute('status', '') === 'failed') { + Console::error('Migration('.$migration->getSequence().':'.$migration->getId().') failed, Project('.$this->project->getSequence().':'.$this->project->getId().')'); - $sourceErrors = $source?->getErrors() ?? []; - $destinationErrors = $destination?->getErrors() ?? []; + $sourceErrors = $source?->getErrors() ?? []; + $destinationErrors = $destination?->getErrors() ?? []; - foreach ([...$sourceErrors, ...$destinationErrors] as $error) { - /** @var MigrationException $error */ - if ($error->getCode() === 0 || $error->getCode() >= 500) { - ($this->logError)($error, 'appwrite-worker', 'appwrite-queue-' . self::getName(), [ - 'migrationId' => $migration->getId(), - 'source' => $migration->getAttribute('source') ?? '', - 'destination' => $migration->getAttribute('destination') ?? '', - 'resourceName' => $error->getResourceName(), - 'resourceGroup' => $error->getResourceGroup(), - ]); + foreach ([...$sourceErrors, ...$destinationErrors] as $error) { + /** @var MigrationException $error */ + if ($error->getCode() === 0 || $error->getCode() >= 500) { + ($this->logError)($error, 'appwrite-worker', 'appwrite-queue-' . self::getName(), [ + 'migrationId' => $migration->getId(), + 'source' => $migration->getAttribute('source') ?? '', + 'destination' => $migration->getAttribute('destination') ?? '', + 'resourceName' => $error->getResourceName(), + 'resourceGroup' => $error->getResourceGroup(), + ]); + } + } + + $source?->error(); + $destination?->error(); + } + + if ($migration->getAttribute('status', '') === 'completed') { + $destination?->success(); + $source?->success(); + + // TODO: Move to CSV hook + if ($migration->getAttribute('destination') === DestinationCSV::getName()) { + $this->handleCSVExportComplete($project, $migration, $queueForMails, $queueForRealtime, $platform, $authorization); } } + } finally { + $source?->cleanup(); + $destination?->cleanup(); - $source?->error(); - $destination?->error(); + $transfer = null; + $source = null; + $destination = null; } - - if ($migration->getAttribute('status', '') === 'completed') { - $destination?->success(); - $source?->success(); - - if ($migration->getAttribute('destination') === DestinationCSV::getName()) { - $this->handleCSVExportComplete($project, $migration, $queueForMails, $queueForRealtime, $platform, $authorization); - } - } - - $transfer = null; - $source = null; - $destination = null; } } @@ -459,11 +466,10 @@ class Migrations extends Action * @param Document $project * @param Document $migration * @param Mail $queueForMails + * @param Realtime $queueForRealtime + * @param array $platform + * @param Authorization $authorization * @return void - * @throws AuthorizationException - * @throws Structure - * @throws \Utopia\Database\Exception - * @throws Exception */ protected function handleCSVExportComplete( Document $project, diff --git a/src/Appwrite/Platform/Workers/StatsResources.php b/src/Appwrite/Platform/Workers/StatsResources.php index 1ef348091a..1c3db8d9c9 100644 --- a/src/Appwrite/Platform/Workers/StatsResources.php +++ b/src/Appwrite/Platform/Workers/StatsResources.php @@ -111,7 +111,8 @@ class StatsResources extends Action Query::equal('projectInternalId', [$project->getSequence()]) ]); $keys = $dbForPlatform->count('keys', [ - Query::equal('projectInternalId', [$project->getSequence()]) + Query::equal('resourceType', ['projects']), + Query::equal('resourceInternalId', [$project->getSequence()]), ]); $domains = $dbForPlatform->count('rules', [ @@ -192,13 +193,13 @@ class StatsResources extends Action } try { - $this->countForDatabase($dbForProject, $region); + $dbForProject->skipFilters(fn () => $this->countForDatabase($dbForProject, $region), ['subQueryAttributes', 'subQueryIndexes']); } catch (Throwable $th) { call_user_func_array($this->logError, [$th, "StatsResources", "count_for_database_{$project->getId()}"]); } try { - $this->countForSitesAndFunctions($dbForProject, $region); + $dbForProject->skipFilters(fn () => $this->countForSitesAndFunctions($dbForProject, $region), ['subQueryVariables', 'subQueryProjectVariables']); } catch (Throwable $th) { call_user_func_array($this->logError, [$th, "StatsResources", "count_for_functions_{$project->getId()}"]); } diff --git a/src/Appwrite/SDK/Specification/Format.php b/src/Appwrite/SDK/Specification/Format.php index a6228a0b29..7cb03c8e1b 100644 --- a/src/Appwrite/SDK/Specification/Format.php +++ b/src/Appwrite/SDK/Specification/Format.php @@ -40,17 +40,46 @@ abstract class Format 'license.url' => '', ]; - /* - * Blacklist to omit the enum types for the given route's parameter - */ - protected array $enumBlacklist = [ + private const array OAUTH_PROVIDER_BLACKLIST = [ + [ + 'namespace' => 'account', + 'methods' => [ + 'createOAuth2Session', + 'createOAuth2Token', + 'updateMagicURLSession' + ], + 'parameter' => 'provider', + 'excludeKeys' => [ + 'mock', + 'mock-unverified' + ], + ], + [ + 'namespace' => 'projects', + 'methods' => [ + 'updateOAuth2' + ], + 'parameter' => 'provider', + 'excludeKeys' => [ + 'mock', + 'mock-unverified' + ], + ], + ]; + + private const array PROVIDER_USAGE_BLACKLIST = [ [ 'namespace' => 'users', - 'method' => 'getUsage', - 'parameter' => 'provider' - ] + 'methods' => [ + 'getUsage' + ], + 'parameter' => 'provider', + 'exclude' => true, /* fully excluded */ + ], ]; + protected array $enumBlacklist = []; + public function __construct(App $app, array $services, array $routes, array $models, array $keys, int $authCount, string $platform) { $this->app = $app; @@ -60,6 +89,49 @@ abstract class Format $this->keys = $keys; $this->authCount = $authCount; $this->platform = $platform; + + $this->enumBlacklist = $this->buildEnumBlacklist(); + } + + protected function buildEnumBlacklist(): array + { + $blacklist = []; + + foreach (self::OAUTH_PROVIDER_BLACKLIST as $config) { + foreach ($config['methods'] as $method) { + $entry = [ + 'namespace' => $config['namespace'], + 'method' => $method, + 'parameter' => $config['parameter'], + ]; + if (isset($config['excludeKeys'])) { + $entry['excludeKeys'] = $config['excludeKeys']; + } + if (isset($config['exclude'])) { + $entry['exclude'] = $config['exclude']; + } + $blacklist[] = $entry; + } + } + + foreach (self::PROVIDER_USAGE_BLACKLIST as $config) { + foreach ($config['methods'] as $method) { + $entry = [ + 'namespace' => $config['namespace'], + 'method' => $method, + 'parameter' => $config['parameter'], + ]; + if (isset($config['excludeKeys'])) { + $entry['excludeKeys'] = $config['excludeKeys']; + } + if (isset($config['exclude'])) { + $entry['exclude'] = $config['exclude']; + } + $blacklist[] = $entry; + } + } + + return $blacklist; } /** @@ -204,6 +276,8 @@ abstract class Format switch ($param) { case 'permissions': return 'BrowserPermission'; + case 'output': + return 'ImageFormat'; } break; } @@ -592,171 +666,16 @@ abstract class Format public function getResponseEnumName(string $model, string $param): ?string { - switch ($model) { - case 'attributeString': - switch ($param) { - case 'status': - return 'AttributeStatus'; - } - break; - case 'attributeInteger': - switch ($param) { - case 'status': - return 'AttributeStatus'; - } - break; - case 'attributeFloat': - switch ($param) { - case 'status': - return 'AttributeStatus'; - } - break; - case 'attributeBoolean': - switch ($param) { - case 'status': - return 'AttributeStatus'; - } - break; - case 'attributeEmail': - switch ($param) { - case 'status': - return 'AttributeStatus'; - } - break; - case 'attributeEnum': - switch ($param) { - case 'status': - return 'AttributeStatus'; - } - break; - case 'attributeIp': - switch ($param) { - case 'status': - return 'AttributeStatus'; - } - break; - case 'attributeUrl': - switch ($param) { - case 'status': - return 'AttributeStatus'; - } - break; - case 'attributeDatetime': - switch ($param) { - case 'status': - return 'AttributeStatus'; - } - break; - case 'attributeRelationship': - switch ($param) { - case 'status': - return 'AttributeStatus'; - } - break; - case 'attributePoint': - switch ($param) { - case 'status': - return 'AttributeStatus'; - } - break; - case 'attributeLine': - switch ($param) { - case 'status': - return 'AttributeStatus'; - } - break; - case 'attributePolygon': - switch ($param) { - case 'status': - return 'AttributeStatus'; - } - break; - case 'columnString': - switch ($param) { - case 'status': - return 'ColumnStatus'; - } - break; - case 'columnInteger': - switch ($param) { - case 'status': - return 'ColumnStatus'; - } - break; - case 'columnFloat': - switch ($param) { - case 'status': - return 'ColumnStatus'; - } - break; - case 'columnBoolean': - switch ($param) { - case 'status': - return 'ColumnStatus'; - } - break; - case 'columnEmail': - switch ($param) { - case 'status': - return 'ColumnStatus'; - } - break; - case 'columnEnum': - switch ($param) { - case 'status': - return 'ColumnStatus'; - } - break; - case 'columnIp': - switch ($param) { - case 'status': - return 'ColumnStatus'; - } - break; - case 'columnUrl': - switch ($param) { - case 'status': - return 'ColumnStatus'; - } - break; - case 'columnDatetime': - switch ($param) { - case 'status': - return 'ColumnStatus'; - } - break; - case 'columnRelationship': - switch ($param) { - case 'status': - return 'ColumnStatus'; - } - break; - case 'columnPoint': - switch ($param) { - case 'status': - return 'ColumnStatus'; - } - break; - case 'columnLine': - switch ($param) { - case 'status': - return 'ColumnStatus'; - } - break; - case 'columnPolygon': - switch ($param) { - case 'status': - return 'ColumnStatus'; - } - break; - case 'healthStatus': - switch ($param) { - case 'status': - return 'HealthCheckStatus'; - } - break; + if ($param !== 'status') { + return null; } - return null; + + return match (true) { + $model === 'healthStatus' => 'HealthCheckStatus', + str_starts_with($model, 'attribute') => 'AttributeStatus', + str_starts_with($model, 'column') => 'ColumnStatus', + default => null, + }; } protected function getNestedModels(Model $model, array &$usedModels): void @@ -778,4 +697,31 @@ abstract class Format } } } + + protected function parseDescription(string $description, array $excludedValues): string + { + if (empty($excludedValues)) { + return $description; + } + + foreach ($excludedValues as $excludedValue) { + // remove from comma-separated list + $description = preg_replace( + '/,\s*' . preg_quote($excludedValue, '/') . '(?=\s*[,.]|$)/', + '', + $description + ); + $description = preg_replace( + '/(?<=:\s|,\s)' . preg_quote($excludedValue, '/') . '\s*,\s*/', + '', + $description + ); + } + + // clean up double commas and extra spaces + $description = preg_replace('/,\s*,/', ',', $description); + $description = preg_replace('/\s+/', ' ', $description); + + return trim($description); + } } diff --git a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php index 00e98afb60..8171a45db4 100644 --- a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php +++ b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php @@ -550,7 +550,7 @@ class OpenAPI3 extends Format break; case 'Utopia\Validator\Integer': $node['schema']['type'] = $validator->getType(); - $node['schema']['format'] = 'int32'; + $node['schema']['format'] = $validator->getFormat(); if (!empty($param['example'])) { $node['schema']['x-example'] = $param['example']; } @@ -584,23 +584,52 @@ class OpenAPI3 extends Format // Iterate from the blackList. If it matches with the current one, then it is a blackList // Do not add the enum $allowed = true; + $excludeKeys = null; foreach ($this->enumBlacklist as $blacklist) { if ( $blacklist['namespace'] == $sdk->getNamespace() && $blacklist['method'] == $methodName && $blacklist['parameter'] == $name ) { - $allowed = false; + // 'exclude' => true means full exclude + if (isset($blacklist['exclude']) && $blacklist['exclude'] === true) { + $allowed = false; + break; + } + + if (isset($blacklist['excludeKeys'])) { + $excludeKeys = $blacklist['excludeKeys']; + } break; } } if ($allowed && $validator->getType() === 'string') { - $node['schema']['items']['enum'] = \array_values($validator->getList()); + $allValues = \array_values($validator->getList()); + $allKeys = $this->getRequestEnumKeys($sdk->getNamespace() ?? '', $methodName, $name); + + if ($excludeKeys !== null) { + $keepIndices = []; + foreach ($allValues as $index => $value) { + if (!\in_array($value, $excludeKeys, true)) { + $keepIndices[] = $index; + } + } + $enumKeys = \array_values(\array_intersect_key($allKeys, \array_flip($keepIndices))); + $enumValues = \array_values(\array_intersect_key($allValues, \array_flip($keepIndices))); + } else { + $enumKeys = $allKeys; + $enumValues = $allValues; + } + $node['schema']['items']['enum'] = $enumValues; $node['schema']['items']['x-enum-name'] = $this->getRequestEnumName($sdk->getNamespace() ?? '', $methodName, $name); - $node['schema']['items']['x-enum-keys'] = $this->getRequestEnumKeys($sdk->getNamespace() ?? '', $methodName, $name); + $node['schema']['items']['x-enum-keys'] = $enumKeys; + + if (!empty($excludeKeys)) { + $node['description'] = $this->parseDescription($node['description'], $excludeKeys); + } } if ($validator->getType() === 'integer') { - $node['schema']['items']['format'] = 'int32'; + $node['schema']['items']['format'] = $validator->getFormat() ?? 'int32'; } } else { $node['schema']['type'] = $validator->getType(); @@ -609,23 +638,52 @@ class OpenAPI3 extends Format // Iterate from the blackList. If it matches with the current one, then it is a blackList // Do not add the enum $allowed = true; + $excludeKeys = null; foreach ($this->enumBlacklist as $blacklist) { if ( $blacklist['namespace'] == $sdk->getNamespace() && $blacklist['method'] == $methodName && $blacklist['parameter'] == $name ) { - $allowed = false; + // 'exclude' => true means full exclude + if (isset($blacklist['exclude']) && $blacklist['exclude'] === true) { + $allowed = false; + break; + } + + if (isset($blacklist['excludeKeys'])) { + $excludeKeys = $blacklist['excludeKeys']; + } break; } } if ($allowed && $validator->getType() === 'string') { - $node['schema']['enum'] = \array_values($validator->getList()); + $allValues = \array_values($validator->getList()); + $allKeys = $this->getRequestEnumKeys($sdk->getNamespace() ?? '', $methodName, $name); + + if ($excludeKeys !== null) { + $keepIndices = []; + foreach ($allValues as $index => $value) { + if (!\in_array($value, $excludeKeys, true)) { + $keepIndices[] = $index; + } + } + $enumKeys = \array_values(\array_intersect_key($allKeys, \array_flip($keepIndices))); + $enumValues = \array_values(\array_intersect_key($allValues, \array_flip($keepIndices))); + } else { + $enumKeys = $allKeys; + $enumValues = $allValues; + } + $node['schema']['enum'] = $enumValues; $node['schema']['x-enum-name'] = $this->getRequestEnumName($sdk->getNamespace() ?? '', $methodName, $name); - $node['schema']['x-enum-keys'] = $this->getRequestEnumKeys($sdk->getNamespace() ?? '', $methodName, $name); + $node['schema']['x-enum-keys'] = $enumKeys; + + if (!empty($excludeKeys)) { + $node['description'] = $this->parseDescription($node['description'], $excludeKeys); + } } if ($validator->getType() === 'integer') { - $node['format'] = 'int32'; + $node['schema']['format'] = $validator->getFormat() ?? 'int32'; } } break; @@ -694,6 +752,10 @@ class OpenAPI3 extends Format 'x-example' => $node['schema']['x-example'] ?? null ]; + if (isset($node['schema']['format'])) { + $body['content'][$consumes[0]]['schema']['properties'][$name]['format'] = $node['schema']['format']; + } + if (isset($node['schema']['enum'])) { /// If the enum flag is Set, add the enum values to the body $body['content'][$consumes[0]]['schema']['properties'][$name]['enum'] = $node['schema']['enum']; @@ -795,7 +857,7 @@ class OpenAPI3 extends Format case 'integer': $type = 'integer'; - $format = 'int32'; + $format = $rule['format'] ?? 'int32'; break; case 'float': diff --git a/src/Appwrite/SDK/Specification/Format/Swagger2.php b/src/Appwrite/SDK/Specification/Format/Swagger2.php index 37173c51c6..990c456851 100644 --- a/src/Appwrite/SDK/Specification/Format/Swagger2.php +++ b/src/Appwrite/SDK/Specification/Format/Swagger2.php @@ -539,7 +539,7 @@ class Swagger2 extends Format break; case 'Utopia\Validator\Integer': $node['type'] = $validator->getType(); - $node['format'] = 'int32'; + $node['format'] = $validator->getFormat(); if (!empty($param['example'])) { $node['x-example'] = $param['example']; } @@ -571,41 +571,97 @@ class Swagger2 extends Format $node['x-example'] = $param['example']; } - // Iterate the blackList. If it matches with the current one, then it is blackListed $allowed = true; + $excludeKeys = null; foreach ($this->enumBlacklist as $blacklist) { if ($blacklist['namespace'] == $namespace && $blacklist['method'] == $methodName && $blacklist['parameter'] == $name) { - $allowed = false; + // 'exclude' => true means full exclude + if (isset($blacklist['exclude']) && $blacklist['exclude'] === true) { + $allowed = false; + break; + } + + if (isset($blacklist['excludeKeys'])) { + $excludeKeys = $blacklist['excludeKeys']; + } break; } } if ($allowed && $validator->getType() === 'string') { - $node['items']['enum'] = \array_values($validator->getList()); + $allValues = \array_values($validator->getList()); + $allKeys = $this->getRequestEnumKeys($namespace, $methodName, $name); + + if ($excludeKeys !== null) { + $keepIndices = []; + foreach ($allValues as $index => $value) { + if (!\in_array($value, $excludeKeys, true)) { + $keepIndices[] = $index; + } + } + $enumKeys = \array_values(\array_intersect_key($allKeys, \array_flip($keepIndices))); + $enumValues = \array_values(\array_intersect_key($allValues, \array_flip($keepIndices))); + } else { + $enumKeys = $allKeys; + $enumValues = $allValues; + } + $node['items']['enum'] = $enumValues; $node['items']['x-enum-name'] = $this->getRequestEnumName($namespace, $methodName, $name); - $node['items']['x-enum-keys'] = $this->getRequestEnumKeys($namespace, $methodName, $name); + $node['items']['x-enum-keys'] = $enumKeys; + + if (!empty($excludeKeys)) { + $node['description'] = $this->parseDescription($node['description'], $excludeKeys); + } } if ($validator->getType() === 'integer') { - $node['items']['format'] = 'int32'; + $node['items']['format'] = $validator->getFormat() ?? 'int32'; } } else { $node['type'] = $validator->getType(); $node['x-example'] = ($param['example'] ?? '') ?: $validator->getList()[0]; - // Iterate the blackList. If it matches with the current one, then it is blackListed $allowed = true; + $excludeKeys = null; foreach ($this->enumBlacklist as $blacklist) { if ($blacklist['namespace'] == $namespace && $blacklist['method'] == $methodName && $blacklist['parameter'] == $name) { - $allowed = false; + // 'exclude' => true means full exclude + if (isset($blacklist['exclude']) && $blacklist['exclude'] === true) { + $allowed = false; + break; + } + + if (isset($blacklist['excludeKeys'])) { + $excludeKeys = $blacklist['excludeKeys']; + } break; } } if ($allowed && $validator->getType() === 'string') { - $node['enum'] = \array_values($validator->getList()); + $allValues = \array_values($validator->getList()); + $allKeys = $this->getRequestEnumKeys($namespace, $methodName, $name); + + if ($excludeKeys !== null) { + $keepIndices = []; + foreach ($allValues as $index => $value) { + if (!\in_array($value, $excludeKeys, true)) { + $keepIndices[] = $index; + } + } + $enumKeys = \array_values(\array_intersect_key($allKeys, \array_flip($keepIndices))); + $enumValues = \array_values(\array_intersect_key($allValues, \array_flip($keepIndices))); + } else { + $enumKeys = $allKeys; + $enumValues = $allValues; + } + $node['enum'] = $enumValues; $node['x-enum-name'] = $this->getRequestEnumName($namespace, $methodName, $name); - $node['x-enum-keys'] = $this->getRequestEnumKeys($namespace, $methodName, $name); + $node['x-enum-keys'] = $enumKeys; + + if (!empty($excludeKeys)) { + $node['description'] = $this->parseDescription($node['description'], $excludeKeys); + } } if ($validator->getType() === 'integer') { - $node['format'] = 'int32'; + $node['format'] = $validator->getFormat() ?? 'int32'; } } break; @@ -683,6 +739,10 @@ class Swagger2 extends Format 'x-example' => $node['x-example'] ?? null, ]; + if (isset($node['format'])) { + $body['schema']['properties'][$name]['format'] = $node['format']; + } + if (isset($node['enum'])) { /// If the enum flag is Set, add the enum values to the body $body['schema']['properties'][$name]['enum'] = $node['enum']; @@ -776,7 +836,7 @@ class Swagger2 extends Format case 'integer': $type = 'integer'; - $format = 'int32'; + $format = $rule['format'] ?? 'int32'; break; case 'float': diff --git a/src/Appwrite/Utopia/Database/RuntimeQuery.php b/src/Appwrite/Utopia/Database/RuntimeQuery.php new file mode 100644 index 0000000000..025d424768 --- /dev/null +++ b/src/Appwrite/Utopia/Database/RuntimeQuery.php @@ -0,0 +1,121 @@ + $queries + * @param array $payload + */ + public static function filter(array $queries, array $payload): array + { + if (empty($queries)) { + return $payload; + } + // multiple queries follows and condition + foreach ($queries as $query) { + if (!self::evaluateFilter($query, $payload)) { + return []; + }; + } + return $payload; + } + + private static function evaluateFilter(Query $query, array $payload): bool + { + $attribute = $query->getAttribute(); + $method = $query->getMethod(); + $values = $query->getValues(); + + // during 'and' and 'or' attribute will not be present + switch ($method) { + case Query::TYPE_AND: + // All subqueries must evaluate to true + foreach ($query->getValues() as $subquery) { + if (!self::evaluateFilter($subquery, $payload)) { + return false; + } + } + return true; + + case Query::TYPE_OR: + // At least one subquery must evaluate to true + foreach ($query->getValues() as $subquery) { + if (self::evaluateFilter($subquery, $payload)) { + return true; + } + } + return false; + } + + $hasAttribute = \array_key_exists($attribute, $payload); + if (!$hasAttribute) { + return false; + } + + // null can be a value as well + $payloadAttributeValue = $payload[$attribute]; + switch ($method) { + case Query::TYPE_EQUAL: + return self::anyMatch($values, fn ($value) => $payloadAttributeValue === $value); + + case Query::TYPE_NOT_EQUAL: + return !self::anyMatch($values, fn ($value) => $payloadAttributeValue === $value); + + case Query::TYPE_LESSER: + return self::anyMatch($values, fn ($value) => $payloadAttributeValue < $value); + + case Query::TYPE_LESSER_EQUAL: + return self::anyMatch($values, fn ($value) => $payloadAttributeValue <= $value); + + case Query::TYPE_GREATER: + return self::anyMatch($values, fn ($value) => $payloadAttributeValue > $value); + + case Query::TYPE_GREATER_EQUAL: + return self::anyMatch($values, fn ($value) => $payloadAttributeValue >= $value); + + // attribute must be present and should be explicitly null + case Query::TYPE_IS_NULL: + return $payloadAttributeValue === null; + + case Query::TYPE_IS_NOT_NULL: + return $payloadAttributeValue !== null; + + default: + throw new \InvalidArgumentException( + "Unsupported query method: {$method}" + ); + } + } + + private static function anyMatch(array $values, callable $fn): bool + { + foreach ($values as $value) { + if ($fn($value)) { + return true; + } + } + return false; + } +} diff --git a/src/Appwrite/Utopia/Database/Validator/Queries/Projects.php b/src/Appwrite/Utopia/Database/Validator/Queries/Projects.php index 5a0befb739..50c9d850f3 100644 --- a/src/Appwrite/Utopia/Database/Validator/Queries/Projects.php +++ b/src/Appwrite/Utopia/Database/Validator/Queries/Projects.php @@ -6,7 +6,9 @@ class Projects extends Base { public const ALLOWED_ATTRIBUTES = [ 'name', - 'teamId' + 'teamId', + 'labels', + 'search' ]; /** @@ -17,4 +19,9 @@ class Projects extends Base { parent::__construct('projects', self::ALLOWED_ATTRIBUTES); } + + public function isSelectQueryAllowed(): bool + { + return true; + } } diff --git a/src/Appwrite/Utopia/Response.php b/src/Appwrite/Utopia/Response.php index 160bb47bb0..f2ac486f82 100644 --- a/src/Appwrite/Utopia/Response.php +++ b/src/Appwrite/Utopia/Response.php @@ -6,147 +6,8 @@ use Appwrite\Utopia\Database\Documents\User as DBUser; use Appwrite\Utopia\Fetch\BodyMultipart; use Appwrite\Utopia\Response\Filter; use Appwrite\Utopia\Response\Model; -use Appwrite\Utopia\Response\Model\Account; -use Appwrite\Utopia\Response\Model\AlgoArgon2; -use Appwrite\Utopia\Response\Model\AlgoBcrypt; -use Appwrite\Utopia\Response\Model\AlgoMd5; -use Appwrite\Utopia\Response\Model\AlgoPhpass; -use Appwrite\Utopia\Response\Model\AlgoScrypt; -use Appwrite\Utopia\Response\Model\AlgoScryptModified; -use Appwrite\Utopia\Response\Model\AlgoSha; -use Appwrite\Utopia\Response\Model\Any; -use Appwrite\Utopia\Response\Model\Attribute; -use Appwrite\Utopia\Response\Model\AttributeBoolean; -use Appwrite\Utopia\Response\Model\AttributeDatetime; -use Appwrite\Utopia\Response\Model\AttributeEmail; -use Appwrite\Utopia\Response\Model\AttributeEnum; -use Appwrite\Utopia\Response\Model\AttributeFloat; -use Appwrite\Utopia\Response\Model\AttributeInteger; -use Appwrite\Utopia\Response\Model\AttributeIP; -use Appwrite\Utopia\Response\Model\AttributeLine; -use Appwrite\Utopia\Response\Model\AttributeList; -use Appwrite\Utopia\Response\Model\AttributePoint; -use Appwrite\Utopia\Response\Model\AttributePolygon; -use Appwrite\Utopia\Response\Model\AttributeRelationship; -use Appwrite\Utopia\Response\Model\AttributeString; -use Appwrite\Utopia\Response\Model\AttributeURL; -use Appwrite\Utopia\Response\Model\AuthProvider; -use Appwrite\Utopia\Response\Model\BaseList; -use Appwrite\Utopia\Response\Model\Branch; -use Appwrite\Utopia\Response\Model\Bucket; -use Appwrite\Utopia\Response\Model\Collection; -use Appwrite\Utopia\Response\Model\Column; -use Appwrite\Utopia\Response\Model\ColumnBoolean; -use Appwrite\Utopia\Response\Model\ColumnDatetime; -use Appwrite\Utopia\Response\Model\ColumnEmail; -use Appwrite\Utopia\Response\Model\ColumnEnum; -use Appwrite\Utopia\Response\Model\ColumnFloat; -use Appwrite\Utopia\Response\Model\ColumnIndex; -use Appwrite\Utopia\Response\Model\ColumnInteger; -use Appwrite\Utopia\Response\Model\ColumnIP; -use Appwrite\Utopia\Response\Model\ColumnLine; -use Appwrite\Utopia\Response\Model\ColumnList; -use Appwrite\Utopia\Response\Model\ColumnPoint; -use Appwrite\Utopia\Response\Model\ColumnPolygon; -use Appwrite\Utopia\Response\Model\ColumnRelationship; -use Appwrite\Utopia\Response\Model\ColumnString; -use Appwrite\Utopia\Response\Model\ColumnURL; -use Appwrite\Utopia\Response\Model\ConsoleVariables; -use Appwrite\Utopia\Response\Model\Continent; -use Appwrite\Utopia\Response\Model\Country; -use Appwrite\Utopia\Response\Model\Currency; -use Appwrite\Utopia\Response\Model\Database; -use Appwrite\Utopia\Response\Model\Deployment; -use Appwrite\Utopia\Response\Model\DetectionFramework; -use Appwrite\Utopia\Response\Model\DetectionRuntime; -use Appwrite\Utopia\Response\Model\DetectionVariable; -use Appwrite\Utopia\Response\Model\DevKey; -use Appwrite\Utopia\Response\Model\Document as ModelDocument; -use Appwrite\Utopia\Response\Model\Error; -use Appwrite\Utopia\Response\Model\ErrorDev; -use Appwrite\Utopia\Response\Model\Execution; -use Appwrite\Utopia\Response\Model\File; -use Appwrite\Utopia\Response\Model\Framework; -use Appwrite\Utopia\Response\Model\FrameworkAdapter; -use Appwrite\Utopia\Response\Model\Func; -use Appwrite\Utopia\Response\Model\Headers; -use Appwrite\Utopia\Response\Model\HealthAntivirus; -use Appwrite\Utopia\Response\Model\HealthCertificate; -use Appwrite\Utopia\Response\Model\HealthQueue; -use Appwrite\Utopia\Response\Model\HealthStatus; -use Appwrite\Utopia\Response\Model\HealthTime; -use Appwrite\Utopia\Response\Model\HealthVersion; -use Appwrite\Utopia\Response\Model\Identity; -use Appwrite\Utopia\Response\Model\Index; -use Appwrite\Utopia\Response\Model\Installation; -use Appwrite\Utopia\Response\Model\JWT; -use Appwrite\Utopia\Response\Model\Key; -use Appwrite\Utopia\Response\Model\Language; -use Appwrite\Utopia\Response\Model\Locale; -use Appwrite\Utopia\Response\Model\LocaleCode; -use Appwrite\Utopia\Response\Model\Log; -use Appwrite\Utopia\Response\Model\Membership; -use Appwrite\Utopia\Response\Model\Message; -use Appwrite\Utopia\Response\Model\Metric; -use Appwrite\Utopia\Response\Model\MetricBreakdown; -use Appwrite\Utopia\Response\Model\MFAChallenge; -use Appwrite\Utopia\Response\Model\MFAFactors; -use Appwrite\Utopia\Response\Model\MFARecoveryCodes; -use Appwrite\Utopia\Response\Model\MFAType; -use Appwrite\Utopia\Response\Model\Migration; -use Appwrite\Utopia\Response\Model\MigrationFirebaseProject; -use Appwrite\Utopia\Response\Model\MigrationReport; -use Appwrite\Utopia\Response\Model\Mock; -use Appwrite\Utopia\Response\Model\MockNumber; -use Appwrite\Utopia\Response\Model\None; -use Appwrite\Utopia\Response\Model\Phone; -use Appwrite\Utopia\Response\Model\Platform; -use Appwrite\Utopia\Response\Model\Preferences; -use Appwrite\Utopia\Response\Model\Project; -use Appwrite\Utopia\Response\Model\Provider; -use Appwrite\Utopia\Response\Model\ProviderRepository; -use Appwrite\Utopia\Response\Model\ProviderRepositoryFramework; -use Appwrite\Utopia\Response\Model\ProviderRepositoryRuntime; -use Appwrite\Utopia\Response\Model\ResourceToken; -use Appwrite\Utopia\Response\Model\Row; -use Appwrite\Utopia\Response\Model\Rule; -use Appwrite\Utopia\Response\Model\Runtime; -use Appwrite\Utopia\Response\Model\Session; -use Appwrite\Utopia\Response\Model\Site; -use Appwrite\Utopia\Response\Model\Specification; -use Appwrite\Utopia\Response\Model\Subscriber; -use Appwrite\Utopia\Response\Model\Table; -use Appwrite\Utopia\Response\Model\Target; -use Appwrite\Utopia\Response\Model\Team; -use Appwrite\Utopia\Response\Model\TemplateEmail; -use Appwrite\Utopia\Response\Model\TemplateFramework; -use Appwrite\Utopia\Response\Model\TemplateFunction; -use Appwrite\Utopia\Response\Model\TemplateRuntime; -use Appwrite\Utopia\Response\Model\TemplateSite; -use Appwrite\Utopia\Response\Model\TemplateSMS; -use Appwrite\Utopia\Response\Model\TemplateVariable; -use Appwrite\Utopia\Response\Model\Token; -use Appwrite\Utopia\Response\Model\Topic; -use Appwrite\Utopia\Response\Model\Transaction; -use Appwrite\Utopia\Response\Model\UsageBuckets; -use Appwrite\Utopia\Response\Model\UsageCollection; -use Appwrite\Utopia\Response\Model\UsageDatabase; -use Appwrite\Utopia\Response\Model\UsageDatabases; -use Appwrite\Utopia\Response\Model\UsageFunction; -use Appwrite\Utopia\Response\Model\UsageFunctions; -use Appwrite\Utopia\Response\Model\UsageProject; -use Appwrite\Utopia\Response\Model\UsageSite; -use Appwrite\Utopia\Response\Model\UsageSites; -use Appwrite\Utopia\Response\Model\UsageStorage; -use Appwrite\Utopia\Response\Model\UsageTable; -use Appwrite\Utopia\Response\Model\UsageUsers; -use Appwrite\Utopia\Response\Model\User; -use Appwrite\Utopia\Response\Model\Variable; -use Appwrite\Utopia\Response\Model\VcsContent; -use Appwrite\Utopia\Response\Model\Webhook; use Exception; use JsonException; -// Keep last use Swoole\Http\Response as SwooleHTTPResponse; use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; @@ -418,6 +279,11 @@ class Response extends SwooleResponse */ protected static bool $showSensitive = false; + /** + * @var array + */ + protected static array $models = []; + protected SwooleHTTPResponse $swoole; /** @@ -428,206 +294,6 @@ class Response extends SwooleResponse public function __construct(SwooleHTTPResponse $response) { $this->swoole = $response; - - $this - // General - ->setModel(new None()) - ->setModel(new Any()) - ->setModel(new Error()) - ->setModel(new ErrorDev()) - // Lists - ->setModel(new BaseList('Rows List', self::MODEL_ROW_LIST, 'rows', self::MODEL_ROW)) - ->setModel(new BaseList('Documents List', self::MODEL_DOCUMENT_LIST, 'documents', self::MODEL_DOCUMENT)) - ->setModel(new BaseList('Tables List', self::MODEL_TABLE_LIST, 'tables', self::MODEL_TABLE)) - ->setModel(new BaseList('Collections List', self::MODEL_COLLECTION_LIST, 'collections', self::MODEL_COLLECTION)) - ->setModel(new BaseList('Databases List', self::MODEL_DATABASE_LIST, 'databases', self::MODEL_DATABASE)) - ->setModel(new BaseList('Indexes List', self::MODEL_INDEX_LIST, 'indexes', self::MODEL_INDEX)) - ->setModel(new BaseList('Column Indexes List', self::MODEL_COLUMN_INDEX_LIST, 'indexes', self::MODEL_COLUMN_INDEX)) - ->setModel(new BaseList('Users List', self::MODEL_USER_LIST, 'users', self::MODEL_USER)) - ->setModel(new BaseList('Sessions List', self::MODEL_SESSION_LIST, 'sessions', self::MODEL_SESSION)) - ->setModel(new BaseList('Identities List', self::MODEL_IDENTITY_LIST, 'identities', self::MODEL_IDENTITY)) - ->setModel(new BaseList('Logs List', self::MODEL_LOG_LIST, 'logs', self::MODEL_LOG)) - ->setModel(new BaseList('Files List', self::MODEL_FILE_LIST, 'files', self::MODEL_FILE)) - ->setModel(new BaseList('Buckets List', self::MODEL_BUCKET_LIST, 'buckets', self::MODEL_BUCKET)) - ->setModel(new BaseList('Resource Tokens List', self::MODEL_RESOURCE_TOKEN_LIST, 'tokens', self::MODEL_RESOURCE_TOKEN)) - ->setModel(new BaseList('Teams List', self::MODEL_TEAM_LIST, 'teams', self::MODEL_TEAM)) - ->setModel(new BaseList('Memberships List', self::MODEL_MEMBERSHIP_LIST, 'memberships', self::MODEL_MEMBERSHIP)) - ->setModel(new BaseList('Sites List', self::MODEL_SITE_LIST, 'sites', self::MODEL_SITE)) - ->setModel(new BaseList('Site Templates List', self::MODEL_TEMPLATE_SITE_LIST, 'templates', self::MODEL_TEMPLATE_SITE)) - ->setModel(new BaseList('Functions List', self::MODEL_FUNCTION_LIST, 'functions', self::MODEL_FUNCTION)) - ->setModel(new BaseList('Function Templates List', self::MODEL_TEMPLATE_FUNCTION_LIST, 'templates', self::MODEL_TEMPLATE_FUNCTION)) - ->setModel(new BaseList('Installations List', self::MODEL_INSTALLATION_LIST, 'installations', self::MODEL_INSTALLATION)) - ->setModel(new BaseList('Framework Provider Repositories List', self::MODEL_PROVIDER_REPOSITORY_FRAMEWORK_LIST, 'frameworkProviderRepositories', self::MODEL_PROVIDER_REPOSITORY_FRAMEWORK)) - ->setModel(new BaseList('Runtime Provider Repositories List', self::MODEL_PROVIDER_REPOSITORY_RUNTIME_LIST, 'runtimeProviderRepositories', self::MODEL_PROVIDER_REPOSITORY_RUNTIME)) - ->setModel(new BaseList('Branches List', self::MODEL_BRANCH_LIST, 'branches', self::MODEL_BRANCH)) - ->setModel(new BaseList('Frameworks List', self::MODEL_FRAMEWORK_LIST, 'frameworks', self::MODEL_FRAMEWORK)) - ->setModel(new BaseList('Runtimes List', self::MODEL_RUNTIME_LIST, 'runtimes', self::MODEL_RUNTIME)) - ->setModel(new BaseList('Deployments List', self::MODEL_DEPLOYMENT_LIST, 'deployments', self::MODEL_DEPLOYMENT)) - ->setModel(new BaseList('Executions List', self::MODEL_EXECUTION_LIST, 'executions', self::MODEL_EXECUTION)) - ->setModel(new BaseList('Projects List', self::MODEL_PROJECT_LIST, 'projects', self::MODEL_PROJECT, true, false)) - ->setModel(new BaseList('Webhooks List', self::MODEL_WEBHOOK_LIST, 'webhooks', self::MODEL_WEBHOOK, true, false)) - ->setModel(new BaseList('API Keys List', self::MODEL_KEY_LIST, 'keys', self::MODEL_KEY, true, false)) - ->setModel(new BaseList('Dev Keys List', self::MODEL_DEV_KEY_LIST, 'devKeys', self::MODEL_DEV_KEY, true, false)) - ->setModel(new BaseList('Auth Providers List', self::MODEL_AUTH_PROVIDER_LIST, 'platforms', self::MODEL_AUTH_PROVIDER, true, false)) - ->setModel(new BaseList('Platforms List', self::MODEL_PLATFORM_LIST, 'platforms', self::MODEL_PLATFORM, true, false)) - ->setModel(new BaseList('Countries List', self::MODEL_COUNTRY_LIST, 'countries', self::MODEL_COUNTRY)) - ->setModel(new BaseList('Continents List', self::MODEL_CONTINENT_LIST, 'continents', self::MODEL_CONTINENT)) - ->setModel(new BaseList('Languages List', self::MODEL_LANGUAGE_LIST, 'languages', self::MODEL_LANGUAGE)) - ->setModel(new BaseList('Currencies List', self::MODEL_CURRENCY_LIST, 'currencies', self::MODEL_CURRENCY)) - ->setModel(new BaseList('Phones List', self::MODEL_PHONE_LIST, 'phones', self::MODEL_PHONE)) - ->setModel(new BaseList('Metric List', self::MODEL_METRIC_LIST, 'metrics', self::MODEL_METRIC, true, false)) - ->setModel(new BaseList('Variables List', self::MODEL_VARIABLE_LIST, 'variables', self::MODEL_VARIABLE)) - ->setModel(new BaseList('Status List', self::MODEL_HEALTH_STATUS_LIST, 'statuses', self::MODEL_HEALTH_STATUS)) - ->setModel(new BaseList('Rule List', self::MODEL_PROXY_RULE_LIST, 'rules', self::MODEL_PROXY_RULE)) - ->setModel(new BaseList('Locale codes list', self::MODEL_LOCALE_CODE_LIST, 'localeCodes', self::MODEL_LOCALE_CODE)) - ->setModel(new BaseList('Provider list', self::MODEL_PROVIDER_LIST, 'providers', self::MODEL_PROVIDER)) - ->setModel(new BaseList('Message list', self::MODEL_MESSAGE_LIST, 'messages', self::MODEL_MESSAGE)) - ->setModel(new BaseList('Topic list', self::MODEL_TOPIC_LIST, 'topics', self::MODEL_TOPIC)) - ->setModel(new BaseList('Subscriber list', self::MODEL_SUBSCRIBER_LIST, 'subscribers', self::MODEL_SUBSCRIBER)) - ->setModel(new BaseList('Target list', self::MODEL_TARGET_LIST, 'targets', self::MODEL_TARGET)) - ->setModel(new BaseList('Transaction List', self::MODEL_TRANSACTION_LIST, 'transactions', self::MODEL_TRANSACTION)) - ->setModel(new BaseList('Migrations List', self::MODEL_MIGRATION_LIST, 'migrations', self::MODEL_MIGRATION)) - ->setModel(new BaseList('Migrations Firebase Projects List', self::MODEL_MIGRATION_FIREBASE_PROJECT_LIST, 'projects', self::MODEL_MIGRATION_FIREBASE_PROJECT)) - ->setModel(new BaseList('Specifications List', self::MODEL_SPECIFICATION_LIST, 'specifications', self::MODEL_SPECIFICATION)) - ->setModel(new BaseList('VCS Content List', self::MODEL_VCS_CONTENT_LIST, 'contents', self::MODEL_VCS_CONTENT)) - // Entities - ->setModel(new Database()) - // Collection API Models - ->setModel(new Collection()) - ->setModel(new Attribute()) - ->setModel(new AttributeList()) - ->setModel(new AttributeString()) - ->setModel(new AttributeInteger()) - ->setModel(new AttributeFloat()) - ->setModel(new AttributeBoolean()) - ->setModel(new AttributeEmail()) - ->setModel(new AttributeEnum()) - ->setModel(new AttributeIP()) - ->setModel(new AttributeURL()) - ->setModel(new AttributeDatetime()) - ->setModel(new AttributeRelationship()) - ->setModel(new AttributePoint()) - ->setModel(new AttributeLine()) - ->setModel(new AttributePolygon()) - // Table API Models - ->setModel(new Table()) - ->setModel(new Column()) - ->setModel(new ColumnList()) - ->setModel(new ColumnString()) - ->setModel(new ColumnInteger()) - ->setModel(new ColumnFloat()) - ->setModel(new ColumnBoolean()) - ->setModel(new ColumnEmail()) - ->setModel(new ColumnEnum()) - ->setModel(new ColumnIP()) - ->setModel(new ColumnURL()) - ->setModel(new ColumnDatetime()) - ->setModel(new ColumnRelationship()) - ->setModel(new ColumnPoint()) - ->setModel(new ColumnLine()) - ->setModel(new ColumnPolygon()) - ->setModel(new Index()) - ->setModel(new ColumnIndex()) - ->setModel(new Row()) - ->setModel(new ModelDocument()) - ->setModel(new Log()) - ->setModel(new User()) - ->setModel(new AlgoMd5()) - ->setModel(new AlgoSha()) - ->setModel(new AlgoPhpass()) - ->setModel(new AlgoBcrypt()) - ->setModel(new AlgoScrypt()) - ->setModel(new AlgoScryptModified()) - ->setModel(new AlgoArgon2()) - ->setModel(new Account()) - ->setModel(new Preferences()) - ->setModel(new Session()) - ->setModel(new Identity()) - ->setModel(new Token()) - ->setModel(new JWT()) - ->setModel(new Locale()) - ->setModel(new LocaleCode()) - ->setModel(new File()) - ->setModel(new Bucket()) - ->setModel(new ResourceToken()) - ->setModel(new Team()) - ->setModel(new Membership()) - ->setModel(new Site()) - ->setModel(new TemplateSite()) - ->setModel(new TemplateFramework()) - ->setModel(new Func()) - ->setModel(new TemplateFunction()) - ->setModel(new TemplateRuntime()) - ->setModel(new TemplateVariable()) - ->setModel(new Installation()) - ->setModel(new ProviderRepository()) - ->setModel(new ProviderRepositoryFramework()) - ->setModel(new ProviderRepositoryRuntime()) - ->setModel(new DetectionFramework()) - ->setModel(new DetectionRuntime()) - ->setModel(new DetectionVariable()) - ->setModel(new VcsContent()) - ->setModel(new Branch()) - ->setModel(new Runtime()) - ->setModel(new Framework()) - ->setModel(new FrameworkAdapter()) - ->setModel(new Deployment()) - ->setModel(new Execution()) - ->setModel(new Project()) - ->setModel(new Webhook()) - ->setModel(new Key()) - ->setModel(new DevKey()) - ->setModel(new MockNumber()) - ->setModel(new AuthProvider()) - ->setModel(new Platform()) - ->setModel(new Variable()) - ->setModel(new Country()) - ->setModel(new Continent()) - ->setModel(new Language()) - ->setModel(new Currency()) - ->setModel(new Phone()) - ->setModel(new HealthAntivirus()) - ->setModel(new HealthQueue()) - ->setModel(new HealthStatus()) - ->setModel(new HealthCertificate()) - ->setModel(new HealthTime()) - ->setModel(new HealthVersion()) - ->setModel(new Metric()) - ->setModel(new MetricBreakdown()) - ->setModel(new UsageDatabases()) - ->setModel(new UsageDatabase()) - ->setModel(new UsageTable()) - ->setModel(new UsageCollection()) - ->setModel(new UsageUsers()) - ->setModel(new UsageStorage()) - ->setModel(new UsageBuckets()) - ->setModel(new UsageFunctions()) - ->setModel(new UsageFunction()) - ->setModel(new UsageSites()) - ->setModel(new UsageSite()) - ->setModel(new UsageProject()) - ->setModel(new Headers()) - ->setModel(new Specification()) - ->setModel(new Rule()) - ->setModel(new TemplateSMS()) - ->setModel(new TemplateEmail()) - ->setModel(new ConsoleVariables()) - ->setModel(new MFAChallenge()) - ->setModel(new MFARecoveryCodes()) - ->setModel(new MFAType()) - ->setModel(new MFAFactors()) - ->setModel(new Provider()) - ->setModel(new Message()) - ->setModel(new Topic()) - ->setModel(new Transaction()) - ->setModel(new Subscriber()) - ->setModel(new Target()) - ->setModel(new Migration()) - ->setModel(new MigrationReport()) - ->setModel(new MigrationFirebaseProject()) - // Tests (keep last) - ->setModel(new Mock()); - parent::__construct($response); } @@ -639,20 +305,14 @@ class Response extends SwooleResponse public const CONTENT_TYPE_MULTIPART = 'multipart/form-data'; /** - * List of defined output objects - */ - protected $models = []; - - /** - * Set Model Object + * Register a model * - * @return self + * @param Model $model + * @return void */ - public function setModel(Model $instance): Response + public static function setModel(Model $model): void { - $this->models[$instance->getType()] = $instance; - - return $this; + self::$models[$model->getType()] = $model; } /** @@ -664,11 +324,11 @@ class Response extends SwooleResponse */ public function getModel(string $key): Model { - if (!isset($this->models[$key])) { + if (!isset(self::$models[$key])) { throw new Exception('Undefined model: ' . $key); } - return $this->models[$key]; + return self::$models[$key]; } /** @@ -678,7 +338,18 @@ class Response extends SwooleResponse */ public function getModels(): array { - return $this->models; + return self::$models; + } + + /** + * Check if a model exists + * + * @param string $key + * @return bool + */ + public static function hasModel(string $key): bool + { + return isset(self::$models[$key]); } public function applyFilters(array $data, string $model): array @@ -774,7 +445,7 @@ class Response extends SwooleResponse } if ($rule['array']) { - if (!is_array($data[$key])) { + if (!\is_array($data[$key])) { throw new Exception($key . ' must be an array of type ' . $rule['type']); } @@ -798,7 +469,7 @@ class Response extends SwooleResponse $ruleType = $rule['type']; } - if (!array_key_exists($ruleType, $this->models)) { + if (!self::hasModel($ruleType)) { throw new Exception('Missing model for rule: ' . $ruleType); } diff --git a/src/Appwrite/Utopia/Response/Filters/ListSelection.php b/src/Appwrite/Utopia/Response/Filters/ListSelection.php new file mode 100644 index 0000000000..53c5ae75cf --- /dev/null +++ b/src/Appwrite/Utopia/Response/Filters/ListSelection.php @@ -0,0 +1,41 @@ +selectQueries)) { + return $content; + } + + $selections = []; + foreach ($this->selectQueries as $query) { + foreach ($query->getValues() as $value) { + if ($value === '*') { + return $content; + } + $selections[$value] = true; + } + } + + return $this->handleList($content, $this->itemsKey, function (array $item) use ($selections) { + $filtered = []; + foreach ($item as $key => $value) { + if (isset($selections[$key]) || \str_starts_with($key, '$')) { + $filtered[$key] = $value; + } + } + return $filtered; + }); + } +} diff --git a/src/Appwrite/Utopia/Response/Model.php b/src/Appwrite/Utopia/Response/Model.php index 59c786ee1f..687b8b3eba 100644 --- a/src/Appwrite/Utopia/Response/Model.php +++ b/src/Appwrite/Utopia/Response/Model.php @@ -101,22 +101,6 @@ abstract class Model return $this; } - /** - * Delete an existing Rule - * If rule exists, it will be removed - * - * @param string $key - * @return Model - */ - public function removeRule(string $key): self - { - if (isset($this->rules[$key])) { - unset($this->rules[$key]); - } - - return $this; - } - /** * @return array */ diff --git a/src/Appwrite/Utopia/Response/Model/Account.php b/src/Appwrite/Utopia/Response/Model/Account.php index 07fd4e92ab..2ccbd2e480 100644 --- a/src/Appwrite/Utopia/Response/Model/Account.php +++ b/src/Appwrite/Utopia/Response/Model/Account.php @@ -3,18 +3,131 @@ namespace Appwrite\Utopia\Response\Model; use Appwrite\Utopia\Response; +use Appwrite\Utopia\Response\Model; +use Utopia\Database\Document; -class Account extends User +class Account extends Model { public function __construct() { - parent::__construct(); - $this - ->removeRule('password') - ->removeRule('hash') - ->removeRule('mfaRecoveryCodes') - ->removeRule('hashOptions'); + ->addRule('$id', [ + 'type' => self::TYPE_STRING, + 'description' => 'User ID.', + 'default' => '', + 'example' => '5e5ea5c16897e', + ]) + ->addRule('$createdAt', [ + 'type' => self::TYPE_DATETIME, + 'description' => 'User creation date in ISO 8601 format.', + 'default' => '', + 'example' => self::TYPE_DATETIME_EXAMPLE, + ]) + ->addRule('$updatedAt', [ + 'type' => self::TYPE_DATETIME, + 'description' => 'User update date in ISO 8601 format.', + 'default' => '', + 'example' => self::TYPE_DATETIME_EXAMPLE, + ]) + ->addRule('name', [ + 'type' => self::TYPE_STRING, + 'description' => 'User name.', + 'default' => '', + 'example' => 'John Doe', + ]) + ->addRule('registration', [ + 'type' => self::TYPE_DATETIME, + 'description' => 'User registration date in ISO 8601 format.', + 'default' => '', + 'example' => self::TYPE_DATETIME_EXAMPLE, + ]) + ->addRule('status', [ + 'type' => self::TYPE_BOOLEAN, + 'description' => 'User status. Pass `true` for enabled and `false` for disabled.', + 'default' => true, + 'example' => true, + ]) + ->addRule('labels', [ + 'type' => self::TYPE_STRING, + 'description' => 'Labels for the user.', + 'default' => [], + 'example' => ['vip'], + 'array' => true, + ]) + ->addRule('passwordUpdate', [ + 'type' => self::TYPE_DATETIME, + 'description' => 'Password update time in ISO 8601 format.', + 'default' => '', + 'example' => self::TYPE_DATETIME_EXAMPLE, + ]) + ->addRule('email', [ + 'type' => self::TYPE_STRING, + 'description' => 'User email address.', + 'default' => '', + 'example' => 'john@appwrite.io', + ]) + ->addRule('phone', [ + 'type' => self::TYPE_STRING, + 'description' => 'User phone number in E.164 format.', + 'default' => '', + 'example' => '+4930901820', + ]) + ->addRule('emailVerification', [ + 'type' => self::TYPE_BOOLEAN, + 'description' => 'Email verification status.', + 'default' => false, + 'example' => true, + ]) + ->addRule('phoneVerification', [ + 'type' => self::TYPE_BOOLEAN, + 'description' => 'Phone verification status.', + 'default' => false, + 'example' => true, + ]) + ->addRule('mfa', [ + 'type' => self::TYPE_BOOLEAN, + 'description' => 'Multi factor authentication status.', + 'default' => false, + 'example' => true, + ]) + ->addRule('prefs', [ + 'type' => Response::MODEL_PREFERENCES, + 'description' => 'User preferences as a key-value object', + 'default' => new \stdClass(), + 'example' => ['theme' => 'pink', 'timezone' => 'UTC'], + ]) + ->addRule('targets', [ + 'type' => Response::MODEL_TARGET, + 'description' => 'A user-owned message receiver. A single user may have multiple e.g. emails, phones, and a browser. Each target is registered with a single provider.', + 'default' => [], + 'array' => true, + 'example' => [], + ]) + ->addRule('accessedAt', [ + 'type' => self::TYPE_DATETIME, + 'description' => 'Most recent access date in ISO 8601 format. This attribute is only updated again after ' . APP_USER_ACCESS / 60 / 60 . ' hours.', + 'default' => '', + 'example' => self::TYPE_DATETIME_EXAMPLE, + ]) + ; + } + + /** + * Get Collection + * + * @return Document + */ + public function filter(Document $document): Document + { + $prefs = $document->getAttribute('prefs'); + if ($prefs instanceof Document) { + $prefs = $prefs->getArrayCopy(); + } + + if (is_array($prefs) && empty($prefs)) { + $document->setAttribute('prefs', new \stdClass()); + } + return $document; } /** diff --git a/src/Appwrite/Utopia/Response/Model/AttributeInteger.php b/src/Appwrite/Utopia/Response/Model/AttributeInteger.php index fddfe57445..ecdfd38e2d 100644 --- a/src/Appwrite/Utopia/Response/Model/AttributeInteger.php +++ b/src/Appwrite/Utopia/Response/Model/AttributeInteger.php @@ -25,6 +25,7 @@ class AttributeInteger extends Attribute ]) ->addRule('min', [ 'type' => self::TYPE_INTEGER, + 'format' => 'int64', 'description' => 'Minimum value to enforce for new documents.', 'default' => null, 'required' => false, @@ -32,6 +33,7 @@ class AttributeInteger extends Attribute ]) ->addRule('max', [ 'type' => self::TYPE_INTEGER, + 'format' => 'int64', 'description' => 'Maximum value to enforce for new documents.', 'default' => null, 'required' => false, diff --git a/src/Appwrite/Utopia/Response/Model/Bucket.php b/src/Appwrite/Utopia/Response/Model/Bucket.php index f51c8b6527..aece4cf850 100644 --- a/src/Appwrite/Utopia/Response/Model/Bucket.php +++ b/src/Appwrite/Utopia/Response/Model/Bucket.php @@ -69,7 +69,7 @@ class Bucket extends Model ]) ->addRule('compression', [ 'type' => self::TYPE_STRING, - 'description' => 'Compression algorithm choosen for compression. Will be one of ' . Compression::NONE . ', [' . Compression::GZIP . '](https://en.wikipedia.org/wiki/Gzip), or [' . Compression::ZSTD . '](https://en.wikipedia.org/wiki/Zstd).', + 'description' => 'Compression algorithm chosen for compression. Will be one of ' . Compression::NONE . ', [' . Compression::GZIP . '](https://en.wikipedia.org/wiki/Gzip), or [' . Compression::ZSTD . '](https://en.wikipedia.org/wiki/Zstd).', 'default' => '', 'example' => 'gzip', 'array' => false @@ -92,6 +92,12 @@ class Bucket extends Model 'default' => true, 'example' => false, ]) + ->addRule('totalSize', [ + 'type' => self::TYPE_INTEGER, + 'description' => 'Total size of this bucket in bytes.', + 'default' => 0, + 'example' => 128, + ]) ; } diff --git a/src/Appwrite/Utopia/Response/Model/ColumnInteger.php b/src/Appwrite/Utopia/Response/Model/ColumnInteger.php index 9f6c2c89ab..b248a8d88e 100644 --- a/src/Appwrite/Utopia/Response/Model/ColumnInteger.php +++ b/src/Appwrite/Utopia/Response/Model/ColumnInteger.php @@ -25,6 +25,7 @@ class ColumnInteger extends Column ]) ->addRule('min', [ 'type' => self::TYPE_INTEGER, + 'format' => 'int64', 'description' => 'Minimum value to enforce for new documents.', 'default' => null, 'required' => false, @@ -32,6 +33,7 @@ class ColumnInteger extends Column ]) ->addRule('max', [ 'type' => self::TYPE_INTEGER, + 'format' => 'int64', 'description' => 'Maximum value to enforce for new documents.', 'default' => null, 'required' => false, diff --git a/src/Appwrite/Utopia/Response/Model/Deployment.php b/src/Appwrite/Utopia/Response/Model/Deployment.php index f0815630b3..c13660c8f1 100644 --- a/src/Appwrite/Utopia/Response/Model/Deployment.php +++ b/src/Appwrite/Utopia/Response/Model/Deployment.php @@ -96,10 +96,10 @@ class Deployment extends Model ]) ->addRule('status', [ 'type' => self::TYPE_ENUM, - 'description' => 'The deployment status. Possible values are "waiting", "processing", "building", "ready", and "failed".', + 'description' => 'The deployment status. Possible values are "waiting", "processing", "building", "ready", "canceled" and "failed".', 'default' => '', 'example' => 'ready', - 'enum' => ['waiting', 'processing', 'building', 'ready', 'failed'], + 'enum' => ['waiting', 'processing', 'building', 'ready', 'canceled', 'failed'], ]) ->addRule('buildLogs', [ 'type' => self::TYPE_STRING, diff --git a/src/Appwrite/Utopia/Response/Model/File.php b/src/Appwrite/Utopia/Response/Model/File.php index 11a128abcc..c4e36286ea 100644 --- a/src/Appwrite/Utopia/Response/Model/File.php +++ b/src/Appwrite/Utopia/Response/Model/File.php @@ -4,6 +4,8 @@ namespace Appwrite\Utopia\Response\Model; use Appwrite\Utopia\Response; use Appwrite\Utopia\Response\Model; +use Utopia\Database\Document; +use Utopia\Storage\Compression\Compression; class File extends Model { @@ -77,6 +79,18 @@ class File extends Model 'default' => 0, 'example' => 17890, ]) + ->addRule('encryption', [ + 'type' => self::TYPE_BOOLEAN, + 'description' => 'Whether file contents are encrypted at rest.', + 'default' => false, + 'example' => true, + ]) + ->addRule('compression', [ + 'type' => self::TYPE_STRING, + 'description' => 'Compression algorithm used for the file. Will be one of ' . Compression::NONE . ', [' . Compression::GZIP . '](https://en.wikipedia.org/wiki/Gzip), or [' . Compression::ZSTD . '](https://en.wikipedia.org/wiki/Zstd).', + 'default' => '', + 'example' => 'gzip' + ]) ; } @@ -99,4 +113,14 @@ class File extends Model { return Response::MODEL_FILE; } + + public function filter(Document $document): Document + { + $document->setAttribute('compression', $document->getAttribute('algorithm', '')); + + $encryption = !empty($document->getAttribute('openSSLCipher', '')); + $document->setAttribute('encryption', $encryption); + + return $document; + } } diff --git a/src/Appwrite/Utopia/Response/Model/Message.php b/src/Appwrite/Utopia/Response/Model/Message.php index 4c1e08b9cb..95b965fa1a 100644 --- a/src/Appwrite/Utopia/Response/Model/Message.php +++ b/src/Appwrite/Utopia/Response/Model/Message.php @@ -98,7 +98,7 @@ class Message extends Model 'type' => self::TYPE_ENUM, 'description' => 'Status of delivery.', 'default' => 'draft', - 'example' => 'Message status can be one of the following: draft, processing, scheduled, sent, or failed.', + 'example' => 'processing', 'enum' => ['draft', 'processing', 'scheduled', 'sent', 'failed'], ]); } diff --git a/src/Appwrite/Utopia/Response/Model/Project.php b/src/Appwrite/Utopia/Response/Model/Project.php index 65f9f7685b..c516aab73f 100644 --- a/src/Appwrite/Utopia/Response/Model/Project.php +++ b/src/Appwrite/Utopia/Response/Model/Project.php @@ -276,6 +276,13 @@ class Project extends Model 'default' => '', 'example' => self::TYPE_DATETIME_EXAMPLE, ]) + ->addRule('labels', [ + 'type' => self::TYPE_STRING, + 'description' => 'Labels for the project.', + 'default' => [], + 'example' => ['vip'], + 'array' => true, + ]) ; $services = Config::getParam('services', []); @@ -341,6 +348,20 @@ class Project extends Model */ public function filter(Document $document): Document { + $this->expandSmtpFields($document); + $this->expandServiceFields($document); + $this->expandAuthFields($document); + $this->expandOAuthProviders($document); + + return $document; + } + + private function expandSmtpFields(Document $document): void + { + if (!$document->isSet('smtp')) { + return; + } + // SMTP $smtp = $document->getAttribute('smtp', []); $document->setAttribute('smtpEnabled', $smtp['enabled'] ?? false); @@ -352,8 +373,14 @@ class Project extends Model $document->setAttribute('smtpUsername', $smtp['username'] ?? ''); $document->setAttribute('smtpPassword', $smtp['password'] ?? ''); $document->setAttribute('smtpSecure', $smtp['secure'] ?? ''); + } + + private function expandServiceFields(Document $document): void + { + if (!$document->isSet('services')) { + return; + } - // Services $values = $document->getAttribute('services', []); $services = Config::getParam('services', []); @@ -365,8 +392,14 @@ class Project extends Model $value = $values[$key] ?? true; $document->setAttribute('serviceStatusFor' . ucfirst($key), $value); } + } + + private function expandAuthFields(Document $document): void + { + if (!$document->isSet('auths')) { + return; + } - // Auth $authValues = $document->getAttribute('auths', []); $auth = Config::getParam('auth', []); @@ -383,13 +416,19 @@ class Project extends Model $document->setAttribute('authMembershipsMfa', $authValues['membershipsMfa'] ?? true); $document->setAttribute('authInvalidateSessions', $authValues['invalidateSessions'] ?? false); - foreach ($auth as $index => $method) { + foreach ($auth as $method) { $key = $method['key']; $value = $authValues[$key] ?? true; $document->setAttribute('auth' . ucfirst($key), $value); } + } + + private function expandOAuthProviders(Document $document): void + { + if (!$document->isSet('oAuthProviders')) { + return; + } - // OAuth Providers $providers = Config::getParam('oAuthProviders', []); $providerValues = $document->getAttribute('oAuthProviders', []); $projectProviders = []; @@ -410,7 +449,5 @@ class Project extends Model } $document->setAttribute('oAuthProviders', $projectProviders); - - return $document; } } diff --git a/src/Appwrite/Utopia/Response/Model/UsageSites.php b/src/Appwrite/Utopia/Response/Model/UsageSites.php index 74435b332c..fea87c7718 100644 --- a/src/Appwrite/Utopia/Response/Model/UsageSites.php +++ b/src/Appwrite/Utopia/Response/Model/UsageSites.php @@ -3,15 +3,19 @@ namespace Appwrite\Utopia\Response\Model; use Appwrite\Utopia\Response; +use Appwrite\Utopia\Response\Model; -class UsageSites extends UsageFunctions +class UsageSites extends Model { public function __construct() { - parent::__construct(); $this - ->removeRule('functionsTotal') - ->removeRule('functions') + ->addRule('range', [ + 'type' => self::TYPE_STRING, + 'description' => 'Time range of the usage stats.', + 'default' => '', + 'example' => '30d', + ]) ->addRule('sitesTotal', [ 'type' => self::TYPE_INTEGER, 'description' => 'Total aggregated number of sites.', @@ -25,6 +29,60 @@ class UsageSites extends UsageFunctions 'example' => [], 'array' => true ]) + ->addRule('deploymentsTotal', [ + 'type' => self::TYPE_INTEGER, + 'description' => 'Total aggregated number of sites deployments.', + 'default' => 0, + 'example' => 0, + ]) + ->addRule('deploymentsStorageTotal', [ + 'type' => self::TYPE_INTEGER, + 'description' => 'Total aggregated sum of sites deployment storage.', + 'default' => 0, + 'example' => 0, + ]) + ->addRule('buildsTotal', [ + 'type' => self::TYPE_INTEGER, + 'description' => 'Total aggregated number of sites build.', + 'default' => 0, + 'example' => 0, + ]) + ->addRule('buildsStorageTotal', [ + 'type' => self::TYPE_INTEGER, + 'description' => 'total aggregated sum of sites build storage.', + 'default' => 0, + 'example' => 0, + ]) + ->addRule('buildsTimeTotal', [ + 'type' => self::TYPE_INTEGER, + 'description' => 'Total aggregated sum of sites build compute time.', + 'default' => 0, + 'example' => 0, + ]) + ->addRule('buildsMbSecondsTotal', [ + 'type' => self::TYPE_INTEGER, + 'description' => 'Total aggregated sum of sites build mbSeconds.', + 'default' => 0, + 'example' => 0, + ]) + ->addRule('executionsTotal', [ + 'type' => self::TYPE_INTEGER, + 'description' => 'Total aggregated number of sites execution.', + 'default' => 0, + 'example' => 0, + ]) + ->addRule('executionsTimeTotal', [ + 'type' => self::TYPE_INTEGER, + 'description' => 'Total aggregated sum of sites execution compute time.', + 'default' => 0, + 'example' => 0, + ]) + ->addRule('executionsMbSecondsTotal', [ + 'type' => self::TYPE_INTEGER, + 'description' => 'Total aggregated sum of sites execution mbSeconds.', + 'default' => 0, + 'example' => 0, + ]) ->addRule('requestsTotal', [ 'type' => self::TYPE_INTEGER, 'description' => 'Total aggregated number of requests.', @@ -64,6 +122,95 @@ class UsageSites extends UsageFunctions 'example' => [], 'array' => true ]) + ->addRule('deployments', [ + 'type' => Response::MODEL_METRIC, + 'description' => 'Aggregated number of sites deployment per period.', + 'default' => [], + 'example' => [], + 'array' => true + ]) + ->addRule('deploymentsStorage', [ + 'type' => Response::MODEL_METRIC, + 'description' => 'Aggregated number of sites deployment storage per period.', + 'default' => [], + 'example' => [], + 'array' => true + ]) + ->addRule('buildsSuccessTotal', [ + 'type' => self::TYPE_INTEGER, + 'description' => 'Total aggregated number of successful site builds.', + 'default' => 0, + 'example' => 0, + ]) + ->addRule('buildsFailedTotal', [ + 'type' => self::TYPE_INTEGER, + 'description' => 'Total aggregated number of failed site builds.', + 'default' => 0, + 'example' => 0, + ]) + ->addRule('builds', [ + 'type' => Response::MODEL_METRIC, + 'description' => 'Aggregated number of sites build per period.', + 'default' => [], + 'example' => [], + 'array' => true + ]) + ->addRule('buildsStorage', [ + 'type' => Response::MODEL_METRIC, + 'description' => 'Aggregated sum of sites build storage per period.', + 'default' => [], + 'example' => [], + 'array' => true + ]) + ->addRule('buildsTime', [ + 'type' => Response::MODEL_METRIC, + 'description' => 'Aggregated sum of sites build compute time per period.', + 'default' => [], + 'example' => [], + 'array' => true + ]) + ->addRule('buildsMbSeconds', [ + 'type' => Response::MODEL_METRIC, + 'description' => 'Aggregated sum of sites build mbSeconds per period.', + 'default' => [], + 'example' => [], + 'array' => true + ]) + ->addRule('executions', [ + 'type' => Response::MODEL_METRIC, + 'description' => 'Aggregated number of sites execution per period.', + 'default' => [], + 'example' => [], + 'array' => true + ]) + ->addRule('executionsTime', [ + 'type' => Response::MODEL_METRIC, + 'description' => 'Aggregated number of sites execution compute time per period.', + 'default' => [], + 'example' => [], + 'array' => true + ]) + ->addRule('executionsMbSeconds', [ + 'type' => Response::MODEL_METRIC, + 'description' => 'Aggregated number of sites mbSeconds per period.', + 'default' => [], + 'example' => [], + 'array' => true + ]) + ->addRule('buildsSuccess', [ + 'type' => Response::MODEL_METRIC, + 'description' => 'Aggregated number of successful site builds per period.', + 'default' => [], + 'example' => [], + 'array' => true + ]) + ->addRule('buildsFailed', [ + 'type' => Response::MODEL_METRIC, + 'description' => 'Aggregated number of failed site builds per period.', + 'default' => [], + 'example' => [], + 'array' => true + ]) ; } diff --git a/tests/e2e/General/HTTPTest.php b/tests/e2e/General/HTTPTest.php index 6323500136..4012745682 100644 --- a/tests/e2e/General/HTTPTest.php +++ b/tests/e2e/General/HTTPTest.php @@ -31,7 +31,7 @@ class HTTPTest extends Scope $this->assertEquals(204, $response['headers']['status-code']); $this->assertEquals('Appwrite', $response['headers']['server']); $this->assertEquals('GET, POST, PUT, PATCH, DELETE', $response['headers']['access-control-allow-methods']); - $this->assertEquals('Accept, Origin, Cookie, Set-Cookie, Content-Type, Content-Range, X-Appwrite-Project, X-Appwrite-Key, X-Appwrite-Dev-Key, X-Appwrite-Locale, X-Appwrite-Mode, X-Appwrite-JWT, X-Appwrite-Response-Format, X-Appwrite-Timeout, X-Appwrite-ID, X-Appwrite-Timestamp, X-Appwrite-Session, X-SDK-Version, X-SDK-Name, X-SDK-Language, X-SDK-Platform, X-SDK-GraphQL, X-SDK-Profile, Range, Cache-Control, Expires, Pragma, X-Fallback-Cookies, X-Requested-With, X-Forwarded-For, X-Forwarded-User-Agent', $response['headers']['access-control-allow-headers']); + $this->assertEquals('Accept, Origin, Cookie, Set-Cookie, Content-Type, Content-Range, X-Appwrite-Project, X-Appwrite-Key, X-Appwrite-Dev-Key, X-Appwrite-Locale, X-Appwrite-Mode, X-Appwrite-JWT, X-Appwrite-Response-Format, X-Appwrite-Timeout, X-Appwrite-ID, X-Appwrite-Timestamp, X-Appwrite-Session, X-Appwrite-Platform, X-SDK-Version, X-SDK-Name, X-SDK-Language, X-SDK-Platform, X-SDK-GraphQL, X-SDK-Profile, Range, Cache-Control, Expires, Pragma, X-Fallback-Cookies, X-Requested-With, X-Forwarded-For, X-Forwarded-User-Agent', $response['headers']['access-control-allow-headers']); $this->assertEquals('X-Appwrite-Session, X-Fallback-Cookies', $response['headers']['access-control-expose-headers']); $this->assertEquals('http://localhost', $response['headers']['access-control-allow-origin']); $this->assertEquals('true', $response['headers']['access-control-allow-credentials']); diff --git a/tests/e2e/Scopes/ProjectCustom.php b/tests/e2e/Scopes/ProjectCustom.php index c2b4896814..52c53016d6 100644 --- a/tests/e2e/Scopes/ProjectCustom.php +++ b/tests/e2e/Scopes/ProjectCustom.php @@ -161,9 +161,9 @@ trait ProjectCustom 'senderEmail' => 'mailer@appwrite.io', 'senderName' => 'Mailer', 'host' => 'maildev', - 'port' => 1025, - 'username' => '', - 'password' => '', + 'port' => intval(System::getEnv('_APP_SMTP_PORT', "1025")), + 'username' => System::getEnv('_APP_SMTP_USERNAME', 'user'), + 'password' => System::getEnv('_APP_SMTP_PASSWORD', 'password'), ]); $project = [ diff --git a/tests/e2e/Services/Account/AccountBase.php b/tests/e2e/Services/Account/AccountBase.php index 0c9d481371..fa0d5f0fab 100644 --- a/tests/e2e/Services/Account/AccountBase.php +++ b/tests/e2e/Services/Account/AccountBase.php @@ -363,4 +363,77 @@ trait AccountBase $this->assertEquals($response['headers']['status-code'], 201); $this->assertEquals('191.0.113.195', $response['body']['clientIp'] ?? $response['body']['ip'] ?? ''); } + + /** + * @group abuseEnabled + */ + public function testAccountAbuseReset(): void + { + $email = \uniqid() . '.abuse.reset.test@example.com'; + $password = 'password'; + $account = $this->client->call(Client::METHOD_POST, '/account', array_merge([ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ]), [ + 'userId' => ID::unique(), + 'email' => $email, + 'password' => $password, + 'name' => 'Abuse Reset Test', + ]); + + $this->assertEquals($account['headers']['status-code'], 201); + + // 20 successful requests won't get blocked + for ($i = 0; $i < 20; $i++) { + $session = $this->client->call(Client::METHOD_POST, '/account/sessions/email', array_merge([ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ]), [ + 'email' => $email, + 'password' => $password, + ]); + + $this->assertEquals($session['headers']['status-code'], 201); + } + + // 10 failures are OK + for ($i = 0; $i < 10; $i++) { + $session = $this->client->call(Client::METHOD_POST, '/account/sessions/email', array_merge([ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ]), [ + 'email' => $email, + 'password' => 'wrongPassword', + ]); + + $this->assertEquals($session['headers']['status-code'], 401); + } + + // 11th request gets limited + $session = $this->client->call(Client::METHOD_POST, '/account/sessions/email', array_merge([ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ]), [ + 'email' => $email, + 'password' => 'wrongPassword', + ]); + + $this->assertEquals($session['headers']['status-code'], 429); + + // Even correct password is now blocked, correctness doesn't matter + $session = $this->client->call(Client::METHOD_POST, '/account/sessions/email', array_merge([ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ]), [ + 'email' => $email, + 'password' => $password, + ]); + + $this->assertEquals($session['headers']['status-code'], 429); + } } diff --git a/tests/e2e/Services/Account/AccountConsoleClientTest.php b/tests/e2e/Services/Account/AccountConsoleClientTest.php index 3e43d443e3..f0b27a3f7e 100644 --- a/tests/e2e/Services/Account/AccountConsoleClientTest.php +++ b/tests/e2e/Services/Account/AccountConsoleClientTest.php @@ -196,4 +196,55 @@ class AccountConsoleClientTest extends Scope $lastEmail = $this->getLastEmail(); $this->assertEquals($lastEmailId, $lastEmail['id']); } + + public function testGetAccountLogs(): void + { + $email = uniqid() . 'user@localhost.test'; + $password = 'password'; + $name = 'User Name'; + + /** + * Test for SUCCESS - Create account and session for console project + */ + $response = $this->client->call(Client::METHOD_POST, '/account', array_merge([ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ]), [ + 'userId' => ID::unique(), + 'email' => $email, + 'password' => $password, + 'name' => $name, + ]); + + $this->assertEquals($response['headers']['status-code'], 201); + + $response = $this->client->call(Client::METHOD_POST, '/account/sessions/email', array_merge([ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ]), [ + 'email' => $email, + 'password' => $password, + ]); + + $this->assertEquals($response['headers']['status-code'], 201); + + $session = $response['cookies']['a_session_' . $this->getProject()['$id']]; + + /** + * Test for SUCCESS - Get account logs + */ + $response = $this->client->call(Client::METHOD_GET, '/account/logs', array_merge([ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'cookie' => 'a_session_' . $this->getProject()['$id'] . '=' . $session, + ])); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertIsArray($response['body']['logs']); + $this->assertNotEmpty($response['body']['logs']); + $this->assertIsNumeric($response['body']['total']); + } } diff --git a/tests/e2e/Services/Account/AccountCustomClientTest.php b/tests/e2e/Services/Account/AccountCustomClientTest.php index d3aa8a4845..b7f3fcc03d 100644 --- a/tests/e2e/Services/Account/AccountCustomClientTest.php +++ b/tests/e2e/Services/Account/AccountCustomClientTest.php @@ -1845,7 +1845,7 @@ class AccountCustomClientTest extends Scope ])); $this->assertEquals(201, $response['headers']['status-code']); - $this->assertEquals(99, $response['headers']['x-ratelimit-remaining']); + $this->assertEquals(119, $response['headers']['x-ratelimit-remaining']); $this->assertNotEmpty($response['body']['jwt']); $this->assertIsString($response['body']['jwt']); @@ -1887,6 +1887,57 @@ class AccountCustomClientTest extends Scope $this->assertEquals(401, $response['headers']['status-code']); + // Test JWT with custom duration + $response = $this->client->call(Client::METHOD_POST, '/account/sessions/email', array_merge([ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ]), [ + 'email' => $email, + 'password' => $password, + ]); + + $this->assertEquals(201, $response['headers']['status-code']); + + $session = $response['cookies']['a_session_' . $this->getProject()['$id']]; + + $response = $this->client->call(Client::METHOD_POST, '/account/jwt', array_merge([ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'cookie' => 'a_session_' . $this->getProject()['$id'] . '=' . $session, + ]), [ + 'duration' => 5 + ]); + + $this->assertEquals(201, $response['headers']['status-code']); + $this->assertNotEmpty($response['body']['jwt']); + + $jwt = $response['body']['jwt']; + + // Ensure JWT works before expiration + $response = $this->client->call(Client::METHOD_GET, '/account', array_merge([ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-jwt' => $jwt, + ])); + + $this->assertEquals(200, $response['headers']['status-code']); + + // Wait for JWT to expire + \sleep(6); + + // Ensure JWT no longer works after expiration + $response = $this->client->call(Client::METHOD_GET, '/account', array_merge([ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-jwt' => $jwt, + ])); + + $this->assertEquals(401, $response['headers']['status-code']); + return []; } diff --git a/tests/e2e/Services/Databases/Legacy/DatabasesBase.php b/tests/e2e/Services/Databases/Legacy/DatabasesBase.php index d1d2c9687d..6cde01e240 100644 --- a/tests/e2e/Services/Databases/Legacy/DatabasesBase.php +++ b/tests/e2e/Services/Databases/Legacy/DatabasesBase.php @@ -6119,6 +6119,7 @@ trait DatabasesBase $this->assertEquals(200, $inc['headers']['status-code']); $this->assertEquals(6, $inc['body']['count']); $this->assertEquals($collectionId, $inc['body']['$collectionId']); + $this->assertEquals($databaseId, $inc['body']['$databaseId']); // Verify count = 6 $get = $this->client->call(Client::METHOD_GET, "/databases/$databaseId/collections/$collectionId/documents/$docId", array_merge([ @@ -6231,6 +6232,7 @@ trait DatabasesBase $this->assertEquals(200, $dec['headers']['status-code']); $this->assertEquals(9, $dec['body']['count']); $this->assertEquals($collectionId, $dec['body']['$collectionId']); + $this->assertEquals($databaseId, $dec['body']['$databaseId']); $get = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents/' . $documentId, array_merge([ 'content-type' => 'application/json', diff --git a/tests/e2e/Services/Databases/Legacy/Transactions/TransactionsBase.php b/tests/e2e/Services/Databases/Legacy/Transactions/TransactionsBase.php index 0f85de0ff5..d4acfc338c 100644 --- a/tests/e2e/Services/Databases/Legacy/Transactions/TransactionsBase.php +++ b/tests/e2e/Services/Databases/Legacy/Transactions/TransactionsBase.php @@ -3827,6 +3827,7 @@ trait TransactionsBase $this->assertArrayHasKey('$collectionId', $decrementResponse['body'], 'Response should contain $collectionId for Collections API'); $this->assertArrayNotHasKey('$tableId', $decrementResponse['body'], 'Response should not contain $tableId for Collections API'); $this->assertEquals($collectionId, $decrementResponse['body']['$collectionId']); + $this->assertEquals($databaseId, $decrementResponse['body']['$databaseId']); // Test increment endpoint $incrementResponse = $this->client->call( @@ -3846,6 +3847,7 @@ trait TransactionsBase $this->assertArrayHasKey('$collectionId', $incrementResponse['body'], 'Response should contain $collectionId for Collections API'); $this->assertArrayNotHasKey('$tableId', $incrementResponse['body'], 'Response should not contain $tableId for Collections API'); $this->assertEquals($collectionId, $incrementResponse['body']['$collectionId']); + $this->assertEquals($databaseId, $incrementResponse['body']['$databaseId']); // Commit transaction - this will fail if transaction log has 'column' instead of 'attribute' $commitResponse = $this->client->call(Client::METHOD_PATCH, "/databases/transactions/{$transactionId}", array_merge([ diff --git a/tests/e2e/Services/Databases/TablesDB/DatabasesBase.php b/tests/e2e/Services/Databases/TablesDB/DatabasesBase.php index 62b7851271..58bb92f643 100644 --- a/tests/e2e/Services/Databases/TablesDB/DatabasesBase.php +++ b/tests/e2e/Services/Databases/TablesDB/DatabasesBase.php @@ -8022,6 +8022,7 @@ trait DatabasesBase ])); $this->assertEquals(200, $inc['headers']['status-code']); $this->assertEquals($tableId, $inc['body']['$tableId']); + $this->assertEquals($databaseId, $inc['body']['$databaseId']); $this->assertEquals(6, $inc['body']['count']); // Verify count = 6 @@ -8135,6 +8136,7 @@ trait DatabasesBase $this->assertEquals(200, $dec['headers']['status-code']); $this->assertEquals(9, $dec['body']['count']); $this->assertEquals($tableId, $dec['body']['$tableId']); + $this->assertEquals($databaseId, $dec['body']['$databaseId']); $get = $this->client->call(Client::METHOD_GET, '/tablesdb/' . $databaseId . '/tables/' . $tableId . '/rows/' . $rowId, array_merge([ 'content-type' => 'application/json', diff --git a/tests/e2e/Services/Databases/TablesDB/Transactions/TransactionsBase.php b/tests/e2e/Services/Databases/TablesDB/Transactions/TransactionsBase.php index 488dc60239..a5af7053f0 100644 --- a/tests/e2e/Services/Databases/TablesDB/Transactions/TransactionsBase.php +++ b/tests/e2e/Services/Databases/TablesDB/Transactions/TransactionsBase.php @@ -3963,6 +3963,7 @@ trait TransactionsBase $this->assertArrayHasKey('$tableId', $decrementResponse['body'], 'Response should contain $tableId for TablesDB API'); $this->assertArrayNotHasKey('$collectionId', $decrementResponse['body'], 'Response should not contain $collectionId for TablesDB API'); $this->assertEquals($tableId, $decrementResponse['body']['$tableId']); + $this->assertEquals($databaseId, $decrementResponse['body']['$databaseId']); // Test increment endpoint $incrementResponse = $this->client->call( @@ -3982,6 +3983,7 @@ trait TransactionsBase $this->assertArrayHasKey('$tableId', $incrementResponse['body'], 'Response should contain $tableId for TablesDB API'); $this->assertArrayNotHasKey('$collectionId', $incrementResponse['body'], 'Response should not contain $collectionId for TablesDB API'); $this->assertEquals($tableId, $incrementResponse['body']['$tableId']); + $this->assertEquals($databaseId, $incrementResponse['body']['$databaseId']); // Commit transaction - this will fail if transaction log has 'attribute' instead of 'column' $commitResponse = $this->client->call(Client::METHOD_PATCH, "/tablesdb/transactions/{$transactionId}", array_merge([ diff --git a/tests/e2e/Services/GraphQL/Base.php b/tests/e2e/Services/GraphQL/Base.php index 10a6efd8e8..c88e41ce8b 100644 --- a/tests/e2e/Services/GraphQL/Base.php +++ b/tests/e2e/Services/GraphQL/Base.php @@ -2334,7 +2334,8 @@ trait Base buckets { _id name - enabled + enabled, + totalSize } } }'; @@ -2344,6 +2345,7 @@ trait Base _id name enabled + totalSize } }'; case self::UPDATE_BUCKET: @@ -2426,15 +2428,21 @@ trait Base case self::GET_DB_HEALTH: return 'query getDbHealth { healthGetDB { - ping - status + statuses { + ping + status + } + total } }'; case self::GET_CACHE_HEALTH: return 'query getCacheHealth { healthGetCache { - ping - status + statuses { + ping + status + } + total } }'; case self::GET_TIME_HEALTH: diff --git a/tests/e2e/Services/GraphQL/HealthTest.php b/tests/e2e/Services/GraphQL/HealthTest.php index 484883f668..732f7b5b1a 100644 --- a/tests/e2e/Services/GraphQL/HealthTest.php +++ b/tests/e2e/Services/GraphQL/HealthTest.php @@ -51,6 +51,8 @@ class HealthTest extends Scope $this->assertArrayNotHasKey('errors', $dbHealth['body']); $dbHealth = $dbHealth['body']['data']['healthGetDB']; $this->assertIsArray($dbHealth); + $this->assertIsArray($dbHealth['statuses']); + $this->assertGreaterThan(0, $dbHealth['total']); return $dbHealth; } @@ -72,6 +74,8 @@ class HealthTest extends Scope $this->assertArrayNotHasKey('errors', $cacheHealth['body']); $cacheHealth = $cacheHealth['body']['data']['healthGetCache']; $this->assertIsArray($cacheHealth); + $this->assertIsArray($cacheHealth['statuses']); + $this->assertGreaterThan(0, $cacheHealth['total']); return $cacheHealth; } diff --git a/tests/e2e/Services/GraphQL/StorageServerTest.php b/tests/e2e/Services/GraphQL/StorageServerTest.php index 37dba77ab3..2c648be99a 100644 --- a/tests/e2e/Services/GraphQL/StorageServerTest.php +++ b/tests/e2e/Services/GraphQL/StorageServerTest.php @@ -105,12 +105,24 @@ class StorageServerTest extends Scope $buckets = $buckets['body']['data']['storageListBuckets']; $this->assertIsArray($buckets); + if (!empty($buckets['buckets'])) { + foreach ($buckets['buckets'] as $bucket) { + $this->assertArrayHasKey('totalSize', $bucket); + $this->assertIsInt($bucket['totalSize']); + + /* always 0 because the stats worker runs hourly! */ + $this->assertGreaterThanOrEqual(0, $bucket['totalSize']); + } + } + return $buckets; } /** * @depends testCreateBucket + * @depends testCreateFile * @param $bucket + * @param $file * @return array * @throws \Exception */ @@ -134,6 +146,7 @@ class StorageServerTest extends Scope $this->assertArrayNotHasKey('errors', $bucket['body']); $bucket = $bucket['body']['data']['storageGetBucket']; $this->assertEquals('Actors', $bucket['name']); + $this->assertArrayHasKey('totalSize', $bucket); return $bucket; } diff --git a/tests/e2e/Services/Health/AntiVirusTest.php b/tests/e2e/Services/Health/AntiVirusTest.php new file mode 100644 index 0000000000..e2fc605245 --- /dev/null +++ b/tests/e2e/Services/Health/AntiVirusTest.php @@ -0,0 +1,15 @@ +callGet('/health/anti-virus'); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertNotEmpty($response['body']['status']); + $this->assertIsString($response['body']['status']); + $this->assertIsString($response['body']['version']); + } +} diff --git a/tests/e2e/Services/Health/AuditsQueueTest.php b/tests/e2e/Services/Health/AuditsQueueTest.php new file mode 100644 index 0000000000..e26d9018bc --- /dev/null +++ b/tests/e2e/Services/Health/AuditsQueueTest.php @@ -0,0 +1,17 @@ +callGet('/health/queue/audits'); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertIsInt($response['body']['size']); + $this->assertLessThan(100, $response['body']['size']); + + $failure = $this->callGet('/health/queue/audits', ['threshold' => '0']); + $this->assertEquals(503, $failure['headers']['status-code']); + } +} diff --git a/tests/e2e/Services/Health/BuildsQueueTest.php b/tests/e2e/Services/Health/BuildsQueueTest.php new file mode 100644 index 0000000000..a8f146cf77 --- /dev/null +++ b/tests/e2e/Services/Health/BuildsQueueTest.php @@ -0,0 +1,17 @@ +callGet('/health/queue/builds'); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertIsInt($response['body']['size']); + $this->assertLessThan(100, $response['body']['size']); + + $failure = $this->callGet('/health/queue/builds', ['threshold' => '0']); + $this->assertEquals(503, $failure['headers']['status-code']); + } +} diff --git a/tests/e2e/Services/Health/CacheTest.php b/tests/e2e/Services/Health/CacheTest.php new file mode 100644 index 0000000000..0b825b2dba --- /dev/null +++ b/tests/e2e/Services/Health/CacheTest.php @@ -0,0 +1,16 @@ +callGet('/health/cache'); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertIsArray($response['body']['statuses']); + $this->assertIsInt($response['body']['statuses'][0]['ping']); + $this->assertLessThan(100, $response['body']['statuses'][0]['ping']); + $this->assertEquals('pass', $response['body']['statuses'][0]['status']); + } +} diff --git a/tests/e2e/Services/Health/CertificateTest.php b/tests/e2e/Services/Health/CertificateTest.php new file mode 100644 index 0000000000..b8fe2147ca --- /dev/null +++ b/tests/e2e/Services/Health/CertificateTest.php @@ -0,0 +1,37 @@ +assertCertificate('www.google.com', '/CN=www.google.com', 'www.google.com'); + $this->assertCertificate('appwrite.io', '/CN=appwrite.io', 'appwrite.io'); + + $response = $this->callGet('/health/certificate', ['domain' => 'https://google.com']); + $this->assertEquals(200, $response['headers']['status-code']); + + $this->assertCertificateFailure('localhost', 400); + $this->assertCertificateFailure('doesnotexist.com', 404); + $this->assertCertificateFailure('www.google.com/usr/src/local', 400); + $this->assertCertificateFailure('', 400); + } + + private function assertCertificate(string $domain, string $expectedName, string $expectedSN): void + { + $response = $this->callGet('/health/certificate', ['domain' => $domain]); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertEquals($expectedName, $response['body']['name']); + $this->assertEquals($expectedSN, $response['body']['subjectSN']); + $this->assertContains($response['body']['issuerOrganisation'], ["Let's Encrypt", 'Google Trust Services']); + $this->assertIsInt($response['body']['validFrom']); + $this->assertIsInt($response['body']['validTo']); + } + + private function assertCertificateFailure(string $domain, int $status): void + { + $response = $this->callGet('/health/certificate', ['domain' => $domain]); + $this->assertEquals($status, $response['headers']['status-code']); + } +} diff --git a/tests/e2e/Services/Health/CertificatesQueueTest.php b/tests/e2e/Services/Health/CertificatesQueueTest.php new file mode 100644 index 0000000000..6738482932 --- /dev/null +++ b/tests/e2e/Services/Health/CertificatesQueueTest.php @@ -0,0 +1,17 @@ +callGet('/health/queue/certificates'); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertIsInt($response['body']['size']); + $this->assertLessThan(100, $response['body']['size']); + + $failure = $this->callGet('/health/queue/certificates', ['threshold' => '0']); + $this->assertEquals(503, $failure['headers']['status-code']); + } +} diff --git a/tests/e2e/Services/Health/DBTest.php b/tests/e2e/Services/Health/DBTest.php new file mode 100644 index 0000000000..7b21a3224d --- /dev/null +++ b/tests/e2e/Services/Health/DBTest.php @@ -0,0 +1,16 @@ +callGet('/health/db'); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertIsArray($response['body']['statuses']); + $this->assertIsInt($response['body']['statuses'][0]['ping']); + $this->assertLessThan(100, $response['body']['statuses'][0]['ping']); + $this->assertEquals('pass', $response['body']['statuses'][0]['status']); + } +} diff --git a/tests/e2e/Services/Health/DatabasesQueueTest.php b/tests/e2e/Services/Health/DatabasesQueueTest.php new file mode 100644 index 0000000000..27dc107cb4 --- /dev/null +++ b/tests/e2e/Services/Health/DatabasesQueueTest.php @@ -0,0 +1,17 @@ +callGet('/health/queue/databases', ['name' => 'database_db_main']); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertIsInt($response['body']['size']); + $this->assertLessThan(100, $response['body']['size']); + + $failure = $this->callGet('/health/queue/databases', ['name' => 'database_db_main', 'threshold' => '0']); + $this->assertEquals(503, $failure['headers']['status-code']); + } +} diff --git a/tests/e2e/Services/Health/DeletesQueueTest.php b/tests/e2e/Services/Health/DeletesQueueTest.php new file mode 100644 index 0000000000..9b834fa975 --- /dev/null +++ b/tests/e2e/Services/Health/DeletesQueueTest.php @@ -0,0 +1,17 @@ +callGet('/health/queue/deletes'); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertIsInt($response['body']['size']); + $this->assertLessThan(100, $response['body']['size']); + + $failure = $this->callGet('/health/queue/deletes', ['threshold' => '0']); + $this->assertEquals(503, $failure['headers']['status-code']); + } +} diff --git a/tests/e2e/Services/Health/FunctionsQueueTest.php b/tests/e2e/Services/Health/FunctionsQueueTest.php new file mode 100644 index 0000000000..c66f89b1cd --- /dev/null +++ b/tests/e2e/Services/Health/FunctionsQueueTest.php @@ -0,0 +1,17 @@ +callGet('/health/queue/functions'); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertIsInt($response['body']['size']); + $this->assertLessThan(100, $response['body']['size']); + + $failure = $this->callGet('/health/queue/functions', ['threshold' => '0']); + $this->assertEquals(503, $failure['headers']['status-code']); + } +} diff --git a/tests/e2e/Services/Health/HTTPTest.php b/tests/e2e/Services/Health/HTTPTest.php new file mode 100644 index 0000000000..31ccb0b0a0 --- /dev/null +++ b/tests/e2e/Services/Health/HTTPTest.php @@ -0,0 +1,15 @@ +callGet('/health'); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertEquals('pass', $response['body']['status']); + $this->assertIsInt($response['body']['ping']); + $this->assertLessThan(100, $response['body']['ping']); + } +} diff --git a/tests/e2e/Services/Health/HealthBase.php b/tests/e2e/Services/Health/HealthBase.php index 545cbc893f..fd47c19f2f 100644 --- a/tests/e2e/Services/Health/HealthBase.php +++ b/tests/e2e/Services/Health/HealthBase.php @@ -2,6 +2,26 @@ namespace Tests\E2E\Services\Health; -trait HealthBase +use Tests\E2E\Client; +use Tests\E2E\Scopes\ProjectCustom; +use Tests\E2E\Scopes\Scope; +use Tests\E2E\Scopes\SideServer; + +abstract class HealthBase extends Scope { + use ProjectCustom; + use SideServer; + + protected function getProjectId(): string + { + return $this->getProject()['$id']; + } + + protected function callGet(string $path, array $query = []): array + { + return $this->client->call(Client::METHOD_GET, $path, \array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProjectId(), + ], $this->getHeaders()), $query); + } } diff --git a/tests/e2e/Services/Health/HealthCustomServerTest.php b/tests/e2e/Services/Health/HealthCustomServerTest.php deleted file mode 100644 index 4b7062dc22..0000000000 --- a/tests/e2e/Services/Health/HealthCustomServerTest.php +++ /dev/null @@ -1,544 +0,0 @@ -client->call(Client::METHOD_GET, '/health', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), []); - - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertEquals('pass', $response['body']['status']); - $this->assertIsInt($response['body']['ping']); - $this->assertLessThan(100, $response['body']['ping']); - - return []; - } - - public function testDBSuccess(): array - { - /** - * Test for SUCCESS - */ - $response = $this->client->call(Client::METHOD_GET, '/health/db', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), []); - - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertEquals('pass', $response['body']['statuses'][0]['status']); - $this->assertIsInt($response['body']['statuses'][0]['ping']); - $this->assertLessThan(100, $response['body']['statuses'][0]['ping']); - - return []; - } - - public function testCacheSuccess(): array - { - /** - * Test for SUCCESS - */ - $response = $this->client->call(Client::METHOD_GET, '/health/cache', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), []); - - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertEquals('pass', $response['body']['statuses'][0]['status']); - $this->assertIsInt($response['body']['statuses'][0]['ping']); - $this->assertLessThan(100, $response['body']['statuses'][0]['ping']); - - return []; - } - - public function testPubSubSuccess(): array - { - /** - * Test for SUCCESS - */ - $response = $this->client->call(Client::METHOD_GET, '/health/pubsub', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), []); - - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertEquals('pass', $response['body']['statuses'][0]['status']); - $this->assertIsInt($response['body']['statuses'][0]['ping']); - $this->assertLessThan(100, $response['body']['statuses'][0]['ping']); - - return []; - } - - public function testTimeSuccess(): array - { - /** - * Test for SUCCESS - */ - $response = $this->client->call(Client::METHOD_GET, '/health/time', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), []); - - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertIsInt($response['body']['remoteTime']); - $this->assertIsInt($response['body']['localTime']); - $this->assertNotEmpty($response['body']['remoteTime']); - $this->assertNotEmpty($response['body']['localTime']); - $this->assertLessThan(10, $response['body']['diff']); - - return []; - } - - public function testWebhooksSuccess(): array - { - /** - * Test for SUCCESS - */ - $response = $this->client->call(Client::METHOD_GET, '/health/queue/webhooks', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), []); - - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertIsInt($response['body']['size']); - $this->assertLessThan(100, $response['body']['size']); - - /** - * Test for FAILURE - */ - $response = $this->client->call(Client::METHOD_GET, '/health/queue/webhooks?threshold=0', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), []); - $this->assertEquals(503, $response['headers']['status-code']); - - return []; - } - - public function testLogsSuccess(): array - { - /** - * Test for SUCCESS - */ - $response = $this->client->call(Client::METHOD_GET, '/health/queue/logs', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), []); - - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertIsInt($response['body']['size']); - $this->assertLessThan(100, $response['body']['size']); - - /** - * Test for FAILURE - */ - $response = $this->client->call(Client::METHOD_GET, '/health/queue/logs?threshold=0', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), []); - $this->assertEquals(503, $response['headers']['status-code']); - - return []; - } - - public function testCertificatesSuccess(): array - { - /** - * Test for SUCCESS - */ - $response = $this->client->call(Client::METHOD_GET, '/health/queue/certificates', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), []); - - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertIsInt($response['body']['size']); - $this->assertLessThan(100, $response['body']['size']); - - /** - * Test for FAILURE - */ - $response = $this->client->call(Client::METHOD_GET, '/health/queue/certificates?threshold=0', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), []); - $this->assertEquals(503, $response['headers']['status-code']); - - return []; - } - - public function testFunctionsSuccess(): array - { - /** - * Test for SUCCESS - */ - $response = $this->client->call(Client::METHOD_GET, '/health/queue/functions', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), []); - - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertIsInt($response['body']['size']); - $this->assertLessThan(100, $response['body']['size']); - - /** - * Test for FAILURE - */ - $response = $this->client->call(Client::METHOD_GET, '/health/queue/functions?threshold=0', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), []); - $this->assertEquals(503, $response['headers']['status-code']); - - return []; - } - - public function testBuildsSuccess(): array - { - /** - * Test for SUCCESS - */ - $response = $this->client->call(Client::METHOD_GET, '/health/queue/builds', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), []); - - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertIsInt($response['body']['size']); - $this->assertLessThan(100, $response['body']['size']); - - /** - * Test for FAILURE - */ - $response = $this->client->call(Client::METHOD_GET, '/health/queue/builds?threshold=0', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), []); - $this->assertEquals(503, $response['headers']['status-code']); - - return []; - } - - public function testDatabasesSuccess(): array - { - /** - * Test for SUCCESS - */ - $response = $this->client->call(Client::METHOD_GET, '/health/queue/databases', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), [ - 'name' => 'database_db_main', - ]); - - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertIsInt($response['body']['size']); - $this->assertLessThan(100, $response['body']['size']); - - /** - * Test for FAILURE - */ - $response = $this->client->call(Client::METHOD_GET, '/health/queue/databases', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), [ - 'name' => 'database_db_main', - 'threshold' => '0' - ]); - $this->assertEquals(503, $response['headers']['status-code']); - - return []; - } - - public function testDeletesSuccess(): array - { - /** - * Test for SUCCESS - */ - $response = $this->client->call(Client::METHOD_GET, '/health/queue/deletes', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), []); - - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertIsInt($response['body']['size']); - $this->assertLessThan(100, $response['body']['size']); - - /** - * Test for FAILURE - */ - $response = $this->client->call(Client::METHOD_GET, '/health/queue/deletes?threshold=0', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), []); - $this->assertEquals(503, $response['headers']['status-code']); - - return []; - } - - public function testMailsSuccess(): array - { - /** - * Test for SUCCESS - */ - $response = $this->client->call(Client::METHOD_GET, '/health/queue/mails', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), []); - - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertIsInt($response['body']['size']); - $this->assertLessThan(100, $response['body']['size']); - - /** - * Test for FAILURE - */ - $response = $this->client->call(Client::METHOD_GET, '/health/queue/mails?threshold=0', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), []); - $this->assertEquals(503, $response['headers']['status-code']); - - return []; - } - - public function testMessagingSuccess(): array - { - /** - * Test for SUCCESS - */ - $response = $this->client->call(Client::METHOD_GET, '/health/queue/messaging', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), []); - - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertIsInt($response['body']['size']); - $this->assertLessThan(100, $response['body']['size']); - - /** - * Test for FAILURE - */ - $response = $this->client->call(Client::METHOD_GET, '/health/queue/messaging?threshold=0', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), []); - $this->assertEquals(503, $response['headers']['status-code']); - - return []; - } - - public function testMigrationsSuccess(): array - { - /** - * Test for SUCCESS - */ - $response = $this->client->call(Client::METHOD_GET, '/health/queue/migrations', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), []); - - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertIsInt($response['body']['size']); - $this->assertLessThan(100, $response['body']['size']); - - /** - * Test for FAILURE - */ - $response = $this->client->call(Client::METHOD_GET, '/health/queue/migrations?threshold=0', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), []); - $this->assertEquals(503, $response['headers']['status-code']); - - return []; - } - - public function testStorageLocalSuccess(): array - { - /** - * Test for SUCCESS - */ - $response = $this->client->call(Client::METHOD_GET, '/health/storage/local', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), []); - - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertEquals('pass', $response['body']['status']); - $this->assertIsInt($response['body']['ping']); - $this->assertLessThan(100, $response['body']['ping']); - - return []; - } - - public function testStorageSuccess(): array - { - /** - * Test for SUCCESS - */ - $response = $this->client->call(Client::METHOD_GET, '/health/storage', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), []); - - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertEquals('pass', $response['body']['status']); - $this->assertIsInt($response['body']['ping']); - $this->assertLessThan(100, $response['body']['ping']); - - return []; - } - - public function testStorageAntiVirusSuccess(): array - { - /** - * Test for SUCCESS - */ - $response = $this->client->call(Client::METHOD_GET, '/health/anti-virus', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), []); - - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertNotEmpty($response['body']['status']); - $this->assertIsString($response['body']['status']); - $this->assertIsString($response['body']['version']); - - return []; - } - - public function testCertificateValidity(): array - { - /** - * Test for SUCCESS - */ - $response = $this->client->call(Client::METHOD_GET, '/health/certificate?domain=www.google.com', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), []); - - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertEquals('/CN=www.google.com', $response['body']['name']); - $this->assertEquals('www.google.com', $response['body']['subjectSN']); - $this->assertContains($response['body']['issuerOrganisation'], ['Let\'s Encrypt', 'Google Trust Services']); - $this->assertIsInt($response['body']['validFrom']); - $this->assertIsInt($response['body']['validTo']); - - $response = $this->client->call(Client::METHOD_GET, '/health/certificate?domain=appwrite.io', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), []); - - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertEquals('/CN=appwrite.io', $response['body']['name']); - $this->assertEquals('appwrite.io', $response['body']['subjectSN']); - $this->assertContains($response['body']['issuerOrganisation'], ['Let\'s Encrypt', 'Google Trust Services']); - $this->assertIsInt($response['body']['validFrom']); - $this->assertIsInt($response['body']['validTo']); - - $response = $this->client->call(Client::METHOD_GET, '/health/certificate?domain=https://google.com', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), []); - - $this->assertEquals(200, $response['headers']['status-code']); - - /** - * Test for FAILURE - */ - $response = $this->client->call(Client::METHOD_GET, '/health/certificate?domain=localhost', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), []); - - $this->assertEquals(400, $response['headers']['status-code']); - - $response = $this->client->call(Client::METHOD_GET, '/health/certificate?domain=doesnotexist.com', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), []); - - $this->assertEquals(404, $response['headers']['status-code']); - - $response = $this->client->call(Client::METHOD_GET, '/health/certificate?domain=www.google.com/usr/src/local', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), []); - - $this->assertEquals(400, $response['headers']['status-code']); - - $response = $this->client->call(Client::METHOD_GET, '/health/certificate?domain=', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), []); - - $this->assertEquals(400, $response['headers']['status-code']); - - return []; - } - - public function testStatsResources() - { - /** - * Test for SUCCESS - */ - $response = $this->client->call(Client::METHOD_GET, '/health/queue/stats-resources', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), []); - - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertIsInt($response['body']['size']); - $this->assertLessThan(100, $response['body']['size']); - - /** - * Test for FAILURE - */ - $response = $this->client->call(Client::METHOD_GET, '/health/queue/stats-resources?threshold=0', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), []); - $this->assertEquals(503, $response['headers']['status-code']); - } - - public function testUsageSuccess() - { - /** - * Test for SUCCESS - */ - $response = $this->client->call(Client::METHOD_GET, '/health/queue/stats-usage', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), []); - - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertIsInt($response['body']['size']); - $this->assertLessThan(100, $response['body']['size']); - - /** - * Test for FAILURE - */ - $response = $this->client->call(Client::METHOD_GET, '/health/queue/stats-usage?threshold=0', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), []); - $this->assertEquals(503, $response['headers']['status-code']); - } -} diff --git a/tests/e2e/Services/Health/LogsQueueTest.php b/tests/e2e/Services/Health/LogsQueueTest.php new file mode 100644 index 0000000000..bbeea90dd9 --- /dev/null +++ b/tests/e2e/Services/Health/LogsQueueTest.php @@ -0,0 +1,17 @@ +callGet('/health/queue/logs'); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertIsInt($response['body']['size']); + $this->assertLessThan(100, $response['body']['size']); + + $failure = $this->callGet('/health/queue/logs', ['threshold' => '0']); + $this->assertEquals(503, $failure['headers']['status-code']); + } +} diff --git a/tests/e2e/Services/Health/MailsQueueTest.php b/tests/e2e/Services/Health/MailsQueueTest.php new file mode 100644 index 0000000000..d986150949 --- /dev/null +++ b/tests/e2e/Services/Health/MailsQueueTest.php @@ -0,0 +1,17 @@ +callGet('/health/queue/mails'); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertIsInt($response['body']['size']); + $this->assertLessThan(100, $response['body']['size']); + + $failure = $this->callGet('/health/queue/mails', ['threshold' => '0']); + $this->assertEquals(503, $failure['headers']['status-code']); + } +} diff --git a/tests/e2e/Services/Health/MessagingQueueTest.php b/tests/e2e/Services/Health/MessagingQueueTest.php new file mode 100644 index 0000000000..c2aefdc8d2 --- /dev/null +++ b/tests/e2e/Services/Health/MessagingQueueTest.php @@ -0,0 +1,17 @@ +callGet('/health/queue/messaging'); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertIsInt($response['body']['size']); + $this->assertLessThan(100, $response['body']['size']); + + $failure = $this->callGet('/health/queue/messaging', ['threshold' => '0']); + $this->assertEquals(503, $failure['headers']['status-code']); + } +} diff --git a/tests/e2e/Services/Health/MigrationsQueueTest.php b/tests/e2e/Services/Health/MigrationsQueueTest.php new file mode 100644 index 0000000000..234a1bd433 --- /dev/null +++ b/tests/e2e/Services/Health/MigrationsQueueTest.php @@ -0,0 +1,17 @@ +callGet('/health/queue/migrations'); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertIsInt($response['body']['size']); + $this->assertLessThan(100, $response['body']['size']); + + $failure = $this->callGet('/health/queue/migrations', ['threshold' => '0']); + $this->assertEquals(503, $failure['headers']['status-code']); + } +} diff --git a/tests/e2e/Services/Health/PubSubTest.php b/tests/e2e/Services/Health/PubSubTest.php new file mode 100644 index 0000000000..f5afdba4c2 --- /dev/null +++ b/tests/e2e/Services/Health/PubSubTest.php @@ -0,0 +1,16 @@ +callGet('/health/pubsub'); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertIsArray($response['body']['statuses']); + $this->assertIsInt($response['body']['statuses'][0]['ping']); + $this->assertLessThan(100, $response['body']['statuses'][0]['ping']); + $this->assertEquals('pass', $response['body']['statuses'][0]['status']); + } +} diff --git a/tests/e2e/Services/Health/StatsResourcesQueueTest.php b/tests/e2e/Services/Health/StatsResourcesQueueTest.php new file mode 100644 index 0000000000..827b04b6de --- /dev/null +++ b/tests/e2e/Services/Health/StatsResourcesQueueTest.php @@ -0,0 +1,17 @@ +callGet('/health/queue/stats-resources'); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertIsInt($response['body']['size']); + $this->assertLessThan(100, $response['body']['size']); + + $failure = $this->callGet('/health/queue/stats-resources', ['threshold' => '0']); + $this->assertEquals(503, $failure['headers']['status-code']); + } +} diff --git a/tests/e2e/Services/Health/StatsUsageQueueTest.php b/tests/e2e/Services/Health/StatsUsageQueueTest.php new file mode 100644 index 0000000000..cdff8a55f5 --- /dev/null +++ b/tests/e2e/Services/Health/StatsUsageQueueTest.php @@ -0,0 +1,17 @@ +callGet('/health/queue/stats-usage'); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertIsInt($response['body']['size']); + $this->assertLessThan(100, $response['body']['size']); + + $failure = $this->callGet('/health/queue/stats-usage', ['threshold' => '0']); + $this->assertEquals(503, $failure['headers']['status-code']); + } +} diff --git a/tests/e2e/Services/Health/StorageLocalTest.php b/tests/e2e/Services/Health/StorageLocalTest.php new file mode 100644 index 0000000000..be64ba4877 --- /dev/null +++ b/tests/e2e/Services/Health/StorageLocalTest.php @@ -0,0 +1,15 @@ +callGet('/health/storage/local'); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertEquals('pass', $response['body']['status']); + $this->assertIsInt($response['body']['ping']); + $this->assertLessThan(100, $response['body']['ping']); + } +} diff --git a/tests/e2e/Services/Health/StorageTest.php b/tests/e2e/Services/Health/StorageTest.php new file mode 100644 index 0000000000..2a67d7376e --- /dev/null +++ b/tests/e2e/Services/Health/StorageTest.php @@ -0,0 +1,15 @@ +callGet('/health/storage'); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertEquals('pass', $response['body']['status']); + $this->assertIsInt($response['body']['ping']); + $this->assertLessThan(100, $response['body']['ping']); + } +} diff --git a/tests/e2e/Services/Health/TimeTest.php b/tests/e2e/Services/Health/TimeTest.php new file mode 100644 index 0000000000..3a9fec0f00 --- /dev/null +++ b/tests/e2e/Services/Health/TimeTest.php @@ -0,0 +1,17 @@ +callGet('/health/time'); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertIsInt($response['body']['remoteTime']); + $this->assertIsInt($response['body']['localTime']); + $this->assertNotEmpty($response['body']['remoteTime']); + $this->assertNotEmpty($response['body']['localTime']); + $this->assertLessThan(10, $response['body']['diff']); + } +} diff --git a/tests/e2e/Services/Health/WebhooksQueueTest.php b/tests/e2e/Services/Health/WebhooksQueueTest.php new file mode 100644 index 0000000000..b857b87b29 --- /dev/null +++ b/tests/e2e/Services/Health/WebhooksQueueTest.php @@ -0,0 +1,17 @@ +callGet('/health/queue/webhooks'); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertIsInt($response['body']['size']); + $this->assertLessThan(100, $response['body']['size']); + + $failure = $this->callGet('/health/queue/webhooks', ['threshold' => '0']); + $this->assertEquals(503, $failure['headers']['status-code']); + } +} diff --git a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php index 9526c5a4da..e31331574f 100644 --- a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php +++ b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php @@ -23,9 +23,9 @@ class ProjectsConsoleClientTest extends Scope use Async; /** - * @group devKeys * @group smtpAndTemplates - * @group projectsCRUD */ + * @group projectsCRUD + */ public function testCreateProject(): array { /** @@ -257,11 +257,11 @@ class ProjectsConsoleClientTest extends Scope 'search' => $id ])); - $this->assertEquals($response['headers']['status-code'], 200); - $this->assertEquals($response['body']['total'], 3); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertEquals(4, $response['body']['total']); $this->assertIsArray($response['body']['projects']); - $this->assertCount(3, $response['body']['projects']); - $this->assertEquals($response['body']['projects'][0]['name'], 'Project Test'); + $this->assertCount(4, $response['body']['projects']); + $this->assertEquals('Project Test', $response['body']['projects'][0]['name']); $response = $this->client->call(Client::METHOD_GET, '/projects', array_merge([ 'content-type' => 'application/json', @@ -271,9 +271,9 @@ class ProjectsConsoleClientTest extends Scope ])); $this->assertEquals($response['headers']['status-code'], 200); - $this->assertEquals(3, $response['body']['total']); + $this->assertEquals(4, $response['body']['total']); $this->assertIsArray($response['body']['projects']); - $this->assertCount(3, $response['body']['projects']); + $this->assertCount(4, $response['body']['projects']); $this->assertEquals($response['body']['projects'][0]['$id'], $data['projectId']); /** @@ -348,8 +348,8 @@ class ProjectsConsoleClientTest extends Scope $this->assertEquals(200, $response['headers']['status-code']); $this->assertNotEmpty($response['body']); - $this->assertCount(1, $response['body']['projects']); - $this->assertEquals('Project Test 2', $response['body']['projects'][0]['name']); + $this->assertCount(2, $response['body']['projects']); + $this->assertEquals('Team 1 Project', $response['body']['projects'][0]['name']); $response = $this->client->call(Client::METHOD_GET, '/projects', array_merge([ 'content-type' => 'application/json', @@ -376,7 +376,7 @@ class ProjectsConsoleClientTest extends Scope $this->assertEquals(200, $response['headers']['status-code']); $this->assertNotEmpty($response['body']); - $this->assertCount(4, $response['body']['projects']); + $this->assertCount(5, $response['body']['projects']); $this->assertEquals('Project Test 2', $response['body']['projects'][0]['name']); $this->assertEquals('Team 1 Project', $response['body']['projects'][1]['name']); @@ -387,9 +387,9 @@ class ProjectsConsoleClientTest extends Scope $this->assertEquals(200, $response['headers']['status-code']); $this->assertNotEmpty($response['body']); - $this->assertCount(4, $response['body']['projects']); + $this->assertCount(5, $response['body']['projects']); $this->assertEquals('Project Test', $response['body']['projects'][0]['name']); - $this->assertEquals('Team 1 Project', $response['body']['projects'][2]['name']); + $this->assertEquals('Original Project', $response['body']['projects'][2]['name']); $response = $this->client->call(Client::METHOD_GET, '/projects', array_merge([ 'content-type' => 'application/json', @@ -402,8 +402,8 @@ class ProjectsConsoleClientTest extends Scope $this->assertEquals(200, $response['headers']['status-code']); $this->assertNotEmpty($response['body']); - $this->assertCount(3, $response['body']['projects']); - $this->assertEquals('Team 1 Project', $response['body']['projects'][1]['name']); + $this->assertCount(4, $response['body']['projects']); + $this->assertEquals('Original Project', $response['body']['projects'][1]['name']); $response = $this->client->call(Client::METHOD_GET, '/projects', array_merge([ 'content-type' => 'application/json', @@ -436,6 +436,267 @@ class ProjectsConsoleClientTest extends Scope return $data; } + /** + * @group projectsCRUD + */ + public function testListProjectsQuerySelect(): void + { + $team = $this->client->call(Client::METHOD_POST, '/teams', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'teamId' => ID::unique(), + 'name' => 'Query Select Test Team', + ]); + + $this->assertEquals(201, $team['headers']['status-code']); + $teamId = $team['body']['$id']; + + $project = $this->client->call(Client::METHOD_POST, '/projects', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'projectId' => ID::unique(), + 'name' => 'Query Select Test Project', + 'teamId' => $teamId, + 'region' => System::getEnv('_APP_REGION', 'default') + ]); + + $this->assertEquals(201, $project['headers']['status-code']); + $projectId = $project['body']['$id']; + + /** + * Test Query.select - basic fields + */ + $response = $this->client->call(Client::METHOD_GET, '/projects', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'queries' => [ + Query::select(['$id', 'name'])->toString(), + ], + ]); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertNotEmpty($response['body']); + $this->assertGreaterThan(0, count($response['body']['projects'])); + + $project = $response['body']['projects'][0]; + $this->assertArrayHasKey('$id', $project); + $this->assertArrayHasKey('name', $project); + $this->assertArrayNotHasKey('platforms', $project); + $this->assertArrayNotHasKey('webhooks', $project); + $this->assertArrayNotHasKey('keys', $project); + $this->assertArrayNotHasKey('devKeys', $project); + $this->assertArrayNotHasKey('oAuthProviders', $project); + $this->assertArrayNotHasKey('smtpEnabled', $project); + $this->assertArrayNotHasKey('smtpHost', $project); + $this->assertArrayNotHasKey('authLimit', $project); + $this->assertArrayNotHasKey('authDuration', $project); + + /** + * Test Query.select - multiple fields + */ + $response = $this->client->call(Client::METHOD_GET, '/projects', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'queries' => [ + Query::select(['$id', 'name', 'teamId', 'description', '$createdAt', '$updatedAt'])->toString(), + ], + ]); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertNotEmpty($response['body']); + $this->assertGreaterThan(0, count($response['body']['projects'])); + + $project = $response['body']['projects'][0]; + $this->assertArrayHasKey('$id', $project); + $this->assertArrayHasKey('name', $project); + $this->assertArrayHasKey('teamId', $project); + $this->assertArrayHasKey('description', $project); + $this->assertArrayHasKey('$createdAt', $project); + $this->assertArrayHasKey('$updatedAt', $project); + $this->assertArrayNotHasKey('platforms', $project); + $this->assertArrayNotHasKey('webhooks', $project); + $this->assertArrayNotHasKey('keys', $project); + $this->assertArrayNotHasKey('devKeys', $project); + $this->assertArrayNotHasKey('oAuthProviders', $project); + $this->assertArrayNotHasKey('smtpEnabled', $project); + $this->assertArrayNotHasKey('authLimit', $project); + + /** + * Test Query.select combined with filters + */ + $response = $this->client->call(Client::METHOD_GET, '/projects', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'queries' => [ + Query::select(['$id', 'name', 'teamId'])->toString(), + Query::equal('name', ['Query Select Test Project'])->toString(), + ], + ]); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertNotEmpty($response['body']); + $this->assertCount(1, $response['body']['projects']); + + $project = $response['body']['projects'][0]; + $this->assertArrayHasKey('$id', $project); + $this->assertArrayHasKey('name', $project); + $this->assertArrayHasKey('teamId', $project); + $this->assertEquals('Query Select Test Project', $project['name']); + $this->assertEquals($teamId, $project['teamId']); + $this->assertArrayNotHasKey('platforms', $project); + $this->assertArrayNotHasKey('webhooks', $project); + $this->assertArrayNotHasKey('keys', $project); + $this->assertArrayNotHasKey('devKeys', $project); + $this->assertArrayNotHasKey('oAuthProviders', $project); + $this->assertArrayNotHasKey('smtpEnabled', $project); + $this->assertArrayNotHasKey('authLimit', $project); + + /** + * Test Query.select combined with limit + */ + $response = $this->client->call(Client::METHOD_GET, '/projects', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'queries' => [ + Query::select(['$id', 'name'])->toString(), + Query::limit(2)->toString(), + ], + ]); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertNotEmpty($response['body']); + $this->assertLessThanOrEqual(2, count($response['body']['projects'])); + + foreach ($response['body']['projects'] as $p) { + $this->assertArrayHasKey('$id', $p); + $this->assertArrayHasKey('name', $p); + $this->assertArrayNotHasKey('platforms', $p); + $this->assertArrayNotHasKey('webhooks', $p); + $this->assertArrayNotHasKey('keys', $p); + $this->assertArrayNotHasKey('devKeys', $p); + $this->assertArrayNotHasKey('oAuthProviders', $p); + $this->assertArrayNotHasKey('smtpEnabled', $p); + $this->assertArrayNotHasKey('authLimit', $p); + } + + /** + * Test Query.select with subquery attributes (platforms, webhooks, etc.) + * When explicitly selected, subqueries should still run + */ + $response = $this->client->call(Client::METHOD_GET, '/projects', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'queries' => [ + Query::select(['$id', 'name', 'platforms'])->toString(), + ], + ]); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertNotEmpty($response['body']); + $this->assertGreaterThan(0, count($response['body']['projects'])); + + $project = $response['body']['projects'][0]; + $this->assertArrayHasKey('$id', $project); + $this->assertArrayHasKey('name', $project); + $this->assertArrayHasKey('platforms', $project); + $this->assertIsArray($project['platforms']); + $this->assertArrayNotHasKey('webhooks', $project); + $this->assertArrayNotHasKey('keys', $project); + $this->assertArrayNotHasKey('devKeys', $project); + $this->assertArrayNotHasKey('oAuthProviders', $project); + $this->assertArrayNotHasKey('smtpEnabled', $project); + $this->assertArrayNotHasKey('authLimit', $project); + + /** + * Test Query.select with expanded attributes + * webhooks and keys should load their subquery data when selected + */ + $response = $this->client->call(Client::METHOD_GET, '/projects', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'queries' => [ + Query::select(['$id', 'name', 'webhooks', 'keys'])->toString(), + ], + ]); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertNotEmpty($response['body']); + $this->assertGreaterThan(0, count($response['body']['projects'])); + + $project = $response['body']['projects'][0]; + $this->assertArrayHasKey('$id', $project); + $this->assertArrayHasKey('name', $project); + $this->assertArrayHasKey('webhooks', $project); + $this->assertArrayHasKey('keys', $project); + $this->assertIsArray($project['webhooks']); + $this->assertIsArray($project['keys']); + $this->assertArrayNotHasKey('platforms', $project); + $this->assertArrayNotHasKey('devKeys', $project); + $this->assertArrayNotHasKey('smtpEnabled', $project); + $this->assertArrayNotHasKey('authLimit', $project); + + /** + * Test Query.select with wildcard '*' + * Should return all fields like no select query + */ + $response = $this->client->call(Client::METHOD_GET, '/projects', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'queries' => [ + Query::select(['*'])->toString(), + ], + ]); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertNotEmpty($response['body']); + $this->assertGreaterThan(0, count($response['body']['projects'])); + + $project = $response['body']['projects'][0]; + $this->assertArrayHasKey('$id', $project); + $this->assertArrayHasKey('name', $project); + $this->assertArrayHasKey('teamId', $project); + $this->assertArrayHasKey('platforms', $project); + $this->assertArrayHasKey('webhooks', $project); + $this->assertArrayHasKey('keys', $project); + $this->assertArrayHasKey('devKeys', $project); + $this->assertArrayHasKey('oAuthProviders', $project); + $this->assertArrayHasKey('smtpEnabled', $project); + $this->assertArrayHasKey('smtpHost', $project); + $this->assertArrayHasKey('authLimit', $project); + $this->assertArrayHasKey('authDuration', $project); + + /** + * Test Query.select with invalid attribute + */ + $response = $this->client->call(Client::METHOD_GET, '/projects', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'queries' => [ + Query::select(['$id', 'invalidAttribute'])->toString(), + ], + ]); + + $this->assertEquals(400, $response['headers']['status-code']); + $this->assertEquals('Invalid `queries` param: Invalid query: Attribute not found in schema: invalidAttribute', $response['body']['message']); + + $response = $this->client->call(Client::METHOD_DELETE, '/projects/' . $projectId, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders())); + + $this->assertEquals(204, $response['headers']['status-code']); + } + public function testGetProject(): void { // Create a team @@ -618,6 +879,14 @@ class ProjectsConsoleClientTest extends Scope public function testUpdateProjectSMTP($data): array { $id = $data['projectId']; + $smtpHost = System::getEnv('_APP_SMTP_HOST', "maildev"); + $smtpPort = intval(System::getEnv('_APP_SMTP_PORT', "1025")); + $smtpUsername = System::getEnv('_APP_SMTP_USERNAME', 'user'); + $smtpPassword = System::getEnv('_APP_SMTP_PASSWORD', 'password'); + + /** + * Test for SUCCESS: Valid Credentials + */ $response = $this->client->call(Client::METHOD_PATCH, '/projects/' . $id . '/smtp', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], @@ -625,23 +894,23 @@ class ProjectsConsoleClientTest extends Scope 'enabled' => true, 'senderEmail' => 'mailer@appwrite.io', 'senderName' => 'Mailer', - 'host' => 'maildev', - 'port' => 1025, - 'username' => 'user', - 'password' => 'password', + 'host' => $smtpHost, + 'port' => $smtpPort, + 'username' => $smtpUsername, + 'password' => $smtpPassword, ]); $this->assertEquals(200, $response['headers']['status-code']); $this->assertTrue($response['body']['smtpEnabled']); $this->assertEquals('mailer@appwrite.io', $response['body']['smtpSenderEmail']); $this->assertEquals('Mailer', $response['body']['smtpSenderName']); - $this->assertEquals('maildev', $response['body']['smtpHost']); - $this->assertEquals(1025, $response['body']['smtpPort']); - $this->assertEquals('user', $response['body']['smtpUsername']); - $this->assertEquals('password', $response['body']['smtpPassword']); + $this->assertEquals($smtpHost, $response['body']['smtpHost']); + $this->assertEquals($smtpPort, $response['body']['smtpPort']); + $this->assertEquals($smtpUsername, $response['body']['smtpUsername']); + $this->assertEquals($smtpPassword, $response['body']['smtpPassword']); $this->assertEquals('', $response['body']['smtpSecure']); - /** Test Reading Project */ + // Check the project $response = $this->client->call(Client::METHOD_GET, '/projects/' . $id, array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], @@ -651,12 +920,32 @@ class ProjectsConsoleClientTest extends Scope $this->assertTrue($response['body']['smtpEnabled']); $this->assertEquals('mailer@appwrite.io', $response['body']['smtpSenderEmail']); $this->assertEquals('Mailer', $response['body']['smtpSenderName']); - $this->assertEquals('maildev', $response['body']['smtpHost']); - $this->assertEquals(1025, $response['body']['smtpPort']); - $this->assertEquals('user', $response['body']['smtpUsername']); - $this->assertEquals('password', $response['body']['smtpPassword']); + $this->assertEquals($smtpHost, $response['body']['smtpHost']); + $this->assertEquals($smtpPort, $response['body']['smtpPort']); + $this->assertEquals($smtpUsername, $response['body']['smtpUsername']); + $this->assertEquals($smtpPassword, $response['body']['smtpPassword']); $this->assertEquals('', $response['body']['smtpSecure']); + /** + * Test for FAILURE: Invalid Credentials + */ + $response = $this->client->call(Client::METHOD_PATCH, '/projects/' . $id . '/smtp', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'enabled' => true, + 'senderEmail' => 'fail@appwrite.io', + 'senderName' => 'Failing Mailer', + 'host' => $smtpHost, + 'port' => $smtpPort, + 'username' => 'invalid-user', + 'password' => 'bad-password', + ]); + + $this->assertEquals(400, $response['headers']['status-code']); + $this->assertEquals(Exception::PROJECT_SMTP_CONFIG_INVALID, $response['body']['type']); + $this->assertStringContainsStringIgnoringCase('Could not authenticate', $response['body']['message']); + return $data; } @@ -665,6 +954,11 @@ class ProjectsConsoleClientTest extends Scope */ public function testCreateProjectSMTPTests(): void { + $smtpHost = System::getEnv('_APP_SMTP_HOST', "maildev"); + $smtpPort = intval(System::getEnv('_APP_SMTP_PORT', "1025")); + $smtpUsername = System::getEnv('_APP_SMTP_USERNAME', 'user'); + $smtpPassword = System::getEnv('_APP_SMTP_PASSWORD', 'password'); + // Create a team $team = $this->client->call(Client::METHOD_POST, '/teams', array_merge([ 'content-type' => 'application/json', @@ -699,10 +993,10 @@ class ProjectsConsoleClientTest extends Scope 'senderEmail' => 'custommailer@appwrite.io', 'senderName' => 'Custom Mailer', 'replyTo' => 'reply@appwrite.io', - 'host' => 'maildev', - 'port' => 1025, - 'username' => '', - 'password' => '', + 'host' => $smtpHost, + 'port' => $smtpPort, + 'username' => $smtpUsername, + 'password' => $smtpPassword, ]); $this->assertEquals(204, $response['headers']['status-code']); @@ -736,10 +1030,10 @@ class ProjectsConsoleClientTest extends Scope 'senderEmail' => 'custommailer@appwrite.io', 'senderName' => 'Custom Mailer', 'replyTo' => 'reply@appwrite.io', - 'host' => 'maildev', - 'port' => 1025, - 'username' => '', - 'password' => '', + 'host' => $smtpHost, + 'port' => $smtpPort, + 'username' => $smtpUsername, + 'password' => $smtpPassword, ]); $this->assertEquals(204, $response['headers']['status-code']); @@ -752,10 +1046,10 @@ class ProjectsConsoleClientTest extends Scope 'senderEmail' => 'custommailer@appwrite.io', 'senderName' => 'Custom Mailer', 'replyTo' => 'reply@appwrite.io', - 'host' => 'maildev', - 'port' => 1025, - 'username' => '', - 'password' => '', + 'host' => $smtpHost, + 'port' => $smtpPort, + 'username' => $smtpUsername, + 'password' => $smtpPassword, ]); $this->assertEquals(400, $response['headers']['status-code']); @@ -776,7 +1070,7 @@ class ProjectsConsoleClientTest extends Scope ], $this->getHeaders())); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertEquals('Account Verification', $response['body']['subject']); + $this->assertEquals('Account Verification for {{project}}', $response['body']['subject']); $this->assertEquals('', $response['body']['senderEmail']); $this->assertEquals('verification', $response['body']['type']); $this->assertEquals('en-us', $response['body']['locale']); @@ -879,7 +1173,7 @@ class ProjectsConsoleClientTest extends Scope $this->assertEquals(200, $response['headers']['status-code']); $this->assertNotEmpty($response['body']['$id']); - $this->assertEquals('Project Test 2', $response['body']['name']); + $this->assertEquals('Project Test', $response['body']['name']); $this->assertArrayHasKey('platforms', $response['body']); $this->assertArrayHasKey('webhooks', $response['body']); $this->assertArrayHasKey('keys', $response['body']); @@ -959,39 +1253,6 @@ class ProjectsConsoleClientTest extends Scope $this->assertEquals(200, $response['headers']['status-code']); $this->assertEquals(15, $response['body']['authDuration']); - // Create session - $response = $this->client->call(Client::METHOD_POST, '/account/sessions/email', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $projectId, - ]), [ - 'email' => $userEmail, - 'password' => 'password', - ]); - - $this->assertEquals(201, $response['headers']['status-code']); - - $sessionCookie = $response['headers']['set-cookie']; - - // Wait 10 seconds, ensure valid session, extend session - \sleep(10); - - $response = $this->client->call(Client::METHOD_GET, '/account', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $projectId, - 'Cookie' => $sessionCookie, - ])); - - $this->assertEquals(200, $response['headers']['status-code']); - - $response = $this->client->call(Client::METHOD_PATCH, '/account/sessions/current', array_merge([ - 'origin' => 'http://localhost', - 'content-type' => 'application/json', - 'x-appwrite-project' => $projectId, - 'cookie' => $sessionCookie, - ])); - - $this->assertEquals(200, $response['headers']['status-code']); - // Wait 20 seconds, ensure non-valid session \sleep(20); @@ -1590,6 +1851,8 @@ class ProjectsConsoleClientTest extends Scope $sessionCookie = $response['headers']['set-cookie']; $sessionId2 = $response['body']['$id']; + sleep(5); // fixes flaky tests. + /** * List sessions */ @@ -3132,7 +3395,7 @@ class ProjectsConsoleClientTest extends Scope $this->assertContains('users.write', $response['body']['scopes']); $this->assertContains('collections.read', $response['body']['scopes']); $this->assertContains('tables.read', $response['body']['scopes']); - $this->assertCount(3, $response['body']['scopes']); + $this->assertCount(4, $response['body']['scopes']); $this->assertArrayHasKey('sdks', $response['body']); $this->assertEmpty($response['body']['sdks']); $this->assertArrayHasKey('accessedAt', $response['body']); @@ -3151,7 +3414,7 @@ class ProjectsConsoleClientTest extends Scope $this->assertContains('users.write', $response['body']['scopes']); $this->assertContains('collections.read', $response['body']['scopes']); $this->assertContains('tables.read', $response['body']['scopes']); - $this->assertCount(3, $response['body']['scopes']); + $this->assertCount(4, $response['body']['scopes']); $this->assertArrayHasKey('sdks', $response['body']); $this->assertEmpty($response['body']['sdks']); $this->assertArrayHasKey('accessedAt', $response['body']); @@ -4520,7 +4783,7 @@ class ProjectsConsoleClientTest extends Scope */ /** - * @group devKeys + * @group abuseEnabled */ public function testCreateProjectDevKey(): void { @@ -4581,7 +4844,7 @@ class ProjectsConsoleClientTest extends Scope /** - * @group devKeys + * @group abuseEnabled */ public function testListProjectDevKey(): void { @@ -4672,7 +4935,7 @@ class ProjectsConsoleClientTest extends Scope /** - * @group devKeys + * @group abuseEnabled */ public function testGetProjectDevKey(): void { @@ -4716,7 +4979,7 @@ class ProjectsConsoleClientTest extends Scope } /** - * @group devKeys + * @group abuseEnabled */ public function testGetDevKeyWithSdks(): void { @@ -4773,7 +5036,7 @@ class ProjectsConsoleClientTest extends Scope } /** - * @group devKeys + * @group abuseEnabled */ public function testNoHostValidationWithDevKey(): void { @@ -4854,7 +5117,7 @@ class ProjectsConsoleClientTest extends Scope } /** - * @group devKeys + * @group abuseEnabled */ public function testCorsWithDevKey(): void { @@ -4911,7 +5174,7 @@ class ProjectsConsoleClientTest extends Scope } /** - * @group devKeys + * @group abuseEnabled */ public function testNoRateLimitWithDevKey(): void { @@ -5016,7 +5279,7 @@ class ProjectsConsoleClientTest extends Scope } /** - * @group devKeys + * @group abuseEnabled */ public function testUpdateProjectDevKey(): void { @@ -5061,7 +5324,7 @@ class ProjectsConsoleClientTest extends Scope } /** - * @group devKeys + * @group abuseEnabled */ public function testDeleteProjectDevKey(): void { @@ -5086,8 +5349,8 @@ class ProjectsConsoleClientTest extends Scope $this->assertEmpty($response['body']); /** - * Get rate limit trying to use the deleted key - */ + * Get rate limit trying to use the deleted key + */ $response = $this->client->call(Client::METHOD_POST, '/account/sessions/email', [ 'content-type' => 'application/json', 'x-appwrite-project' => $projectId, @@ -5119,4 +5382,216 @@ class ProjectsConsoleClientTest extends Scope /** * Devkeys Tests ends here ------------------------------------------------ */ + + public function testProjectLabels(): void + { + // Setup: Prepare team + $team = $this->client->call(Client::METHOD_POST, '/teams', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'teamId' => ID::unique(), + 'name' => 'Query Select Test Team', + ]); + + $this->assertEquals(201, $team['headers']['status-code']); + $teamId = $team['body']['$id']; + + // Setup: Prepare project + $project = $this->client->call(Client::METHOD_POST, '/projects', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'projectId' => ID::unique(), + 'name' => 'Test project - Labels 1', + 'teamId' => $teamId, + 'region' => System::getEnv('_APP_REGION', 'default') + ]); + + $this->assertEquals(201, $project['headers']['status-code']); + $this->assertIsArray($project['body']['labels']); + $this->assertCount(0, $project['body']['labels']); + $projectId = $project['body']['$id']; + + // Apply labels + $project = $this->client->call(Client::METHOD_PUT, '/projects/' . $projectId . '/labels', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'labels' => ['vip', 'imagine', 'blocked'] + ]); + + $this->assertEquals(200, $project['headers']['status-code']); + $this->assertIsArray($project['body']['labels']); + $this->assertCount(3, $project['body']['labels']); + $this->assertEquals('vip', $project['body']['labels'][0]); + $this->assertEquals('imagine', $project['body']['labels'][1]); + $this->assertEquals('blocked', $project['body']['labels'][2]); + + // Update labels + $project = $this->client->call(Client::METHOD_PUT, '/projects/' . $projectId . '/labels', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'labels' => ['nonvip', 'imagine'] + ]); + $this->assertEquals(200, $project['headers']['status-code']); + $this->assertIsArray($project['body']['labels']); + $this->assertCount(2, $project['body']['labels']); + $this->assertEquals('nonvip', $project['body']['labels'][0]); + $this->assertEquals('imagine', $project['body']['labels'][1]); + + // Filter by labels + $projects = $this->client->call(Client::METHOD_GET, '/projects', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'queries' => [ + Query::contains('labels', ['nonvip'])->toString(), + ] + ]); + $this->assertEquals(200, $projects['headers']['status-code']); + $this->assertEquals(1, $projects['body']['total']); + $this->assertEquals($projectId, $projects['body']['projects'][0]['$id']); + + $projects = $this->client->call(Client::METHOD_GET, '/projects', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'queries' => [ + Query::contains('labels', ['vip'])->toString(), + ] + ]); + $this->assertEquals(200, $projects['headers']['status-code']); + $this->assertEquals(0, $projects['body']['total']); + + $projects = $this->client->call(Client::METHOD_GET, '/projects', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'queries' => [ + Query::contains('labels', ['imagine'])->toString(), + ] + ]); + $this->assertEquals(200, $projects['headers']['status-code']); + $this->assertEquals(1, $projects['body']['total']); + $this->assertEquals($projectId, $projects['body']['projects'][0]['$id']); + + $projects = $this->client->call(Client::METHOD_GET, '/projects', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'queries' => [ + Query::contains('labels', ['nonvip', 'imagine'])->toString(), + ] + ]); + $this->assertEquals(200, $projects['headers']['status-code']); + $this->assertEquals(1, $projects['body']['total']); + $this->assertEquals($projectId, $projects['body']['projects'][0]['$id']); + + // Setup: Second project with only imagine label + $project = $this->client->call(Client::METHOD_POST, '/projects', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'projectId' => ID::unique(), + 'name' => 'Test project - Labels 2', + 'teamId' => $teamId, + 'region' => System::getEnv('_APP_REGION', 'default') + ]); + + $this->assertEquals(201, $project['headers']['status-code']); + $this->assertIsArray($project['body']['labels']); + $this->assertCount(0, $project['body']['labels']); + $projectId2 = $project['body']['$id']; + + $project = $this->client->call(Client::METHOD_PUT, '/projects/' . $projectId2 . '/labels', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'labels' => ['vip', 'imagine'] + ]); + $this->assertEquals(200, $project['headers']['status-code']); + $this->assertIsArray($project['body']['labels']); + $this->assertCount(2, $project['body']['labels']); + $this->assertEquals('vip', $project['body']['labels'][0]); + $this->assertEquals('imagine', $project['body']['labels'][1]); + + // List of imagine has both + $projects = $this->client->call(Client::METHOD_GET, '/projects', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'queries' => [ + Query::contains('labels', ['imagine'])->toString(), + ] + ]); + $this->assertEquals(200, $projects['headers']['status-code']); + $this->assertEquals(2, $projects['body']['total']); + $this->assertEquals($projectId, $projects['body']['projects'][0]['$id']); + $this->assertEquals($projectId2, $projects['body']['projects'][1]['$id']); + + // List of vip only has second + $projects = $this->client->call(Client::METHOD_GET, '/projects', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'queries' => [ + Query::contains('labels', ['vip'])->toString(), + ] + ]); + $this->assertEquals(200, $projects['headers']['status-code']); + $this->assertEquals(1, $projects['body']['total']); + $this->assertEquals($projectId2, $projects['body']['projects'][0]['$id']); + + // List of vip and imagine has second + $projects = $this->client->call(Client::METHOD_GET, '/projects', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'queries' => [ + Query::contains('labels', ['vip'])->toString(), + Query::contains('labels', ['imagine'])->toString(), + ] + ]); + $this->assertEquals(200, $projects['headers']['status-code']); + $this->assertEquals(1, $projects['body']['total']); + $this->assertEquals($projectId2, $projects['body']['projects'][0]['$id']); + + // List of vip or imagine has second + $projects = $this->client->call(Client::METHOD_GET, '/projects', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'queries' => [ + Query::contains('labels', ['vip', 'imagine'])->toString(), + ] + ]); + $this->assertEquals(200, $projects['headers']['status-code']); + $this->assertEquals(2, $projects['body']['total']); + $this->assertEquals($projectId, $projects['body']['projects'][0]['$id']); + $this->assertEquals($projectId2, $projects['body']['projects'][1]['$id']); + + // Cleanup + $response = $this->client->call(Client::METHOD_DELETE, '/projects/' . $projectId, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders())); + + $this->assertEquals(204, $response['headers']['status-code']); + + $response = $this->client->call(Client::METHOD_DELETE, '/projects/' . $projectId2, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders())); + + $this->assertEquals(204, $response['headers']['status-code']); + + $response = $this->client->call(Client::METHOD_DELETE, '/teams/' . $teamId, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders())); + + $this->assertEquals(204, $response['headers']['status-code']); + } } diff --git a/tests/e2e/Services/Realtime/RealtimeBase.php b/tests/e2e/Services/Realtime/RealtimeBase.php index 89bd1898c4..ea5c3d710f 100644 --- a/tests/e2e/Services/Realtime/RealtimeBase.php +++ b/tests/e2e/Services/Realtime/RealtimeBase.php @@ -10,7 +10,8 @@ trait RealtimeBase private function getWebsocket( array $channels = [], array $headers = [], - string $projectId = null + string $projectId = null, + array $queries = [] ): WebSocketClient { if (is_null($projectId)) { $projectId = $this->getProject()['$id']; @@ -19,6 +20,7 @@ trait RealtimeBase $query = [ "project" => $projectId, "channels" => $channels, + "queries" => $queries ]; return new WebSocketClient( diff --git a/tests/e2e/Services/Realtime/RealtimeCustomClientQueryTest.php b/tests/e2e/Services/Realtime/RealtimeCustomClientQueryTest.php new file mode 100644 index 0000000000..068736561e --- /dev/null +++ b/tests/e2e/Services/Realtime/RealtimeCustomClientQueryTest.php @@ -0,0 +1,1547 @@ +getUser(); + $userId = $user['$id'] ?? ''; + $session = $user['session'] ?? ''; + $projectId = $this->getProject()['$id']; + + // Subscribe with query that matches current user + $client = $this->getWebsocket(['account'], [ + 'origin' => 'http://localhost', + 'cookie' => 'a_session_' . $projectId . '=' . $session, + ], null, [ + Query::equal('$id', [$userId])->toString(), + ]); + + $response = json_decode($client->receive(), true); + $this->assertEquals('connected', $response['type']); + + // Update account name - should receive event (matches query) + $name = "Test User " . uniqid(); + $this->client->call(Client::METHOD_PATCH, '/account/name', array_merge([ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'cookie' => 'a_session_' . $projectId . '=' . $session, + ]), [ + 'name' => $name + ]); + + $event = json_decode($client->receive(), true); + $this->assertEquals('event', $event['type']); + $this->assertEquals($name, $event['data']['payload']['name']); + + $client->close(); + + + $user = $this->getUser(); + $userId = $user['$id'] ?? ''; + $session = $user['session'] ?? ''; + $projectId = $this->getProject()['$id']; + + // Subscribe with query that does NOT match current user + $client = $this->getWebsocket(['account'], [ + 'origin' => 'http://localhost', + 'cookie' => 'a_session_' . $projectId . '=' . $session, + ], null, [ + Query::notEqual('$id', [$userId])->toString(), + ]); + + $response = json_decode($client->receive(), true); + $this->assertEquals('connected', $response['type']); + + // Update account name - should NOT receive event (doesn't match query) + $name = "Test User " . uniqid(); + $this->client->call(Client::METHOD_PATCH, '/account/name', array_merge([ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'cookie' => 'a_session_' . $projectId . '=' . $session, + ]), [ + 'name' => $name + ]); + + // Should timeout - no event should be received + try { + $client->receive(); + $this->fail('Expected TimeoutException - event should be filtered'); + } catch (TimeoutException $e) { + $this->assertTrue(true); + } + + $client->close(); + } + + public function testDatabaseChannelWithQuery() + { + $user = $this->getUser(); + $session = $user['session'] ?? ''; + $projectId = $this->getProject()['$id']; + + // Setup database and collection + $database = $this->client->call(Client::METHOD_POST, '/databases', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'databaseId' => ID::unique(), + 'name' => 'Query Test DB', + ]); + $databaseId = $database['body']['$id']; + + $collection = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'collectionId' => ID::unique(), + 'name' => 'Test Collection', + 'permissions' => [ + Permission::create(Role::user($user['$id'])), + ], + 'documentSecurity' => true, + ]); + $collectionId = $collection['body']['$id']; + + $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/attributes/string', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'key' => 'status', + 'size' => 256, + 'required' => false, + ]); + + sleep(2); + + $targetDocumentId = ID::unique(); + + // Subscribe with query for specific document ID + $client = $this->getWebsocket(['documents'], [ + 'origin' => 'http://localhost', + 'cookie' => 'a_session_' . $projectId . '=' . $session, + ], null, [ + Query::equal('$id', [$targetDocumentId])->toString(), + ]); + + $response = json_decode($client->receive(), true); + $this->assertEquals('connected', $response['type']); + + // Create document with matching ID - should receive event + $document = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], $this->getHeaders()), [ + 'documentId' => $targetDocumentId, + 'data' => [ + 'status' => 'active' + ], + 'permissions' => [ + Permission::read(Role::any()), + ], + ]); + + $event = json_decode($client->receive(), true); + $this->assertEquals('event', $event['type']); + $this->assertEquals($targetDocumentId, $event['data']['payload']['$id']); + + // Create document with different ID - should NOT receive event + $otherDocumentId = ID::unique(); + $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], $this->getHeaders()), [ + 'documentId' => $otherDocumentId, + 'data' => [ + 'status' => 'inactive' + ], + 'permissions' => [ + Permission::read(Role::any()), + ], + ]); + + try { + $client->receive(); + $this->fail('Expected TimeoutException - event should be filtered'); + } catch (TimeoutException $e) { + $this->assertTrue(true); + } + + $client->close(); + + // Setup database and collection + $database = $this->client->call(Client::METHOD_POST, '/databases', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'databaseId' => ID::unique(), + 'name' => 'NotEqual Test DB', + ]); + $databaseId = $database['body']['$id']; + + $collection = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'collectionId' => ID::unique(), + 'name' => 'Test Collection', + 'permissions' => [ + Permission::create(Role::user($user['$id'])), + ], + 'documentSecurity' => true, + ]); + $collectionId = $collection['body']['$id']; + + $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/attributes/string', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'key' => 'status', + 'size' => 256, + 'required' => false, + ]); + + sleep(2); + + $excludedDocumentId = ID::unique(); + + // Subscribe with query that excludes specific document ID + $client = $this->getWebsocket(['documents'], [ + 'origin' => 'http://localhost', + 'cookie' => 'a_session_' . $projectId . '=' . $session, + ], null, [ + Query::notEqual('$id', [$excludedDocumentId])->toString(), + ]); + + $response = json_decode($client->receive(), true); + $this->assertEquals('connected', $response['type']); + + // Create document with different ID - should receive event + $allowedDocumentId = ID::unique(); + $document = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], $this->getHeaders()), [ + 'documentId' => $allowedDocumentId, + 'data' => [ + 'status' => 'active' + ], + 'permissions' => [ + Permission::read(Role::any()), + ], + ]); + + $event = json_decode($client->receive(), true); + $this->assertEquals('event', $event['type']); + $this->assertEquals($allowedDocumentId, $event['data']['payload']['$id']); + + // Create document with excluded ID - should NOT receive event + $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], $this->getHeaders()), [ + 'documentId' => $excludedDocumentId, + 'data' => [ + 'status' => 'inactive' + ], + 'permissions' => [ + Permission::read(Role::any()), + ], + ]); + + try { + $client->receive(); + $this->fail('Expected TimeoutException - event should be filtered'); + } catch (TimeoutException $e) { + $this->assertTrue(true); + } + + $client->close(); + + // Setup database and collection + $database = $this->client->call(Client::METHOD_POST, '/databases', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'databaseId' => ID::unique(), + 'name' => 'GreaterThan Test DB', + ]); + $databaseId = $database['body']['$id']; + + $collection = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'collectionId' => ID::unique(), + 'name' => 'Test Collection', + 'permissions' => [ + Permission::create(Role::user($user['$id'])), + ], + 'documentSecurity' => true, + ]); + $collectionId = $collection['body']['$id']; + + $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/attributes/integer', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'key' => 'score', + 'required' => false, + ]); + + sleep(2); + + // Subscribe with query for score > 50 + $client = $this->getWebsocket(['documents'], [ + 'origin' => 'http://localhost', + 'cookie' => 'a_session_' . $projectId . '=' . $session, + ], null, [ + Query::greaterThan('score', 50)->toString(), + ]); + + $response = json_decode($client->receive(), true); + $this->assertEquals('connected', $response['type']); + + // Create document with score > 50 - should receive event + $document1 = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], $this->getHeaders()), [ + 'documentId' => ID::unique(), + 'data' => [ + 'score' => 75 + ], + 'permissions' => [ + Permission::read(Role::any()), + ], + ]); + + $event = json_decode($client->receive(), true); + $this->assertEquals('event', $event['type']); + $this->assertEquals(75, $event['data']['payload']['score']); + + // Create document with score <= 50 - should NOT receive event + $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], $this->getHeaders()), [ + 'documentId' => ID::unique(), + 'data' => [ + 'score' => 30 + ], + 'permissions' => [ + Permission::read(Role::any()), + ], + ]); + + try { + $client->receive(); + $this->fail('Expected TimeoutException - event should be filtered'); + } catch (TimeoutException $e) { + $this->assertTrue(true); + } + + $client->close(); + + // Setup database and collection + $database = $this->client->call(Client::METHOD_POST, '/databases', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'databaseId' => ID::unique(), + 'name' => 'LesserThan Test DB', + ]); + $databaseId = $database['body']['$id']; + + $collection = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'collectionId' => ID::unique(), + 'name' => 'Test Collection', + 'permissions' => [ + Permission::create(Role::user($user['$id'])), + ], + 'documentSecurity' => true, + ]); + $collectionId = $collection['body']['$id']; + + $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/attributes/integer', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'key' => 'age', + 'required' => false, + ]); + + sleep(2); + + // Subscribe with query for age < 18 + $client = $this->getWebsocket(['documents'], [ + 'origin' => 'http://localhost', + 'cookie' => 'a_session_' . $projectId . '=' . $session, + ], null, [ + Query::lessThan('age', 18)->toString(), + ]); + + $response = json_decode($client->receive(), true); + $this->assertEquals('connected', $response['type']); + + // Create document with age < 18 - should receive event + $document1 = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], $this->getHeaders()), [ + 'documentId' => ID::unique(), + 'data' => [ + 'age' => 15 + ], + 'permissions' => [ + Permission::read(Role::any()), + ], + ]); + + $event = json_decode($client->receive(), true); + $this->assertEquals('event', $event['type']); + $this->assertEquals(15, $event['data']['payload']['age']); + + // Create document with age >= 18 - should NOT receive event + $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], $this->getHeaders()), [ + 'documentId' => ID::unique(), + 'data' => [ + 'age' => 25 + ], + 'permissions' => [ + Permission::read(Role::any()), + ], + ]); + + try { + $client->receive(); + $this->fail('Expected TimeoutException - event should be filtered'); + } catch (TimeoutException $e) { + $this->assertTrue(true); + } + + $client->close(); + + // Setup database and collection + $database = $this->client->call(Client::METHOD_POST, '/databases', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'databaseId' => ID::unique(), + 'name' => 'GreaterEqual Test DB', + ]); + $databaseId = $database['body']['$id']; + + $collection = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'collectionId' => ID::unique(), + 'name' => 'Test Collection', + 'permissions' => [ + Permission::create(Role::user($user['$id'])), + ], + 'documentSecurity' => true, + ]); + $collectionId = $collection['body']['$id']; + + $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/attributes/integer', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'key' => 'priority', + 'required' => false, + ]); + + sleep(2); + + // Subscribe with query for priority >= 5 + $client = $this->getWebsocket(['documents'], [ + 'origin' => 'http://localhost', + 'cookie' => 'a_session_' . $projectId . '=' . $session, + ], null, [ + Query::greaterThanEqual('priority', 5)->toString(), + ]); + + $response = json_decode($client->receive(), true); + $this->assertEquals('connected', $response['type']); + + // Create document with priority = 5 - should receive event + $document1 = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], $this->getHeaders()), [ + 'documentId' => ID::unique(), + 'data' => [ + 'priority' => 5 + ], + 'permissions' => [ + Permission::read(Role::any()), + ], + ]); + + $event = json_decode($client->receive(), true); + $this->assertEquals('event', $event['type']); + $this->assertEquals(5, $event['data']['payload']['priority']); + + // Create document with priority > 5 - should receive event + $document2 = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], $this->getHeaders()), [ + 'documentId' => ID::unique(), + 'data' => [ + 'priority' => 8 + ], + 'permissions' => [ + Permission::read(Role::any()), + ], + ]); + + $event = json_decode($client->receive(), true); + $this->assertEquals('event', $event['type']); + $this->assertEquals(8, $event['data']['payload']['priority']); + + // Create document with priority < 5 - should NOT receive event + $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], $this->getHeaders()), [ + 'documentId' => ID::unique(), + 'data' => [ + 'priority' => 3 + ], + 'permissions' => [ + Permission::read(Role::any()), + ], + ]); + + try { + $client->receive(); + $this->fail('Expected TimeoutException - event should be filtered'); + } catch (TimeoutException $e) { + $this->assertTrue(true); + } + + $client->close(); + + // Setup database and collection + $database = $this->client->call(Client::METHOD_POST, '/databases', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'databaseId' => ID::unique(), + 'name' => 'LesserEqual Test DB', + ]); + $databaseId = $database['body']['$id']; + + $collection = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'collectionId' => ID::unique(), + 'name' => 'Test Collection', + 'permissions' => [ + Permission::create(Role::user($user['$id'])), + ], + 'documentSecurity' => true, + ]); + $collectionId = $collection['body']['$id']; + + $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/attributes/integer', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'key' => 'level', + 'required' => false, + ]); + + sleep(2); + + // Subscribe with query for level <= 10 + $client = $this->getWebsocket(['documents'], [ + 'origin' => 'http://localhost', + 'cookie' => 'a_session_' . $projectId . '=' . $session, + ], null, [ + Query::lessThanEqual('level', 10)->toString(), + ]); + + $response = json_decode($client->receive(), true); + $this->assertEquals('connected', $response['type']); + + // Create document with level = 10 - should receive event + $document1 = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], $this->getHeaders()), [ + 'documentId' => ID::unique(), + 'data' => [ + 'level' => 10 + ], + 'permissions' => [ + Permission::read(Role::any()), + ], + ]); + + $event = json_decode($client->receive(), true); + $this->assertEquals('event', $event['type']); + $this->assertEquals(10, $event['data']['payload']['level']); + + // Create document with level < 10 - should receive event + $document2 = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], $this->getHeaders()), [ + 'documentId' => ID::unique(), + 'data' => [ + 'level' => 7 + ], + 'permissions' => [ + Permission::read(Role::any()), + ], + ]); + + $event = json_decode($client->receive(), true); + $this->assertEquals('event', $event['type']); + $this->assertEquals(7, $event['data']['payload']['level']); + + // Create document with level > 10 - should NOT receive event + $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], $this->getHeaders()), [ + 'documentId' => ID::unique(), + 'data' => [ + 'level' => 15 + ], + 'permissions' => [ + Permission::read(Role::any()), + ], + ]); + + try { + $client->receive(); + $this->fail('Expected TimeoutException - event should be filtered'); + } catch (TimeoutException $e) { + $this->assertTrue(true); + } + + $client->close(); + + // Setup database and collection + $database = $this->client->call(Client::METHOD_POST, '/databases', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'databaseId' => ID::unique(), + 'name' => 'IsNull Test DB', + ]); + $databaseId = $database['body']['$id']; + + $collection = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'collectionId' => ID::unique(), + 'name' => 'Test Collection', + 'permissions' => [ + Permission::create(Role::user($user['$id'])), + ], + 'documentSecurity' => true, + ]); + $collectionId = $collection['body']['$id']; + + $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/attributes/string', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'key' => 'description', + 'size' => 256, + 'required' => false, + ]); + + sleep(2); + + // Subscribe with query for description IS NULL + $client = $this->getWebsocket(['documents'], [ + 'origin' => 'http://localhost', + 'cookie' => 'a_session_' . $projectId . '=' . $session, + ], null, [ + Query::isNull('description')->toString(), + ]); + + $response = json_decode($client->receive(), true); + $this->assertEquals('connected', $response['type']); + + // Create document without description - should receive event + $document1 = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], $this->getHeaders()), [ + 'documentId' => ID::unique(), + 'data' => [ + 'description' => null + ], + 'permissions' => [ + Permission::read(Role::any()), + ], + ]); + + $event = json_decode($client->receive(), true); + $this->assertEquals('event', $event['type']); + + // Create document with description - should NOT receive event + $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], $this->getHeaders()), [ + 'documentId' => ID::unique(), + 'data' => [ + 'description' => 'Has description' + ], + 'permissions' => [ + Permission::read(Role::any()), + ], + ]); + + try { + $client->receive(); + $this->fail('Expected TimeoutException - event should be filtered'); + } catch (TimeoutException $e) { + $this->assertTrue(true); + } + + $client->close(); + + // Setup database and collection + $database = $this->client->call(Client::METHOD_POST, '/databases', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'databaseId' => ID::unique(), + 'name' => 'IsNotNull Test DB', + ]); + $databaseId = $database['body']['$id']; + + $collection = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'collectionId' => ID::unique(), + 'name' => 'Test Collection', + 'permissions' => [ + Permission::create(Role::user($user['$id'])), + ], + 'documentSecurity' => true, + ]); + $collectionId = $collection['body']['$id']; + + $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/attributes/string', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'key' => 'email', + 'size' => 256, + 'required' => false, + ]); + + sleep(2); + + // Subscribe with query for email IS NOT NULL + $client = $this->getWebsocket(['documents'], [ + 'origin' => 'http://localhost', + 'cookie' => 'a_session_' . $projectId . '=' . $session, + ], null, [ + Query::isNotNull('email')->toString(), + ]); + + $response = json_decode($client->receive(), true); + $this->assertEquals('connected', $response['type']); + + // Create document with email - should receive event + $document1 = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], $this->getHeaders()), [ + 'documentId' => ID::unique(), + 'data' => [ + 'email' => 'test@example.com' + ], + 'permissions' => [ + Permission::read(Role::any()), + ], + ]); + + $event = json_decode($client->receive(), true); + $this->assertEquals('event', $event['type']); + $this->assertEquals('test@example.com', $event['data']['payload']['email']); + + // Create document without email - should NOT receive event + $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], $this->getHeaders()), [ + 'documentId' => ID::unique(), + 'data' => [], + 'permissions' => [ + Permission::read(Role::any()), + ], + ]); + + try { + $client->receive(); + $this->fail('Expected TimeoutException - event should be filtered'); + } catch (TimeoutException $e) { + $this->assertTrue(true); + } + + $client->close(); + + // Setup database and collection + $database = $this->client->call(Client::METHOD_POST, '/databases', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'databaseId' => ID::unique(), + 'name' => 'And Test DB', + ]); + $databaseId = $database['body']['$id']; + + $collection = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'collectionId' => ID::unique(), + 'name' => 'Test Collection', + 'permissions' => [ + Permission::create(Role::user($user['$id'])), + ], + 'documentSecurity' => true, + ]); + $collectionId = $collection['body']['$id']; + + $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/attributes/string', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'key' => 'status', + 'size' => 256, + 'required' => false, + ]); + + $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/attributes/integer', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'key' => 'priority', + 'required' => false, + ]); + + sleep(2); + + // Subscribe with AND query: status = 'active' AND priority > 5 + $client = $this->getWebsocket(['documents'], [ + 'origin' => 'http://localhost', + 'cookie' => 'a_session_' . $projectId . '=' . $session, + ], null, [ + Query::and([ + Query::equal('status', ['active']), + Query::greaterThan('priority', 5) + ])->toString(), + ]); + + $response = json_decode($client->receive(), true); + $this->assertEquals('connected', $response['type']); + + // Create document matching both conditions - should receive event + $document1 = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], $this->getHeaders()), [ + 'documentId' => ID::unique(), + 'data' => [ + 'status' => 'active', + 'priority' => 8 + ], + 'permissions' => [ + Permission::read(Role::any()), + ], + ]); + + $event = json_decode($client->receive(), true); + $this->assertEquals('event', $event['type']); + $this->assertEquals('active', $event['data']['payload']['status']); + $this->assertEquals(8, $event['data']['payload']['priority']); + + // Create document with status = 'active' but priority <= 5 - should NOT receive event + $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], $this->getHeaders()), [ + 'documentId' => ID::unique(), + 'data' => [ + 'status' => 'active', + 'priority' => 3 + ], + 'permissions' => [ + Permission::read(Role::any()), + ], + ]); + + try { + $client->receive(); + $this->fail('Expected TimeoutException - event should be filtered'); + } catch (TimeoutException $e) { + $this->assertTrue(true); + } + + // Create document with priority > 5 but status != 'active' - should NOT receive event + $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], $this->getHeaders()), [ + 'documentId' => ID::unique(), + 'data' => [ + 'status' => 'inactive', + 'priority' => 9 + ], + 'permissions' => [ + Permission::read(Role::any()), + ], + ]); + + try { + $client->receive(); + $this->fail('Expected TimeoutException - event should be filtered'); + } catch (TimeoutException $e) { + $this->assertTrue(true); + } + + $client->close(); + + // Setup database and collection + $database = $this->client->call(Client::METHOD_POST, '/databases', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'databaseId' => ID::unique(), + 'name' => 'Or Test DB', + ]); + $databaseId = $database['body']['$id']; + + $collection = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'collectionId' => ID::unique(), + 'name' => 'Test Collection', + 'permissions' => [ + Permission::create(Role::user($user['$id'])), + ], + 'documentSecurity' => true, + ]); + $collectionId = $collection['body']['$id']; + + $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/attributes/string', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'key' => 'type', + 'size' => 256, + 'required' => false, + ]); + + sleep(2); + + // Subscribe with OR query: type = 'urgent' OR type = 'critical' + $client = $this->getWebsocket(['documents'], [ + 'origin' => 'http://localhost', + 'cookie' => 'a_session_' . $projectId . '=' . $session, + ], null, [ + Query::or([ + Query::equal('type', ['urgent']), + Query::equal('type', ['critical']) + ])->toString(), + ]); + + $response = json_decode($client->receive(), true); + $this->assertEquals('connected', $response['type']); + + // Create document with type = 'urgent' - should receive event + $document1 = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], $this->getHeaders()), [ + 'documentId' => ID::unique(), + 'data' => [ + 'type' => 'urgent' + ], + 'permissions' => [ + Permission::read(Role::any()), + ], + ]); + + $event = json_decode($client->receive(), true); + $this->assertEquals('event', $event['type']); + $this->assertEquals('urgent', $event['data']['payload']['type']); + + // Create document with type = 'critical' - should receive event + $document2 = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], $this->getHeaders()), [ + 'documentId' => ID::unique(), + 'data' => [ + 'type' => 'critical' + ], + 'permissions' => [ + Permission::read(Role::any()), + ], + ]); + + $event = json_decode($client->receive(), true); + $this->assertEquals('event', $event['type']); + $this->assertEquals('critical', $event['data']['payload']['type']); + + // Create document with type = 'normal' - should NOT receive event + $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], $this->getHeaders()), [ + 'documentId' => ID::unique(), + 'data' => [ + 'type' => 'normal' + ], + 'permissions' => [ + Permission::read(Role::any()), + ], + ]); + + try { + $client->receive(); + $this->fail('Expected TimeoutException - event should be filtered'); + } catch (TimeoutException $e) { + $this->assertTrue(true); + } + + $client->close(); + + // Setup database and collection + $database = $this->client->call(Client::METHOD_POST, '/databases', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'databaseId' => ID::unique(), + 'name' => 'Complex Query Test DB', + ]); + $databaseId = $database['body']['$id']; + + $collection = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'collectionId' => ID::unique(), + 'name' => 'Test Collection', + 'permissions' => [ + Permission::create(Role::user($user['$id'])), + ], + 'documentSecurity' => true, + ]); + $collectionId = $collection['body']['$id']; + + $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/attributes/string', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'key' => 'category', + 'size' => 256, + 'required' => false, + ]); + + $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/attributes/integer', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'key' => 'score', + 'required' => false, + ]); + + sleep(2); + + // Subscribe with complex query: (category = 'premium' OR category = 'vip') AND score >= 80 + $client = $this->getWebsocket(['documents'], [ + 'origin' => 'http://localhost', + 'cookie' => 'a_session_' . $projectId . '=' . $session, + ], null, [ + Query::and([ + Query::or([ + Query::equal('category', ['premium']), + Query::equal('category', ['vip']) + ]), + Query::greaterThanEqual('score', 80) + ])->toString(), + ]); + + $response = json_decode($client->receive(), true); + $this->assertEquals('connected', $response['type']); + + // Create document with category = 'premium' and score >= 80 - should receive event + $document1 = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], $this->getHeaders()), [ + 'documentId' => ID::unique(), + 'data' => [ + 'category' => 'premium', + 'score' => 85 + ], + 'permissions' => [ + Permission::read(Role::any()), + ], + ]); + + $event = json_decode($client->receive(), true); + $this->assertEquals('event', $event['type']); + $this->assertEquals('premium', $event['data']['payload']['category']); + $this->assertEquals(85, $event['data']['payload']['score']); + + // Create document with category = 'vip' and score >= 80 - should receive event + $document2 = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], $this->getHeaders()), [ + 'documentId' => ID::unique(), + 'data' => [ + 'category' => 'vip', + 'score' => 90 + ], + 'permissions' => [ + Permission::read(Role::any()), + ], + ]); + + $event = json_decode($client->receive(), true); + $this->assertEquals('event', $event['type']); + $this->assertEquals('vip', $event['data']['payload']['category']); + $this->assertEquals(90, $event['data']['payload']['score']); + + // Create document with category = 'premium' but score < 80 - should NOT receive event + $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], $this->getHeaders()), [ + 'documentId' => ID::unique(), + 'data' => [ + 'category' => 'premium', + 'score' => 70 + ], + 'permissions' => [ + Permission::read(Role::any()), + ], + ]); + + try { + $client->receive(); + $this->fail('Expected TimeoutException - event should be filtered'); + } catch (TimeoutException $e) { + $this->assertTrue(true); + } + + // Create document with score >= 80 but category != 'premium' or 'vip' - should NOT receive event + $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], $this->getHeaders()), [ + 'documentId' => ID::unique(), + 'data' => [ + 'category' => 'standard', + 'score' => 85 + ], + 'permissions' => [ + Permission::read(Role::any()), + ], + ]); + + try { + $client->receive(); + $this->fail('Expected TimeoutException - event should be filtered'); + } catch (TimeoutException $e) { + $this->assertTrue(true); + } + + $client->close(); + } + + public function testFilesChannelWithQuery() + { + $user = $this->getUser(); + $session = $user['session'] ?? ''; + $projectId = $this->getProject()['$id']; + + // Create bucket + $bucket = $this->client->call(Client::METHOD_POST, '/storage/buckets', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'bucketId' => ID::unique(), + 'name' => 'Query Test Bucket', + 'permissions' => [ + Permission::read(Role::any()), + Permission::create(Role::any()), + ] + ]); + $bucketId = $bucket['body']['$id']; + + $targetFileId = ID::unique(); + + // Subscribe with query for specific file ID + $client = $this->getWebsocket(['files'], [ + 'origin' => 'http://localhost', + 'cookie' => 'a_session_' . $projectId . '=' . $session, + ], null, [ + Query::equal('$id', [$targetFileId])->toString(), + ]); + + $response = json_decode($client->receive(), true); + $this->assertEquals('connected', $response['type']); + + // Create file with matching ID - should receive event + $file = $this->client->call(Client::METHOD_POST, '/storage/buckets/' . $bucketId . '/files', array_merge([ + 'content-type' => 'multipart/form-data', + 'x-appwrite-project' => $projectId, + ], $this->getHeaders()), [ + 'fileId' => $targetFileId, + 'file' => new CURLFile(realpath(__DIR__ . '/../../../resources/logo.png'), 'image/png', 'logo.png'), + 'permissions' => [ + Permission::read(Role::any()), + ], + ]); + + $event = json_decode($client->receive(), true); + $this->assertEquals('event', $event['type']); + $this->assertEquals($targetFileId, $event['data']['payload']['$id']); + + // Create file with different ID - should NOT receive event + $otherFileId = ID::unique(); + $this->client->call(Client::METHOD_POST, '/storage/buckets/' . $bucketId . '/files', array_merge([ + 'content-type' => 'multipart/form-data', + 'x-appwrite-project' => $projectId, + ], $this->getHeaders()), [ + 'fileId' => $otherFileId, + 'file' => new CURLFile(realpath(__DIR__ . '/../../../resources/logo.png'), 'image/png', 'logo2.png'), + 'permissions' => [ + Permission::read(Role::any()), + ], + ]); + + try { + $client->receive(); + $this->fail('Expected TimeoutException - event should be filtered'); + } catch (TimeoutException $e) { + $this->assertTrue(true); + } + + $client->close(); + } + + public function testMultipleQueriesWithAndLogic() + { + $user = $this->getUser(); + $session = $user['session'] ?? ''; + $projectId = $this->getProject()['$id']; + + // Setup database and collection + $database = $this->client->call(Client::METHOD_POST, '/databases', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'databaseId' => ID::unique(), + 'name' => 'Multiple Queries Test DB', + ]); + $databaseId = $database['body']['$id']; + + $collection = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'collectionId' => ID::unique(), + 'name' => 'Test Collection', + 'permissions' => [ + Permission::create(Role::user($user['$id'])), + ], + 'documentSecurity' => true, + ]); + $collectionId = $collection['body']['$id']; + + $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/attributes/string', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'key' => 'status', + 'size' => 256, + 'required' => false, + ]); + + sleep(2); + + $targetDocId = ID::unique(); + + // Subscribe with multiple queries (AND logic - ALL queries must match for event to be received) + $client = $this->getWebsocket(['documents'], [ + 'origin' => 'http://localhost', + 'cookie' => 'a_session_' . $projectId . '=' . $session, + ], null, [ + Query::equal('$id', [$targetDocId])->toString(), + Query::equal('status', ['active'])->toString(), + ]); + + $response = json_decode($client->receive(), true); + $this->assertEquals('connected', $response['type']); + + // Create document matching BOTH queries - should receive event + $document1 = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], $this->getHeaders()), [ + 'documentId' => $targetDocId, + 'data' => [ + 'status' => 'active' + ], + 'permissions' => [ + Permission::read(Role::any()), + ], + ]); + + $event = json_decode($client->receive(), true); + $this->assertEquals('event', $event['type']); + $this->assertEquals($targetDocId, $event['data']['payload']['$id']); + $this->assertEquals('active', $event['data']['payload']['status']); + + // Create document with matching ID but wrong status - should NOT receive event (only one query matches) + $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], $this->getHeaders()), [ + 'documentId' => $targetDocId, + 'data' => [ + 'status' => 'inactive' + ], + 'permissions' => [ + Permission::read(Role::any()), + ], + ]); + + try { + $client->receive(); + $this->fail('Expected TimeoutException - event should be filtered (ID matches but status does not)'); + } catch (TimeoutException $e) { + $this->assertTrue(true); + } + + // Create document with matching status but wrong ID - should NOT receive event (only one query matches) + $otherDocId = ID::unique(); + $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], $this->getHeaders()), [ + 'documentId' => $otherDocId, + 'data' => [ + 'status' => 'active' + ], + 'permissions' => [ + Permission::read(Role::any()), + ], + ]); + + try { + $client->receive(); + $this->fail('Expected TimeoutException - event should be filtered (status matches but ID does not)'); + } catch (TimeoutException $e) { + $this->assertTrue(true); + } + + // Create document matching NEITHER query - should NOT receive event + $anotherDocId = ID::unique(); + $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], $this->getHeaders()), [ + 'documentId' => $anotherDocId, + 'data' => [ + 'status' => 'inactive' + ], + 'permissions' => [ + Permission::read(Role::any()), + ], + ]); + + try { + $client->receive(); + $this->fail('Expected TimeoutException - event should be filtered (neither query matches)'); + } catch (TimeoutException $e) { + $this->assertTrue(true); + } + + $client->close(); + } + + public function testInvalidQueryShouldNotSubscribe() + { + $user = $this->getUser(); + $session = $user['session'] ?? ''; + $projectId = $this->getProject()['$id']; + + // Test 1: Simple invalid query method (contains is not allowed) + $client = $this->getWebsocket(['documents'], [ + 'origin' => 'http://localhost', + 'cookie' => 'a_session_' . $projectId . '=' . $session, + ], null, [ + Query::contains('status', ['active'])->toString(), + ]); + + $response = json_decode($client->receive(), true); + $this->assertEquals('error', $response['type']); + $this->assertStringContainsString('not supported in Realtime queries', $response['data']['message']); + $this->assertStringContainsString('contains', $response['data']['message']); + + // Test 2: Invalid query method in nested AND query + $client = $this->getWebsocket(['documents'], [ + 'origin' => 'http://localhost', + 'cookie' => 'a_session_' . $projectId . '=' . $session, + ], null, [ + Query::and([ + Query::equal('status', ['active']), + Query::search('name', 'test') // search is not allowed + ])->toString(), + ]); + + $response = json_decode($client->receive(), true); + $this->assertEquals('error', $response['type']); + $this->assertStringContainsString('not supported in Realtime queries', $response['data']['message']); + $this->assertStringContainsString('search', $response['data']['message']); + + // Test 3: Invalid query method in nested OR query + $client = $this->getWebsocket(['documents'], [ + 'origin' => 'http://localhost', + 'cookie' => 'a_session_' . $projectId . '=' . $session, + ], null, [ + Query::or([ + Query::equal('status', ['active']), + Query::between('score', 0, 100) // between is not allowed + ])->toString(), + ]); + + $response = json_decode($client->receive(), true); + $this->assertEquals('error', $response['type']); + $this->assertStringContainsString('not supported in Realtime queries', $response['data']['message']); + $this->assertStringContainsString('between', $response['data']['message']); + + // Test 4: Deeply nested invalid query (AND -> OR -> invalid) + $client = $this->getWebsocket(['documents'], [ + 'origin' => 'http://localhost', + 'cookie' => 'a_session_' . $projectId . '=' . $session, + ], null, [ + Query::and([ + Query::equal('status', ['active']), + Query::or([ + Query::greaterThan('score', 50), + Query::startsWith('name', 'test') // startsWith is not allowed + ]) + ])->toString(), + ]); + + $response = json_decode($client->receive(), true); + $this->assertEquals('error', $response['type']); + $this->assertStringContainsString('not supported in Realtime queries', $response['data']['message']); + $this->assertStringContainsString('startsWith', $response['data']['message']); + + // Test 5: Multiple invalid queries in nested structure + $client = $this->getWebsocket(['documents'], [ + 'origin' => 'http://localhost', + 'cookie' => 'a_session_' . $projectId . '=' . $session, + ], null, [ + Query::and([ + Query::contains('tags', ['important']), // contains is not allowed + Query::or([ + Query::endsWith('email', '@example.com'), // endsWith is not allowed + Query::equal('status', ['active']) + ]) + ])->toString(), + ]); + + $response = json_decode($client->receive(), true); + $this->assertEquals('error', $response['type']); + $this->assertStringContainsString('not supported in Realtime queries', $response['data']['message']); + // Should catch the first invalid method encountered + $this->assertTrue( + str_contains($response['data']['message'], 'contains') || + str_contains($response['data']['message'], 'endsWith') + ); + } +} diff --git a/tests/e2e/Services/Realtime/RealtimeCustomClientTest.php b/tests/e2e/Services/Realtime/RealtimeCustomClientTest.php index c6a1686864..bd746f69f8 100644 --- a/tests/e2e/Services/Realtime/RealtimeCustomClientTest.php +++ b/tests/e2e/Services/Realtime/RealtimeCustomClientTest.php @@ -692,8 +692,8 @@ class RealtimeCustomClientTest extends Scope $client = $this->getWebsocket(['documents', 'collections'], [ 'origin' => 'http://localhost', - 'cookie' => 'a_session_' . $projectId . '=' . $session - ]); + 'cookie' => 'a_session_' . $projectId . '=' . $session, + ], null); $response = json_decode($client->receive(), true); @@ -2962,7 +2962,7 @@ class RealtimeCustomClientTest extends Scope sleep(1); try { - $client->receive(1); // 1 second timeout + $client->receive(); $this->fail('Should not receive any event after rollback'); } catch (TimeoutException $e) { // Expected - no event should be triggered diff --git a/tests/e2e/Services/Sites/SitesConsoleClientTest.php b/tests/e2e/Services/Sites/SitesConsoleClientTest.php index 2b75402b25..31cee13261 100644 --- a/tests/e2e/Services/Sites/SitesConsoleClientTest.php +++ b/tests/e2e/Services/Sites/SitesConsoleClientTest.php @@ -54,15 +54,22 @@ class SitesConsoleClientTest extends Scope $this->assertStringContainsString("Themed website", $response['body']); $this->assertStringContainsString("@media (prefers-color-scheme: dark)", $response['body']); - $deployment = $this->getDeployment($siteId, $deploymentId); - $this->assertEquals(200, $deployment['headers']['status-code']); - $this->assertNotEmpty($deployment['body']['screenshotLight']); - $this->assertNotEmpty($deployment['body']['screenshotDark']); + $deployment = null; + $site = null; + $this->assertEventually(function () use ($siteId, $deploymentId, &$deployment, &$site) { + $deployment = $this->getDeployment($siteId, $deploymentId); + $this->assertEquals(200, $deployment['headers']['status-code']); + $this->assertNotEmpty($deployment['body']['screenshotLight']); + $this->assertNotEmpty($deployment['body']['screenshotDark']); - $site = $this->getSite($siteId); - $this->assertEquals(200, $site['headers']['status-code']); - $this->assertEquals($deployment['body']['screenshotLight'], $site['body']['deploymentScreenshotLight']); - $this->assertEquals($deployment['body']['screenshotDark'], $site['body']['deploymentScreenshotDark']); + $site = $this->getSite($siteId); + $this->assertEquals(200, $site['headers']['status-code']); + $this->assertEquals($deployment['body']['screenshotLight'], $site['body']['deploymentScreenshotLight']); + $this->assertEquals($deployment['body']['screenshotDark'], $site['body']['deploymentScreenshotDark']); + }); + + $this->assertNotNull($site); + $this->assertNotNull($deployment); $screenshotId = $deployment['body']['screenshotLight']; $file = $this->client->call(Client::METHOD_GET, "/storage/buckets/screenshots/files/$screenshotId/view?project=console", array_merge($this->getHeaders(), [ diff --git a/tests/e2e/Services/Storage/StorageBase.php b/tests/e2e/Services/Storage/StorageBase.php index c67cfcc99a..d0130eb3d0 100644 --- a/tests/e2e/Services/Storage/StorageBase.php +++ b/tests/e2e/Services/Storage/StorageBase.php @@ -951,4 +951,69 @@ trait StorageBase return $data; } + + public function testBucketTotalSize(): void + { + $bucket = $this->client->call(Client::METHOD_POST, '/storage/buckets', [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ], [ + 'bucketId' => ID::unique(), + 'name' => 'Test Bucket Size', + 'permissions' => [ + Permission::read(Role::any()), + Permission::create(Role::any()), + ], + ]); + + $this->assertEquals(201, $bucket['headers']['status-code']); + $bucketId = $bucket['body']['$id']; + + // bucket should have totalSize = 0 (no files) + $emptyBucket = $this->client->call(Client::METHOD_GET, '/storage/buckets/' . $bucketId, [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ]); + + $this->assertEquals(200, $emptyBucket['headers']['status-code']); + $this->assertArrayHasKey('totalSize', $emptyBucket['body']); + $this->assertEquals(0, $emptyBucket['body']['totalSize']); + + // upload first file + $file1 = $this->client->call(Client::METHOD_POST, '/storage/buckets/' . $bucketId . '/files', array_merge([ + 'content-type' => 'multipart/form-data', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'fileId' => ID::unique(), + 'file' => new CURLFile(realpath(__DIR__ . '/../../../resources/logo.png'), 'image/png', 'logo.png'), + ]); + + $this->assertEquals(201, $file1['headers']['status-code']); + + // upload second file + $file2 = $this->client->call(Client::METHOD_POST, '/storage/buckets/' . $bucketId . '/files', array_merge([ + 'content-type' => 'multipart/form-data', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'fileId' => ID::unique(), + 'file' => new CURLFile(realpath(__DIR__ . '/../../../resources/image.webp'), 'image/webp', 'image.webp'), + ]); + + $this->assertEquals(201, $file2['headers']['status-code']); + + $bucket = $this->client->call(Client::METHOD_GET, '/storage/buckets/' . $bucketId, [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ]); + + $this->assertEquals(200, $bucket['headers']['status-code']); + $this->assertArrayHasKey('totalSize', $bucket['body']); + $this->assertIsInt($bucket['body']['totalSize']); + + /* will always be 0 in tests because the worker runs hourly! */ + $this->assertGreaterThanOrEqual(0, $bucket['body']['totalSize']); + } } diff --git a/tests/e2e/Services/Storage/StorageConsoleClientTest.php b/tests/e2e/Services/Storage/StorageConsoleClientTest.php index 5c618d6357..2c39a12f09 100644 --- a/tests/e2e/Services/Storage/StorageConsoleClientTest.php +++ b/tests/e2e/Services/Storage/StorageConsoleClientTest.php @@ -160,4 +160,40 @@ class StorageConsoleClientTest extends Scope ], $this->getHeaders())); $this->assertEquals(204, $response['headers']['status-code']); } + + public function testFilePermissionNotAutoSetInConsole(): void + { + // Create a bucket + $bucket = $this->client->call(Client::METHOD_POST, '/storage/buckets', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'bucketId' => ID::unique(), + 'name' => 'Test Bucket Permissions', + 'fileSecurity' => true, + ]); + $this->assertEquals(201, $bucket['headers']['status-code']); + $bucketId = $bucket['body']['$id']; + + // Create a file without providing permissions (console client should not auto-set permissions) + $file = $this->client->call(Client::METHOD_POST, '/storage/buckets/' . $bucketId . '/files', array_merge([ + 'content-type' => 'multipart/form-data', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'fileId' => ID::unique(), + 'file' => new CURLFile(realpath(__DIR__ . '/../../../resources/logo.png'), 'image/png', 'test.png'), + ]); + $this->assertEquals(201, $file['headers']['status-code']); + + // Verify file permissions are empty (not auto-set for privileged console user) + $this->assertIsArray($file['body']['$permissions']); + $this->assertEmpty($file['body']['$permissions']); + + // Clean up: delete the bucket + $response = $this->client->call(Client::METHOD_DELETE, '/storage/buckets/' . $bucketId, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders())); + $this->assertEquals(204, $response['headers']['status-code']); + } } diff --git a/tests/e2e/Services/Storage/StorageCustomClientTest.php b/tests/e2e/Services/Storage/StorageCustomClientTest.php index ec9f0d0cc7..0337856779 100644 --- a/tests/e2e/Services/Storage/StorageCustomClientTest.php +++ b/tests/e2e/Services/Storage/StorageCustomClientTest.php @@ -1447,4 +1447,117 @@ class StorageCustomClientTest extends Scope ]); $this->assertEquals(204, $response['headers']['status-code']); } + + public function testFileEncryptionAndCompression(): void + { + // Create bucket + $bucket = $this->client->call(Client::METHOD_POST, '/storage/buckets', [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ], [ + 'bucketId' => ID::unique(), + 'name' => 'Test Bucket', + 'permissions' => [ + Permission::read(Role::any()) + ], + 'encryption' => true, + 'compression' => 'gzip' + ]); + $this->assertSame(201, $bucket['headers']['status-code']); + + // Create file + $file = $this->client->call(Client::METHOD_POST, '/storage/buckets/' . $bucket['body']['$id'] . '/files', [ + 'content-type' => 'multipart/form-data', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ], [ + 'fileId' => ID::unique(), + 'file' => new CURLFile(realpath(__DIR__ . '/../../../resources/logo.png'), 'image/png', 'transformations.png'), + ]); + $this->assertSame(201, $file['headers']['status-code']); + $this->assertSame('gzip', $file['body']['compression']); + $this->assertSame(true, $file['body']['encryption']); + + // Get file + $file = $this->client->call(Client::METHOD_GET, '/storage/buckets/' . $bucket['body']['$id'] . '/files/' . $file['body']['$id'], [ + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ]); + $this->assertSame(200, $file['headers']['status-code']); + $this->assertSame('gzip', $file['body']['compression']); + $this->assertSame(true, $file['body']['encryption']); + + // List files + $files = $this->client->call(Client::METHOD_GET, '/storage/buckets/' . $bucket['body']['$id'] . '/files', [ + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ]); + $this->assertSame(200, $files['headers']['status-code']); + $this->assertSame(1, $files['body']['total']); + $this->assertSame('gzip', $files['body']['files'][0]['compression']); + $this->assertSame(true, $files['body']['files'][0]['encryption']); + + // Update the bucket + $bucket = $this->client->call(Client::METHOD_PUT, '/storage/buckets/' . $bucket['body']['$id'], [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ], [ + 'name' => 'Test Bucket', + 'encryption' => false, + 'compression' => 'none' + ]); + + // Existing file did not update + $file = $this->client->call(Client::METHOD_GET, '/storage/buckets/' . $bucket['body']['$id'] . '/files/' . $file['body']['$id'], [ + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ]); + $this->assertSame(200, $file['headers']['status-code']); + $this->assertSame('gzip', $file['body']['compression']); + $this->assertSame(true, $file['body']['encryption']); + + // Create 2nd file + $file = $this->client->call(Client::METHOD_POST, '/storage/buckets/' . $bucket['body']['$id'] . '/files', [ + 'content-type' => 'multipart/form-data', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ], [ + 'fileId' => ID::unique(), + 'file' => new CURLFile(realpath(__DIR__ . '/../../../resources/logo.png'), 'image/png', 'transformations.png'), + ]); + $this->assertSame(201, $file['headers']['status-code']); + $this->assertSame('none', $file['body']['compression']); + $this->assertSame(false, $file['body']['encryption']); + + // Get file + $file = $this->client->call(Client::METHOD_GET, '/storage/buckets/' . $bucket['body']['$id'] . '/files/' . $file['body']['$id'], [ + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ]); + $this->assertSame(200, $file['headers']['status-code']); + $this->assertSame('none', $file['body']['compression']); + $this->assertSame(false, $file['body']['encryption']); + + // List files + $files = $this->client->call(Client::METHOD_GET, '/storage/buckets/' . $bucket['body']['$id'] . '/files', [ + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ]); + $this->assertSame(200, $files['headers']['status-code']); + $this->assertSame(2, $files['body']['total']); + $this->assertSame('none', $files['body']['files'][1]['compression']); + $this->assertSame(false, $files['body']['files'][1]['encryption']); + $this->assertSame('gzip', $files['body']['files'][0]['compression']); + $this->assertSame(true, $files['body']['files'][0]['encryption']); + + // Delete the bucket + $response = $this->client->call(Client::METHOD_DELETE, '/storage/buckets/' . $bucket['body']['$id'], [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ]); + $this->assertEquals(204, $response['headers']['status-code']); + } } diff --git a/tests/e2e/Services/Storage/StorageCustomServerTest.php b/tests/e2e/Services/Storage/StorageCustomServerTest.php index 1dafd8ca06..9b0473a352 100644 --- a/tests/e2e/Services/Storage/StorageCustomServerTest.php +++ b/tests/e2e/Services/Storage/StorageCustomServerTest.php @@ -96,6 +96,14 @@ class StorageCustomServerTest extends Scope $this->assertEquals($id, $response['body']['buckets'][0]['$id']); $this->assertEquals('Test Bucket', $response['body']['buckets'][0]['name']); + foreach ($response['body']['buckets'] as $bucket) { + $this->assertArrayHasKey('totalSize', $bucket); + $this->assertIsInt($bucket['totalSize']); + + /* always 0 because the stats worker runs hourly! */ + $this->assertGreaterThanOrEqual(0, $bucket['totalSize']); + } + $response = $this->client->call(Client::METHOD_GET, '/storage/buckets', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], @@ -186,6 +194,7 @@ class StorageCustomServerTest extends Scope $this->assertNotEmpty($response['body']); $this->assertEquals($id, $response['body']['$id']); $this->assertEquals('Test Bucket', $response['body']['name']); + $this->assertArrayHasKey('totalSize', $response['body']); /** * Test for FAILURE diff --git a/tests/unit/Utopia/Database/Query/RuntimeQueryTest.php b/tests/unit/Utopia/Database/Query/RuntimeQueryTest.php new file mode 100644 index 0000000000..7df1ca80eb --- /dev/null +++ b/tests/unit/Utopia/Database/Query/RuntimeQueryTest.php @@ -0,0 +1,602 @@ + 'John', 'age' => 30]; + $result = RuntimeQuery::filter([], $payload); + $this->assertEquals($payload, $result); + } + + public function testFilterWithNoMatchingQuery(): void + { + $queries = [Query::equal('name', ['Jane'])]; + $payload = ['name' => 'John', 'age' => 30]; + $result = RuntimeQuery::filter($queries, $payload); + $this->assertEquals([], $result); + } + + public function testFilterWithMatchingQuery(): void + { + $queries = [Query::equal('name', ['John'])]; + $payload = ['name' => 'John', 'age' => 30]; + $result = RuntimeQuery::filter($queries, $payload); + $this->assertEquals($payload, $result); + } + + // TYPE_EQUAL tests + public function testEqualMatch(): void + { + $query = Query::equal('name', ['John']); + $payload = ['name' => 'John']; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals($payload, $result); + } + + public function testEqualNoMatch(): void + { + $query = Query::equal('name', ['Jane']); + $payload = ['name' => 'John']; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals([], $result); + } + + public function testEqualMultipleValuesMatch(): void + { + $query = Query::equal('status', ['active', 'pending', 'approved']); + $payload = ['status' => 'active']; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals($payload, $result); + } + + public function testEqualMultipleValuesNoMatch(): void + { + $query = Query::equal('status', ['active', 'pending', 'approved']); + $payload = ['status' => 'rejected']; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals([], $result); + } + + public function testEqualNumericValues(): void + { + $query = Query::equal('age', [30, 25, 35]); + $payload = ['age' => 30]; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals($payload, $result); + } + + public function testEqualBooleanValues(): void + { + $query = Query::equal('active', [true]); + $payload = ['active' => true]; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals($payload, $result); + } + + public function testEqualMissingAttribute(): void + { + $query = Query::equal('missing', ['value']); + $payload = ['name' => 'John']; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals([], $result); + } + + // TYPE_NOT_EQUAL tests + public function testNotEqualMatch(): void + { + $query = Query::notEqual('name', ['Jane']); + $payload = ['name' => 'John']; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals($payload, $result); + } + + public function testNotEqualNoMatch(): void + { + $query = Query::notEqual('name', ['John']); + $payload = ['name' => 'John']; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals([], $result); + } + + public function testNotEqualMultipleValues(): void + { + // generally from the client side they will pass query strings via the realtime + // and Query::parse will be done first and parse doesn't allow multiple notEqual values + $query = Query::notEqual('status', ['rejected', 'cancelled']); + $payload = ['status' => 'active']; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals($payload, $result); + + $query = Query::notEqual('status', ['active', 'pending']); + $payload = ['status' => 'active']; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals([], $result); + } + + // TYPE_LESSER tests + public function testLesserMatch(): void + { + $query = Query::lessThan('age', 30); + $payload = ['age' => 25]; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals($payload, $result); + } + + public function testLesserNoMatch(): void + { + $query = Query::lessThan('age', 30); + $payload = ['age' => 35]; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals([], $result); + } + + public function testLesserEqualValue(): void + { + $query = Query::lessThan('age', 30); + $payload = ['age' => 30]; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals([], $result); + } + + public function testLesserMultipleValues(): void + { + // Note: Query::lessThan only accepts single value, but RuntimeQuery's anyMatch supports arrays + // This test uses a single value as Query class requires + $query = Query::lessThan('age', 30); + $payload = ['age' => 25]; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals($payload, $result); + } + + public function testLesserStringComparison(): void + { + $query = Query::lessThan('name', 'M'); + $payload = ['name' => 'A']; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals($payload, $result); + } + + // TYPE_LESSER_EQUAL tests + public function testLesserEqualMatch(): void + { + $query = Query::lessThanEqual('age', 30); + $payload = ['age' => 25]; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals($payload, $result); + } + + public function testLesserEqualExactMatch(): void + { + $query = Query::lessThanEqual('age', 30); + $payload = ['age' => 30]; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals($payload, $result); + } + + public function testLesserEqualNoMatch(): void + { + $query = Query::lessThanEqual('age', 30); + $payload = ['age' => 35]; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals([], $result); + } + + public function testLesserEqualMultipleValues(): void + { + // Note: Query::lessThanEqual only accepts single value + $query = Query::lessThanEqual('age', 30); + $payload = ['age' => 30]; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals($payload, $result); + } + + // TYPE_GREATER tests + public function testGreaterMatch(): void + { + $query = Query::greaterThan('age', 30); + $payload = ['age' => 35]; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals($payload, $result); + } + + public function testGreaterNoMatch(): void + { + $query = Query::greaterThan('age', 30); + $payload = ['age' => 25]; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals([], $result); + } + + public function testGreaterEqualValue(): void + { + $query = Query::greaterThan('age', 30); + $payload = ['age' => 30]; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals([], $result); + } + + public function testGreaterMultipleValues(): void + { + // Note: Query::greaterThan only accepts single value + $query = Query::greaterThan('age', 20); + $payload = ['age' => 35]; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals($payload, $result); + } + + // TYPE_GREATER_EQUAL tests + public function testGreaterEqualMatch(): void + { + $query = Query::greaterThanEqual('age', 30); + $payload = ['age' => 35]; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals($payload, $result); + } + + public function testGreaterEqualExactMatch(): void + { + $query = Query::greaterThanEqual('age', 30); + $payload = ['age' => 30]; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals($payload, $result); + } + + public function testGreaterEqualNoMatch(): void + { + $query = Query::greaterThanEqual('age', 30); + $payload = ['age' => 25]; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals([], $result); + } + + public function testGreaterEqualMultipleValues(): void + { + // Note: Query::greaterThanEqual only accepts single value + $query = Query::greaterThanEqual('age', 20); + $payload = ['age' => 30]; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals($payload, $result); + } + + // TYPE_IS_NULL tests + public function testIsNullMatch(): void + { + $query = Query::isNull('description'); + $payload = ['description' => null]; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals($payload, $result); + } + + public function testIsNullNoMatch(): void + { + $query = Query::isNull('description'); + $payload = ['description' => 'Some text']; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals([], $result); + } + + public function testIsNullMissingAttribute(): void + { + $query = Query::isNull('missing'); + $payload = ['name' => 'John']; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals([], $result); + } + + // TYPE_IS_NOT_NULL tests + public function testIsNotNullMatch(): void + { + $query = Query::isNotNull('description'); + $payload = ['description' => 'Some text']; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals($payload, $result); + } + + public function testIsNotNullNoMatch(): void + { + $query = Query::isNotNull('description'); + $payload = ['description' => null]; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals([], $result); + } + + public function testIsNotNullMissingAttribute(): void + { + $query = Query::isNotNull('missing'); + $payload = ['name' => 'John']; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals([], $result); + } + + // TYPE_AND tests + public function testAndAllMatch(): void + { + $query = Query::and([ + Query::equal('name', ['John']), + Query::equal('age', [30]) + ]); + $payload = ['name' => 'John', 'age' => 30]; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals($payload, $result); + } + + public function testAndOneFails(): void + { + $query = Query::and([ + Query::equal('name', ['John']), + Query::equal('age', [25]) + ]); + $payload = ['name' => 'John', 'age' => 30]; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals([], $result); + } + + public function testAndAllFail(): void + { + $query = Query::and([ + Query::equal('name', ['Jane']), + Query::equal('age', [25]) + ]); + $payload = ['name' => 'John', 'age' => 30]; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals([], $result); + } + + public function testAndMultipleConditions(): void + { + $query = Query::and([ + Query::equal('status', ['active']), + Query::greaterThan('age', 18), + Query::isNotNull('email') + ]); + $payload = ['status' => 'active', 'age' => 25, 'email' => 'test@example.com']; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals($payload, $result); + } + + public function testAndNestedAnd(): void + { + $query = Query::and([ + Query::equal('name', ['John']), + Query::and([ + Query::equal('age', [30]), + Query::equal('status', ['active']) + ]) + ]); + $payload = ['name' => 'John', 'age' => 30, 'status' => 'active']; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals($payload, $result); + } + + // TYPE_OR tests + public function testOrOneMatch(): void + { + $query = Query::or([ + Query::equal('name', ['John']), + Query::equal('name', ['Jane']) + ]); + $payload = ['name' => 'John']; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals($payload, $result); + } + + public function testOrAllMatch(): void + { + $query = Query::or([ + Query::equal('status', ['active']), + Query::equal('status', ['pending']) + ]); + $payload = ['status' => 'active']; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals($payload, $result); + } + + public function testOrAllFail(): void + { + $query = Query::or([ + Query::equal('name', ['Jane']), + Query::equal('age', [25]) + ]); + $payload = ['name' => 'John', 'age' => 30]; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals([], $result); + } + + public function testOrMultipleConditions(): void + { + $query = Query::or([ + Query::equal('status', ['active']), + Query::equal('status', ['pending']), + Query::equal('status', ['approved']) + ]); + $payload = ['status' => 'pending']; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals($payload, $result); + } + + public function testOrNestedOr(): void + { + $query = Query::or([ + Query::equal('name', ['John']), + Query::or([ + Query::equal('name', ['Jane']), + Query::equal('name', ['Bob']) + ]) + ]); + $payload = ['name' => 'Bob']; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals($payload, $result); + } + + public function testOrWithDifferentAttributes(): void + { + $query = Query::or([ + Query::equal('name', ['John']), + Query::equal('email', ['john@example.com']) + ]); + $payload = ['name' => 'Jane', 'email' => 'john@example.com']; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals($payload, $result); + } + + // Complex combinations + public function testAndOrCombination(): void + { + $query = Query::and([ + Query::equal('type', ['user']), + Query::or([ + Query::equal('status', ['active']), + Query::equal('status', ['pending']) + ]) + ]); + $payload = ['type' => 'user', 'status' => 'active']; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals($payload, $result); + } + + public function testOrAndCombination(): void + { + $query = Query::or([ + Query::and([ + Query::equal('name', ['John']), + Query::equal('age', [30]) + ]), + Query::and([ + Query::equal('name', ['Jane']), + Query::equal('age', [25]) + ]) + ]); + $payload = ['name' => 'John', 'age' => 30]; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals($payload, $result); + } + + // Edge cases + public function testMultipleQueriesAllMatch(): void + { + $queries = [ + Query::equal('name', ['John']), + Query::equal('age', [30]) + ]; + $payload = ['name' => 'John', 'age' => 30]; + $result = RuntimeQuery::filter($queries, $payload); + $this->assertEquals($payload, $result); + } + + public function testMultipleQueriesFirstMatches(): void + { + $queries = [ + Query::equal('name', ['John']), + Query::equal('age', [25]) + ]; + $payload = ['name' => 'John', 'age' => 30]; + $result = RuntimeQuery::filter($queries, $payload); + // With AND logic, if first matches but second doesn't, should return empty + $this->assertEquals([], $result); + } + + public function testMultipleQueriesSecondMatches(): void + { + $queries = [ + Query::equal('name', ['Jane']), + Query::equal('age', [30]) + ]; + $payload = ['name' => 'John', 'age' => 30]; + $result = RuntimeQuery::filter($queries, $payload); + // With AND logic, if second matches but first doesn't, should return empty + $this->assertEquals([], $result); + } + + public function testMultipleQueriesNoneMatch(): void + { + $queries = [ + Query::equal('name', ['Jane']), + Query::equal('age', [25]) + ]; + $payload = ['name' => 'John', 'age' => 30]; + $result = RuntimeQuery::filter($queries, $payload); + $this->assertEquals([], $result); + } + + public function testEmptyPayload(): void + { + $query = Query::equal('name', ['John']); + $payload = []; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals([], $result); + } + + public function testEmptyAndQuery(): void + { + $query = Query::and([]); + $payload = ['name' => 'John']; + $result = RuntimeQuery::filter([$query], $payload); + // Empty AND should return true (all conditions pass vacuously) + $this->assertEquals($payload, $result); + } + + public function testEmptyOrQuery(): void + { + $query = Query::or([]); + $payload = ['name' => 'John']; + $result = RuntimeQuery::filter([$query], $payload); + // Empty OR should return false (no conditions match) + $this->assertEquals([], $result); + } + + // Type-specific edge cases + public function testEqualWithZero(): void + { + $query = Query::equal('count', [0]); + $payload = ['count' => 0]; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals($payload, $result); + } + + public function testEqualWithEmptyString(): void + { + $query = Query::equal('name', ['']); + $payload = ['name' => '']; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals($payload, $result); + } + + public function testEqualWithFalse(): void + { + $query = Query::equal('active', [false]); + $payload = ['active' => false]; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals($payload, $result); + } + + public function testComparisonWithFloat(): void + { + $query = Query::greaterThan('score', 8.5); + $payload = ['score' => 9.2]; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals($payload, $result); + } + + public function testComparisonWithStringNumbers(): void + { + $query = Query::lessThan('version', '10'); + $payload = ['version' => '9']; + $result = RuntimeQuery::filter([$query], $payload); + $this->assertEquals($payload, $result); + } +}