diff --git a/.travis.yml b/.travis.yml index 451a7056c8..b9258d18d9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,11 @@ os: linux language: php php: - - 8.0 + - 8.1 + +stages: + - lint + - test env: - SDK=Android11Java8 @@ -27,7 +31,7 @@ env: - SDK=FlutterStable - SDK=Go112 - SDK=Go118 - - SDK=FlutterBeta +# - SDK=FlutterBeta - SDK=KotlinJava8 - SDK=KotlinJava11 - SDK=KotlinJava17 @@ -42,8 +46,8 @@ env: - SDK=Ruby27 - SDK=Ruby30 - SDK=Ruby31 - - SDK=SwiftClient55 - - SDK=SwiftServer55 + - SDK=AppleSwift55 + - SDK=Swift55 - SDK=WebChromium - SDK=WebNode @@ -51,16 +55,22 @@ notifications: email: - team@appwrite.io +jobs: + include: + - stage: lint + name: Lint + install: + - composer install + script: + - composer lint + before_install: - > if [ ! -z "${DOCKERHUB_PULL_USERNAME:-}" ]; then echo "${DOCKERHUB_PULL_PASSWORD}" | docker login --username "${DOCKERHUB_PULL_USERNAME}" --password-stdin fi - - install: - docker --version - composer install - script: - - vendor/bin/phpunit tests/${SDK}Test.php \ No newline at end of file + - composer test tests/${SDK}Test.php \ No newline at end of file diff --git a/composer.json b/composer.json index cca3500474..1378543461 100644 --- a/composer.json +++ b/composer.json @@ -9,6 +9,11 @@ "email": "eldad@appwrite.io" } ], + "scripts": { + "test": "vendor/bin/phpunit", + "lint": "vendor/bin/phpcs", + "format": "vendor/bin/phpcbf" + }, "autoload": { "psr-4": { "Appwrite\\SDK\\": "src/SDK", @@ -19,16 +24,17 @@ "psr-4": {"Tests\\": "tests"} }, "require": { - "php": ">=7.0.0", + "php": ">=8.0", "ext-curl": "*", "ext-mbstring": "*", "ext-json": "*", - "twig/twig": "^3.3", - "matthiasmullie/minify": "^1.3" + "twig/twig": "^3.4.1", + "matthiasmullie/minify": "^1.3.68" }, "require-dev": { - "phpunit/phpunit": "^9.5.13", - "brianium/paratest": "^6.4" + "phpunit/phpunit": "^9.5.21", + "brianium/paratest": "^6.4", + "squizlabs/php_codesniffer": "^3.6" }, "minimum-stability": "dev", "prefer-stable": true diff --git a/composer.lock b/composer.lock index ac22884f93..8d202ab0ea 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "007d124489decbc914d4a6a4d34e2a79", + "content-hash": "533996af87f893e7dfaa0508e3ee720d", "packages": [ { "name": "matthiasmullie/minify", - "version": "1.3.68", + "version": "1.3.69", "source": { "type": "git", "url": "https://github.com/matthiasmullie/minify.git", - "reference": "c00fb02f71b2ef0a5f53fe18c5a8b9aa30f48297" + "reference": "a61c949cccd086808063611ef9698eabe42ef22f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/matthiasmullie/minify/zipball/c00fb02f71b2ef0a5f53fe18c5a8b9aa30f48297", - "reference": "c00fb02f71b2ef0a5f53fe18c5a8b9aa30f48297", + "url": "https://api.github.com/repos/matthiasmullie/minify/zipball/a61c949cccd086808063611ef9698eabe42ef22f", + "reference": "a61c949cccd086808063611ef9698eabe42ef22f", "shasum": "" }, "require": { @@ -66,7 +66,7 @@ ], "support": { "issues": "https://github.com/matthiasmullie/minify/issues", - "source": "https://github.com/matthiasmullie/minify/tree/1.3.68" + "source": "https://github.com/matthiasmullie/minify/tree/1.3.69" }, "funding": [ { @@ -74,7 +74,7 @@ "type": "github" } ], - "time": "2022-04-19T08:28:56+00:00" + "time": "2022-08-01T09:00:18+00:00" }, { "name": "matthiasmullie/path-converter", @@ -131,16 +131,16 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.25.0", + "version": "v1.26.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "30885182c981ab175d4d034db0f6f469898070ab" + "reference": "6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/30885182c981ab175d4d034db0f6f469898070ab", - "reference": "30885182c981ab175d4d034db0f6f469898070ab", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4", + "reference": "6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4", "shasum": "" }, "require": { @@ -155,7 +155,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.26-dev" }, "thanks": { "name": "symfony/polyfill", @@ -193,7 +193,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.25.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.26.0" }, "funding": [ { @@ -209,20 +209,20 @@ "type": "tidelift" } ], - "time": "2021-10-20T20:35:02+00:00" + "time": "2022-05-24T11:49:31+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.25.0", + "version": "v1.26.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825" + "reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/0abb51d2f102e00a4eefcf46ba7fec406d245825", - "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e", + "reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e", "shasum": "" }, "require": { @@ -237,7 +237,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.26-dev" }, "thanks": { "name": "symfony/polyfill", @@ -276,7 +276,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.25.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.26.0" }, "funding": [ { @@ -292,20 +292,20 @@ "type": "tidelift" } ], - "time": "2021-11-30T18:21:41+00:00" + "time": "2022-05-24T11:49:31+00:00" }, { "name": "twig/twig", - "version": "v3.3.10", + "version": "v3.4.2", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "8442df056c51b706793adf80a9fd363406dd3674" + "reference": "e07cdd3d430cd7e453c31b36eb5ad6c0c5e43077" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/8442df056c51b706793adf80a9fd363406dd3674", - "reference": "8442df056c51b706793adf80a9fd363406dd3674", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/e07cdd3d430cd7e453c31b36eb5ad6c0c5e43077", + "reference": "e07cdd3d430cd7e453c31b36eb5ad6c0c5e43077", "shasum": "" }, "require": { @@ -320,7 +320,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -356,7 +356,7 @@ ], "support": { "issues": "https://github.com/twigphp/Twig/issues", - "source": "https://github.com/twigphp/Twig/tree/v3.3.10" + "source": "https://github.com/twigphp/Twig/tree/v3.4.2" }, "funding": [ { @@ -368,22 +368,22 @@ "type": "tidelift" } ], - "time": "2022-04-06T06:47:41+00:00" + "time": "2022-08-12T06:47:24+00:00" } ], "packages-dev": [ { "name": "brianium/paratest", - "version": "v6.4.4", + "version": "v6.6.4", "source": { "type": "git", "url": "https://github.com/paratestphp/paratest.git", - "reference": "589cdb23728b2a19872945580b95d8aa2c6619da" + "reference": "4ce800dc32fd0292a4f05c00f347142dce1ecdda" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paratestphp/paratest/zipball/589cdb23728b2a19872945580b95d8aa2c6619da", - "reference": "589cdb23728b2a19872945580b95d8aa2c6619da", + "url": "https://api.github.com/repos/paratestphp/paratest/zipball/4ce800dc32fd0292a4f05c00f347142dce1ecdda", + "reference": "4ce800dc32fd0292a4f05c00f347142dce1ecdda", "shasum": "" }, "require": { @@ -391,26 +391,30 @@ "ext-pcre": "*", "ext-reflection": "*", "ext-simplexml": "*", + "jean85/pretty-package-versions": "^2.0.5", "php": "^7.3 || ^8.0", - "phpunit/php-code-coverage": "^9.2.11", + "phpunit/php-code-coverage": "^9.2.17", "phpunit/php-file-iterator": "^3.0.6", "phpunit/php-timer": "^5.0.3", - "phpunit/phpunit": "^9.5.14", - "sebastian/environment": "^5.1.3", - "symfony/console": "^5.4.0 || ^6.0.0", - "symfony/process": "^5.4.0 || ^6.0.0" + "phpunit/phpunit": "^9.5.24", + "sebastian/environment": "^5.1.4", + "symfony/console": "^5.4.12 || ^6.1.4", + "symfony/process": "^5.4.11 || ^6.1.3" }, "require-dev": { - "doctrine/coding-standard": "^9.0.0", + "doctrine/coding-standard": "^10.0.0", + "ext-pcov": "*", "ext-posix": "*", - "infection/infection": "^0.26.5", + "infection/infection": "^0.26.14", "malukenho/mcbumpface": "^1.1.5", - "squizlabs/php_codesniffer": "^3.6.2", - "symfony/filesystem": "^v5.4.0 || ^6.0.0", - "vimeo/psalm": "^4.20.0" + "squizlabs/php_codesniffer": "^3.7.1", + "symfony/filesystem": "^5.4.12 || ^6.1.4", + "vimeo/psalm": "^4.27.0" }, "bin": [ - "bin/paratest" + "bin/paratest", + "bin/paratest.bat", + "bin/paratest_for_phpstorm" ], "type": "library", "autoload": { @@ -446,7 +450,7 @@ ], "support": { "issues": "https://github.com/paratestphp/paratest/issues", - "source": "https://github.com/paratestphp/paratest/tree/v6.4.4" + "source": "https://github.com/paratestphp/paratest/tree/v6.6.4" }, "funding": [ { @@ -458,7 +462,7 @@ "type": "paypal" } ], - "time": "2022-03-28T07:55:11+00:00" + "time": "2022-09-13T10:47:01+00:00" }, { "name": "doctrine/instantiator", @@ -530,6 +534,65 @@ ], "time": "2022-03-03T08:28:38+00:00" }, + { + "name": "jean85/pretty-package-versions", + "version": "2.0.5", + "source": { + "type": "git", + "url": "https://github.com/Jean85/pretty-package-versions.git", + "reference": "ae547e455a3d8babd07b96966b17d7fd21d9c6af" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Jean85/pretty-package-versions/zipball/ae547e455a3d8babd07b96966b17d7fd21d9c6af", + "reference": "ae547e455a3d8babd07b96966b17d7fd21d9c6af", + "shasum": "" + }, + "require": { + "composer-runtime-api": "^2.0.0", + "php": "^7.1|^8.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.17", + "jean85/composer-provided-replaced-stub-package": "^1.0", + "phpstan/phpstan": "^0.12.66", + "phpunit/phpunit": "^7.5|^8.5|^9.4", + "vimeo/psalm": "^4.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Jean85\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Alessandro Lai", + "email": "alessandro.lai85@gmail.com" + } + ], + "description": "A library to get pretty versions strings of installed dependencies", + "keywords": [ + "composer", + "package", + "release", + "versions" + ], + "support": { + "issues": "https://github.com/Jean85/pretty-package-versions/issues", + "source": "https://github.com/Jean85/pretty-package-versions/tree/2.0.5" + }, + "time": "2021-10-08T21:21:46+00:00" + }, { "name": "myclabs/deep-copy", "version": "1.11.0", @@ -591,16 +654,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.13.2", + "version": "v4.15.1", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "210577fe3cf7badcc5814d99455df46564f3c077" + "reference": "0ef6c55a3f47f89d7a374e6f835197a0b5fcf900" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/210577fe3cf7badcc5814d99455df46564f3c077", - "reference": "210577fe3cf7badcc5814d99455df46564f3c077", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/0ef6c55a3f47f89d7a374e6f835197a0b5fcf900", + "reference": "0ef6c55a3f47f89d7a374e6f835197a0b5fcf900", "shasum": "" }, "require": { @@ -641,9 +704,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.13.2" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.1" }, - "time": "2021-11-30T19:35:32+00:00" + "time": "2022-09-04T07:30:47+00:00" }, { "name": "phar-io/manifest", @@ -756,252 +819,25 @@ }, "time": "2022-02-21T01:04:05+00:00" }, - { - "name": "phpdocumentor/reflection-common", - "version": "2.2.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-2.x": "2.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" - } - ], - "description": "Common reflection classes used by phpdocumentor to reflect the code structure", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "FQSEN", - "phpDocumentor", - "phpdoc", - "reflection", - "static analysis" - ], - "support": { - "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", - "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x" - }, - "time": "2020-06-27T09:03:43+00:00" - }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "5.3.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "622548b623e81ca6d78b721c5e029f4ce664f170" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170", - "reference": "622548b623e81ca6d78b721c5e029f4ce664f170", - "shasum": "" - }, - "require": { - "ext-filter": "*", - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.2", - "phpdocumentor/type-resolver": "^1.3", - "webmozart/assert": "^1.9.1" - }, - "require-dev": { - "mockery/mockery": "~1.3.2", - "psalm/phar": "^4.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - }, - { - "name": "Jaap van Otterdijk", - "email": "account@ijaap.nl" - } - ], - "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "support": { - "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0" - }, - "time": "2021-10-19T17:43:47+00:00" - }, - { - "name": "phpdocumentor/type-resolver", - "version": "1.6.1", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "77a32518733312af16a44300404e945338981de3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/77a32518733312af16a44300404e945338981de3", - "reference": "77a32518733312af16a44300404e945338981de3", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.0" - }, - "require-dev": { - "ext-tokenizer": "*", - "psalm/phar": "^4.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-1.x": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", - "support": { - "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.1" - }, - "time": "2022-03-15T21:29:03+00:00" - }, - { - "name": "phpspec/prophecy", - "version": "v1.15.0", - "source": { - "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/bbcd7380b0ebf3961ee21409db7b38bc31d69a13", - "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.2", - "php": "^7.2 || ~8.0, <8.2", - "phpdocumentor/reflection-docblock": "^5.2", - "sebastian/comparator": "^3.0 || ^4.0", - "sebastian/recursion-context": "^3.0 || ^4.0" - }, - "require-dev": { - "phpspec/phpspec": "^6.0 || ^7.0", - "phpunit/phpunit": "^8.0 || ^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Prophecy\\": "src/Prophecy" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - }, - { - "name": "Marcello Duarte", - "email": "marcello.duarte@gmail.com" - } - ], - "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "https://github.com/phpspec/prophecy", - "keywords": [ - "Double", - "Dummy", - "fake", - "mock", - "spy", - "stub" - ], - "support": { - "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/v1.15.0" - }, - "time": "2021-12-08T12:19:24+00:00" - }, { "name": "phpunit/php-code-coverage", - "version": "9.2.15", + "version": "9.2.17", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "2e9da11878c4202f97915c1cb4bb1ca318a63f5f" + "reference": "aa94dc41e8661fe90c7316849907cba3007b10d8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2e9da11878c4202f97915c1cb4bb1ca318a63f5f", - "reference": "2e9da11878c4202f97915c1cb4bb1ca318a63f5f", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/aa94dc41e8661fe90c7316849907cba3007b10d8", + "reference": "aa94dc41e8661fe90c7316849907cba3007b10d8", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.13.0", + "nikic/php-parser": "^4.14", "php": ">=7.3", "phpunit/php-file-iterator": "^3.0.3", "phpunit/php-text-template": "^2.0.2", @@ -1050,7 +886,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.15" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.17" }, "funding": [ { @@ -1058,7 +894,7 @@ "type": "github" } ], - "time": "2022-03-07T09:28:20+00:00" + "time": "2022-08-30T12:24:04+00:00" }, { "name": "phpunit/php-file-iterator", @@ -1303,16 +1139,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.20", + "version": "9.5.25", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "12bc8879fb65aef2138b26fc633cb1e3620cffba" + "reference": "3e6f90ca7e3d02025b1d147bd8d4a89fd4ca8a1d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/12bc8879fb65aef2138b26fc633cb1e3620cffba", - "reference": "12bc8879fb65aef2138b26fc633cb1e3620cffba", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3e6f90ca7e3d02025b1d147bd8d4a89fd4ca8a1d", + "reference": "3e6f90ca7e3d02025b1d147bd8d4a89fd4ca8a1d", "shasum": "" }, "require": { @@ -1327,7 +1163,6 @@ "phar-io/manifest": "^2.0.3", "phar-io/version": "^3.0.2", "php": ">=7.3", - "phpspec/prophecy": "^1.12.1", "phpunit/php-code-coverage": "^9.2.13", "phpunit/php-file-iterator": "^3.0.5", "phpunit/php-invoker": "^3.1.1", @@ -1335,20 +1170,16 @@ "phpunit/php-timer": "^5.0.2", "sebastian/cli-parser": "^1.0.1", "sebastian/code-unit": "^1.0.6", - "sebastian/comparator": "^4.0.5", + "sebastian/comparator": "^4.0.8", "sebastian/diff": "^4.0.3", "sebastian/environment": "^5.1.3", - "sebastian/exporter": "^4.0.3", + "sebastian/exporter": "^4.0.5", "sebastian/global-state": "^5.0.1", "sebastian/object-enumerator": "^4.0.3", "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^3.0", + "sebastian/type": "^3.2", "sebastian/version": "^3.0.2" }, - "require-dev": { - "ext-pdo": "*", - "phpspec/prophecy-phpunit": "^2.0.1" - }, "suggest": { "ext-soap": "*", "ext-xdebug": "*" @@ -1390,7 +1221,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.20" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.25" }, "funding": [ { @@ -1400,9 +1231,13 @@ { "url": "https://github.com/sebastianbergmann", "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", + "type": "tidelift" } ], - "time": "2022-04-01T12:37:26+00:00" + "time": "2022-09-25T03:44:45+00:00" }, { "name": "psr/container", @@ -1626,16 +1461,16 @@ }, { "name": "sebastian/comparator", - "version": "4.0.6", + "version": "4.0.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "55f4261989e546dc112258c7a75935a81a7ce382" + "reference": "fa0f136dd2334583309d32b62544682ee972b51a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/55f4261989e546dc112258c7a75935a81a7ce382", - "reference": "55f4261989e546dc112258c7a75935a81a7ce382", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", + "reference": "fa0f136dd2334583309d32b62544682ee972b51a", "shasum": "" }, "require": { @@ -1688,7 +1523,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.6" + "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8" }, "funding": [ { @@ -1696,7 +1531,7 @@ "type": "github" } ], - "time": "2020-10-26T15:49:45+00:00" + "time": "2022-09-14T12:41:17+00:00" }, { "name": "sebastian/complexity", @@ -1886,16 +1721,16 @@ }, { "name": "sebastian/exporter", - "version": "4.0.4", + "version": "4.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9" + "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/65e8b7db476c5dd267e65eea9cab77584d3cfff9", - "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", + "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", "shasum": "" }, "require": { @@ -1951,7 +1786,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.4" + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.5" }, "funding": [ { @@ -1959,7 +1794,7 @@ "type": "github" } ], - "time": "2021-11-11T14:18:36+00:00" + "time": "2022-09-14T06:03:37+00:00" }, { "name": "sebastian/global-state", @@ -2314,16 +2149,16 @@ }, { "name": "sebastian/type", - "version": "3.0.0", + "version": "3.2.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad" + "reference": "fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b233b84bc4465aff7b57cf1c4bc75c86d00d6dad", - "reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e", + "reference": "fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e", "shasum": "" }, "require": { @@ -2335,7 +2170,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -2358,7 +2193,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/3.0.0" + "source": "https://github.com/sebastianbergmann/type/tree/3.2.0" }, "funding": [ { @@ -2366,7 +2201,7 @@ "type": "github" } ], - "time": "2022-03-15T09:54:48+00:00" + "time": "2022-09-12T14:47:03+00:00" }, { "name": "sebastian/version", @@ -2421,22 +2256,79 @@ ], "time": "2020-09-28T06:39:44+00:00" }, + { + "name": "squizlabs/php_codesniffer", + "version": "3.7.1", + "source": { + "type": "git", + "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/1359e176e9307e906dc3d890bcc9603ff6d90619", + "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + }, + "bin": [ + "bin/phpcs", + "bin/phpcbf" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "lead" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", + "keywords": [ + "phpcs", + "standards" + ], + "support": { + "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", + "source": "https://github.com/squizlabs/PHP_CodeSniffer", + "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" + }, + "time": "2022-06-18T07:21:10+00:00" + }, { "name": "symfony/console", - "version": "v6.0.8", + "version": "v6.1.4", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "0d00aa289215353aa8746a31d101f8e60826285c" + "reference": "7fccea8728aa2d431a6725b02b3ce759049fc84d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/0d00aa289215353aa8746a31d101f8e60826285c", - "reference": "0d00aa289215353aa8746a31d101f8e60826285c", + "url": "https://api.github.com/repos/symfony/console/zipball/7fccea8728aa2d431a6725b02b3ce759049fc84d", + "reference": "7fccea8728aa2d431a6725b02b3ce759049fc84d", "shasum": "" }, "require": { - "php": ">=8.0.2", + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.1|^3", "symfony/polyfill-mbstring": "~1.0", "symfony/service-contracts": "^1.1|^2|^3", "symfony/string": "^5.4|^6.0" @@ -2498,7 +2390,74 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.0.8" + "source": "https://github.com/symfony/console/tree/v6.1.4" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-08-26T10:32:31+00:00" + }, + { + "name": "symfony/deprecation-contracts", + "version": "v3.1.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "07f1b9cc2ffee6aaafcf4b710fbc38ff736bd918" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/07f1b9cc2ffee6aaafcf4b710fbc38ff736bd918", + "reference": "07f1b9cc2ffee6aaafcf4b710fbc38ff736bd918", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.1-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "files": [ + "function.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "A generic function and convention to trigger deprecation notices", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.1.1" }, "funding": [ { @@ -2514,20 +2473,20 @@ "type": "tidelift" } ], - "time": "2022-04-20T15:01:42+00:00" + "time": "2022-02-25T11:15:52+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.25.0", + "version": "v1.26.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "81b86b50cf841a64252b439e738e97f4a34e2783" + "reference": "433d05519ce6990bf3530fba6957499d327395c2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/81b86b50cf841a64252b439e738e97f4a34e2783", - "reference": "81b86b50cf841a64252b439e738e97f4a34e2783", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/433d05519ce6990bf3530fba6957499d327395c2", + "reference": "433d05519ce6990bf3530fba6957499d327395c2", "shasum": "" }, "require": { @@ -2539,7 +2498,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.26-dev" }, "thanks": { "name": "symfony/polyfill", @@ -2579,7 +2538,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.25.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.26.0" }, "funding": [ { @@ -2595,20 +2554,20 @@ "type": "tidelift" } ], - "time": "2021-11-23T21:10:46+00:00" + "time": "2022-05-24T11:49:31+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.25.0", + "version": "v1.26.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8" + "reference": "219aa369ceff116e673852dce47c3a41794c14bd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8590a5f561694770bdcd3f9b5c69dde6945028e8", - "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/219aa369ceff116e673852dce47c3a41794c14bd", + "reference": "219aa369ceff116e673852dce47c3a41794c14bd", "shasum": "" }, "require": { @@ -2620,7 +2579,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.26-dev" }, "thanks": { "name": "symfony/polyfill", @@ -2663,7 +2622,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.25.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.26.0" }, "funding": [ { @@ -2679,24 +2638,24 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2022-05-24T11:49:31+00:00" }, { "name": "symfony/process", - "version": "v6.0.8", + "version": "v6.1.3", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "d074154ea8b1443a96391f6e39f9e547b2dd01b9" + "reference": "a6506e99cfad7059b1ab5cab395854a0a0c21292" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/d074154ea8b1443a96391f6e39f9e547b2dd01b9", - "reference": "d074154ea8b1443a96391f6e39f9e547b2dd01b9", + "url": "https://api.github.com/repos/symfony/process/zipball/a6506e99cfad7059b1ab5cab395854a0a0c21292", + "reference": "a6506e99cfad7059b1ab5cab395854a0a0c21292", "shasum": "" }, "require": { - "php": ">=8.0.2" + "php": ">=8.1" }, "type": "library", "autoload": { @@ -2724,7 +2683,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v6.0.8" + "source": "https://github.com/symfony/process/tree/v6.1.3" }, "funding": [ { @@ -2740,24 +2699,24 @@ "type": "tidelift" } ], - "time": "2022-04-12T16:11:42+00:00" + "time": "2022-06-27T17:24:16+00:00" }, { "name": "symfony/service-contracts", - "version": "v3.0.1", + "version": "v3.1.1", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "e517458f278c2131ca9f262f8fbaf01410f2c65c" + "reference": "925e713fe8fcacf6bc05e936edd8dd5441a21239" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/e517458f278c2131ca9f262f8fbaf01410f2c65c", - "reference": "e517458f278c2131ca9f262f8fbaf01410f2c65c", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/925e713fe8fcacf6bc05e936edd8dd5441a21239", + "reference": "925e713fe8fcacf6bc05e936edd8dd5441a21239", "shasum": "" }, "require": { - "php": ">=8.0.2", + "php": ">=8.1", "psr/container": "^2.0" }, "conflict": { @@ -2769,7 +2728,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "3.0-dev" + "dev-main": "3.1-dev" }, "thanks": { "name": "symfony/contracts", @@ -2779,7 +2738,10 @@ "autoload": { "psr-4": { "Symfony\\Contracts\\Service\\": "" - } + }, + "exclude-from-classmap": [ + "/Test/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2806,7 +2768,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v3.0.1" + "source": "https://github.com/symfony/service-contracts/tree/v3.1.1" }, "funding": [ { @@ -2822,24 +2784,24 @@ "type": "tidelift" } ], - "time": "2022-03-13T20:10:05+00:00" + "time": "2022-05-30T19:18:58+00:00" }, { "name": "symfony/string", - "version": "v6.0.8", + "version": "v6.1.4", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "ac0aa5c2282e0de624c175b68d13f2c8f2e2649d" + "reference": "290972cad7b364e3befaa74ba0ec729800fb161c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/ac0aa5c2282e0de624c175b68d13f2c8f2e2649d", - "reference": "ac0aa5c2282e0de624c175b68d13f2c8f2e2649d", + "url": "https://api.github.com/repos/symfony/string/zipball/290972cad7b364e3befaa74ba0ec729800fb161c", + "reference": "290972cad7b364e3befaa74ba0ec729800fb161c", "shasum": "" }, "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-intl-grapheme": "~1.0", "symfony/polyfill-intl-normalizer": "~1.0", @@ -2891,7 +2853,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.0.8" + "source": "https://github.com/symfony/string/tree/v6.1.4" }, "funding": [ { @@ -2907,7 +2869,7 @@ "type": "tidelift" } ], - "time": "2022-04-22T08:18:02+00:00" + "time": "2022-08-12T18:05:43+00:00" }, { "name": "theseer/tokenizer", @@ -2958,64 +2920,6 @@ } ], "time": "2021-07-28T10:34:58+00:00" - }, - { - "name": "webmozart/assert", - "version": "1.10.0", - "source": { - "type": "git", - "url": "https://github.com/webmozarts/assert.git", - "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozarts/assert/zipball/6964c76c7804814a842473e0c8fd15bab0f18e25", - "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0", - "symfony/polyfill-ctype": "^1.8" - }, - "conflict": { - "phpstan/phpstan": "<0.12.20", - "vimeo/psalm": "<4.6.1 || 4.6.2" - }, - "require-dev": { - "phpunit/phpunit": "^8.5.13" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.10-dev" - } - }, - "autoload": { - "psr-4": { - "Webmozart\\Assert\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Assertions to validate method input/output with nice error messages.", - "keywords": [ - "assert", - "check", - "validate" - ], - "support": { - "issues": "https://github.com/webmozarts/assert/issues", - "source": "https://github.com/webmozarts/assert/tree/1.10.0" - }, - "time": "2021-03-09T10:59:23+00:00" } ], "aliases": [], @@ -3024,7 +2928,7 @@ "prefer-stable": true, "prefer-lowest": false, "platform": { - "php": ">=7.0.0", + "php": ">=8.0", "ext-curl": "*", "ext-mbstring": "*", "ext-json": "*" diff --git a/example.php b/example.php index 89d5a61b48..c3948d6bc2 100644 --- a/example.php +++ b/example.php @@ -2,6 +2,7 @@ include_once 'vendor/autoload.php'; +use Appwrite\SDK\Language\GraphQL; use Appwrite\Spec\Swagger2; use Appwrite\SDK\SDK; use Appwrite\SDK\Language\Web; @@ -13,9 +14,9 @@ use Appwrite\SDK\Language\Dart; use Appwrite\SDK\Language\Go; use Appwrite\SDK\Language\Deno; -use Appwrite\SDK\Language\HTTP; +use Appwrite\SDK\Language\REST; use Appwrite\SDK\Language\Swift; -use Appwrite\SDK\Language\SwiftClient; +use Appwrite\SDK\Language\Apple; use Appwrite\SDK\Language\DotNet; use Appwrite\SDK\Language\Flutter; use Appwrite\SDK\Language\Android; @@ -35,11 +36,12 @@ function getSSLPage($url) { return $result; } - //$spec = getSSLPage('https://appwrite.io/v1/open-api-2.json?extensions=1'); - // $spec = getSSLPage('https://appwrite.io/v1/open-api-2.json?extensions=1'); // Enable only with Appwrite local server running on port 80 - // $spec = getSSLPage('https://appwrite.io/v1/open-api-2.json?extensions=1&platform=console'); // Enable only with Appwrite local server running on port 80 - // $spec = file_get_contents('https://appwrite.io/specs/swagger2?platform=client'); - $spec = file_get_contents('./specs/swagger2-latest-console.json'); + // Leave the platform you want uncommented + $platform = 'client'; + // $platform = 'console'; + // $platform = 'server'; + + $spec = getSSLPage("https://raw.githubusercontent.com/appwrite/appwrite/master/app/config/specs/swagger2-latest-${platform}.json"); if(empty($spec)) { throw new Exception('Failed to fetch spec from Appwrite server'); @@ -183,7 +185,7 @@ function getSSLPage($url) { ->setTwitter('appwrite_io') ->setDiscord('564160730845151244', 'https://appwrite.io/discord') ->setDefaultHeaders([ - 'X-Appwrite-Response-Format' => '0.13.0', + 'X-Appwrite-Response-Format' => '0.15.0', ]) ; @@ -341,7 +343,7 @@ function getSSLPage($url) { $sdk->generate(__DIR__ . '/examples/swift-server'); // Swift (Client) - $sdk = new SDK(new SwiftClient(), new Swagger2($spec)); + $sdk = new SDK(new Apple(), new Swagger2($spec)); $sdk ->setName('NAME') @@ -362,7 +364,7 @@ function getSSLPage($url) { ]) ; - $sdk->generate(__DIR__ . '/examples/swift-client'); + $sdk->generate(__DIR__ . '/examples/apple'); // DotNet $sdk = new SDK(new DotNet(), new Swagger2($spec)); @@ -388,8 +390,8 @@ function getSSLPage($url) { $sdk->generate(__DIR__ . '/examples/dotnet'); - // HTTP - $sdk = new SDK(new HTTP(), new Swagger2($spec)); + // REST + $sdk = new SDK(new REST(), new Swagger2($spec)); $sdk ->setName('NAME') @@ -407,7 +409,7 @@ function getSSLPage($url) { ->setDiscord('564160730845151244', 'https://appwrite.io/discord') ; - $sdk->generate(__DIR__ . '/examples/HTTP'); + $sdk->generate(__DIR__ . '/examples/REST'); // Android @@ -457,6 +459,16 @@ function getSSLPage($url) { ]) ; $sdk->generate(__DIR__ . '/examples/kotlin'); + + // GraphQL + $sdk = new SDK(new GraphQL(), new Swagger2($spec)); + + $sdk + ->setName('GraphQL') + ->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 Flutter 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') + ->setLogo('https://appwrite.io/v1/images/console.png') + ; + $sdk->generate(__DIR__ . '/examples/graphql'); } catch (Exception $exception) { echo 'Error: ' . $exception->getMessage() . ' on ' . $exception->getFile() . ':' . $exception->getLine() . "\n"; diff --git a/phpcs.xml b/phpcs.xml new file mode 100644 index 0000000000..209fb3674f --- /dev/null +++ b/phpcs.xml @@ -0,0 +1,22 @@ + + + + + ./src + ./tests + + + + ./tests/sdks + ./tests/languages + ./tests/resources + + + + * + + + + * + + \ No newline at end of file diff --git a/specs/swagger-appwrite-0.12.0.json b/specs/swagger-appwrite-0.12.0.json deleted file mode 100644 index face1d8d4b..0000000000 --- a/specs/swagger-appwrite-0.12.0.json +++ /dev/null @@ -1 +0,0 @@ -{"swagger":"2.0","info":{"version":"0.11.0","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","contact":{"name":"Appwrite Team","url":"https:\/\/appwrite.io\/support","email":"team@appwrite.io"},"license":{"name":"BSD-3-Clause","url":"https:\/\/raw.githubusercontent.com\/appwrite\/appwrite\/master\/LICENSE"}},"host":"appwrite.io","basePath":"\/v1","schemes":["https"],"consumes":["application\/json","multipart\/form-data"],"produces":["application\/json"],"securityDefinitions":{"Project":{"type":"apiKey","name":"X-Appwrite-Project","description":"Your project ID","in":"header","x-appwrite":{"demo":"5df5acd0d48c2"}},"Key":{"type":"apiKey","name":"X-Appwrite-Key","description":"Your secret API key","in":"header","x-appwrite":{"demo":"919c2d18fb5d4...a2ae413da83346ad2"}},"JWT":{"type":"apiKey","name":"X-Appwrite-JWT","description":"Your secret JSON Web Token","in":"header","x-appwrite":{"demo":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ..."}},"Locale":{"type":"apiKey","name":"X-Appwrite-Locale","description":"","in":"header","x-appwrite":{"demo":"en"}}},"paths":{"\/account":{"get":{"summary":"Get Account","operationId":"accountGet","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Get currently logged in user data as JSON object.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"get","weight":47,"cookies":false,"type":"","demo":"account\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/get.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[],"JWT":[]}},"security":[{"Project":[],"JWT":[]}]},"delete":{"summary":"Delete Account","operationId":"accountDelete","consumes":["application\/json"],"produces":[],"tags":["account"],"description":"Delete a currently logged in user account. Behind the scene, the user record is not deleted but permanently blocked from any access. This is done to avoid deleted accounts being overtaken by new users with the same email address. Any user-related resources like documents or storage files should be deleted separately.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"delete","weight":56,"cookies":false,"type":"","demo":"account\/delete.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/delete.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[],"JWT":[]}},"security":[{"Project":[],"JWT":[]}]}},"\/account\/email":{"patch":{"summary":"Update Account Email","operationId":"accountUpdateEmail","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Update currently logged in user account email address. After changing user address, user confirmation status is being reset and a new confirmation mail is sent. For security measures, user password is required to complete this request.\nThis endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updateEmail","weight":54,"cookies":false,"type":"","demo":"account\/update-email.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-email.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[],"JWT":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"email":{"type":"string","description":"User email.","default":null,"x-example":"email@example.com"},"password":{"type":"string","description":"User password. Must be between 6 to 32 chars.","default":null,"x-example":"password"}},"required":["email","password"]}}]}},"\/account\/logs":{"get":{"summary":"Get Account Logs","operationId":"accountGetLogs","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Get currently logged in user list of latest security activity logs. Each log returns user IP address, location and date and time of log.","responses":{"200":{"description":"Logs List","schema":{"$ref":"#\/definitions\/logList"}}},"x-appwrite":{"method":"getLogs","weight":50,"cookies":false,"type":"","demo":"account\/get-logs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/get-logs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[],"JWT":[]}},"security":[{"Project":[],"JWT":[]}]}},"\/account\/name":{"patch":{"summary":"Update Account Name","operationId":"accountUpdateName","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Update currently logged in user account name.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updateName","weight":52,"cookies":false,"type":"","demo":"account\/update-name.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-name.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[],"JWT":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"User name. Max length: 128 chars.","default":null,"x-example":"[NAME]"}},"required":["name"]}}]}},"\/account\/password":{"patch":{"summary":"Update Account Password","operationId":"accountUpdatePassword","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Update currently logged in user password. For validation, user is required to pass in the new password, and the old password. For users created with OAuth and Team Invites, oldPassword is optional.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updatePassword","weight":53,"cookies":false,"type":"","demo":"account\/update-password.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-password.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[],"JWT":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"password":{"type":"string","description":"New user password. Must be between 6 to 32 chars.","default":null,"x-example":"password"},"oldPassword":{"type":"string","description":"Old user password. Must be between 6 to 32 chars.","default":"","x-example":"password"}},"required":["password"]}}]}},"\/account\/prefs":{"get":{"summary":"Get Account Preferences","operationId":"accountGetPrefs","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Get currently logged in user preferences as a key-value object.","responses":{"200":{"description":"Preferences","schema":{"$ref":"#\/definitions\/preferences"}}},"x-appwrite":{"method":"getPrefs","weight":48,"cookies":false,"type":"","demo":"account\/get-prefs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/get-prefs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[],"JWT":[]}},"security":[{"Project":[],"JWT":[]}]},"patch":{"summary":"Update Account Preferences","operationId":"accountUpdatePrefs","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Update currently logged in user account preferences. You can pass only the specific settings you wish to update.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updatePrefs","weight":55,"cookies":false,"type":"","demo":"account\/update-prefs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-prefs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[],"JWT":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"prefs":{"type":"object","description":"Prefs key-value JSON object.","default":null,"x-example":"{}"}},"required":["prefs"]}}]}},"\/account\/recovery":{"post":{"summary":"Create Password Recovery","operationId":"accountCreateRecovery","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Sends the user an email with a temporary secret key for password reset. When the user clicks the confirmation link he is redirected back to your app password reset URL with the secret key and email address values attached to the URL query string. Use the query string params to submit a request to the [PUT \/account\/recovery](\/docs\/client\/account#accountUpdateRecovery) endpoint to complete the process. The verification link sent to the user's email address is valid for 1 hour.","responses":{"201":{"description":"Token","schema":{"$ref":"#\/definitions\/token"}}},"x-appwrite":{"method":"createRecovery","weight":59,"cookies":false,"type":"","demo":"account\/create-recovery.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create-recovery.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},email:{param-email}","scope":"public","platforms":["client","server"],"packaging":false,"auth":{"Project":[],"JWT":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"email":{"type":"string","description":"User email.","default":null,"x-example":"email@example.com"},"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"}},"required":["email","url"]}}]},"put":{"summary":"Create Password Recovery (confirmation)","operationId":"accountUpdateRecovery","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to complete the user account password reset. Both the **userId** and **secret** arguments will be passed as query parameters to the redirect URL you have provided when sending your request to the [POST \/account\/recovery](\/docs\/client\/account#accountCreateRecovery) endpoint.\n\nPlease note that in order to avoid a [Redirect Attack](https:\/\/github.com\/OWASP\/CheatSheetSeries\/blob\/master\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.","responses":{"200":{"description":"Token","schema":{"$ref":"#\/definitions\/token"}}},"x-appwrite":{"method":"updateRecovery","weight":60,"cookies":false,"type":"","demo":"account\/update-recovery.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-recovery.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},userId:{param-userId}","scope":"public","platforms":["client","server"],"packaging":false,"auth":{"Project":[],"JWT":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"userId":{"type":"string","description":"User account UID address.","default":null,"x-example":"[USER_ID]"},"secret":{"type":"string","description":"Valid reset token.","default":null,"x-example":"[SECRET]"},"password":{"type":"string","description":"New password. Must be between 6 to 32 chars.","default":null,"x-example":"password"},"passwordAgain":{"type":"string","description":"New password again. Must be between 6 to 32 chars.","default":null,"x-example":"password"}},"required":["userId","secret","password","passwordAgain"]}}]}},"\/account\/sessions":{"get":{"summary":"Get Account Sessions","operationId":"accountGetSessions","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Get currently logged in user list of active sessions across different devices.","responses":{"200":{"description":"Sessions List","schema":{"$ref":"#\/definitions\/sessionList"}}},"x-appwrite":{"method":"getSessions","weight":49,"cookies":false,"type":"","demo":"account\/get-sessions.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/get-sessions.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[],"JWT":[]}},"security":[{"Project":[],"JWT":[]}]},"delete":{"summary":"Delete All Account Sessions","operationId":"accountDeleteSessions","consumes":["application\/json"],"produces":[],"tags":["account"],"description":"Delete all sessions from the user account and remove any sessions cookies from the end client.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteSessions","weight":58,"cookies":false,"type":"","demo":"account\/delete-sessions.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/delete-sessions.md","rate-limit":100,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[],"JWT":[]}},"security":[{"Project":[],"JWT":[]}]}},"\/account\/sessions\/{sessionId}":{"get":{"summary":"Get Session By ID","operationId":"accountGetSession","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to get a logged in user's session using a Session ID. Inputting 'current' will return the current session being used.","responses":{"200":{"description":"Session","schema":{"$ref":"#\/definitions\/session"}}},"x-appwrite":{"method":"getSession","weight":51,"cookies":false,"type":"","demo":"account\/get-session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/get-session.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[],"JWT":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"sessionId","description":"Session unique ID. Use the string 'current' to get the current device session.","required":true,"type":"string","x-example":"[SESSION_ID]","in":"path"}]},"delete":{"summary":"Delete Account Session","operationId":"accountDeleteSession","consumes":["application\/json"],"produces":[],"tags":["account"],"description":"Use this endpoint to log out the currently logged in user from all their account sessions across all of their different devices. When using the option id argument, only the session unique ID provider will be deleted.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteSession","weight":57,"cookies":false,"type":"","demo":"account\/delete-session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/delete-session.md","rate-limit":100,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[],"JWT":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"sessionId","description":"Session unique ID. Use the string 'current' to delete the current device session.","required":true,"type":"string","x-example":"[SESSION_ID]","in":"path"}]}},"\/account\/verification":{"post":{"summary":"Create Email Verification","operationId":"accountCreateVerification","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the **userId** and **secret** arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the **userId** and **secret** parameters. Learn more about how to [complete the verification process](\/docs\/client\/account#accountUpdateVerification). The verification link sent to the user's email address is valid for 7 days.\n\nPlease note that in order to avoid a [Redirect Attack](https:\/\/github.com\/OWASP\/CheatSheetSeries\/blob\/master\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.\n","responses":{"201":{"description":"Token","schema":{"$ref":"#\/definitions\/token"}}},"x-appwrite":{"method":"createVerification","weight":61,"cookies":false,"type":"","demo":"account\/create-verification.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create-verification.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},userId:{userId}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[],"JWT":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"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.","default":null,"x-example":"https:\/\/example.com"}},"required":["url"]}}]},"put":{"summary":"Create Email Verification (confirmation)","operationId":"accountUpdateVerification","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to complete the user email verification process. Use both the **userId** and **secret** parameters that were attached to your app URL to verify the user email ownership. If confirmed this route will return a 200 status code.","responses":{"200":{"description":"Token","schema":{"$ref":"#\/definitions\/token"}}},"x-appwrite":{"method":"updateVerification","weight":62,"cookies":false,"type":"","demo":"account\/update-verification.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-verification.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},userId:{param-userId}","scope":"public","platforms":["client","server"],"packaging":false,"auth":{"Project":[],"JWT":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"userId":{"type":"string","description":"User unique ID.","default":null,"x-example":"[USER_ID]"},"secret":{"type":"string","description":"Valid verification token.","default":null,"x-example":"[SECRET]"}},"required":["userId","secret"]}}]}},"\/avatars\/browsers\/{code}":{"get":{"summary":"Get Browser Icon","operationId":"avatarsGetBrowser","consumes":["application\/json"],"produces":["image\/png"],"tags":["avatars"],"description":"You can use this endpoint to show different browser icons to your users. The code argument receives the browser code as it appears in your user \/account\/sessions endpoint. Use width, height and quality arguments to change the output settings.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getBrowser","weight":64,"cookies":false,"type":"location","demo":"avatars\/get-browser.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-browser.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"code","description":"Browser Code.","required":true,"type":"string","x-example":"aa","in":"path"},{"name":"width","description":"Image width. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"height","description":"Image height. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"quality","description":"Image quality. Pass an integer between 0 to 100. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"}]}},"\/avatars\/credit-cards\/{code}":{"get":{"summary":"Get Credit Card Icon","operationId":"avatarsGetCreditCard","consumes":["application\/json"],"produces":["image\/png"],"tags":["avatars"],"description":"The credit card endpoint will return you the icon of the credit card provider you need. Use width, height and quality arguments to change the output settings.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getCreditCard","weight":63,"cookies":false,"type":"location","demo":"avatars\/get-credit-card.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-credit-card.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"code","description":"Credit Card Code. Possible values: amex, argencard, cabal, censosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, union-china-pay, visa, mir, maestro.","required":true,"type":"string","x-example":"amex","in":"path"},{"name":"width","description":"Image width. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"height","description":"Image height. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"quality","description":"Image quality. Pass an integer between 0 to 100. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"}]}},"\/avatars\/favicon":{"get":{"summary":"Get Favicon","operationId":"avatarsGetFavicon","consumes":["application\/json"],"produces":["image\/*"],"tags":["avatars"],"description":"Use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL.\n","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getFavicon","weight":67,"cookies":false,"type":"location","demo":"avatars\/get-favicon.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-favicon.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"url","description":"Website URL which you want to fetch the favicon from.","required":true,"type":"string","format":"url","x-example":"https:\/\/example.com","in":"query"}]}},"\/avatars\/flags\/{code}":{"get":{"summary":"Get Country Flag","operationId":"avatarsGetFlag","consumes":["application\/json"],"produces":["image\/png"],"tags":["avatars"],"description":"You can use this endpoint to show different country flags icons to your users. The code argument receives the 2 letter country code. Use width, height and quality arguments to change the output settings.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getFlag","weight":65,"cookies":false,"type":"location","demo":"avatars\/get-flag.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-flag.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"code","description":"Country Code. ISO Alpha-2 country code format.","required":true,"type":"string","x-example":"af","in":"path"},{"name":"width","description":"Image width. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"height","description":"Image height. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"quality","description":"Image quality. Pass an integer between 0 to 100. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"}]}},"\/avatars\/image":{"get":{"summary":"Get Image from URL","operationId":"avatarsGetImage","consumes":["application\/json"],"produces":["image\/*"],"tags":["avatars"],"description":"Use this endpoint to fetch a remote image URL and crop it to any image size you want. This endpoint is very useful if you need to crop and display remote images in your app or in case you want to make sure a 3rd party image is properly served using a TLS protocol.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getImage","weight":66,"cookies":false,"type":"location","demo":"avatars\/get-image.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-image.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"url","description":"Image URL which you want to crop.","required":true,"type":"string","format":"url","x-example":"https:\/\/example.com","in":"query"},{"name":"width","description":"Resize preview image width, Pass an integer between 0 to 2000.","required":false,"type":"integer","format":"int32","x-example":0,"default":400,"in":"query"},{"name":"height","description":"Resize preview image height, Pass an integer between 0 to 2000.","required":false,"type":"integer","format":"int32","x-example":0,"default":400,"in":"query"}]}},"\/avatars\/initials":{"get":{"summary":"Get User Initials","operationId":"avatarsGetInitials","consumes":["application\/json"],"produces":["image\/png"],"tags":["avatars"],"description":"Use this endpoint to show your user initials avatar icon on your website or app. By default, this route will try to print your logged-in user name or email initials. You can also overwrite the user name if you pass the 'name' parameter. If no name is given and no user is logged, an empty avatar will be returned.\n\nYou can use the color and background params to change the avatar colors. By default, a random theme will be selected. The random theme will persist for the user's initials when reloading the same theme will always return for the same initials.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getInitials","weight":69,"cookies":false,"type":"location","demo":"avatars\/get-initials.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-initials.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"name","description":"Full Name. When empty, current user name or email will be used. Max length: 128 chars.","required":false,"type":"string","x-example":"[NAME]","default":"","in":"query"},{"name":"width","description":"Image width. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":500,"in":"query"},{"name":"height","description":"Image height. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":500,"in":"query"},{"name":"color","description":"Changes text color. By default a random color will be picked and stay will persistent to the given name.","required":false,"type":"string","default":"","in":"query"},{"name":"background","description":"Changes background color. By default a random color will be picked and stay will persistent to the given name.","required":false,"type":"string","default":"","in":"query"}]}},"\/avatars\/qr":{"get":{"summary":"Get QR Code","operationId":"avatarsGetQR","consumes":["application\/json"],"produces":["image\/png"],"tags":["avatars"],"description":"Converts a given plain text to a QR code image. You can use the query parameters to change the size and style of the resulting image.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getQR","weight":68,"cookies":false,"type":"location","demo":"avatars\/get-q-r.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-qr.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"text","description":"Plain text to be converted to QR code image.","required":true,"type":"string","x-example":"[TEXT]","in":"query"},{"name":"size","description":"QR code size. Pass an integer between 0 to 1000. Defaults to 400.","required":false,"type":"integer","format":"int32","x-example":0,"default":400,"in":"query"},{"name":"margin","description":"Margin from edge. Pass an integer between 0 to 10. Defaults to 1.","required":false,"type":"integer","format":"int32","x-example":0,"default":1,"in":"query"},{"name":"download","description":"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.","required":false,"type":"boolean","x-example":false,"default":false,"in":"query"}]}},"\/database\/collections":{"get":{"summary":"List Collections","operationId":"databaseListCollections","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Get a list of all the user collections. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project's collections. [Learn more about different API modes](\/docs\/admin).","responses":{"200":{"description":"Collections List","schema":{"$ref":"#\/definitions\/collectionList"}}},"x-appwrite":{"method":"listCollections","weight":71,"cookies":false,"type":"","demo":"database\/list-collections.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/list-collections.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.read","platforms":["server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Results offset. The default value is 0. Use this param to manage pagination.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create Collection","operationId":"databaseCreateCollection","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Create a new Collection.","responses":{"201":{"description":"Collection","schema":{"$ref":"#\/definitions\/collection"}}},"x-appwrite":{"method":"createCollection","weight":70,"cookies":false,"type":"","demo":"database\/create-collection.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/create-collection.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Collection name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"read":{"type":"array","description":"An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}},"write":{"type":"array","description":"An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}},"rules":{"type":"array","description":"Array of [rule objects](\/docs\/rules). Each rule define a collection field name, data type and validation.","default":null,"x-example":null,"items":{"type":"string"}}},"required":["name","read","write","rules"]}}]}},"\/database\/collections\/{collectionId}":{"get":{"summary":"Get Collection","operationId":"databaseGetCollection","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata.","responses":{"200":{"description":"Collection","schema":{"$ref":"#\/definitions\/collection"}}},"x-appwrite":{"method":"getCollection","weight":72,"cookies":false,"type":"","demo":"database\/get-collection.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/get-collection.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.read","platforms":["server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID.","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"}]},"put":{"summary":"Update Collection","operationId":"databaseUpdateCollection","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Update a collection by its unique ID.","responses":{"200":{"description":"Collection","schema":{"$ref":"#\/definitions\/collection"}}},"x-appwrite":{"method":"updateCollection","weight":73,"cookies":false,"type":"","demo":"database\/update-collection.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/update-collection.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID.","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Collection name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"read":{"type":"array","description":"An array of strings with read permissions. By default inherits the existing read permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}},"write":{"type":"array","description":"An array of strings with write permissions. By default inherits the existing write permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}},"rules":{"type":"array","description":"Array of [rule objects](\/docs\/rules). Each rule define a collection field name, data type and validation.","default":[],"x-example":null,"items":{"type":"string"}}},"required":["name"]}}]},"delete":{"summary":"Delete Collection","operationId":"databaseDeleteCollection","consumes":["application\/json"],"produces":[],"tags":["database"],"description":"Delete a collection by its unique ID. Only users with write permissions have access to delete this resource.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteCollection","weight":74,"cookies":false,"type":"","demo":"database\/delete-collection.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/delete-collection.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID.","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"}]}},"\/database\/collections\/{collectionId}\/documents":{"get":{"summary":"List Documents","operationId":"databaseListDocuments","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Get a list of all the user documents. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project's documents. [Learn more about different API modes](\/docs\/admin).","responses":{"200":{"description":"Documents List","schema":{"$ref":"#\/definitions\/documentList"}}},"x-appwrite":{"method":"listDocuments","weight":76,"cookies":false,"type":"","demo":"database\/list-documents.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/list-documents.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"documents.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"filters","description":"Array of filter strings. Each filter is constructed from a key name, comparison operator (=, !=, >, <, <=, >=) and a value. You can also use a dot (.) separator in attribute names to filter by child document attributes. Examples: 'name=John Doe' or 'category.$id>=5bed2d152c362'.","required":false,"type":"array","collectionFormat":"multi","items":{"type":"string"},"default":[],"in":"query"},{"name":"limit","description":"Maximum number of documents to return in response. Use this value to manage pagination. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Offset value. The default value is 0. Use this param to manage pagination.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"orderField","description":"Document field that results will be sorted by.","required":false,"type":"string","x-example":"[ORDER_FIELD]","default":"","in":"query"},{"name":"orderType","description":"Order direction. Possible values are DESC for descending order, or ASC for ascending order.","required":false,"type":"string","x-example":"DESC","default":"ASC","in":"query"},{"name":"orderCast","description":"Order field type casting. Possible values are int, string, date, time or datetime. The database will attempt to cast the order field to the value you pass here. The default value is a string.","required":false,"type":"string","x-example":"int","default":"string","in":"query"},{"name":"search","description":"Search query. Enter any free text search. The database will try to find a match against all document attributes and children. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"}]},"post":{"summary":"Create Document","operationId":"databaseCreateDocument","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](\/docs\/server\/database#databaseCreateCollection) API or directly from your database console.","responses":{"201":{"description":"Document","schema":{"$ref":"#\/definitions\/document"}}},"x-appwrite":{"method":"createDocument","weight":75,"cookies":false,"type":"","demo":"database\/create-document.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/create-document.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"documents.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"data":{"type":"object","description":"Document data as JSON object.","default":null,"x-example":"{}"},"read":{"type":"array","description":"An array of strings with read permissions. By default only the current user is granted with read permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}},"write":{"type":"array","description":"An array of strings with write permissions. By default only the current user is granted with write permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}},"parentDocument":{"type":"string","description":"Parent document unique ID. Use when you want your new document to be a child of a parent document.","default":"","x-example":"[PARENT_DOCUMENT]"},"parentProperty":{"type":"string","description":"Parent document property name. Use when you want your new document to be a child of a parent document.","default":"","x-example":null},"parentPropertyType":{"type":"string","description":"Parent document property connection type. You can set this value to **assign**, **append** or **prepend**, default value is assign. Use when you want your new document to be a child of a parent document.","default":"assign","x-example":"assign"}},"required":["data"]}}]}},"\/database\/collections\/{collectionId}\/documents\/{documentId}":{"get":{"summary":"Get Document","operationId":"databaseGetDocument","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Get a document by its unique ID. This endpoint response returns a JSON object with the document data.","responses":{"200":{"description":"Document","schema":{"$ref":"#\/definitions\/document"}}},"x-appwrite":{"method":"getDocument","weight":77,"cookies":false,"type":"","demo":"database\/get-document.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/get-document.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"documents.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"documentId","description":"Document unique ID.","required":true,"type":"string","x-example":"[DOCUMENT_ID]","in":"path"}]},"patch":{"summary":"Update Document","operationId":"databaseUpdateDocument","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated.","responses":{"200":{"description":"Document","schema":{"$ref":"#\/definitions\/document"}}},"x-appwrite":{"method":"updateDocument","weight":78,"cookies":false,"type":"","demo":"database\/update-document.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/update-document.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"documents.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"documentId","description":"Document unique ID.","required":true,"type":"string","x-example":"[DOCUMENT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"data":{"type":"object","description":"Document data as JSON object.","default":null,"x-example":"{}"},"read":{"type":"array","description":"An array of strings with read permissions. By default inherits the existing read permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}},"write":{"type":"array","description":"An array of strings with write permissions. By default inherits the existing write permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}}},"required":["data"]}}]},"delete":{"summary":"Delete Document","operationId":"databaseDeleteDocument","consumes":["application\/json"],"produces":[],"tags":["database"],"description":"Delete a document by its unique ID. This endpoint deletes only the parent documents, its attributes and relations to other documents. Child documents **will not** be deleted.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteDocument","weight":79,"cookies":false,"type":"","demo":"database\/delete-document.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/delete-document.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"documents.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"documentId","description":"Document unique ID.","required":true,"type":"string","x-example":"[DOCUMENT_ID]","in":"path"}]}},"\/functions":{"get":{"summary":"List Functions","operationId":"functionsList","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Get a list of all the project's functions. You can use the query params to filter your results.","responses":{"200":{"description":"Functions List","schema":{"$ref":"#\/definitions\/functionList"}}},"x-appwrite":{"method":"list","weight":169,"cookies":false,"type":"","demo":"functions\/list.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/list-functions.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.read","platforms":["server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Results offset. The default value is 0. Use this param to manage pagination.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create Function","operationId":"functionsCreate","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Create a new function. You can pass a list of [permissions](\/docs\/permissions) to allow different project users or team with access to execute the function using the client API.","responses":{"201":{"description":"Function","schema":{"$ref":"#\/definitions\/function"}}},"x-appwrite":{"method":"create","weight":168,"cookies":false,"type":"","demo":"functions\/create.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/create-function.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.write","platforms":["server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Function name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"execute":{"type":"array","description":"An array of strings with execution permissions. By default no user is granted with any execute permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}},"runtime":{"type":"string","description":"Execution runtime.","default":null,"x-example":"dotnet-5.0"},"vars":{"type":"object","description":"Key-value JSON object.","default":{},"x-example":"{}"},"events":{"type":"array","description":"Events list.","default":[],"x-example":null,"items":{"type":"string"}},"schedule":{"type":"string","description":"Schedule CRON syntax.","default":"","x-example":null},"timeout":{"type":"integer","description":"Function maximum execution time in seconds.","default":15,"x-example":1}},"required":["name","execute","runtime"]}}]}},"\/functions\/{functionId}":{"get":{"summary":"Get Function","operationId":"functionsGet","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Get a function by its unique ID.","responses":{"200":{"description":"Function","schema":{"$ref":"#\/definitions\/function"}}},"x-appwrite":{"method":"get","weight":170,"cookies":false,"type":"","demo":"functions\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/get-function.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.read","platforms":["server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"}]},"put":{"summary":"Update Function","operationId":"functionsUpdate","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Update function by its unique ID.","responses":{"200":{"description":"Function","schema":{"$ref":"#\/definitions\/function"}}},"x-appwrite":{"method":"update","weight":172,"cookies":false,"type":"","demo":"functions\/update.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/update-function.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.write","platforms":["server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Function name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"execute":{"type":"array","description":"An array of strings with execution permissions. By default no user is granted with any execute permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}},"vars":{"type":"object","description":"Key-value JSON object.","default":{},"x-example":"{}"},"events":{"type":"array","description":"Events list.","default":[],"x-example":null,"items":{"type":"string"}},"schedule":{"type":"string","description":"Schedule CRON syntax.","default":"","x-example":null},"timeout":{"type":"integer","description":"Function maximum execution time in seconds.","default":15,"x-example":1}},"required":["name","execute"]}}]},"delete":{"summary":"Delete Function","operationId":"functionsDelete","consumes":["application\/json"],"produces":[],"tags":["functions"],"description":"Delete a function by its unique ID.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"delete","weight":174,"cookies":false,"type":"","demo":"functions\/delete.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/delete-function.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.write","platforms":["server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"}]}},"\/functions\/{functionId}\/executions":{"get":{"summary":"List Executions","operationId":"functionsListExecutions","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Get a list of all the current user function execution logs. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project's executions. [Learn more about different API modes](\/docs\/admin).","responses":{"200":{"description":"Executions List","schema":{"$ref":"#\/definitions\/executionList"}}},"x-appwrite":{"method":"listExecutions","weight":180,"cookies":false,"type":"","demo":"functions\/list-executions.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/list-executions.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"execution.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Results offset. The default value is 0. Use this param to manage pagination.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create Execution","operationId":"functionsCreateExecution","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Trigger a function execution. The returned object will return you the current execution status. You can ping the `Get Execution` endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously.","responses":{"201":{"description":"Execution","schema":{"$ref":"#\/definitions\/execution"}}},"x-appwrite":{"method":"createExecution","weight":179,"cookies":false,"type":"","demo":"functions\/create-execution.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/create-execution.md","rate-limit":60,"rate-time":60,"rate-key":"url:{url},ip:{ip}","scope":"execution.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"data":{"type":"string","description":"String of custom data to send to function.","default":"","x-example":"[DATA]"}}}}]}},"\/functions\/{functionId}\/executions\/{executionId}":{"get":{"summary":"Get Execution","operationId":"functionsGetExecution","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Get a function execution log by its unique ID.","responses":{"200":{"description":"Execution","schema":{"$ref":"#\/definitions\/execution"}}},"x-appwrite":{"method":"getExecution","weight":181,"cookies":false,"type":"","demo":"functions\/get-execution.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/get-execution.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"execution.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"executionId","description":"Execution unique ID.","required":true,"type":"string","x-example":"[EXECUTION_ID]","in":"path"}]}},"\/functions\/{functionId}\/tag":{"patch":{"summary":"Update Function Tag","operationId":"functionsUpdateTag","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Update the function code tag ID using the unique function ID. Use this endpoint to switch the code tag that should be executed by the execution endpoint.","responses":{"200":{"description":"Function","schema":{"$ref":"#\/definitions\/function"}}},"x-appwrite":{"method":"updateTag","weight":173,"cookies":false,"type":"","demo":"functions\/update-tag.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/update-function-tag.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.write","platforms":["server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"tag":{"type":"string","description":"Tag unique ID.","default":null,"x-example":"[TAG]"}},"required":["tag"]}}]}},"\/functions\/{functionId}\/tags":{"get":{"summary":"List Tags","operationId":"functionsListTags","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Get a list of all the project's code tags. You can use the query params to filter your results.","responses":{"200":{"description":"Tags List","schema":{"$ref":"#\/definitions\/tagList"}}},"x-appwrite":{"method":"listTags","weight":176,"cookies":false,"type":"","demo":"functions\/list-tags.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/list-tags.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.read","platforms":["server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Results offset. The default value is 0. Use this param to manage pagination.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create Tag","operationId":"functionsCreateTag","consumes":["multipart\/form-data"],"produces":["application\/json"],"tags":["functions"],"description":"Create a new function code tag. Use this endpoint to upload a new version of your code function. To execute your newly uploaded code, you'll need to update the function's tag to use your new tag UID.\n\nThis endpoint accepts a tar.gz file compressed with your code. Make sure to include any dependencies your code has within the compressed file. You can learn more about code packaging in the [Appwrite Cloud Functions tutorial](\/docs\/functions).\n\nUse the \"command\" param to set the entry point used to execute your code.","responses":{"201":{"description":"Tag","schema":{"$ref":"#\/definitions\/tag"}}},"x-appwrite":{"method":"createTag","weight":175,"cookies":false,"type":"","demo":"functions\/create-tag.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/create-tag.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.write","platforms":["server"],"packaging":true,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"command","description":"Code execution command.","required":true,"type":"string","x-example":"[COMMAND]","in":"formData"},{"name":"code","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.","required":true,"type":"file","in":"formData"}]}},"\/functions\/{functionId}\/tags\/{tagId}":{"get":{"summary":"Get Tag","operationId":"functionsGetTag","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Get a code tag by its unique ID.","responses":{"200":{"description":"Tag","schema":{"$ref":"#\/definitions\/tag"}}},"x-appwrite":{"method":"getTag","weight":177,"cookies":false,"type":"","demo":"functions\/get-tag.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/get-tag.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.read","platforms":["server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"tagId","description":"Tag unique ID.","required":true,"type":"string","x-example":"[TAG_ID]","in":"path"}]},"delete":{"summary":"Delete Tag","operationId":"functionsDeleteTag","consumes":["application\/json"],"produces":[],"tags":["functions"],"description":"Delete a code tag by its unique ID.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteTag","weight":178,"cookies":false,"type":"","demo":"functions\/delete-tag.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/delete-tag.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.write","platforms":["server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"tagId","description":"Tag unique ID.","required":true,"type":"string","x-example":"[TAG_ID]","in":"path"}]}},"\/health":{"get":{"summary":"Get HTTP","operationId":"healthGet","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Check the Appwrite HTTP server is up and responsive.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"get","weight":87,"cookies":false,"type":"","demo":"health\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/anti-virus":{"get":{"summary":"Get Anti virus","operationId":"healthGetAntiVirus","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Check the Appwrite Anti Virus server is up and connection is successful.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getAntiVirus","weight":99,"cookies":false,"type":"","demo":"health\/get-anti-virus.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-storage-anti-virus.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/cache":{"get":{"summary":"Get Cache","operationId":"healthGetCache","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Check the Appwrite in-memory cache server is up and connection is successful.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getCache","weight":90,"cookies":false,"type":"","demo":"health\/get-cache.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-cache.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/db":{"get":{"summary":"Get DB","operationId":"healthGetDB","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Check the Appwrite database server is up and connection is successful.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getDB","weight":89,"cookies":false,"type":"","demo":"health\/get-d-b.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-db.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/queue\/certificates":{"get":{"summary":"Get Certificate Queue","operationId":"healthGetQueueCertificates","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Get the number of certificates that are waiting to be issued against [Letsencrypt](https:\/\/letsencrypt.org\/) in the Appwrite internal queue server.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getQueueCertificates","weight":96,"cookies":false,"type":"","demo":"health\/get-queue-certificates.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-certificates.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/queue\/functions":{"get":{"summary":"Get Functions Queue","operationId":"healthGetQueueFunctions","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getQueueFunctions","weight":97,"cookies":false,"type":"","demo":"health\/get-queue-functions.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-functions.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/queue\/logs":{"get":{"summary":"Get Logs Queue","operationId":"healthGetQueueLogs","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Get the number of logs that are waiting to be processed in the Appwrite internal queue server.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getQueueLogs","weight":94,"cookies":false,"type":"","demo":"health\/get-queue-logs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-logs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/queue\/tasks":{"get":{"summary":"Get Tasks Queue","operationId":"healthGetQueueTasks","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Get the number of tasks that are waiting to be processed in the Appwrite internal queue server.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getQueueTasks","weight":93,"cookies":false,"type":"","demo":"health\/get-queue-tasks.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-tasks.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/queue\/usage":{"get":{"summary":"Get Usage Queue","operationId":"healthGetQueueUsage","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Get the number of usage stats that are waiting to be processed in the Appwrite internal queue server.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getQueueUsage","weight":95,"cookies":false,"type":"","demo":"health\/get-queue-usage.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-usage.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/queue\/webhooks":{"get":{"summary":"Get Webhooks Queue","operationId":"healthGetQueueWebhooks","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getQueueWebhooks","weight":92,"cookies":false,"type":"","demo":"health\/get-queue-webhooks.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-webhooks.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/storage\/local":{"get":{"summary":"Get Local Storage","operationId":"healthGetStorageLocal","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Check the Appwrite local storage device is up and connection is successful.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getStorageLocal","weight":98,"cookies":false,"type":"","demo":"health\/get-storage-local.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-storage-local.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/time":{"get":{"summary":"Get Time","operationId":"healthGetTime","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Check the Appwrite server time is synced with Google remote NTP server. We use this technology to smoothly handle leap seconds with no disruptive events. The [Network Time Protocol](https:\/\/en.wikipedia.org\/wiki\/Network_Time_Protocol) (NTP) is used by hundreds of millions of computers and devices to synchronize their clocks over the Internet. If your computer sets its own clock, it likely uses NTP.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getTime","weight":91,"cookies":false,"type":"","demo":"health\/get-time.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-time.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[]}]}},"\/locale":{"get":{"summary":"Get User Locale","operationId":"localeGet","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"Get the current user location based on IP. Returns an object with user country code, country name, continent name, continent code, ip address and suggested currency. You can use the locale header to get the data in a supported language.\n\n([IP Geolocation by DB-IP](https:\/\/db-ip.com))","responses":{"200":{"description":"Locale","schema":{"$ref":"#\/definitions\/locale"}}},"x-appwrite":{"method":"get","weight":80,"cookies":false,"type":"","demo":"locale\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-locale.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}]}},"\/locale\/continents":{"get":{"summary":"List Continents","operationId":"localeGetContinents","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"List of all continents. You can use the locale header to get the data in a supported language.","responses":{"200":{"description":"Continents List","schema":{"$ref":"#\/definitions\/continentList"}}},"x-appwrite":{"method":"getContinents","weight":84,"cookies":false,"type":"","demo":"locale\/get-continents.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-continents.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}]}},"\/locale\/countries":{"get":{"summary":"List Countries","operationId":"localeGetCountries","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"List of all countries. You can use the locale header to get the data in a supported language.","responses":{"200":{"description":"Countries List","schema":{"$ref":"#\/definitions\/countryList"}}},"x-appwrite":{"method":"getCountries","weight":81,"cookies":false,"type":"","demo":"locale\/get-countries.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-countries.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}]}},"\/locale\/countries\/eu":{"get":{"summary":"List EU Countries","operationId":"localeGetCountriesEU","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"List of all countries that are currently members of the EU. You can use the locale header to get the data in a supported language.","responses":{"200":{"description":"Countries List","schema":{"$ref":"#\/definitions\/countryList"}}},"x-appwrite":{"method":"getCountriesEU","weight":82,"cookies":false,"type":"","demo":"locale\/get-countries-e-u.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-countries-eu.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}]}},"\/locale\/countries\/phones":{"get":{"summary":"List Countries Phone Codes","operationId":"localeGetCountriesPhones","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"List of all countries phone codes. You can use the locale header to get the data in a supported language.","responses":{"200":{"description":"Phones List","schema":{"$ref":"#\/definitions\/phoneList"}}},"x-appwrite":{"method":"getCountriesPhones","weight":83,"cookies":false,"type":"","demo":"locale\/get-countries-phones.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-countries-phones.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}]}},"\/locale\/currencies":{"get":{"summary":"List Currencies","operationId":"localeGetCurrencies","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"List of all currencies, including currency symbol, name, plural, and decimal digits for all major and minor currencies. You can use the locale header to get the data in a supported language.","responses":{"200":{"description":"Currencies List","schema":{"$ref":"#\/definitions\/currencyList"}}},"x-appwrite":{"method":"getCurrencies","weight":85,"cookies":false,"type":"","demo":"locale\/get-currencies.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-currencies.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}]}},"\/locale\/languages":{"get":{"summary":"List Languages","operationId":"localeGetLanguages","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"List of all languages classified by ISO 639-1 including 2-letter code, name in English, and name in the respective language.","responses":{"200":{"description":"Languages List","schema":{"$ref":"#\/definitions\/languageList"}}},"x-appwrite":{"method":"getLanguages","weight":86,"cookies":false,"type":"","demo":"locale\/get-languages.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-languages.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}]}},"\/storage\/files":{"get":{"summary":"List Files","operationId":"storageListFiles","consumes":["application\/json"],"produces":["application\/json"],"tags":["storage"],"description":"Get a list of all the user files. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project's files. [Learn more about different API modes](\/docs\/admin).","responses":{"200":{"description":"Files List","schema":{"$ref":"#\/definitions\/fileList"}}},"x-appwrite":{"method":"listFiles","weight":136,"cookies":false,"type":"","demo":"storage\/list-files.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/list-files.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Results offset. The default value is 0. Use this param to manage pagination.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create File","operationId":"storageCreateFile","consumes":["multipart\/form-data"],"produces":["application\/json"],"tags":["storage"],"description":"Create a new file. The user who creates the file will automatically be assigned to read and write access unless he has passed custom values for read and write arguments.","responses":{"201":{"description":"File","schema":{"$ref":"#\/definitions\/file"}}},"x-appwrite":{"method":"createFile","weight":135,"cookies":false,"type":"upload","demo":"storage\/create-file.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/create-file.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"file","description":"Binary file.","required":true,"type":"file","in":"formData"},{"name":"read","description":"An array of strings with read permissions. By default only the current user is granted with read permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","required":false,"type":"array","collectionFormat":"multi","items":{"type":"string"},"in":"formData"},{"name":"write","description":"An array of strings with write permissions. By default only the current user is granted with write permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","required":false,"type":"array","collectionFormat":"multi","items":{"type":"string"},"in":"formData"}]}},"\/storage\/files\/{fileId}":{"get":{"summary":"Get File","operationId":"storageGetFile","consumes":["application\/json"],"produces":["application\/json"],"tags":["storage"],"description":"Get a file by its unique ID. This endpoint response returns a JSON object with the file metadata.","responses":{"200":{"description":"File","schema":{"$ref":"#\/definitions\/file"}}},"x-appwrite":{"method":"getFile","weight":137,"cookies":false,"type":"","demo":"storage\/get-file.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/get-file.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"fileId","description":"File unique ID.","required":true,"type":"string","x-example":"[FILE_ID]","in":"path"}]},"put":{"summary":"Update File","operationId":"storageUpdateFile","consumes":["application\/json"],"produces":["application\/json"],"tags":["storage"],"description":"Update a file by its unique ID. Only users with write permissions have access to update this resource.","responses":{"200":{"description":"File","schema":{"$ref":"#\/definitions\/file"}}},"x-appwrite":{"method":"updateFile","weight":141,"cookies":false,"type":"","demo":"storage\/update-file.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/update-file.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"fileId","description":"File unique ID.","required":true,"type":"string","x-example":"[FILE_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"read":{"type":"array","description":"An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}},"write":{"type":"array","description":"An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}}},"required":["read","write"]}}]},"delete":{"summary":"Delete File","operationId":"storageDeleteFile","consumes":["application\/json"],"produces":[],"tags":["storage"],"description":"Delete a file by its unique ID. Only users with write permissions have access to delete this resource.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteFile","weight":142,"cookies":false,"type":"","demo":"storage\/delete-file.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/delete-file.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"fileId","description":"File unique ID.","required":true,"type":"string","x-example":"[FILE_ID]","in":"path"}]}},"\/storage\/files\/{fileId}\/download":{"get":{"summary":"Get File for Download","operationId":"storageGetFileDownload","consumes":["application\/json"],"produces":["*\/*"],"tags":["storage"],"description":"Get a file content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory.","responses":{"200":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getFileDownload","weight":139,"cookies":false,"type":"location","demo":"storage\/get-file-download.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/get-file-download.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"fileId","description":"File unique ID.","required":true,"type":"string","x-example":"[FILE_ID]","in":"path"}]}},"\/storage\/files\/{fileId}\/preview":{"get":{"summary":"Get File Preview","operationId":"storageGetFilePreview","consumes":["application\/json"],"produces":["image\/*"],"tags":["storage"],"description":"Get a file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets, will return the file icon image. You can also pass query string arguments for cutting and resizing your preview image.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getFilePreview","weight":138,"cookies":false,"type":"location","demo":"storage\/get-file-preview.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/get-file-preview.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"fileId","description":"File unique ID","required":true,"type":"string","x-example":"[FILE_ID]","in":"path"},{"name":"width","description":"Resize preview image width, Pass an integer between 0 to 4000.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"height","description":"Resize preview image height, Pass an integer between 0 to 4000.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"gravity","description":"Image crop gravity. Can be one of center,top-left,top,top-right,left,right,bottom-left,bottom,bottom-right","required":false,"type":"string","x-example":"center","default":"center","in":"query"},{"name":"quality","description":"Preview image quality. Pass an integer between 0 to 100. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"borderWidth","description":"Preview image border in pixels. Pass an integer between 0 to 100. Defaults to 0.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"borderColor","description":"Preview image border color. Use a valid HEX color, no # is needed for prefix.","required":false,"type":"string","default":"","in":"query"},{"name":"borderRadius","description":"Preview image border radius in pixels. Pass an integer between 0 to 4000.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"opacity","description":"Preview image opacity. Only works with images having an alpha channel (like png). Pass a number between 0 to 1.","required":false,"type":"number","format":"float","x-example":0,"default":1,"in":"query"},{"name":"rotation","description":"Preview image rotation in degrees. Pass an integer between 0 and 360.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"background","description":"Preview image background color. Only works with transparent images (png). Use a valid HEX color, no # is needed for prefix.","required":false,"type":"string","default":"","in":"query"},{"name":"output","description":"Output format type (jpeg, jpg, png, gif and webp).","required":false,"type":"string","x-example":"jpg","default":"","in":"query"}]}},"\/storage\/files\/{fileId}\/view":{"get":{"summary":"Get File for View","operationId":"storageGetFileView","consumes":["application\/json"],"produces":["*\/*"],"tags":["storage"],"description":"Get a file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header.","responses":{"200":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getFileView","weight":140,"cookies":false,"type":"location","demo":"storage\/get-file-view.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/get-file-view.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"fileId","description":"File unique ID.","required":true,"type":"string","x-example":"[FILE_ID]","in":"path"}]}},"\/teams":{"get":{"summary":"List Teams","operationId":"teamsList","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Get a list of all the current user teams. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project's teams. [Learn more about different API modes](\/docs\/admin).","responses":{"200":{"description":"Teams List","schema":{"$ref":"#\/definitions\/teamList"}}},"x-appwrite":{"method":"list","weight":144,"cookies":false,"type":"","demo":"teams\/list.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/list-teams.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Results offset. The default value is 0. Use this param to manage pagination.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create Team","operationId":"teamsCreate","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Create a new team. The user who creates the team will automatically be assigned as the owner of the team. The team owner can invite new members, who will be able add new owners and update or delete the team from your project.","responses":{"201":{"description":"Team","schema":{"$ref":"#\/definitions\/team"}}},"x-appwrite":{"method":"create","weight":143,"cookies":false,"type":"","demo":"teams\/create.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/create-team.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Team name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"roles":{"type":"array","description":"Array of strings. Use this param to set the roles in the team for the user who created it. The default role is **owner**. A role can be any string. Learn more about [roles and permissions](\/docs\/permissions). Max length for each role is 32 chars.","default":["owner"],"x-example":null,"items":{"type":"string"}}},"required":["name"]}}]}},"\/teams\/{teamId}":{"get":{"summary":"Get Team","operationId":"teamsGet","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Get a team by its unique ID. All team members have read access for this resource.","responses":{"200":{"description":"Team","schema":{"$ref":"#\/definitions\/team"}}},"x-appwrite":{"method":"get","weight":145,"cookies":false,"type":"","demo":"teams\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/get-team.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team unique ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"}]},"put":{"summary":"Update Team","operationId":"teamsUpdate","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Update a team by its unique ID. Only team owners have write access for this resource.","responses":{"200":{"description":"Team","schema":{"$ref":"#\/definitions\/team"}}},"x-appwrite":{"method":"update","weight":146,"cookies":false,"type":"","demo":"teams\/update.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/update-team.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team unique ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Team name. Max length: 128 chars.","default":null,"x-example":"[NAME]"}},"required":["name"]}}]},"delete":{"summary":"Delete Team","operationId":"teamsDelete","consumes":["application\/json"],"produces":[],"tags":["teams"],"description":"Delete a team by its unique ID. Only team owners have write access for this resource.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"delete","weight":147,"cookies":false,"type":"","demo":"teams\/delete.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/delete-team.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team unique ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"}]}},"\/teams\/{teamId}\/memberships":{"get":{"summary":"Get Team Memberships","operationId":"teamsGetMemberships","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Get a team members by the team unique ID. All team members have read access for this list of resources.","responses":{"200":{"description":"Memberships List","schema":{"$ref":"#\/definitions\/membershipList"}}},"x-appwrite":{"method":"getMemberships","weight":150,"cookies":false,"type":"","demo":"teams\/get-memberships.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/get-team-members.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team unique ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"},{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Results offset. The default value is 0. Use this param to manage pagination.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create Team Membership","operationId":"teamsCreateMembership","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Use this endpoint to invite a new member to join your team. If initiated from Client SDK, an email with a link to join the team will be sent to the new member's email address if the member doesn't exist in the project it will be created automatically. If initiated from server side SDKs, new member will automatically be added to the team.\n\nUse the 'URL' parameter to redirect the user from the invitation email back to your app. When the user is redirected, use the [Update Team Membership Status](\/docs\/client\/teams#teamsUpdateMembershipStatus) endpoint to allow the user to accept the invitation to the team. While calling from side SDKs the redirect url can be empty string.\n\nPlease note that in order to avoid a [Redirect Attacks](https:\/\/github.com\/OWASP\/CheatSheetSeries\/blob\/master\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URL's are the once from domains you have set when added your platforms in the console interface.","responses":{"201":{"description":"Membership","schema":{"$ref":"#\/definitions\/membership"}}},"x-appwrite":{"method":"createMembership","weight":148,"cookies":false,"type":"","demo":"teams\/create-membership.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/create-team-membership.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team unique ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"email":{"type":"string","description":"New team member email.","default":null,"x-example":"email@example.com"},"roles":{"type":"array","description":"Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](\/docs\/permissions). Max length for each role is 32 chars.","default":null,"x-example":null,"items":{"type":"string"}},"url":{"type":"string","description":"URL to redirect the user back to your app from the invitation email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.","default":null,"x-example":"https:\/\/example.com"},"name":{"type":"string","description":"New team member name. Max length: 128 chars.","default":"","x-example":"[NAME]"}},"required":["email","roles","url"]}}]}},"\/teams\/{teamId}\/memberships\/{membershipId}":{"patch":{"summary":"Update Membership Roles","operationId":"teamsUpdateMembershipRoles","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"","responses":{"200":{"description":"Membership","schema":{"$ref":"#\/definitions\/membership"}}},"x-appwrite":{"method":"updateMembershipRoles","weight":149,"cookies":false,"type":"","demo":"teams\/update-membership-roles.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/update-team-membership-roles.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team unique ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"},{"name":"membershipId","description":"Membership ID.","required":true,"type":"string","x-example":"[MEMBERSHIP_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"roles":{"type":"array","description":"Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](\/docs\/permissions). Max length for each role is 32 chars.","default":null,"x-example":null,"items":{"type":"string"}}},"required":["roles"]}}]},"delete":{"summary":"Delete Team Membership","operationId":"teamsDeleteMembership","consumes":["application\/json"],"produces":[],"tags":["teams"],"description":"This endpoint allows a user to leave a team or for a team owner to delete the membership of any other team member. You can also use this endpoint to delete a user membership even if it is not accepted.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteMembership","weight":152,"cookies":false,"type":"","demo":"teams\/delete-membership.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/delete-team-membership.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team unique ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"},{"name":"membershipId","description":"Membership ID.","required":true,"type":"string","x-example":"[MEMBERSHIP_ID]","in":"path"}]}},"\/teams\/{teamId}\/memberships\/{membershipId}\/status":{"patch":{"summary":"Update Team Membership Status","operationId":"teamsUpdateMembershipStatus","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Use this endpoint to allow a user to accept an invitation to join a team after being redirected back to your app from the invitation email recieved by the user.","responses":{"200":{"description":"Membership","schema":{"$ref":"#\/definitions\/membership"}}},"x-appwrite":{"method":"updateMembershipStatus","weight":151,"cookies":false,"type":"","demo":"teams\/update-membership-status.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/update-team-membership-status.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"public","platforms":["client","server"],"packaging":false,"auth":{"Project":[],"JWT":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team unique ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"},{"name":"membershipId","description":"Membership ID.","required":true,"type":"string","x-example":"[MEMBERSHIP_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"userId":{"type":"string","description":"User unique ID.","default":null,"x-example":"[USER_ID]"},"secret":{"type":"string","description":"Secret key.","default":null,"x-example":"[SECRET]"}},"required":["userId","secret"]}}]}},"\/users":{"get":{"summary":"List Users","operationId":"usersList","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Get a list of all the project's users. You can use the query params to filter your results.","responses":{"200":{"description":"Users List","schema":{"$ref":"#\/definitions\/userList"}}},"x-appwrite":{"method":"list","weight":154,"cookies":false,"type":"","demo":"users\/list.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/list-users.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.read","platforms":["server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Results offset. The default value is 0. Use this param to manage pagination.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create User","operationId":"usersCreate","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Create a new user.","responses":{"201":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"create","weight":153,"cookies":false,"type":"","demo":"users\/create.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/create-user.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"email":{"type":"string","description":"User email.","default":null,"x-example":"email@example.com"},"password":{"type":"string","description":"User password. Must be between 6 to 32 chars.","default":null,"x-example":"password"},"name":{"type":"string","description":"User name. Max length: 128 chars.","default":"","x-example":"[NAME]"}},"required":["email","password"]}}]}},"\/users\/{userId}":{"get":{"summary":"Get User","operationId":"usersGet","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Get a user by its unique ID.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"get","weight":155,"cookies":false,"type":"","demo":"users\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/get-user.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.read","platforms":["server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"}]},"delete":{"summary":"Delete User","operationId":"usersDelete","consumes":["application\/json"],"produces":[],"tags":["users"],"description":"Delete a user by its unique ID.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"delete","weight":167,"cookies":false,"type":"","demo":"users\/delete.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/delete.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"}]}},"\/users\/{userId}\/email":{"patch":{"summary":"Update Email","operationId":"usersUpdateEmail","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Update the user email by its unique ID.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updateEmail","weight":163,"cookies":false,"type":"","demo":"users\/update-email.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/update-user-email.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"email":{"type":"string","description":"User email.","default":null,"x-example":"email@example.com"}},"required":["email"]}}]}},"\/users\/{userId}\/logs":{"get":{"summary":"Get User Logs","operationId":"usersGetLogs","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Get a user activity logs list by its unique ID.","responses":{"200":{"description":"Logs List","schema":{"$ref":"#\/definitions\/logList"}}},"x-appwrite":{"method":"getLogs","weight":158,"cookies":false,"type":"","demo":"users\/get-logs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/get-user-logs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.read","platforms":["server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"}]}},"\/users\/{userId}\/name":{"patch":{"summary":"Update Name","operationId":"usersUpdateName","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Update the user name by its unique ID.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updateName","weight":161,"cookies":false,"type":"","demo":"users\/update-name.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/update-user-name.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"User name. Max length: 128 chars.","default":null,"x-example":"[NAME]"}},"required":["name"]}}]}},"\/users\/{userId}\/password":{"patch":{"summary":"Update Password","operationId":"usersUpdatePassword","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Update the user password by its unique ID.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updatePassword","weight":162,"cookies":false,"type":"","demo":"users\/update-password.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/update-user-password.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"password":{"type":"string","description":"New user password. Must be between 6 to 32 chars.","default":null,"x-example":"password"}},"required":["password"]}}]}},"\/users\/{userId}\/prefs":{"get":{"summary":"Get User Preferences","operationId":"usersGetPrefs","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Get the user preferences by its unique ID.","responses":{"200":{"description":"Preferences","schema":{"$ref":"#\/definitions\/preferences"}}},"x-appwrite":{"method":"getPrefs","weight":156,"cookies":false,"type":"","demo":"users\/get-prefs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/get-user-prefs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.read","platforms":["server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"}]},"patch":{"summary":"Update User Preferences","operationId":"usersUpdatePrefs","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Update the user preferences by its unique ID. You can pass only the specific settings you wish to update.","responses":{"200":{"description":"Preferences","schema":{"$ref":"#\/definitions\/preferences"}}},"x-appwrite":{"method":"updatePrefs","weight":164,"cookies":false,"type":"","demo":"users\/update-prefs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/update-user-prefs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"prefs":{"type":"object","description":"Prefs key-value JSON object.","default":null,"x-example":"{}"}},"required":["prefs"]}}]}},"\/users\/{userId}\/sessions":{"get":{"summary":"Get User Sessions","operationId":"usersGetSessions","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Get the user sessions list by its unique ID.","responses":{"200":{"description":"Sessions List","schema":{"$ref":"#\/definitions\/sessionList"}}},"x-appwrite":{"method":"getSessions","weight":157,"cookies":false,"type":"","demo":"users\/get-sessions.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/get-user-sessions.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.read","platforms":["server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"}]},"delete":{"summary":"Delete User Sessions","operationId":"usersDeleteSessions","consumes":["application\/json"],"produces":[],"tags":["users"],"description":"Delete all user's sessions by using the user's unique ID.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteSessions","weight":166,"cookies":false,"type":"","demo":"users\/delete-sessions.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/delete-user-sessions.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"}]}},"\/users\/{userId}\/sessions\/{sessionId}":{"delete":{"summary":"Delete User Session","operationId":"usersDeleteSession","consumes":["application\/json"],"produces":[],"tags":["users"],"description":"Delete a user sessions by its unique ID.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteSession","weight":165,"cookies":false,"type":"","demo":"users\/delete-session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/delete-user-session.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"},{"name":"sessionId","description":"User unique session ID.","required":true,"type":"string","x-example":"[SESSION_ID]","in":"path"}]}},"\/users\/{userId}\/status":{"patch":{"summary":"Update User Status","operationId":"usersUpdateStatus","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Update the user status by its unique ID.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updateStatus","weight":159,"cookies":false,"type":"","demo":"users\/update-status.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/update-user-status.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"status":{"type":"integer","description":"User Status code. To activate the user pass 1, to block the user pass 2 and for disabling the user pass 0","default":null,"x-example":1}},"required":["status"]}}]}},"\/users\/{userId}\/verification":{"patch":{"summary":"Update Email Verification","operationId":"usersUpdateVerification","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Update the user email verification status by its unique ID.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updateVerification","weight":160,"cookies":false,"type":"","demo":"users\/update-verification.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/update-user-verification.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[],"Key":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"emailVerification":{"type":"boolean","description":"User Email Verification Status.","default":null,"x-example":false}},"required":["emailVerification"]}}]}}},"tags":[{"name":"account","description":"The Account service allows you to authenticate and manage a user account."},{"name":"avatars","description":"The Avatars service aims to help you complete everyday tasks related to your app image, icons, and avatars."},{"name":"database","description":"The Database service allows you to create structured collections of documents, query and filter lists of documents"},{"name":"locale","description":"The Locale service allows you to customize your app based on your users' location."},{"name":"health","description":"The Health service allows you to both validate and monitor your Appwrite server's health."},{"name":"projects","description":"The Project service allows you to manage all the projects in your Appwrite server."},{"name":"storage","description":"The Storage service allows you to manage your project files."},{"name":"teams","description":"The Teams service allows you to group users of your project and to enable them to share read and write access to your project resources"},{"name":"users","description":"The Users service allows you to manage your project users."},{"name":"functions","description":"The Functions Service allows you view, create and manage your Cloud Functions."}],"definitions":{"collectionList":{"description":"Collections List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"collections":{"type":"array","description":"List of collections.","items":{"type":"object","$ref":"#\/definitions\/collection"},"x-example":""}},"required":["sum","collections"]},"documentList":{"description":"Documents List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"documents":{"type":"array","description":"List of documents.","items":{"type":"object","$ref":"#\/definitions\/document"},"x-example":""}},"required":["sum","documents"]},"userList":{"description":"Users List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"users":{"type":"array","description":"List of users.","items":{"type":"object","$ref":"#\/definitions\/user"},"x-example":""}},"required":["sum","users"]},"sessionList":{"description":"Sessions List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"sessions":{"type":"array","description":"List of sessions.","items":{"type":"object","$ref":"#\/definitions\/session"},"x-example":""}},"required":["sum","sessions"]},"logList":{"description":"Logs List","type":"object","properties":{"logs":{"type":"array","description":"List of logs.","items":{"type":"object","$ref":"#\/definitions\/log"},"x-example":""}},"required":["logs"]},"fileList":{"description":"Files List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"files":{"type":"array","description":"List of files.","items":{"type":"object","$ref":"#\/definitions\/file"},"x-example":""}},"required":["sum","files"]},"teamList":{"description":"Teams List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"teams":{"type":"array","description":"List of teams.","items":{"type":"object","$ref":"#\/definitions\/team"},"x-example":""}},"required":["sum","teams"]},"membershipList":{"description":"Memberships List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"memberships":{"type":"array","description":"List of memberships.","items":{"type":"object","$ref":"#\/definitions\/membership"},"x-example":""}},"required":["sum","memberships"]},"functionList":{"description":"Functions List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"functions":{"type":"array","description":"List of functions.","items":{"type":"object","$ref":"#\/definitions\/function"},"x-example":""}},"required":["sum","functions"]},"tagList":{"description":"Tags List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"tags":{"type":"array","description":"List of tags.","items":{"type":"object","$ref":"#\/definitions\/tag"},"x-example":""}},"required":["sum","tags"]},"executionList":{"description":"Executions List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"executions":{"type":"array","description":"List of executions.","items":{"type":"object","$ref":"#\/definitions\/execution"},"x-example":""}},"required":["sum","executions"]},"countryList":{"description":"Countries List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"countries":{"type":"array","description":"List of countries.","items":{"type":"object","$ref":"#\/definitions\/country"},"x-example":""}},"required":["sum","countries"]},"continentList":{"description":"Continents List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"continents":{"type":"array","description":"List of continents.","items":{"type":"object","$ref":"#\/definitions\/continent"},"x-example":""}},"required":["sum","continents"]},"languageList":{"description":"Languages List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"languages":{"type":"array","description":"List of languages.","items":{"type":"object","$ref":"#\/definitions\/language"},"x-example":""}},"required":["sum","languages"]},"currencyList":{"description":"Currencies List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"currencies":{"type":"array","description":"List of currencies.","items":{"type":"object","$ref":"#\/definitions\/currency"},"x-example":""}},"required":["sum","currencies"]},"phoneList":{"description":"Phones List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"phones":{"type":"array","description":"List of phones.","items":{"type":"object","$ref":"#\/definitions\/phone"},"x-example":""}},"required":["sum","phones"]},"permissions":{"description":"Permissions","type":"object","properties":{"read":{"type":"array","description":"Read permissions.","items":{"type":"string"},"x-example":"user:5e5ea5c16897e"},"write":{"type":"array","description":"Write permissions.","items":{"type":"string"},"x-example":"user:5e5ea5c16897e"}},"required":["read","write"]},"collection":{"description":"Collection","type":"object","properties":{"$id":{"type":"string","description":"Collection ID.","x-example":"5e5ea5c16897e"},"$permissions":{"type":"object","description":"Collection permissions.","x-example":{},"items":{"type":"object","$ref":"#\/definitions\/permissions"}},"name":{"type":"string","description":"Collection name.","x-example":"Movies"},"dateCreated":{"type":"integer","description":"Collection creation date in Unix timestamp.","x-example":1592981250,"format":"int32"},"dateUpdated":{"type":"integer","description":"Collection creation date in Unix timestamp.","x-example":1592981550,"format":"int32"},"rules":{"type":"array","description":"Collection rules.","items":{"type":"object","$ref":"#\/definitions\/rule"},"x-example":""}},"required":["$id","$permissions","name","dateCreated","dateUpdated","rules"]},"document":{"description":"Document","type":"object","properties":{"$id":{"type":"string","description":"Document ID.","x-example":"5e5ea5c16897e"},"$collection":{"type":"string","description":"Collection ID.","x-example":"5e5ea5c15117e"},"$permissions":{"type":"object","description":"Document permissions.","x-example":{},"items":{"type":"object","$ref":"#\/definitions\/permissions"}}},"additionalProperties":true,"required":["$id","$collection","$permissions"]},"rule":{"description":"Rule","type":"object","properties":{"$id":{"type":"string","description":"Rule ID.","x-example":"5e5ea5c16897e"},"$collection":{"type":"string","description":"Rule Collection.","x-example":"5e5e66c16897e"},"type":{"type":"string","description":"Rule type. Possible values: ","x-example":"title"},"key":{"type":"string","description":"Rule key.","x-example":"title"},"label":{"type":"string","description":"Rule label.","x-example":"Title"},"default":{"type":"string","description":"Rule default value.","x-example":"Movie Name"},"array":{"type":"boolean","description":"Is array?","x-example":false},"required":{"type":"boolean","description":"Is required?","x-example":true},"list":{"type":"array","description":"List of allowed values","items":{"type":"string"},"x-example":"5e5ea5c168099"}},"required":["$id","$collection","type","key","label","default","array","required","list"]},"log":{"description":"Log","type":"object","properties":{"event":{"type":"string","description":"Event name.","x-example":"account.sessions.create"},"ip":{"type":"string","description":"IP session in use when the session was created.","x-example":"127.0.0.1"},"time":{"type":"integer","description":"Log creation time in Unix timestamp.","x-example":1592981250,"format":"int32"},"osCode":{"type":"string","description":"Operating system code name. View list of [available options](https:\/\/github.com\/appwrite\/appwrite\/blob\/master\/docs\/lists\/os.json).","x-example":"Mac"},"osName":{"type":"string","description":"Operating system name.","x-example":"Mac"},"osVersion":{"type":"string","description":"Operating system version.","x-example":"Mac"},"clientType":{"type":"string","description":"Client type.","x-example":"browser"},"clientCode":{"type":"string","description":"Client code name. View list of [available options](https:\/\/github.com\/appwrite\/appwrite\/blob\/master\/docs\/lists\/clients.json).","x-example":"CM"},"clientName":{"type":"string","description":"Client name.","x-example":"Chrome Mobile iOS"},"clientVersion":{"type":"string","description":"Client version.","x-example":"84.0"},"clientEngine":{"type":"string","description":"Client engine name.","x-example":"WebKit"},"clientEngineVersion":{"type":"string","description":"Client engine name.","x-example":"605.1.15"},"deviceName":{"type":"string","description":"Device name.","x-example":"smartphone"},"deviceBrand":{"type":"string","description":"Device brand name.","x-example":"Google"},"deviceModel":{"type":"string","description":"Device model name.","x-example":"Nexus 5"},"countryCode":{"type":"string","description":"Country two-character ISO 3166-1 alpha code.","x-example":"US"},"countryName":{"type":"string","description":"Country name.","x-example":"United States"}},"required":["event","ip","time","osCode","osName","osVersion","clientType","clientCode","clientName","clientVersion","clientEngine","clientEngineVersion","deviceName","deviceBrand","deviceModel","countryCode","countryName"]},"user":{"description":"User","type":"object","properties":{"$id":{"type":"string","description":"User ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"User name.","x-example":"John Doe"},"registration":{"type":"integer","description":"User registration date in Unix timestamp.","x-example":1592981250,"format":"int32"},"status":{"type":"integer","description":"User status. 0 for Unactivated, 1 for active and 2 is blocked.","x-example":0,"format":"int32"},"passwordUpdate":{"type":"integer","description":"Unix timestamp of the most recent password update","x-example":1592981250,"format":"int32"},"email":{"type":"string","description":"User email address.","x-example":"john@appwrite.io"},"emailVerification":{"type":"boolean","description":"Email verification status.","x-example":true},"prefs":{"type":"object","description":"User preferences as a key-value object","x-example":{"theme":"pink","timezone":"UTC"},"items":{"type":"object","$ref":"#\/definitions\/preferences"}}},"required":["$id","name","registration","status","passwordUpdate","email","emailVerification","prefs"]},"preferences":{"description":"Preferences","type":"object","additionalProperties":true},"session":{"description":"Session","type":"object","properties":{"$id":{"type":"string","description":"Session ID.","x-example":"5e5ea5c16897e"},"userId":{"type":"string","description":"User ID.","x-example":"5e5bb8c16897e"},"expire":{"type":"integer","description":"Session expiration date in Unix timestamp.","x-example":1592981250,"format":"int32"},"provider":{"type":"string","description":"Session Provider.","x-example":"email"},"providerUid":{"type":"string","description":"Session Provider User ID.","x-example":"user@example.com"},"providerToken":{"type":"string","description":"Session Provider Token.","x-example":"MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3"},"ip":{"type":"string","description":"IP in use when the session was created.","x-example":"127.0.0.1"},"osCode":{"type":"string","description":"Operating system code name. View list of [available options](https:\/\/github.com\/appwrite\/appwrite\/blob\/master\/docs\/lists\/os.json).","x-example":"Mac"},"osName":{"type":"string","description":"Operating system name.","x-example":"Mac"},"osVersion":{"type":"string","description":"Operating system version.","x-example":"Mac"},"clientType":{"type":"string","description":"Client type.","x-example":"browser"},"clientCode":{"type":"string","description":"Client code name. View list of [available options](https:\/\/github.com\/appwrite\/appwrite\/blob\/master\/docs\/lists\/clients.json).","x-example":"CM"},"clientName":{"type":"string","description":"Client name.","x-example":"Chrome Mobile iOS"},"clientVersion":{"type":"string","description":"Client version.","x-example":"84.0"},"clientEngine":{"type":"string","description":"Client engine name.","x-example":"WebKit"},"clientEngineVersion":{"type":"string","description":"Client engine name.","x-example":"605.1.15"},"deviceName":{"type":"string","description":"Device name.","x-example":"smartphone"},"deviceBrand":{"type":"string","description":"Device brand name.","x-example":"Google"},"deviceModel":{"type":"string","description":"Device model name.","x-example":"Nexus 5"},"countryCode":{"type":"string","description":"Country two-character ISO 3166-1 alpha code.","x-example":"US"},"countryName":{"type":"string","description":"Country name.","x-example":"United States"},"current":{"type":"boolean","description":"Returns true if this the current user session.","x-example":true}},"required":["$id","userId","expire","provider","providerUid","providerToken","ip","osCode","osName","osVersion","clientType","clientCode","clientName","clientVersion","clientEngine","clientEngineVersion","deviceName","deviceBrand","deviceModel","countryCode","countryName","current"]},"token":{"description":"Token","type":"object","properties":{"$id":{"type":"string","description":"Token ID.","x-example":"bb8ea5c16897e"},"userId":{"type":"string","description":"User ID.","x-example":"5e5ea5c168bb8"},"secret":{"type":"string","description":"Token secret key. This will return an empty string unless the response is returned using an API key or as part of a webhook payload.","x-example":""},"expire":{"type":"integer","description":"Token expiration date in Unix timestamp.","x-example":1592981250,"format":"int32"}},"required":["$id","userId","secret","expire"]},"locale":{"description":"Locale","type":"object","properties":{"ip":{"type":"string","description":"User IP address.","x-example":"127.0.0.1"},"countryCode":{"type":"string","description":"Country code in [ISO 3166-1](http:\/\/en.wikipedia.org\/wiki\/ISO_3166-1) two-character format","x-example":"US"},"country":{"type":"string","description":"Country name. This field support localization.","x-example":"United States"},"continentCode":{"type":"string","description":"Continent code. A two character continent code \"AF\" for Africa, \"AN\" for Antarctica, \"AS\" for Asia, \"EU\" for Europe, \"NA\" for North America, \"OC\" for Oceania, and \"SA\" for South America.","x-example":"NA"},"continent":{"type":"string","description":"Continent name. This field support localization.","x-example":"North America"},"eu":{"type":"boolean","description":"True if country is part of the Europian Union.","x-example":false},"currency":{"type":"string","description":"Currency code in [ISO 4217-1](http:\/\/en.wikipedia.org\/wiki\/ISO_4217) three-character format","x-example":"USD"}},"required":["ip","countryCode","country","continentCode","continent","eu","currency"]},"file":{"description":"File","type":"object","properties":{"$id":{"type":"string","description":"File ID.","x-example":"5e5ea5c16897e"},"$permissions":{"type":"object","description":"File permissions.","x-example":{},"items":{"type":"object","$ref":"#\/definitions\/permissions"}},"name":{"type":"string","description":"File name.","x-example":"Pink.png"},"dateCreated":{"type":"integer","description":"File creation date in Unix timestamp.","x-example":1592981250,"format":"int32"},"signature":{"type":"string","description":"File MD5 signature.","x-example":"5d529fd02b544198ae075bd57c1762bb"},"mimeType":{"type":"string","description":"File mime type.","x-example":"image\/png"},"sizeOriginal":{"type":"integer","description":"File original size in bytes.","x-example":17890,"format":"int32"}},"required":["$id","$permissions","name","dateCreated","signature","mimeType","sizeOriginal"]},"team":{"description":"Team","type":"object","properties":{"$id":{"type":"string","description":"Team ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"Team name.","x-example":"VIP"},"dateCreated":{"type":"integer","description":"Team creation date in Unix timestamp.","x-example":1592981250,"format":"int32"},"sum":{"type":"integer","description":"Total sum of team members.","x-example":7,"format":"int32"}},"required":["$id","name","dateCreated","sum"]},"membership":{"description":"Membership","type":"object","properties":{"$id":{"type":"string","description":"Membership ID.","x-example":"5e5ea5c16897e"},"userId":{"type":"string","description":"User ID.","x-example":"5e5ea5c16897e"},"teamId":{"type":"string","description":"Team ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"User name.","x-example":"VIP"},"email":{"type":"string","description":"User email address.","x-example":"john@appwrite.io"},"invited":{"type":"integer","description":"Date, the user has been invited to join the team in Unix timestamp.","x-example":1592981250,"format":"int32"},"joined":{"type":"integer","description":"Date, the user has accepted the invitation to join the team in Unix timestamp.","x-example":1592981250,"format":"int32"},"confirm":{"type":"boolean","description":"User confirmation status, true if the user has joined the team or false otherwise.","x-example":false},"roles":{"type":"array","description":"User list of roles","items":{"type":"string"},"x-example":"admin"}},"required":["$id","userId","teamId","name","email","invited","joined","confirm","roles"]},"function":{"description":"Function","type":"object","properties":{"$id":{"type":"string","description":"Function ID.","x-example":"5e5ea5c16897e"},"$permissions":{"type":"object","description":"Function permissions.","x-example":{},"items":{"type":"object","$ref":"#\/definitions\/permissions"}},"name":{"type":"string","description":"Function name.","x-example":"My Function"},"dateCreated":{"type":"integer","description":"Function creation date in Unix timestamp.","x-example":1592981250,"format":"int32"},"dateUpdated":{"type":"integer","description":"Function update date in Unix timestamp.","x-example":1592981257,"format":"int32"},"status":{"type":"string","description":"Function status. Possible values: disabled, enabled","x-example":"enabled"},"runtime":{"type":"string","description":"Function execution runtime.","x-example":"python-3.8"},"tag":{"type":"string","description":"Function active tag ID.","x-example":"5e5ea5c16897e"},"vars":{"type":"string","description":"Function environment variables.","x-example":{"key":"value"}},"events":{"type":"array","description":"Function trigger events.","items":{"type":"string"},"x-example":"account.create"},"schedule":{"type":"string","description":"Function execution schedult in CRON format.","x-example":"5 4 * * *"},"scheduleNext":{"type":"integer","description":"Function next scheduled execution date in Unix timestamp.","x-example":1592981292,"format":"int32"},"schedulePrevious":{"type":"integer","description":"Function next scheduled execution date in Unix timestamp.","x-example":1592981237,"format":"int32"},"timeout":{"type":"integer","description":"Function execution timeout in seconds.","x-example":1592981237,"format":"int32"}},"required":["$id","$permissions","name","dateCreated","dateUpdated","status","runtime","tag","vars","events","schedule","scheduleNext","schedulePrevious","timeout"]},"tag":{"description":"Tag","type":"object","properties":{"$id":{"type":"string","description":"Tag ID.","x-example":"5e5ea5c16897e"},"functionId":{"type":"string","description":"Function ID.","x-example":"5e5ea6g16897e"},"dateCreated":{"type":"integer","description":"The tag creation date in Unix timestamp.","x-example":1592981250,"format":"int32"},"command":{"type":"string","description":"The entrypoint command in use to execute the tag code.","x-example":"enabled"},"size":{"type":"string","description":"The code size in bytes.","x-example":"python-3.8"}},"required":["$id","functionId","dateCreated","command","size"]},"execution":{"description":"Execution","type":"object","properties":{"$id":{"type":"string","description":"Execution ID.","x-example":"5e5ea5c16897e"},"$permissions":{"type":"object","description":"Execution permissions.","x-example":{},"items":{"type":"object","$ref":"#\/definitions\/permissions"}},"functionId":{"type":"string","description":"Function ID.","x-example":"5e5ea6g16897e"},"dateCreated":{"type":"integer","description":"The execution creation date in Unix timestamp.","x-example":1592981250,"format":"int32"},"trigger":{"type":"string","description":"The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`.","x-example":"http"},"status":{"type":"string","description":"The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`.","x-example":"processing"},"exitCode":{"type":"integer","description":"The script exit code.","x-example":0,"format":"int32"},"stdout":{"type":"string","description":"The script stdout output string. Logs the last 4,000 characters of the execution stdout output.","x-example":""},"stderr":{"type":"string","description":"The script stderr output string. Logs the last 4,000 characters of the execution stderr output","x-example":""},"time":{"type":"number","description":"The script execution time in seconds.","x-example":0.4,"format":"float"}},"required":["$id","$permissions","functionId","dateCreated","trigger","status","exitCode","stdout","stderr","time"]},"country":{"description":"Country","type":"object","properties":{"name":{"type":"string","description":"Country name.","x-example":"United States"},"code":{"type":"string","description":"Country two-character ISO 3166-1 alpha code.","x-example":"US"}},"required":["name","code"]},"continent":{"description":"Continent","type":"object","properties":{"name":{"type":"string","description":"Continent name.","x-example":"Europe"},"code":{"type":"string","description":"Continent two letter code.","x-example":"EU"}},"required":["name","code"]},"language":{"description":"Language","type":"object","properties":{"name":{"type":"string","description":"Language name.","x-example":"Italian"},"code":{"type":"string","description":"Language two-character ISO 639-1 codes.","x-example":"it"},"nativeName":{"type":"string","description":"Language native name.","x-example":"Italiano"}},"required":["name","code","nativeName"]},"currency":{"description":"Currency","type":"object","properties":{"symbol":{"type":"string","description":"Currency symbol.","x-example":"$"},"name":{"type":"string","description":"Currency name.","x-example":"US dollar"},"symbolNative":{"type":"string","description":"Currency native symbol.","x-example":"$"},"decimalDigits":{"type":"integer","description":"Number of decimal digits.","x-example":2,"format":"int32"},"rounding":{"type":"number","description":"Currency digit rounding.","x-example":0,"format":"float"},"code":{"type":"string","description":"Currency code in [ISO 4217-1](http:\/\/en.wikipedia.org\/wiki\/ISO_4217) three-character format.","x-example":"USD"},"namePlural":{"type":"string","description":"Currency plural name","x-example":"US dollars"}},"required":["symbol","name","symbolNative","decimalDigits","rounding","code","namePlural"]},"phone":{"description":"Phone","type":"object","properties":{"code":{"type":"string","description":"Phone code.","x-example":"+1"},"countryCode":{"type":"string","description":"Country two-character ISO 3166-1 alpha code.","x-example":"US"},"countryName":{"type":"string","description":"Country name.","x-example":"United States"}},"required":["code","countryCode","countryName"]}},"externalDocs":{"description":"Full API docs, specs and tutorials","url":"https:\/\/appwrite.io\/docs"}} diff --git a/specs/swagger-appwrite-0.12.1-console.json b/specs/swagger-appwrite-0.12.1-console.json deleted file mode 100644 index a56b0ef374..0000000000 --- a/specs/swagger-appwrite-0.12.1-console.json +++ /dev/null @@ -1 +0,0 @@ -{"swagger":"2.0","info":{"version":"0.12.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","contact":{"name":"Appwrite Team","url":"https:\/\/appwrite.io\/support","email":"team@appwrite.io"},"license":{"name":"BSD-3-Clause","url":"https:\/\/raw.githubusercontent.com\/appwrite\/appwrite\/master\/LICENSE"}},"host":"HOSTNAME","basePath":"\/v1","schemes":["https"],"consumes":["application\/json","multipart\/form-data"],"produces":["application\/json"],"securityDefinitions":{"Project":{"type":"apiKey","name":"X-Appwrite-Project","description":"Your project ID","in":"header","x-appwrite":{"demo":"5df5acd0d48c2"}},"Key":{"type":"apiKey","name":"X-Appwrite-Key","description":"Your secret API key","in":"header","x-appwrite":{"demo":"919c2d18fb5d4...a2ae413da83346ad2"}},"JWT":{"type":"apiKey","name":"X-Appwrite-JWT","description":"Your secret JSON Web Token","in":"header","x-appwrite":{"demo":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ..."}},"Locale":{"type":"apiKey","name":"X-Appwrite-Locale","description":"","in":"header","x-appwrite":{"demo":"en"}},"Mode":{"type":"apiKey","name":"X-Appwrite-Mode","description":"","in":"header","x-appwrite":{"demo":""}}},"paths":{"\/account":{"get":{"summary":"Get Account","operationId":"accountGet","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Get currently logged in user data as JSON object.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"get","weight":46,"cookies":false,"type":"","demo":"account\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/get.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}]},"post":{"summary":"Create Account","operationId":"accountCreate","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to allow a new user to register a new account in your project. After the user registration completes successfully, you can use the [\/account\/verfication](\/docs\/client\/account#accountCreateVerification) route to start verifying the user email address. To allow the new user to login to their new account, you need to create a new [account session](\/docs\/client\/account#accountCreateSession).","responses":{"201":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"create","weight":36,"cookies":false,"type":"","demo":"account\/create.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"public","platforms":["client"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"userId":{"type":"string","description":"Unique Id. Choose your own unique ID or pass the string `unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.","default":null,"x-example":"[USER_ID]"},"email":{"type":"string","description":"User email.","default":null,"x-example":"email@example.com"},"password":{"type":"string","description":"User password. Must be at least 8 chars.","default":null,"x-example":"password"},"name":{"type":"string","description":"User name. Max length: 128 chars.","default":"","x-example":"[NAME]"}},"required":["userId","email","password"]}}]},"delete":{"summary":"Delete Account","operationId":"accountDelete","consumes":["application\/json"],"produces":[],"tags":["account"],"description":"Delete a currently logged in user account. Behind the scene, the user record is not deleted but permanently blocked from any access. This is done to avoid deleted accounts being overtaken by new users with the same email address. Any user-related resources like documents or storage files should be deleted separately.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"delete","weight":55,"cookies":false,"type":"","demo":"account\/delete.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/delete.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}]}},"\/account\/email":{"patch":{"summary":"Update Account Email","operationId":"accountUpdateEmail","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Update currently logged in user account email address. After changing user address, the user confirmation status will get reset. A new confirmation email is not sent automatically however you can use the send confirmation email endpoint again to send the confirmation email. For security measures, user password is required to complete this request.\nThis endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password.\n","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updateEmail","weight":53,"cookies":false,"type":"","demo":"account\/update-email.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-email.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"email":{"type":"string","description":"User email.","default":null,"x-example":"email@example.com"},"password":{"type":"string","description":"User password. Must be at least 8 chars.","default":null,"x-example":"password"}},"required":["email","password"]}}]}},"\/account\/jwt":{"post":{"summary":"Create Account JWT","operationId":"accountCreateJWT","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to create a JSON Web Token. You can use the resulting JWT to authenticate on behalf of the current user when working with the Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes from its creation and will be invalid if the user will logout in that time frame.","responses":{"201":{"description":"JWT","schema":{"$ref":"#\/definitions\/jwt"}}},"x-appwrite":{"method":"createJWT","weight":45,"cookies":false,"type":"","demo":"account\/create-j-w-t.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create-jwt.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},userId:{userId}","scope":"account","platforms":["client"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}]}},"\/account\/logs":{"get":{"summary":"Get Account Logs","operationId":"accountGetLogs","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Get currently logged in user list of latest security activity logs. Each log returns user IP address, location and date and time of log.","responses":{"200":{"description":"Logs List","schema":{"$ref":"#\/definitions\/logList"}}},"x-appwrite":{"method":"getLogs","weight":49,"cookies":false,"type":"","demo":"account\/get-logs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/get-logs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"limit","description":"Maximum number of logs to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Offset value. The default value is 0. Use this value to manage pagination. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"}]}},"\/account\/name":{"patch":{"summary":"Update Account Name","operationId":"accountUpdateName","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Update currently logged in user account name.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updateName","weight":51,"cookies":false,"type":"","demo":"account\/update-name.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-name.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"User name. Max length: 128 chars.","default":null,"x-example":"[NAME]"}},"required":["name"]}}]}},"\/account\/password":{"patch":{"summary":"Update Account Password","operationId":"accountUpdatePassword","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Update currently logged in user password. For validation, user is required to pass in the new password, and the old password. For users created with OAuth and Team Invites, oldPassword is optional.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updatePassword","weight":52,"cookies":false,"type":"","demo":"account\/update-password.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-password.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"password":{"type":"string","description":"New user password. Must be at least 8 chars.","default":null,"x-example":"password"},"oldPassword":{"type":"string","description":"Current user password. Must be at least 8 chars.","default":"","x-example":"password"}},"required":["password"]}}]}},"\/account\/prefs":{"get":{"summary":"Get Account Preferences","operationId":"accountGetPrefs","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Get currently logged in user preferences as a key-value object.","responses":{"200":{"description":"Preferences","schema":{"$ref":"#\/definitions\/preferences"}}},"x-appwrite":{"method":"getPrefs","weight":47,"cookies":false,"type":"","demo":"account\/get-prefs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/get-prefs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}]},"patch":{"summary":"Update Account Preferences","operationId":"accountUpdatePrefs","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Update currently logged in user account preferences. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updatePrefs","weight":54,"cookies":false,"type":"","demo":"account\/update-prefs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-prefs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"prefs":{"type":"object","description":"Prefs key-value JSON object.","default":{},"x-example":"{}"}},"required":["prefs"]}}]}},"\/account\/recovery":{"post":{"summary":"Create Password Recovery","operationId":"accountCreateRecovery","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Sends the user an email with a temporary secret key for password reset. When the user clicks the confirmation link he is redirected back to your app password reset URL with the secret key and email address values attached to the URL query string. Use the query string params to submit a request to the [PUT \/account\/recovery](\/docs\/client\/account#accountUpdateRecovery) endpoint to complete the process. The verification link sent to the user's email address is valid for 1 hour.","responses":{"201":{"description":"Token","schema":{"$ref":"#\/definitions\/token"}}},"x-appwrite":{"method":"createRecovery","weight":58,"cookies":false,"type":"","demo":"account\/create-recovery.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create-recovery.md","rate-limit":10,"rate-time":3600,"rate-key":["url:{url},email:{param-email}","ip:{ip}"],"scope":"public","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"email":{"type":"string","description":"User email.","default":null,"x-example":"email@example.com"},"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"}},"required":["email","url"]}}]},"put":{"summary":"Create Password Recovery (confirmation)","operationId":"accountUpdateRecovery","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to complete the user account password reset. Both the **userId** and **secret** arguments will be passed as query parameters to the redirect URL you have provided when sending your request to the [POST \/account\/recovery](\/docs\/client\/account#accountCreateRecovery) endpoint.\n\nPlease note that in order to avoid a [Redirect Attack](https:\/\/github.com\/OWASP\/CheatSheetSeries\/blob\/master\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.","responses":{"200":{"description":"Token","schema":{"$ref":"#\/definitions\/token"}}},"x-appwrite":{"method":"updateRecovery","weight":59,"cookies":false,"type":"","demo":"account\/update-recovery.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-recovery.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},userId:{param-userId}","scope":"public","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"userId":{"type":"string","description":"User ID.","default":null,"x-example":"[USER_ID]"},"secret":{"type":"string","description":"Valid reset token.","default":null,"x-example":"[SECRET]"},"password":{"type":"string","description":"New user password. Must be at least 8 chars.","default":null,"x-example":"password"},"passwordAgain":{"type":"string","description":"Repeat new user password. Must be at least 8 chars.","default":null,"x-example":"password"}},"required":["userId","secret","password","passwordAgain"]}}]}},"\/account\/sessions":{"get":{"summary":"Get Account Sessions","operationId":"accountGetSessions","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Get currently logged in user list of active sessions across different devices.","responses":{"200":{"description":"Sessions List","schema":{"$ref":"#\/definitions\/sessionList"}}},"x-appwrite":{"method":"getSessions","weight":48,"cookies":false,"type":"","demo":"account\/get-sessions.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/get-sessions.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}]},"post":{"summary":"Create Account Session","operationId":"accountCreateSession","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Allow the user to login into their account by providing a valid email and password combination. This route will create a new session for the user.","responses":{"201":{"description":"Session","schema":{"$ref":"#\/definitions\/session"}}},"x-appwrite":{"method":"createSession","weight":37,"cookies":false,"type":"","demo":"account\/create-session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create-session.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},email:{param-email}","scope":"public","platforms":["client"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"email":{"type":"string","description":"User email.","default":null,"x-example":"email@example.com"},"password":{"type":"string","description":"User password. Must be at least 8 chars.","default":null,"x-example":"password"}},"required":["email","password"]}}]},"delete":{"summary":"Delete All Account Sessions","operationId":"accountDeleteSessions","consumes":["application\/json"],"produces":[],"tags":["account"],"description":"Delete all sessions from the user account and remove any sessions cookies from the end client.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteSessions","weight":57,"cookies":false,"type":"","demo":"account\/delete-sessions.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/delete-sessions.md","rate-limit":100,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}]}},"\/account\/sessions\/anonymous":{"post":{"summary":"Create Anonymous Session","operationId":"accountCreateAnonymousSession","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to allow a new user to register an anonymous account in your project. This route will also create a new session for the user. To allow the new user to convert an anonymous account to a normal account, you need to update its [email and password](\/docs\/client\/account#accountUpdateEmail) or create an [OAuth2 session](\/docs\/client\/account#accountCreateOAuth2Session).","responses":{"201":{"description":"Session","schema":{"$ref":"#\/definitions\/session"}}},"x-appwrite":{"method":"createAnonymousSession","weight":44,"cookies":false,"type":"","demo":"account\/create-anonymous-session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create-session-anonymous.md","rate-limit":50,"rate-time":3600,"rate-key":"ip:{ip}","scope":"public","platforms":["client"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}]}},"\/account\/sessions\/magic-url":{"post":{"summary":"Create Magic URL session","operationId":"accountCreateMagicURLSession","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Sends the user an email with a secret key for creating a session. When the user clicks the link in the email, the user is redirected back to the URL you provided with the secret key and userId values attached to the URL query string. Use the query string parameters to submit a request to the [PUT \/account\/sessions\/magic-url](\/docs\/client\/account#accountUpdateMagicURLSession) endpoint to complete the login process. The link sent to the user's email address is valid for 1 hour. If you are on a mobile device you can leave the URL parameter empty, so that the login completion will be handled by your Appwrite instance by default.","responses":{"201":{"description":"Token","schema":{"$ref":"#\/definitions\/token"}}},"x-appwrite":{"method":"createMagicURLSession","weight":42,"cookies":false,"type":"","demo":"account\/create-magic-u-r-l-session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create-magic-url-session.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},email:{param-email}","scope":"public","platforms":["client"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"userId":{"type":"string","description":"Unique Id. Choose your own unique ID or pass the string `unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.","default":null,"x-example":"[USER_ID]"},"email":{"type":"string","description":"User email.","default":null,"x-example":"email@example.com"},"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"}},"required":["userId","email"]}}]},"put":{"summary":"Create Magic URL session (confirmation)","operationId":"accountUpdateMagicURLSession","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to complete creating the session with the Magic URL. Both the **userId** and **secret** arguments will be passed as query parameters to the redirect URL you have provided when sending your request to the [POST \/account\/sessions\/magic-url](\/docs\/client\/account#accountCreateMagicURLSession) endpoint.\n\nPlease note that in order to avoid a [Redirect Attack](https:\/\/github.com\/OWASP\/CheatSheetSeries\/blob\/master\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.","responses":{"200":{"description":"Session","schema":{"$ref":"#\/definitions\/session"}}},"x-appwrite":{"method":"updateMagicURLSession","weight":43,"cookies":false,"type":"","demo":"account\/update-magic-u-r-l-session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-magic-url-session.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},userId:{param-userId}","scope":"public","platforms":["client"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"userId":{"type":"string","description":"User ID.","default":null,"x-example":"[USER_ID]"},"secret":{"type":"string","description":"Valid verification token.","default":null,"x-example":"[SECRET]"}},"required":["userId","secret"]}}]}},"\/account\/sessions\/oauth2\/{provider}":{"get":{"summary":"Create Account Session with OAuth2","operationId":"accountCreateOAuth2Session","consumes":["application\/json"],"produces":["text\/html"],"tags":["account"],"description":"Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL's back to your app when login is completed.\n\nIf there is already an active session, the new session will be attached to the logged-in account. If there are no active sessions, the server will attempt to look for a user with the same email address as the email received from the OAuth2 provider and attach the new session to the existing user. If no matching user is found - the server will create a new user..\n","responses":{"301":{"description":"No content"}},"x-appwrite":{"method":"createOAuth2Session","weight":38,"cookies":false,"type":"webAuth","demo":"account\/create-o-auth2session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create-session-oauth2.md","rate-limit":50,"rate-time":3600,"rate-key":"ip:{ip}","scope":"public","platforms":["client"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"provider","description":"OAuth2 Provider. Currently, supported providers are: amazon, apple, bitbucket, bitly, box, discord, dropbox, facebook, github, gitlab, google, linkedin, microsoft, paypal, paypalSandbox, salesforce, slack, spotify, tradeshift, tradeshiftBox, twitch, vk, yahoo, yammer, yandex, wordpress.","required":true,"type":"string","x-example":"amazon","in":"path"},{"name":"success","description":"URL to redirect back to your app after a successful login attempt. 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.","required":false,"type":"string","format":"url","x-example":"https:\/\/example.com","default":"","in":"query"},{"name":"failure","description":"URL to redirect back to your app after a failed login attempt. 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.","required":false,"type":"string","format":"url","x-example":"https:\/\/example.com","default":"","in":"query"},{"name":"scopes","description":"A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes.","required":false,"type":"array","collectionFormat":"multi","items":{"type":"string"},"default":[],"in":"query"}]}},"\/account\/sessions\/{sessionId}":{"get":{"summary":"Get Session By ID","operationId":"accountGetSession","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to get a logged in user's session using a Session ID. Inputting 'current' will return the current session being used.","responses":{"200":{"description":"Session","schema":{"$ref":"#\/definitions\/session"}}},"x-appwrite":{"method":"getSession","weight":50,"cookies":false,"type":"","demo":"account\/get-session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/get-session.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"sessionId","description":"Session ID. Use the string 'current' to get the current device session.","required":true,"type":"string","x-example":"[SESSION_ID]","in":"path"}]},"delete":{"summary":"Delete Account Session","operationId":"accountDeleteSession","consumes":["application\/json"],"produces":[],"tags":["account"],"description":"Use this endpoint to log out the currently logged in user from all their account sessions across all of their different devices. When using the option id argument, only the session unique ID provider will be deleted.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteSession","weight":56,"cookies":false,"type":"","demo":"account\/delete-session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/delete-session.md","rate-limit":100,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"sessionId","description":"Session ID. Use the string 'current' to delete the current device session.","required":true,"type":"string","x-example":"[SESSION_ID]","in":"path"}]}},"\/account\/verification":{"post":{"summary":"Create Email Verification","operationId":"accountCreateVerification","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the **userId** and **secret** arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the **userId** and **secret** parameters. Learn more about how to [complete the verification process](\/docs\/client\/account#accountUpdateVerification). The verification link sent to the user's email address is valid for 7 days.\n\nPlease note that in order to avoid a [Redirect Attack](https:\/\/github.com\/OWASP\/CheatSheetSeries\/blob\/master\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.\n","responses":{"201":{"description":"Token","schema":{"$ref":"#\/definitions\/token"}}},"x-appwrite":{"method":"createVerification","weight":60,"cookies":false,"type":"","demo":"account\/create-verification.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create-verification.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},userId:{userId}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"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.","default":null,"x-example":"https:\/\/example.com"}},"required":["url"]}}]},"put":{"summary":"Create Email Verification (confirmation)","operationId":"accountUpdateVerification","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to complete the user email verification process. Use both the **userId** and **secret** parameters that were attached to your app URL to verify the user email ownership. If confirmed this route will return a 200 status code.","responses":{"200":{"description":"Token","schema":{"$ref":"#\/definitions\/token"}}},"x-appwrite":{"method":"updateVerification","weight":61,"cookies":false,"type":"","demo":"account\/update-verification.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-verification.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},userId:{param-userId}","scope":"public","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"userId":{"type":"string","description":"User ID.","default":null,"x-example":"[USER_ID]"},"secret":{"type":"string","description":"Valid verification token.","default":null,"x-example":"[SECRET]"}},"required":["userId","secret"]}}]}},"\/avatars\/browsers\/{code}":{"get":{"summary":"Get Browser Icon","operationId":"avatarsGetBrowser","consumes":["application\/json"],"produces":["image\/png"],"tags":["avatars"],"description":"You can use this endpoint to show different browser icons to your users. The code argument receives the browser code as it appears in your user \/account\/sessions endpoint. Use width, height and quality arguments to change the output settings.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getBrowser","weight":63,"cookies":false,"type":"location","demo":"avatars\/get-browser.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-browser.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"code","description":"Browser Code.","required":true,"type":"string","x-example":"aa","in":"path"},{"name":"width","description":"Image width. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"height","description":"Image height. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"quality","description":"Image quality. Pass an integer between 0 to 100. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"}]}},"\/avatars\/credit-cards\/{code}":{"get":{"summary":"Get Credit Card Icon","operationId":"avatarsGetCreditCard","consumes":["application\/json"],"produces":["image\/png"],"tags":["avatars"],"description":"The credit card endpoint will return you the icon of the credit card provider you need. Use width, height and quality arguments to change the output settings.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getCreditCard","weight":62,"cookies":false,"type":"location","demo":"avatars\/get-credit-card.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-credit-card.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"code","description":"Credit Card Code. Possible values: amex, argencard, cabal, censosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, union-china-pay, visa, mir, maestro.","required":true,"type":"string","x-example":"amex","in":"path"},{"name":"width","description":"Image width. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"height","description":"Image height. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"quality","description":"Image quality. Pass an integer between 0 to 100. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"}]}},"\/avatars\/favicon":{"get":{"summary":"Get Favicon","operationId":"avatarsGetFavicon","consumes":["application\/json"],"produces":["image\/*"],"tags":["avatars"],"description":"Use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL.\n","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getFavicon","weight":66,"cookies":false,"type":"location","demo":"avatars\/get-favicon.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-favicon.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"url","description":"Website URL which you want to fetch the favicon from.","required":true,"type":"string","format":"url","x-example":"https:\/\/example.com","in":"query"}]}},"\/avatars\/flags\/{code}":{"get":{"summary":"Get Country Flag","operationId":"avatarsGetFlag","consumes":["application\/json"],"produces":["image\/png"],"tags":["avatars"],"description":"You can use this endpoint to show different country flags icons to your users. The code argument receives the 2 letter country code. Use width, height and quality arguments to change the output settings.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getFlag","weight":64,"cookies":false,"type":"location","demo":"avatars\/get-flag.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-flag.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"code","description":"Country Code. ISO Alpha-2 country code format.","required":true,"type":"string","x-example":"af","in":"path"},{"name":"width","description":"Image width. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"height","description":"Image height. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"quality","description":"Image quality. Pass an integer between 0 to 100. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"}]}},"\/avatars\/image":{"get":{"summary":"Get Image from URL","operationId":"avatarsGetImage","consumes":["application\/json"],"produces":["image\/*"],"tags":["avatars"],"description":"Use this endpoint to fetch a remote image URL and crop it to any image size you want. This endpoint is very useful if you need to crop and display remote images in your app or in case you want to make sure a 3rd party image is properly served using a TLS protocol.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getImage","weight":65,"cookies":false,"type":"location","demo":"avatars\/get-image.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-image.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"url","description":"Image URL which you want to crop.","required":true,"type":"string","format":"url","x-example":"https:\/\/example.com","in":"query"},{"name":"width","description":"Resize preview image width, Pass an integer between 0 to 2000.","required":false,"type":"integer","format":"int32","x-example":0,"default":400,"in":"query"},{"name":"height","description":"Resize preview image height, Pass an integer between 0 to 2000.","required":false,"type":"integer","format":"int32","x-example":0,"default":400,"in":"query"}]}},"\/avatars\/initials":{"get":{"summary":"Get User Initials","operationId":"avatarsGetInitials","consumes":["application\/json"],"produces":["image\/png"],"tags":["avatars"],"description":"Use this endpoint to show your user initials avatar icon on your website or app. By default, this route will try to print your logged-in user name or email initials. You can also overwrite the user name if you pass the 'name' parameter. If no name is given and no user is logged, an empty avatar will be returned.\n\nYou can use the color and background params to change the avatar colors. By default, a random theme will be selected. The random theme will persist for the user's initials when reloading the same theme will always return for the same initials.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getInitials","weight":68,"cookies":false,"type":"location","demo":"avatars\/get-initials.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-initials.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"name","description":"Full Name. When empty, current user name or email will be used. Max length: 128 chars.","required":false,"type":"string","x-example":"[NAME]","default":"","in":"query"},{"name":"width","description":"Image width. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":500,"in":"query"},{"name":"height","description":"Image height. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":500,"in":"query"},{"name":"color","description":"Changes text color. By default a random color will be picked and stay will persistent to the given name.","required":false,"type":"string","default":"","in":"query"},{"name":"background","description":"Changes background color. By default a random color will be picked and stay will persistent to the given name.","required":false,"type":"string","default":"","in":"query"}]}},"\/avatars\/qr":{"get":{"summary":"Get QR Code","operationId":"avatarsGetQR","consumes":["application\/json"],"produces":["image\/png"],"tags":["avatars"],"description":"Converts a given plain text to a QR code image. You can use the query parameters to change the size and style of the resulting image.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getQR","weight":67,"cookies":false,"type":"location","demo":"avatars\/get-q-r.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-qr.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"text","description":"Plain text to be converted to QR code image.","required":true,"type":"string","x-example":"[TEXT]","in":"query"},{"name":"size","description":"QR code size. Pass an integer between 0 to 1000. Defaults to 400.","required":false,"type":"integer","format":"int32","x-example":0,"default":400,"in":"query"},{"name":"margin","description":"Margin from edge. Pass an integer between 0 to 10. Defaults to 1.","required":false,"type":"integer","format":"int32","x-example":0,"default":1,"in":"query"},{"name":"download","description":"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.","required":false,"type":"boolean","x-example":false,"default":false,"in":"query"}]}},"\/database\/collections":{"get":{"summary":"List Collections","operationId":"databaseListCollections","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Get a list of all the user collections. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project's collections. [Learn more about different API modes](\/docs\/admin).","responses":{"200":{"description":"Collections List","schema":{"$ref":"#\/definitions\/collectionList"}}},"x-appwrite":{"method":"listCollections","weight":70,"cookies":false,"type":"","demo":"database\/list-collections.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/list-collections.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Maximum number of collection to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Offset value. The default value is 0. Use this param to manage pagination. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"cursor","description":"ID of the collection used as the starting point for the query, excluding the collection itself. Should be used for efficient pagination when working with large sets of data.","required":false,"type":"string","x-example":"[CURSOR]","default":"","in":"query"},{"name":"cursorDirection","description":"Direction of the cursor.","required":false,"type":"string","x-example":"after","default":"after","in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create Collection","operationId":"databaseCreateCollection","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Create a new Collection.","responses":{"201":{"description":"Collection","schema":{"$ref":"#\/definitions\/collection"}}},"x-appwrite":{"method":"createCollection","weight":69,"cookies":false,"type":"","demo":"database\/create-collection.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/create-collection.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"collectionId":{"type":"string","description":"Unique Id. Choose your own unique ID or pass the string `unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.","default":null,"x-example":"[COLLECTION_ID]"},"name":{"type":"string","description":"Collection name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"permission":{"type":"string","description":"Permissions type model to use for reading documents in this collection. You can use collection-level permission set once on the collection using the `read` and `write` params, or you can set document-level permission where each document read and write params will decide who has access to read and write to each document individually. [learn more about permissions](https:\/\/appwrite.io\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":"document"},"read":{"type":"array","description":"An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](https:\/\/appwrite.io\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":"[\"role:all\"]","items":{"type":"string"}},"write":{"type":"array","description":"An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](https:\/\/appwrite.io\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":"[\"role:all\"]","items":{"type":"string"}}},"required":["collectionId","name","permission","read","write"]}}]}},"\/database\/collections\/{collectionId}":{"get":{"summary":"Get Collection","operationId":"databaseGetCollection","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata.","responses":{"200":{"description":"Collection","schema":{"$ref":"#\/definitions\/collection"}}},"x-appwrite":{"method":"getCollection","weight":71,"cookies":false,"type":"","demo":"database\/get-collection.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/get-collection.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID.","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"}]},"put":{"summary":"Update Collection","operationId":"databaseUpdateCollection","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Update a collection by its unique ID.","responses":{"200":{"description":"Collection","schema":{"$ref":"#\/definitions\/collection"}}},"x-appwrite":{"method":"updateCollection","weight":75,"cookies":false,"type":"","demo":"database\/update-collection.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/update-collection.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID.","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Collection name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"permission":{"type":"string","description":"Permissions type model to use for reading documents in this collection. You can use collection-level permission set once on the collection using the `read` and `write` params, or you can set document-level permission where each document read and write params will decide who has access to read and write to each document individually. [learn more about permissions](https:\/\/appwrite.io\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":"document"},"read":{"type":"array","description":"An array of strings with read permissions. By default inherits the existing read permissions. [learn more about permissions](https:\/\/appwrite.io\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":"[\"role:all\"]","items":{"type":"string"}},"write":{"type":"array","description":"An array of strings with write permissions. By default inherits the existing write permissions. [learn more about permissions](https:\/\/appwrite.io\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":"[\"role:all\"]","items":{"type":"string"}},"enabled":{"type":"boolean","description":"Is collection enabled?","default":true,"x-example":false}},"required":["name","permission"]}}]},"delete":{"summary":"Delete Collection","operationId":"databaseDeleteCollection","consumes":["application\/json"],"produces":[],"tags":["database"],"description":"Delete a collection by its unique ID. Only users with write permissions have access to delete this resource.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteCollection","weight":76,"cookies":false,"type":"","demo":"database\/delete-collection.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/delete-collection.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID.","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"}]}},"\/database\/collections\/{collectionId}\/attributes":{"get":{"summary":"List Attributes","operationId":"databaseListAttributes","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"","responses":{"200":{"description":"Attributes List","schema":{"$ref":"#\/definitions\/attributeList"}}},"x-appwrite":{"method":"listAttributes","weight":85,"cookies":false,"type":"","demo":"database\/list-attributes.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/list-attributes.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"}]}},"\/database\/collections\/{collectionId}\/attributes\/boolean":{"post":{"summary":"Create Boolean Attribute","operationId":"databaseCreateBooleanAttribute","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Create a boolean attribute.\n","responses":{"201":{"description":"AttributeBoolean","schema":{"$ref":"#\/definitions\/attributeBoolean"}}},"x-appwrite":{"method":"createBooleanAttribute","weight":84,"cookies":false,"type":"","demo":"database\/create-boolean-attribute.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/create-boolean-attribute.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"key":{"type":"string","description":"Attribute Key.","default":null,"x-example":null},"required":{"type":"boolean","description":"Is attribute required?","default":null,"x-example":false},"default":{"type":"boolean","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","default":null,"x-example":false},"array":{"type":"boolean","description":"Is attribute an array?","default":false,"x-example":false}},"required":["key","required"]}}]}},"\/database\/collections\/{collectionId}\/attributes\/email":{"post":{"summary":"Create Email Attribute","operationId":"databaseCreateEmailAttribute","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Create an email attribute.\n","responses":{"201":{"description":"AttributeEmail","schema":{"$ref":"#\/definitions\/attributeEmail"}}},"x-appwrite":{"method":"createEmailAttribute","weight":78,"cookies":false,"type":"","demo":"database\/create-email-attribute.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/create-email-attribute.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"key":{"type":"string","description":"Attribute Key.","default":null,"x-example":null},"required":{"type":"boolean","description":"Is attribute required?","default":null,"x-example":false},"default":{"type":"string","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","default":null,"x-example":"email@example.com"},"array":{"type":"boolean","description":"Is attribute an array?","default":false,"x-example":false}},"required":["key","required"]}}]}},"\/database\/collections\/{collectionId}\/attributes\/enum":{"post":{"summary":"Create Enum Attribute","operationId":"databaseCreateEnumAttribute","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"","responses":{"201":{"description":"AttributeEnum","schema":{"$ref":"#\/definitions\/attributeEnum"}}},"x-appwrite":{"method":"createEnumAttribute","weight":79,"cookies":false,"type":"","demo":"database\/create-enum-attribute.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/create-attribute-enum.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"key":{"type":"string","description":"Attribute Key.","default":null,"x-example":null},"elements":{"type":"array","description":"Array of elements in enumerated type. Uses length of longest element to determine size.","default":null,"x-example":null,"items":{"type":"string"}},"required":{"type":"boolean","description":"Is attribute required?","default":null,"x-example":false},"default":{"type":"string","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","default":null,"x-example":"[DEFAULT]"},"array":{"type":"boolean","description":"Is attribute an array?","default":false,"x-example":false}},"required":["key","elements","required"]}}]}},"\/database\/collections\/{collectionId}\/attributes\/float":{"post":{"summary":"Create Float Attribute","operationId":"databaseCreateFloatAttribute","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Create a float attribute. Optionally, minimum and maximum values can be provided.\n","responses":{"201":{"description":"AttributeFloat","schema":{"$ref":"#\/definitions\/attributeFloat"}}},"x-appwrite":{"method":"createFloatAttribute","weight":83,"cookies":false,"type":"","demo":"database\/create-float-attribute.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/create-float-attribute.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"key":{"type":"string","description":"Attribute Key.","default":null,"x-example":null},"required":{"type":"boolean","description":"Is attribute required?","default":null,"x-example":false},"min":{"type":"string","description":"Minimum value to enforce on new documents","default":null,"x-example":null},"max":{"type":"string","description":"Maximum value to enforce on new documents","default":null,"x-example":null},"default":{"type":"string","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","default":null,"x-example":null},"array":{"type":"boolean","description":"Is attribute an array?","default":false,"x-example":false}},"required":["key","required"]}}]}},"\/database\/collections\/{collectionId}\/attributes\/integer":{"post":{"summary":"Create Integer Attribute","operationId":"databaseCreateIntegerAttribute","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Create an integer attribute. Optionally, minimum and maximum values can be provided.\n","responses":{"201":{"description":"AttributeInteger","schema":{"$ref":"#\/definitions\/attributeInteger"}}},"x-appwrite":{"method":"createIntegerAttribute","weight":82,"cookies":false,"type":"","demo":"database\/create-integer-attribute.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/create-integer-attribute.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"key":{"type":"string","description":"Attribute Key.","default":null,"x-example":null},"required":{"type":"boolean","description":"Is attribute required?","default":null,"x-example":false},"min":{"type":"integer","description":"Minimum value to enforce on new documents","default":null,"x-example":null},"max":{"type":"integer","description":"Maximum value to enforce on new documents","default":null,"x-example":null},"default":{"type":"integer","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","default":null,"x-example":null},"array":{"type":"boolean","description":"Is attribute an array?","default":false,"x-example":false}},"required":["key","required"]}}]}},"\/database\/collections\/{collectionId}\/attributes\/ip":{"post":{"summary":"Create IP Address Attribute","operationId":"databaseCreateIpAttribute","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Create IP address attribute.\n","responses":{"201":{"description":"AttributeIP","schema":{"$ref":"#\/definitions\/attributeIp"}}},"x-appwrite":{"method":"createIpAttribute","weight":80,"cookies":false,"type":"","demo":"database\/create-ip-attribute.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/create-ip-attribute.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"key":{"type":"string","description":"Attribute Key.","default":null,"x-example":null},"required":{"type":"boolean","description":"Is attribute required?","default":null,"x-example":false},"default":{"type":"string","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","default":null,"x-example":null},"array":{"type":"boolean","description":"Is attribute an array?","default":false,"x-example":false}},"required":["key","required"]}}]}},"\/database\/collections\/{collectionId}\/attributes\/string":{"post":{"summary":"Create String Attribute","operationId":"databaseCreateStringAttribute","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Create a string attribute.\n","responses":{"201":{"description":"AttributeString","schema":{"$ref":"#\/definitions\/attributeString"}}},"x-appwrite":{"method":"createStringAttribute","weight":77,"cookies":false,"type":"","demo":"database\/create-string-attribute.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/create-string-attribute.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"key":{"type":"string","description":"Attribute Key.","default":null,"x-example":null},"size":{"type":"integer","description":"Attribute size for text attributes, in number of characters.","default":null,"x-example":1},"required":{"type":"boolean","description":"Is attribute required?","default":null,"x-example":false},"default":{"type":"string","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","default":null,"x-example":"[DEFAULT]"},"array":{"type":"boolean","description":"Is attribute an array?","default":false,"x-example":false}},"required":["key","size","required"]}}]}},"\/database\/collections\/{collectionId}\/attributes\/url":{"post":{"summary":"Create URL Attribute","operationId":"databaseCreateUrlAttribute","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Create a URL attribute.\n","responses":{"201":{"description":"AttributeURL","schema":{"$ref":"#\/definitions\/attributeUrl"}}},"x-appwrite":{"method":"createUrlAttribute","weight":81,"cookies":false,"type":"","demo":"database\/create-url-attribute.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/create-url-attribute.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"key":{"type":"string","description":"Attribute Key.","default":null,"x-example":null},"required":{"type":"boolean","description":"Is attribute required?","default":null,"x-example":false},"default":{"type":"string","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","default":null,"x-example":"https:\/\/example.com"},"array":{"type":"boolean","description":"Is attribute an array?","default":false,"x-example":false}},"required":["key","required"]}}]}},"\/database\/collections\/{collectionId}\/attributes\/{key}":{"get":{"summary":"Get Attribute","operationId":"databaseGetAttribute","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"","responses":{"200":{"description":"AttributeBoolean, or AttributeInteger, or AttributeFloat, or AttributeEmail, or AttributeEnum, or AttributeURL, or AttributeIP, or AttributeString","schema":{"x-oneOf":[{"$ref":"#\/definitions\/attributeBoolean"},{"$ref":"#\/definitions\/attributeInteger"},{"$ref":"#\/definitions\/attributeFloat"},{"$ref":"#\/definitions\/attributeEmail"},{"$ref":"#\/definitions\/attributeEnum"},{"$ref":"#\/definitions\/attributeUrl"},{"$ref":"#\/definitions\/attributeIp"},{"$ref":"#\/definitions\/attributeString"}]}}},"x-appwrite":{"method":"getAttribute","weight":86,"cookies":false,"type":"","demo":"database\/get-attribute.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/get-attribute.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"key","description":"Attribute Key.","required":true,"type":"string","in":"path"}]},"delete":{"summary":"Delete Attribute","operationId":"databaseDeleteAttribute","consumes":["application\/json"],"produces":[],"tags":["database"],"description":"","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteAttribute","weight":87,"cookies":false,"type":"","demo":"database\/delete-attribute.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/delete-attribute.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"key","description":"Attribute Key.","required":true,"type":"string","in":"path"}]}},"\/database\/collections\/{collectionId}\/documents":{"get":{"summary":"List Documents","operationId":"databaseListDocuments","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Get a list of all the user documents. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project's documents. [Learn more about different API modes](\/docs\/admin).","responses":{"200":{"description":"Documents List","schema":{"$ref":"#\/definitions\/documentList"}}},"x-appwrite":{"method":"listDocuments","weight":93,"cookies":false,"type":"","demo":"database\/list-documents.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/list-documents.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"documents.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"queries","description":"Array of query strings.","required":false,"type":"array","collectionFormat":"multi","items":{"type":"string"},"default":[],"in":"query"},{"name":"limit","description":"Maximum number of documents to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Offset value. The default value is 0. Use this value to manage pagination. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"cursor","description":"ID of the document used as the starting point for the query, excluding the document itself. Should be used for efficient pagination when working with large sets of data. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"string","x-example":"[CURSOR]","default":"","in":"query"},{"name":"cursorDirection","description":"Direction of the cursor.","required":false,"type":"string","x-example":"after","default":"after","in":"query"},{"name":"orderAttributes","description":"Array of attributes used to sort results.","required":false,"type":"array","collectionFormat":"multi","items":{"type":"string"},"default":[],"in":"query"},{"name":"orderTypes","description":"Array of order directions for sorting attribtues. Possible values are DESC for descending order, or ASC for ascending order.","required":false,"type":"array","collectionFormat":"multi","items":{"type":"string"},"default":[],"in":"query"}]},"post":{"summary":"Create Document","operationId":"databaseCreateDocument","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](\/docs\/server\/database#databaseCreateCollection) API or directly from your database console.","responses":{"201":{"description":"Document","schema":{"$ref":"#\/definitions\/document"}}},"x-appwrite":{"method":"createDocument","weight":92,"cookies":false,"type":"","demo":"database\/create-document.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/create-document.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"documents.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection). Make sure to define attributes before creating documents.","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"documentId":{"type":"string","description":"Document ID. Choose your own unique ID or pass the string `unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.","default":null,"x-example":"[DOCUMENT_ID]"},"data":{"type":"object","description":"Document data as JSON object.","default":{},"x-example":"{}"},"read":{"type":"array","description":"An array of strings with read permissions. By default only the current user is granted with read permissions. [learn more about permissions](https:\/\/appwrite.io\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":"[\"role:all\"]","items":{"type":"string"}},"write":{"type":"array","description":"An array of strings with write permissions. By default only the current user is granted with write permissions. [learn more about permissions](https:\/\/appwrite.io\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":"[\"role:all\"]","items":{"type":"string"}}},"required":["documentId","data"]}}]}},"\/database\/collections\/{collectionId}\/documents\/{documentId}":{"get":{"summary":"Get Document","operationId":"databaseGetDocument","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Get a document by its unique ID. This endpoint response returns a JSON object with the document data.","responses":{"200":{"description":"Document","schema":{"$ref":"#\/definitions\/document"}}},"x-appwrite":{"method":"getDocument","weight":94,"cookies":false,"type":"","demo":"database\/get-document.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/get-document.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"documents.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"documentId","description":"Document ID.","required":true,"type":"string","x-example":"[DOCUMENT_ID]","in":"path"}]},"patch":{"summary":"Update Document","operationId":"databaseUpdateDocument","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated.","responses":{"200":{"description":"Document","schema":{"$ref":"#\/definitions\/document"}}},"x-appwrite":{"method":"updateDocument","weight":96,"cookies":false,"type":"","demo":"database\/update-document.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/update-document.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"documents.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"collectionId","description":"Collection ID.","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"documentId","description":"Document ID.","required":true,"type":"string","x-example":"[DOCUMENT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"data":{"type":"object","description":"Document data as JSON object.","default":{},"x-example":"{}"},"read":{"type":"array","description":"An array of strings with read permissions. By default inherits the existing read permissions. [learn more about permissions](https:\/\/appwrite.io\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":"[\"role:all\"]","items":{"type":"string"}},"write":{"type":"array","description":"An array of strings with write permissions. By default inherits the existing write permissions. [learn more about permissions](https:\/\/appwrite.io\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":"[\"role:all\"]","items":{"type":"string"}}},"required":["data"]}}]},"delete":{"summary":"Delete Document","operationId":"databaseDeleteDocument","consumes":["application\/json"],"produces":[],"tags":["database"],"description":"Delete a document by its unique ID. This endpoint deletes only the parent documents, its attributes and relations to other documents. Child documents **will not** be deleted.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteDocument","weight":97,"cookies":false,"type":"","demo":"database\/delete-document.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/delete-document.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"documents.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"documentId","description":"Document ID.","required":true,"type":"string","x-example":"[DOCUMENT_ID]","in":"path"}]}},"\/database\/collections\/{collectionId}\/documents\/{documentId}\/logs":{"get":{"summary":"List Document Logs","operationId":"databaseListDocumentLogs","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Get the document activity logs list by its unique ID.","responses":{"200":{"description":"Logs List","schema":{"$ref":"#\/definitions\/logList"}}},"x-appwrite":{"method":"listDocumentLogs","weight":95,"cookies":false,"type":"","demo":"database\/list-document-logs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/get-document-logs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"documents.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"collectionId","description":"Collection ID.","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"documentId","description":"Document ID.","required":true,"type":"string","x-example":"[DOCUMENT_ID]","in":"path"},{"name":"limit","description":"Maximum number of logs to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Offset value. The default value is 0. Use this value to manage pagination. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"}]}},"\/database\/collections\/{collectionId}\/indexes":{"get":{"summary":"List Indexes","operationId":"databaseListIndexes","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"","responses":{"200":{"description":"Indexes List","schema":{"$ref":"#\/definitions\/indexList"}}},"x-appwrite":{"method":"listIndexes","weight":89,"cookies":false,"type":"","demo":"database\/list-indexes.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/list-indexes.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"}]},"post":{"summary":"Create Index","operationId":"databaseCreateIndex","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"","responses":{"201":{"description":"Index","schema":{"$ref":"#\/definitions\/index"}}},"x-appwrite":{"method":"createIndex","weight":88,"cookies":false,"type":"","demo":"database\/create-index.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/create-index.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"key":{"type":"string","description":"Index Key.","default":null,"x-example":null},"type":{"type":"string","description":"Index type.","default":null,"x-example":"key"},"attributes":{"type":"array","description":"Array of attributes to index.","default":null,"x-example":null,"items":{"type":"string"}},"orders":{"type":"array","description":"Array of index orders.","default":[],"x-example":null,"items":{"type":"string"}}},"required":["key","type","attributes"]}}]}},"\/database\/collections\/{collectionId}\/indexes\/{key}":{"get":{"summary":"Get Index","operationId":"databaseGetIndex","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"","responses":{"200":{"description":"Index","schema":{"$ref":"#\/definitions\/index"}}},"x-appwrite":{"method":"getIndex","weight":90,"cookies":false,"type":"","demo":"database\/get-index.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/get-index.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"key","description":"Index Key.","required":true,"type":"string","in":"path"}]},"delete":{"summary":"Delete Index","operationId":"databaseDeleteIndex","consumes":["application\/json"],"produces":[],"tags":["database"],"description":"","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteIndex","weight":91,"cookies":false,"type":"","demo":"database\/delete-index.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/delete-index.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"key","description":"Index Key.","required":true,"type":"string","in":"path"}]}},"\/database\/collections\/{collectionId}\/logs":{"get":{"summary":"List Collection Logs","operationId":"databaseListCollectionLogs","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Get the collection activity logs list by its unique ID.","responses":{"200":{"description":"Logs List","schema":{"$ref":"#\/definitions\/logList"}}},"x-appwrite":{"method":"listCollectionLogs","weight":74,"cookies":false,"type":"","demo":"database\/list-collection-logs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/get-collection-logs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"collectionId","description":"Collection ID.","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"limit","description":"Maximum number of logs to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Offset value. The default value is 0. Use this value to manage pagination. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"}]}},"\/database\/usage":{"get":{"summary":"Get usage stats for the database","operationId":"databaseGetUsage","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"","responses":{"200":{"description":"UsageDatabase","schema":{"$ref":"#\/definitions\/usageDatabase"}}},"x-appwrite":{"method":"getUsage","weight":72,"cookies":false,"type":"","demo":"database\/get-usage.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"range","description":"Date range.","required":false,"type":"string","x-example":"24h","default":"30d","in":"query"}]}},"\/database\/{collectionId}\/usage":{"get":{"summary":"Get usage stats for a collection","operationId":"databaseGetCollectionUsage","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"","responses":{"200":{"description":"UsageCollection","schema":{"$ref":"#\/definitions\/usageCollection"}}},"x-appwrite":{"method":"getCollectionUsage","weight":73,"cookies":false,"type":"","demo":"database\/get-collection-usage.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"range","description":"Date range.","required":false,"type":"string","x-example":"24h","default":"30d","in":"query"},{"name":"collectionId","description":"Collection ID.","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"}]}},"\/functions":{"get":{"summary":"List Functions","operationId":"functionsList","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Get a list of all the project's functions. You can use the query params to filter your results.","responses":{"200":{"description":"Functions List","schema":{"$ref":"#\/definitions\/functionList"}}},"x-appwrite":{"method":"list","weight":186,"cookies":false,"type":"","demo":"functions\/list.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/list-functions.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Maximum number of functions to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Offset value. The default value is 0. Use this value to manage pagination. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"cursor","description":"ID of the function used as the starting point for the query, excluding the function itself. Should be used for efficient pagination when working with large sets of data. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"string","x-example":"[CURSOR]","default":"","in":"query"},{"name":"cursorDirection","description":"Direction of the cursor.","required":false,"type":"string","x-example":"after","default":"after","in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create Function","operationId":"functionsCreate","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Create a new function. You can pass a list of [permissions](\/docs\/permissions) to allow different project users or team with access to execute the function using the client API.","responses":{"201":{"description":"Function","schema":{"$ref":"#\/definitions\/function"}}},"x-appwrite":{"method":"create","weight":185,"cookies":false,"type":"","demo":"functions\/create.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/create-function.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"functionId":{"type":"string","description":"Function ID. Choose your own unique ID or pass the string `unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.","default":null,"x-example":"[FUNCTION_ID]"},"name":{"type":"string","description":"Function name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"execute":{"type":"array","description":"An array of strings with execution permissions. By default no user is granted with any execute permissions. [learn more about permissions](https:\/\/appwrite.io\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}},"runtime":{"type":"string","description":"Execution runtime.","default":null,"x-example":"node-14.5"},"vars":{"type":"object","description":"Key-value JSON object that will be passed to the function as environment variables.","default":[],"x-example":"{}"},"events":{"type":"array","description":"Events list.","default":[],"x-example":null,"items":{"type":"string"}},"schedule":{"type":"string","description":"Schedule CRON syntax.","default":"","x-example":null},"timeout":{"type":"integer","description":"Function maximum execution time in seconds.","default":15,"x-example":1}},"required":["functionId","name","execute","runtime"]}}]}},"\/functions\/runtimes":{"get":{"summary":"List the currently active function runtimes.","operationId":"functionsListRuntimes","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Get a list of all runtimes that are currently active in your project.","responses":{"200":{"description":"Runtimes List","schema":{"$ref":"#\/definitions\/runtimeList"}}},"x-appwrite":{"method":"listRuntimes","weight":187,"cookies":false,"type":"","demo":"functions\/list-runtimes.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/list-runtimes.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/functions\/{functionId}":{"get":{"summary":"Get Function","operationId":"functionsGet","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Get a function by its unique ID.","responses":{"200":{"description":"Function","schema":{"$ref":"#\/definitions\/function"}}},"x-appwrite":{"method":"get","weight":188,"cookies":false,"type":"","demo":"functions\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/get-function.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"}]},"put":{"summary":"Update Function","operationId":"functionsUpdate","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Update function by its unique ID.","responses":{"200":{"description":"Function","schema":{"$ref":"#\/definitions\/function"}}},"x-appwrite":{"method":"update","weight":190,"cookies":false,"type":"","demo":"functions\/update.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/update-function.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Function name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"execute":{"type":"array","description":"An array of strings with execution permissions. By default no user is granted with any execute permissions. [learn more about permissions](https:\/\/appwrite.io\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}},"vars":{"type":"object","description":"Key-value JSON object that will be passed to the function as environment variables.","default":[],"x-example":"{}"},"events":{"type":"array","description":"Events list.","default":[],"x-example":null,"items":{"type":"string"}},"schedule":{"type":"string","description":"Schedule CRON syntax.","default":"","x-example":null},"timeout":{"type":"integer","description":"Maximum execution time in seconds.","default":15,"x-example":1}},"required":["name","execute"]}}]},"delete":{"summary":"Delete Function","operationId":"functionsDelete","consumes":["application\/json"],"produces":[],"tags":["functions"],"description":"Delete a function by its unique ID.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"delete","weight":192,"cookies":false,"type":"","demo":"functions\/delete.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/delete-function.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"}]}},"\/functions\/{functionId}\/executions":{"get":{"summary":"List Executions","operationId":"functionsListExecutions","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Get a list of all the current user function execution logs. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project's executions. [Learn more about different API modes](\/docs\/admin).","responses":{"200":{"description":"Executions List","schema":{"$ref":"#\/definitions\/executionList"}}},"x-appwrite":{"method":"listExecutions","weight":198,"cookies":false,"type":"","demo":"functions\/list-executions.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/list-executions.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"execution.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"functionId","description":"Function ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"limit","description":"Maximum number of executions to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Offset value. The default value is 0. Use this value to manage pagination. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"cursor","description":"ID of the execution used as the starting point for the query, excluding the execution itself. Should be used for efficient pagination when working with large sets of data. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"string","x-example":"[CURSOR]","default":"","in":"query"},{"name":"cursorDirection","description":"Direction of the cursor.","required":false,"type":"string","x-example":"after","default":"after","in":"query"}]},"post":{"summary":"Create Execution","operationId":"functionsCreateExecution","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Trigger a function execution. The returned object will return you the current execution status. You can ping the `Get Execution` endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously.","responses":{"201":{"description":"Execution","schema":{"$ref":"#\/definitions\/execution"}}},"x-appwrite":{"method":"createExecution","weight":197,"cookies":false,"type":"","demo":"functions\/create-execution.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/create-execution.md","rate-limit":60,"rate-time":60,"rate-key":"url:{url},ip:{ip}","scope":"execution.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"functionId","description":"Function ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"data":{"type":"string","description":"String of custom data to send to function.","default":"","x-example":"[DATA]"}}}}]}},"\/functions\/{functionId}\/executions\/{executionId}":{"get":{"summary":"Get Execution","operationId":"functionsGetExecution","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Get a function execution log by its unique ID.","responses":{"200":{"description":"Execution","schema":{"$ref":"#\/definitions\/execution"}}},"x-appwrite":{"method":"getExecution","weight":199,"cookies":false,"type":"","demo":"functions\/get-execution.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/get-execution.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"execution.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"functionId","description":"Function ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"executionId","description":"Execution ID.","required":true,"type":"string","x-example":"[EXECUTION_ID]","in":"path"}]}},"\/functions\/{functionId}\/tag":{"patch":{"summary":"Update Function Tag","operationId":"functionsUpdateTag","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Update the function code tag ID using the unique function ID. Use this endpoint to switch the code tag that should be executed by the execution endpoint.","responses":{"200":{"description":"Function","schema":{"$ref":"#\/definitions\/function"}}},"x-appwrite":{"method":"updateTag","weight":191,"cookies":false,"type":"","demo":"functions\/update-tag.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/update-function-tag.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"tag":{"type":"string","description":"Tag ID.","default":null,"x-example":"[TAG]"}},"required":["tag"]}}]}},"\/functions\/{functionId}\/tags":{"get":{"summary":"List Tags","operationId":"functionsListTags","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Get a list of all the project's code tags. You can use the query params to filter your results.","responses":{"200":{"description":"Tags List","schema":{"$ref":"#\/definitions\/tagList"}}},"x-appwrite":{"method":"listTags","weight":194,"cookies":false,"type":"","demo":"functions\/list-tags.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/list-tags.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Maximum number of tags to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Offset value. The default value is 0. Use this value to manage pagination. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"cursor","description":"ID of the tag used as the starting point for the query, excluding the tag itself. Should be used for efficient pagination when working with large sets of data. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"string","x-example":"[CURSOR]","default":"","in":"query"},{"name":"cursorDirection","description":"Direction of the cursor.","required":false,"type":"string","x-example":"after","default":"after","in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create Tag","operationId":"functionsCreateTag","consumes":["multipart\/form-data"],"produces":["application\/json"],"tags":["functions"],"description":"Create a new function code tag. Use this endpoint to upload a new version of your code function. To execute your newly uploaded code, you'll need to update the function's tag to use your new tag UID.\n\nThis endpoint accepts a tar.gz file compressed with your code. Make sure to include any dependencies your code has within the compressed file. You can learn more about code packaging in the [Appwrite Cloud Functions tutorial](\/docs\/functions).\n\nUse the \"command\" param to set the entry point used to execute your code.","responses":{"201":{"description":"Tag","schema":{"$ref":"#\/definitions\/tag"}}},"x-appwrite":{"method":"createTag","weight":193,"cookies":false,"type":"","demo":"functions\/create-tag.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/create-tag.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.write","platforms":["server"],"packaging":true,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"command","description":"Code execution command.","required":true,"type":"string","x-example":"[COMMAND]","in":"formData"},{"name":"code","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.","required":true,"type":"file","in":"formData"}]}},"\/functions\/{functionId}\/tags\/{tagId}":{"get":{"summary":"Get Tag","operationId":"functionsGetTag","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Get a code tag by its unique ID.","responses":{"200":{"description":"Tag","schema":{"$ref":"#\/definitions\/tag"}}},"x-appwrite":{"method":"getTag","weight":195,"cookies":false,"type":"","demo":"functions\/get-tag.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/get-tag.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"tagId","description":"Tag ID.","required":true,"type":"string","x-example":"[TAG_ID]","in":"path"}]},"delete":{"summary":"Delete Tag","operationId":"functionsDeleteTag","consumes":["application\/json"],"produces":[],"tags":["functions"],"description":"Delete a code tag by its unique ID.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteTag","weight":196,"cookies":false,"type":"","demo":"functions\/delete-tag.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/delete-tag.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"tagId","description":"Tag ID.","required":true,"type":"string","x-example":"[TAG_ID]","in":"path"}]}},"\/functions\/{functionId}\/usage":{"get":{"summary":"Get Function Usage","operationId":"functionsGetUsage","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"","responses":{"200":{"description":"UsageFunctions","schema":{"$ref":"#\/definitions\/usageFunctions"}}},"x-appwrite":{"method":"getUsage","weight":189,"cookies":false,"type":"","demo":"functions\/get-usage.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"functionId","description":"Function ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"range","description":"Date range.","required":false,"type":"string","x-example":"24h","default":"30d","in":"query"}]}},"\/health":{"get":{"summary":"Get HTTP","operationId":"healthGet","consumes":["application\/json"],"produces":["application\/json"],"tags":["health"],"description":"Check the Appwrite HTTP server is up and responsive.","responses":{"200":{"description":"Health Status","schema":{"$ref":"#\/definitions\/healthStatus"}}},"x-appwrite":{"method":"get","weight":105,"cookies":false,"type":"","demo":"health\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/anti-virus":{"get":{"summary":"Get Antivirus","operationId":"healthGetAntivirus","consumes":["application\/json"],"produces":["application\/json"],"tags":["health"],"description":"Check the Appwrite Antivirus server is up and connection is successful.","responses":{"200":{"description":"Health Antivirus","schema":{"$ref":"#\/definitions\/healthAntivirus"}}},"x-appwrite":{"method":"getAntivirus","weight":116,"cookies":false,"type":"","demo":"health\/get-antivirus.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-storage-anti-virus.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/cache":{"get":{"summary":"Get Cache","operationId":"healthGetCache","consumes":["application\/json"],"produces":["application\/json"],"tags":["health"],"description":"Check the Appwrite in-memory cache server is up and connection is successful.","responses":{"200":{"description":"Health Status","schema":{"$ref":"#\/definitions\/healthStatus"}}},"x-appwrite":{"method":"getCache","weight":108,"cookies":false,"type":"","demo":"health\/get-cache.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-cache.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/db":{"get":{"summary":"Get DB","operationId":"healthGetDB","consumes":["application\/json"],"produces":["application\/json"],"tags":["health"],"description":"Check the Appwrite database server is up and connection is successful.","responses":{"200":{"description":"Health Status","schema":{"$ref":"#\/definitions\/healthStatus"}}},"x-appwrite":{"method":"getDB","weight":107,"cookies":false,"type":"","demo":"health\/get-d-b.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-db.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/queue\/certificates":{"get":{"summary":"Get Certificates Queue","operationId":"healthGetQueueCertificates","consumes":["application\/json"],"produces":["application\/json"],"tags":["health"],"description":"Get the number of certificates that are waiting to be issued against [Letsencrypt](https:\/\/letsencrypt.org\/) in the Appwrite internal queue server.","responses":{"200":{"description":"Health Queue","schema":{"$ref":"#\/definitions\/healthQueue"}}},"x-appwrite":{"method":"getQueueCertificates","weight":113,"cookies":false,"type":"","demo":"health\/get-queue-certificates.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-certificates.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/queue\/functions":{"get":{"summary":"Get Functions Queue","operationId":"healthGetQueueFunctions","consumes":["application\/json"],"produces":["application\/json"],"tags":["health"],"description":"","responses":{"200":{"description":"Health Queue","schema":{"$ref":"#\/definitions\/healthQueue"}}},"x-appwrite":{"method":"getQueueFunctions","weight":114,"cookies":false,"type":"","demo":"health\/get-queue-functions.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-functions.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/queue\/logs":{"get":{"summary":"Get Logs Queue","operationId":"healthGetQueueLogs","consumes":["application\/json"],"produces":["application\/json"],"tags":["health"],"description":"Get the number of logs that are waiting to be processed in the Appwrite internal queue server.","responses":{"200":{"description":"Health Queue","schema":{"$ref":"#\/definitions\/healthQueue"}}},"x-appwrite":{"method":"getQueueLogs","weight":111,"cookies":false,"type":"","demo":"health\/get-queue-logs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-logs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/queue\/usage":{"get":{"summary":"Get Usage Queue","operationId":"healthGetQueueUsage","consumes":["application\/json"],"produces":["application\/json"],"tags":["health"],"description":"Get the number of usage stats that are waiting to be processed in the Appwrite internal queue server.","responses":{"200":{"description":"Health Queue","schema":{"$ref":"#\/definitions\/healthQueue"}}},"x-appwrite":{"method":"getQueueUsage","weight":112,"cookies":false,"type":"","demo":"health\/get-queue-usage.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-usage.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/queue\/webhooks":{"get":{"summary":"Get Webhooks Queue","operationId":"healthGetQueueWebhooks","consumes":["application\/json"],"produces":["application\/json"],"tags":["health"],"description":"Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server.","responses":{"200":{"description":"Health Queue","schema":{"$ref":"#\/definitions\/healthQueue"}}},"x-appwrite":{"method":"getQueueWebhooks","weight":110,"cookies":false,"type":"","demo":"health\/get-queue-webhooks.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-webhooks.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/storage\/local":{"get":{"summary":"Get Local Storage","operationId":"healthGetStorageLocal","consumes":["application\/json"],"produces":["application\/json"],"tags":["health"],"description":"Check the Appwrite local storage device is up and connection is successful.","responses":{"200":{"description":"Health Status","schema":{"$ref":"#\/definitions\/healthStatus"}}},"x-appwrite":{"method":"getStorageLocal","weight":115,"cookies":false,"type":"","demo":"health\/get-storage-local.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-storage-local.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/time":{"get":{"summary":"Get Time","operationId":"healthGetTime","consumes":["application\/json"],"produces":["application\/json"],"tags":["health"],"description":"Check the Appwrite server time is synced with Google remote NTP server. We use this technology to smoothly handle leap seconds with no disruptive events. The [Network Time Protocol](https:\/\/en.wikipedia.org\/wiki\/Network_Time_Protocol) (NTP) is used by hundreds of millions of computers and devices to synchronize their clocks over the Internet. If your computer sets its own clock, it likely uses NTP.","responses":{"200":{"description":"Health Time","schema":{"$ref":"#\/definitions\/healthTime"}}},"x-appwrite":{"method":"getTime","weight":109,"cookies":false,"type":"","demo":"health\/get-time.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-time.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/locale":{"get":{"summary":"Get User Locale","operationId":"localeGet","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"Get the current user location based on IP. Returns an object with user country code, country name, continent name, continent code, ip address and suggested currency. You can use the locale header to get the data in a supported language.\n\n([IP Geolocation by DB-IP](https:\/\/db-ip.com))","responses":{"200":{"description":"Locale","schema":{"$ref":"#\/definitions\/locale"}}},"x-appwrite":{"method":"get","weight":98,"cookies":false,"type":"","demo":"locale\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-locale.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}]}},"\/locale\/continents":{"get":{"summary":"List Continents","operationId":"localeGetContinents","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"List of all continents. You can use the locale header to get the data in a supported language.","responses":{"200":{"description":"Continents List","schema":{"$ref":"#\/definitions\/continentList"}}},"x-appwrite":{"method":"getContinents","weight":102,"cookies":false,"type":"","demo":"locale\/get-continents.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-continents.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}]}},"\/locale\/countries":{"get":{"summary":"List Countries","operationId":"localeGetCountries","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"List of all countries. You can use the locale header to get the data in a supported language.","responses":{"200":{"description":"Countries List","schema":{"$ref":"#\/definitions\/countryList"}}},"x-appwrite":{"method":"getCountries","weight":99,"cookies":false,"type":"","demo":"locale\/get-countries.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-countries.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}]}},"\/locale\/countries\/eu":{"get":{"summary":"List EU Countries","operationId":"localeGetCountriesEU","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"List of all countries that are currently members of the EU. You can use the locale header to get the data in a supported language.","responses":{"200":{"description":"Countries List","schema":{"$ref":"#\/definitions\/countryList"}}},"x-appwrite":{"method":"getCountriesEU","weight":100,"cookies":false,"type":"","demo":"locale\/get-countries-e-u.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-countries-eu.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}]}},"\/locale\/countries\/phones":{"get":{"summary":"List Countries Phone Codes","operationId":"localeGetCountriesPhones","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"List of all countries phone codes. You can use the locale header to get the data in a supported language.","responses":{"200":{"description":"Phones List","schema":{"$ref":"#\/definitions\/phoneList"}}},"x-appwrite":{"method":"getCountriesPhones","weight":101,"cookies":false,"type":"","demo":"locale\/get-countries-phones.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-countries-phones.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}]}},"\/locale\/currencies":{"get":{"summary":"List Currencies","operationId":"localeGetCurrencies","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"List of all currencies, including currency symbol, name, plural, and decimal digits for all major and minor currencies. You can use the locale header to get the data in a supported language.","responses":{"200":{"description":"Currencies List","schema":{"$ref":"#\/definitions\/currencyList"}}},"x-appwrite":{"method":"getCurrencies","weight":103,"cookies":false,"type":"","demo":"locale\/get-currencies.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-currencies.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}]}},"\/locale\/languages":{"get":{"summary":"List Languages","operationId":"localeGetLanguages","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"List of all languages classified by ISO 639-1 including 2-letter code, name in English, and name in the respective language.","responses":{"200":{"description":"Languages List","schema":{"$ref":"#\/definitions\/languageList"}}},"x-appwrite":{"method":"getLanguages","weight":104,"cookies":false,"type":"","demo":"locale\/get-languages.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-languages.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}]}},"\/projects":{"get":{"summary":"List Projects","operationId":"projectsList","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Projects List","schema":{"$ref":"#\/definitions\/projectList"}}},"x-appwrite":{"method":"list","weight":119,"cookies":false,"type":"","demo":"projects\/list.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Results offset. The default value is 0. Use this param to manage pagination. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"cursor","description":"ID of the project used as the starting point for the query, excluding the project itself. Should be used for efficient pagination when working with large sets of data. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"string","x-example":"[CURSOR]","default":"","in":"query"},{"name":"cursorDirection","description":"Direction of the cursor.","required":false,"type":"string","x-example":"after","default":"after","in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create Project","operationId":"projectsCreate","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"201":{"description":"Project","schema":{"$ref":"#\/definitions\/project"}}},"x-appwrite":{"method":"create","weight":118,"cookies":false,"type":"","demo":"projects\/create.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"projectId":{"type":"string","description":"Unique Id. Choose your own unique ID or pass the string `unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.","default":null,"x-example":"[PROJECT_ID]"},"name":{"type":"string","description":"Project name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"teamId":{"type":"string","description":"Team unique ID.","default":null,"x-example":"[TEAM_ID]"},"description":{"type":"string","description":"Project description. Max length: 256 chars.","default":"","x-example":"[DESCRIPTION]"},"logo":{"type":"string","description":"Project logo.","default":"","x-example":"[LOGO]"},"url":{"type":"string","description":"Project URL.","default":"","x-example":"https:\/\/example.com"},"legalName":{"type":"string","description":"Project legal Name. Max length: 256 chars.","default":"","x-example":"[LEGAL_NAME]"},"legalCountry":{"type":"string","description":"Project legal Country. Max length: 256 chars.","default":"","x-example":"[LEGAL_COUNTRY]"},"legalState":{"type":"string","description":"Project legal State. Max length: 256 chars.","default":"","x-example":"[LEGAL_STATE]"},"legalCity":{"type":"string","description":"Project legal City. Max length: 256 chars.","default":"","x-example":"[LEGAL_CITY]"},"legalAddress":{"type":"string","description":"Project legal Address. Max length: 256 chars.","default":"","x-example":"[LEGAL_ADDRESS]"},"legalTaxId":{"type":"string","description":"Project legal Tax ID. Max length: 256 chars.","default":"","x-example":"[LEGAL_TAX_ID]"}},"required":["projectId","name","teamId"]}}]}},"\/projects\/{projectId}":{"get":{"summary":"Get Project","operationId":"projectsGet","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Project","schema":{"$ref":"#\/definitions\/project"}}},"x-appwrite":{"method":"get","weight":120,"cookies":false,"type":"","demo":"projects\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"}]},"patch":{"summary":"Update Project","operationId":"projectsUpdate","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Project","schema":{"$ref":"#\/definitions\/project"}}},"x-appwrite":{"method":"update","weight":122,"cookies":false,"type":"","demo":"projects\/update.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Project name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"description":{"type":"string","description":"Project description. Max length: 256 chars.","default":"","x-example":"[DESCRIPTION]"},"logo":{"type":"string","description":"Project logo.","default":"","x-example":"[LOGO]"},"url":{"type":"string","description":"Project URL.","default":"","x-example":"https:\/\/example.com"},"legalName":{"type":"string","description":"Project legal name. Max length: 256 chars.","default":"","x-example":"[LEGAL_NAME]"},"legalCountry":{"type":"string","description":"Project legal country. Max length: 256 chars.","default":"","x-example":"[LEGAL_COUNTRY]"},"legalState":{"type":"string","description":"Project legal state. Max length: 256 chars.","default":"","x-example":"[LEGAL_STATE]"},"legalCity":{"type":"string","description":"Project legal city. Max length: 256 chars.","default":"","x-example":"[LEGAL_CITY]"},"legalAddress":{"type":"string","description":"Project legal address. Max length: 256 chars.","default":"","x-example":"[LEGAL_ADDRESS]"},"legalTaxId":{"type":"string","description":"Project legal tax ID. Max length: 256 chars.","default":"","x-example":"[LEGAL_TAX_ID]"}},"required":["name"]}}]},"delete":{"summary":"Delete Project","operationId":"projectsDelete","consumes":["application\/json"],"produces":[],"tags":["projects"],"description":"","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"delete","weight":127,"cookies":false,"type":"","demo":"projects\/delete.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"password":{"type":"string","description":"Your user password for confirmation. Must be at least 8 chars.","default":null,"x-example":"password"}},"required":["password"]}}]}},"\/projects\/{projectId}\/auth\/limit":{"patch":{"summary":"Update Project users limit","operationId":"projectsUpdateAuthLimit","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Project","schema":{"$ref":"#\/definitions\/project"}}},"x-appwrite":{"method":"updateAuthLimit","weight":125,"cookies":false,"type":"","demo":"projects\/update-auth-limit.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"limit":{"type":"integer","description":"Set the max number of users allowed in this project. Use 0 for unlimited.","default":null,"x-example":null}},"required":["limit"]}}]}},"\/projects\/{projectId}\/auth\/{method}":{"patch":{"summary":"Update Project auth method status. Use this endpoint to enable or disable a given auth method for this project.","operationId":"projectsUpdateAuthStatus","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Project","schema":{"$ref":"#\/definitions\/project"}}},"x-appwrite":{"method":"updateAuthStatus","weight":126,"cookies":false,"type":"","demo":"projects\/update-auth-status.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"method","description":"Auth Method. Possible values: email-password,magic-url,anonymous,invites,jwt,phone","required":true,"type":"string","x-example":"email-password","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"status":{"type":"boolean","description":"Set the status of this auth method.","default":null,"x-example":false}},"required":["status"]}}]}},"\/projects\/{projectId}\/domains":{"get":{"summary":"List Domains","operationId":"projectsListDomains","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Domains List","schema":{"$ref":"#\/definitions\/domainList"}}},"x-appwrite":{"method":"listDomains","weight":144,"cookies":false,"type":"","demo":"projects\/list-domains.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"}]},"post":{"summary":"Create Domain","operationId":"projectsCreateDomain","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"201":{"description":"Domain","schema":{"$ref":"#\/definitions\/domain"}}},"x-appwrite":{"method":"createDomain","weight":143,"cookies":false,"type":"","demo":"projects\/create-domain.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"domain":{"type":"string","description":"Domain name.","default":null,"x-example":null}},"required":["domain"]}}]}},"\/projects\/{projectId}\/domains\/{domainId}":{"get":{"summary":"Get Domain","operationId":"projectsGetDomain","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Domain","schema":{"$ref":"#\/definitions\/domain"}}},"x-appwrite":{"method":"getDomain","weight":145,"cookies":false,"type":"","demo":"projects\/get-domain.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"domainId","description":"Domain unique ID.","required":true,"type":"string","x-example":"[DOMAIN_ID]","in":"path"}]},"delete":{"summary":"Delete Domain","operationId":"projectsDeleteDomain","consumes":["application\/json"],"produces":[],"tags":["projects"],"description":"","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteDomain","weight":147,"cookies":false,"type":"","demo":"projects\/delete-domain.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"domainId","description":"Domain unique ID.","required":true,"type":"string","x-example":"[DOMAIN_ID]","in":"path"}]}},"\/projects\/{projectId}\/domains\/{domainId}\/verification":{"patch":{"summary":"Update Domain Verification Status","operationId":"projectsUpdateDomainVerification","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Domain","schema":{"$ref":"#\/definitions\/domain"}}},"x-appwrite":{"method":"updateDomainVerification","weight":146,"cookies":false,"type":"","demo":"projects\/update-domain-verification.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"domainId","description":"Domain unique ID.","required":true,"type":"string","x-example":"[DOMAIN_ID]","in":"path"}]}},"\/projects\/{projectId}\/keys":{"get":{"summary":"List Keys","operationId":"projectsListKeys","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"API Keys List","schema":{"$ref":"#\/definitions\/keyList"}}},"x-appwrite":{"method":"listKeys","weight":134,"cookies":false,"type":"","demo":"projects\/list-keys.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"}]},"post":{"summary":"Create Key","operationId":"projectsCreateKey","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"201":{"description":"Key","schema":{"$ref":"#\/definitions\/key"}}},"x-appwrite":{"method":"createKey","weight":133,"cookies":false,"type":"","demo":"projects\/create-key.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Key name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"scopes":{"type":"array","description":"Key scopes list.","default":null,"x-example":null,"items":{"type":"string"}}},"required":["name","scopes"]}}]}},"\/projects\/{projectId}\/keys\/{keyId}":{"get":{"summary":"Get Key","operationId":"projectsGetKey","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Key","schema":{"$ref":"#\/definitions\/key"}}},"x-appwrite":{"method":"getKey","weight":135,"cookies":false,"type":"","demo":"projects\/get-key.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"keyId","description":"Key unique ID.","required":true,"type":"string","x-example":"[KEY_ID]","in":"path"}]},"put":{"summary":"Update Key","operationId":"projectsUpdateKey","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Key","schema":{"$ref":"#\/definitions\/key"}}},"x-appwrite":{"method":"updateKey","weight":136,"cookies":false,"type":"","demo":"projects\/update-key.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"keyId","description":"Key unique ID.","required":true,"type":"string","x-example":"[KEY_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Key name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"scopes":{"type":"array","description":"Key scopes list","default":null,"x-example":null,"items":{"type":"string"}}},"required":["name","scopes"]}}]},"delete":{"summary":"Delete Key","operationId":"projectsDeleteKey","consumes":["application\/json"],"produces":[],"tags":["projects"],"description":"","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteKey","weight":137,"cookies":false,"type":"","demo":"projects\/delete-key.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"keyId","description":"Key unique ID.","required":true,"type":"string","x-example":"[KEY_ID]","in":"path"}]}},"\/projects\/{projectId}\/oauth2":{"patch":{"summary":"Update Project OAuth2","operationId":"projectsUpdateOAuth2","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Project","schema":{"$ref":"#\/definitions\/project"}}},"x-appwrite":{"method":"updateOAuth2","weight":124,"cookies":false,"type":"","demo":"projects\/update-o-auth2.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"provider":{"type":"string","description":"Provider Name","default":null,"x-example":"amazon"},"appId":{"type":"string","description":"Provider app ID. Max length: 256 chars.","default":"","x-example":"[APP_ID]"},"secret":{"type":"string","description":"Provider secret key. Max length: 512 chars.","default":"","x-example":"[SECRET]"}},"required":["provider"]}}]}},"\/projects\/{projectId}\/platforms":{"get":{"summary":"List Platforms","operationId":"projectsListPlatforms","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Platforms List","schema":{"$ref":"#\/definitions\/platformList"}}},"x-appwrite":{"method":"listPlatforms","weight":139,"cookies":false,"type":"","demo":"projects\/list-platforms.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"}]},"post":{"summary":"Create Platform","operationId":"projectsCreatePlatform","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"201":{"description":"Platform","schema":{"$ref":"#\/definitions\/platform"}}},"x-appwrite":{"method":"createPlatform","weight":138,"cookies":false,"type":"","demo":"projects\/create-platform.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"type":{"type":"string","description":"Platform type.","default":null,"x-example":"web"},"name":{"type":"string","description":"Platform name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"key":{"type":"string","description":"Package name for Android or bundle ID for iOS or macOS. Max length: 256 chars.","default":"","x-example":"[KEY]"},"store":{"type":"string","description":"App store or Google Play store ID. Max length: 256 chars.","default":"","x-example":"[STORE]"},"hostname":{"type":"string","description":"Platform client hostname. Max length: 256 chars.","default":"","x-example":"[HOSTNAME]"}},"required":["type","name"]}}]}},"\/projects\/{projectId}\/platforms\/{platformId}":{"get":{"summary":"Get Platform","operationId":"projectsGetPlatform","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Platform","schema":{"$ref":"#\/definitions\/platform"}}},"x-appwrite":{"method":"getPlatform","weight":140,"cookies":false,"type":"","demo":"projects\/get-platform.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"platformId","description":"Platform unique ID.","required":true,"type":"string","x-example":"[PLATFORM_ID]","in":"path"}]},"put":{"summary":"Update Platform","operationId":"projectsUpdatePlatform","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Platform","schema":{"$ref":"#\/definitions\/platform"}}},"x-appwrite":{"method":"updatePlatform","weight":141,"cookies":false,"type":"","demo":"projects\/update-platform.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"platformId","description":"Platform unique ID.","required":true,"type":"string","x-example":"[PLATFORM_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Platform name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"key":{"type":"string","description":"Package name for android or bundle ID for iOS. Max length: 256 chars.","default":"","x-example":"[KEY]"},"store":{"type":"string","description":"App store or Google Play store ID. Max length: 256 chars.","default":"","x-example":"[STORE]"},"hostname":{"type":"string","description":"Platform client URL. Max length: 256 chars.","default":"","x-example":"[HOSTNAME]"}},"required":["name"]}}]},"delete":{"summary":"Delete Platform","operationId":"projectsDeletePlatform","consumes":["application\/json"],"produces":[],"tags":["projects"],"description":"","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deletePlatform","weight":142,"cookies":false,"type":"","demo":"projects\/delete-platform.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"platformId","description":"Platform unique ID.","required":true,"type":"string","x-example":"[PLATFORM_ID]","in":"path"}]}},"\/projects\/{projectId}\/service":{"patch":{"summary":"Update service status","operationId":"projectsUpdateServiceStatus","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Project","schema":{"$ref":"#\/definitions\/project"}}},"x-appwrite":{"method":"updateServiceStatus","weight":123,"cookies":false,"type":"","demo":"projects\/update-service-status.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"service":{"type":"string","description":"Service name.","default":null,"x-example":"account"},"status":{"type":"boolean","description":"Service status.","default":null,"x-example":false}},"required":["service","status"]}}]}},"\/projects\/{projectId}\/usage":{"get":{"summary":"Get usage stats for a project","operationId":"projectsGetUsage","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"UsageProject","schema":{"$ref":"#\/definitions\/usageProject"}}},"x-appwrite":{"method":"getUsage","weight":121,"cookies":false,"type":"","demo":"projects\/get-usage.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"range","description":"Date range.","required":false,"type":"string","x-example":"24h","default":"30d","in":"query"}]}},"\/projects\/{projectId}\/webhooks":{"get":{"summary":"List Webhooks","operationId":"projectsListWebhooks","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Webhooks List","schema":{"$ref":"#\/definitions\/webhookList"}}},"x-appwrite":{"method":"listWebhooks","weight":129,"cookies":false,"type":"","demo":"projects\/list-webhooks.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"}]},"post":{"summary":"Create Webhook","operationId":"projectsCreateWebhook","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"201":{"description":"Webhook","schema":{"$ref":"#\/definitions\/webhook"}}},"x-appwrite":{"method":"createWebhook","weight":128,"cookies":false,"type":"","demo":"projects\/create-webhook.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Webhook name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"events":{"type":"array","description":"Events list.","default":null,"x-example":null,"items":{"type":"string"}},"url":{"type":"string","description":"Webhook URL.","default":null,"x-example":"https:\/\/example.com"},"security":{"type":"boolean","description":"Certificate verification, false for disabled or true for enabled.","default":null,"x-example":false},"httpUser":{"type":"string","description":"Webhook HTTP user. Max length: 256 chars.","default":"","x-example":"[HTTP_USER]"},"httpPass":{"type":"string","description":"Webhook HTTP password. Max length: 256 chars.","default":"","x-example":"[HTTP_PASS]"}},"required":["name","events","url","security"]}}]}},"\/projects\/{projectId}\/webhooks\/{webhookId}":{"get":{"summary":"Get Webhook","operationId":"projectsGetWebhook","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Webhook","schema":{"$ref":"#\/definitions\/webhook"}}},"x-appwrite":{"method":"getWebhook","weight":130,"cookies":false,"type":"","demo":"projects\/get-webhook.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"webhookId","description":"Webhook unique ID.","required":true,"type":"string","x-example":"[WEBHOOK_ID]","in":"path"}]},"put":{"summary":"Update Webhook","operationId":"projectsUpdateWebhook","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Webhook","schema":{"$ref":"#\/definitions\/webhook"}}},"x-appwrite":{"method":"updateWebhook","weight":131,"cookies":false,"type":"","demo":"projects\/update-webhook.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"webhookId","description":"Webhook unique ID.","required":true,"type":"string","x-example":"[WEBHOOK_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Webhook name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"events":{"type":"array","description":"Events list.","default":null,"x-example":null,"items":{"type":"string"}},"url":{"type":"string","description":"Webhook URL.","default":null,"x-example":"https:\/\/example.com"},"security":{"type":"boolean","description":"Certificate verification, false for disabled or true for enabled.","default":null,"x-example":false},"httpUser":{"type":"string","description":"Webhook HTTP user. Max length: 256 chars.","default":"","x-example":"[HTTP_USER]"},"httpPass":{"type":"string","description":"Webhook HTTP password. Max length: 256 chars.","default":"","x-example":"[HTTP_PASS]"}},"required":["name","events","url","security"]}}]},"delete":{"summary":"Delete Webhook","operationId":"projectsDeleteWebhook","consumes":["application\/json"],"produces":[],"tags":["projects"],"description":"","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteWebhook","weight":132,"cookies":false,"type":"","demo":"projects\/delete-webhook.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"webhookId","description":"Webhook unique ID.","required":true,"type":"string","x-example":"[WEBHOOK_ID]","in":"path"}]}},"\/storage\/files":{"get":{"summary":"List Files","operationId":"storageListFiles","consumes":["application\/json"],"produces":["application\/json"],"tags":["storage"],"description":"Get a list of all the user files. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project's files. [Learn more about different API modes](\/docs\/admin).","responses":{"200":{"description":"Files List","schema":{"$ref":"#\/definitions\/fileList"}}},"x-appwrite":{"method":"listFiles","weight":149,"cookies":false,"type":"","demo":"storage\/list-files.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/list-files.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Maximum number of files to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Offset value. The default value is 0. Use this param to manage pagination. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"cursor","description":"ID of the file used as the starting point for the query, excluding the file itself. Should be used for efficient pagination when working with large sets of data. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"string","x-example":"[CURSOR]","default":"","in":"query"},{"name":"cursorDirection","description":"Direction of the cursor.","required":false,"type":"string","x-example":"after","default":"after","in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create File","operationId":"storageCreateFile","consumes":["multipart\/form-data"],"produces":["application\/json"],"tags":["storage"],"description":"Create a new file. The user who creates the file will automatically be assigned to read and write access unless he has passed custom values for read and write arguments.","responses":{"201":{"description":"File","schema":{"$ref":"#\/definitions\/file"}}},"x-appwrite":{"method":"createFile","weight":148,"cookies":false,"type":"upload","demo":"storage\/create-file.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/create-file.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"fileId","description":"File ID. Choose your own unique ID or pass the string `unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.","required":true,"type":"string","x-example":"[FILE_ID]","in":"formData"},{"name":"file","description":"Binary file.","required":true,"type":"file","in":"formData"},{"name":"read","description":"An array of strings with read permissions. By default only the current user is granted with read permissions. [learn more about permissions](https:\/\/appwrite.io\/docs\/permissions) and get a full list of available permissions.","required":false,"type":"array","collectionFormat":"multi","items":{"type":"string"},"in":"formData"},{"name":"write","description":"An array of strings with write permissions. By default only the current user is granted with write permissions. [learn more about permissions](https:\/\/appwrite.io\/docs\/permissions) and get a full list of available permissions.","required":false,"type":"array","collectionFormat":"multi","items":{"type":"string"},"in":"formData"}]}},"\/storage\/files\/{fileId}":{"get":{"summary":"Get File","operationId":"storageGetFile","consumes":["application\/json"],"produces":["application\/json"],"tags":["storage"],"description":"Get a file by its unique ID. This endpoint response returns a JSON object with the file metadata.","responses":{"200":{"description":"File","schema":{"$ref":"#\/definitions\/file"}}},"x-appwrite":{"method":"getFile","weight":150,"cookies":false,"type":"","demo":"storage\/get-file.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/get-file.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"fileId","description":"File ID.","required":true,"type":"string","x-example":"[FILE_ID]","in":"path"}]},"put":{"summary":"Update File","operationId":"storageUpdateFile","consumes":["application\/json"],"produces":["application\/json"],"tags":["storage"],"description":"Update a file by its unique ID. Only users with write permissions have access to update this resource.","responses":{"200":{"description":"File","schema":{"$ref":"#\/definitions\/file"}}},"x-appwrite":{"method":"updateFile","weight":154,"cookies":false,"type":"","demo":"storage\/update-file.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/update-file.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"fileId","description":"File ID.","required":true,"type":"string","x-example":"[FILE_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"read":{"type":"array","description":"An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](https:\/\/appwrite.io\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}},"write":{"type":"array","description":"An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](https:\/\/appwrite.io\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}}},"required":["read","write"]}}]},"delete":{"summary":"Delete File","operationId":"storageDeleteFile","consumes":["application\/json"],"produces":[],"tags":["storage"],"description":"Delete a file by its unique ID. Only users with write permissions have access to delete this resource.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteFile","weight":155,"cookies":false,"type":"","demo":"storage\/delete-file.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/delete-file.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"fileId","description":"File ID.","required":true,"type":"string","x-example":"[FILE_ID]","in":"path"}]}},"\/storage\/files\/{fileId}\/download":{"get":{"summary":"Get File for Download","operationId":"storageGetFileDownload","consumes":["application\/json"],"produces":["*\/*"],"tags":["storage"],"description":"Get a file content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory.","responses":{"200":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getFileDownload","weight":152,"cookies":false,"type":"location","demo":"storage\/get-file-download.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/get-file-download.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"fileId","description":"File ID.","required":true,"type":"string","x-example":"[FILE_ID]","in":"path"}]}},"\/storage\/files\/{fileId}\/preview":{"get":{"summary":"Get File Preview","operationId":"storageGetFilePreview","consumes":["application\/json"],"produces":["image\/*"],"tags":["storage"],"description":"Get a file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets, will return the file icon image. You can also pass query string arguments for cutting and resizing your preview image.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getFilePreview","weight":151,"cookies":false,"type":"location","demo":"storage\/get-file-preview.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/get-file-preview.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"fileId","description":"File ID.","required":true,"type":"string","x-example":"[FILE_ID]","in":"path"},{"name":"width","description":"Resize preview image width, Pass an integer between 0 to 4000.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"height","description":"Resize preview image height, Pass an integer between 0 to 4000.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"gravity","description":"Image crop gravity. Can be one of center,top-left,top,top-right,left,right,bottom-left,bottom,bottom-right","required":false,"type":"string","x-example":"center","default":"center","in":"query"},{"name":"quality","description":"Preview image quality. Pass an integer between 0 to 100. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"borderWidth","description":"Preview image border in pixels. Pass an integer between 0 to 100. Defaults to 0.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"borderColor","description":"Preview image border color. Use a valid HEX color, no # is needed for prefix.","required":false,"type":"string","default":"","in":"query"},{"name":"borderRadius","description":"Preview image border radius in pixels. Pass an integer between 0 to 4000.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"opacity","description":"Preview image opacity. Only works with images having an alpha channel (like png). Pass a number between 0 to 1.","required":false,"type":"number","format":"float","x-example":0,"default":1,"in":"query"},{"name":"rotation","description":"Preview image rotation in degrees. Pass an integer between -360 and 360.","required":false,"type":"integer","format":"int32","x-example":-360,"default":0,"in":"query"},{"name":"background","description":"Preview image background color. Only works with transparent images (png). Use a valid HEX color, no # is needed for prefix.","required":false,"type":"string","default":"","in":"query"},{"name":"output","description":"Output format type (jpeg, jpg, png, gif and webp).","required":false,"type":"string","x-example":"jpg","default":"","in":"query"}]}},"\/storage\/files\/{fileId}\/view":{"get":{"summary":"Get File for View","operationId":"storageGetFileView","consumes":["application\/json"],"produces":["*\/*"],"tags":["storage"],"description":"Get a file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header.","responses":{"200":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getFileView","weight":153,"cookies":false,"type":"location","demo":"storage\/get-file-view.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/get-file-view.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"fileId","description":"File ID.","required":true,"type":"string","x-example":"[FILE_ID]","in":"path"}]}},"\/storage\/usage":{"get":{"summary":"Get usage stats for storage","operationId":"storageGetUsage","consumes":["application\/json"],"produces":["application\/json"],"tags":["storage"],"description":"","responses":{"200":{"description":"StorageUsage","schema":{"$ref":"#\/definitions\/usageStorage"}}},"x-appwrite":{"method":"getUsage","weight":156,"cookies":false,"type":"","demo":"storage\/get-usage.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"range","description":"Date range.","required":false,"type":"string","x-example":"24h","default":"30d","in":"query"}]}},"\/storage\/{bucketId}\/usage":{"get":{"summary":"Get usage stats for a storage bucket","operationId":"storageGetBucketUsage","consumes":["application\/json"],"produces":["application\/json"],"tags":["storage"],"description":"","responses":{"200":{"description":"UsageBuckets","schema":{"$ref":"#\/definitions\/usageBuckets"}}},"x-appwrite":{"method":"getBucketUsage","weight":157,"cookies":false,"type":"","demo":"storage\/get-bucket-usage.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"bucketId","description":"Bucket ID.","required":true,"type":"string","x-example":"[BUCKET_ID]","in":"path"},{"name":"range","description":"Date range.","required":false,"type":"string","x-example":"24h","default":"30d","in":"query"}]}},"\/teams":{"get":{"summary":"List Teams","operationId":"teamsList","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Get a list of all the teams in which the current user is a member. You can use the parameters to filter your results.\r\n\r\nIn admin mode, this endpoint returns a list of all the teams in the current project. [Learn more about different API modes](\/docs\/admin).","responses":{"200":{"description":"Teams List","schema":{"$ref":"#\/definitions\/teamList"}}},"x-appwrite":{"method":"list","weight":159,"cookies":false,"type":"","demo":"teams\/list.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/list-teams.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Maximum number of teams to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Offset value. The default value is 0. Use this param to manage pagination. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"cursor","description":"ID of the team used as the starting point for the query, excluding the team itself. Should be used for efficient pagination when working with large sets of data. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"string","x-example":"[CURSOR]","default":"","in":"query"},{"name":"cursorDirection","description":"Direction of the cursor.","required":false,"type":"string","x-example":"after","default":"after","in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create Team","operationId":"teamsCreate","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Create a new team. The user who creates the team will automatically be assigned as the owner of the team. Only the users with the owner role can invite new members, add new owners and delete or update the team.","responses":{"201":{"description":"Team","schema":{"$ref":"#\/definitions\/team"}}},"x-appwrite":{"method":"create","weight":158,"cookies":false,"type":"","demo":"teams\/create.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/create-team.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"teamId":{"type":"string","description":"Team ID. Choose your own unique ID or pass the string `unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.","default":null,"x-example":"[TEAM_ID]"},"name":{"type":"string","description":"Team name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"roles":{"type":"array","description":"Array of strings. Use this param to set the roles in the team for the user who created it. The default role is **owner**. A role can be any string. Learn more about [roles and permissions](\/docs\/permissions). Max length for each role is 32 chars.","default":["owner"],"x-example":null,"items":{"type":"string"}}},"required":["teamId","name"]}}]}},"\/teams\/{teamId}":{"get":{"summary":"Get Team","operationId":"teamsGet","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Get a team by its ID. All team members have read access for this resource.","responses":{"200":{"description":"Team","schema":{"$ref":"#\/definitions\/team"}}},"x-appwrite":{"method":"get","weight":160,"cookies":false,"type":"","demo":"teams\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/get-team.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"}]},"put":{"summary":"Update Team","operationId":"teamsUpdate","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Update a team using its ID. Only members with the owner role can update the team.","responses":{"200":{"description":"Team","schema":{"$ref":"#\/definitions\/team"}}},"x-appwrite":{"method":"update","weight":161,"cookies":false,"type":"","demo":"teams\/update.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/update-team.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"New team name. Max length: 128 chars.","default":null,"x-example":"[NAME]"}},"required":["name"]}}]},"delete":{"summary":"Delete Team","operationId":"teamsDelete","consumes":["application\/json"],"produces":[],"tags":["teams"],"description":"Delete a team using its ID. Only team members with the owner role can delete the team.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"delete","weight":162,"cookies":false,"type":"","demo":"teams\/delete.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/delete-team.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"}]}},"\/teams\/{teamId}\/memberships":{"get":{"summary":"Get Team Memberships","operationId":"teamsGetMemberships","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Use this endpoint to list a team's members using the team's ID. All team members have read access to this endpoint.","responses":{"200":{"description":"Memberships List","schema":{"$ref":"#\/definitions\/membershipList"}}},"x-appwrite":{"method":"getMemberships","weight":164,"cookies":false,"type":"","demo":"teams\/get-memberships.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/get-team-members.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"},{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Maximum number of memberships to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Offset value. The default value is 0. Use this value to manage pagination. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"cursor","description":"ID of the membership used as the starting point for the query, excluding the membership itself. Should be used for efficient pagination when working with large sets of data. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"string","x-example":"[CURSOR]","default":"","in":"query"},{"name":"cursorDirection","description":"Direction of the cursor.","required":false,"type":"string","x-example":"after","default":"after","in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create Team Membership","operationId":"teamsCreateMembership","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Invite a new member to join your team. If initiated from the client SDK, an email with a link to join the team will be sent to the member's email address and an account will be created for them should they not be signed up already. If initiated from server-side SDKs, the new member will automatically be added to the team.\n\nUse the 'url' parameter to redirect the user from the invitation email back to your app. When the user is redirected, use the [Update Team Membership Status](\/docs\/client\/teams#teamsUpdateMembershipStatus) endpoint to allow the user to accept the invitation to the team. \n\nPlease note that to avoid a [Redirect Attack](https:\/\/github.com\/OWASP\/CheatSheetSeries\/blob\/master\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URL's are the once from domains you have set when adding your platforms in the console interface.","responses":{"201":{"description":"Membership","schema":{"$ref":"#\/definitions\/membership"}}},"x-appwrite":{"method":"createMembership","weight":163,"cookies":false,"type":"","demo":"teams\/create-membership.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/create-team-membership.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"email":{"type":"string","description":"Email of the new team member.","default":null,"x-example":"email@example.com"},"roles":{"type":"array","description":"Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](\/docs\/permissions). Max length for each role is 32 chars.","default":null,"x-example":null,"items":{"type":"string"}},"url":{"type":"string","description":"URL to redirect the user back to your app from the invitation email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.","default":null,"x-example":"https:\/\/example.com"},"name":{"type":"string","description":"Name of the new team member. Max length: 128 chars.","default":"","x-example":"[NAME]"}},"required":["email","roles","url"]}}]}},"\/teams\/{teamId}\/memberships\/{membershipId}":{"get":{"summary":"Get Team Membership","operationId":"teamsGetMembership","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Get a team member by the membership unique id. All team members have read access for this resource.","responses":{"200":{"description":"Memberships List","schema":{"$ref":"#\/definitions\/membershipList"}}},"x-appwrite":{"method":"getMembership","weight":165,"cookies":false,"type":"","demo":"teams\/get-membership.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/get-team-member.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"},{"name":"membershipId","description":"Membership ID.","required":true,"type":"string","x-example":"[MEMBERSHIP_ID]","in":"path"}]},"patch":{"summary":"Update Membership Roles","operationId":"teamsUpdateMembershipRoles","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Modify the roles of a team member. Only team members with the owner role have access to this endpoint. Learn more about [roles and permissions](\/docs\/permissions).","responses":{"200":{"description":"Membership","schema":{"$ref":"#\/definitions\/membership"}}},"x-appwrite":{"method":"updateMembershipRoles","weight":166,"cookies":false,"type":"","demo":"teams\/update-membership-roles.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/update-team-membership-roles.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"},{"name":"membershipId","description":"Membership ID.","required":true,"type":"string","x-example":"[MEMBERSHIP_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"roles":{"type":"array","description":"An array of strings. Use this param to set the user's roles in the team. A role can be any string. Learn more about [roles and permissions](https:\/\/appwrite.io\/docs\/permissions). Max length for each role is 32 chars.","default":null,"x-example":null,"items":{"type":"string"}}},"required":["roles"]}}]},"delete":{"summary":"Delete Team Membership","operationId":"teamsDeleteMembership","consumes":["application\/json"],"produces":[],"tags":["teams"],"description":"This endpoint allows a user to leave a team or for a team owner to delete the membership of any other team member. You can also use this endpoint to delete a user membership even if it is not accepted.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteMembership","weight":168,"cookies":false,"type":"","demo":"teams\/delete-membership.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/delete-team-membership.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"},{"name":"membershipId","description":"Membership ID.","required":true,"type":"string","x-example":"[MEMBERSHIP_ID]","in":"path"}]}},"\/teams\/{teamId}\/memberships\/{membershipId}\/status":{"patch":{"summary":"Update Team Membership Status","operationId":"teamsUpdateMembershipStatus","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Use this endpoint to allow a user to accept an invitation to join a team after being redirected back to your app from the invitation email received by the user.","responses":{"200":{"description":"Membership","schema":{"$ref":"#\/definitions\/membership"}}},"x-appwrite":{"method":"updateMembershipStatus","weight":167,"cookies":false,"type":"","demo":"teams\/update-membership-status.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/update-team-membership-status.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"public","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"},{"name":"membershipId","description":"Membership ID.","required":true,"type":"string","x-example":"[MEMBERSHIP_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"userId":{"type":"string","description":"User ID.","default":null,"x-example":"[USER_ID]"},"secret":{"type":"string","description":"Secret key.","default":null,"x-example":"[SECRET]"}},"required":["userId","secret"]}}]}},"\/users":{"get":{"summary":"List Users","operationId":"usersList","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Get a list of all the project's users. You can use the query params to filter your results.","responses":{"200":{"description":"Users List","schema":{"$ref":"#\/definitions\/userList"}}},"x-appwrite":{"method":"list","weight":170,"cookies":false,"type":"","demo":"users\/list.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/list-users.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Maximum number of users to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Offset value. The default value is 0. Use this param to manage pagination. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"cursor","description":"ID of the user used as the starting point for the query, excluding the user itself. Should be used for efficient pagination when working with large sets of data. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"string","x-example":"[CURSOR]","default":"","in":"query"},{"name":"cursorDirection","description":"Direction of the cursor.","required":false,"type":"string","x-example":"after","default":"after","in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create User","operationId":"usersCreate","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Create a new user.","responses":{"201":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"create","weight":169,"cookies":false,"type":"","demo":"users\/create.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/create-user.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"userId":{"type":"string","description":"User ID. Choose your own unique ID or pass the string `unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.","default":null,"x-example":"[USER_ID]"},"email":{"type":"string","description":"User email.","default":null,"x-example":"email@example.com"},"password":{"type":"string","description":"User password. Must be at least 8 chars.","default":null,"x-example":"password"},"name":{"type":"string","description":"User name. Max length: 128 chars.","default":"","x-example":"[NAME]"}},"required":["userId","email","password"]}}]}},"\/users\/usage":{"get":{"summary":"Get usage stats for the users API","operationId":"usersGetUsage","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"","responses":{"200":{"description":"UsageUsers","schema":{"$ref":"#\/definitions\/usageUsers"}}},"x-appwrite":{"method":"getUsage","weight":184,"cookies":false,"type":"","demo":"users\/get-usage.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"range","description":"Date range.","required":false,"type":"string","x-example":"24h","default":"30d","in":"query"},{"name":"provider","description":"Provider Name.","required":false,"type":"string","x-example":"email","default":"","in":"query"}]}},"\/users\/{userId}":{"get":{"summary":"Get User","operationId":"usersGet","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Get a user by its unique ID.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"get","weight":171,"cookies":false,"type":"","demo":"users\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/get-user.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"}]},"delete":{"summary":"Delete User","operationId":"usersDelete","consumes":["application\/json"],"produces":[],"tags":["users"],"description":"Delete a user by its unique ID.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"delete","weight":183,"cookies":false,"type":"","demo":"users\/delete.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/delete.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"}]}},"\/users\/{userId}\/email":{"patch":{"summary":"Update Email","operationId":"usersUpdateEmail","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Update the user email by its unique ID.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updateEmail","weight":179,"cookies":false,"type":"","demo":"users\/update-email.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/update-user-email.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"email":{"type":"string","description":"User email.","default":null,"x-example":"email@example.com"}},"required":["email"]}}]}},"\/users\/{userId}\/logs":{"get":{"summary":"Get User Logs","operationId":"usersGetLogs","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Get the user activity logs list by its unique ID.","responses":{"200":{"description":"Logs List","schema":{"$ref":"#\/definitions\/logList"}}},"x-appwrite":{"method":"getLogs","weight":174,"cookies":false,"type":"","demo":"users\/get-logs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/get-user-logs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"},{"name":"limit","description":"Maximum number of logs to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Offset value. The default value is 0. Use this value to manage pagination. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"}]}},"\/users\/{userId}\/name":{"patch":{"summary":"Update Name","operationId":"usersUpdateName","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Update the user name by its unique ID.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updateName","weight":177,"cookies":false,"type":"","demo":"users\/update-name.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/update-user-name.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"User name. Max length: 128 chars.","default":null,"x-example":"[NAME]"}},"required":["name"]}}]}},"\/users\/{userId}\/password":{"patch":{"summary":"Update Password","operationId":"usersUpdatePassword","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Update the user password by its unique ID.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updatePassword","weight":178,"cookies":false,"type":"","demo":"users\/update-password.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/update-user-password.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"password":{"type":"string","description":"New user password. Must be at least 8 chars.","default":null,"x-example":"password"}},"required":["password"]}}]}},"\/users\/{userId}\/prefs":{"get":{"summary":"Get User Preferences","operationId":"usersGetPrefs","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Get the user preferences by its unique ID.","responses":{"200":{"description":"Preferences","schema":{"$ref":"#\/definitions\/preferences"}}},"x-appwrite":{"method":"getPrefs","weight":172,"cookies":false,"type":"","demo":"users\/get-prefs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/get-user-prefs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"}]},"patch":{"summary":"Update User Preferences","operationId":"usersUpdatePrefs","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Update the user preferences by its unique ID. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded.","responses":{"200":{"description":"Preferences","schema":{"$ref":"#\/definitions\/preferences"}}},"x-appwrite":{"method":"updatePrefs","weight":180,"cookies":false,"type":"","demo":"users\/update-prefs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/update-user-prefs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"prefs":{"type":"object","description":"Prefs key-value JSON object.","default":{},"x-example":"{}"}},"required":["prefs"]}}]}},"\/users\/{userId}\/sessions":{"get":{"summary":"Get User Sessions","operationId":"usersGetSessions","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Get the user sessions list by its unique ID.","responses":{"200":{"description":"Sessions List","schema":{"$ref":"#\/definitions\/sessionList"}}},"x-appwrite":{"method":"getSessions","weight":173,"cookies":false,"type":"","demo":"users\/get-sessions.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/get-user-sessions.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"}]},"delete":{"summary":"Delete User Sessions","operationId":"usersDeleteSessions","consumes":["application\/json"],"produces":[],"tags":["users"],"description":"Delete all user's sessions by using the user's unique ID.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteSessions","weight":182,"cookies":false,"type":"","demo":"users\/delete-sessions.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/delete-user-sessions.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"}]}},"\/users\/{userId}\/sessions\/{sessionId}":{"delete":{"summary":"Delete User Session","operationId":"usersDeleteSession","consumes":["application\/json"],"produces":[],"tags":["users"],"description":"Delete a user sessions by its unique ID.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteSession","weight":181,"cookies":false,"type":"","demo":"users\/delete-session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/delete-user-session.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"},{"name":"sessionId","description":"Session ID.","required":true,"type":"string","x-example":"[SESSION_ID]","in":"path"}]}},"\/users\/{userId}\/status":{"patch":{"summary":"Update User Status","operationId":"usersUpdateStatus","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Update the user status by its unique ID.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updateStatus","weight":175,"cookies":false,"type":"","demo":"users\/update-status.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/update-user-status.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"status":{"type":"boolean","description":"User Status. To activate the user pass `true` and to block the user pass `false`.","default":null,"x-example":false}},"required":["status"]}}]}},"\/users\/{userId}\/verification":{"patch":{"summary":"Update Email Verification","operationId":"usersUpdateVerification","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Update the user email verification status by its unique ID.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updateVerification","weight":176,"cookies":false,"type":"","demo":"users\/update-verification.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/update-user-verification.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"emailVerification":{"type":"boolean","description":"User email verification status.","default":null,"x-example":false}},"required":["emailVerification"]}}]}}},"tags":[{"name":"account","description":"The Account service allows you to authenticate and manage a user account."},{"name":"avatars","description":"The Avatars service aims to help you complete everyday tasks related to your app image, icons, and avatars."},{"name":"database","description":"The Database service allows you to create structured collections of documents, query and filter lists of documents"},{"name":"locale","description":"The Locale service allows you to customize your app based on your users' location."},{"name":"health","description":"The Health service allows you to both validate and monitor your Appwrite server's health."},{"name":"projects","description":"The Project service allows you to manage all the projects in your Appwrite server."},{"name":"storage","description":"The Storage service allows you to manage your project files."},{"name":"teams","description":"The Teams service allows you to group users of your project and to enable them to share read and write access to your project resources"},{"name":"users","description":"The Users service allows you to manage your project users."},{"name":"functions","description":"The Functions Service allows you view, create and manage your Cloud Functions."}],"definitions":{"collectionList":{"description":"Collections List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"collections":{"type":"array","description":"List of collections.","items":{"type":"object","$ref":"#\/definitions\/collection"},"x-example":""}},"required":["sum","collections"]},"indexList":{"description":"Indexes List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"indexes":{"type":"array","description":"List of indexes.","items":{"type":"object","$ref":"#\/definitions\/index"},"x-example":""}},"required":["sum","indexes"]},"documentList":{"description":"Documents List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"documents":{"type":"array","description":"List of documents.","items":{"type":"object","$ref":"#\/definitions\/document"},"x-example":""}},"required":["sum","documents"]},"userList":{"description":"Users List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"users":{"type":"array","description":"List of users.","items":{"type":"object","$ref":"#\/definitions\/user"},"x-example":""}},"required":["sum","users"]},"sessionList":{"description":"Sessions List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"sessions":{"type":"array","description":"List of sessions.","items":{"type":"object","$ref":"#\/definitions\/session"},"x-example":""}},"required":["sum","sessions"]},"logList":{"description":"Logs List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"logs":{"type":"array","description":"List of logs.","items":{"type":"object","$ref":"#\/definitions\/log"},"x-example":""}},"required":["sum","logs"]},"fileList":{"description":"Files List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"files":{"type":"array","description":"List of files.","items":{"type":"object","$ref":"#\/definitions\/file"},"x-example":""}},"required":["sum","files"]},"teamList":{"description":"Teams List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"teams":{"type":"array","description":"List of teams.","items":{"type":"object","$ref":"#\/definitions\/team"},"x-example":""}},"required":["sum","teams"]},"membershipList":{"description":"Memberships List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"memberships":{"type":"array","description":"List of memberships.","items":{"type":"object","$ref":"#\/definitions\/membership"},"x-example":""}},"required":["sum","memberships"]},"functionList":{"description":"Functions List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"functions":{"type":"array","description":"List of functions.","items":{"type":"object","$ref":"#\/definitions\/function"},"x-example":""}},"required":["sum","functions"]},"runtimeList":{"description":"Runtimes List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"runtimes":{"type":"array","description":"List of runtimes.","items":{"type":"object","$ref":"#\/definitions\/runtime"},"x-example":""}},"required":["sum","runtimes"]},"tagList":{"description":"Tags List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"tags":{"type":"array","description":"List of tags.","items":{"type":"object","$ref":"#\/definitions\/tag"},"x-example":""}},"required":["sum","tags"]},"executionList":{"description":"Executions List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"executions":{"type":"array","description":"List of executions.","items":{"type":"object","$ref":"#\/definitions\/execution"},"x-example":""}},"required":["sum","executions"]},"projectList":{"description":"Projects List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"projects":{"type":"array","description":"List of projects.","items":{"type":"object","$ref":"#\/definitions\/project"},"x-example":""}},"required":["sum","projects"]},"webhookList":{"description":"Webhooks List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"webhooks":{"type":"array","description":"List of webhooks.","items":{"type":"object","$ref":"#\/definitions\/webhook"},"x-example":""}},"required":["sum","webhooks"]},"keyList":{"description":"API Keys List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"keys":{"type":"array","description":"List of keys.","items":{"type":"object","$ref":"#\/definitions\/key"},"x-example":""}},"required":["sum","keys"]},"platformList":{"description":"Platforms List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"platforms":{"type":"array","description":"List of platforms.","items":{"type":"object","$ref":"#\/definitions\/platform"},"x-example":""}},"required":["sum","platforms"]},"domainList":{"description":"Domains List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"domains":{"type":"array","description":"List of domains.","items":{"type":"object","$ref":"#\/definitions\/domain"},"x-example":""}},"required":["sum","domains"]},"countryList":{"description":"Countries List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"countries":{"type":"array","description":"List of countries.","items":{"type":"object","$ref":"#\/definitions\/country"},"x-example":""}},"required":["sum","countries"]},"continentList":{"description":"Continents List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"continents":{"type":"array","description":"List of continents.","items":{"type":"object","$ref":"#\/definitions\/continent"},"x-example":""}},"required":["sum","continents"]},"languageList":{"description":"Languages List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"languages":{"type":"array","description":"List of languages.","items":{"type":"object","$ref":"#\/definitions\/language"},"x-example":""}},"required":["sum","languages"]},"currencyList":{"description":"Currencies List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"currencies":{"type":"array","description":"List of currencies.","items":{"type":"object","$ref":"#\/definitions\/currency"},"x-example":""}},"required":["sum","currencies"]},"phoneList":{"description":"Phones List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"phones":{"type":"array","description":"List of phones.","items":{"type":"object","$ref":"#\/definitions\/phone"},"x-example":""}},"required":["sum","phones"]},"metricList":{"description":"Metric List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"metrics":{"type":"array","description":"List of metrics.","items":{"type":"object","$ref":"#\/definitions\/metric"},"x-example":""}},"required":["sum","metrics"]},"collection":{"description":"Collection","type":"object","properties":{"$id":{"type":"string","description":"Collection ID.","x-example":"5e5ea5c16897e"},"$read":{"type":"array","description":"Collection read permissions.","items":{"type":"string"},"x-example":"role:all"},"$write":{"type":"array","description":"Collection write permissions.","items":{"type":"string"},"x-example":"user:608f9da25e7e1"},"name":{"type":"string","description":"Collection name.","x-example":"My Collection"},"enabled":{"type":"boolean","description":"Collection enabled.","x-example":false},"permission":{"type":"string","description":"Collection permission model. Possible values: `document` or `collection`","x-example":"document"},"attributes":{"type":"array","description":"Collection attributes.","items":{"x-anyOf":[{"$ref":"#\/definitions\/attributeBoolean"},{"$ref":"#\/definitions\/attributeInteger"},{"$ref":"#\/definitions\/attributeFloat"},{"$ref":"#\/definitions\/attributeEmail"},{"$ref":"#\/definitions\/attributeEnum"},{"$ref":"#\/definitions\/attributeUrl"},{"$ref":"#\/definitions\/attributeIp"},{"$ref":"#\/definitions\/attributeString"}]},"x-example":{}},"indexes":{"type":"array","description":"Collection indexes.","items":{"type":"object","$ref":"#\/definitions\/index"},"x-example":{}}},"required":["$id","$read","$write","name","enabled","permission","attributes","indexes"]},"attributeList":{"description":"Attributes List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"attributes":{"type":"array","description":"List of attributes.","items":{"x-anyOf":[{"$ref":"#\/definitions\/attributeBoolean"},{"$ref":"#\/definitions\/attributeInteger"},{"$ref":"#\/definitions\/attributeFloat"},{"$ref":"#\/definitions\/attributeEmail"},{"$ref":"#\/definitions\/attributeEnum"},{"$ref":"#\/definitions\/attributeUrl"},{"$ref":"#\/definitions\/attributeIp"},{"$ref":"#\/definitions\/attributeString"}]},"x-example":""}},"required":["sum","attributes"]},"attributeString":{"description":"AttributeString","type":"object","properties":{"key":{"type":"string","description":"Attribute Key.","x-example":"fullName"},"type":{"type":"string","description":"Attribute type.","x-example":"string"},"status":{"type":"string","description":"Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed`","x-example":"available"},"required":{"type":"boolean","description":"Is attribute required?","x-example":true},"array":{"type":"boolean","description":"Is attribute an array?","x-example":false,"x-nullable":true},"size":{"type":"integer","description":"Attribute size.","x-example":128,"format":"int32"},"default":{"type":"string","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","x-example":"default","x-nullable":true}},"required":["key","type","status","required","size"]},"attributeInteger":{"description":"AttributeInteger","type":"object","properties":{"key":{"type":"string","description":"Attribute Key.","x-example":"fullName"},"type":{"type":"string","description":"Attribute type.","x-example":"string"},"status":{"type":"string","description":"Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed`","x-example":"available"},"required":{"type":"boolean","description":"Is attribute required?","x-example":true},"array":{"type":"boolean","description":"Is attribute an array?","x-example":false,"x-nullable":true},"min":{"type":"integer","description":"Minimum value to enforce for new documents.","x-example":1,"format":"int32","x-nullable":true},"max":{"type":"integer","description":"Maximum value to enforce for new documents.","x-example":10,"format":"int32","x-nullable":true},"default":{"type":"integer","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","x-example":10,"format":"int32","x-nullable":true}},"required":["key","type","status","required"]},"attributeFloat":{"description":"AttributeFloat","type":"object","properties":{"key":{"type":"string","description":"Attribute Key.","x-example":"fullName"},"type":{"type":"string","description":"Attribute type.","x-example":"string"},"status":{"type":"string","description":"Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed`","x-example":"available"},"required":{"type":"boolean","description":"Is attribute required?","x-example":true},"array":{"type":"boolean","description":"Is attribute an array?","x-example":false,"x-nullable":true},"min":{"type":"number","description":"Minimum value to enforce for new documents.","x-example":1.5,"format":"double","x-nullable":true},"max":{"type":"number","description":"Maximum value to enforce for new documents.","x-example":10.5,"format":"double","x-nullable":true},"default":{"type":"number","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","x-example":2.5,"format":"double","x-nullable":true}},"required":["key","type","status","required"]},"attributeBoolean":{"description":"AttributeBoolean","type":"object","properties":{"key":{"type":"string","description":"Attribute Key.","x-example":"fullName"},"type":{"type":"string","description":"Attribute type.","x-example":"string"},"status":{"type":"string","description":"Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed`","x-example":"available"},"required":{"type":"boolean","description":"Is attribute required?","x-example":true},"array":{"type":"boolean","description":"Is attribute an array?","x-example":false,"x-nullable":true},"default":{"type":"boolean","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","x-example":false,"x-nullable":true}},"required":["key","type","status","required"]},"attributeEmail":{"description":"AttributeEmail","type":"object","properties":{"key":{"type":"string","description":"Attribute Key.","x-example":"fullName"},"type":{"type":"string","description":"Attribute type.","x-example":"string"},"status":{"type":"string","description":"Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed`","x-example":"available"},"required":{"type":"boolean","description":"Is attribute required?","x-example":true},"array":{"type":"boolean","description":"Is attribute an array?","x-example":false,"x-nullable":true},"format":{"type":"string","description":"String format.","x-example":"email"},"default":{"type":"string","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","x-example":"default@example.com","x-nullable":true}},"required":["key","type","status","required","format"]},"attributeEnum":{"description":"AttributeEnum","type":"object","properties":{"key":{"type":"string","description":"Attribute Key.","x-example":"fullName"},"type":{"type":"string","description":"Attribute type.","x-example":"string"},"status":{"type":"string","description":"Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed`","x-example":"available"},"required":{"type":"boolean","description":"Is attribute required?","x-example":true},"array":{"type":"boolean","description":"Is attribute an array?","x-example":false,"x-nullable":true},"elements":{"type":"array","description":"Array of elements in enumerated type.","items":{"type":"string"},"x-example":"element"},"format":{"type":"string","description":"String format.","x-example":"enum"},"default":{"type":"string","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","x-example":"element","x-nullable":true}},"required":["key","type","status","required","elements","format"]},"attributeIp":{"description":"AttributeIP","type":"object","properties":{"key":{"type":"string","description":"Attribute Key.","x-example":"fullName"},"type":{"type":"string","description":"Attribute type.","x-example":"string"},"status":{"type":"string","description":"Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed`","x-example":"available"},"required":{"type":"boolean","description":"Is attribute required?","x-example":true},"array":{"type":"boolean","description":"Is attribute an array?","x-example":false,"x-nullable":true},"format":{"type":"string","description":"String format.","x-example":"ip"},"default":{"type":"string","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","x-example":"192.0.2.0","x-nullable":true}},"required":["key","type","status","required","format"]},"attributeUrl":{"description":"AttributeURL","type":"object","properties":{"key":{"type":"string","description":"Attribute Key.","x-example":"fullName"},"type":{"type":"string","description":"Attribute type.","x-example":"string"},"status":{"type":"string","description":"Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed`","x-example":"available"},"required":{"type":"boolean","description":"Is attribute required?","x-example":true},"array":{"type":"boolean","description":"Is attribute an array?","x-example":false,"x-nullable":true},"format":{"type":"string","description":"String format.","x-example":"url"},"default":{"type":"string","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","x-example":"http:\/\/example.com","x-nullable":true}},"required":["key","type","status","required","format"]},"index":{"description":"Index","type":"object","properties":{"key":{"type":"string","description":"Index Key.","x-example":"index1"},"type":{"type":"string","description":"Index type.","x-example":"primary"},"status":{"type":"string","description":"Index status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed`","x-example":"available"},"attributes":{"type":"array","description":"Index attributes.","items":{"type":"string"},"x-example":[]},"orders":{"type":"array","description":"Index orders.","items":{"type":"string"},"x-example":[]}},"required":["key","type","status","attributes","orders"]},"document":{"description":"Document","type":"object","properties":{"$id":{"type":"string","description":"Document ID.","x-example":"5e5ea5c16897e"},"$collection":{"type":"string","description":"Collection ID.","x-example":"5e5ea5c15117e"},"$read":{"type":"array","description":"Document read permissions.","items":{"type":"string"},"x-example":"role:all"},"$write":{"type":"array","description":"Document write permissions.","items":{"type":"string"},"x-example":"user:608f9da25e7e1"}},"additionalProperties":true,"required":["$id","$collection","$read","$write"]},"log":{"description":"Log","type":"object","properties":{"event":{"type":"string","description":"Event name.","x-example":"account.sessions.create"},"userId":{"type":"string","description":"User ID.","x-example":"610fc2f985ee0"},"userEmail":{"type":"string","description":"User Email.","x-example":"john@appwrite.io"},"userName":{"type":"string","description":"User Name.","x-example":"John Doe"},"mode":{"type":"string","description":"API mode when event triggered.","x-example":"admin"},"ip":{"type":"string","description":"IP session in use when the session was created.","x-example":"127.0.0.1"},"time":{"type":"integer","description":"Log creation time in Unix timestamp.","x-example":1592981250,"format":"int32"},"osCode":{"type":"string","description":"Operating system code name. View list of [available options](https:\/\/github.com\/appwrite\/appwrite\/blob\/master\/docs\/lists\/os.json).","x-example":"Mac"},"osName":{"type":"string","description":"Operating system name.","x-example":"Mac"},"osVersion":{"type":"string","description":"Operating system version.","x-example":"Mac"},"clientType":{"type":"string","description":"Client type.","x-example":"browser"},"clientCode":{"type":"string","description":"Client code name. View list of [available options](https:\/\/github.com\/appwrite\/appwrite\/blob\/master\/docs\/lists\/clients.json).","x-example":"CM"},"clientName":{"type":"string","description":"Client name.","x-example":"Chrome Mobile iOS"},"clientVersion":{"type":"string","description":"Client version.","x-example":"84.0"},"clientEngine":{"type":"string","description":"Client engine name.","x-example":"WebKit"},"clientEngineVersion":{"type":"string","description":"Client engine name.","x-example":"605.1.15"},"deviceName":{"type":"string","description":"Device name.","x-example":"smartphone"},"deviceBrand":{"type":"string","description":"Device brand name.","x-example":"Google"},"deviceModel":{"type":"string","description":"Device model name.","x-example":"Nexus 5"},"countryCode":{"type":"string","description":"Country two-character ISO 3166-1 alpha code.","x-example":"US"},"countryName":{"type":"string","description":"Country name.","x-example":"United States"}},"required":["event","userId","userEmail","userName","mode","ip","time","osCode","osName","osVersion","clientType","clientCode","clientName","clientVersion","clientEngine","clientEngineVersion","deviceName","deviceBrand","deviceModel","countryCode","countryName"]},"user":{"description":"User","type":"object","properties":{"$id":{"type":"string","description":"User ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"User name.","x-example":"John Doe"},"registration":{"type":"integer","description":"User registration date in Unix timestamp.","x-example":1592981250,"format":"int32"},"status":{"type":"boolean","description":"User status. Pass `true` for enabled and `false` for disabled.","x-example":true},"passwordUpdate":{"type":"integer","description":"Unix timestamp of the most recent password update","x-example":1592981250,"format":"int32"},"email":{"type":"string","description":"User email address.","x-example":"john@appwrite.io"},"emailVerification":{"type":"boolean","description":"Email verification status.","x-example":true},"prefs":{"type":"object","description":"User preferences as a key-value object","x-example":{"theme":"pink","timezone":"UTC"},"items":{"type":"object","$ref":"#\/definitions\/preferences"}}},"required":["$id","name","registration","status","passwordUpdate","email","emailVerification","prefs"]},"preferences":{"description":"Preferences","type":"object","additionalProperties":true},"session":{"description":"Session","type":"object","properties":{"$id":{"type":"string","description":"Session ID.","x-example":"5e5ea5c16897e"},"userId":{"type":"string","description":"User ID.","x-example":"5e5bb8c16897e"},"expire":{"type":"integer","description":"Session expiration date in Unix timestamp.","x-example":1592981250,"format":"int32"},"provider":{"type":"string","description":"Session Provider.","x-example":"email"},"providerUid":{"type":"string","description":"Session Provider User ID.","x-example":"user@example.com"},"providerToken":{"type":"string","description":"Session Provider Token.","x-example":"MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3"},"ip":{"type":"string","description":"IP in use when the session was created.","x-example":"127.0.0.1"},"osCode":{"type":"string","description":"Operating system code name. View list of [available options](https:\/\/github.com\/appwrite\/appwrite\/blob\/master\/docs\/lists\/os.json).","x-example":"Mac"},"osName":{"type":"string","description":"Operating system name.","x-example":"Mac"},"osVersion":{"type":"string","description":"Operating system version.","x-example":"Mac"},"clientType":{"type":"string","description":"Client type.","x-example":"browser"},"clientCode":{"type":"string","description":"Client code name. View list of [available options](https:\/\/github.com\/appwrite\/appwrite\/blob\/master\/docs\/lists\/clients.json).","x-example":"CM"},"clientName":{"type":"string","description":"Client name.","x-example":"Chrome Mobile iOS"},"clientVersion":{"type":"string","description":"Client version.","x-example":"84.0"},"clientEngine":{"type":"string","description":"Client engine name.","x-example":"WebKit"},"clientEngineVersion":{"type":"string","description":"Client engine name.","x-example":"605.1.15"},"deviceName":{"type":"string","description":"Device name.","x-example":"smartphone"},"deviceBrand":{"type":"string","description":"Device brand name.","x-example":"Google"},"deviceModel":{"type":"string","description":"Device model name.","x-example":"Nexus 5"},"countryCode":{"type":"string","description":"Country two-character ISO 3166-1 alpha code.","x-example":"US"},"countryName":{"type":"string","description":"Country name.","x-example":"United States"},"current":{"type":"boolean","description":"Returns true if this the current user session.","x-example":true}},"required":["$id","userId","expire","provider","providerUid","providerToken","ip","osCode","osName","osVersion","clientType","clientCode","clientName","clientVersion","clientEngine","clientEngineVersion","deviceName","deviceBrand","deviceModel","countryCode","countryName","current"]},"token":{"description":"Token","type":"object","properties":{"$id":{"type":"string","description":"Token ID.","x-example":"bb8ea5c16897e"},"userId":{"type":"string","description":"User ID.","x-example":"5e5ea5c168bb8"},"secret":{"type":"string","description":"Token secret key. This will return an empty string unless the response is returned using an API key or as part of a webhook payload.","x-example":""},"expire":{"type":"integer","description":"Token expiration date in Unix timestamp.","x-example":1592981250,"format":"int32"}},"required":["$id","userId","secret","expire"]},"jwt":{"description":"JWT","type":"object","properties":{"jwt":{"type":"string","description":"JWT encoded string.","x-example":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"}},"required":["jwt"]},"locale":{"description":"Locale","type":"object","properties":{"ip":{"type":"string","description":"User IP address.","x-example":"127.0.0.1"},"countryCode":{"type":"string","description":"Country code in [ISO 3166-1](http:\/\/en.wikipedia.org\/wiki\/ISO_3166-1) two-character format","x-example":"US"},"country":{"type":"string","description":"Country name. This field support localization.","x-example":"United States"},"continentCode":{"type":"string","description":"Continent code. A two character continent code \"AF\" for Africa, \"AN\" for Antarctica, \"AS\" for Asia, \"EU\" for Europe, \"NA\" for North America, \"OC\" for Oceania, and \"SA\" for South America.","x-example":"NA"},"continent":{"type":"string","description":"Continent name. This field support localization.","x-example":"North America"},"eu":{"type":"boolean","description":"True if country is part of the Europian Union.","x-example":false},"currency":{"type":"string","description":"Currency code in [ISO 4217-1](http:\/\/en.wikipedia.org\/wiki\/ISO_4217) three-character format","x-example":"USD"}},"required":["ip","countryCode","country","continentCode","continent","eu","currency"]},"file":{"description":"File","type":"object","properties":{"$id":{"type":"string","description":"File ID.","x-example":"5e5ea5c16897e"},"$read":{"type":"array","description":"File read permissions.","items":{"type":"string"},"x-example":"role:all"},"$write":{"type":"array","description":"File write permissions.","items":{"type":"string"},"x-example":"user:608f9da25e7e1"},"name":{"type":"string","description":"File name.","x-example":"Pink.png"},"dateCreated":{"type":"integer","description":"File creation date in Unix timestamp.","x-example":1592981250,"format":"int32"},"signature":{"type":"string","description":"File MD5 signature.","x-example":"5d529fd02b544198ae075bd57c1762bb"},"mimeType":{"type":"string","description":"File mime type.","x-example":"image\/png"},"sizeOriginal":{"type":"integer","description":"File original size in bytes.","x-example":17890,"format":"int32"}},"required":["$id","$read","$write","name","dateCreated","signature","mimeType","sizeOriginal"]},"team":{"description":"Team","type":"object","properties":{"$id":{"type":"string","description":"Team ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"Team name.","x-example":"VIP"},"dateCreated":{"type":"integer","description":"Team creation date in Unix timestamp.","x-example":1592981250,"format":"int32"},"sum":{"type":"integer","description":"Total sum of team members.","x-example":7,"format":"int32"}},"required":["$id","name","dateCreated","sum"]},"membership":{"description":"Membership","type":"object","properties":{"$id":{"type":"string","description":"Membership ID.","x-example":"5e5ea5c16897e"},"userId":{"type":"string","description":"User ID.","x-example":"5e5ea5c16897e"},"teamId":{"type":"string","description":"Team ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"User name.","x-example":"VIP"},"email":{"type":"string","description":"User email address.","x-example":"john@appwrite.io"},"invited":{"type":"integer","description":"Date, the user has been invited to join the team in Unix timestamp.","x-example":1592981250,"format":"int32"},"joined":{"type":"integer","description":"Date, the user has accepted the invitation to join the team in Unix timestamp.","x-example":1592981250,"format":"int32"},"confirm":{"type":"boolean","description":"User confirmation status, true if the user has joined the team or false otherwise.","x-example":false},"roles":{"type":"array","description":"User list of roles","items":{"type":"string"},"x-example":"admin"}},"required":["$id","userId","teamId","name","email","invited","joined","confirm","roles"]},"function":{"description":"Function","type":"object","properties":{"$id":{"type":"string","description":"Function ID.","x-example":"5e5ea5c16897e"},"execute":{"type":"string","description":"Execution permissions.","x-example":"role:member"},"name":{"type":"string","description":"Function name.","x-example":"My Function"},"dateCreated":{"type":"integer","description":"Function creation date in Unix timestamp.","x-example":1592981250,"format":"int32"},"dateUpdated":{"type":"integer","description":"Function update date in Unix timestamp.","x-example":1592981257,"format":"int32"},"status":{"type":"string","description":"Function status. Possible values: `disabled`, `enabled`","x-example":"enabled"},"runtime":{"type":"string","description":"Function execution runtime.","x-example":"python-3.8"},"tag":{"type":"string","description":"Function active tag ID.","x-example":"5e5ea5c16897e"},"vars":{"type":"string","description":"Function environment variables.","x-example":{"key":"value"}},"events":{"type":"array","description":"Function trigger events.","items":{"type":"string"},"x-example":"account.create"},"schedule":{"type":"string","description":"Function execution schedult in CRON format.","x-example":"5 4 * * *"},"scheduleNext":{"type":"integer","description":"Function next scheduled execution date in Unix timestamp.","x-example":1592981292,"format":"int32"},"schedulePrevious":{"type":"integer","description":"Function next scheduled execution date in Unix timestamp.","x-example":1592981237,"format":"int32"},"timeout":{"type":"integer","description":"Function execution timeout in seconds.","x-example":1592981237,"format":"int32"}},"required":["$id","execute","name","dateCreated","dateUpdated","status","runtime","tag","vars","events","schedule","scheduleNext","schedulePrevious","timeout"]},"runtime":{"description":"Runtime","type":"object","properties":{"$id":{"type":"string","description":"Runtime ID.","x-example":"python-3.8"},"name":{"type":"string","description":"Runtime Name.","x-example":"Python"},"version":{"type":"string","description":"Runtime version.","x-example":"3.8"},"base":{"type":"string","description":"Base Docker image used to build the runtime.","x-example":"python:3.8-alpine"},"image":{"type":"string","description":"Image name of Docker Hub.","x-example":"appwrite\\\/runtime-for-python:3.8"},"logo":{"type":"string","description":"Name of the logo image.","x-example":"python.png"},"supports":{"type":"array","description":"List of supported architectures.","items":{"type":"string"},"x-example":"amd64"}},"required":["$id","name","version","base","image","logo","supports"]},"tag":{"description":"Tag","type":"object","properties":{"$id":{"type":"string","description":"Tag ID.","x-example":"5e5ea5c16897e"},"functionId":{"type":"string","description":"Function ID.","x-example":"5e5ea6g16897e"},"dateCreated":{"type":"integer","description":"The tag creation date in Unix timestamp.","x-example":1592981250,"format":"int32"},"command":{"type":"string","description":"The entrypoint command in use to execute the tag code.","x-example":"enabled"},"size":{"type":"string","description":"The code size in bytes.","x-example":"python-3.8"}},"required":["$id","functionId","dateCreated","command","size"]},"execution":{"description":"Execution","type":"object","properties":{"$id":{"type":"string","description":"Execution ID.","x-example":"5e5ea5c16897e"},"$read":{"type":"array","description":"Execution read permissions.","items":{"type":"string"},"x-example":"role:all"},"functionId":{"type":"string","description":"Function ID.","x-example":"5e5ea6g16897e"},"dateCreated":{"type":"integer","description":"The execution creation date in Unix timestamp.","x-example":1592981250,"format":"int32"},"trigger":{"type":"string","description":"The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`.","x-example":"http"},"status":{"type":"string","description":"The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`.","x-example":"processing"},"exitCode":{"type":"integer","description":"The script exit code.","x-example":0,"format":"int32"},"stdout":{"type":"string","description":"The script stdout output string. Logs the last 4,000 characters of the execution stdout output.","x-example":""},"stderr":{"type":"string","description":"The script stderr output string. Logs the last 4,000 characters of the execution stderr output","x-example":""},"time":{"type":"number","description":"The script execution time in seconds.","x-example":0.4,"format":"double"}},"required":["$id","$read","functionId","dateCreated","trigger","status","exitCode","stdout","stderr","time"]},"project":{"description":"Project","type":"object","properties":{"$id":{"type":"string","description":"Project ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"Project name.","x-example":"New Project"},"description":{"type":"string","description":"Project description.","x-example":"This is a new project."},"teamId":{"type":"string","description":"Project team ID.","x-example":"1592981250"},"logo":{"type":"string","description":"Project logo file ID.","x-example":"5f5c451b403cb"},"url":{"type":"string","description":"Project website URL.","x-example":"5f5c451b403cb"},"legalName":{"type":"string","description":"Company legal name.","x-example":"Company LTD."},"legalCountry":{"type":"string","description":"Country code in [ISO 3166-1](http:\/\/en.wikipedia.org\/wiki\/ISO_3166-1) two-character format.","x-example":"US"},"legalState":{"type":"string","description":"State name.","x-example":"New York"},"legalCity":{"type":"string","description":"City name.","x-example":"New York City."},"legalAddress":{"type":"string","description":"Company Address.","x-example":"620 Eighth Avenue, New York, NY 10018"},"legalTaxId":{"type":"string","description":"Company Tax ID.","x-example":"131102020"},"authLimit":{"type":"integer","description":"Max users allowed. 0 is unlimited.","x-example":100,"format":"int32"},"platforms":{"type":"array","description":"List of Platforms.","items":{"type":"object","$ref":"#\/definitions\/platform"},"x-example":{}},"webhooks":{"type":"array","description":"List of Webhooks.","items":{"type":"object","$ref":"#\/definitions\/webhook"},"x-example":{}},"keys":{"type":"array","description":"List of API Keys.","items":{"type":"object","$ref":"#\/definitions\/key"},"x-example":{}},"domains":{"type":"array","description":"List of Domains.","items":{"type":"object","$ref":"#\/definitions\/domain"},"x-example":{}},"providerAmazonAppid":{"type":"string","description":"Amazon OAuth app ID.","x-example":"123247283472834787438"},"providerAmazonSecret":{"type":"string","description":"Amazon OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerAppleAppid":{"type":"string","description":"Apple OAuth app ID.","x-example":"123247283472834787438"},"providerAppleSecret":{"type":"string","description":"Apple OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerBitbucketAppid":{"type":"string","description":"BitBucket OAuth app ID.","x-example":"123247283472834787438"},"providerBitbucketSecret":{"type":"string","description":"BitBucket OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerBitlyAppid":{"type":"string","description":"Bitly OAuth app ID.","x-example":"123247283472834787438"},"providerBitlySecret":{"type":"string","description":"Bitly OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerBoxAppid":{"type":"string","description":"Box OAuth app ID.","x-example":"123247283472834787438"},"providerBoxSecret":{"type":"string","description":"Box OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerDiscordAppid":{"type":"string","description":"Discord OAuth app ID.","x-example":"123247283472834787438"},"providerDiscordSecret":{"type":"string","description":"Discord OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerDropboxAppid":{"type":"string","description":"Dropbox OAuth app ID.","x-example":"123247283472834787438"},"providerDropboxSecret":{"type":"string","description":"Dropbox OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerFacebookAppid":{"type":"string","description":"Facebook OAuth app ID.","x-example":"123247283472834787438"},"providerFacebookSecret":{"type":"string","description":"Facebook OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerGithubAppid":{"type":"string","description":"GitHub OAuth app ID.","x-example":"123247283472834787438"},"providerGithubSecret":{"type":"string","description":"GitHub OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerGitlabAppid":{"type":"string","description":"GitLab OAuth app ID.","x-example":"123247283472834787438"},"providerGitlabSecret":{"type":"string","description":"GitLab OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerGoogleAppid":{"type":"string","description":"Google OAuth app ID.","x-example":"123247283472834787438"},"providerGoogleSecret":{"type":"string","description":"Google OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerLinkedinAppid":{"type":"string","description":"LinkedIn OAuth app ID.","x-example":"123247283472834787438"},"providerLinkedinSecret":{"type":"string","description":"LinkedIn OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerMicrosoftAppid":{"type":"string","description":"Microsoft OAuth app ID.","x-example":"123247283472834787438"},"providerMicrosoftSecret":{"type":"string","description":"Microsoft OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerPaypalAppid":{"type":"string","description":"PayPal OAuth app ID.","x-example":"123247283472834787438"},"providerPaypalSecret":{"type":"string","description":"PayPal OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerPaypalSandboxAppid":{"type":"string","description":"PayPal OAuth app ID.","x-example":"123247283472834787438"},"providerPaypalSandboxSecret":{"type":"string","description":"PayPal OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerSalesforceAppid":{"type":"string","description":"Salesforce OAuth app ID.","x-example":"123247283472834787438"},"providerSalesforceSecret":{"type":"string","description":"Salesforce OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerSlackAppid":{"type":"string","description":"Slack OAuth app ID.","x-example":"123247283472834787438"},"providerSlackSecret":{"type":"string","description":"Slack OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerSpotifyAppid":{"type":"string","description":"Spotify OAuth app ID.","x-example":"123247283472834787438"},"providerSpotifySecret":{"type":"string","description":"Spotify OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerTradeshiftAppid":{"type":"string","description":"Tradeshift OAuth app ID.","x-example":"123247283472834787438"},"providerTradeshiftSecret":{"type":"string","description":"Tradeshift OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerTradeshiftBoxAppid":{"type":"string","description":"Tradeshift OAuth app ID.","x-example":"123247283472834787438"},"providerTradeshiftBoxSecret":{"type":"string","description":"Tradeshift OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerTwitchAppid":{"type":"string","description":"Twitch OAuth app ID.","x-example":"123247283472834787438"},"providerTwitchSecret":{"type":"string","description":"Twitch OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerVkAppid":{"type":"string","description":"VK OAuth app ID.","x-example":"123247283472834787438"},"providerVkSecret":{"type":"string","description":"VK OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerYahooAppid":{"type":"string","description":"Yahoo OAuth app ID.","x-example":"123247283472834787438"},"providerYahooSecret":{"type":"string","description":"Yahoo OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerYammerAppid":{"type":"string","description":"Yammer OAuth app ID.","x-example":"123247283472834787438"},"providerYammerSecret":{"type":"string","description":"Yammer OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerYandexAppid":{"type":"string","description":"Yandex OAuth app ID.","x-example":"123247283472834787438"},"providerYandexSecret":{"type":"string","description":"Yandex OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerWordpressAppid":{"type":"string","description":"WordPress OAuth app ID.","x-example":"123247283472834787438"},"providerWordpressSecret":{"type":"string","description":"WordPress OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerMockAppid":{"type":"string","description":"Mock OAuth app ID.","x-example":"123247283472834787438"},"providerMockSecret":{"type":"string","description":"Mock OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"authEmailPassword":{"type":"boolean","description":"Email\/Password auth method status","x-example":true},"authUsersAuthMagicURL":{"type":"boolean","description":"Magic URL auth method status","x-example":true},"authAnonymous":{"type":"boolean","description":"Anonymous auth method status","x-example":true},"authInvites":{"type":"boolean","description":"Invites auth method status","x-example":true},"authJWT":{"type":"boolean","description":"JWT auth method status","x-example":true},"authPhone":{"type":"boolean","description":"Phone auth method status","x-example":true},"serviceStatusForAccount":{"type":"boolean","description":"Account service status","x-example":true},"serviceStatusForAvatars":{"type":"boolean","description":"Avatars service status","x-example":true},"serviceStatusForDatabase":{"type":"boolean","description":"Database service status","x-example":true},"serviceStatusForLocale":{"type":"boolean","description":"Locale service status","x-example":true},"serviceStatusForHealth":{"type":"boolean","description":"Health service status","x-example":true},"serviceStatusForStorage":{"type":"boolean","description":"Storage service status","x-example":true},"serviceStatusForTeams":{"type":"boolean","description":"Teams service status","x-example":true},"serviceStatusForUsers":{"type":"boolean","description":"Users service status","x-example":true},"serviceStatusForFunctions":{"type":"boolean","description":"Functions service status","x-example":true}},"required":["$id","name","description","teamId","logo","url","legalName","legalCountry","legalState","legalCity","legalAddress","legalTaxId","authLimit","platforms","webhooks","keys","domains","providerAmazonAppid","providerAmazonSecret","providerAppleAppid","providerAppleSecret","providerBitbucketAppid","providerBitbucketSecret","providerBitlyAppid","providerBitlySecret","providerBoxAppid","providerBoxSecret","providerDiscordAppid","providerDiscordSecret","providerDropboxAppid","providerDropboxSecret","providerFacebookAppid","providerFacebookSecret","providerGithubAppid","providerGithubSecret","providerGitlabAppid","providerGitlabSecret","providerGoogleAppid","providerGoogleSecret","providerLinkedinAppid","providerLinkedinSecret","providerMicrosoftAppid","providerMicrosoftSecret","providerPaypalAppid","providerPaypalSecret","providerPaypalSandboxAppid","providerPaypalSandboxSecret","providerSalesforceAppid","providerSalesforceSecret","providerSlackAppid","providerSlackSecret","providerSpotifyAppid","providerSpotifySecret","providerTradeshiftAppid","providerTradeshiftSecret","providerTradeshiftBoxAppid","providerTradeshiftBoxSecret","providerTwitchAppid","providerTwitchSecret","providerVkAppid","providerVkSecret","providerYahooAppid","providerYahooSecret","providerYammerAppid","providerYammerSecret","providerYandexAppid","providerYandexSecret","providerWordpressAppid","providerWordpressSecret","providerMockAppid","providerMockSecret","authEmailPassword","authUsersAuthMagicURL","authAnonymous","authInvites","authJWT","authPhone","serviceStatusForAccount","serviceStatusForAvatars","serviceStatusForDatabase","serviceStatusForLocale","serviceStatusForHealth","serviceStatusForStorage","serviceStatusForTeams","serviceStatusForUsers","serviceStatusForFunctions"]},"webhook":{"description":"Webhook","type":"object","properties":{"$id":{"type":"string","description":"Webhook ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"Webhook name.","x-example":"My Webhook"},"url":{"type":"string","description":"Webhook URL endpoint.","x-example":"https:\/\/example.com\/webhook"},"events":{"type":"array","description":"Webhook trigger events.","items":{"type":"string"},"x-example":"database.collections.update"},"security":{"type":"boolean","description":"Indicated if SSL \/ TLS Certificate verification is enabled.","x-example":true},"httpUser":{"type":"string","description":"HTTP basic authentication username.","x-example":"username"},"httpPass":{"type":"string","description":"HTTP basic authentication password.","x-example":"password"}},"required":["$id","name","url","events","security","httpUser","httpPass"]},"key":{"description":"Key","type":"object","properties":{"$id":{"type":"string","description":"Key ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"Key name.","x-example":"My API Key"},"scopes":{"type":"array","description":"Allowed permission scopes.","items":{"type":"string"},"x-example":"users.read"},"secret":{"type":"string","description":"Secret key.","x-example":"919c2d18fb5d4...a2ae413da83346ad2"}},"required":["$id","name","scopes","secret"]},"domain":{"description":"Domain","type":"object","properties":{"$id":{"type":"string","description":"Domain ID.","x-example":"5e5ea5c16897e"},"domain":{"type":"string","description":"Domain name.","x-example":"appwrite.company.com"},"registerable":{"type":"string","description":"Registerable domain name.","x-example":"company.com"},"tld":{"type":"string","description":"TLD name.","x-example":"com"},"verification":{"type":"boolean","description":"Verification process status.","x-example":true},"certificateId":{"type":"string","description":"Certificate ID.","x-example":"6ejea5c13377e"}},"required":["$id","domain","registerable","tld","verification","certificateId"]},"platform":{"description":"Platform","type":"object","properties":{"$id":{"type":"string","description":"Platform ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"Platform name.","x-example":"My Web App"},"type":{"type":"string","description":"Platform type. Possible values are: web, flutter-ios, flutter-android, ios, android, and unity.","x-example":"My Web App"},"key":{"type":"string","description":"Platform Key. iOS bundle ID or Android package name. Empty string for other platforms.","x-example":"com.company.appname"},"store":{"type":"string","description":"App store or Google Play store ID.","x-example":""},"hostname":{"type":"string","description":"Web app hostname. Empty string for other platforms.","x-example":true},"httpUser":{"type":"string","description":"HTTP basic authentication username.","x-example":"username"},"httpPass":{"type":"string","description":"HTTP basic authentication password.","x-example":"password"}},"required":["$id","name","type","key","store","hostname","httpUser","httpPass"]},"country":{"description":"Country","type":"object","properties":{"name":{"type":"string","description":"Country name.","x-example":"United States"},"code":{"type":"string","description":"Country two-character ISO 3166-1 alpha code.","x-example":"US"}},"required":["name","code"]},"continent":{"description":"Continent","type":"object","properties":{"name":{"type":"string","description":"Continent name.","x-example":"Europe"},"code":{"type":"string","description":"Continent two letter code.","x-example":"EU"}},"required":["name","code"]},"language":{"description":"Language","type":"object","properties":{"name":{"type":"string","description":"Language name.","x-example":"Italian"},"code":{"type":"string","description":"Language two-character ISO 639-1 codes.","x-example":"it"},"nativeName":{"type":"string","description":"Language native name.","x-example":"Italiano"}},"required":["name","code","nativeName"]},"currency":{"description":"Currency","type":"object","properties":{"symbol":{"type":"string","description":"Currency symbol.","x-example":"$"},"name":{"type":"string","description":"Currency name.","x-example":"US dollar"},"symbolNative":{"type":"string","description":"Currency native symbol.","x-example":"$"},"decimalDigits":{"type":"integer","description":"Number of decimal digits.","x-example":2,"format":"int32"},"rounding":{"type":"number","description":"Currency digit rounding.","x-example":0,"format":"double"},"code":{"type":"string","description":"Currency code in [ISO 4217-1](http:\/\/en.wikipedia.org\/wiki\/ISO_4217) three-character format.","x-example":"USD"},"namePlural":{"type":"string","description":"Currency plural name","x-example":"US dollars"}},"required":["symbol","name","symbolNative","decimalDigits","rounding","code","namePlural"]},"phone":{"description":"Phone","type":"object","properties":{"code":{"type":"string","description":"Phone code.","x-example":"+1"},"countryCode":{"type":"string","description":"Country two-character ISO 3166-1 alpha code.","x-example":"US"},"countryName":{"type":"string","description":"Country name.","x-example":"United States"}},"required":["code","countryCode","countryName"]},"healthAntivirus":{"description":"Health Antivirus","type":"object","properties":{"version":{"type":"string","description":"Antivirus version.","x-example":"1.0.0"},"status":{"type":"string","description":"Antivirus status. Possible values can are: `disabled`, `offline`, `online`","x-example":"online"}},"required":["version","status"]},"healthQueue":{"description":"Health Queue","type":"object","properties":{"size":{"type":"integer","description":"Amount of actions in the queue.","x-example":8,"format":"int32"}},"required":["size"]},"healthStatus":{"description":"Health Status","type":"object","properties":{"ping":{"type":"integer","description":"Duration in milliseconds how long the health check took.","x-example":128,"format":"int32"},"status":{"type":"string","description":"Service status. Possible values can are: `pass`, `fail`","x-example":"pass"}},"required":["ping","status"]},"healthTime":{"description":"Health Time","type":"object","properties":{"remoteTime":{"type":"integer","description":"Current unix timestamp on trustful remote server.","x-example":1639490751,"format":"int32"},"localTime":{"type":"integer","description":"Current unix timestamp of local server where Appwrite runs.","x-example":1639490844,"format":"int32"},"diff":{"type":"integer","description":"Difference of unix remote and local timestamps in milliseconds.","x-example":93,"format":"int32"}},"required":["remoteTime","localTime","diff"]},"usageDatabase":{"description":"UsageDatabase","type":"object","properties":{"range":{"type":"string","description":"The time range of the usage stats.","x-example":"30d"},"documentsCount":{"type":"array","description":"Aggregated stats for total number of documents.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"collectionsCount":{"type":"array","description":"Aggregated stats for total number of collections.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"documentsCreate":{"type":"array","description":"Aggregated stats for documents created.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"documentsRead":{"type":"array","description":"Aggregated stats for documents read.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"documentsUpdate":{"type":"array","description":"Aggregated stats for documents updated.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"documentsDelete":{"type":"array","description":"Aggregated stats for documents deleted.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"collectionsCreate":{"type":"array","description":"Aggregated stats for collections created.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"collectionsRead":{"type":"array","description":"Aggregated stats for collections read.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"collectionsUpdate":{"type":"array","description":"Aggregated stats for collections updated.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"collectionsDelete":{"type":"array","description":"Aggregated stats for collections delete.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}}},"required":["range","documentsCount","collectionsCount","documentsCreate","documentsRead","documentsUpdate","documentsDelete","collectionsCreate","collectionsRead","collectionsUpdate","collectionsDelete"]},"usageCollection":{"description":"UsageCollection","type":"object","properties":{"range":{"type":"string","description":"The time range of the usage stats.","x-example":"30d"},"documentsCount":{"type":"array","description":"Aggregated stats for total number of documents.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"documentsCreate":{"type":"array","description":"Aggregated stats for documents created.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"documentsRead":{"type":"array","description":"Aggregated stats for documents read.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"documentsUpdate":{"type":"array","description":"Aggregated stats for documents updated.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"documentsDelete":{"type":"array","description":"Aggregated stats for documents deleted.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}}},"required":["range","documentsCount","documentsCreate","documentsRead","documentsUpdate","documentsDelete"]},"usageUsers":{"description":"UsageUsers","type":"object","properties":{"range":{"type":"string","description":"The time range of the usage stats.","x-example":"30d"},"usersCount":{"type":"array","description":"Aggregated stats for total number of users.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"usersCreate":{"type":"array","description":"Aggregated stats for users created.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"usersRead":{"type":"array","description":"Aggregated stats for users read.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"usersUpdate":{"type":"array","description":"Aggregated stats for users updated.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"usersDelete":{"type":"array","description":"Aggregated stats for users deleted.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"sessionsCreate":{"type":"array","description":"Aggregated stats for sessions created.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"sessionsProviderCreate":{"type":"array","description":"Aggregated stats for sessions created for a provider ( email, anonymous or oauth2 ).","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"sessionsDelete":{"type":"array","description":"Aggregated stats for sessions deleted.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}}},"required":["range","usersCount","usersCreate","usersRead","usersUpdate","usersDelete","sessionsCreate","sessionsProviderCreate","sessionsDelete"]},"usageStorage":{"description":"StorageUsage","type":"object","properties":{"range":{"type":"string","description":"The time range of the usage stats.","x-example":"30d"},"storage":{"type":"array","description":"Aggregated stats for the occupied storage size (in bytes).","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"files":{"type":"array","description":"Aggregated stats for total number of files.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}}},"required":["range","storage","files"]},"usageBuckets":{"description":"UsageBuckets","type":"object","properties":{"range":{"type":"string","description":"The time range of the usage stats.","x-example":"30d"},"filesCount":{"type":"array","description":"Aggregated stats for total number of files in this bucket.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"filesCreate":{"type":"array","description":"Aggregated stats for files created.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"filesRead":{"type":"array","description":"Aggregated stats for files read.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"filesUpdate":{"type":"array","description":"Aggregated stats for files updated.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"filesDelete":{"type":"array","description":"Aggregated stats for files deleted.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}}},"required":["range","filesCount","filesCreate","filesRead","filesUpdate","filesDelete"]},"usageFunctions":{"description":"UsageFunctions","type":"object","properties":{"range":{"type":"string","description":"The time range of the usage stats.","x-example":"30d"},"functionsExecutions":{"type":"array","description":"Aggregated stats for function executions.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"functionsFailures":{"type":"array","description":"Aggregated stats for function execution failures.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"functionsCompute":{"type":"array","description":"Aggregated stats for function execution duration.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}}},"required":["range","functionsExecutions","functionsFailures","functionsCompute"]},"usageProject":{"description":"UsageProject","type":"object","properties":{"range":{"type":"string","description":"The time range of the usage stats.","x-example":"30d"},"requests":{"type":"array","description":"Aggregated stats for number of requests.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"network":{"type":"array","description":"Aggregated stats for consumed bandwidth.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"functions":{"type":"array","description":"Aggregated stats for function executions.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"documents":{"type":"array","description":"Aggregated stats for number of documents.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"collections":{"type":"array","description":"Aggregated stats for number of collections.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"users":{"type":"array","description":"Aggregated stats for number of users.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"storage":{"type":"array","description":"Aggregated stats for the occupied storage size (in bytes).","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}}},"required":["range","requests","network","functions","documents","collections","users","storage"]}},"externalDocs":{"description":"Full API docs, specs and tutorials","url":"https:\/\/appwrite.io\/docs"}} \ No newline at end of file diff --git a/specs/swagger-appwrite-0.13.0.json b/specs/swagger-appwrite-0.13.0.json deleted file mode 100644 index c26280a513..0000000000 --- a/specs/swagger-appwrite-0.13.0.json +++ /dev/null @@ -1 +0,0 @@ -{"swagger":"2.0","info":{"version":"0.12.3","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","contact":{"name":"Appwrite Team","url":"https:\/\/appwrite.io\/support","email":"team@appwrite.io"},"license":{"name":"BSD-3-Clause","url":"https:\/\/raw.githubusercontent.com\/appwrite\/appwrite\/master\/LICENSE"}},"host":"HOSTNAME","basePath":"\/v1","schemes":["https"],"consumes":["application\/json","multipart\/form-data"],"produces":["application\/json"],"securityDefinitions":{"Project":{"type":"apiKey","name":"X-Appwrite-Project","description":"Your project ID","in":"header","x-appwrite":{"demo":"5df5acd0d48c2"}},"Key":{"type":"apiKey","name":"X-Appwrite-Key","description":"Your secret API key","in":"header","x-appwrite":{"demo":"919c2d18fb5d4...a2ae413da83346ad2"}},"JWT":{"type":"apiKey","name":"X-Appwrite-JWT","description":"Your secret JSON Web Token","in":"header","x-appwrite":{"demo":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ..."}},"Locale":{"type":"apiKey","name":"X-Appwrite-Locale","description":"","in":"header","x-appwrite":{"demo":"en"}},"Mode":{"type":"apiKey","name":"X-Appwrite-Mode","description":"","in":"header","x-appwrite":{"demo":""}}},"paths":{"\/account":{"get":{"summary":"Get Account","operationId":"accountGet","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Get currently logged in user data as JSON object.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"get","weight":47,"cookies":false,"type":"","demo":"account\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/get.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}]},"post":{"summary":"Create Account","operationId":"accountCreate","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to allow a new user to register a new account in your project. After the user registration completes successfully, you can use the [\/account\/verfication](\/docs\/client\/account#accountCreateVerification) route to start verifying the user email address. To allow the new user to login to their new account, you need to create a new [account session](\/docs\/client\/account#accountCreateSession).","responses":{"201":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"create","weight":37,"cookies":false,"type":"","demo":"account\/create.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"public","platforms":["client"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"userId":{"type":"string","description":"Unique Id. Choose your own unique ID or pass the string \"unique()\" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.","default":null,"x-example":"[USER_ID]"},"email":{"type":"string","description":"User email.","default":null,"x-example":"email@example.com"},"password":{"type":"string","description":"User password. Must be at least 8 chars.","default":null,"x-example":"password"},"name":{"type":"string","description":"User name. Max length: 128 chars.","default":"","x-example":"[NAME]"}},"required":["userId","email","password"]}}]},"delete":{"summary":"Delete Account","operationId":"accountDelete","consumes":["application\/json"],"produces":[],"tags":["account"],"description":"Delete a currently logged in user account. Behind the scene, the user record is not deleted but permanently blocked from any access. This is done to avoid deleted accounts being overtaken by new users with the same email address. Any user-related resources like documents or storage files should be deleted separately.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"delete","weight":56,"cookies":false,"type":"","demo":"account\/delete.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/delete.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}]}},"\/account\/email":{"patch":{"summary":"Update Account Email","operationId":"accountUpdateEmail","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Update currently logged in user account email address. After changing user address, the user confirmation status will get reset. A new confirmation email is not sent automatically however you can use the send confirmation email endpoint again to send the confirmation email. For security measures, user password is required to complete this request.\nThis endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password.\n","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updateEmail","weight":54,"cookies":false,"type":"","demo":"account\/update-email.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-email.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"email":{"type":"string","description":"User email.","default":null,"x-example":"email@example.com"},"password":{"type":"string","description":"User password. Must be at least 8 chars.","default":null,"x-example":"password"}},"required":["email","password"]}}]}},"\/account\/jwt":{"post":{"summary":"Create Account JWT","operationId":"accountCreateJWT","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to create a JSON Web Token. You can use the resulting JWT to authenticate on behalf of the current user when working with the Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes from its creation and will be invalid if the user will logout in that time frame.","responses":{"201":{"description":"JWT","schema":{"$ref":"#\/definitions\/jwt"}}},"x-appwrite":{"method":"createJWT","weight":46,"cookies":false,"type":"","demo":"account\/create-j-w-t.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create-jwt.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},userId:{userId}","scope":"account","platforms":["client"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}]}},"\/account\/logs":{"get":{"summary":"Get Account Logs","operationId":"accountGetLogs","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Get currently logged in user list of latest security activity logs. Each log returns user IP address, location and date and time of log.","responses":{"200":{"description":"Logs List","schema":{"$ref":"#\/definitions\/logList"}}},"x-appwrite":{"method":"getLogs","weight":50,"cookies":false,"type":"","demo":"account\/get-logs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/get-logs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"limit","description":"Maximum number of logs to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Offset value. The default value is 0. Use this value to manage pagination. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"}]}},"\/account\/name":{"patch":{"summary":"Update Account Name","operationId":"accountUpdateName","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Update currently logged in user account name.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updateName","weight":52,"cookies":false,"type":"","demo":"account\/update-name.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-name.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"User name. Max length: 128 chars.","default":null,"x-example":"[NAME]"}},"required":["name"]}}]}},"\/account\/password":{"patch":{"summary":"Update Account Password","operationId":"accountUpdatePassword","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Update currently logged in user password. For validation, user is required to pass in the new password, and the old password. For users created with OAuth and Team Invites, oldPassword is optional.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updatePassword","weight":53,"cookies":false,"type":"","demo":"account\/update-password.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-password.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"password":{"type":"string","description":"New user password. Must be at least 8 chars.","default":null,"x-example":"password"},"oldPassword":{"type":"string","description":"Current user password. Must be at least 8 chars.","default":"","x-example":"password"}},"required":["password"]}}]}},"\/account\/prefs":{"get":{"summary":"Get Account Preferences","operationId":"accountGetPrefs","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Get currently logged in user preferences as a key-value object.","responses":{"200":{"description":"Preferences","schema":{"$ref":"#\/definitions\/preferences"}}},"x-appwrite":{"method":"getPrefs","weight":48,"cookies":false,"type":"","demo":"account\/get-prefs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/get-prefs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}]},"patch":{"summary":"Update Account Preferences","operationId":"accountUpdatePrefs","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Update currently logged in user account preferences. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updatePrefs","weight":55,"cookies":false,"type":"","demo":"account\/update-prefs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-prefs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"prefs":{"type":"object","description":"Prefs key-value JSON object.","default":{},"x-example":"{}"}},"required":["prefs"]}}]}},"\/account\/recovery":{"post":{"summary":"Create Password Recovery","operationId":"accountCreateRecovery","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Sends the user an email with a temporary secret key for password reset. When the user clicks the confirmation link he is redirected back to your app password reset URL with the secret key and email address values attached to the URL query string. Use the query string params to submit a request to the [PUT \/account\/recovery](\/docs\/client\/account#accountUpdateRecovery) endpoint to complete the process. The verification link sent to the user's email address is valid for 1 hour.","responses":{"201":{"description":"Token","schema":{"$ref":"#\/definitions\/token"}}},"x-appwrite":{"method":"createRecovery","weight":60,"cookies":false,"type":"","demo":"account\/create-recovery.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create-recovery.md","rate-limit":10,"rate-time":3600,"rate-key":["url:{url},email:{param-email}","ip:{ip}"],"scope":"public","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"email":{"type":"string","description":"User email.","default":null,"x-example":"email@example.com"},"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"}},"required":["email","url"]}}]},"put":{"summary":"Create Password Recovery (confirmation)","operationId":"accountUpdateRecovery","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to complete the user account password reset. Both the **userId** and **secret** arguments will be passed as query parameters to the redirect URL you have provided when sending your request to the [POST \/account\/recovery](\/docs\/client\/account#accountCreateRecovery) endpoint.\n\nPlease note that in order to avoid a [Redirect Attack](https:\/\/github.com\/OWASP\/CheatSheetSeries\/blob\/master\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.","responses":{"200":{"description":"Token","schema":{"$ref":"#\/definitions\/token"}}},"x-appwrite":{"method":"updateRecovery","weight":61,"cookies":false,"type":"","demo":"account\/update-recovery.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-recovery.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},userId:{param-userId}","scope":"public","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"userId":{"type":"string","description":"User ID.","default":null,"x-example":"[USER_ID]"},"secret":{"type":"string","description":"Valid reset token.","default":null,"x-example":"[SECRET]"},"password":{"type":"string","description":"New user password. Must be at least 8 chars.","default":null,"x-example":"password"},"passwordAgain":{"type":"string","description":"Repeat new user password. Must be at least 8 chars.","default":null,"x-example":"password"}},"required":["userId","secret","password","passwordAgain"]}}]}},"\/account\/sessions":{"get":{"summary":"Get Account Sessions","operationId":"accountGetSessions","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Get currently logged in user list of active sessions across different devices.","responses":{"200":{"description":"Sessions List","schema":{"$ref":"#\/definitions\/sessionList"}}},"x-appwrite":{"method":"getSessions","weight":49,"cookies":false,"type":"","demo":"account\/get-sessions.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/get-sessions.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}]},"post":{"summary":"Create Account Session","operationId":"accountCreateSession","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Allow the user to login into their account by providing a valid email and password combination. This route will create a new session for the user.","responses":{"201":{"description":"Session","schema":{"$ref":"#\/definitions\/session"}}},"x-appwrite":{"method":"createSession","weight":38,"cookies":false,"type":"","demo":"account\/create-session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create-session.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},email:{param-email}","scope":"public","platforms":["client"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"email":{"type":"string","description":"User email.","default":null,"x-example":"email@example.com"},"password":{"type":"string","description":"User password. Must be at least 8 chars.","default":null,"x-example":"password"}},"required":["email","password"]}}]},"delete":{"summary":"Delete All Account Sessions","operationId":"accountDeleteSessions","consumes":["application\/json"],"produces":[],"tags":["account"],"description":"Delete all sessions from the user account and remove any sessions cookies from the end client.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteSessions","weight":59,"cookies":false,"type":"","demo":"account\/delete-sessions.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/delete-sessions.md","rate-limit":100,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}]}},"\/account\/sessions\/anonymous":{"post":{"summary":"Create Anonymous Session","operationId":"accountCreateAnonymousSession","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to allow a new user to register an anonymous account in your project. This route will also create a new session for the user. To allow the new user to convert an anonymous account to a normal account, you need to update its [email and password](\/docs\/client\/account#accountUpdateEmail) or create an [OAuth2 session](\/docs\/client\/account#accountCreateOAuth2Session).","responses":{"201":{"description":"Session","schema":{"$ref":"#\/definitions\/session"}}},"x-appwrite":{"method":"createAnonymousSession","weight":45,"cookies":false,"type":"","demo":"account\/create-anonymous-session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create-session-anonymous.md","rate-limit":50,"rate-time":3600,"rate-key":"ip:{ip}","scope":"public","platforms":["client"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}]}},"\/account\/sessions\/magic-url":{"post":{"summary":"Create Magic URL session","operationId":"accountCreateMagicURLSession","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Sends the user an email with a secret key for creating a session. When the user clicks the link in the email, the user is redirected back to the URL you provided with the secret key and userId values attached to the URL query string. Use the query string parameters to submit a request to the [PUT \/account\/sessions\/magic-url](\/docs\/client\/account#accountUpdateMagicURLSession) endpoint to complete the login process. The link sent to the user's email address is valid for 1 hour. If you are on a mobile device you can leave the URL parameter empty, so that the login completion will be handled by your Appwrite instance by default.","responses":{"201":{"description":"Token","schema":{"$ref":"#\/definitions\/token"}}},"x-appwrite":{"method":"createMagicURLSession","weight":43,"cookies":false,"type":"","demo":"account\/create-magic-u-r-l-session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create-magic-url-session.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},email:{param-email}","scope":"public","platforms":["client"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"userId":{"type":"string","description":"Unique Id. Choose your own unique ID or pass the string \"unique()\" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.","default":null,"x-example":"[USER_ID]"},"email":{"type":"string","description":"User email.","default":null,"x-example":"email@example.com"},"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"}},"required":["userId","email"]}}]},"put":{"summary":"Create Magic URL session (confirmation)","operationId":"accountUpdateMagicURLSession","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to complete creating the session with the Magic URL. Both the **userId** and **secret** arguments will be passed as query parameters to the redirect URL you have provided when sending your request to the [POST \/account\/sessions\/magic-url](\/docs\/client\/account#accountCreateMagicURLSession) endpoint.\n\nPlease note that in order to avoid a [Redirect Attack](https:\/\/github.com\/OWASP\/CheatSheetSeries\/blob\/master\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.","responses":{"200":{"description":"Session","schema":{"$ref":"#\/definitions\/session"}}},"x-appwrite":{"method":"updateMagicURLSession","weight":44,"cookies":false,"type":"","demo":"account\/update-magic-u-r-l-session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-magic-url-session.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},userId:{param-userId}","scope":"public","platforms":["client"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"userId":{"type":"string","description":"User ID.","default":null,"x-example":"[USER_ID]"},"secret":{"type":"string","description":"Valid verification token.","default":null,"x-example":"[SECRET]"}},"required":["userId","secret"]}}]}},"\/account\/sessions\/oauth2\/{provider}":{"get":{"summary":"Create Account Session with OAuth2","operationId":"accountCreateOAuth2Session","consumes":["application\/json"],"produces":["text\/html"],"tags":["account"],"description":"Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL's back to your app when login is completed.\n\nIf there is already an active session, the new session will be attached to the logged-in account. If there are no active sessions, the server will attempt to look for a user with the same email address as the email received from the OAuth2 provider and attach the new session to the existing user. If no matching user is found - the server will create a new user..\n","responses":{"301":{"description":"No content"}},"x-appwrite":{"method":"createOAuth2Session","weight":39,"cookies":false,"type":"webAuth","demo":"account\/create-o-auth2session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create-session-oauth2.md","rate-limit":50,"rate-time":3600,"rate-key":"ip:{ip}","scope":"public","platforms":["client"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"provider","description":"OAuth2 Provider. Currently, supported providers are: amazon, apple, bitbucket, bitly, box, discord, dropbox, facebook, github, gitlab, google, linkedin, microsoft, notion, paypal, paypalSandbox, salesforce, slack, spotify, tradeshift, tradeshiftBox, twitch, vk, yahoo, yammer, yandex, wordpress, stripe.","required":true,"type":"string","x-example":"amazon","in":"path"},{"name":"success","description":"URL to redirect back to your app after a successful login attempt. 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.","required":false,"type":"string","format":"url","x-example":"https:\/\/example.com","default":"","in":"query"},{"name":"failure","description":"URL to redirect back to your app after a failed login attempt. 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.","required":false,"type":"string","format":"url","x-example":"https:\/\/example.com","default":"","in":"query"},{"name":"scopes","description":"A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes.","required":false,"type":"array","collectionFormat":"multi","items":{"type":"string"},"default":[],"in":"query"}]}},"\/account\/sessions\/{sessionId}":{"get":{"summary":"Get Session By ID","operationId":"accountGetSession","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to get a logged in user's session using a Session ID. Inputting 'current' will return the current session being used.","responses":{"200":{"description":"Session","schema":{"$ref":"#\/definitions\/session"}}},"x-appwrite":{"method":"getSession","weight":51,"cookies":false,"type":"","demo":"account\/get-session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/get-session.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"sessionId","description":"Session ID. Use the string 'current' to get the current device session.","required":true,"type":"string","x-example":"[SESSION_ID]","in":"path"}]},"patch":{"summary":"Update Session (Refresh Tokens)","operationId":"accountUpdateSession","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"","responses":{"200":{"description":"Session","schema":{"$ref":"#\/definitions\/session"}}},"x-appwrite":{"method":"updateSession","weight":58,"cookies":false,"type":"","demo":"account\/update-session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-session.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"sessionId","description":"Session ID. Use the string 'current' to update the current device session.","required":true,"type":"string","x-example":"[SESSION_ID]","in":"path"}]},"delete":{"summary":"Delete Account Session","operationId":"accountDeleteSession","consumes":["application\/json"],"produces":[],"tags":["account"],"description":"Use this endpoint to log out the currently logged in user from all their account sessions across all of their different devices. When using the Session ID argument, only the unique session ID provided is deleted.\n","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteSession","weight":57,"cookies":false,"type":"","demo":"account\/delete-session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/delete-session.md","rate-limit":100,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"sessionId","description":"Session ID. Use the string 'current' to delete the current device session.","required":true,"type":"string","x-example":"[SESSION_ID]","in":"path"}]}},"\/account\/verification":{"post":{"summary":"Create Email Verification","operationId":"accountCreateVerification","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the **userId** and **secret** arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the **userId** and **secret** parameters. Learn more about how to [complete the verification process](\/docs\/client\/account#accountUpdateVerification). The verification link sent to the user's email address is valid for 7 days.\n\nPlease note that in order to avoid a [Redirect Attack](https:\/\/github.com\/OWASP\/CheatSheetSeries\/blob\/master\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.\n","responses":{"201":{"description":"Token","schema":{"$ref":"#\/definitions\/token"}}},"x-appwrite":{"method":"createVerification","weight":62,"cookies":false,"type":"","demo":"account\/create-verification.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create-verification.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},userId:{userId}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"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.","default":null,"x-example":"https:\/\/example.com"}},"required":["url"]}}]},"put":{"summary":"Create Email Verification (confirmation)","operationId":"accountUpdateVerification","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to complete the user email verification process. Use both the **userId** and **secret** parameters that were attached to your app URL to verify the user email ownership. If confirmed this route will return a 200 status code.","responses":{"200":{"description":"Token","schema":{"$ref":"#\/definitions\/token"}}},"x-appwrite":{"method":"updateVerification","weight":63,"cookies":false,"type":"","demo":"account\/update-verification.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-verification.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},userId:{param-userId}","scope":"public","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"userId":{"type":"string","description":"User ID.","default":null,"x-example":"[USER_ID]"},"secret":{"type":"string","description":"Valid verification token.","default":null,"x-example":"[SECRET]"}},"required":["userId","secret"]}}]}},"\/avatars\/browsers\/{code}":{"get":{"summary":"Get Browser Icon","operationId":"avatarsGetBrowser","consumes":["application\/json"],"produces":["image\/png"],"tags":["avatars"],"description":"You can use this endpoint to show different browser icons to your users. The code argument receives the browser code as it appears in your user \/account\/sessions endpoint. Use width, height and quality arguments to change the output settings.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getBrowser","weight":65,"cookies":false,"type":"location","demo":"avatars\/get-browser.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-browser.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"code","description":"Browser Code.","required":true,"type":"string","x-example":"aa","in":"path"},{"name":"width","description":"Image width. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"height","description":"Image height. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"quality","description":"Image quality. Pass an integer between 0 to 100. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"}]}},"\/avatars\/credit-cards\/{code}":{"get":{"summary":"Get Credit Card Icon","operationId":"avatarsGetCreditCard","consumes":["application\/json"],"produces":["image\/png"],"tags":["avatars"],"description":"The credit card endpoint will return you the icon of the credit card provider you need. Use width, height and quality arguments to change the output settings.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getCreditCard","weight":64,"cookies":false,"type":"location","demo":"avatars\/get-credit-card.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-credit-card.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"code","description":"Credit Card Code. Possible values: amex, argencard, cabal, censosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, union-china-pay, visa, mir, maestro.","required":true,"type":"string","x-example":"amex","in":"path"},{"name":"width","description":"Image width. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"height","description":"Image height. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"quality","description":"Image quality. Pass an integer between 0 to 100. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"}]}},"\/avatars\/favicon":{"get":{"summary":"Get Favicon","operationId":"avatarsGetFavicon","consumes":["application\/json"],"produces":["image\/*"],"tags":["avatars"],"description":"Use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL.\n","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getFavicon","weight":68,"cookies":false,"type":"location","demo":"avatars\/get-favicon.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-favicon.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"url","description":"Website URL which you want to fetch the favicon from.","required":true,"type":"string","format":"url","x-example":"https:\/\/example.com","in":"query"}]}},"\/avatars\/flags\/{code}":{"get":{"summary":"Get Country Flag","operationId":"avatarsGetFlag","consumes":["application\/json"],"produces":["image\/png"],"tags":["avatars"],"description":"You can use this endpoint to show different country flags icons to your users. The code argument receives the 2 letter country code. Use width, height and quality arguments to change the output settings.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getFlag","weight":66,"cookies":false,"type":"location","demo":"avatars\/get-flag.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-flag.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"code","description":"Country Code. ISO Alpha-2 country code format.","required":true,"type":"string","x-example":"af","in":"path"},{"name":"width","description":"Image width. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"height","description":"Image height. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"quality","description":"Image quality. Pass an integer between 0 to 100. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"}]}},"\/avatars\/image":{"get":{"summary":"Get Image from URL","operationId":"avatarsGetImage","consumes":["application\/json"],"produces":["image\/*"],"tags":["avatars"],"description":"Use this endpoint to fetch a remote image URL and crop it to any image size you want. This endpoint is very useful if you need to crop and display remote images in your app or in case you want to make sure a 3rd party image is properly served using a TLS protocol.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getImage","weight":67,"cookies":false,"type":"location","demo":"avatars\/get-image.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-image.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"url","description":"Image URL which you want to crop.","required":true,"type":"string","format":"url","x-example":"https:\/\/example.com","in":"query"},{"name":"width","description":"Resize preview image width, Pass an integer between 0 to 2000.","required":false,"type":"integer","format":"int32","x-example":0,"default":400,"in":"query"},{"name":"height","description":"Resize preview image height, Pass an integer between 0 to 2000.","required":false,"type":"integer","format":"int32","x-example":0,"default":400,"in":"query"}]}},"\/avatars\/initials":{"get":{"summary":"Get User Initials","operationId":"avatarsGetInitials","consumes":["application\/json"],"produces":["image\/png"],"tags":["avatars"],"description":"Use this endpoint to show your user initials avatar icon on your website or app. By default, this route will try to print your logged-in user name or email initials. You can also overwrite the user name if you pass the 'name' parameter. If no name is given and no user is logged, an empty avatar will be returned.\n\nYou can use the color and background params to change the avatar colors. By default, a random theme will be selected. The random theme will persist for the user's initials when reloading the same theme will always return for the same initials.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getInitials","weight":70,"cookies":false,"type":"location","demo":"avatars\/get-initials.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-initials.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"name","description":"Full Name. When empty, current user name or email will be used. Max length: 128 chars.","required":false,"type":"string","x-example":"[NAME]","default":"","in":"query"},{"name":"width","description":"Image width. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":500,"in":"query"},{"name":"height","description":"Image height. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":500,"in":"query"},{"name":"color","description":"Changes text color. By default a random color will be picked and stay will persistent to the given name.","required":false,"type":"string","default":"","in":"query"},{"name":"background","description":"Changes background color. By default a random color will be picked and stay will persistent to the given name.","required":false,"type":"string","default":"","in":"query"}]}},"\/avatars\/qr":{"get":{"summary":"Get QR Code","operationId":"avatarsGetQR","consumes":["application\/json"],"produces":["image\/png"],"tags":["avatars"],"description":"Converts a given plain text to a QR code image. You can use the query parameters to change the size and style of the resulting image.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getQR","weight":69,"cookies":false,"type":"location","demo":"avatars\/get-q-r.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-qr.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"text","description":"Plain text to be converted to QR code image.","required":true,"type":"string","x-example":"[TEXT]","in":"query"},{"name":"size","description":"QR code size. Pass an integer between 0 to 1000. Defaults to 400.","required":false,"type":"integer","format":"int32","x-example":0,"default":400,"in":"query"},{"name":"margin","description":"Margin from edge. Pass an integer between 0 to 10. Defaults to 1.","required":false,"type":"integer","format":"int32","x-example":0,"default":1,"in":"query"},{"name":"download","description":"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.","required":false,"type":"boolean","x-example":false,"default":false,"in":"query"}]}},"\/database\/collections":{"get":{"summary":"List Collections","operationId":"databaseListCollections","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Get a list of all the user collections. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project's collections. [Learn more about different API modes](\/docs\/admin).","responses":{"200":{"description":"Collections List","schema":{"$ref":"#\/definitions\/collectionList"}}},"x-appwrite":{"method":"listCollections","weight":72,"cookies":false,"type":"","demo":"database\/list-collections.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/list-collections.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Maximum number of collection to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Offset value. The default value is 0. Use this param to manage pagination. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"cursor","description":"ID of the collection used as the starting point for the query, excluding the collection itself. Should be used for efficient pagination when working with large sets of data.","required":false,"type":"string","x-example":"[CURSOR]","default":"","in":"query"},{"name":"cursorDirection","description":"Direction of the cursor.","required":false,"type":"string","x-example":"after","default":"after","in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create Collection","operationId":"databaseCreateCollection","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Create a new Collection.","responses":{"201":{"description":"Collection","schema":{"$ref":"#\/definitions\/collection"}}},"x-appwrite":{"method":"createCollection","weight":71,"cookies":false,"type":"","demo":"database\/create-collection.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/create-collection.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"collectionId":{"type":"string","description":"Unique Id. Choose your own unique ID or pass the string \"unique()\" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.","default":null,"x-example":"[COLLECTION_ID]"},"name":{"type":"string","description":"Collection name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"permission":{"type":"string","description":"Permissions type model to use for reading documents in this collection. You can use collection-level permission set once on the collection using the `read` and `write` params, or you can set document-level permission where each document read and write params will decide who has access to read and write to each document individually. [learn more about permissions](https:\/\/appwrite.io\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":"document"},"read":{"type":"array","description":"An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](https:\/\/appwrite.io\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":"[\"role:all\"]","items":{"type":"string"}},"write":{"type":"array","description":"An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](https:\/\/appwrite.io\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":"[\"role:all\"]","items":{"type":"string"}}},"required":["collectionId","name","permission","read","write"]}}]}},"\/database\/collections\/{collectionId}":{"get":{"summary":"Get Collection","operationId":"databaseGetCollection","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata.","responses":{"200":{"description":"Collection","schema":{"$ref":"#\/definitions\/collection"}}},"x-appwrite":{"method":"getCollection","weight":73,"cookies":false,"type":"","demo":"database\/get-collection.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/get-collection.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID.","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"}]},"put":{"summary":"Update Collection","operationId":"databaseUpdateCollection","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Update a collection by its unique ID.","responses":{"200":{"description":"Collection","schema":{"$ref":"#\/definitions\/collection"}}},"x-appwrite":{"method":"updateCollection","weight":77,"cookies":false,"type":"","demo":"database\/update-collection.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/update-collection.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID.","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Collection name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"permission":{"type":"string","description":"Permissions type model to use for reading documents in this collection. You can use collection-level permission set once on the collection using the `read` and `write` params, or you can set document-level permission where each document read and write params will decide who has access to read and write to each document individually. [learn more about permissions](https:\/\/appwrite.io\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":"document"},"read":{"type":"array","description":"An array of strings with read permissions. By default inherits the existing read permissions. [learn more about permissions](https:\/\/appwrite.io\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":"[\"role:all\"]","items":{"type":"string"}},"write":{"type":"array","description":"An array of strings with write permissions. By default inherits the existing write permissions. [learn more about permissions](https:\/\/appwrite.io\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":"[\"role:all\"]","items":{"type":"string"}},"enabled":{"type":"boolean","description":"Is collection enabled?","default":true,"x-example":false}},"required":["name","permission"]}}]},"delete":{"summary":"Delete Collection","operationId":"databaseDeleteCollection","consumes":["application\/json"],"produces":[],"tags":["database"],"description":"Delete a collection by its unique ID. Only users with write permissions have access to delete this resource.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteCollection","weight":78,"cookies":false,"type":"","demo":"database\/delete-collection.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/delete-collection.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID.","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"}]}},"\/database\/collections\/{collectionId}\/attributes":{"get":{"summary":"List Attributes","operationId":"databaseListAttributes","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"","responses":{"200":{"description":"Attributes List","schema":{"$ref":"#\/definitions\/attributeList"}}},"x-appwrite":{"method":"listAttributes","weight":87,"cookies":false,"type":"","demo":"database\/list-attributes.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/list-attributes.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"}]}},"\/database\/collections\/{collectionId}\/attributes\/boolean":{"post":{"summary":"Create Boolean Attribute","operationId":"databaseCreateBooleanAttribute","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Create a boolean attribute.\n","responses":{"201":{"description":"AttributeBoolean","schema":{"$ref":"#\/definitions\/attributeBoolean"}}},"x-appwrite":{"method":"createBooleanAttribute","weight":86,"cookies":false,"type":"","demo":"database\/create-boolean-attribute.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/create-boolean-attribute.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"key":{"type":"string","description":"Attribute Key.","default":null,"x-example":null},"required":{"type":"boolean","description":"Is attribute required?","default":null,"x-example":false},"default":{"type":"boolean","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","default":null,"x-example":false},"array":{"type":"boolean","description":"Is attribute an array?","default":false,"x-example":false}},"required":["key","required"]}}]}},"\/database\/collections\/{collectionId}\/attributes\/email":{"post":{"summary":"Create Email Attribute","operationId":"databaseCreateEmailAttribute","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Create an email attribute.\n","responses":{"201":{"description":"AttributeEmail","schema":{"$ref":"#\/definitions\/attributeEmail"}}},"x-appwrite":{"method":"createEmailAttribute","weight":80,"cookies":false,"type":"","demo":"database\/create-email-attribute.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/create-email-attribute.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"key":{"type":"string","description":"Attribute Key.","default":null,"x-example":null},"required":{"type":"boolean","description":"Is attribute required?","default":null,"x-example":false},"default":{"type":"string","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","default":null,"x-example":"email@example.com"},"array":{"type":"boolean","description":"Is attribute an array?","default":false,"x-example":false}},"required":["key","required"]}}]}},"\/database\/collections\/{collectionId}\/attributes\/enum":{"post":{"summary":"Create Enum Attribute","operationId":"databaseCreateEnumAttribute","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"","responses":{"201":{"description":"AttributeEnum","schema":{"$ref":"#\/definitions\/attributeEnum"}}},"x-appwrite":{"method":"createEnumAttribute","weight":81,"cookies":false,"type":"","demo":"database\/create-enum-attribute.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/create-attribute-enum.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"key":{"type":"string","description":"Attribute Key.","default":null,"x-example":null},"elements":{"type":"array","description":"Array of elements in enumerated type. Uses length of longest element to determine size.","default":null,"x-example":null,"items":{"type":"string"}},"required":{"type":"boolean","description":"Is attribute required?","default":null,"x-example":false},"default":{"type":"string","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","default":null,"x-example":"[DEFAULT]"},"array":{"type":"boolean","description":"Is attribute an array?","default":false,"x-example":false}},"required":["key","elements","required"]}}]}},"\/database\/collections\/{collectionId}\/attributes\/float":{"post":{"summary":"Create Float Attribute","operationId":"databaseCreateFloatAttribute","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Create a float attribute. Optionally, minimum and maximum values can be provided.\n","responses":{"201":{"description":"AttributeFloat","schema":{"$ref":"#\/definitions\/attributeFloat"}}},"x-appwrite":{"method":"createFloatAttribute","weight":85,"cookies":false,"type":"","demo":"database\/create-float-attribute.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/create-float-attribute.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"key":{"type":"string","description":"Attribute Key.","default":null,"x-example":null},"required":{"type":"boolean","description":"Is attribute required?","default":null,"x-example":false},"min":{"type":"number","description":"Minimum value to enforce on new documents","default":null,"x-example":null},"max":{"type":"number","description":"Maximum value to enforce on new documents","default":null,"x-example":null},"default":{"type":"number","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","default":null,"x-example":null},"array":{"type":"boolean","description":"Is attribute an array?","default":false,"x-example":false}},"required":["key","required"]}}]}},"\/database\/collections\/{collectionId}\/attributes\/integer":{"post":{"summary":"Create Integer Attribute","operationId":"databaseCreateIntegerAttribute","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Create an integer attribute. Optionally, minimum and maximum values can be provided.\n","responses":{"201":{"description":"AttributeInteger","schema":{"$ref":"#\/definitions\/attributeInteger"}}},"x-appwrite":{"method":"createIntegerAttribute","weight":84,"cookies":false,"type":"","demo":"database\/create-integer-attribute.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/create-integer-attribute.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"key":{"type":"string","description":"Attribute Key.","default":null,"x-example":null},"required":{"type":"boolean","description":"Is attribute required?","default":null,"x-example":false},"min":{"type":"integer","description":"Minimum value to enforce on new documents","default":null,"x-example":null},"max":{"type":"integer","description":"Maximum value to enforce on new documents","default":null,"x-example":null},"default":{"type":"integer","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","default":null,"x-example":null},"array":{"type":"boolean","description":"Is attribute an array?","default":false,"x-example":false}},"required":["key","required"]}}]}},"\/database\/collections\/{collectionId}\/attributes\/ip":{"post":{"summary":"Create IP Address Attribute","operationId":"databaseCreateIpAttribute","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Create IP address attribute.\n","responses":{"201":{"description":"AttributeIP","schema":{"$ref":"#\/definitions\/attributeIp"}}},"x-appwrite":{"method":"createIpAttribute","weight":82,"cookies":false,"type":"","demo":"database\/create-ip-attribute.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/create-ip-attribute.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"key":{"type":"string","description":"Attribute Key.","default":null,"x-example":null},"required":{"type":"boolean","description":"Is attribute required?","default":null,"x-example":false},"default":{"type":"string","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","default":null,"x-example":null},"array":{"type":"boolean","description":"Is attribute an array?","default":false,"x-example":false}},"required":["key","required"]}}]}},"\/database\/collections\/{collectionId}\/attributes\/string":{"post":{"summary":"Create String Attribute","operationId":"databaseCreateStringAttribute","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Create a string attribute.\n","responses":{"201":{"description":"AttributeString","schema":{"$ref":"#\/definitions\/attributeString"}}},"x-appwrite":{"method":"createStringAttribute","weight":79,"cookies":false,"type":"","demo":"database\/create-string-attribute.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/create-string-attribute.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"key":{"type":"string","description":"Attribute Key.","default":null,"x-example":null},"size":{"type":"integer","description":"Attribute size for text attributes, in number of characters.","default":null,"x-example":1},"required":{"type":"boolean","description":"Is attribute required?","default":null,"x-example":false},"default":{"type":"string","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","default":null,"x-example":"[DEFAULT]"},"array":{"type":"boolean","description":"Is attribute an array?","default":false,"x-example":false}},"required":["key","size","required"]}}]}},"\/database\/collections\/{collectionId}\/attributes\/url":{"post":{"summary":"Create URL Attribute","operationId":"databaseCreateUrlAttribute","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Create a URL attribute.\n","responses":{"201":{"description":"AttributeURL","schema":{"$ref":"#\/definitions\/attributeUrl"}}},"x-appwrite":{"method":"createUrlAttribute","weight":83,"cookies":false,"type":"","demo":"database\/create-url-attribute.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/create-url-attribute.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"key":{"type":"string","description":"Attribute Key.","default":null,"x-example":null},"required":{"type":"boolean","description":"Is attribute required?","default":null,"x-example":false},"default":{"type":"string","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","default":null,"x-example":"https:\/\/example.com"},"array":{"type":"boolean","description":"Is attribute an array?","default":false,"x-example":false}},"required":["key","required"]}}]}},"\/database\/collections\/{collectionId}\/attributes\/{key}":{"get":{"summary":"Get Attribute","operationId":"databaseGetAttribute","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"","responses":{"200":{"description":"AttributeBoolean, or AttributeInteger, or AttributeFloat, or AttributeEmail, or AttributeEnum, or AttributeURL, or AttributeIP, or AttributeString","schema":{"x-oneOf":[{"$ref":"#\/definitions\/attributeBoolean"},{"$ref":"#\/definitions\/attributeInteger"},{"$ref":"#\/definitions\/attributeFloat"},{"$ref":"#\/definitions\/attributeEmail"},{"$ref":"#\/definitions\/attributeEnum"},{"$ref":"#\/definitions\/attributeUrl"},{"$ref":"#\/definitions\/attributeIp"},{"$ref":"#\/definitions\/attributeString"}]}}},"x-appwrite":{"method":"getAttribute","weight":88,"cookies":false,"type":"","demo":"database\/get-attribute.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/get-attribute.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"key","description":"Attribute Key.","required":true,"type":"string","in":"path"}]},"delete":{"summary":"Delete Attribute","operationId":"databaseDeleteAttribute","consumes":["application\/json"],"produces":[],"tags":["database"],"description":"","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteAttribute","weight":89,"cookies":false,"type":"","demo":"database\/delete-attribute.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/delete-attribute.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"key","description":"Attribute Key.","required":true,"type":"string","in":"path"}]}},"\/database\/collections\/{collectionId}\/documents":{"get":{"summary":"List Documents","operationId":"databaseListDocuments","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Get a list of all the user documents. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project's documents. [Learn more about different API modes](\/docs\/admin).","responses":{"200":{"description":"Documents List","schema":{"$ref":"#\/definitions\/documentList"}}},"x-appwrite":{"method":"listDocuments","weight":95,"cookies":false,"type":"","demo":"database\/list-documents.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/list-documents.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"documents.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"queries","description":"Array of query strings.","required":false,"type":"array","collectionFormat":"multi","items":{"type":"string"},"default":[],"in":"query"},{"name":"limit","description":"Maximum number of documents to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Offset value. The default value is 0. Use this value to manage pagination. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"cursor","description":"ID of the document used as the starting point for the query, excluding the document itself. Should be used for efficient pagination when working with large sets of data. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"string","x-example":"[CURSOR]","default":"","in":"query"},{"name":"cursorDirection","description":"Direction of the cursor.","required":false,"type":"string","x-example":"after","default":"after","in":"query"},{"name":"orderAttributes","description":"Array of attributes used to sort results.","required":false,"type":"array","collectionFormat":"multi","items":{"type":"string"},"default":[],"in":"query"},{"name":"orderTypes","description":"Array of order directions for sorting attribtues. Possible values are DESC for descending order, or ASC for ascending order.","required":false,"type":"array","collectionFormat":"multi","items":{"type":"string"},"default":[],"in":"query"}]},"post":{"summary":"Create Document","operationId":"databaseCreateDocument","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](\/docs\/server\/database#databaseCreateCollection) API or directly from your database console.","responses":{"201":{"description":"Document","schema":{"$ref":"#\/definitions\/document"}}},"x-appwrite":{"method":"createDocument","weight":94,"cookies":false,"type":"","demo":"database\/create-document.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/create-document.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"documents.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection). Make sure to define attributes before creating documents.","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"documentId":{"type":"string","description":"Document ID. Choose your own unique ID or pass the string \"unique()\" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.","default":null,"x-example":"[DOCUMENT_ID]"},"data":{"type":"object","description":"Document data as JSON object.","default":{},"x-example":"{}"},"read":{"type":"array","description":"An array of strings with read permissions. By default only the current user is granted with read permissions. [learn more about permissions](https:\/\/appwrite.io\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":"[\"role:all\"]","items":{"type":"string"}},"write":{"type":"array","description":"An array of strings with write permissions. By default only the current user is granted with write permissions. [learn more about permissions](https:\/\/appwrite.io\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":"[\"role:all\"]","items":{"type":"string"}}},"required":["documentId","data"]}}]}},"\/database\/collections\/{collectionId}\/documents\/{documentId}":{"get":{"summary":"Get Document","operationId":"databaseGetDocument","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Get a document by its unique ID. This endpoint response returns a JSON object with the document data.","responses":{"200":{"description":"Document","schema":{"$ref":"#\/definitions\/document"}}},"x-appwrite":{"method":"getDocument","weight":96,"cookies":false,"type":"","demo":"database\/get-document.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/get-document.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"documents.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"documentId","description":"Document ID.","required":true,"type":"string","x-example":"[DOCUMENT_ID]","in":"path"}]},"patch":{"summary":"Update Document","operationId":"databaseUpdateDocument","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated.","responses":{"200":{"description":"Document","schema":{"$ref":"#\/definitions\/document"}}},"x-appwrite":{"method":"updateDocument","weight":98,"cookies":false,"type":"","demo":"database\/update-document.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/update-document.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"documents.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"collectionId","description":"Collection ID.","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"documentId","description":"Document ID.","required":true,"type":"string","x-example":"[DOCUMENT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"data":{"type":"object","description":"Document data as JSON object.","default":{},"x-example":"{}"},"read":{"type":"array","description":"An array of strings with read permissions. By default inherits the existing read permissions. [learn more about permissions](https:\/\/appwrite.io\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":"[\"role:all\"]","items":{"type":"string"}},"write":{"type":"array","description":"An array of strings with write permissions. By default inherits the existing write permissions. [learn more about permissions](https:\/\/appwrite.io\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":"[\"role:all\"]","items":{"type":"string"}}},"required":["data"]}}]},"delete":{"summary":"Delete Document","operationId":"databaseDeleteDocument","consumes":["application\/json"],"produces":[],"tags":["database"],"description":"Delete a document by its unique ID. This endpoint deletes only the parent documents, its attributes and relations to other documents. Child documents **will not** be deleted.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteDocument","weight":99,"cookies":false,"type":"","demo":"database\/delete-document.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/delete-document.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"documents.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"documentId","description":"Document ID.","required":true,"type":"string","x-example":"[DOCUMENT_ID]","in":"path"}]}},"\/database\/collections\/{collectionId}\/documents\/{documentId}\/logs":{"get":{"summary":"List Document Logs","operationId":"databaseListDocumentLogs","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Get the document activity logs list by its unique ID.","responses":{"200":{"description":"Logs List","schema":{"$ref":"#\/definitions\/logList"}}},"x-appwrite":{"method":"listDocumentLogs","weight":97,"cookies":false,"type":"","demo":"database\/list-document-logs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/get-document-logs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"documents.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"collectionId","description":"Collection ID.","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"documentId","description":"Document ID.","required":true,"type":"string","x-example":"[DOCUMENT_ID]","in":"path"},{"name":"limit","description":"Maximum number of logs to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Offset value. The default value is 0. Use this value to manage pagination. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"}]}},"\/database\/collections\/{collectionId}\/indexes":{"get":{"summary":"List Indexes","operationId":"databaseListIndexes","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"","responses":{"200":{"description":"Indexes List","schema":{"$ref":"#\/definitions\/indexList"}}},"x-appwrite":{"method":"listIndexes","weight":91,"cookies":false,"type":"","demo":"database\/list-indexes.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/list-indexes.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"}]},"post":{"summary":"Create Index","operationId":"databaseCreateIndex","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"","responses":{"201":{"description":"Index","schema":{"$ref":"#\/definitions\/index"}}},"x-appwrite":{"method":"createIndex","weight":90,"cookies":false,"type":"","demo":"database\/create-index.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/create-index.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"key":{"type":"string","description":"Index Key.","default":null,"x-example":null},"type":{"type":"string","description":"Index type.","default":null,"x-example":"key"},"attributes":{"type":"array","description":"Array of attributes to index.","default":null,"x-example":null,"items":{"type":"string"}},"orders":{"type":"array","description":"Array of index orders.","default":[],"x-example":null,"items":{"type":"string"}}},"required":["key","type","attributes"]}}]}},"\/database\/collections\/{collectionId}\/indexes\/{key}":{"get":{"summary":"Get Index","operationId":"databaseGetIndex","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"","responses":{"200":{"description":"Index","schema":{"$ref":"#\/definitions\/index"}}},"x-appwrite":{"method":"getIndex","weight":92,"cookies":false,"type":"","demo":"database\/get-index.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/get-index.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"key","description":"Index Key.","required":true,"type":"string","in":"path"}]},"delete":{"summary":"Delete Index","operationId":"databaseDeleteIndex","consumes":["application\/json"],"produces":[],"tags":["database"],"description":"","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteIndex","weight":93,"cookies":false,"type":"","demo":"database\/delete-index.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/delete-index.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"key","description":"Index Key.","required":true,"type":"string","in":"path"}]}},"\/database\/collections\/{collectionId}\/logs":{"get":{"summary":"List Collection Logs","operationId":"databaseListCollectionLogs","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Get the collection activity logs list by its unique ID.","responses":{"200":{"description":"Logs List","schema":{"$ref":"#\/definitions\/logList"}}},"x-appwrite":{"method":"listCollectionLogs","weight":76,"cookies":false,"type":"","demo":"database\/list-collection-logs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/get-collection-logs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"collectionId","description":"Collection ID.","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"limit","description":"Maximum number of logs to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Offset value. The default value is 0. Use this value to manage pagination. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"}]}},"\/database\/usage":{"get":{"summary":"Get usage stats for the database","operationId":"databaseGetUsage","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"","responses":{"200":{"description":"UsageDatabase","schema":{"$ref":"#\/definitions\/usageDatabase"}}},"x-appwrite":{"method":"getUsage","weight":74,"cookies":false,"type":"","demo":"database\/get-usage.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"range","description":"Date range.","required":false,"type":"string","x-example":"24h","default":"30d","in":"query"}]}},"\/database\/{collectionId}\/usage":{"get":{"summary":"Get usage stats for a collection","operationId":"databaseGetCollectionUsage","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"","responses":{"200":{"description":"UsageCollection","schema":{"$ref":"#\/definitions\/usageCollection"}}},"x-appwrite":{"method":"getCollectionUsage","weight":75,"cookies":false,"type":"","demo":"database\/get-collection-usage.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"range","description":"Date range.","required":false,"type":"string","x-example":"24h","default":"30d","in":"query"},{"name":"collectionId","description":"Collection ID.","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"}]}},"\/functions":{"get":{"summary":"List Functions","operationId":"functionsList","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Get a list of all the project's functions. You can use the query params to filter your results.","responses":{"200":{"description":"Functions List","schema":{"$ref":"#\/definitions\/functionList"}}},"x-appwrite":{"method":"list","weight":193,"cookies":false,"type":"","demo":"functions\/list.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/list-functions.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Maximum number of functions to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Offset value. The default value is 0. Use this value to manage pagination. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"cursor","description":"ID of the function used as the starting point for the query, excluding the function itself. Should be used for efficient pagination when working with large sets of data. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"string","x-example":"[CURSOR]","default":"","in":"query"},{"name":"cursorDirection","description":"Direction of the cursor.","required":false,"type":"string","x-example":"after","default":"after","in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create Function","operationId":"functionsCreate","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Create a new function. You can pass a list of [permissions](\/docs\/permissions) to allow different project users or team with access to execute the function using the client API.","responses":{"201":{"description":"Function","schema":{"$ref":"#\/definitions\/function"}}},"x-appwrite":{"method":"create","weight":192,"cookies":false,"type":"","demo":"functions\/create.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/create-function.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"functionId":{"type":"string","description":"Function ID. Choose your own unique ID or pass the string \"unique()\" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.","default":null,"x-example":"[FUNCTION_ID]"},"name":{"type":"string","description":"Function name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"execute":{"type":"array","description":"An array of strings with execution permissions. By default no user is granted with any execute permissions. [learn more about permissions](https:\/\/appwrite.io\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}},"runtime":{"type":"string","description":"Execution runtime.","default":null,"x-example":"node-14.5"},"vars":{"type":"object","description":"Key-value JSON object that will be passed to the function as environment variables.","default":[],"x-example":"{}"},"events":{"type":"array","description":"Events list.","default":[],"x-example":null,"items":{"type":"string"}},"schedule":{"type":"string","description":"Schedule CRON syntax.","default":"","x-example":null},"timeout":{"type":"integer","description":"Function maximum execution time in seconds.","default":15,"x-example":1}},"required":["functionId","name","execute","runtime"]}}]}},"\/functions\/runtimes":{"get":{"summary":"List the currently active function runtimes.","operationId":"functionsListRuntimes","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Get a list of all runtimes that are currently active in your project.","responses":{"200":{"description":"Runtimes List","schema":{"$ref":"#\/definitions\/runtimeList"}}},"x-appwrite":{"method":"listRuntimes","weight":194,"cookies":false,"type":"","demo":"functions\/list-runtimes.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/list-runtimes.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/functions\/{functionId}":{"get":{"summary":"Get Function","operationId":"functionsGet","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Get a function by its unique ID.","responses":{"200":{"description":"Function","schema":{"$ref":"#\/definitions\/function"}}},"x-appwrite":{"method":"get","weight":195,"cookies":false,"type":"","demo":"functions\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/get-function.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"}]},"put":{"summary":"Update Function","operationId":"functionsUpdate","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Update function by its unique ID.","responses":{"200":{"description":"Function","schema":{"$ref":"#\/definitions\/function"}}},"x-appwrite":{"method":"update","weight":197,"cookies":false,"type":"","demo":"functions\/update.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/update-function.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Function name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"execute":{"type":"array","description":"An array of strings with execution permissions. By default no user is granted with any execute permissions. [learn more about permissions](https:\/\/appwrite.io\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}},"vars":{"type":"object","description":"Key-value JSON object that will be passed to the function as environment variables.","default":[],"x-example":"{}"},"events":{"type":"array","description":"Events list.","default":[],"x-example":null,"items":{"type":"string"}},"schedule":{"type":"string","description":"Schedule CRON syntax.","default":"","x-example":null},"timeout":{"type":"integer","description":"Maximum execution time in seconds.","default":15,"x-example":1}},"required":["name","execute"]}}]},"delete":{"summary":"Delete Function","operationId":"functionsDelete","consumes":["application\/json"],"produces":[],"tags":["functions"],"description":"Delete a function by its unique ID.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"delete","weight":199,"cookies":false,"type":"","demo":"functions\/delete.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/delete-function.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"}]}},"\/functions\/{functionId}\/deployments":{"get":{"summary":"List Deployments","operationId":"functionsListDeployments","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Get a list of all the project's code deployments. You can use the query params to filter your results.","responses":{"200":{"description":"Deployments List","schema":{"$ref":"#\/definitions\/deploymentList"}}},"x-appwrite":{"method":"listDeployments","weight":201,"cookies":false,"type":"","demo":"functions\/list-deployments.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/list-deployments.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Maximum number of deployments to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Offset value. The default value is 0. Use this value to manage pagination. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"cursor","description":"ID of the deployment used as the starting point for the query, excluding the deployment itself. Should be used for efficient pagination when working with large sets of data. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"string","x-example":"[CURSOR]","default":"","in":"query"},{"name":"cursorDirection","description":"Direction of the cursor.","required":false,"type":"string","x-example":"after","default":"after","in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create Deployment","operationId":"functionsCreateDeployment","consumes":["multipart\/form-data"],"produces":["application\/json"],"tags":["functions"],"description":"Create a new function code deployment. Use this endpoint to upload a new version of your code function. To execute your newly uploaded code, you'll need to update the function's deployment to use your new deployment UID.\n\nThis endpoint accepts a tar.gz file compressed with your code. Make sure to include any dependencies your code has within the compressed file. You can learn more about code packaging in the [Appwrite Cloud Functions tutorial](\/docs\/functions).\n\nUse the \"command\" param to set the entry point used to execute your code.","responses":{"201":{"description":"Deployment","schema":{"$ref":"#\/definitions\/deployment"}}},"x-appwrite":{"method":"createDeployment","weight":200,"cookies":false,"type":"","demo":"functions\/create-deployment.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/create-deployment.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.write","platforms":["server"],"packaging":true,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"entrypoint","description":"Entrypoint File.","required":true,"type":"string","x-example":"[ENTRYPOINT]","in":"formData"},{"name":"code","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.","required":true,"type":"file","in":"formData"},{"name":"activate","description":"Automatically activate the deployment when it is finished building.","required":true,"type":"boolean","x-example":false,"in":"formData"}]}},"\/functions\/{functionId}\/deployments\/{deploymentId}":{"get":{"summary":"Get Deployment","operationId":"functionsGetDeployment","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Get a code deployment by its unique ID.","responses":{"200":{"description":"Deployments List","schema":{"$ref":"#\/definitions\/deploymentList"}}},"x-appwrite":{"method":"getDeployment","weight":202,"cookies":false,"type":"","demo":"functions\/get-deployment.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/get-deployment.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"deploymentId","description":"Deployment ID.","required":true,"type":"string","x-example":"[DEPLOYMENT_ID]","in":"path"}]},"patch":{"summary":"Update Function Deployment","operationId":"functionsUpdateDeployment","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Update the function code deployment ID using the unique function ID. Use this endpoint to switch the code deployment that should be executed by the execution endpoint.","responses":{"200":{"description":"Function","schema":{"$ref":"#\/definitions\/function"}}},"x-appwrite":{"method":"updateDeployment","weight":198,"cookies":false,"type":"","demo":"functions\/update-deployment.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/update-function-deployment.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"deploymentId","description":"Deployment ID.","required":true,"type":"string","x-example":"[DEPLOYMENT_ID]","in":"path"}]},"delete":{"summary":"Delete Deployment","operationId":"functionsDeleteDeployment","consumes":["application\/json"],"produces":[],"tags":["functions"],"description":"Delete a code deployment by its unique ID.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteDeployment","weight":203,"cookies":false,"type":"","demo":"functions\/delete-deployment.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/delete-deployment.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"deploymentId","description":"Deployment ID.","required":true,"type":"string","x-example":"[DEPLOYMENT_ID]","in":"path"}]}},"\/functions\/{functionId}\/deployments\/{deploymentId}\/builds\/{buildId}":{"post":{"summary":"Retry Build","operationId":"functionsRetryBuild","consumes":["application\/json"],"produces":[],"tags":["functions"],"description":"","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"retryBuild","weight":207,"cookies":false,"type":"","demo":"functions\/retry-build.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/retry-build.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"functionId","description":"Function ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"deploymentId","description":"Deployment ID.","required":true,"type":"string","x-example":"[DEPLOYMENT_ID]","in":"path"},{"name":"buildId","description":"Build unique ID.","required":true,"type":"string","x-example":"[BUILD_ID]","in":"path"}]}},"\/functions\/{functionId}\/executions":{"get":{"summary":"List Executions","operationId":"functionsListExecutions","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Get a list of all the current user function execution logs. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project's executions. [Learn more about different API modes](\/docs\/admin).","responses":{"200":{"description":"Executions List","schema":{"$ref":"#\/definitions\/executionList"}}},"x-appwrite":{"method":"listExecutions","weight":205,"cookies":false,"type":"","demo":"functions\/list-executions.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/list-executions.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"execution.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"functionId","description":"Function ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"limit","description":"Maximum number of executions to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Offset value. The default value is 0. Use this value to manage pagination. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"cursor","description":"ID of the execution used as the starting point for the query, excluding the execution itself. Should be used for efficient pagination when working with large sets of data. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"string","x-example":"[CURSOR]","default":"","in":"query"},{"name":"cursorDirection","description":"Direction of the cursor.","required":false,"type":"string","x-example":"after","default":"after","in":"query"}]},"post":{"summary":"Create Execution","operationId":"functionsCreateExecution","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Trigger a function execution. The returned object will return you the current execution status. You can ping the `Get Execution` endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously.","responses":{"201":{"description":"Execution","schema":{"$ref":"#\/definitions\/execution"}}},"x-appwrite":{"method":"createExecution","weight":204,"cookies":false,"type":"","demo":"functions\/create-execution.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/create-execution.md","rate-limit":60,"rate-time":60,"rate-key":"url:{url},ip:{ip}","scope":"execution.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"functionId","description":"Function ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"data":{"type":"string","description":"String of custom data to send to function.","default":"","x-example":"[DATA]"},"async":{"type":"boolean","description":"Execute code asynchronously. Default value is true.","default":true,"x-example":false}}}}]}},"\/functions\/{functionId}\/executions\/{executionId}":{"get":{"summary":"Get Execution","operationId":"functionsGetExecution","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Get a function execution log by its unique ID.","responses":{"200":{"description":"Execution","schema":{"$ref":"#\/definitions\/execution"}}},"x-appwrite":{"method":"getExecution","weight":206,"cookies":false,"type":"","demo":"functions\/get-execution.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/get-execution.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"execution.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"functionId","description":"Function ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"executionId","description":"Execution ID.","required":true,"type":"string","x-example":"[EXECUTION_ID]","in":"path"}]}},"\/functions\/{functionId}\/usage":{"get":{"summary":"Get Function Usage","operationId":"functionsGetUsage","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"","responses":{"200":{"description":"UsageFunctions","schema":{"$ref":"#\/definitions\/usageFunctions"}}},"x-appwrite":{"method":"getUsage","weight":196,"cookies":false,"type":"","demo":"functions\/get-usage.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"functionId","description":"Function ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"range","description":"Date range.","required":false,"type":"string","x-example":"24h","default":"30d","in":"query"}]}},"\/health":{"get":{"summary":"Get HTTP","operationId":"healthGet","consumes":["application\/json"],"produces":["application\/json"],"tags":["health"],"description":"Check the Appwrite HTTP server is up and responsive.","responses":{"200":{"description":"Health Status","schema":{"$ref":"#\/definitions\/healthStatus"}}},"x-appwrite":{"method":"get","weight":107,"cookies":false,"type":"","demo":"health\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/anti-virus":{"get":{"summary":"Get Antivirus","operationId":"healthGetAntivirus","consumes":["application\/json"],"produces":["application\/json"],"tags":["health"],"description":"Check the Appwrite Antivirus server is up and connection is successful.","responses":{"200":{"description":"Health Antivirus","schema":{"$ref":"#\/definitions\/healthAntivirus"}}},"x-appwrite":{"method":"getAntivirus","weight":118,"cookies":false,"type":"","demo":"health\/get-antivirus.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-storage-anti-virus.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/cache":{"get":{"summary":"Get Cache","operationId":"healthGetCache","consumes":["application\/json"],"produces":["application\/json"],"tags":["health"],"description":"Check the Appwrite in-memory cache server is up and connection is successful.","responses":{"200":{"description":"Health Status","schema":{"$ref":"#\/definitions\/healthStatus"}}},"x-appwrite":{"method":"getCache","weight":110,"cookies":false,"type":"","demo":"health\/get-cache.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-cache.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/db":{"get":{"summary":"Get DB","operationId":"healthGetDB","consumes":["application\/json"],"produces":["application\/json"],"tags":["health"],"description":"Check the Appwrite database server is up and connection is successful.","responses":{"200":{"description":"Health Status","schema":{"$ref":"#\/definitions\/healthStatus"}}},"x-appwrite":{"method":"getDB","weight":109,"cookies":false,"type":"","demo":"health\/get-d-b.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-db.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/queue\/certificates":{"get":{"summary":"Get Certificates Queue","operationId":"healthGetQueueCertificates","consumes":["application\/json"],"produces":["application\/json"],"tags":["health"],"description":"Get the number of certificates that are waiting to be issued against [Letsencrypt](https:\/\/letsencrypt.org\/) in the Appwrite internal queue server.","responses":{"200":{"description":"Health Queue","schema":{"$ref":"#\/definitions\/healthQueue"}}},"x-appwrite":{"method":"getQueueCertificates","weight":115,"cookies":false,"type":"","demo":"health\/get-queue-certificates.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-certificates.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/queue\/functions":{"get":{"summary":"Get Functions Queue","operationId":"healthGetQueueFunctions","consumes":["application\/json"],"produces":["application\/json"],"tags":["health"],"description":"","responses":{"200":{"description":"Health Queue","schema":{"$ref":"#\/definitions\/healthQueue"}}},"x-appwrite":{"method":"getQueueFunctions","weight":116,"cookies":false,"type":"","demo":"health\/get-queue-functions.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-functions.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/queue\/logs":{"get":{"summary":"Get Logs Queue","operationId":"healthGetQueueLogs","consumes":["application\/json"],"produces":["application\/json"],"tags":["health"],"description":"Get the number of logs that are waiting to be processed in the Appwrite internal queue server.","responses":{"200":{"description":"Health Queue","schema":{"$ref":"#\/definitions\/healthQueue"}}},"x-appwrite":{"method":"getQueueLogs","weight":113,"cookies":false,"type":"","demo":"health\/get-queue-logs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-logs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/queue\/usage":{"get":{"summary":"Get Usage Queue","operationId":"healthGetQueueUsage","consumes":["application\/json"],"produces":["application\/json"],"tags":["health"],"description":"Get the number of usage stats that are waiting to be processed in the Appwrite internal queue server.","responses":{"200":{"description":"Health Queue","schema":{"$ref":"#\/definitions\/healthQueue"}}},"x-appwrite":{"method":"getQueueUsage","weight":114,"cookies":false,"type":"","demo":"health\/get-queue-usage.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-usage.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/queue\/webhooks":{"get":{"summary":"Get Webhooks Queue","operationId":"healthGetQueueWebhooks","consumes":["application\/json"],"produces":["application\/json"],"tags":["health"],"description":"Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server.","responses":{"200":{"description":"Health Queue","schema":{"$ref":"#\/definitions\/healthQueue"}}},"x-appwrite":{"method":"getQueueWebhooks","weight":112,"cookies":false,"type":"","demo":"health\/get-queue-webhooks.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-webhooks.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/storage\/local":{"get":{"summary":"Get Local Storage","operationId":"healthGetStorageLocal","consumes":["application\/json"],"produces":["application\/json"],"tags":["health"],"description":"Check the Appwrite local storage device is up and connection is successful.","responses":{"200":{"description":"Health Status","schema":{"$ref":"#\/definitions\/healthStatus"}}},"x-appwrite":{"method":"getStorageLocal","weight":117,"cookies":false,"type":"","demo":"health\/get-storage-local.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-storage-local.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/time":{"get":{"summary":"Get Time","operationId":"healthGetTime","consumes":["application\/json"],"produces":["application\/json"],"tags":["health"],"description":"Check the Appwrite server time is synced with Google remote NTP server. We use this technology to smoothly handle leap seconds with no disruptive events. The [Network Time Protocol](https:\/\/en.wikipedia.org\/wiki\/Network_Time_Protocol) (NTP) is used by hundreds of millions of computers and devices to synchronize their clocks over the Internet. If your computer sets its own clock, it likely uses NTP.","responses":{"200":{"description":"Health Time","schema":{"$ref":"#\/definitions\/healthTime"}}},"x-appwrite":{"method":"getTime","weight":111,"cookies":false,"type":"","demo":"health\/get-time.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-time.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/locale":{"get":{"summary":"Get User Locale","operationId":"localeGet","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"Get the current user location based on IP. Returns an object with user country code, country name, continent name, continent code, ip address and suggested currency. You can use the locale header to get the data in a supported language.\n\n([IP Geolocation by DB-IP](https:\/\/db-ip.com))","responses":{"200":{"description":"Locale","schema":{"$ref":"#\/definitions\/locale"}}},"x-appwrite":{"method":"get","weight":100,"cookies":false,"type":"","demo":"locale\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-locale.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}]}},"\/locale\/continents":{"get":{"summary":"List Continents","operationId":"localeGetContinents","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"List of all continents. You can use the locale header to get the data in a supported language.","responses":{"200":{"description":"Continents List","schema":{"$ref":"#\/definitions\/continentList"}}},"x-appwrite":{"method":"getContinents","weight":104,"cookies":false,"type":"","demo":"locale\/get-continents.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-continents.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}]}},"\/locale\/countries":{"get":{"summary":"List Countries","operationId":"localeGetCountries","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"List of all countries. You can use the locale header to get the data in a supported language.","responses":{"200":{"description":"Countries List","schema":{"$ref":"#\/definitions\/countryList"}}},"x-appwrite":{"method":"getCountries","weight":101,"cookies":false,"type":"","demo":"locale\/get-countries.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-countries.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}]}},"\/locale\/countries\/eu":{"get":{"summary":"List EU Countries","operationId":"localeGetCountriesEU","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"List of all countries that are currently members of the EU. You can use the locale header to get the data in a supported language.","responses":{"200":{"description":"Countries List","schema":{"$ref":"#\/definitions\/countryList"}}},"x-appwrite":{"method":"getCountriesEU","weight":102,"cookies":false,"type":"","demo":"locale\/get-countries-e-u.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-countries-eu.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}]}},"\/locale\/countries\/phones":{"get":{"summary":"List Countries Phone Codes","operationId":"localeGetCountriesPhones","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"List of all countries phone codes. You can use the locale header to get the data in a supported language.","responses":{"200":{"description":"Phones List","schema":{"$ref":"#\/definitions\/phoneList"}}},"x-appwrite":{"method":"getCountriesPhones","weight":103,"cookies":false,"type":"","demo":"locale\/get-countries-phones.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-countries-phones.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}]}},"\/locale\/currencies":{"get":{"summary":"List Currencies","operationId":"localeGetCurrencies","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"List of all currencies, including currency symbol, name, plural, and decimal digits for all major and minor currencies. You can use the locale header to get the data in a supported language.","responses":{"200":{"description":"Currencies List","schema":{"$ref":"#\/definitions\/currencyList"}}},"x-appwrite":{"method":"getCurrencies","weight":105,"cookies":false,"type":"","demo":"locale\/get-currencies.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-currencies.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}]}},"\/locale\/languages":{"get":{"summary":"List Languages","operationId":"localeGetLanguages","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"List of all languages classified by ISO 639-1 including 2-letter code, name in English, and name in the respective language.","responses":{"200":{"description":"Languages List","schema":{"$ref":"#\/definitions\/languageList"}}},"x-appwrite":{"method":"getLanguages","weight":106,"cookies":false,"type":"","demo":"locale\/get-languages.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-languages.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}]}},"\/projects":{"get":{"summary":"List Projects","operationId":"projectsList","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Projects List","schema":{"$ref":"#\/definitions\/projectList"}}},"x-appwrite":{"method":"list","weight":121,"cookies":false,"type":"","demo":"projects\/list.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Results offset. The default value is 0. Use this param to manage pagination. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"cursor","description":"ID of the project used as the starting point for the query, excluding the project itself. Should be used for efficient pagination when working with large sets of data. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"string","x-example":"[CURSOR]","default":"","in":"query"},{"name":"cursorDirection","description":"Direction of the cursor.","required":false,"type":"string","x-example":"after","default":"after","in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create Project","operationId":"projectsCreate","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"201":{"description":"Project","schema":{"$ref":"#\/definitions\/project"}}},"x-appwrite":{"method":"create","weight":120,"cookies":false,"type":"","demo":"projects\/create.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"projectId":{"type":"string","description":"Unique Id. Choose your own unique ID or pass the string \"unique()\" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.","default":null,"x-example":"[PROJECT_ID]"},"name":{"type":"string","description":"Project name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"teamId":{"type":"string","description":"Team unique ID.","default":null,"x-example":"[TEAM_ID]"},"description":{"type":"string","description":"Project description. Max length: 256 chars.","default":"","x-example":"[DESCRIPTION]"},"logo":{"type":"string","description":"Project logo.","default":"","x-example":"[LOGO]"},"url":{"type":"string","description":"Project URL.","default":"","x-example":"https:\/\/example.com"},"legalName":{"type":"string","description":"Project legal Name. Max length: 256 chars.","default":"","x-example":"[LEGAL_NAME]"},"legalCountry":{"type":"string","description":"Project legal Country. Max length: 256 chars.","default":"","x-example":"[LEGAL_COUNTRY]"},"legalState":{"type":"string","description":"Project legal State. Max length: 256 chars.","default":"","x-example":"[LEGAL_STATE]"},"legalCity":{"type":"string","description":"Project legal City. Max length: 256 chars.","default":"","x-example":"[LEGAL_CITY]"},"legalAddress":{"type":"string","description":"Project legal Address. Max length: 256 chars.","default":"","x-example":"[LEGAL_ADDRESS]"},"legalTaxId":{"type":"string","description":"Project legal Tax ID. Max length: 256 chars.","default":"","x-example":"[LEGAL_TAX_ID]"}},"required":["projectId","name","teamId"]}}]}},"\/projects\/{projectId}":{"get":{"summary":"Get Project","operationId":"projectsGet","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Project","schema":{"$ref":"#\/definitions\/project"}}},"x-appwrite":{"method":"get","weight":122,"cookies":false,"type":"","demo":"projects\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"}]},"patch":{"summary":"Update Project","operationId":"projectsUpdate","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Project","schema":{"$ref":"#\/definitions\/project"}}},"x-appwrite":{"method":"update","weight":124,"cookies":false,"type":"","demo":"projects\/update.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Project name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"description":{"type":"string","description":"Project description. Max length: 256 chars.","default":"","x-example":"[DESCRIPTION]"},"logo":{"type":"string","description":"Project logo.","default":"","x-example":"[LOGO]"},"url":{"type":"string","description":"Project URL.","default":"","x-example":"https:\/\/example.com"},"legalName":{"type":"string","description":"Project legal name. Max length: 256 chars.","default":"","x-example":"[LEGAL_NAME]"},"legalCountry":{"type":"string","description":"Project legal country. Max length: 256 chars.","default":"","x-example":"[LEGAL_COUNTRY]"},"legalState":{"type":"string","description":"Project legal state. Max length: 256 chars.","default":"","x-example":"[LEGAL_STATE]"},"legalCity":{"type":"string","description":"Project legal city. Max length: 256 chars.","default":"","x-example":"[LEGAL_CITY]"},"legalAddress":{"type":"string","description":"Project legal address. Max length: 256 chars.","default":"","x-example":"[LEGAL_ADDRESS]"},"legalTaxId":{"type":"string","description":"Project legal tax ID. Max length: 256 chars.","default":"","x-example":"[LEGAL_TAX_ID]"}},"required":["name"]}}]},"delete":{"summary":"Delete Project","operationId":"projectsDelete","consumes":["application\/json"],"produces":[],"tags":["projects"],"description":"","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"delete","weight":129,"cookies":false,"type":"","demo":"projects\/delete.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"password":{"type":"string","description":"Your user password for confirmation. Must be at least 8 chars.","default":null,"x-example":"password"}},"required":["password"]}}]}},"\/projects\/{projectId}\/auth\/limit":{"patch":{"summary":"Update Project users limit","operationId":"projectsUpdateAuthLimit","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Project","schema":{"$ref":"#\/definitions\/project"}}},"x-appwrite":{"method":"updateAuthLimit","weight":127,"cookies":false,"type":"","demo":"projects\/update-auth-limit.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"limit":{"type":"integer","description":"Set the max number of users allowed in this project. Use 0 for unlimited.","default":null,"x-example":0}},"required":["limit"]}}]}},"\/projects\/{projectId}\/auth\/{method}":{"patch":{"summary":"Update Project auth method status. Use this endpoint to enable or disable a given auth method for this project.","operationId":"projectsUpdateAuthStatus","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Project","schema":{"$ref":"#\/definitions\/project"}}},"x-appwrite":{"method":"updateAuthStatus","weight":128,"cookies":false,"type":"","demo":"projects\/update-auth-status.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"method","description":"Auth Method. Possible values: email-password,magic-url,anonymous,invites,jwt,phone","required":true,"type":"string","x-example":"email-password","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"status":{"type":"boolean","description":"Set the status of this auth method.","default":null,"x-example":false}},"required":["status"]}}]}},"\/projects\/{projectId}\/domains":{"get":{"summary":"List Domains","operationId":"projectsListDomains","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Domains List","schema":{"$ref":"#\/definitions\/domainList"}}},"x-appwrite":{"method":"listDomains","weight":146,"cookies":false,"type":"","demo":"projects\/list-domains.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"}]},"post":{"summary":"Create Domain","operationId":"projectsCreateDomain","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"201":{"description":"Domain","schema":{"$ref":"#\/definitions\/domain"}}},"x-appwrite":{"method":"createDomain","weight":145,"cookies":false,"type":"","demo":"projects\/create-domain.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"domain":{"type":"string","description":"Domain name.","default":null,"x-example":null}},"required":["domain"]}}]}},"\/projects\/{projectId}\/domains\/{domainId}":{"get":{"summary":"Get Domain","operationId":"projectsGetDomain","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Domain","schema":{"$ref":"#\/definitions\/domain"}}},"x-appwrite":{"method":"getDomain","weight":147,"cookies":false,"type":"","demo":"projects\/get-domain.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"domainId","description":"Domain unique ID.","required":true,"type":"string","x-example":"[DOMAIN_ID]","in":"path"}]},"delete":{"summary":"Delete Domain","operationId":"projectsDeleteDomain","consumes":["application\/json"],"produces":[],"tags":["projects"],"description":"","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteDomain","weight":149,"cookies":false,"type":"","demo":"projects\/delete-domain.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"domainId","description":"Domain unique ID.","required":true,"type":"string","x-example":"[DOMAIN_ID]","in":"path"}]}},"\/projects\/{projectId}\/domains\/{domainId}\/verification":{"patch":{"summary":"Update Domain Verification Status","operationId":"projectsUpdateDomainVerification","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Domain","schema":{"$ref":"#\/definitions\/domain"}}},"x-appwrite":{"method":"updateDomainVerification","weight":148,"cookies":false,"type":"","demo":"projects\/update-domain-verification.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"domainId","description":"Domain unique ID.","required":true,"type":"string","x-example":"[DOMAIN_ID]","in":"path"}]}},"\/projects\/{projectId}\/keys":{"get":{"summary":"List Keys","operationId":"projectsListKeys","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"API Keys List","schema":{"$ref":"#\/definitions\/keyList"}}},"x-appwrite":{"method":"listKeys","weight":136,"cookies":false,"type":"","demo":"projects\/list-keys.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"}]},"post":{"summary":"Create Key","operationId":"projectsCreateKey","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"201":{"description":"Key","schema":{"$ref":"#\/definitions\/key"}}},"x-appwrite":{"method":"createKey","weight":135,"cookies":false,"type":"","demo":"projects\/create-key.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Key name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"scopes":{"type":"array","description":"Key scopes list.","default":null,"x-example":null,"items":{"type":"string"}}},"required":["name","scopes"]}}]}},"\/projects\/{projectId}\/keys\/{keyId}":{"get":{"summary":"Get Key","operationId":"projectsGetKey","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Key","schema":{"$ref":"#\/definitions\/key"}}},"x-appwrite":{"method":"getKey","weight":137,"cookies":false,"type":"","demo":"projects\/get-key.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"keyId","description":"Key unique ID.","required":true,"type":"string","x-example":"[KEY_ID]","in":"path"}]},"put":{"summary":"Update Key","operationId":"projectsUpdateKey","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Key","schema":{"$ref":"#\/definitions\/key"}}},"x-appwrite":{"method":"updateKey","weight":138,"cookies":false,"type":"","demo":"projects\/update-key.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"keyId","description":"Key unique ID.","required":true,"type":"string","x-example":"[KEY_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Key name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"scopes":{"type":"array","description":"Key scopes list","default":null,"x-example":null,"items":{"type":"string"}}},"required":["name","scopes"]}}]},"delete":{"summary":"Delete Key","operationId":"projectsDeleteKey","consumes":["application\/json"],"produces":[],"tags":["projects"],"description":"","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteKey","weight":139,"cookies":false,"type":"","demo":"projects\/delete-key.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"keyId","description":"Key unique ID.","required":true,"type":"string","x-example":"[KEY_ID]","in":"path"}]}},"\/projects\/{projectId}\/oauth2":{"patch":{"summary":"Update Project OAuth2","operationId":"projectsUpdateOAuth2","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Project","schema":{"$ref":"#\/definitions\/project"}}},"x-appwrite":{"method":"updateOAuth2","weight":126,"cookies":false,"type":"","demo":"projects\/update-o-auth2.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"provider":{"type":"string","description":"Provider Name","default":null,"x-example":"amazon"},"appId":{"type":"string","description":"Provider app ID. Max length: 256 chars.","default":"","x-example":"[APP_ID]"},"secret":{"type":"string","description":"Provider secret key. Max length: 512 chars.","default":"","x-example":"[SECRET]"}},"required":["provider"]}}]}},"\/projects\/{projectId}\/platforms":{"get":{"summary":"List Platforms","operationId":"projectsListPlatforms","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Platforms List","schema":{"$ref":"#\/definitions\/platformList"}}},"x-appwrite":{"method":"listPlatforms","weight":141,"cookies":false,"type":"","demo":"projects\/list-platforms.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"}]},"post":{"summary":"Create Platform","operationId":"projectsCreatePlatform","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"201":{"description":"Platform","schema":{"$ref":"#\/definitions\/platform"}}},"x-appwrite":{"method":"createPlatform","weight":140,"cookies":false,"type":"","demo":"projects\/create-platform.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"type":{"type":"string","description":"Platform type.","default":null,"x-example":"web"},"name":{"type":"string","description":"Platform name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"key":{"type":"string","description":"Package name for Android or bundle ID for iOS or macOS. Max length: 256 chars.","default":"","x-example":"[KEY]"},"store":{"type":"string","description":"App store or Google Play store ID. Max length: 256 chars.","default":"","x-example":"[STORE]"},"hostname":{"type":"string","description":"Platform client hostname. Max length: 256 chars.","default":"","x-example":"[HOSTNAME]"}},"required":["type","name"]}}]}},"\/projects\/{projectId}\/platforms\/{platformId}":{"get":{"summary":"Get Platform","operationId":"projectsGetPlatform","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Platform","schema":{"$ref":"#\/definitions\/platform"}}},"x-appwrite":{"method":"getPlatform","weight":142,"cookies":false,"type":"","demo":"projects\/get-platform.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"platformId","description":"Platform unique ID.","required":true,"type":"string","x-example":"[PLATFORM_ID]","in":"path"}]},"put":{"summary":"Update Platform","operationId":"projectsUpdatePlatform","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Platform","schema":{"$ref":"#\/definitions\/platform"}}},"x-appwrite":{"method":"updatePlatform","weight":143,"cookies":false,"type":"","demo":"projects\/update-platform.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"platformId","description":"Platform unique ID.","required":true,"type":"string","x-example":"[PLATFORM_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Platform name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"key":{"type":"string","description":"Package name for android or bundle ID for iOS. Max length: 256 chars.","default":"","x-example":"[KEY]"},"store":{"type":"string","description":"App store or Google Play store ID. Max length: 256 chars.","default":"","x-example":"[STORE]"},"hostname":{"type":"string","description":"Platform client URL. Max length: 256 chars.","default":"","x-example":"[HOSTNAME]"}},"required":["name"]}}]},"delete":{"summary":"Delete Platform","operationId":"projectsDeletePlatform","consumes":["application\/json"],"produces":[],"tags":["projects"],"description":"","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deletePlatform","weight":144,"cookies":false,"type":"","demo":"projects\/delete-platform.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"platformId","description":"Platform unique ID.","required":true,"type":"string","x-example":"[PLATFORM_ID]","in":"path"}]}},"\/projects\/{projectId}\/service":{"patch":{"summary":"Update service status","operationId":"projectsUpdateServiceStatus","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Project","schema":{"$ref":"#\/definitions\/project"}}},"x-appwrite":{"method":"updateServiceStatus","weight":125,"cookies":false,"type":"","demo":"projects\/update-service-status.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"service":{"type":"string","description":"Service name.","default":null,"x-example":"account"},"status":{"type":"boolean","description":"Service status.","default":null,"x-example":false}},"required":["service","status"]}}]}},"\/projects\/{projectId}\/usage":{"get":{"summary":"Get usage stats for a project","operationId":"projectsGetUsage","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"UsageProject","schema":{"$ref":"#\/definitions\/usageProject"}}},"x-appwrite":{"method":"getUsage","weight":123,"cookies":false,"type":"","demo":"projects\/get-usage.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"range","description":"Date range.","required":false,"type":"string","x-example":"24h","default":"30d","in":"query"}]}},"\/projects\/{projectId}\/webhooks":{"get":{"summary":"List Webhooks","operationId":"projectsListWebhooks","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Webhooks List","schema":{"$ref":"#\/definitions\/webhookList"}}},"x-appwrite":{"method":"listWebhooks","weight":131,"cookies":false,"type":"","demo":"projects\/list-webhooks.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"}]},"post":{"summary":"Create Webhook","operationId":"projectsCreateWebhook","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"201":{"description":"Webhook","schema":{"$ref":"#\/definitions\/webhook"}}},"x-appwrite":{"method":"createWebhook","weight":130,"cookies":false,"type":"","demo":"projects\/create-webhook.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Webhook name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"events":{"type":"array","description":"Events list.","default":null,"x-example":null,"items":{"type":"string"}},"url":{"type":"string","description":"Webhook URL.","default":null,"x-example":"https:\/\/example.com"},"security":{"type":"boolean","description":"Certificate verification, false for disabled or true for enabled.","default":null,"x-example":false},"httpUser":{"type":"string","description":"Webhook HTTP user. Max length: 256 chars.","default":"","x-example":"[HTTP_USER]"},"httpPass":{"type":"string","description":"Webhook HTTP password. Max length: 256 chars.","default":"","x-example":"[HTTP_PASS]"}},"required":["name","events","url","security"]}}]}},"\/projects\/{projectId}\/webhooks\/{webhookId}":{"get":{"summary":"Get Webhook","operationId":"projectsGetWebhook","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Webhook","schema":{"$ref":"#\/definitions\/webhook"}}},"x-appwrite":{"method":"getWebhook","weight":132,"cookies":false,"type":"","demo":"projects\/get-webhook.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"webhookId","description":"Webhook unique ID.","required":true,"type":"string","x-example":"[WEBHOOK_ID]","in":"path"}]},"put":{"summary":"Update Webhook","operationId":"projectsUpdateWebhook","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Webhook","schema":{"$ref":"#\/definitions\/webhook"}}},"x-appwrite":{"method":"updateWebhook","weight":133,"cookies":false,"type":"","demo":"projects\/update-webhook.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"webhookId","description":"Webhook unique ID.","required":true,"type":"string","x-example":"[WEBHOOK_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Webhook name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"events":{"type":"array","description":"Events list.","default":null,"x-example":null,"items":{"type":"string"}},"url":{"type":"string","description":"Webhook URL.","default":null,"x-example":"https:\/\/example.com"},"security":{"type":"boolean","description":"Certificate verification, false for disabled or true for enabled.","default":null,"x-example":false},"httpUser":{"type":"string","description":"Webhook HTTP user. Max length: 256 chars.","default":"","x-example":"[HTTP_USER]"},"httpPass":{"type":"string","description":"Webhook HTTP password. Max length: 256 chars.","default":"","x-example":"[HTTP_PASS]"}},"required":["name","events","url","security"]}}]},"delete":{"summary":"Delete Webhook","operationId":"projectsDeleteWebhook","consumes":["application\/json"],"produces":[],"tags":["projects"],"description":"","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteWebhook","weight":134,"cookies":false,"type":"","demo":"projects\/delete-webhook.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"webhookId","description":"Webhook unique ID.","required":true,"type":"string","x-example":"[WEBHOOK_ID]","in":"path"}]}},"\/storage\/buckets":{"get":{"summary":"List buckets","operationId":"storageListBuckets","consumes":["application\/json"],"produces":["application\/json"],"tags":["storage"],"description":"Get a list of all the storage buckets. You can use the query params to filter your results.","responses":{"200":{"description":"Buckets List","schema":{"$ref":"#\/definitions\/bucketList"}}},"x-appwrite":{"method":"listBuckets","weight":151,"cookies":false,"type":"","demo":"storage\/list-buckets.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/list-buckets.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"buckets.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Results offset. The default value is 0. Use this param to manage pagination.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"cursor","description":"ID of the bucket used as the starting point for the query, excluding the bucket itself. Should be used for efficient pagination when working with large sets of data.","required":false,"type":"string","x-example":"[CURSOR]","default":"","in":"query"},{"name":"cursorDirection","description":"Direction of the cursor.","required":false,"type":"string","x-example":"after","default":"after","in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create bucket","operationId":"storageCreateBucket","consumes":["application\/json"],"produces":["application\/json"],"tags":["storage"],"description":"Create a new storage bucket.","responses":{"201":{"description":"Bucket","schema":{"$ref":"#\/definitions\/bucket"}}},"x-appwrite":{"method":"createBucket","weight":150,"cookies":false,"type":"","demo":"storage\/create-bucket.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/create-bucket.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"buckets.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"bucketId":{"type":"string","description":"Unique Id. Choose your own unique ID or pass the string `unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.","default":null,"x-example":"[BUCKET_ID]"},"name":{"type":"string","description":"Bucket name","default":null,"x-example":"[NAME]"},"permission":{"type":"string","description":"Permissions type model to use for reading files in this bucket. You can use bucket-level permission set once on the bucket using the `read` and `write` params, or you can set file-level permission where each file read and write params will decide who has access to read and write to each file individually. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":"file"},"read":{"type":"array","description":"An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":"[\"role:all\"]","items":{"type":"string"}},"write":{"type":"array","description":"An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":"[\"role:all\"]","items":{"type":"string"}},"enabled":{"type":"boolean","description":"Is bucket enabled?","default":true,"x-example":false},"maximumFileSize":{"type":"integer","description":"Maximum file size allowed in bytes. Maximum allowed value is 30MB. For self-hosted setups you can change the max limit by changing the `_APP_STORAGE_LIMIT` environment variable. [Learn more about storage environment variables](docs\/environment-variables#storage)","default":30000000,"x-example":null},"allowedFileExtensions":{"type":"array","description":"Allowed file extensions","default":[],"x-example":null,"items":{"type":"string"}},"encryption":{"type":"boolean","description":"Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled","default":true,"x-example":false},"antivirus":{"type":"boolean","description":"Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled","default":true,"x-example":false}},"required":["bucketId","name","permission"]}}]}},"\/storage\/buckets\/{bucketId}":{"get":{"summary":"Get Bucket","operationId":"storageGetBucket","consumes":["application\/json"],"produces":["application\/json"],"tags":["storage"],"description":"Get a storage bucket by its unique ID. This endpoint response returns a JSON object with the storage bucket metadata.","responses":{"200":{"description":"Bucket","schema":{"$ref":"#\/definitions\/bucket"}}},"x-appwrite":{"method":"getBucket","weight":152,"cookies":false,"type":"","demo":"storage\/get-bucket.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/get-bucket.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"buckets.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"bucketId","description":"Bucket unique ID.","required":true,"type":"string","x-example":"[BUCKET_ID]","in":"path"}]},"put":{"summary":"Update Bucket","operationId":"storageUpdateBucket","consumes":["application\/json"],"produces":["application\/json"],"tags":["storage"],"description":"Update a storage bucket by its unique ID.","responses":{"200":{"description":"Bucket","schema":{"$ref":"#\/definitions\/bucket"}}},"x-appwrite":{"method":"updateBucket","weight":153,"cookies":false,"type":"","demo":"storage\/update-bucket.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/update-bucket.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"buckets.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"bucketId","description":"Bucket unique ID.","required":true,"type":"string","x-example":"[BUCKET_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Bucket name","default":null,"x-example":"[NAME]"},"permission":{"type":"string","description":"Permissions type model to use for reading files in this bucket. You can use bucket-level permission set once on the bucket using the `read` and `write` params, or you can set file-level permission where each file read and write params will decide who has access to read and write to each file individually. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":"file"},"read":{"type":"array","description":"An array of strings with read permissions. By default inherits the existing read permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":"[\"role:all\"]","items":{"type":"string"}},"write":{"type":"array","description":"An array of strings with write permissions. By default inherits the existing write permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":"[\"role:all\"]","items":{"type":"string"}},"enabled":{"type":"boolean","description":"Is bucket enabled?","default":true,"x-example":false},"maximumFileSize":{"type":"integer","description":"Maximum file size allowed in bytes. Maximum allowed value is 30MB. For self hosted version you can change the limit by changing _APP_STORAGE_LIMIT environment variable. [Learn more about storage environment variables](docs\/environment-variables#storage)","default":null,"x-example":null},"allowedFileExtensions":{"type":"array","description":"Allowed file extensions","default":[],"x-example":null,"items":{"type":"string"}},"encryption":{"type":"boolean","description":"Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled","default":true,"x-example":false},"antivirus":{"type":"boolean","description":"Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled","default":true,"x-example":false}},"required":["name","permission"]}}]},"delete":{"summary":"Delete Bucket","operationId":"storageDeleteBucket","consumes":["application\/json"],"produces":[],"tags":["storage"],"description":"Delete a storage bucket by its unique ID.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteBucket","weight":154,"cookies":false,"type":"","demo":"storage\/delete-bucket.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/delete-bucket.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"buckets.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"bucketId","description":"Bucket unique ID.","required":true,"type":"string","x-example":"[BUCKET_ID]","in":"path"}]}},"\/storage\/buckets\/{bucketId}\/files":{"get":{"summary":"List Files","operationId":"storageListFiles","consumes":["application\/json"],"produces":["application\/json"],"tags":["storage"],"description":"Get a list of all the user files. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project's files. [Learn more about different API modes](\/docs\/admin).","responses":{"200":{"description":"Files List","schema":{"$ref":"#\/definitions\/fileList"}}},"x-appwrite":{"method":"listFiles","weight":156,"cookies":false,"type":"","demo":"storage\/list-files.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/list-files.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"bucketId","description":"Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](\/docs\/server\/storage#createBucket).","required":true,"type":"string","x-example":"[BUCKET_ID]","in":"path"},{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Maximum number of files to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Offset value. The default value is 0. Use this param to manage pagination. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"cursor","description":"ID of the file used as the starting point for the query, excluding the file itself. Should be used for efficient pagination when working with large sets of data. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"string","x-example":"[CURSOR]","default":"","in":"query"},{"name":"cursorDirection","description":"Direction of the cursor.","required":false,"type":"string","x-example":"after","default":"after","in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create File","operationId":"storageCreateFile","consumes":["multipart\/form-data"],"produces":["application\/json"],"tags":["storage"],"description":"Create a new file. Before using this route, you should create a new bucket resource using either a [server integration](\/docs\/server\/database#storageCreateBucket) API or directly from your Appwrite console.\n\nLarger files should be uploaded using multiple requests with the [content-range](https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTTP\/Headers\/Content-Range) header to send a partial request with a maximum supported chunk of `5MB`. The `content-range` header values should always be in bytes.\n\nWhen the first request is sent, the server will return the **File** object, and the subsequent part request must include the file's **id** in `x-appwrite-id` header to allow the server to know that the partial upload is for the existing file and not for a new one.\n\nIf you're creating a new file using one of the Appwrite SDKs, all the chunking logic will be managed by the SDK internally.\n","responses":{"201":{"description":"File","schema":{"$ref":"#\/definitions\/file"}}},"x-appwrite":{"method":"createFile","weight":155,"cookies":false,"type":"upload","demo":"storage\/create-file.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/create-file.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"bucketId","description":"Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](\/docs\/server\/storage#createBucket).","required":true,"type":"string","x-example":"[BUCKET_ID]","in":"path"},{"name":"fileId","description":"File ID. Choose your own unique ID or pass the string \"unique()\" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.","required":true,"x-upload-id":true,"type":"string","x-example":"[FILE_ID]","in":"formData"},{"name":"file","description":"Binary file.","required":true,"type":"file","in":"formData"},{"name":"read","description":"An array of strings with read permissions. By default only the current user is granted with read permissions. [learn more about permissions](https:\/\/appwrite.io\/docs\/permissions) and get a full list of available permissions.","required":false,"type":"array","collectionFormat":"multi","items":{"type":"string"},"x-example":"[\"role:all\"]","in":"formData"},{"name":"write","description":"An array of strings with write permissions. By default only the current user is granted with write permissions. [learn more about permissions](https:\/\/appwrite.io\/docs\/permissions) and get a full list of available permissions.","required":false,"type":"array","collectionFormat":"multi","items":{"type":"string"},"x-example":"[\"role:all\"]","in":"formData"}]}},"\/storage\/buckets\/{bucketId}\/files\/{fileId}":{"get":{"summary":"Get File","operationId":"storageGetFile","consumes":["application\/json"],"produces":["application\/json"],"tags":["storage"],"description":"Get a file by its unique ID. This endpoint response returns a JSON object with the file metadata.","responses":{"200":{"description":"File","schema":{"$ref":"#\/definitions\/file"}}},"x-appwrite":{"method":"getFile","weight":157,"cookies":false,"type":"","demo":"storage\/get-file.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/get-file.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"bucketId","description":"Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](\/docs\/server\/storage#createBucket).","required":true,"type":"string","x-example":"[BUCKET_ID]","in":"path"},{"name":"fileId","description":"File ID.","required":true,"type":"string","x-example":"[FILE_ID]","in":"path"}]},"put":{"summary":"Update File","operationId":"storageUpdateFile","consumes":["application\/json"],"produces":["application\/json"],"tags":["storage"],"description":"Update a file by its unique ID. Only users with write permissions have access to update this resource.","responses":{"200":{"description":"File","schema":{"$ref":"#\/definitions\/file"}}},"x-appwrite":{"method":"updateFile","weight":161,"cookies":false,"type":"","demo":"storage\/update-file.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/update-file.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"bucketId","description":"Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](\/docs\/server\/storage#createBucket).","required":true,"type":"string","x-example":"[BUCKET_ID]","in":"path"},{"name":"fileId","description":"File unique ID.","required":true,"type":"string","x-example":"[FILE_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"read":{"type":"array","description":"An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](https:\/\/appwrite.io\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":"[\"role:all\"]","items":{"type":"string"}},"write":{"type":"array","description":"An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](https:\/\/appwrite.io\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":"[\"role:all\"]","items":{"type":"string"}}}}}]},"delete":{"summary":"Delete File","operationId":"storageDeleteFile","consumes":["application\/json"],"produces":[],"tags":["storage"],"description":"Delete a file by its unique ID. Only users with write permissions have access to delete this resource.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteFile","weight":162,"cookies":false,"type":"","demo":"storage\/delete-file.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/delete-file.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"bucketId","description":"Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](\/docs\/server\/storage#createBucket).","required":true,"type":"string","x-example":"[BUCKET_ID]","in":"path"},{"name":"fileId","description":"File ID.","required":true,"type":"string","x-example":"[FILE_ID]","in":"path"}]}},"\/storage\/buckets\/{bucketId}\/files\/{fileId}\/download":{"get":{"summary":"Get File for Download","operationId":"storageGetFileDownload","consumes":["application\/json"],"produces":["*\/*"],"tags":["storage"],"description":"Get a file content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory.","responses":{"200":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getFileDownload","weight":159,"cookies":false,"type":"location","demo":"storage\/get-file-download.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/get-file-download.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"bucketId","description":"Storage bucket ID. You can create a new storage bucket using the Storage service [server integration](\/docs\/server\/storage#createBucket).","required":true,"type":"string","x-example":"[BUCKET_ID]","in":"path"},{"name":"fileId","description":"File ID.","required":true,"type":"string","x-example":"[FILE_ID]","in":"path"}]}},"\/storage\/buckets\/{bucketId}\/files\/{fileId}\/preview":{"get":{"summary":"Get File Preview","operationId":"storageGetFilePreview","consumes":["application\/json"],"produces":["image\/*"],"tags":["storage"],"description":"Get a file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets, will return the file icon image. You can also pass query string arguments for cutting and resizing your preview image. Preview is supported only for image files smaller than 10MB.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getFilePreview","weight":158,"cookies":false,"type":"","demo":"storage\/get-file-preview.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/get-file-preview.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"bucketId","description":"Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](\/docs\/server\/storage#createBucket).","required":true,"type":"string","x-example":"[BUCKET_ID]","in":"path"},{"name":"fileId","description":"File ID","required":true,"type":"string","x-example":"[FILE_ID]","in":"path"},{"name":"width","description":"Resize preview image width, Pass an integer between 0 to 4000.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"height","description":"Resize preview image height, Pass an integer between 0 to 4000.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"gravity","description":"Image crop gravity. Can be one of center,top-left,top,top-right,left,right,bottom-left,bottom,bottom-right","required":false,"type":"string","x-example":"center","default":"center","in":"query"},{"name":"quality","description":"Preview image quality. Pass an integer between 0 to 100. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"borderWidth","description":"Preview image border in pixels. Pass an integer between 0 to 100. Defaults to 0.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"borderColor","description":"Preview image border color. Use a valid HEX color, no # is needed for prefix.","required":false,"type":"string","default":"","in":"query"},{"name":"borderRadius","description":"Preview image border radius in pixels. Pass an integer between 0 to 4000.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"opacity","description":"Preview image opacity. Only works with images having an alpha channel (like png). Pass a number between 0 to 1.","required":false,"type":"number","format":"float","x-example":0,"default":1,"in":"query"},{"name":"rotation","description":"Preview image rotation in degrees. Pass an integer between -360 and 360.","required":false,"type":"integer","format":"int32","x-example":-360,"default":0,"in":"query"},{"name":"background","description":"Preview image background color. Only works with transparent images (png). Use a valid HEX color, no # is needed for prefix.","required":false,"type":"string","default":"","in":"query"},{"name":"output","description":"Output format type (jpeg, jpg, png, gif and webp).","required":false,"type":"string","x-example":"jpg","default":"","in":"query"}]}},"\/storage\/buckets\/{bucketId}\/files\/{fileId}\/view":{"get":{"summary":"Get File for View","operationId":"storageGetFileView","consumes":["application\/json"],"produces":["*\/*"],"tags":["storage"],"description":"Get a file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header.","responses":{"200":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getFileView","weight":160,"cookies":false,"type":"location","demo":"storage\/get-file-view.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/get-file-view.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"bucketId","description":"Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](\/docs\/server\/storage#createBucket).","required":true,"type":"string","x-example":"[BUCKET_ID]","in":"path"},{"name":"fileId","description":"File ID.","required":true,"type":"string","x-example":"[FILE_ID]","in":"path"}]}},"\/storage\/usage":{"get":{"summary":"Get usage stats for storage","operationId":"storageGetUsage","consumes":["application\/json"],"produces":["application\/json"],"tags":["storage"],"description":"","responses":{"200":{"description":"StorageUsage","schema":{"$ref":"#\/definitions\/usageStorage"}}},"x-appwrite":{"method":"getUsage","weight":163,"cookies":false,"type":"","demo":"storage\/get-usage.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"range","description":"Date range.","required":false,"type":"string","x-example":"24h","default":"30d","in":"query"}]}},"\/storage\/{bucketId}\/usage":{"get":{"summary":"Get usage stats for a storage bucket","operationId":"storageGetBucketUsage","consumes":["application\/json"],"produces":["application\/json"],"tags":["storage"],"description":"","responses":{"200":{"description":"UsageBuckets","schema":{"$ref":"#\/definitions\/usageBuckets"}}},"x-appwrite":{"method":"getBucketUsage","weight":164,"cookies":false,"type":"","demo":"storage\/get-bucket-usage.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"bucketId","description":"Bucket ID.","required":true,"type":"string","x-example":"[BUCKET_ID]","in":"path"},{"name":"range","description":"Date range.","required":false,"type":"string","x-example":"24h","default":"30d","in":"query"}]}},"\/teams":{"get":{"summary":"List Teams","operationId":"teamsList","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Get a list of all the teams in which the current user is a member. You can use the parameters to filter your results.\r\n\r\nIn admin mode, this endpoint returns a list of all the teams in the current project. [Learn more about different API modes](\/docs\/admin).","responses":{"200":{"description":"Teams List","schema":{"$ref":"#\/definitions\/teamList"}}},"x-appwrite":{"method":"list","weight":166,"cookies":false,"type":"","demo":"teams\/list.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/list-teams.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Maximum number of teams to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Offset value. The default value is 0. Use this param to manage pagination. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"cursor","description":"ID of the team used as the starting point for the query, excluding the team itself. Should be used for efficient pagination when working with large sets of data. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"string","x-example":"[CURSOR]","default":"","in":"query"},{"name":"cursorDirection","description":"Direction of the cursor.","required":false,"type":"string","x-example":"after","default":"after","in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create Team","operationId":"teamsCreate","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Create a new team. The user who creates the team will automatically be assigned as the owner of the team. Only the users with the owner role can invite new members, add new owners and delete or update the team.","responses":{"201":{"description":"Team","schema":{"$ref":"#\/definitions\/team"}}},"x-appwrite":{"method":"create","weight":165,"cookies":false,"type":"","demo":"teams\/create.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/create-team.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"teamId":{"type":"string","description":"Team ID. Choose your own unique ID or pass the string \"unique()\" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.","default":null,"x-example":"[TEAM_ID]"},"name":{"type":"string","description":"Team name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"roles":{"type":"array","description":"Array of strings. Use this param to set the roles in the team for the user who created it. The default role is **owner**. A role can be any string. Learn more about [roles and permissions](\/docs\/permissions). Max length for each role is 32 chars.","default":["owner"],"x-example":null,"items":{"type":"string"}}},"required":["teamId","name"]}}]}},"\/teams\/{teamId}":{"get":{"summary":"Get Team","operationId":"teamsGet","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Get a team by its ID. All team members have read access for this resource.","responses":{"200":{"description":"Team","schema":{"$ref":"#\/definitions\/team"}}},"x-appwrite":{"method":"get","weight":167,"cookies":false,"type":"","demo":"teams\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/get-team.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"}]},"put":{"summary":"Update Team","operationId":"teamsUpdate","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Update a team using its ID. Only members with the owner role can update the team.","responses":{"200":{"description":"Team","schema":{"$ref":"#\/definitions\/team"}}},"x-appwrite":{"method":"update","weight":168,"cookies":false,"type":"","demo":"teams\/update.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/update-team.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"New team name. Max length: 128 chars.","default":null,"x-example":"[NAME]"}},"required":["name"]}}]},"delete":{"summary":"Delete Team","operationId":"teamsDelete","consumes":["application\/json"],"produces":[],"tags":["teams"],"description":"Delete a team using its ID. Only team members with the owner role can delete the team.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"delete","weight":169,"cookies":false,"type":"","demo":"teams\/delete.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/delete-team.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"}]}},"\/teams\/{teamId}\/memberships":{"get":{"summary":"Get Team Memberships","operationId":"teamsGetMemberships","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Use this endpoint to list a team's members using the team's ID. All team members have read access to this endpoint.","responses":{"200":{"description":"Memberships List","schema":{"$ref":"#\/definitions\/membershipList"}}},"x-appwrite":{"method":"getMemberships","weight":171,"cookies":false,"type":"","demo":"teams\/get-memberships.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/get-team-members.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"},{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Maximum number of memberships to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Offset value. The default value is 0. Use this value to manage pagination. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"cursor","description":"ID of the membership used as the starting point for the query, excluding the membership itself. Should be used for efficient pagination when working with large sets of data. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"string","x-example":"[CURSOR]","default":"","in":"query"},{"name":"cursorDirection","description":"Direction of the cursor.","required":false,"type":"string","x-example":"after","default":"after","in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create Team Membership","operationId":"teamsCreateMembership","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Invite a new member to join your team. If initiated from the client SDK, an email with a link to join the team will be sent to the member's email address and an account will be created for them should they not be signed up already. If initiated from server-side SDKs, the new member will automatically be added to the team.\n\nUse the 'url' parameter to redirect the user from the invitation email back to your app. When the user is redirected, use the [Update Team Membership Status](\/docs\/client\/teams#teamsUpdateMembershipStatus) endpoint to allow the user to accept the invitation to the team. \n\nPlease note that to avoid a [Redirect Attack](https:\/\/github.com\/OWASP\/CheatSheetSeries\/blob\/master\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URL's are the once from domains you have set when adding your platforms in the console interface.","responses":{"201":{"description":"Membership","schema":{"$ref":"#\/definitions\/membership"}}},"x-appwrite":{"method":"createMembership","weight":170,"cookies":false,"type":"","demo":"teams\/create-membership.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/create-team-membership.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"email":{"type":"string","description":"Email of the new team member.","default":null,"x-example":"email@example.com"},"roles":{"type":"array","description":"Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](\/docs\/permissions). Max length for each role is 32 chars.","default":null,"x-example":null,"items":{"type":"string"}},"url":{"type":"string","description":"URL to redirect the user back to your app from the invitation email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.","default":null,"x-example":"https:\/\/example.com"},"name":{"type":"string","description":"Name of the new team member. Max length: 128 chars.","default":"","x-example":"[NAME]"}},"required":["email","roles","url"]}}]}},"\/teams\/{teamId}\/memberships\/{membershipId}":{"get":{"summary":"Get Team Membership","operationId":"teamsGetMembership","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Get a team member by the membership unique id. All team members have read access for this resource.","responses":{"200":{"description":"Memberships List","schema":{"$ref":"#\/definitions\/membershipList"}}},"x-appwrite":{"method":"getMembership","weight":172,"cookies":false,"type":"","demo":"teams\/get-membership.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/get-team-member.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"},{"name":"membershipId","description":"Membership ID.","required":true,"type":"string","x-example":"[MEMBERSHIP_ID]","in":"path"}]},"patch":{"summary":"Update Membership Roles","operationId":"teamsUpdateMembershipRoles","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Modify the roles of a team member. Only team members with the owner role have access to this endpoint. Learn more about [roles and permissions](\/docs\/permissions).","responses":{"200":{"description":"Membership","schema":{"$ref":"#\/definitions\/membership"}}},"x-appwrite":{"method":"updateMembershipRoles","weight":173,"cookies":false,"type":"","demo":"teams\/update-membership-roles.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/update-team-membership-roles.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"},{"name":"membershipId","description":"Membership ID.","required":true,"type":"string","x-example":"[MEMBERSHIP_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"roles":{"type":"array","description":"An array of strings. Use this param to set the user's roles in the team. A role can be any string. Learn more about [roles and permissions](https:\/\/appwrite.io\/docs\/permissions). Max length for each role is 32 chars.","default":null,"x-example":null,"items":{"type":"string"}}},"required":["roles"]}}]},"delete":{"summary":"Delete Team Membership","operationId":"teamsDeleteMembership","consumes":["application\/json"],"produces":[],"tags":["teams"],"description":"This endpoint allows a user to leave a team or for a team owner to delete the membership of any other team member. You can also use this endpoint to delete a user membership even if it is not accepted.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteMembership","weight":175,"cookies":false,"type":"","demo":"teams\/delete-membership.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/delete-team-membership.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"},{"name":"membershipId","description":"Membership ID.","required":true,"type":"string","x-example":"[MEMBERSHIP_ID]","in":"path"}]}},"\/teams\/{teamId}\/memberships\/{membershipId}\/status":{"patch":{"summary":"Update Team Membership Status","operationId":"teamsUpdateMembershipStatus","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Use this endpoint to allow a user to accept an invitation to join a team after being redirected back to your app from the invitation email received by the user.\n\nIf the request is successful, a session for the user is automatically created.\n","responses":{"200":{"description":"Membership","schema":{"$ref":"#\/definitions\/membership"}}},"x-appwrite":{"method":"updateMembershipStatus","weight":174,"cookies":false,"type":"","demo":"teams\/update-membership-status.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/update-team-membership-status.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"public","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"},{"name":"membershipId","description":"Membership ID.","required":true,"type":"string","x-example":"[MEMBERSHIP_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"userId":{"type":"string","description":"User ID.","default":null,"x-example":"[USER_ID]"},"secret":{"type":"string","description":"Secret key.","default":null,"x-example":"[SECRET]"}},"required":["userId","secret"]}}]}},"\/users":{"get":{"summary":"List Users","operationId":"usersList","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Get a list of all the project's users. You can use the query params to filter your results.","responses":{"200":{"description":"Users List","schema":{"$ref":"#\/definitions\/userList"}}},"x-appwrite":{"method":"list","weight":177,"cookies":false,"type":"","demo":"users\/list.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/list-users.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Maximum number of users to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Offset value. The default value is 0. Use this param to manage pagination. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"cursor","description":"ID of the user used as the starting point for the query, excluding the user itself. Should be used for efficient pagination when working with large sets of data. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"string","x-example":"[CURSOR]","default":"","in":"query"},{"name":"cursorDirection","description":"Direction of the cursor.","required":false,"type":"string","x-example":"after","default":"after","in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create User","operationId":"usersCreate","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Create a new user.","responses":{"201":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"create","weight":176,"cookies":false,"type":"","demo":"users\/create.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/create-user.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"userId":{"type":"string","description":"User ID. Choose your own unique ID or pass the string \"unique()\" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.","default":null,"x-example":"[USER_ID]"},"email":{"type":"string","description":"User email.","default":null,"x-example":"email@example.com"},"password":{"type":"string","description":"User password. Must be at least 8 chars.","default":null,"x-example":"password"},"name":{"type":"string","description":"User name. Max length: 128 chars.","default":"","x-example":"[NAME]"}},"required":["userId","email","password"]}}]}},"\/users\/usage":{"get":{"summary":"Get usage stats for the users API","operationId":"usersGetUsage","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"","responses":{"200":{"description":"UsageUsers","schema":{"$ref":"#\/definitions\/usageUsers"}}},"x-appwrite":{"method":"getUsage","weight":191,"cookies":false,"type":"","demo":"users\/get-usage.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"range","description":"Date range.","required":false,"type":"string","x-example":"24h","default":"30d","in":"query"},{"name":"provider","description":"Provider Name.","required":false,"type":"string","x-example":"email","default":"","in":"query"}]}},"\/users\/{userId}":{"get":{"summary":"Get User","operationId":"usersGet","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Get a user by its unique ID.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"get","weight":178,"cookies":false,"type":"","demo":"users\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/get-user.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"}]},"delete":{"summary":"Delete User","operationId":"usersDelete","consumes":["application\/json"],"produces":[],"tags":["users"],"description":"Delete a user by its unique ID.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"delete","weight":190,"cookies":false,"type":"","demo":"users\/delete.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/delete.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"}]}},"\/users\/{userId}\/email":{"patch":{"summary":"Update Email","operationId":"usersUpdateEmail","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Update the user email by its unique ID.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updateEmail","weight":186,"cookies":false,"type":"","demo":"users\/update-email.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/update-user-email.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"email":{"type":"string","description":"User email.","default":null,"x-example":"email@example.com"}},"required":["email"]}}]}},"\/users\/{userId}\/logs":{"get":{"summary":"Get User Logs","operationId":"usersGetLogs","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Get the user activity logs list by its unique ID.","responses":{"200":{"description":"Logs List","schema":{"$ref":"#\/definitions\/logList"}}},"x-appwrite":{"method":"getLogs","weight":181,"cookies":false,"type":"","demo":"users\/get-logs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/get-user-logs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"},{"name":"limit","description":"Maximum number of logs to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Offset value. The default value is 0. Use this value to manage pagination. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"}]}},"\/users\/{userId}\/name":{"patch":{"summary":"Update Name","operationId":"usersUpdateName","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Update the user name by its unique ID.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updateName","weight":184,"cookies":false,"type":"","demo":"users\/update-name.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/update-user-name.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"User name. Max length: 128 chars.","default":null,"x-example":"[NAME]"}},"required":["name"]}}]}},"\/users\/{userId}\/password":{"patch":{"summary":"Update Password","operationId":"usersUpdatePassword","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Update the user password by its unique ID.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updatePassword","weight":185,"cookies":false,"type":"","demo":"users\/update-password.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/update-user-password.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"password":{"type":"string","description":"New user password. Must be at least 8 chars.","default":null,"x-example":"password"}},"required":["password"]}}]}},"\/users\/{userId}\/prefs":{"get":{"summary":"Get User Preferences","operationId":"usersGetPrefs","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Get the user preferences by its unique ID.","responses":{"200":{"description":"Preferences","schema":{"$ref":"#\/definitions\/preferences"}}},"x-appwrite":{"method":"getPrefs","weight":179,"cookies":false,"type":"","demo":"users\/get-prefs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/get-user-prefs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"}]},"patch":{"summary":"Update User Preferences","operationId":"usersUpdatePrefs","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Update the user preferences by its unique ID. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded.","responses":{"200":{"description":"Preferences","schema":{"$ref":"#\/definitions\/preferences"}}},"x-appwrite":{"method":"updatePrefs","weight":187,"cookies":false,"type":"","demo":"users\/update-prefs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/update-user-prefs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"prefs":{"type":"object","description":"Prefs key-value JSON object.","default":{},"x-example":"{}"}},"required":["prefs"]}}]}},"\/users\/{userId}\/sessions":{"get":{"summary":"Get User Sessions","operationId":"usersGetSessions","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Get the user sessions list by its unique ID.","responses":{"200":{"description":"Sessions List","schema":{"$ref":"#\/definitions\/sessionList"}}},"x-appwrite":{"method":"getSessions","weight":180,"cookies":false,"type":"","demo":"users\/get-sessions.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/get-user-sessions.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"}]},"delete":{"summary":"Delete User Sessions","operationId":"usersDeleteSessions","consumes":["application\/json"],"produces":[],"tags":["users"],"description":"Delete all user's sessions by using the user's unique ID.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteSessions","weight":189,"cookies":false,"type":"","demo":"users\/delete-sessions.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/delete-user-sessions.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"}]}},"\/users\/{userId}\/sessions\/{sessionId}":{"delete":{"summary":"Delete User Session","operationId":"usersDeleteSession","consumes":["application\/json"],"produces":[],"tags":["users"],"description":"Delete a user sessions by its unique ID.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteSession","weight":188,"cookies":false,"type":"","demo":"users\/delete-session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/delete-user-session.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"},{"name":"sessionId","description":"Session ID.","required":true,"type":"string","x-example":"[SESSION_ID]","in":"path"}]}},"\/users\/{userId}\/status":{"patch":{"summary":"Update User Status","operationId":"usersUpdateStatus","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Update the user status by its unique ID.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updateStatus","weight":182,"cookies":false,"type":"","demo":"users\/update-status.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/update-user-status.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"status":{"type":"boolean","description":"User Status. To activate the user pass `true` and to block the user pass `false`.","default":null,"x-example":false}},"required":["status"]}}]}},"\/users\/{userId}\/verification":{"patch":{"summary":"Update Email Verification","operationId":"usersUpdateVerification","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Update the user email verification status by its unique ID.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updateVerification","weight":183,"cookies":false,"type":"","demo":"users\/update-verification.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/update-user-verification.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"emailVerification":{"type":"boolean","description":"User email verification status.","default":null,"x-example":false}},"required":["emailVerification"]}}]}}},"tags":[{"name":"account","description":"The Account service allows you to authenticate and manage a user account."},{"name":"avatars","description":"The Avatars service aims to help you complete everyday tasks related to your app image, icons, and avatars."},{"name":"database","description":"The Database service allows you to create structured collections of documents, query and filter lists of documents"},{"name":"locale","description":"The Locale service allows you to customize your app based on your users' location."},{"name":"health","description":"The Health service allows you to both validate and monitor your Appwrite server's health."},{"name":"projects","description":"The Project service allows you to manage all the projects in your Appwrite server."},{"name":"storage","description":"The Storage service allows you to manage your project files."},{"name":"teams","description":"The Teams service allows you to group users of your project and to enable them to share read and write access to your project resources"},{"name":"users","description":"The Users service allows you to manage your project users."},{"name":"functions","description":"The Functions Service allows you view, create and manage your Cloud Functions."}],"definitions":{"documentList":{"description":"Documents List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"documents":{"type":"array","description":"List of documents.","items":{"type":"object","$ref":"#\/definitions\/document"},"x-example":""}},"required":["sum","documents"]},"collectionList":{"description":"Collections List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"collections":{"type":"array","description":"List of collections.","items":{"type":"object","$ref":"#\/definitions\/collection"},"x-example":""}},"required":["sum","collections"]},"indexList":{"description":"Indexes List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"indexes":{"type":"array","description":"List of indexes.","items":{"type":"object","$ref":"#\/definitions\/index"},"x-example":""}},"required":["sum","indexes"]},"userList":{"description":"Users List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"users":{"type":"array","description":"List of users.","items":{"type":"object","$ref":"#\/definitions\/user"},"x-example":""}},"required":["sum","users"]},"sessionList":{"description":"Sessions List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"sessions":{"type":"array","description":"List of sessions.","items":{"type":"object","$ref":"#\/definitions\/session"},"x-example":""}},"required":["sum","sessions"]},"logList":{"description":"Logs List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"logs":{"type":"array","description":"List of logs.","items":{"type":"object","$ref":"#\/definitions\/log"},"x-example":""}},"required":["sum","logs"]},"fileList":{"description":"Files List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"files":{"type":"array","description":"List of files.","items":{"type":"object","$ref":"#\/definitions\/file"},"x-example":""}},"required":["sum","files"]},"bucketList":{"description":"Buckets List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"buckets":{"type":"array","description":"List of buckets.","items":{"type":"object","$ref":"#\/definitions\/bucket"},"x-example":""}},"required":["sum","buckets"]},"teamList":{"description":"Teams List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"teams":{"type":"array","description":"List of teams.","items":{"type":"object","$ref":"#\/definitions\/team"},"x-example":""}},"required":["sum","teams"]},"membershipList":{"description":"Memberships List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"memberships":{"type":"array","description":"List of memberships.","items":{"type":"object","$ref":"#\/definitions\/membership"},"x-example":""}},"required":["sum","memberships"]},"functionList":{"description":"Functions List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"functions":{"type":"array","description":"List of functions.","items":{"type":"object","$ref":"#\/definitions\/function"},"x-example":""}},"required":["sum","functions"]},"runtimeList":{"description":"Runtimes List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"runtimes":{"type":"array","description":"List of runtimes.","items":{"type":"object","$ref":"#\/definitions\/runtime"},"x-example":""}},"required":["sum","runtimes"]},"deploymentList":{"description":"Deployments List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"deployments":{"type":"array","description":"List of deployments.","items":{"type":"object","$ref":"#\/definitions\/deployment"},"x-example":""}},"required":["sum","deployments"]},"executionList":{"description":"Executions List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"executions":{"type":"array","description":"List of executions.","items":{"type":"object","$ref":"#\/definitions\/execution"},"x-example":""}},"required":["sum","executions"]},"projectList":{"description":"Projects List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"projects":{"type":"array","description":"List of projects.","items":{"type":"object","$ref":"#\/definitions\/project"},"x-example":""}},"required":["sum","projects"]},"webhookList":{"description":"Webhooks List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"webhooks":{"type":"array","description":"List of webhooks.","items":{"type":"object","$ref":"#\/definitions\/webhook"},"x-example":""}},"required":["sum","webhooks"]},"keyList":{"description":"API Keys List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"keys":{"type":"array","description":"List of keys.","items":{"type":"object","$ref":"#\/definitions\/key"},"x-example":""}},"required":["sum","keys"]},"platformList":{"description":"Platforms List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"platforms":{"type":"array","description":"List of platforms.","items":{"type":"object","$ref":"#\/definitions\/platform"},"x-example":""}},"required":["sum","platforms"]},"domainList":{"description":"Domains List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"domains":{"type":"array","description":"List of domains.","items":{"type":"object","$ref":"#\/definitions\/domain"},"x-example":""}},"required":["sum","domains"]},"countryList":{"description":"Countries List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"countries":{"type":"array","description":"List of countries.","items":{"type":"object","$ref":"#\/definitions\/country"},"x-example":""}},"required":["sum","countries"]},"continentList":{"description":"Continents List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"continents":{"type":"array","description":"List of continents.","items":{"type":"object","$ref":"#\/definitions\/continent"},"x-example":""}},"required":["sum","continents"]},"languageList":{"description":"Languages List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"languages":{"type":"array","description":"List of languages.","items":{"type":"object","$ref":"#\/definitions\/language"},"x-example":""}},"required":["sum","languages"]},"currencyList":{"description":"Currencies List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"currencies":{"type":"array","description":"List of currencies.","items":{"type":"object","$ref":"#\/definitions\/currency"},"x-example":""}},"required":["sum","currencies"]},"phoneList":{"description":"Phones List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"phones":{"type":"array","description":"List of phones.","items":{"type":"object","$ref":"#\/definitions\/phone"},"x-example":""}},"required":["sum","phones"]},"metricList":{"description":"Metric List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"metrics":{"type":"array","description":"List of metrics.","items":{"type":"object","$ref":"#\/definitions\/metric"},"x-example":""}},"required":["sum","metrics"]},"collection":{"description":"Collection","type":"object","properties":{"$id":{"type":"string","description":"Collection ID.","x-example":"5e5ea5c16897e"},"$read":{"type":"array","description":"Collection read permissions.","items":{"type":"string"},"x-example":"role:all"},"$write":{"type":"array","description":"Collection write permissions.","items":{"type":"string"},"x-example":"user:608f9da25e7e1"},"name":{"type":"string","description":"Collection name.","x-example":"My Collection"},"enabled":{"type":"boolean","description":"Collection enabled.","x-example":false},"permission":{"type":"string","description":"Collection permission model. Possible values: `document` or `collection`","x-example":"document"},"attributes":{"type":"array","description":"Collection attributes.","items":{"x-anyOf":[{"$ref":"#\/definitions\/attributeBoolean"},{"$ref":"#\/definitions\/attributeInteger"},{"$ref":"#\/definitions\/attributeFloat"},{"$ref":"#\/definitions\/attributeEmail"},{"$ref":"#\/definitions\/attributeEnum"},{"$ref":"#\/definitions\/attributeUrl"},{"$ref":"#\/definitions\/attributeIp"},{"$ref":"#\/definitions\/attributeString"}]},"x-example":{}},"indexes":{"type":"array","description":"Collection indexes.","items":{"type":"object","$ref":"#\/definitions\/index"},"x-example":{}}},"required":["$id","$read","$write","name","enabled","permission","attributes","indexes"]},"attributeList":{"description":"Attributes List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"attributes":{"type":"array","description":"List of attributes.","items":{"x-anyOf":[{"$ref":"#\/definitions\/attributeBoolean"},{"$ref":"#\/definitions\/attributeInteger"},{"$ref":"#\/definitions\/attributeFloat"},{"$ref":"#\/definitions\/attributeEmail"},{"$ref":"#\/definitions\/attributeEnum"},{"$ref":"#\/definitions\/attributeUrl"},{"$ref":"#\/definitions\/attributeIp"},{"$ref":"#\/definitions\/attributeString"}]},"x-example":""}},"required":["sum","attributes"]},"attributeString":{"description":"AttributeString","type":"object","properties":{"key":{"type":"string","description":"Attribute Key.","x-example":"fullName"},"type":{"type":"string","description":"Attribute type.","x-example":"string"},"status":{"type":"string","description":"Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed`","x-example":"available"},"required":{"type":"boolean","description":"Is attribute required?","x-example":true},"array":{"type":"boolean","description":"Is attribute an array?","x-example":false,"x-nullable":true},"size":{"type":"integer","description":"Attribute size.","x-example":128,"format":"int32"},"default":{"type":"string","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","x-example":"default","x-nullable":true}},"required":["key","type","status","required","size"]},"attributeInteger":{"description":"AttributeInteger","type":"object","properties":{"key":{"type":"string","description":"Attribute Key.","x-example":"fullName"},"type":{"type":"string","description":"Attribute type.","x-example":"string"},"status":{"type":"string","description":"Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed`","x-example":"available"},"required":{"type":"boolean","description":"Is attribute required?","x-example":true},"array":{"type":"boolean","description":"Is attribute an array?","x-example":false,"x-nullable":true},"min":{"type":"integer","description":"Minimum value to enforce for new documents.","x-example":1,"format":"int32","x-nullable":true},"max":{"type":"integer","description":"Maximum value to enforce for new documents.","x-example":10,"format":"int32","x-nullable":true},"default":{"type":"integer","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","x-example":10,"format":"int32","x-nullable":true}},"required":["key","type","status","required"]},"attributeFloat":{"description":"AttributeFloat","type":"object","properties":{"key":{"type":"string","description":"Attribute Key.","x-example":"fullName"},"type":{"type":"string","description":"Attribute type.","x-example":"string"},"status":{"type":"string","description":"Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed`","x-example":"available"},"required":{"type":"boolean","description":"Is attribute required?","x-example":true},"array":{"type":"boolean","description":"Is attribute an array?","x-example":false,"x-nullable":true},"min":{"type":"number","description":"Minimum value to enforce for new documents.","x-example":1.5,"format":"double","x-nullable":true},"max":{"type":"number","description":"Maximum value to enforce for new documents.","x-example":10.5,"format":"double","x-nullable":true},"default":{"type":"number","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","x-example":2.5,"format":"double","x-nullable":true}},"required":["key","type","status","required"]},"attributeBoolean":{"description":"AttributeBoolean","type":"object","properties":{"key":{"type":"string","description":"Attribute Key.","x-example":"fullName"},"type":{"type":"string","description":"Attribute type.","x-example":"string"},"status":{"type":"string","description":"Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed`","x-example":"available"},"required":{"type":"boolean","description":"Is attribute required?","x-example":true},"array":{"type":"boolean","description":"Is attribute an array?","x-example":false,"x-nullable":true},"default":{"type":"boolean","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","x-example":false,"x-nullable":true}},"required":["key","type","status","required"]},"attributeEmail":{"description":"AttributeEmail","type":"object","properties":{"key":{"type":"string","description":"Attribute Key.","x-example":"fullName"},"type":{"type":"string","description":"Attribute type.","x-example":"string"},"status":{"type":"string","description":"Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed`","x-example":"available"},"required":{"type":"boolean","description":"Is attribute required?","x-example":true},"array":{"type":"boolean","description":"Is attribute an array?","x-example":false,"x-nullable":true},"format":{"type":"string","description":"String format.","x-example":"email"},"default":{"type":"string","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","x-example":"default@example.com","x-nullable":true}},"required":["key","type","status","required","format"]},"attributeEnum":{"description":"AttributeEnum","type":"object","properties":{"key":{"type":"string","description":"Attribute Key.","x-example":"fullName"},"type":{"type":"string","description":"Attribute type.","x-example":"string"},"status":{"type":"string","description":"Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed`","x-example":"available"},"required":{"type":"boolean","description":"Is attribute required?","x-example":true},"array":{"type":"boolean","description":"Is attribute an array?","x-example":false,"x-nullable":true},"elements":{"type":"array","description":"Array of elements in enumerated type.","items":{"type":"string"},"x-example":"element"},"format":{"type":"string","description":"String format.","x-example":"enum"},"default":{"type":"string","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","x-example":"element","x-nullable":true}},"required":["key","type","status","required","elements","format"]},"attributeIp":{"description":"AttributeIP","type":"object","properties":{"key":{"type":"string","description":"Attribute Key.","x-example":"fullName"},"type":{"type":"string","description":"Attribute type.","x-example":"string"},"status":{"type":"string","description":"Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed`","x-example":"available"},"required":{"type":"boolean","description":"Is attribute required?","x-example":true},"array":{"type":"boolean","description":"Is attribute an array?","x-example":false,"x-nullable":true},"format":{"type":"string","description":"String format.","x-example":"ip"},"default":{"type":"string","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","x-example":"192.0.2.0","x-nullable":true}},"required":["key","type","status","required","format"]},"attributeUrl":{"description":"AttributeURL","type":"object","properties":{"key":{"type":"string","description":"Attribute Key.","x-example":"fullName"},"type":{"type":"string","description":"Attribute type.","x-example":"string"},"status":{"type":"string","description":"Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed`","x-example":"available"},"required":{"type":"boolean","description":"Is attribute required?","x-example":true},"array":{"type":"boolean","description":"Is attribute an array?","x-example":false,"x-nullable":true},"format":{"type":"string","description":"String format.","x-example":"url"},"default":{"type":"string","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","x-example":"http:\/\/example.com","x-nullable":true}},"required":["key","type","status","required","format"]},"index":{"description":"Index","type":"object","properties":{"key":{"type":"string","description":"Index Key.","x-example":"index1"},"type":{"type":"string","description":"Index type.","x-example":"primary"},"status":{"type":"string","description":"Index status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed`","x-example":"available"},"attributes":{"type":"array","description":"Index attributes.","items":{"type":"string"},"x-example":[]},"orders":{"type":"array","description":"Index orders.","items":{"type":"string"},"x-example":[]}},"required":["key","type","status","attributes","orders"]},"document":{"description":"Document","type":"object","properties":{"$id":{"type":"string","description":"Document ID.","x-example":"5e5ea5c16897e"},"$collection":{"type":"string","description":"Collection ID.","x-example":"5e5ea5c15117e"},"$read":{"type":"array","description":"Document read permissions.","items":{"type":"string"},"x-example":"role:all"},"$write":{"type":"array","description":"Document write permissions.","items":{"type":"string"},"x-example":"user:608f9da25e7e1"}},"additionalProperties":true,"required":["$id","$collection","$read","$write"]},"log":{"description":"Log","type":"object","properties":{"event":{"type":"string","description":"Event name.","x-example":"account.sessions.create"},"userId":{"type":"string","description":"User ID.","x-example":"610fc2f985ee0"},"userEmail":{"type":"string","description":"User Email.","x-example":"john@appwrite.io"},"userName":{"type":"string","description":"User Name.","x-example":"John Doe"},"mode":{"type":"string","description":"API mode when event triggered.","x-example":"admin"},"ip":{"type":"string","description":"IP session in use when the session was created.","x-example":"127.0.0.1"},"time":{"type":"integer","description":"Log creation time in Unix timestamp.","x-example":1592981250,"format":"int32"},"osCode":{"type":"string","description":"Operating system code name. View list of [available options](https:\/\/github.com\/appwrite\/appwrite\/blob\/master\/docs\/lists\/os.json).","x-example":"Mac"},"osName":{"type":"string","description":"Operating system name.","x-example":"Mac"},"osVersion":{"type":"string","description":"Operating system version.","x-example":"Mac"},"clientType":{"type":"string","description":"Client type.","x-example":"browser"},"clientCode":{"type":"string","description":"Client code name. View list of [available options](https:\/\/github.com\/appwrite\/appwrite\/blob\/master\/docs\/lists\/clients.json).","x-example":"CM"},"clientName":{"type":"string","description":"Client name.","x-example":"Chrome Mobile iOS"},"clientVersion":{"type":"string","description":"Client version.","x-example":"84.0"},"clientEngine":{"type":"string","description":"Client engine name.","x-example":"WebKit"},"clientEngineVersion":{"type":"string","description":"Client engine name.","x-example":"605.1.15"},"deviceName":{"type":"string","description":"Device name.","x-example":"smartphone"},"deviceBrand":{"type":"string","description":"Device brand name.","x-example":"Google"},"deviceModel":{"type":"string","description":"Device model name.","x-example":"Nexus 5"},"countryCode":{"type":"string","description":"Country two-character ISO 3166-1 alpha code.","x-example":"US"},"countryName":{"type":"string","description":"Country name.","x-example":"United States"}},"required":["event","userId","userEmail","userName","mode","ip","time","osCode","osName","osVersion","clientType","clientCode","clientName","clientVersion","clientEngine","clientEngineVersion","deviceName","deviceBrand","deviceModel","countryCode","countryName"]},"user":{"description":"User","type":"object","properties":{"$id":{"type":"string","description":"User ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"User name.","x-example":"John Doe"},"registration":{"type":"integer","description":"User registration date in Unix timestamp.","x-example":1592981250,"format":"int32"},"status":{"type":"boolean","description":"User status. Pass `true` for enabled and `false` for disabled.","x-example":true},"passwordUpdate":{"type":"integer","description":"Unix timestamp of the most recent password update","x-example":1592981250,"format":"int32"},"email":{"type":"string","description":"User email address.","x-example":"john@appwrite.io"},"emailVerification":{"type":"boolean","description":"Email verification status.","x-example":true},"prefs":{"type":"object","description":"User preferences as a key-value object","x-example":{"theme":"pink","timezone":"UTC"},"items":{"type":"object","$ref":"#\/definitions\/preferences"}}},"required":["$id","name","registration","status","passwordUpdate","email","emailVerification","prefs"]},"preferences":{"description":"Preferences","type":"object","additionalProperties":true},"session":{"description":"Session","type":"object","properties":{"$id":{"type":"string","description":"Session ID.","x-example":"5e5ea5c16897e"},"userId":{"type":"string","description":"User ID.","x-example":"5e5bb8c16897e"},"expire":{"type":"integer","description":"Session expiration date in Unix timestamp.","x-example":1592981250,"format":"int32"},"provider":{"type":"string","description":"Session Provider.","x-example":"email"},"providerUid":{"type":"string","description":"Session Provider User ID.","x-example":"user@example.com"},"providerAccessToken":{"type":"string","description":"Session Provider Access Token.","x-example":"MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3"},"providerAccessTokenExpiry":{"type":"integer","description":"Date, the Unix timestamp of when the access token expires.","x-example":1592981250,"format":"int32"},"providerRefreshToken":{"type":"string","description":"Session Provider Refresh Token.","x-example":"MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3"},"ip":{"type":"string","description":"IP in use when the session was created.","x-example":"127.0.0.1"},"osCode":{"type":"string","description":"Operating system code name. View list of [available options](https:\/\/github.com\/appwrite\/appwrite\/blob\/master\/docs\/lists\/os.json).","x-example":"Mac"},"osName":{"type":"string","description":"Operating system name.","x-example":"Mac"},"osVersion":{"type":"string","description":"Operating system version.","x-example":"Mac"},"clientType":{"type":"string","description":"Client type.","x-example":"browser"},"clientCode":{"type":"string","description":"Client code name. View list of [available options](https:\/\/github.com\/appwrite\/appwrite\/blob\/master\/docs\/lists\/clients.json).","x-example":"CM"},"clientName":{"type":"string","description":"Client name.","x-example":"Chrome Mobile iOS"},"clientVersion":{"type":"string","description":"Client version.","x-example":"84.0"},"clientEngine":{"type":"string","description":"Client engine name.","x-example":"WebKit"},"clientEngineVersion":{"type":"string","description":"Client engine name.","x-example":"605.1.15"},"deviceName":{"type":"string","description":"Device name.","x-example":"smartphone"},"deviceBrand":{"type":"string","description":"Device brand name.","x-example":"Google"},"deviceModel":{"type":"string","description":"Device model name.","x-example":"Nexus 5"},"countryCode":{"type":"string","description":"Country two-character ISO 3166-1 alpha code.","x-example":"US"},"countryName":{"type":"string","description":"Country name.","x-example":"United States"},"current":{"type":"boolean","description":"Returns true if this the current user session.","x-example":true}},"required":["$id","userId","expire","provider","providerUid","providerAccessToken","providerAccessTokenExpiry","providerRefreshToken","ip","osCode","osName","osVersion","clientType","clientCode","clientName","clientVersion","clientEngine","clientEngineVersion","deviceName","deviceBrand","deviceModel","countryCode","countryName","current"]},"token":{"description":"Token","type":"object","properties":{"$id":{"type":"string","description":"Token ID.","x-example":"bb8ea5c16897e"},"userId":{"type":"string","description":"User ID.","x-example":"5e5ea5c168bb8"},"secret":{"type":"string","description":"Token secret key. This will return an empty string unless the response is returned using an API key or as part of a webhook payload.","x-example":""},"expire":{"type":"integer","description":"Token expiration date in Unix timestamp.","x-example":1592981250,"format":"int32"}},"required":["$id","userId","secret","expire"]},"jwt":{"description":"JWT","type":"object","properties":{"jwt":{"type":"string","description":"JWT encoded string.","x-example":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"}},"required":["jwt"]},"locale":{"description":"Locale","type":"object","properties":{"ip":{"type":"string","description":"User IP address.","x-example":"127.0.0.1"},"countryCode":{"type":"string","description":"Country code in [ISO 3166-1](http:\/\/en.wikipedia.org\/wiki\/ISO_3166-1) two-character format","x-example":"US"},"country":{"type":"string","description":"Country name. This field support localization.","x-example":"United States"},"continentCode":{"type":"string","description":"Continent code. A two character continent code \"AF\" for Africa, \"AN\" for Antarctica, \"AS\" for Asia, \"EU\" for Europe, \"NA\" for North America, \"OC\" for Oceania, and \"SA\" for South America.","x-example":"NA"},"continent":{"type":"string","description":"Continent name. This field support localization.","x-example":"North America"},"eu":{"type":"boolean","description":"True if country is part of the Europian Union.","x-example":false},"currency":{"type":"string","description":"Currency code in [ISO 4217-1](http:\/\/en.wikipedia.org\/wiki\/ISO_4217) three-character format","x-example":"USD"}},"required":["ip","countryCode","country","continentCode","continent","eu","currency"]},"file":{"description":"File","type":"object","properties":{"$id":{"type":"string","description":"File ID.","x-example":"5e5ea5c16897e"},"bucketId":{"type":"string","description":"Bucket ID.","x-example":"5e5ea5c16897e"},"$read":{"type":"array","description":"File read permissions.","items":{"type":"string"},"x-example":"role:all"},"$write":{"type":"array","description":"File write permissions.","items":{"type":"string"},"x-example":"user:608f9da25e7e1"},"name":{"type":"string","description":"File name.","x-example":"Pink.png"},"dateCreated":{"type":"integer","description":"File creation date in Unix timestamp.","x-example":1592981250,"format":"int32"},"signature":{"type":"string","description":"File MD5 signature.","x-example":"5d529fd02b544198ae075bd57c1762bb"},"mimeType":{"type":"string","description":"File mime type.","x-example":"image\/png"},"sizeOriginal":{"type":"integer","description":"File original size in bytes.","x-example":17890,"format":"int32"},"chunksTotal":{"type":"integer","description":"Total number of chunks available","x-example":17890,"format":"int32"},"chunksUploaded":{"type":"integer","description":"Total number of chunks uploaded","x-example":17890,"format":"int32"}},"required":["$id","bucketId","$read","$write","name","dateCreated","signature","mimeType","sizeOriginal","chunksTotal","chunksUploaded"]},"bucket":{"description":"Bucket","type":"object","properties":{"$id":{"type":"string","description":"Bucket ID.","x-example":"5e5ea5c16897e"},"$read":{"type":"array","description":"File read permissions.","items":{"type":"string"},"x-example":["role:all"]},"$write":{"type":"array","description":"File write permissions.","items":{"type":"string"},"x-example":["user:608f9da25e7e1"]},"permission":{"type":"string","description":"Bucket permission model. Possible values: `bucket` or `file`","x-example":"file"},"dateCreated":{"type":"integer","description":"Bucket creation date in Unix timestamp.","x-example":1592981250,"format":"int32"},"dateUpdated":{"type":"integer","description":"Bucket update date in Unix timestamp.","x-example":1592981250,"format":"int32"},"name":{"type":"string","description":"Bucket name.","x-example":"Documents"},"enabled":{"type":"boolean","description":"Bucket enabled.","x-example":false},"maximumFileSize":{"type":"integer","description":"Maximum file size supported.","x-example":100,"format":"int32"},"allowedFileExtensions":{"type":"array","description":"Allowed file extensions.","items":{"type":"string"},"x-example":["jpg","png"]},"encryption":{"type":"boolean","description":"Bucket is encrypted.","x-example":false},"antivirus":{"type":"boolean","description":"Virus scanning is enabled.","x-example":false}},"required":["$id","$read","$write","permission","dateCreated","dateUpdated","name","enabled","maximumFileSize","allowedFileExtensions","encryption","antivirus"]},"team":{"description":"Team","type":"object","properties":{"$id":{"type":"string","description":"Team ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"Team name.","x-example":"VIP"},"dateCreated":{"type":"integer","description":"Team creation date in Unix timestamp.","x-example":1592981250,"format":"int32"},"sum":{"type":"integer","description":"Total sum of team members.","x-example":7,"format":"int32"}},"required":["$id","name","dateCreated","sum"]},"membership":{"description":"Membership","type":"object","properties":{"$id":{"type":"string","description":"Membership ID.","x-example":"5e5ea5c16897e"},"userId":{"type":"string","description":"User ID.","x-example":"5e5ea5c16897e"},"teamId":{"type":"string","description":"Team ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"User name.","x-example":"VIP"},"email":{"type":"string","description":"User email address.","x-example":"john@appwrite.io"},"invited":{"type":"integer","description":"Date, the user has been invited to join the team in Unix timestamp.","x-example":1592981250,"format":"int32"},"joined":{"type":"integer","description":"Date, the user has accepted the invitation to join the team in Unix timestamp.","x-example":1592981250,"format":"int32"},"confirm":{"type":"boolean","description":"User confirmation status, true if the user has joined the team or false otherwise.","x-example":false},"roles":{"type":"array","description":"User list of roles","items":{"type":"string"},"x-example":"admin"}},"required":["$id","userId","teamId","name","email","invited","joined","confirm","roles"]},"function":{"description":"Function","type":"object","properties":{"$id":{"type":"string","description":"Function ID.","x-example":"5e5ea5c16897e"},"execute":{"type":"array","description":"Execution permissions.","items":{"type":"string"},"x-example":"role:member"},"name":{"type":"string","description":"Function name.","x-example":"My Function"},"dateCreated":{"type":"integer","description":"Function creation date in Unix timestamp.","x-example":1592981250,"format":"int32"},"dateUpdated":{"type":"integer","description":"Function update date in Unix timestamp.","x-example":1592981257,"format":"int32"},"status":{"type":"string","description":"Function status. Possible values: `disabled`, `enabled`","x-example":"enabled"},"runtime":{"type":"string","description":"Function execution runtime.","x-example":"python-3.8"},"deployment":{"type":"string","description":"Function's active deployment ID.","x-example":"5e5ea5c16897e"},"vars":{"type":"string","description":"Function environment variables.","x-example":{"key":"value"}},"events":{"type":"array","description":"Function trigger events.","items":{"type":"string"},"x-example":"account.create"},"schedule":{"type":"string","description":"Function execution schedult in CRON format.","x-example":"5 4 * * *"},"scheduleNext":{"type":"integer","description":"Function next scheduled execution date in Unix timestamp.","x-example":1592981292,"format":"int32"},"schedulePrevious":{"type":"integer","description":"Function next scheduled execution date in Unix timestamp.","x-example":1592981237,"format":"int32"},"timeout":{"type":"integer","description":"Function execution timeout in seconds.","x-example":1592981237,"format":"int32"}},"required":["$id","execute","name","dateCreated","dateUpdated","status","runtime","deployment","vars","events","schedule","scheduleNext","schedulePrevious","timeout"]},"runtime":{"description":"Runtime","type":"object","properties":{"$id":{"type":"string","description":"Runtime ID.","x-example":"python-3.8"},"name":{"type":"string","description":"Runtime Name.","x-example":"Python"},"version":{"type":"string","description":"Runtime version.","x-example":"3.8"},"base":{"type":"string","description":"Base Docker image used to build the runtime.","x-example":"python:3.8-alpine"},"image":{"type":"string","description":"Image name of Docker Hub.","x-example":"appwrite\\\/runtime-for-python:3.8"},"logo":{"type":"string","description":"Name of the logo image.","x-example":"python.png"},"supports":{"type":"array","description":"List of supported architectures.","items":{"type":"string"},"x-example":"amd64"}},"required":["$id","name","version","base","image","logo","supports"]},"deployment":{"description":"Deployment","type":"object","properties":{"$id":{"type":"string","description":"Deployment ID.","x-example":"5e5ea5c16897e"},"resourceId":{"type":"string","description":"Resource ID.","x-example":"5e5ea6g16897e"},"resourceType":{"type":"string","description":"Resource type.","x-example":"functions"},"dateCreated":{"type":"integer","description":"The deployment creation date in Unix timestamp.","x-example":1592981250,"format":"int32"},"entrypoint":{"type":"string","description":"The entrypoint file to use to execute the deployment code.","x-example":"enabled"},"size":{"type":"integer","description":"The code size in bytes.","x-example":128,"format":"int32"},"buildId":{"type":"string","description":"The current build ID.","x-example":"5e5ea5c16897e"},"activate":{"type":"boolean","description":"Whether the deployment should be automatically activated.","x-example":true},"status":{"type":"string","description":"The deployment status.","x-example":"enabled"},"buildStdout":{"type":"string","description":"The build stdout.","x-example":"enabled"},"buildStderr":{"type":"string","description":"The build stderr.","x-example":"enabled"}},"required":["$id","resourceId","resourceType","dateCreated","entrypoint","size","buildId","activate","status","buildStdout","buildStderr"]},"execution":{"description":"Execution","type":"object","properties":{"$id":{"type":"string","description":"Execution ID.","x-example":"5e5ea5c16897e"},"$read":{"type":"array","description":"Execution read permissions.","items":{"type":"string"},"x-example":"role:all"},"functionId":{"type":"string","description":"Function ID.","x-example":"5e5ea6g16897e"},"dateCreated":{"type":"integer","description":"The execution creation date in Unix timestamp.","x-example":1592981250,"format":"int32"},"trigger":{"type":"string","description":"The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`.","x-example":"http"},"status":{"type":"string","description":"The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`.","x-example":"processing"},"statusCode":{"type":"integer","description":"The script status code.","x-example":0,"format":"int32"},"stdout":{"type":"string","description":"The script stdout output string. Logs the last 4,000 characters of the execution stdout output.","x-example":""},"stderr":{"type":"string","description":"The script stderr output string. Logs the last 4,000 characters of the execution stderr output","x-example":""},"time":{"type":"number","description":"The script execution time in seconds.","x-example":0.4,"format":"double"}},"required":["$id","$read","functionId","dateCreated","trigger","status","statusCode","stdout","stderr","time"]},"project":{"description":"Project","type":"object","properties":{"$id":{"type":"string","description":"Project ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"Project name.","x-example":"New Project"},"description":{"type":"string","description":"Project description.","x-example":"This is a new project."},"teamId":{"type":"string","description":"Project team ID.","x-example":"1592981250"},"logo":{"type":"string","description":"Project logo file ID.","x-example":"5f5c451b403cb"},"url":{"type":"string","description":"Project website URL.","x-example":"5f5c451b403cb"},"legalName":{"type":"string","description":"Company legal name.","x-example":"Company LTD."},"legalCountry":{"type":"string","description":"Country code in [ISO 3166-1](http:\/\/en.wikipedia.org\/wiki\/ISO_3166-1) two-character format.","x-example":"US"},"legalState":{"type":"string","description":"State name.","x-example":"New York"},"legalCity":{"type":"string","description":"City name.","x-example":"New York City."},"legalAddress":{"type":"string","description":"Company Address.","x-example":"620 Eighth Avenue, New York, NY 10018"},"legalTaxId":{"type":"string","description":"Company Tax ID.","x-example":"131102020"},"authLimit":{"type":"integer","description":"Max users allowed. 0 is unlimited.","x-example":100,"format":"int32"},"platforms":{"type":"array","description":"List of Platforms.","items":{"type":"object","$ref":"#\/definitions\/platform"},"x-example":{}},"webhooks":{"type":"array","description":"List of Webhooks.","items":{"type":"object","$ref":"#\/definitions\/webhook"},"x-example":{}},"keys":{"type":"array","description":"List of API Keys.","items":{"type":"object","$ref":"#\/definitions\/key"},"x-example":{}},"domains":{"type":"array","description":"List of Domains.","items":{"type":"object","$ref":"#\/definitions\/domain"},"x-example":{}},"providerAmazonAppid":{"type":"string","description":"Amazon OAuth app ID.","x-example":"123247283472834787438"},"providerAmazonSecret":{"type":"string","description":"Amazon OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerAppleAppid":{"type":"string","description":"Apple OAuth app ID.","x-example":"123247283472834787438"},"providerAppleSecret":{"type":"string","description":"Apple OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerBitbucketAppid":{"type":"string","description":"BitBucket OAuth app ID.","x-example":"123247283472834787438"},"providerBitbucketSecret":{"type":"string","description":"BitBucket OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerBitlyAppid":{"type":"string","description":"Bitly OAuth app ID.","x-example":"123247283472834787438"},"providerBitlySecret":{"type":"string","description":"Bitly OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerBoxAppid":{"type":"string","description":"Box OAuth app ID.","x-example":"123247283472834787438"},"providerBoxSecret":{"type":"string","description":"Box OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerDiscordAppid":{"type":"string","description":"Discord OAuth app ID.","x-example":"123247283472834787438"},"providerDiscordSecret":{"type":"string","description":"Discord OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerDropboxAppid":{"type":"string","description":"Dropbox OAuth app ID.","x-example":"123247283472834787438"},"providerDropboxSecret":{"type":"string","description":"Dropbox OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerFacebookAppid":{"type":"string","description":"Facebook OAuth app ID.","x-example":"123247283472834787438"},"providerFacebookSecret":{"type":"string","description":"Facebook OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerGithubAppid":{"type":"string","description":"GitHub OAuth app ID.","x-example":"123247283472834787438"},"providerGithubSecret":{"type":"string","description":"GitHub OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerGitlabAppid":{"type":"string","description":"GitLab OAuth app ID.","x-example":"123247283472834787438"},"providerGitlabSecret":{"type":"string","description":"GitLab OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerGoogleAppid":{"type":"string","description":"Google OAuth app ID.","x-example":"123247283472834787438"},"providerGoogleSecret":{"type":"string","description":"Google OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerLinkedinAppid":{"type":"string","description":"LinkedIn OAuth app ID.","x-example":"123247283472834787438"},"providerLinkedinSecret":{"type":"string","description":"LinkedIn OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerMicrosoftAppid":{"type":"string","description":"Microsoft OAuth app ID.","x-example":"123247283472834787438"},"providerMicrosoftSecret":{"type":"string","description":"Microsoft OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerNotionAppid":{"type":"string","description":"Notion OAuth app ID.","x-example":"123247283472834787438"},"providerNotionSecret":{"type":"string","description":"Notion OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerPaypalAppid":{"type":"string","description":"PayPal OAuth app ID.","x-example":"123247283472834787438"},"providerPaypalSecret":{"type":"string","description":"PayPal OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerPaypalSandboxAppid":{"type":"string","description":"PayPal OAuth app ID.","x-example":"123247283472834787438"},"providerPaypalSandboxSecret":{"type":"string","description":"PayPal OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerSalesforceAppid":{"type":"string","description":"Salesforce OAuth app ID.","x-example":"123247283472834787438"},"providerSalesforceSecret":{"type":"string","description":"Salesforce OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerSlackAppid":{"type":"string","description":"Slack OAuth app ID.","x-example":"123247283472834787438"},"providerSlackSecret":{"type":"string","description":"Slack OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerSpotifyAppid":{"type":"string","description":"Spotify OAuth app ID.","x-example":"123247283472834787438"},"providerSpotifySecret":{"type":"string","description":"Spotify OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerTradeshiftAppid":{"type":"string","description":"Tradeshift OAuth app ID.","x-example":"123247283472834787438"},"providerTradeshiftSecret":{"type":"string","description":"Tradeshift OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerTradeshiftBoxAppid":{"type":"string","description":"Tradeshift OAuth app ID.","x-example":"123247283472834787438"},"providerTradeshiftBoxSecret":{"type":"string","description":"Tradeshift OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerTwitchAppid":{"type":"string","description":"Twitch OAuth app ID.","x-example":"123247283472834787438"},"providerTwitchSecret":{"type":"string","description":"Twitch OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerVkAppid":{"type":"string","description":"VK OAuth app ID.","x-example":"123247283472834787438"},"providerVkSecret":{"type":"string","description":"VK OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerYahooAppid":{"type":"string","description":"Yahoo OAuth app ID.","x-example":"123247283472834787438"},"providerYahooSecret":{"type":"string","description":"Yahoo OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerYammerAppid":{"type":"string","description":"Yammer OAuth app ID.","x-example":"123247283472834787438"},"providerYammerSecret":{"type":"string","description":"Yammer OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerYandexAppid":{"type":"string","description":"Yandex OAuth app ID.","x-example":"123247283472834787438"},"providerYandexSecret":{"type":"string","description":"Yandex OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerWordpressAppid":{"type":"string","description":"WordPress OAuth app ID.","x-example":"123247283472834787438"},"providerWordpressSecret":{"type":"string","description":"WordPress OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerStripeAppid":{"type":"string","description":"Stripe OAuth app ID.","x-example":"123247283472834787438"},"providerStripeSecret":{"type":"string","description":"Stripe OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerMockAppid":{"type":"string","description":"Mock OAuth app ID.","x-example":"123247283472834787438"},"providerMockSecret":{"type":"string","description":"Mock OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"authEmailPassword":{"type":"boolean","description":"Email\/Password auth method status","x-example":true},"authUsersAuthMagicURL":{"type":"boolean","description":"Magic URL auth method status","x-example":true},"authAnonymous":{"type":"boolean","description":"Anonymous auth method status","x-example":true},"authInvites":{"type":"boolean","description":"Invites auth method status","x-example":true},"authJWT":{"type":"boolean","description":"JWT auth method status","x-example":true},"authPhone":{"type":"boolean","description":"Phone auth method status","x-example":true},"serviceStatusForAccount":{"type":"boolean","description":"Account service status","x-example":true},"serviceStatusForAvatars":{"type":"boolean","description":"Avatars service status","x-example":true},"serviceStatusForDatabase":{"type":"boolean","description":"Database service status","x-example":true},"serviceStatusForLocale":{"type":"boolean","description":"Locale service status","x-example":true},"serviceStatusForHealth":{"type":"boolean","description":"Health service status","x-example":true},"serviceStatusForStorage":{"type":"boolean","description":"Storage service status","x-example":true},"serviceStatusForTeams":{"type":"boolean","description":"Teams service status","x-example":true},"serviceStatusForUsers":{"type":"boolean","description":"Users service status","x-example":true},"serviceStatusForFunctions":{"type":"boolean","description":"Functions service status","x-example":true}},"required":["$id","name","description","teamId","logo","url","legalName","legalCountry","legalState","legalCity","legalAddress","legalTaxId","authLimit","platforms","webhooks","keys","domains","providerAmazonAppid","providerAmazonSecret","providerAppleAppid","providerAppleSecret","providerBitbucketAppid","providerBitbucketSecret","providerBitlyAppid","providerBitlySecret","providerBoxAppid","providerBoxSecret","providerDiscordAppid","providerDiscordSecret","providerDropboxAppid","providerDropboxSecret","providerFacebookAppid","providerFacebookSecret","providerGithubAppid","providerGithubSecret","providerGitlabAppid","providerGitlabSecret","providerGoogleAppid","providerGoogleSecret","providerLinkedinAppid","providerLinkedinSecret","providerMicrosoftAppid","providerMicrosoftSecret","providerNotionAppid","providerNotionSecret","providerPaypalAppid","providerPaypalSecret","providerPaypalSandboxAppid","providerPaypalSandboxSecret","providerSalesforceAppid","providerSalesforceSecret","providerSlackAppid","providerSlackSecret","providerSpotifyAppid","providerSpotifySecret","providerTradeshiftAppid","providerTradeshiftSecret","providerTradeshiftBoxAppid","providerTradeshiftBoxSecret","providerTwitchAppid","providerTwitchSecret","providerVkAppid","providerVkSecret","providerYahooAppid","providerYahooSecret","providerYammerAppid","providerYammerSecret","providerYandexAppid","providerYandexSecret","providerWordpressAppid","providerWordpressSecret","providerStripeAppid","providerStripeSecret","providerMockAppid","providerMockSecret","authEmailPassword","authUsersAuthMagicURL","authAnonymous","authInvites","authJWT","authPhone","serviceStatusForAccount","serviceStatusForAvatars","serviceStatusForDatabase","serviceStatusForLocale","serviceStatusForHealth","serviceStatusForStorage","serviceStatusForTeams","serviceStatusForUsers","serviceStatusForFunctions"]},"webhook":{"description":"Webhook","type":"object","properties":{"$id":{"type":"string","description":"Webhook ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"Webhook name.","x-example":"My Webhook"},"url":{"type":"string","description":"Webhook URL endpoint.","x-example":"https:\/\/example.com\/webhook"},"events":{"type":"array","description":"Webhook trigger events.","items":{"type":"string"},"x-example":"database.collections.update"},"security":{"type":"boolean","description":"Indicated if SSL \/ TLS Certificate verification is enabled.","x-example":true},"httpUser":{"type":"string","description":"HTTP basic authentication username.","x-example":"username"},"httpPass":{"type":"string","description":"HTTP basic authentication password.","x-example":"password"}},"required":["$id","name","url","events","security","httpUser","httpPass"]},"key":{"description":"Key","type":"object","properties":{"$id":{"type":"string","description":"Key ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"Key name.","x-example":"My API Key"},"scopes":{"type":"array","description":"Allowed permission scopes.","items":{"type":"string"},"x-example":"users.read"},"secret":{"type":"string","description":"Secret key.","x-example":"919c2d18fb5d4...a2ae413da83346ad2"}},"required":["$id","name","scopes","secret"]},"domain":{"description":"Domain","type":"object","properties":{"$id":{"type":"string","description":"Domain ID.","x-example":"5e5ea5c16897e"},"domain":{"type":"string","description":"Domain name.","x-example":"appwrite.company.com"},"registerable":{"type":"string","description":"Registerable domain name.","x-example":"company.com"},"tld":{"type":"string","description":"TLD name.","x-example":"com"},"verification":{"type":"boolean","description":"Verification process status.","x-example":true},"certificateId":{"type":"string","description":"Certificate ID.","x-example":"6ejea5c13377e"}},"required":["$id","domain","registerable","tld","verification","certificateId"]},"platform":{"description":"Platform","type":"object","properties":{"$id":{"type":"string","description":"Platform ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"Platform name.","x-example":"My Web App"},"type":{"type":"string","description":"Platform type. Possible values are: web, flutter-ios, flutter-android, ios, android, and unity.","x-example":"My Web App"},"key":{"type":"string","description":"Platform Key. iOS bundle ID or Android package name. Empty string for other platforms.","x-example":"com.company.appname"},"store":{"type":"string","description":"App store or Google Play store ID.","x-example":""},"hostname":{"type":"string","description":"Web app hostname. Empty string for other platforms.","x-example":true},"httpUser":{"type":"string","description":"HTTP basic authentication username.","x-example":"username"},"httpPass":{"type":"string","description":"HTTP basic authentication password.","x-example":"password"}},"required":["$id","name","type","key","store","hostname","httpUser","httpPass"]},"country":{"description":"Country","type":"object","properties":{"name":{"type":"string","description":"Country name.","x-example":"United States"},"code":{"type":"string","description":"Country two-character ISO 3166-1 alpha code.","x-example":"US"}},"required":["name","code"]},"continent":{"description":"Continent","type":"object","properties":{"name":{"type":"string","description":"Continent name.","x-example":"Europe"},"code":{"type":"string","description":"Continent two letter code.","x-example":"EU"}},"required":["name","code"]},"language":{"description":"Language","type":"object","properties":{"name":{"type":"string","description":"Language name.","x-example":"Italian"},"code":{"type":"string","description":"Language two-character ISO 639-1 codes.","x-example":"it"},"nativeName":{"type":"string","description":"Language native name.","x-example":"Italiano"}},"required":["name","code","nativeName"]},"currency":{"description":"Currency","type":"object","properties":{"symbol":{"type":"string","description":"Currency symbol.","x-example":"$"},"name":{"type":"string","description":"Currency name.","x-example":"US dollar"},"symbolNative":{"type":"string","description":"Currency native symbol.","x-example":"$"},"decimalDigits":{"type":"integer","description":"Number of decimal digits.","x-example":2,"format":"int32"},"rounding":{"type":"number","description":"Currency digit rounding.","x-example":0,"format":"double"},"code":{"type":"string","description":"Currency code in [ISO 4217-1](http:\/\/en.wikipedia.org\/wiki\/ISO_4217) three-character format.","x-example":"USD"},"namePlural":{"type":"string","description":"Currency plural name","x-example":"US dollars"}},"required":["symbol","name","symbolNative","decimalDigits","rounding","code","namePlural"]},"phone":{"description":"Phone","type":"object","properties":{"code":{"type":"string","description":"Phone code.","x-example":"+1"},"countryCode":{"type":"string","description":"Country two-character ISO 3166-1 alpha code.","x-example":"US"},"countryName":{"type":"string","description":"Country name.","x-example":"United States"}},"required":["code","countryCode","countryName"]},"healthAntivirus":{"description":"Health Antivirus","type":"object","properties":{"version":{"type":"string","description":"Antivirus version.","x-example":"1.0.0"},"status":{"type":"string","description":"Antivirus status. Possible values can are: `disabled`, `offline`, `online`","x-example":"online"}},"required":["version","status"]},"healthQueue":{"description":"Health Queue","type":"object","properties":{"size":{"type":"integer","description":"Amount of actions in the queue.","x-example":8,"format":"int32"}},"required":["size"]},"healthStatus":{"description":"Health Status","type":"object","properties":{"ping":{"type":"integer","description":"Duration in milliseconds how long the health check took.","x-example":128,"format":"int32"},"status":{"type":"string","description":"Service status. Possible values can are: `pass`, `fail`","x-example":"pass"}},"required":["ping","status"]},"healthTime":{"description":"Health Time","type":"object","properties":{"remoteTime":{"type":"integer","description":"Current unix timestamp on trustful remote server.","x-example":1639490751,"format":"int32"},"localTime":{"type":"integer","description":"Current unix timestamp of local server where Appwrite runs.","x-example":1639490844,"format":"int32"},"diff":{"type":"integer","description":"Difference of unix remote and local timestamps in milliseconds.","x-example":93,"format":"int32"}},"required":["remoteTime","localTime","diff"]},"usageDatabase":{"description":"UsageDatabase","type":"object","properties":{"range":{"type":"string","description":"The time range of the usage stats.","x-example":"30d"},"documentsCount":{"type":"array","description":"Aggregated stats for total number of documents.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"collectionsCount":{"type":"array","description":"Aggregated stats for total number of collections.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"documentsCreate":{"type":"array","description":"Aggregated stats for documents created.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"documentsRead":{"type":"array","description":"Aggregated stats for documents read.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"documentsUpdate":{"type":"array","description":"Aggregated stats for documents updated.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"documentsDelete":{"type":"array","description":"Aggregated stats for documents deleted.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"collectionsCreate":{"type":"array","description":"Aggregated stats for collections created.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"collectionsRead":{"type":"array","description":"Aggregated stats for collections read.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"collectionsUpdate":{"type":"array","description":"Aggregated stats for collections updated.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"collectionsDelete":{"type":"array","description":"Aggregated stats for collections delete.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}}},"required":["range","documentsCount","collectionsCount","documentsCreate","documentsRead","documentsUpdate","documentsDelete","collectionsCreate","collectionsRead","collectionsUpdate","collectionsDelete"]},"usageCollection":{"description":"UsageCollection","type":"object","properties":{"range":{"type":"string","description":"The time range of the usage stats.","x-example":"30d"},"documentsCount":{"type":"array","description":"Aggregated stats for total number of documents.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"documentsCreate":{"type":"array","description":"Aggregated stats for documents created.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"documentsRead":{"type":"array","description":"Aggregated stats for documents read.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"documentsUpdate":{"type":"array","description":"Aggregated stats for documents updated.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"documentsDelete":{"type":"array","description":"Aggregated stats for documents deleted.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}}},"required":["range","documentsCount","documentsCreate","documentsRead","documentsUpdate","documentsDelete"]},"usageUsers":{"description":"UsageUsers","type":"object","properties":{"range":{"type":"string","description":"The time range of the usage stats.","x-example":"30d"},"usersCount":{"type":"array","description":"Aggregated stats for total number of users.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"usersCreate":{"type":"array","description":"Aggregated stats for users created.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"usersRead":{"type":"array","description":"Aggregated stats for users read.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"usersUpdate":{"type":"array","description":"Aggregated stats for users updated.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"usersDelete":{"type":"array","description":"Aggregated stats for users deleted.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"sessionsCreate":{"type":"array","description":"Aggregated stats for sessions created.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"sessionsProviderCreate":{"type":"array","description":"Aggregated stats for sessions created for a provider ( email, anonymous or oauth2 ).","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"sessionsDelete":{"type":"array","description":"Aggregated stats for sessions deleted.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}}},"required":["range","usersCount","usersCreate","usersRead","usersUpdate","usersDelete","sessionsCreate","sessionsProviderCreate","sessionsDelete"]},"usageStorage":{"description":"StorageUsage","type":"object","properties":{"range":{"type":"string","description":"The time range of the usage stats.","x-example":"30d"},"filesStorage":{"type":"array","description":"Aggregated stats for the occupied storage size by files (in bytes).","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"tagsStorage":{"type":"array","description":"Aggregated stats for the occupied storage size by tags (in bytes).","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"filesCount":{"type":"array","description":"Aggregated stats for total number of files.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"bucketsCount":{"type":"array","description":"Aggregated stats for total number of buckets.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"bucketsCreate":{"type":"array","description":"Aggregated stats for buckets created.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"bucketsRead":{"type":"array","description":"Aggregated stats for buckets read.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"bucketsUpdate":{"type":"array","description":"Aggregated stats for buckets updated.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"bucketsDelete":{"type":"array","description":"Aggregated stats for buckets deleted.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"filesCreate":{"type":"array","description":"Aggregated stats for files created.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"filesRead":{"type":"array","description":"Aggregated stats for files read.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"filesUpdate":{"type":"array","description":"Aggregated stats for files updated.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"filesDelete":{"type":"array","description":"Aggregated stats for files deleted.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}}},"required":["range","filesStorage","tagsStorage","filesCount","bucketsCount","bucketsCreate","bucketsRead","bucketsUpdate","bucketsDelete","filesCreate","filesRead","filesUpdate","filesDelete"]},"usageBuckets":{"description":"UsageBuckets","type":"object","properties":{"range":{"type":"string","description":"The time range of the usage stats.","x-example":"30d"},"filesCount":{"type":"array","description":"Aggregated stats for total number of files in this bucket.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"filesStorage":{"type":"array","description":"Aggregated stats for total storage of files in this bucket.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"filesCreate":{"type":"array","description":"Aggregated stats for files created.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"filesRead":{"type":"array","description":"Aggregated stats for files read.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"filesUpdate":{"type":"array","description":"Aggregated stats for files updated.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"filesDelete":{"type":"array","description":"Aggregated stats for files deleted.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}}},"required":["range","filesCount","filesStorage","filesCreate","filesRead","filesUpdate","filesDelete"]},"usageFunctions":{"description":"UsageFunctions","type":"object","properties":{"range":{"type":"string","description":"The time range of the usage stats.","x-example":"30d"},"functionsExecutions":{"type":"array","description":"Aggregated stats for function executions.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"functionsFailures":{"type":"array","description":"Aggregated stats for function execution failures.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"functionsCompute":{"type":"array","description":"Aggregated stats for function execution duration.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}}},"required":["range","functionsExecutions","functionsFailures","functionsCompute"]},"usageProject":{"description":"UsageProject","type":"object","properties":{"range":{"type":"string","description":"The time range of the usage stats.","x-example":"30d"},"requests":{"type":"array","description":"Aggregated stats for number of requests.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"network":{"type":"array","description":"Aggregated stats for consumed bandwidth.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"functions":{"type":"array","description":"Aggregated stats for function executions.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"documents":{"type":"array","description":"Aggregated stats for number of documents.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"collections":{"type":"array","description":"Aggregated stats for number of collections.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"users":{"type":"array","description":"Aggregated stats for number of users.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"storage":{"type":"array","description":"Aggregated stats for the occupied storage size (in bytes).","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}}},"required":["range","requests","network","functions","documents","collections","users","storage"]}},"externalDocs":{"description":"Full API docs, specs and tutorials","url":"https:\/\/appwrite.io\/docs"}} diff --git a/specs/swagger-appwrite.0.10.0.json b/specs/swagger-appwrite.0.10.0.json deleted file mode 100644 index 75a60484ff..0000000000 --- a/specs/swagger-appwrite.0.10.0.json +++ /dev/null @@ -1 +0,0 @@ -{"swagger":"2.0","info":{"version":"0.10.0","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","contact":{"name":"Appwrite Team","url":"https:\/\/appwrite.io\/support","email":"team@appwrite.io"},"license":{"name":"BSD-3-Clause","url":"https:\/\/raw.githubusercontent.com\/appwrite\/appwrite\/master\/LICENSE"}},"host":"appwrite.io","basePath":"\/v1","schemes":["https"],"consumes":["application\/json","multipart\/form-data"],"produces":["application\/json"],"securityDefinitions":{"Project":{"type":"apiKey","name":"X-Appwrite-Project","description":"Your project ID","in":"header","x-appwrite":{"demo":"5df5acd0d48c2"}},"Key":{"type":"apiKey","name":"X-Appwrite-Key","description":"Your secret API key","in":"header","x-appwrite":{"demo":"919c2d18fb5d4...a2ae413da83346ad2"}},"JWT":{"type":"apiKey","name":"X-Appwrite-JWT","description":"Your secret JSON Web Token","in":"header","x-appwrite":{"demo":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ..."}},"Locale":{"type":"apiKey","name":"X-Appwrite-Locale","description":"","in":"header","x-appwrite":{"demo":"en"}},"Mode":{"type":"apiKey","name":"X-Appwrite-Mode","description":"","in":"header","x-appwrite":{"demo":""}}},"paths":{"\/account":{"get":{"summary":"Get Account","operationId":"accountGet","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Get currently logged in user data as JSON object.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"get","weight":43,"cookies":false,"type":"","demo":"account\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/get.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}]},"post":{"summary":"Create Account","operationId":"accountCreate","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to allow a new user to register a new account in your project. After the user registration completes successfully, you can use the [\/account\/verfication](\/docs\/client\/account#accountCreateVerification) route to start verifying the user email address. To allow the new user to login to their new account, you need to create a new [account session](\/docs\/client\/account#accountCreateSession).","responses":{"201":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"create","weight":35,"cookies":false,"type":"","demo":"account\/create.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"public","platforms":["client"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"email":{"type":"string","description":"User email.","default":null,"x-example":"email@example.com","x-class":null},"password":{"type":"string","description":"User password. Must be between 6 to 32 chars.","default":null,"x-example":"password","x-class":null},"name":{"type":"string","description":"User name. Max length: 128 chars.","default":"","x-example":"[NAME]","x-class":null}},"required":["email","password"]}}]},"delete":{"summary":"Delete Account","operationId":"accountDelete","consumes":["application\/json"],"produces":[],"tags":["account"],"description":"Delete a currently logged in user account. Behind the scene, the user record is not deleted but permanently blocked from any access. This is done to avoid deleted accounts being overtaken by new users with the same email address. Any user-related resources like documents or storage files should be deleted separately.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"delete","weight":52,"cookies":false,"type":"","demo":"account\/delete.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/delete.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}]}},"\/account\/email":{"patch":{"summary":"Update Account Email","operationId":"accountUpdateEmail","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Update currently logged in user account email address. After changing user address, user confirmation status is being reset and a new confirmation mail is sent. For security measures, user password is required to complete this request.\nThis endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updateEmail","weight":50,"cookies":false,"type":"","demo":"account\/update-email.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-email.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"email":{"type":"string","description":"User email.","default":null,"x-example":"email@example.com","x-class":null},"password":{"type":"string","description":"User password. Must be between 6 to 32 chars.","default":null,"x-example":"password","x-class":null}},"required":["email","password"]}}]}},"\/account\/jwt":{"post":{"summary":"Create Account JWT","operationId":"accountCreateJWT","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to create a JSON Web Token. You can use the resulting JWT to authenticate on behalf of the current user when working with the Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes from its creation and will be invalid if the user will logout in that time frame.","responses":{"201":{"description":"JWT","schema":{"$ref":"#\/definitions\/jwt"}}},"x-appwrite":{"method":"createJWT","weight":42,"cookies":false,"type":"","demo":"account\/create-j-w-t.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create-jwt.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},userId:{param-userId}","scope":"account","platforms":["client"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}]}},"\/account\/logs":{"get":{"summary":"Get Account Logs","operationId":"accountGetLogs","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Get currently logged in user list of latest security activity logs. Each log returns user IP address, location and date and time of log.","responses":{"200":{"description":"Logs List","schema":{"$ref":"#\/definitions\/logList"}}},"x-appwrite":{"method":"getLogs","weight":46,"cookies":false,"type":"","demo":"account\/get-logs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/get-logs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}]}},"\/account\/name":{"patch":{"summary":"Update Account Name","operationId":"accountUpdateName","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Update currently logged in user account name.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updateName","weight":48,"cookies":false,"type":"","demo":"account\/update-name.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-name.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"User name. Max length: 128 chars.","default":null,"x-example":"[NAME]","x-class":null}},"required":["name"]}}]}},"\/account\/password":{"patch":{"summary":"Update Account Password","operationId":"accountUpdatePassword","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Update currently logged in user password. For validation, user is required to pass in the new password, and the old password. For users created with OAuth and Team Invites, oldPassword is optional.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updatePassword","weight":49,"cookies":false,"type":"","demo":"account\/update-password.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-password.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"password":{"type":"string","description":"New user password. Must be between 6 to 32 chars.","default":null,"x-example":"password","x-class":null},"oldPassword":{"type":"string","description":"Old user password. Must be between 6 to 32 chars.","default":"","x-example":"password","x-class":null}},"required":["password"]}}]}},"\/account\/prefs":{"get":{"summary":"Get Account Preferences","operationId":"accountGetPrefs","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Get currently logged in user preferences as a key-value object.","responses":{"200":{"description":"Preferences","schema":{"$ref":"#\/definitions\/preferences"}}},"x-appwrite":{"method":"getPrefs","weight":44,"cookies":false,"type":"","demo":"account\/get-prefs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/get-prefs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}]},"patch":{"summary":"Update Account Preferences","operationId":"accountUpdatePrefs","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Update currently logged in user account preferences. You can pass only the specific settings you wish to update.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updatePrefs","weight":51,"cookies":false,"type":"","demo":"account\/update-prefs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-prefs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"prefs":{"type":"object","description":"Prefs key-value JSON object.","default":null,"x-example":"{}","x-class":null}},"required":["prefs"]}}]}},"\/account\/recovery":{"post":{"summary":"Create Password Recovery","operationId":"accountCreateRecovery","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Sends the user an email with a temporary secret key for password reset. When the user clicks the confirmation link he is redirected back to your app password reset URL with the secret key and email address values attached to the URL query string. Use the query string params to submit a request to the [PUT \/account\/recovery](\/docs\/client\/account#accountUpdateRecovery) endpoint to complete the process. The verification link sent to the user's email address is valid for 1 hour.","responses":{"201":{"description":"Token","schema":{"$ref":"#\/definitions\/token"}}},"x-appwrite":{"method":"createRecovery","weight":55,"cookies":false,"type":"","demo":"account\/create-recovery.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create-recovery.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},email:{param-email}","scope":"public","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"email":{"type":"string","description":"User email.","default":null,"x-example":"email@example.com","x-class":null},"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-class":null}},"required":["email","url"]}}]},"put":{"summary":"Complete Password Recovery","operationId":"accountUpdateRecovery","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to complete the user account password reset. Both the **userId** and **secret** arguments will be passed as query parameters to the redirect URL you have provided when sending your request to the [POST \/account\/recovery](\/docs\/client\/account#accountCreateRecovery) endpoint.\n\nPlease note that in order to avoid a [Redirect Attack](https:\/\/github.com\/OWASP\/CheatSheetSeries\/blob\/master\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.","responses":{"200":{"description":"Token","schema":{"$ref":"#\/definitions\/token"}}},"x-appwrite":{"method":"updateRecovery","weight":56,"cookies":false,"type":"","demo":"account\/update-recovery.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-recovery.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},userId:{param-userId}","scope":"public","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"userId":{"type":"string","description":"User account UID address.","default":null,"x-example":"[USER_ID]","x-class":null},"secret":{"type":"string","description":"Valid reset token.","default":null,"x-example":"[SECRET]","x-class":null},"password":{"type":"string","description":"New password. Must be between 6 to 32 chars.","default":null,"x-example":"password","x-class":null},"passwordAgain":{"type":"string","description":"New password again. Must be between 6 to 32 chars.","default":null,"x-example":"password","x-class":null}},"required":["userId","secret","password","passwordAgain"]}}]}},"\/account\/sessions":{"get":{"summary":"Get Account Sessions","operationId":"accountGetSessions","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Get currently logged in user list of active sessions across different devices.","responses":{"200":{"description":"Sessions List","schema":{"$ref":"#\/definitions\/sessionList"}}},"x-appwrite":{"method":"getSessions","weight":45,"cookies":false,"type":"","demo":"account\/get-sessions.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/get-sessions.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}]},"post":{"summary":"Create Account Session","operationId":"accountCreateSession","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Allow the user to login into their account by providing a valid email and password combination. This route will create a new session for the user.","responses":{"201":{"description":"Session","schema":{"$ref":"#\/definitions\/session"}}},"x-appwrite":{"method":"createSession","weight":36,"cookies":false,"type":"","demo":"account\/create-session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create-session.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},email:{param-email}","scope":"public","platforms":["client"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"email":{"type":"string","description":"User email.","default":null,"x-example":"email@example.com","x-class":null},"password":{"type":"string","description":"User password. Must be between 6 to 32 chars.","default":null,"x-example":"password","x-class":null}},"required":["email","password"]}}]},"delete":{"summary":"Delete All Account Sessions","operationId":"accountDeleteSessions","consumes":["application\/json"],"produces":[],"tags":["account"],"description":"Delete all sessions from the user account and remove any sessions cookies from the end client.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteSessions","weight":54,"cookies":false,"type":"","demo":"account\/delete-sessions.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/delete-sessions.md","rate-limit":100,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}]}},"\/account\/sessions\/anonymous":{"post":{"summary":"Create Anonymous Session","operationId":"accountCreateAnonymousSession","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to allow a new user to register an anonymous account in your project. This route will also create a new session for the user. To allow the new user to convert an anonymous account to a normal account, you need to update its [email and password](\/docs\/client\/account#accountUpdateEmail) or create an [OAuth2 session](\/docs\/client\/account#accountCreateOAuth2Session).","responses":{"201":{"description":"Session","schema":{"$ref":"#\/definitions\/session"}}},"x-appwrite":{"method":"createAnonymousSession","weight":41,"cookies":false,"type":"","demo":"account\/create-anonymous-session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create-session-anonymous.md","rate-limit":50,"rate-time":3600,"rate-key":"ip:{ip}","scope":"public","platforms":["client"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}]}},"\/account\/sessions\/oauth2\/{provider}":{"get":{"summary":"Create Account Session with OAuth2","operationId":"accountCreateOAuth2Session","consumes":["application\/json"],"produces":["text\/html"],"tags":["account"],"description":"Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL's back to your app when login is completed.\n\nIf there is already an active session, the new session will be attached to the logged-in account. If there are no active sessions, the server will attempt to look for a user with the same email address as the email received from the OAuth2 provider and attach the new session to the existing user. If no matching user is found - the server will create a new user..\n","responses":{"301":{"description":"No content"}},"x-appwrite":{"method":"createOAuth2Session","weight":37,"cookies":false,"type":"webAuth","demo":"account\/create-o-auth2session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create-session-oauth2.md","rate-limit":50,"rate-time":3600,"rate-key":"ip:{ip}","scope":"public","platforms":["client"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"provider","description":"OAuth2 Provider. Currently, supported providers are: amazon, apple, bitbucket, bitly, box, discord, dropbox, facebook, github, gitlab, google, linkedin, microsoft, paypal, paypalSandbox, salesforce, slack, spotify, tradeshift, tradeshiftBox, twitch, vk, yahoo, yandex, wordpress.","required":true,"type":"string","x-example":"amazon","in":"path"},{"name":"success","description":"URL to redirect back to your app after a successful login attempt. 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.","required":false,"type":"string","format":"url","x-example":"https:\/\/example.com","default":"https:\/\/appwrite.io\/auth\/oauth2\/success","in":"query"},{"name":"failure","description":"URL to redirect back to your app after a failed login attempt. 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.","required":false,"type":"string","format":"url","x-example":"https:\/\/example.com","default":"https:\/\/appwrite.io\/auth\/oauth2\/failure","in":"query"},{"name":"scopes","description":"A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes.","required":false,"type":"array","collectionFormat":"multi","items":{"type":"string"},"default":[],"in":"query"}]}},"\/account\/sessions\/{sessionId}":{"get":{"summary":"Get Session By ID","operationId":"accountGetSession","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to get a logged in user's session using a Session ID. Inputting 'current' will return the current session being used.","responses":{"200":{"description":"Session","schema":{"$ref":"#\/definitions\/session"}}},"x-appwrite":{"method":"getSession","weight":47,"cookies":false,"type":"","demo":"account\/get-session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/get-session.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"sessionId","description":"Session unique ID. Use the string 'current' to get the current device session.","required":true,"type":"string","x-example":"[SESSION_ID]","in":"path"}]},"delete":{"summary":"Delete Account Session","operationId":"accountDeleteSession","consumes":["application\/json"],"produces":[],"tags":["account"],"description":"Use this endpoint to log out the currently logged in user from all their account sessions across all of their different devices. When using the option id argument, only the session unique ID provider will be deleted.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteSession","weight":53,"cookies":false,"type":"","demo":"account\/delete-session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/delete-session.md","rate-limit":100,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"sessionId","description":"Session unique ID. Use the string 'current' to delete the current device session.","required":true,"type":"string","x-example":"[SESSION_ID]","in":"path"}]}},"\/account\/verification":{"post":{"summary":"Create Email Verification","operationId":"accountCreateVerification","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the **userId** and **secret** arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the **userId** and **secret** parameters. Learn more about how to [complete the verification process](\/docs\/client\/account#accountUpdateVerification). The verification link sent to the user's email address is valid for 7 days.\n\nPlease note that in order to avoid a [Redirect Attack](https:\/\/github.com\/OWASP\/CheatSheetSeries\/blob\/master\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.\n","responses":{"201":{"description":"Token","schema":{"$ref":"#\/definitions\/token"}}},"x-appwrite":{"method":"createVerification","weight":57,"cookies":false,"type":"","demo":"account\/create-verification.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create-verification.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},email:{param-email}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"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.","default":null,"x-example":"https:\/\/example.com","x-class":null}},"required":["url"]}}]},"put":{"summary":"Complete Email Verification","operationId":"accountUpdateVerification","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to complete the user email verification process. Use both the **userId** and **secret** parameters that were attached to your app URL to verify the user email ownership. If confirmed this route will return a 200 status code.","responses":{"200":{"description":"Token","schema":{"$ref":"#\/definitions\/token"}}},"x-appwrite":{"method":"updateVerification","weight":58,"cookies":false,"type":"","demo":"account\/update-verification.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-verification.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},userId:{param-userId}","scope":"public","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"userId":{"type":"string","description":"User unique ID.","default":null,"x-example":"[USER_ID]","x-class":null},"secret":{"type":"string","description":"Valid verification token.","default":null,"x-example":"[SECRET]","x-class":null}},"required":["userId","secret"]}}]}},"\/avatars\/browsers\/{code}":{"get":{"summary":"Get Browser Icon","operationId":"avatarsGetBrowser","consumes":["application\/json"],"produces":["image\/png"],"tags":["avatars"],"description":"You can use this endpoint to show different browser icons to your users. The code argument receives the browser code as it appears in your user \/account\/sessions endpoint. Use width, height and quality arguments to change the output settings.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getBrowser","weight":60,"cookies":false,"type":"location","demo":"avatars\/get-browser.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-browser.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"code","description":"Browser Code.","required":true,"type":"string","x-example":"aa","in":"path"},{"name":"width","description":"Image width. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"height","description":"Image height. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"quality","description":"Image quality. Pass an integer between 0 to 100. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"}]}},"\/avatars\/credit-cards\/{code}":{"get":{"summary":"Get Credit Card Icon","operationId":"avatarsGetCreditCard","consumes":["application\/json"],"produces":["image\/png"],"tags":["avatars"],"description":"The credit card endpoint will return you the icon of the credit card provider you need. Use width, height and quality arguments to change the output settings.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getCreditCard","weight":59,"cookies":false,"type":"location","demo":"avatars\/get-credit-card.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-credit-card.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"code","description":"Credit Card Code. Possible values: amex, argencard, cabal, censosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, union-china-pay, visa, mir, maestro.","required":true,"type":"string","x-example":"amex","in":"path"},{"name":"width","description":"Image width. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"height","description":"Image height. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"quality","description":"Image quality. Pass an integer between 0 to 100. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"}]}},"\/avatars\/favicon":{"get":{"summary":"Get Favicon","operationId":"avatarsGetFavicon","consumes":["application\/json"],"produces":["image\/*"],"tags":["avatars"],"description":"Use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL.\n","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getFavicon","weight":63,"cookies":false,"type":"location","demo":"avatars\/get-favicon.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-favicon.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"url","description":"Website URL which you want to fetch the favicon from.","required":true,"type":"string","format":"url","x-example":"https:\/\/example.com","in":"query"}]}},"\/avatars\/flags\/{code}":{"get":{"summary":"Get Country Flag","operationId":"avatarsGetFlag","consumes":["application\/json"],"produces":["image\/png"],"tags":["avatars"],"description":"You can use this endpoint to show different country flags icons to your users. The code argument receives the 2 letter country code. Use width, height and quality arguments to change the output settings.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getFlag","weight":61,"cookies":false,"type":"location","demo":"avatars\/get-flag.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-flag.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"code","description":"Country Code. ISO Alpha-2 country code format.","required":true,"type":"string","x-example":"af","in":"path"},{"name":"width","description":"Image width. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"height","description":"Image height. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"quality","description":"Image quality. Pass an integer between 0 to 100. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"}]}},"\/avatars\/image":{"get":{"summary":"Get Image from URL","operationId":"avatarsGetImage","consumes":["application\/json"],"produces":["image\/*"],"tags":["avatars"],"description":"Use this endpoint to fetch a remote image URL and crop it to any image size you want. This endpoint is very useful if you need to crop and display remote images in your app or in case you want to make sure a 3rd party image is properly served using a TLS protocol.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getImage","weight":62,"cookies":false,"type":"location","demo":"avatars\/get-image.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-image.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"url","description":"Image URL which you want to crop.","required":true,"type":"string","format":"url","x-example":"https:\/\/example.com","in":"query"},{"name":"width","description":"Resize preview image width, Pass an integer between 0 to 2000.","required":false,"type":"integer","format":"int32","x-example":0,"default":400,"in":"query"},{"name":"height","description":"Resize preview image height, Pass an integer between 0 to 2000.","required":false,"type":"integer","format":"int32","x-example":0,"default":400,"in":"query"}]}},"\/avatars\/initials":{"get":{"summary":"Get User Initials","operationId":"avatarsGetInitials","consumes":["application\/json"],"produces":["image\/png"],"tags":["avatars"],"description":"Use this endpoint to show your user initials avatar icon on your website or app. By default, this route will try to print your logged-in user name or email initials. You can also overwrite the user name if you pass the 'name' parameter. If no name is given and no user is logged, an empty avatar will be returned.\n\nYou can use the color and background params to change the avatar colors. By default, a random theme will be selected. The random theme will persist for the user's initials when reloading the same theme will always return for the same initials.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getInitials","weight":65,"cookies":false,"type":"location","demo":"avatars\/get-initials.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-initials.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"name","description":"Full Name. When empty, current user name or email will be used. Max length: 128 chars.","required":false,"type":"string","x-example":"[NAME]","default":"","in":"query"},{"name":"width","description":"Image width. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":500,"in":"query"},{"name":"height","description":"Image height. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":500,"in":"query"},{"name":"color","description":"Changes text color. By default a random color will be picked and stay will persistent to the given name.","required":false,"type":"string","default":"","in":"query"},{"name":"background","description":"Changes background color. By default a random color will be picked and stay will persistent to the given name.","required":false,"type":"string","default":"","in":"query"}]}},"\/avatars\/qr":{"get":{"summary":"Get QR Code","operationId":"avatarsGetQR","consumes":["application\/json"],"produces":["image\/png"],"tags":["avatars"],"description":"Converts a given plain text to a QR code image. You can use the query parameters to change the size and style of the resulting image.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getQR","weight":64,"cookies":false,"type":"location","demo":"avatars\/get-q-r.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-qr.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"text","description":"Plain text to be converted to QR code image.","required":true,"type":"string","x-example":"[TEXT]","in":"query"},{"name":"size","description":"QR code size. Pass an integer between 0 to 1000. Defaults to 400.","required":false,"type":"integer","format":"int32","x-example":0,"default":400,"in":"query"},{"name":"margin","description":"Margin from edge. Pass an integer between 0 to 10. Defaults to 1.","required":false,"type":"integer","format":"int32","x-example":0,"default":1,"in":"query"},{"name":"download","description":"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.","required":false,"type":"boolean","x-example":false,"default":false,"in":"query"}]}},"\/database\/collections":{"get":{"summary":"List Collections","operationId":"databaseListCollections","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Get a list of all the user collections. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project's collections. [Learn more about different API modes](\/docs\/admin).","responses":{"200":{"description":"Collections List","schema":{"$ref":"#\/definitions\/collectionList"}}},"x-appwrite":{"method":"listCollections","weight":67,"cookies":false,"type":"","demo":"database\/list-collections.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/list-collections.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Results offset. The default value is 0. Use this param to manage pagination.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create Collection","operationId":"databaseCreateCollection","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Create a new Collection.","responses":{"201":{"description":"Collection","schema":{"$ref":"#\/definitions\/collection"}}},"x-appwrite":{"method":"createCollection","weight":66,"cookies":false,"type":"","demo":"database\/create-collection.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/create-collection.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Collection name. Max length: 128 chars.","default":null,"x-example":"[NAME]","x-class":null},"read":{"type":"string","description":"An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"x-class":null},"write":{"type":"string","description":"An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"x-class":null}},"required":["name","read","write"]}}]}},"\/database\/collections\/{collectionId}":{"get":{"summary":"Get Collection","operationId":"databaseGetCollection","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata.","responses":{"200":{"description":"Collection","schema":{"$ref":"#\/definitions\/collection"}}},"x-appwrite":{"method":"getCollection","weight":68,"cookies":false,"type":"","demo":"database\/get-collection.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/get-collection.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID.","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"}]},"put":{"summary":"Update Collection","operationId":"databaseUpdateCollection","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Update a collection by its unique ID.","responses":{"200":{"description":"Collection","schema":{"$ref":"#\/definitions\/collection"}}},"x-appwrite":{"method":"updateCollection","weight":69,"cookies":false,"type":"","demo":"database\/update-collection.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/update-collection.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID.","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Collection name. Max length: 128 chars.","default":null,"x-example":"[NAME]","x-class":null},"read":{"type":"string","description":"An array of strings with read permissions. By default inherits the existing read permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"x-class":null},"write":{"type":"string","description":"An array of strings with write permissions. By default inherits the existing write permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"x-class":null}},"required":["name"]}}]},"delete":{"summary":"Delete Collection","operationId":"databaseDeleteCollection","consumes":["application\/json"],"produces":[],"tags":["database"],"description":"Delete a collection by its unique ID. Only users with write permissions have access to delete this resource.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteCollection","weight":70,"cookies":false,"type":"","demo":"database\/delete-collection.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/delete-collection.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID.","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"}]}},"\/database\/collections\/{collectionId}\/attributes":{"get":{"summary":"List Attributes","operationId":"databaseListAttributes","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"","responses":{"200":{"description":"Attributes List","schema":{"$ref":"#\/definitions\/attributeList"}}},"x-appwrite":{"method":"listAttributes","weight":78,"cookies":false,"type":"","demo":"database\/list-attributes.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/list-attributes.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"attributes.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID. You can create a new collection using the Database service [server integration](\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"}]}},"\/database\/collections\/{collectionId}\/attributes\/boolean":{"post":{"summary":"Create Boolean Attribute","operationId":"databaseCreateBooleanAttribute","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"","responses":{"201":{"description":"Attribute","schema":{"$ref":"#\/definitions\/attribute"}}},"x-appwrite":{"method":"createBooleanAttribute","weight":77,"cookies":false,"type":"","demo":"database\/create-boolean-attribute.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/create-attribute-boolean.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"attributes.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID. You can create a new collection using the Database service [server integration](\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"attributeId":{"type":"string","description":"Attribute ID.","default":null,"x-example":null,"x-class":null},"required":{"type":"boolean","description":"Is attribute required?","default":null,"x-example":false,"x-class":null},"default":{"type":"boolean","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","default":null,"x-example":false,"x-class":null},"array":{"type":"boolean","description":"Is attribute an array?","default":false,"x-example":false,"x-class":null}},"required":["attributeId","required"]}}]}},"\/database\/collections\/{collectionId}\/attributes\/email":{"post":{"summary":"Create Email Attribute","operationId":"databaseCreateEmailAttribute","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"","responses":{"201":{"description":"Attribute","schema":{"$ref":"#\/definitions\/attribute"}}},"x-appwrite":{"method":"createEmailAttribute","weight":72,"cookies":false,"type":"","demo":"database\/create-email-attribute.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/create-attribute-email.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"attributes.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID. You can create a new collection using the Database service [server integration](\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"attributeId":{"type":"string","description":"Attribute ID.","default":null,"x-example":null,"x-class":null},"required":{"type":"boolean","description":"Is attribute required?","default":null,"x-example":false,"x-class":null},"default":{"type":"string","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","default":null,"x-example":"[DEFAULT]","x-class":null},"array":{"type":"boolean","description":"Is attribute an array?","default":false,"x-example":false,"x-class":null}},"required":["attributeId","required"]}}]}},"\/database\/collections\/{collectionId}\/attributes\/float":{"post":{"summary":"Create Float Attribute","operationId":"databaseCreateFloatAttribute","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"","responses":{"201":{"description":"Attribute","schema":{"$ref":"#\/definitions\/attribute"}}},"x-appwrite":{"method":"createFloatAttribute","weight":76,"cookies":false,"type":"","demo":"database\/create-float-attribute.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/create-attribute-float.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"attributes.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID. You can create a new collection using the Database service [server integration](\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"attributeId":{"type":"string","description":"Attribute ID.","default":null,"x-example":null,"x-class":null},"required":{"type":"boolean","description":"Is attribute required?","default":null,"x-example":false,"x-class":null},"min":{"type":"string","description":"Minimum value to enforce on new documents","default":null,"x-example":null,"x-class":null},"max":{"type":"string","description":"Maximum value to enforce on new documents","default":null,"x-example":null,"x-class":null},"default":{"type":"string","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","default":null,"x-example":null,"x-class":null},"array":{"type":"boolean","description":"Is attribute an array?","default":false,"x-example":false,"x-class":null}},"required":["attributeId","required"]}}]}},"\/database\/collections\/{collectionId}\/attributes\/integer":{"post":{"summary":"Create Integer Attribute","operationId":"databaseCreateIntegerAttribute","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"","responses":{"201":{"description":"Attribute","schema":{"$ref":"#\/definitions\/attribute"}}},"x-appwrite":{"method":"createIntegerAttribute","weight":75,"cookies":false,"type":"","demo":"database\/create-integer-attribute.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/create-attribute-integer.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"attributes.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID. You can create a new collection using the Database service [server integration](\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"attributeId":{"type":"string","description":"Attribute ID.","default":null,"x-example":null,"x-class":null},"required":{"type":"boolean","description":"Is attribute required?","default":null,"x-example":false,"x-class":null},"min":{"type":"integer","description":"Minimum value to enforce on new documents","default":null,"x-example":null,"x-class":null},"max":{"type":"integer","description":"Maximum value to enforce on new documents","default":null,"x-example":null,"x-class":null},"default":{"type":"integer","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","default":null,"x-example":null,"x-class":null},"array":{"type":"boolean","description":"Is attribute an array?","default":false,"x-example":false,"x-class":null}},"required":["attributeId","required"]}}]}},"\/database\/collections\/{collectionId}\/attributes\/ip":{"post":{"summary":"Create IP Address Attribute","operationId":"databaseCreateIpAttribute","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"","responses":{"201":{"description":"Attribute","schema":{"$ref":"#\/definitions\/attribute"}}},"x-appwrite":{"method":"createIpAttribute","weight":73,"cookies":false,"type":"","demo":"database\/create-ip-attribute.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/create-attribute-ip.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"attributes.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID. You can create a new collection using the Database service [server integration](\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"attributeId":{"type":"string","description":"Attribute ID.","default":null,"x-example":null,"x-class":null},"required":{"type":"boolean","description":"Is attribute required?","default":null,"x-example":false,"x-class":null},"default":{"type":"string","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","default":null,"x-example":"[DEFAULT]","x-class":null},"array":{"type":"boolean","description":"Is attribute an array?","default":false,"x-example":false,"x-class":null}},"required":["attributeId","required"]}}]}},"\/database\/collections\/{collectionId}\/attributes\/string":{"post":{"summary":"Create String Attribute","operationId":"databaseCreateStringAttribute","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"","responses":{"201":{"description":"Attribute","schema":{"$ref":"#\/definitions\/attribute"}}},"x-appwrite":{"method":"createStringAttribute","weight":71,"cookies":false,"type":"","demo":"database\/create-string-attribute.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/create-attribute-string.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"attributes.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID. You can create a new collection using the Database service [server integration](\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"attributeId":{"type":"string","description":"Attribute ID.","default":null,"x-example":null,"x-class":null},"size":{"type":"integer","description":"Attribute size for text attributes, in number of characters.","default":null,"x-example":null,"x-class":null},"required":{"type":"boolean","description":"Is attribute required?","default":null,"x-example":false,"x-class":null},"default":{"type":"string","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","default":null,"x-example":"[DEFAULT]","x-class":null},"array":{"type":"boolean","description":"Is attribute an array?","default":false,"x-example":false,"x-class":null}},"required":["attributeId","size","required"]}}]}},"\/database\/collections\/{collectionId}\/attributes\/url":{"post":{"summary":"Create IP Address Attribute","operationId":"databaseCreateUrlAttribute","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"","responses":{"201":{"description":"Attribute","schema":{"$ref":"#\/definitions\/attribute"}}},"x-appwrite":{"method":"createUrlAttribute","weight":74,"cookies":false,"type":"","demo":"database\/create-url-attribute.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/create-attribute-url.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"attributes.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID. You can create a new collection using the Database service [server integration](\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"attributeId":{"type":"string","description":"Attribute ID.","default":null,"x-example":null,"x-class":null},"size":{"type":"integer","description":"Attribute size for text attributes, in number of characters.","default":null,"x-example":null,"x-class":null},"required":{"type":"boolean","description":"Is attribute required?","default":null,"x-example":false,"x-class":null},"default":{"type":"string","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","default":null,"x-example":"[DEFAULT]","x-class":null},"array":{"type":"boolean","description":"Is attribute an array?","default":false,"x-example":false,"x-class":null}},"required":["attributeId","size","required"]}}]}},"\/database\/collections\/{collectionId}\/attributes\/{attributeId}":{"get":{"summary":"Get Attribute","operationId":"databaseGetAttribute","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"","responses":{"200":{"description":"Attribute","schema":{"$ref":"#\/definitions\/attribute"}}},"x-appwrite":{"method":"getAttribute","weight":79,"cookies":false,"type":"","demo":"database\/get-attribute.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/get-attribute.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"attributes.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID. You can create a new collection using the Database service [server integration](\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"attributeId","description":"Attribute ID.","required":true,"type":"string","in":"path"}]},"delete":{"summary":"Delete Attribute","operationId":"databaseDeleteAttribute","consumes":["application\/json"],"produces":[],"tags":["database"],"description":"","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteAttribute","weight":80,"cookies":false,"type":"","demo":"database\/delete-attribute.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/delete-attribute.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"attributes.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID. You can create a new collection using the Database service [server integration](\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"attributeId","description":"Attribute ID.","required":true,"type":"string","in":"path"}]}},"\/database\/collections\/{collectionId}\/documents":{"get":{"summary":"List Documents","operationId":"databaseListDocuments","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Get a list of all the user documents. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project's documents. [Learn more about different API modes](\/docs\/admin).","responses":{"200":{"description":"Documents List","schema":{"$ref":"#\/definitions\/documentList"}}},"x-appwrite":{"method":"listDocuments","weight":86,"cookies":false,"type":"","demo":"database\/list-documents.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/list-documents.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"documents.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID. You can create a new collection using the Database service [server integration](\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"queries","description":"Array of query strings.","required":false,"x-class":"query","type":"array","collectionFormat":"multi","items":{"type":"string"},"default":[],"in":"query"},{"name":"limit","description":"Maximum number of documents to return in response. Use this value to manage pagination. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Offset value. The default value is 0. Use this param to manage pagination.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"orderAttributes","description":"Array of attributes used to sort results.","required":false,"type":"array","collectionFormat":"multi","items":{"type":"string"},"default":[],"in":"query"},{"name":"orderTypes","description":"Array of order directions for sorting attribtues. Possible values are DESC for descending order, or ASC for ascending order.","required":false,"type":"array","collectionFormat":"multi","items":{"type":"string"},"default":[],"in":"query"}]},"post":{"summary":"Create Document","operationId":"databaseCreateDocument","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](\/docs\/server\/database#databaseCreateCollection) API or directly from your database console.","responses":{"201":{"description":"Document","schema":{"$ref":"#\/definitions\/document"}}},"x-appwrite":{"method":"createDocument","weight":85,"cookies":false,"type":"","demo":"database\/create-document.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/create-document.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"documents.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"data":{"type":"object","description":"Document data as JSON object.","default":null,"x-example":"{}","x-class":null},"read":{"type":"string","description":"An array of strings with read permissions. By default only the current user is granted with read permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"x-class":null},"write":{"type":"string","description":"An array of strings with write permissions. By default only the current user is granted with write permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"x-class":null}},"required":["data"]}}]}},"\/database\/collections\/{collectionId}\/documents\/{documentId}":{"get":{"summary":"Get Document","operationId":"databaseGetDocument","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Get a document by its unique ID. This endpoint response returns a JSON object with the document data.","responses":{"200":{"description":"Document","schema":{"$ref":"#\/definitions\/document"}}},"x-appwrite":{"method":"getDocument","weight":87,"cookies":false,"type":"","demo":"database\/get-document.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/get-document.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"documents.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID. You can create a new collection using the Database service [server integration](\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"documentId","description":"Document unique ID.","required":true,"type":"string","x-example":"[DOCUMENT_ID]","in":"path"}]},"patch":{"summary":"Update Document","operationId":"databaseUpdateDocument","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated.","responses":{"200":{"description":"Document","schema":{"$ref":"#\/definitions\/document"}}},"x-appwrite":{"method":"updateDocument","weight":88,"cookies":false,"type":"","demo":"database\/update-document.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/update-document.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"documents.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"documentId","description":"Document unique ID.","required":true,"type":"string","x-example":"[DOCUMENT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"data":{"type":"object","description":"Document data as JSON object.","default":null,"x-example":"{}","x-class":null},"read":{"type":"string","description":"An array of strings with read permissions. By default inherits the existing read permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"x-class":null},"write":{"type":"string","description":"An array of strings with write permissions. By default inherits the existing write permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"x-class":null}},"required":["data"]}}]},"delete":{"summary":"Delete Document","operationId":"databaseDeleteDocument","consumes":["application\/json"],"produces":[],"tags":["database"],"description":"Delete a document by its unique ID. This endpoint deletes only the parent documents, its attributes and relations to other documents. Child documents **will not** be deleted.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteDocument","weight":89,"cookies":false,"type":"","demo":"database\/delete-document.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/delete-document.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"documents.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID. You can create a new collection using the Database service [server integration](\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"documentId","description":"Document unique ID.","required":true,"type":"string","x-example":"[DOCUMENT_ID]","in":"path"}]}},"\/database\/collections\/{collectionId}\/indexes":{"get":{"summary":"List Indexes","operationId":"databaseListIndexes","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"","responses":{"200":{"description":"Indexes List","schema":{"$ref":"#\/definitions\/indexList"}}},"x-appwrite":{"method":"listIndexes","weight":82,"cookies":false,"type":"","demo":"database\/list-indexes.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/list-indexes.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"indexes.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID. You can create a new collection using the Database service [server integration](\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"}]},"post":{"summary":"Create Index","operationId":"databaseCreateIndex","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"","responses":{"201":{"description":"Index","schema":{"$ref":"#\/definitions\/index"}}},"x-appwrite":{"method":"createIndex","weight":81,"cookies":false,"type":"","demo":"database\/create-index.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/create-index.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"indexes.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID. You can create a new collection using the Database service [server integration](\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"id":{"type":"string","description":"Index ID.","default":null,"x-example":null,"x-class":null},"type":{"type":"string","description":"Index type.","default":null,"x-example":"key","x-class":null},"attributes":{"type":"array","description":"Array of attributes to index.","default":null,"x-example":null,"x-class":null,"items":{"type":"string"}},"orders":{"type":"array","description":"Array of index orders.","default":[],"x-example":null,"x-class":null,"items":{"type":"string"}}},"required":["id","type","attributes"]}}]}},"\/database\/collections\/{collectionId}\/indexes\/{indexId}":{"get":{"summary":"Get Index","operationId":"databaseGetIndex","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"","responses":{"200":{"description":"Index","schema":{"$ref":"#\/definitions\/index"}}},"x-appwrite":{"method":"getIndex","weight":83,"cookies":false,"type":"","demo":"database\/get-index.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/get-index.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"indexes.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID. You can create a new collection using the Database service [server integration](\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"indexId","description":"Index ID.","required":true,"type":"string","in":"path"}]},"delete":{"summary":"Delete Index","operationId":"databaseDeleteIndex","consumes":["application\/json"],"produces":[],"tags":["database"],"description":"","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteIndex","weight":84,"cookies":false,"type":"","demo":"database\/delete-index.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/delete-index.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"indexes.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID. You can create a new collection using the Database service [server integration](\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"indexId","description":"Index ID.","required":true,"type":"string","in":"path"}]}},"\/functions":{"get":{"summary":"List Functions","operationId":"functionsList","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Get a list of all the project's functions. You can use the query params to filter your results.","responses":{"200":{"description":"Functions List","schema":{"$ref":"#\/definitions\/functionList"}}},"x-appwrite":{"method":"list","weight":171,"cookies":false,"type":"","demo":"functions\/list.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/list-functions.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Results offset. The default value is 0. Use this param to manage pagination.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create Function","operationId":"functionsCreate","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Create a new function. You can pass a list of [permissions](\/docs\/permissions) to allow different project users or team with access to execute the function using the client API.","responses":{"201":{"description":"Function","schema":{"$ref":"#\/definitions\/function"}}},"x-appwrite":{"method":"create","weight":170,"cookies":false,"type":"","demo":"functions\/create.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/create-function.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Function name. Max length: 128 chars.","default":null,"x-example":"[NAME]","x-class":null},"execute":{"type":"array","description":"An array of strings with execution permissions. By default no user is granted with any execute permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"x-class":null,"items":{"type":"string"}},"runtime":{"type":"string","description":"Execution runtime.","default":null,"x-example":"java-11.0","x-class":null},"vars":{"type":"object","description":"Key-value JSON object.","default":{},"x-example":"{}","x-class":null},"events":{"type":"array","description":"Events list.","default":[],"x-example":null,"x-class":null,"items":{"type":"string"}},"schedule":{"type":"string","description":"Schedule CRON syntax.","default":"","x-example":null,"x-class":null},"timeout":{"type":"integer","description":"Function maximum execution time in seconds.","default":15,"x-example":1,"x-class":null}},"required":["name","execute","runtime"]}}]}},"\/functions\/{functionId}":{"get":{"summary":"Get Function","operationId":"functionsGet","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Get a function by its unique ID.","responses":{"200":{"description":"Function","schema":{"$ref":"#\/definitions\/function"}}},"x-appwrite":{"method":"get","weight":172,"cookies":false,"type":"","demo":"functions\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/get-function.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"}]},"put":{"summary":"Update Function","operationId":"functionsUpdate","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Update function by its unique ID.","responses":{"200":{"description":"Function","schema":{"$ref":"#\/definitions\/function"}}},"x-appwrite":{"method":"update","weight":174,"cookies":false,"type":"","demo":"functions\/update.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/update-function.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Function name. Max length: 128 chars.","default":null,"x-example":"[NAME]","x-class":null},"execute":{"type":"array","description":"An array of strings with execution permissions. By default no user is granted with any execute permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"x-class":null,"items":{"type":"string"}},"vars":{"type":"object","description":"Key-value JSON object.","default":{},"x-example":"{}","x-class":null},"events":{"type":"array","description":"Events list.","default":[],"x-example":null,"x-class":null,"items":{"type":"string"}},"schedule":{"type":"string","description":"Schedule CRON syntax.","default":"","x-example":null,"x-class":null},"timeout":{"type":"integer","description":"Function maximum execution time in seconds.","default":15,"x-example":1,"x-class":null}},"required":["name","execute"]}}]},"delete":{"summary":"Delete Function","operationId":"functionsDelete","consumes":["application\/json"],"produces":[],"tags":["functions"],"description":"Delete a function by its unique ID.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"delete","weight":176,"cookies":false,"type":"","demo":"functions\/delete.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/delete-function.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"}]}},"\/functions\/{functionId}\/executions":{"get":{"summary":"List Executions","operationId":"functionsListExecutions","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Get a list of all the current user function execution logs. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project's executions. [Learn more about different API modes](\/docs\/admin).","responses":{"200":{"description":"Executions List","schema":{"$ref":"#\/definitions\/executionList"}}},"x-appwrite":{"method":"listExecutions","weight":182,"cookies":false,"type":"","demo":"functions\/list-executions.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/list-executions.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"execution.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"limit","description":"Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Results offset. The default value is 0. Use this param to manage pagination.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"}]},"post":{"summary":"Create Execution","operationId":"functionsCreateExecution","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Trigger a function execution. The returned object will return you the current execution status. You can ping the `Get Execution` endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously.","responses":{"201":{"description":"Execution","schema":{"$ref":"#\/definitions\/execution"}}},"x-appwrite":{"method":"createExecution","weight":181,"cookies":false,"type":"","demo":"functions\/create-execution.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/create-execution.md","rate-limit":60,"rate-time":60,"rate-key":"url:{url},ip:{ip}","scope":"execution.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"data":{"type":"string","description":"String of custom data to send to function.","default":"","x-example":"[DATA]","x-class":null}}}}]}},"\/functions\/{functionId}\/executions\/{executionId}":{"get":{"summary":"Get Execution","operationId":"functionsGetExecution","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Get a function execution log by its unique ID.","responses":{"200":{"description":"Execution","schema":{"$ref":"#\/definitions\/execution"}}},"x-appwrite":{"method":"getExecution","weight":183,"cookies":false,"type":"","demo":"functions\/get-execution.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/get-execution.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"execution.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"executionId","description":"Execution unique ID.","required":true,"type":"string","x-example":"[EXECUTION_ID]","in":"path"}]}},"\/functions\/{functionId}\/tag":{"patch":{"summary":"Update Function Tag","operationId":"functionsUpdateTag","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Update the function code tag ID using the unique function ID. Use this endpoint to switch the code tag that should be executed by the execution endpoint.","responses":{"200":{"description":"Function","schema":{"$ref":"#\/definitions\/function"}}},"x-appwrite":{"method":"updateTag","weight":175,"cookies":false,"type":"","demo":"functions\/update-tag.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/update-function-tag.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"tag":{"type":"string","description":"Tag unique ID.","default":null,"x-example":"[TAG]","x-class":null}},"required":["tag"]}}]}},"\/functions\/{functionId}\/tags":{"get":{"summary":"List Tags","operationId":"functionsListTags","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Get a list of all the project's code tags. You can use the query params to filter your results.","responses":{"200":{"description":"Tags List","schema":{"$ref":"#\/definitions\/tagList"}}},"x-appwrite":{"method":"listTags","weight":178,"cookies":false,"type":"","demo":"functions\/list-tags.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/list-tags.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Results offset. The default value is 0. Use this param to manage pagination.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create Tag","operationId":"functionsCreateTag","consumes":["multipart\/form-data"],"produces":["application\/json"],"tags":["functions"],"description":"Create a new function code tag. Use this endpoint to upload a new version of your code function. To execute your newly uploaded code, you'll need to update the function's tag to use your new tag UID.\n\nThis endpoint accepts a tar.gz file compressed with your code. Make sure to include any dependencies your code has within the compressed file. You can learn more about code packaging in the [Appwrite Cloud Functions tutorial](\/docs\/functions).\n\nUse the \"command\" param to set the entry point used to execute your code.","responses":{"201":{"description":"Tag","schema":{"$ref":"#\/definitions\/tag"}}},"x-appwrite":{"method":"createTag","weight":177,"cookies":false,"type":"","demo":"functions\/create-tag.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/create-tag.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.write","platforms":["server"],"packaging":true,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"command","description":"Code execution command.","required":true,"type":"string","x-example":"[COMMAND]","in":"formData"},{"name":"code","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.","required":true,"type":"file","in":"formData"}]}},"\/functions\/{functionId}\/tags\/{tagId}":{"get":{"summary":"Get Tag","operationId":"functionsGetTag","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Get a code tag by its unique ID.","responses":{"200":{"description":"Tag","schema":{"$ref":"#\/definitions\/tag"}}},"x-appwrite":{"method":"getTag","weight":179,"cookies":false,"type":"","demo":"functions\/get-tag.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/get-tag.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"tagId","description":"Tag unique ID.","required":true,"type":"string","x-example":"[TAG_ID]","in":"path"}]},"delete":{"summary":"Delete Tag","operationId":"functionsDeleteTag","consumes":["application\/json"],"produces":[],"tags":["functions"],"description":"Delete a code tag by its unique ID.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteTag","weight":180,"cookies":false,"type":"","demo":"functions\/delete-tag.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/delete-tag.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"tagId","description":"Tag unique ID.","required":true,"type":"string","x-example":"[TAG_ID]","in":"path"}]}},"\/functions\/{functionId}\/usage":{"get":{"summary":"Get Function Usage","operationId":"functionsGetUsage","consumes":["application\/json"],"produces":[],"tags":["functions"],"description":"","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getUsage","weight":173,"cookies":false,"type":"","demo":"functions\/get-usage.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"range","description":"Date range.","required":false,"type":"string","x-example":"24h","default":"30d","in":"query"}]}},"\/health":{"get":{"summary":"Get HTTP","operationId":"healthGet","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Check the Appwrite HTTP server is up and responsive.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"get","weight":97,"cookies":false,"type":"","demo":"health\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/anti-virus":{"get":{"summary":"Get Anti virus","operationId":"healthGetAntiVirus","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Check the Appwrite Anti Virus server is up and connection is successful.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getAntiVirus","weight":108,"cookies":false,"type":"","demo":"health\/get-anti-virus.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-storage-anti-virus.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/cache":{"get":{"summary":"Get Cache","operationId":"healthGetCache","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Check the Appwrite in-memory cache server is up and connection is successful.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getCache","weight":100,"cookies":false,"type":"","demo":"health\/get-cache.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-cache.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/db":{"get":{"summary":"Get DB","operationId":"healthGetDB","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Check the Appwrite database server is up and connection is successful.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getDB","weight":99,"cookies":false,"type":"","demo":"health\/get-d-b.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-db.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/queue\/certificates":{"get":{"summary":"Get Certificate Queue","operationId":"healthGetQueueCertificates","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Get the number of certificates that are waiting to be issued against [Letsencrypt](https:\/\/letsencrypt.org\/) in the Appwrite internal queue server.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getQueueCertificates","weight":105,"cookies":false,"type":"","demo":"health\/get-queue-certificates.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-certificates.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/queue\/functions":{"get":{"summary":"Get Functions Queue","operationId":"healthGetQueueFunctions","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getQueueFunctions","weight":106,"cookies":false,"type":"","demo":"health\/get-queue-functions.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-functions.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/queue\/logs":{"get":{"summary":"Get Logs Queue","operationId":"healthGetQueueLogs","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Get the number of logs that are waiting to be processed in the Appwrite internal queue server.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getQueueLogs","weight":103,"cookies":false,"type":"","demo":"health\/get-queue-logs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-logs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/queue\/usage":{"get":{"summary":"Get Usage Queue","operationId":"healthGetQueueUsage","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Get the number of usage stats that are waiting to be processed in the Appwrite internal queue server.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getQueueUsage","weight":104,"cookies":false,"type":"","demo":"health\/get-queue-usage.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-usage.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/queue\/webhooks":{"get":{"summary":"Get Webhooks Queue","operationId":"healthGetQueueWebhooks","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getQueueWebhooks","weight":102,"cookies":false,"type":"","demo":"health\/get-queue-webhooks.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-webhooks.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/storage\/local":{"get":{"summary":"Get Local Storage","operationId":"healthGetStorageLocal","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Check the Appwrite local storage device is up and connection is successful.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getStorageLocal","weight":107,"cookies":false,"type":"","demo":"health\/get-storage-local.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-storage-local.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/time":{"get":{"summary":"Get Time","operationId":"healthGetTime","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Check the Appwrite server time is synced with Google remote NTP server. We use this technology to smoothly handle leap seconds with no disruptive events. The [Network Time Protocol](https:\/\/en.wikipedia.org\/wiki\/Network_Time_Protocol) (NTP) is used by hundreds of millions of computers and devices to synchronize their clocks over the Internet. If your computer sets its own clock, it likely uses NTP.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getTime","weight":101,"cookies":false,"type":"","demo":"health\/get-time.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-time.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/locale":{"get":{"summary":"Get User Locale","operationId":"localeGet","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"Get the current user location based on IP. Returns an object with user country code, country name, continent name, continent code, ip address and suggested currency. You can use the locale header to get the data in a supported language.\n\n([IP Geolocation by DB-IP](https:\/\/db-ip.com))","responses":{"200":{"description":"Locale","schema":{"$ref":"#\/definitions\/locale"}}},"x-appwrite":{"method":"get","weight":90,"cookies":false,"type":"","demo":"locale\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-locale.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}]}},"\/locale\/continents":{"get":{"summary":"List Continents","operationId":"localeGetContinents","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"List of all continents. You can use the locale header to get the data in a supported language.","responses":{"200":{"description":"Continents List","schema":{"$ref":"#\/definitions\/continentList"}}},"x-appwrite":{"method":"getContinents","weight":94,"cookies":false,"type":"","demo":"locale\/get-continents.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-continents.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}]}},"\/locale\/countries":{"get":{"summary":"List Countries","operationId":"localeGetCountries","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"List of all countries. You can use the locale header to get the data in a supported language.","responses":{"200":{"description":"Countries List","schema":{"$ref":"#\/definitions\/countryList"}}},"x-appwrite":{"method":"getCountries","weight":91,"cookies":false,"type":"","demo":"locale\/get-countries.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-countries.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}]}},"\/locale\/countries\/eu":{"get":{"summary":"List EU Countries","operationId":"localeGetCountriesEU","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"List of all countries that are currently members of the EU. You can use the locale header to get the data in a supported language.","responses":{"200":{"description":"Countries List","schema":{"$ref":"#\/definitions\/countryList"}}},"x-appwrite":{"method":"getCountriesEU","weight":92,"cookies":false,"type":"","demo":"locale\/get-countries-e-u.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-countries-eu.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}]}},"\/locale\/countries\/phones":{"get":{"summary":"List Countries Phone Codes","operationId":"localeGetCountriesPhones","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"List of all countries phone codes. You can use the locale header to get the data in a supported language.","responses":{"200":{"description":"Phones List","schema":{"$ref":"#\/definitions\/phoneList"}}},"x-appwrite":{"method":"getCountriesPhones","weight":93,"cookies":false,"type":"","demo":"locale\/get-countries-phones.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-countries-phones.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}]}},"\/locale\/currencies":{"get":{"summary":"List Currencies","operationId":"localeGetCurrencies","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"List of all currencies, including currency symbol, name, plural, and decimal digits for all major and minor currencies. You can use the locale header to get the data in a supported language.","responses":{"200":{"description":"Currencies List","schema":{"$ref":"#\/definitions\/currencyList"}}},"x-appwrite":{"method":"getCurrencies","weight":95,"cookies":false,"type":"","demo":"locale\/get-currencies.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-currencies.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}]}},"\/locale\/languages":{"get":{"summary":"List Languages","operationId":"localeGetLanguages","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"List of all languages classified by ISO 639-1 including 2-letter code, name in English, and name in the respective language.","responses":{"200":{"description":"Languages List","schema":{"$ref":"#\/definitions\/languageList"}}},"x-appwrite":{"method":"getLanguages","weight":96,"cookies":false,"type":"","demo":"locale\/get-languages.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-languages.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}]}},"\/projects":{"get":{"summary":"List Projects","operationId":"projectsList","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Projects List","schema":{"$ref":"#\/definitions\/projectList"}}},"x-appwrite":{"method":"list","weight":111,"cookies":false,"type":"","demo":"projects\/list.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Results offset. The default value is 0. Use this param to manage pagination.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create Project","operationId":"projectsCreate","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"201":{"description":"Project","schema":{"$ref":"#\/definitions\/project"}}},"x-appwrite":{"method":"create","weight":110,"cookies":false,"type":"","demo":"projects\/create.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Project name. Max length: 128 chars.","default":null,"x-example":"[NAME]","x-class":null},"teamId":{"type":"string","description":"Team unique ID.","default":null,"x-example":"[TEAM_ID]","x-class":null},"description":{"type":"string","description":"Project description. Max length: 256 chars.","default":"","x-example":"[DESCRIPTION]","x-class":null},"logo":{"type":"string","description":"Project logo.","default":"","x-example":"[LOGO]","x-class":null},"url":{"type":"string","description":"Project URL.","default":"","x-example":"https:\/\/example.com","x-class":null},"legalName":{"type":"string","description":"Project legal Name. Max length: 256 chars.","default":"","x-example":"[LEGAL_NAME]","x-class":null},"legalCountry":{"type":"string","description":"Project legal Country. Max length: 256 chars.","default":"","x-example":"[LEGAL_COUNTRY]","x-class":null},"legalState":{"type":"string","description":"Project legal State. Max length: 256 chars.","default":"","x-example":"[LEGAL_STATE]","x-class":null},"legalCity":{"type":"string","description":"Project legal City. Max length: 256 chars.","default":"","x-example":"[LEGAL_CITY]","x-class":null},"legalAddress":{"type":"string","description":"Project legal Address. Max length: 256 chars.","default":"","x-example":"[LEGAL_ADDRESS]","x-class":null},"legalTaxId":{"type":"string","description":"Project legal Tax ID. Max length: 256 chars.","default":"","x-example":"[LEGAL_TAX_ID]","x-class":null}},"required":["name","teamId"]}}]}},"\/projects\/{projectId}":{"get":{"summary":"Get Project","operationId":"projectsGet","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Project","schema":{"$ref":"#\/definitions\/project"}}},"x-appwrite":{"method":"get","weight":112,"cookies":false,"type":"","demo":"projects\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"}]},"patch":{"summary":"Update Project","operationId":"projectsUpdate","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Project","schema":{"$ref":"#\/definitions\/project"}}},"x-appwrite":{"method":"update","weight":114,"cookies":false,"type":"","demo":"projects\/update.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Project name. Max length: 128 chars.","default":null,"x-example":"[NAME]","x-class":null},"description":{"type":"string","description":"Project description. Max length: 256 chars.","default":"","x-example":"[DESCRIPTION]","x-class":null},"logo":{"type":"string","description":"Project logo.","default":"","x-example":"[LOGO]","x-class":null},"url":{"type":"string","description":"Project URL.","default":"","x-example":"https:\/\/example.com","x-class":null},"legalName":{"type":"string","description":"Project legal name. Max length: 256 chars.","default":"","x-example":"[LEGAL_NAME]","x-class":null},"legalCountry":{"type":"string","description":"Project legal country. Max length: 256 chars.","default":"","x-example":"[LEGAL_COUNTRY]","x-class":null},"legalState":{"type":"string","description":"Project legal state. Max length: 256 chars.","default":"","x-example":"[LEGAL_STATE]","x-class":null},"legalCity":{"type":"string","description":"Project legal city. Max length: 256 chars.","default":"","x-example":"[LEGAL_CITY]","x-class":null},"legalAddress":{"type":"string","description":"Project legal address. Max length: 256 chars.","default":"","x-example":"[LEGAL_ADDRESS]","x-class":null},"legalTaxId":{"type":"string","description":"Project legal tax ID. Max length: 256 chars.","default":"","x-example":"[LEGAL_TAX_ID]","x-class":null}},"required":["name"]}}]},"delete":{"summary":"Delete Project","operationId":"projectsDelete","consumes":["application\/json"],"produces":[],"tags":["projects"],"description":"","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"delete","weight":119,"cookies":false,"type":"","demo":"projects\/delete.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"password":{"type":"string","description":"Your user password for confirmation. Must be between 6 to 32 chars.","default":null,"x-example":"[PASSWORD]","x-class":null}},"required":["password"]}}]}},"\/projects\/{projectId}\/auth\/limit":{"patch":{"summary":"Update Project users limit","operationId":"projectsUpdateAuthLimit","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Project","schema":{"$ref":"#\/definitions\/project"}}},"x-appwrite":{"method":"updateAuthLimit","weight":117,"cookies":false,"type":"","demo":"projects\/update-auth-limit.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"limit":{"type":"integer","description":"Set the max number of users allowed in this project. Use 0 for unlimited.","default":null,"x-example":null,"x-class":null}},"required":["limit"]}}]}},"\/projects\/{projectId}\/auth\/{method}":{"patch":{"summary":"Update Project auth method status. Use this endpoint to enable or disable a given auth method for this project.","operationId":"projectsUpdateAuthStatus","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Project","schema":{"$ref":"#\/definitions\/project"}}},"x-appwrite":{"method":"updateAuthStatus","weight":118,"cookies":false,"type":"","demo":"projects\/update-auth-status.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"method","description":"Auth Method. Possible values: email-password,anonymous,invites,jwt,phone","required":true,"type":"string","x-example":"email-password","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"status":{"type":"boolean","description":"Set the status of this auth method.","default":null,"x-example":false,"x-class":null}},"required":["status"]}}]}},"\/projects\/{projectId}\/domains":{"get":{"summary":"List Domains","operationId":"projectsListDomains","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Domains List","schema":{"$ref":"#\/definitions\/domainList"}}},"x-appwrite":{"method":"listDomains","weight":136,"cookies":false,"type":"","demo":"projects\/list-domains.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"}]},"post":{"summary":"Create Domain","operationId":"projectsCreateDomain","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"201":{"description":"Domain","schema":{"$ref":"#\/definitions\/domain"}}},"x-appwrite":{"method":"createDomain","weight":135,"cookies":false,"type":"","demo":"projects\/create-domain.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"domain":{"type":"string","description":"Domain name.","default":null,"x-example":null,"x-class":null}},"required":["domain"]}}]}},"\/projects\/{projectId}\/domains\/{domainId}":{"get":{"summary":"Get Domain","operationId":"projectsGetDomain","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Domain","schema":{"$ref":"#\/definitions\/domain"}}},"x-appwrite":{"method":"getDomain","weight":137,"cookies":false,"type":"","demo":"projects\/get-domain.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"domainId","description":"Domain unique ID.","required":true,"type":"string","x-example":"[DOMAIN_ID]","in":"path"}]},"delete":{"summary":"Delete Domain","operationId":"projectsDeleteDomain","consumes":["application\/json"],"produces":[],"tags":["projects"],"description":"","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteDomain","weight":139,"cookies":false,"type":"","demo":"projects\/delete-domain.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"domainId","description":"Domain unique ID.","required":true,"type":"string","x-example":"[DOMAIN_ID]","in":"path"}]}},"\/projects\/{projectId}\/domains\/{domainId}\/verification":{"patch":{"summary":"Update Domain Verification Status","operationId":"projectsUpdateDomainVerification","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Domain","schema":{"$ref":"#\/definitions\/domain"}}},"x-appwrite":{"method":"updateDomainVerification","weight":138,"cookies":false,"type":"","demo":"projects\/update-domain-verification.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"domainId","description":"Domain unique ID.","required":true,"type":"string","x-example":"[DOMAIN_ID]","in":"path"}]}},"\/projects\/{projectId}\/keys":{"get":{"summary":"List Keys","operationId":"projectsListKeys","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"API Keys List","schema":{"$ref":"#\/definitions\/keyList"}}},"x-appwrite":{"method":"listKeys","weight":126,"cookies":false,"type":"","demo":"projects\/list-keys.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"}]},"post":{"summary":"Create Key","operationId":"projectsCreateKey","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"201":{"description":"Key","schema":{"$ref":"#\/definitions\/key"}}},"x-appwrite":{"method":"createKey","weight":125,"cookies":false,"type":"","demo":"projects\/create-key.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Key name. Max length: 128 chars.","default":null,"x-example":"[NAME]","x-class":null},"scopes":{"type":"array","description":"Key scopes list.","default":null,"x-example":null,"x-class":null,"items":{"type":"string"}}},"required":["name","scopes"]}}]}},"\/projects\/{projectId}\/keys\/{keyId}":{"get":{"summary":"Get Key","operationId":"projectsGetKey","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Key","schema":{"$ref":"#\/definitions\/key"}}},"x-appwrite":{"method":"getKey","weight":127,"cookies":false,"type":"","demo":"projects\/get-key.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"keyId","description":"Key unique ID.","required":true,"type":"string","x-example":"[KEY_ID]","in":"path"}]},"put":{"summary":"Update Key","operationId":"projectsUpdateKey","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Key","schema":{"$ref":"#\/definitions\/key"}}},"x-appwrite":{"method":"updateKey","weight":128,"cookies":false,"type":"","demo":"projects\/update-key.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"keyId","description":"Key unique ID.","required":true,"type":"string","x-example":"[KEY_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Key name. Max length: 128 chars.","default":null,"x-example":"[NAME]","x-class":null},"scopes":{"type":"array","description":"Key scopes list","default":null,"x-example":null,"x-class":null,"items":{"type":"string"}}},"required":["name","scopes"]}}]},"delete":{"summary":"Delete Key","operationId":"projectsDeleteKey","consumes":["application\/json"],"produces":[],"tags":["projects"],"description":"","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteKey","weight":129,"cookies":false,"type":"","demo":"projects\/delete-key.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"keyId","description":"Key unique ID.","required":true,"type":"string","x-example":"[KEY_ID]","in":"path"}]}},"\/projects\/{projectId}\/oauth2":{"patch":{"summary":"Update Project OAuth2","operationId":"projectsUpdateOAuth2","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Project","schema":{"$ref":"#\/definitions\/project"}}},"x-appwrite":{"method":"updateOAuth2","weight":116,"cookies":false,"type":"","demo":"projects\/update-o-auth2.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"provider":{"type":"string","description":"Provider Name","default":null,"x-example":"amazon","x-class":null},"appId":{"type":"string","description":"Provider app ID. Max length: 256 chars.","default":"","x-example":"[APP_ID]","x-class":null},"secret":{"type":"string","description":"Provider secret key. Max length: 512 chars.","default":"","x-example":"[SECRET]","x-class":null}},"required":["provider"]}}]}},"\/projects\/{projectId}\/platforms":{"get":{"summary":"List Platforms","operationId":"projectsListPlatforms","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Platforms List","schema":{"$ref":"#\/definitions\/platformList"}}},"x-appwrite":{"method":"listPlatforms","weight":131,"cookies":false,"type":"","demo":"projects\/list-platforms.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"}]},"post":{"summary":"Create Platform","operationId":"projectsCreatePlatform","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"201":{"description":"Platform","schema":{"$ref":"#\/definitions\/platform"}}},"x-appwrite":{"method":"createPlatform","weight":130,"cookies":false,"type":"","demo":"projects\/create-platform.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"type":{"type":"string","description":"Platform type.","default":null,"x-example":"web","x-class":null},"name":{"type":"string","description":"Platform name. Max length: 128 chars.","default":null,"x-example":"[NAME]","x-class":null},"key":{"type":"string","description":"Package name for android or bundle ID for iOS. Max length: 256 chars.","default":"","x-example":"[KEY]","x-class":null},"store":{"type":"string","description":"App store or Google Play store ID. Max length: 256 chars.","default":"","x-example":"[STORE]","x-class":null},"hostname":{"type":"string","description":"Platform client hostname. Max length: 256 chars.","default":"","x-example":"[HOSTNAME]","x-class":null}},"required":["type","name"]}}]}},"\/projects\/{projectId}\/platforms\/{platformId}":{"get":{"summary":"Get Platform","operationId":"projectsGetPlatform","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Platform","schema":{"$ref":"#\/definitions\/platform"}}},"x-appwrite":{"method":"getPlatform","weight":132,"cookies":false,"type":"","demo":"projects\/get-platform.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"platformId","description":"Platform unique ID.","required":true,"type":"string","x-example":"[PLATFORM_ID]","in":"path"}]},"put":{"summary":"Update Platform","operationId":"projectsUpdatePlatform","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Platform","schema":{"$ref":"#\/definitions\/platform"}}},"x-appwrite":{"method":"updatePlatform","weight":133,"cookies":false,"type":"","demo":"projects\/update-platform.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"platformId","description":"Platform unique ID.","required":true,"type":"string","x-example":"[PLATFORM_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Platform name. Max length: 128 chars.","default":null,"x-example":"[NAME]","x-class":null},"key":{"type":"string","description":"Package name for android or bundle ID for iOS. Max length: 256 chars.","default":"","x-example":"[KEY]","x-class":null},"store":{"type":"string","description":"App store or Google Play store ID. Max length: 256 chars.","default":"","x-example":"[STORE]","x-class":null},"hostname":{"type":"string","description":"Platform client URL. Max length: 256 chars.","default":"","x-example":"[HOSTNAME]","x-class":null}},"required":["name"]}}]},"delete":{"summary":"Delete Platform","operationId":"projectsDeletePlatform","consumes":["application\/json"],"produces":[],"tags":["projects"],"description":"","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deletePlatform","weight":134,"cookies":false,"type":"","demo":"projects\/delete-platform.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"platformId","description":"Platform unique ID.","required":true,"type":"string","x-example":"[PLATFORM_ID]","in":"path"}]}},"\/projects\/{projectId}\/service":{"patch":{"summary":"Update service status","operationId":"projectsUpdateServiceStatus","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Project","schema":{"$ref":"#\/definitions\/project"}}},"x-appwrite":{"method":"updateServiceStatus","weight":115,"cookies":false,"type":"","demo":"projects\/update-service-status.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"service":{"type":"string","description":"Service name.","default":null,"x-example":"account","x-class":null},"status":{"type":"boolean","description":"Service status.","default":null,"x-example":false,"x-class":null}},"required":["service","status"]}}]}},"\/projects\/{projectId}\/usage":{"get":{"summary":"Get Project","operationId":"projectsGetUsage","consumes":["application\/json"],"produces":[],"tags":["projects"],"description":"","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getUsage","weight":113,"cookies":false,"type":"","demo":"projects\/get-usage.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"range","description":"Date range.","required":false,"type":"string","x-example":"24h","default":"30d","in":"query"}]}},"\/projects\/{projectId}\/webhooks":{"get":{"summary":"List Webhooks","operationId":"projectsListWebhooks","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Webhooks List","schema":{"$ref":"#\/definitions\/webhookList"}}},"x-appwrite":{"method":"listWebhooks","weight":121,"cookies":false,"type":"","demo":"projects\/list-webhooks.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"}]},"post":{"summary":"Create Webhook","operationId":"projectsCreateWebhook","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"201":{"description":"Webhook","schema":{"$ref":"#\/definitions\/webhook"}}},"x-appwrite":{"method":"createWebhook","weight":120,"cookies":false,"type":"","demo":"projects\/create-webhook.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Webhook name. Max length: 128 chars.","default":null,"x-example":"[NAME]","x-class":null},"events":{"type":"array","description":"Events list.","default":null,"x-example":null,"x-class":null,"items":{"type":"string"}},"url":{"type":"string","description":"Webhook URL.","default":null,"x-example":"https:\/\/example.com","x-class":null},"security":{"type":"boolean","description":"Certificate verification, false for disabled or true for enabled.","default":null,"x-example":false,"x-class":null},"httpUser":{"type":"string","description":"Webhook HTTP user. Max length: 256 chars.","default":"","x-example":"[HTTP_USER]","x-class":null},"httpPass":{"type":"string","description":"Webhook HTTP password. Max length: 256 chars.","default":"","x-example":"[HTTP_PASS]","x-class":null}},"required":["name","events","url","security"]}}]}},"\/projects\/{projectId}\/webhooks\/{webhookId}":{"get":{"summary":"Get Webhook","operationId":"projectsGetWebhook","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Webhook","schema":{"$ref":"#\/definitions\/webhook"}}},"x-appwrite":{"method":"getWebhook","weight":122,"cookies":false,"type":"","demo":"projects\/get-webhook.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"webhookId","description":"Webhook unique ID.","required":true,"type":"string","x-example":"[WEBHOOK_ID]","in":"path"}]},"put":{"summary":"Update Webhook","operationId":"projectsUpdateWebhook","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Webhook","schema":{"$ref":"#\/definitions\/webhook"}}},"x-appwrite":{"method":"updateWebhook","weight":123,"cookies":false,"type":"","demo":"projects\/update-webhook.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"webhookId","description":"Webhook unique ID.","required":true,"type":"string","x-example":"[WEBHOOK_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Webhook name. Max length: 128 chars.","default":null,"x-example":"[NAME]","x-class":null},"events":{"type":"array","description":"Events list.","default":null,"x-example":null,"x-class":null,"items":{"type":"string"}},"url":{"type":"string","description":"Webhook URL.","default":null,"x-example":"https:\/\/example.com","x-class":null},"security":{"type":"boolean","description":"Certificate verification, false for disabled or true for enabled.","default":null,"x-example":false,"x-class":null},"httpUser":{"type":"string","description":"Webhook HTTP user. Max length: 256 chars.","default":"","x-example":"[HTTP_USER]","x-class":null},"httpPass":{"type":"string","description":"Webhook HTTP password. Max length: 256 chars.","default":"","x-example":"[HTTP_PASS]","x-class":null}},"required":["name","events","url","security"]}}]},"delete":{"summary":"Delete Webhook","operationId":"projectsDeleteWebhook","consumes":["application\/json"],"produces":[],"tags":["projects"],"description":"","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteWebhook","weight":124,"cookies":false,"type":"","demo":"projects\/delete-webhook.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"webhookId","description":"Webhook unique ID.","required":true,"type":"string","x-example":"[WEBHOOK_ID]","in":"path"}]}},"\/storage\/files":{"get":{"summary":"List Files","operationId":"storageListFiles","consumes":["application\/json"],"produces":["application\/json"],"tags":["storage"],"description":"Get a list of all the user files. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project's files. [Learn more about different API modes](\/docs\/admin).","responses":{"200":{"description":"Files List","schema":{"$ref":"#\/definitions\/fileList"}}},"x-appwrite":{"method":"listFiles","weight":141,"cookies":false,"type":"","demo":"storage\/list-files.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/list-files.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Results offset. The default value is 0. Use this param to manage pagination.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create File","operationId":"storageCreateFile","consumes":["multipart\/form-data"],"produces":["application\/json"],"tags":["storage"],"description":"Create a new file. The user who creates the file will automatically be assigned to read and write access unless he has passed custom values for read and write arguments.","responses":{"201":{"description":"File","schema":{"$ref":"#\/definitions\/file"}}},"x-appwrite":{"method":"createFile","weight":140,"cookies":false,"type":"upload","demo":"storage\/create-file.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/create-file.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"file","description":"Binary file.","required":true,"type":"file","in":"formData"},{"name":"read","description":"An array of strings with read permissions. By default only the current user is granted with read permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","required":false,"type":"array","collectionFormat":"multi","items":{"type":"string"},"in":"formData"},{"name":"write","description":"An array of strings with write permissions. By default only the current user is granted with write permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","required":false,"type":"array","collectionFormat":"multi","items":{"type":"string"},"in":"formData"}]}},"\/storage\/files\/{fileId}":{"get":{"summary":"Get File","operationId":"storageGetFile","consumes":["application\/json"],"produces":["application\/json"],"tags":["storage"],"description":"Get a file by its unique ID. This endpoint response returns a JSON object with the file metadata.","responses":{"200":{"description":"File","schema":{"$ref":"#\/definitions\/file"}}},"x-appwrite":{"method":"getFile","weight":142,"cookies":false,"type":"","demo":"storage\/get-file.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/get-file.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"fileId","description":"File unique ID.","required":true,"type":"string","x-example":"[FILE_ID]","in":"path"}]},"put":{"summary":"Update File","operationId":"storageUpdateFile","consumes":["application\/json"],"produces":["application\/json"],"tags":["storage"],"description":"Update a file by its unique ID. Only users with write permissions have access to update this resource.","responses":{"200":{"description":"File","schema":{"$ref":"#\/definitions\/file"}}},"x-appwrite":{"method":"updateFile","weight":146,"cookies":false,"type":"","demo":"storage\/update-file.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/update-file.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"fileId","description":"File unique ID.","required":true,"type":"string","x-example":"[FILE_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"read":{"type":"array","description":"An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"x-class":null,"items":{"type":"string"}},"write":{"type":"array","description":"An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"x-class":null,"items":{"type":"string"}}},"required":["read","write"]}}]},"delete":{"summary":"Delete File","operationId":"storageDeleteFile","consumes":["application\/json"],"produces":[],"tags":["storage"],"description":"Delete a file by its unique ID. Only users with write permissions have access to delete this resource.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteFile","weight":147,"cookies":false,"type":"","demo":"storage\/delete-file.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/delete-file.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"fileId","description":"File unique ID.","required":true,"type":"string","x-example":"[FILE_ID]","in":"path"}]}},"\/storage\/files\/{fileId}\/download":{"get":{"summary":"Get File for Download","operationId":"storageGetFileDownload","consumes":["application\/json"],"produces":["*\/*"],"tags":["storage"],"description":"Get a file content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory.","responses":{"200":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getFileDownload","weight":144,"cookies":false,"type":"location","demo":"storage\/get-file-download.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/get-file-download.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"fileId","description":"File unique ID.","required":true,"type":"string","x-example":"[FILE_ID]","in":"path"}]}},"\/storage\/files\/{fileId}\/preview":{"get":{"summary":"Get File Preview","operationId":"storageGetFilePreview","consumes":["application\/json"],"produces":["image\/*"],"tags":["storage"],"description":"Get a file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets, will return the file icon image. You can also pass query string arguments for cutting and resizing your preview image.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getFilePreview","weight":143,"cookies":false,"type":"location","demo":"storage\/get-file-preview.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/get-file-preview.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"fileId","description":"File unique ID","required":true,"type":"string","x-example":"[FILE_ID]","in":"path"},{"name":"width","description":"Resize preview image width, Pass an integer between 0 to 4000.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"height","description":"Resize preview image height, Pass an integer between 0 to 4000.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"gravity","description":"Image crop gravity. Can be one of center,top-left,top,top-right,left,right,bottom-left,bottom,bottom-right","required":false,"type":"string","x-example":"center","default":"center","in":"query"},{"name":"quality","description":"Preview image quality. Pass an integer between 0 to 100. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"borderWidth","description":"Preview image border in pixels. Pass an integer between 0 to 100. Defaults to 0.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"borderColor","description":"Preview image border color. Use a valid HEX color, no # is needed for prefix.","required":false,"type":"string","default":"","in":"query"},{"name":"borderRadius","description":"Preview image border radius in pixels. Pass an integer between 0 to 4000.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"opacity","description":"Preview image opacity. Only works with images having an alpha channel (like png). Pass a number between 0 to 1.","required":false,"type":"number","format":"float","x-example":0,"default":1,"in":"query"},{"name":"rotation","description":"Preview image rotation in degrees. Pass an integer between 0 and 360.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"background","description":"Preview image background color. Only works with transparent images (png). Use a valid HEX color, no # is needed for prefix.","required":false,"type":"string","default":"","in":"query"},{"name":"output","description":"Output format type (jpeg, jpg, png, gif and webp).","required":false,"type":"string","x-example":"jpg","default":"","in":"query"}]}},"\/storage\/files\/{fileId}\/view":{"get":{"summary":"Get File for View","operationId":"storageGetFileView","consumes":["application\/json"],"produces":["*\/*"],"tags":["storage"],"description":"Get a file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header.","responses":{"200":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getFileView","weight":145,"cookies":false,"type":"location","demo":"storage\/get-file-view.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/get-file-view.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"fileId","description":"File unique ID.","required":true,"type":"string","x-example":"[FILE_ID]","in":"path"}]}},"\/teams":{"get":{"summary":"List Teams","operationId":"teamsList","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Get a list of all the current user teams. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project's teams. [Learn more about different API modes](\/docs\/admin).","responses":{"200":{"description":"Teams List","schema":{"$ref":"#\/definitions\/teamList"}}},"x-appwrite":{"method":"list","weight":149,"cookies":false,"type":"","demo":"teams\/list.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/list-teams.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Results offset. The default value is 0. Use this param to manage pagination.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create Team","operationId":"teamsCreate","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Create a new team. The user who creates the team will automatically be assigned as the owner of the team. The team owner can invite new members, who will be able add new owners and update or delete the team from your project.","responses":{"201":{"description":"Team","schema":{"$ref":"#\/definitions\/team"}}},"x-appwrite":{"method":"create","weight":148,"cookies":false,"type":"","demo":"teams\/create.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/create-team.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Team name. Max length: 128 chars.","default":null,"x-example":"[NAME]","x-class":null},"roles":{"type":"array","description":"Array of strings. Use this param to set the roles in the team for the user who created it. The default role is **owner**. A role can be any string. Learn more about [roles and permissions](\/docs\/permissions). Max length for each role is 32 chars.","default":["owner"],"x-example":null,"x-class":null,"items":{"type":"string"}}},"required":["name"]}}]}},"\/teams\/{teamId}":{"get":{"summary":"Get Team","operationId":"teamsGet","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Get a team by its unique ID. All team members have read access for this resource.","responses":{"200":{"description":"Team","schema":{"$ref":"#\/definitions\/team"}}},"x-appwrite":{"method":"get","weight":150,"cookies":false,"type":"","demo":"teams\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/get-team.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team unique ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"}]},"put":{"summary":"Update Team","operationId":"teamsUpdate","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Update a team by its unique ID. Only team owners have write access for this resource.","responses":{"200":{"description":"Team","schema":{"$ref":"#\/definitions\/team"}}},"x-appwrite":{"method":"update","weight":151,"cookies":false,"type":"","demo":"teams\/update.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/update-team.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team unique ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Team name. Max length: 128 chars.","default":null,"x-example":"[NAME]","x-class":null}},"required":["name"]}}]},"delete":{"summary":"Delete Team","operationId":"teamsDelete","consumes":["application\/json"],"produces":[],"tags":["teams"],"description":"Delete a team by its unique ID. Only team owners have write access for this resource.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"delete","weight":152,"cookies":false,"type":"","demo":"teams\/delete.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/delete-team.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team unique ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"}]}},"\/teams\/{teamId}\/memberships":{"get":{"summary":"Get Team Memberships","operationId":"teamsGetMemberships","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Get a team members by the team unique ID. All team members have read access for this list of resources.","responses":{"200":{"description":"Memberships List","schema":{"$ref":"#\/definitions\/membershipList"}}},"x-appwrite":{"method":"getMemberships","weight":154,"cookies":false,"type":"","demo":"teams\/get-memberships.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/get-team-members.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team unique ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"},{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Results offset. The default value is 0. Use this param to manage pagination.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create Team Membership","operationId":"teamsCreateMembership","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Use this endpoint to invite a new member to join your team. If initiated from Client SDK, an email with a link to join the team will be sent to the new member's email address if the member doesn't exist in the project it will be created automatically. If initiated from server side SDKs, new member will automatically be added to the team.\n\nUse the 'URL' parameter to redirect the user from the invitation email back to your app. When the user is redirected, use the [Update Team Membership Status](\/docs\/client\/teams#teamsUpdateMembershipStatus) endpoint to allow the user to accept the invitation to the team. While calling from side SDKs the redirect url can be empty string.\n\nPlease note that in order to avoid a [Redirect Attacks](https:\/\/github.com\/OWASP\/CheatSheetSeries\/blob\/master\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URL's are the once from domains you have set when added your platforms in the console interface.","responses":{"201":{"description":"Membership","schema":{"$ref":"#\/definitions\/membership"}}},"x-appwrite":{"method":"createMembership","weight":153,"cookies":false,"type":"","demo":"teams\/create-membership.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/create-team-membership.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team unique ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"email":{"type":"string","description":"New team member email.","default":null,"x-example":"email@example.com","x-class":null},"name":{"type":"string","description":"New team member name. Max length: 128 chars.","default":"","x-example":"[NAME]","x-class":null},"roles":{"type":"array","description":"Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](\/docs\/permissions). Max length for each role is 32 chars.","default":null,"x-example":null,"x-class":null,"items":{"type":"string"}},"url":{"type":"string","description":"URL to redirect the user back to your app from the invitation email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.","default":null,"x-example":"https:\/\/example.com","x-class":null}},"required":["email","roles","url"]}}]}},"\/teams\/{teamId}\/memberships\/{membershipId}":{"patch":{"summary":"Update Membership Roles","operationId":"teamsUpdateMembershipRoles","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"","responses":{"200":{"description":"Membership","schema":{"$ref":"#\/definitions\/membership"}}},"x-appwrite":{"method":"updateMembershipRoles","weight":155,"cookies":false,"type":"","demo":"teams\/update-membership-roles.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/update-team-membership-roles.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team unique ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"},{"name":"membershipId","description":"Membership ID.","required":true,"type":"string","x-example":"[MEMBERSHIP_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"roles":{"type":"array","description":"Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](\/docs\/permissions). Max length for each role is 32 chars.","default":null,"x-example":null,"x-class":null,"items":{"type":"string"}}},"required":["roles"]}}]},"delete":{"summary":"Delete Team Membership","operationId":"teamsDeleteMembership","consumes":["application\/json"],"produces":[],"tags":["teams"],"description":"This endpoint allows a user to leave a team or for a team owner to delete the membership of any other team member. You can also use this endpoint to delete a user membership even if it is not accepted.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteMembership","weight":157,"cookies":false,"type":"","demo":"teams\/delete-membership.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/delete-team-membership.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team unique ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"},{"name":"membershipId","description":"Membership ID.","required":true,"type":"string","x-example":"[MEMBERSHIP_ID]","in":"path"}]}},"\/teams\/{teamId}\/memberships\/{membershipId}\/status":{"patch":{"summary":"Update Team Membership Status","operationId":"teamsUpdateMembershipStatus","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Use this endpoint to allow a user to accept an invitation to join a team after being redirected back to your app from the invitation email recieved by the user.","responses":{"200":{"description":"Membership","schema":{"$ref":"#\/definitions\/membership"}}},"x-appwrite":{"method":"updateMembershipStatus","weight":156,"cookies":false,"type":"","demo":"teams\/update-membership-status.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/update-team-membership-status.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"public","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team unique ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"},{"name":"membershipId","description":"Membership ID.","required":true,"type":"string","x-example":"[MEMBERSHIP_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"userId":{"type":"string","description":"User unique ID.","default":null,"x-example":"[USER_ID]","x-class":null},"secret":{"type":"string","description":"Secret key.","default":null,"x-example":"[SECRET]","x-class":null}},"required":["userId","secret"]}}]}},"\/users":{"get":{"summary":"List Users","operationId":"usersList","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Get a list of all the project's users. You can use the query params to filter your results.","responses":{"200":{"description":"Users List","schema":{"$ref":"#\/definitions\/userList"}}},"x-appwrite":{"method":"list","weight":159,"cookies":false,"type":"","demo":"users\/list.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/list-users.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Results offset. The default value is 0. Use this param to manage pagination.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create User","operationId":"usersCreate","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Create a new user.","responses":{"201":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"create","weight":158,"cookies":false,"type":"","demo":"users\/create.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/create-user.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"email":{"type":"string","description":"User email.","default":null,"x-example":"email@example.com","x-class":null},"password":{"type":"string","description":"User password. Must be between 6 to 32 chars.","default":null,"x-example":"password","x-class":null},"name":{"type":"string","description":"User name. Max length: 128 chars.","default":"","x-example":"[NAME]","x-class":null}},"required":["email","password"]}}]}},"\/users\/{userId}":{"get":{"summary":"Get User","operationId":"usersGet","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Get a user by its unique ID.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"get","weight":160,"cookies":false,"type":"","demo":"users\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/get-user.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"}]},"delete":{"summary":"Delete User","operationId":"usersDelete","consumes":["application\/json"],"produces":[],"tags":["users"],"description":"Delete a user by its unique ID.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"delete","weight":169,"cookies":false,"type":"","demo":"users\/delete.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/delete.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"}]}},"\/users\/{userId}\/logs":{"get":{"summary":"Get User Logs","operationId":"usersGetLogs","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Get a user activity logs list by its unique ID.","responses":{"200":{"description":"Logs List","schema":{"$ref":"#\/definitions\/logList"}}},"x-appwrite":{"method":"getLogs","weight":163,"cookies":false,"type":"","demo":"users\/get-logs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/get-user-logs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"}]}},"\/users\/{userId}\/prefs":{"get":{"summary":"Get User Preferences","operationId":"usersGetPrefs","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Get the user preferences by its unique ID.","responses":{"200":{"description":"Preferences","schema":{"$ref":"#\/definitions\/preferences"}}},"x-appwrite":{"method":"getPrefs","weight":161,"cookies":false,"type":"","demo":"users\/get-prefs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/get-user-prefs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"}]},"patch":{"summary":"Update User Preferences","operationId":"usersUpdatePrefs","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Update the user preferences by its unique ID. You can pass only the specific settings you wish to update.","responses":{"200":{"description":"Preferences","schema":{"$ref":"#\/definitions\/preferences"}}},"x-appwrite":{"method":"updatePrefs","weight":166,"cookies":false,"type":"","demo":"users\/update-prefs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/update-user-prefs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"prefs":{"type":"object","description":"Prefs key-value JSON object.","default":null,"x-example":"{}","x-class":null}},"required":["prefs"]}}]}},"\/users\/{userId}\/sessions":{"get":{"summary":"Get User Sessions","operationId":"usersGetSessions","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Get the user sessions list by its unique ID.","responses":{"200":{"description":"Sessions List","schema":{"$ref":"#\/definitions\/sessionList"}}},"x-appwrite":{"method":"getSessions","weight":162,"cookies":false,"type":"","demo":"users\/get-sessions.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/get-user-sessions.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"}]},"delete":{"summary":"Delete User Sessions","operationId":"usersDeleteSessions","consumes":["application\/json"],"produces":[],"tags":["users"],"description":"Delete all user's sessions by using the user's unique ID.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteSessions","weight":168,"cookies":false,"type":"","demo":"users\/delete-sessions.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/delete-user-sessions.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"}]}},"\/users\/{userId}\/sessions\/{sessionId}":{"delete":{"summary":"Delete User Session","operationId":"usersDeleteSession","consumes":["application\/json"],"produces":[],"tags":["users"],"description":"Delete a user sessions by its unique ID.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteSession","weight":167,"cookies":false,"type":"","demo":"users\/delete-session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/delete-user-session.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"},{"name":"sessionId","description":"User unique session ID.","required":true,"type":"string","x-example":"[SESSION_ID]","in":"path"}]}},"\/users\/{userId}\/status":{"patch":{"summary":"Update User Status","operationId":"usersUpdateStatus","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Update the user status by its unique ID.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updateStatus","weight":164,"cookies":false,"type":"","demo":"users\/update-status.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/update-user-status.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"status":{"type":"boolean","description":"User Status. To activate the user pass `true` and to block the user pass `false`","default":null,"x-example":false,"x-class":null}},"required":["status"]}}]}},"\/users\/{userId}\/verification":{"patch":{"summary":"Update Email Verification","operationId":"usersUpdateVerification","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Update the user email verification status by its unique ID.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updateVerification","weight":165,"cookies":false,"type":"","demo":"users\/update-verification.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/update-user-verification.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"emailVerification":{"type":"boolean","description":"User Email Verification Status.","default":null,"x-example":false,"x-class":null}},"required":["emailVerification"]}}]}}},"tags":[{"name":"account","description":"The Account service allows you to authenticate and manage a user account."},{"name":"avatars","description":"The Avatars service aims to help you complete everyday tasks related to your app image, icons, and avatars."},{"name":"database","description":"The Database service allows you to create structured collections of documents, query and filter lists of documents"},{"name":"locale","description":"The Locale service allows you to customize your app based on your users' location."},{"name":"health","description":"The Health service allows you to both validate and monitor your Appwrite server's health."},{"name":"projects","description":"The Project service allows you to manage all the projects in your Appwrite server."},{"name":"storage","description":"The Storage service allows you to manage your project files."},{"name":"teams","description":"The Teams service allows you to group users of your project and to enable them to share read and write access to your project resources"},{"name":"users","description":"The Users service allows you to manage your project users."},{"name":"functions","description":"The Functions Service allows you view, create and manage your Cloud Functions."}],"definitions":{"collectionList":{"description":"Collections List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"collections":{"type":"array","description":"List of collections.","items":{"type":"object","$ref":"#\/definitions\/collection"},"x-example":""}},"required":["sum","collections"]},"attributeList":{"description":"Attributes List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"attributes":{"type":"array","description":"List of attributes.","items":{"type":"object","$ref":"#\/definitions\/attribute"},"x-example":""}},"required":["sum","attributes"]},"indexList":{"description":"Indexes List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"indexes":{"type":"array","description":"List of indexes.","items":{"type":"object","$ref":"#\/definitions\/index"},"x-example":""}},"required":["sum","indexes"]},"documentList":{"description":"Documents List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"documents":{"type":"array","description":"List of documents.","items":{"type":"object","$ref":"#\/definitions\/document"},"x-example":""}},"required":["sum","documents"]},"userList":{"description":"Users List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"users":{"type":"array","description":"List of users.","items":{"type":"object","$ref":"#\/definitions\/user"},"x-example":""}},"required":["sum","users"]},"sessionList":{"description":"Sessions List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"sessions":{"type":"array","description":"List of sessions.","items":{"type":"object","$ref":"#\/definitions\/session"},"x-example":""}},"required":["sum","sessions"]},"logList":{"description":"Logs List","type":"object","properties":{"logs":{"type":"array","description":"List of logs.","items":{"type":"object","$ref":"#\/definitions\/log"},"x-example":""}},"required":["logs"]},"fileList":{"description":"Files List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"files":{"type":"array","description":"List of files.","items":{"type":"object","$ref":"#\/definitions\/file"},"x-example":""}},"required":["sum","files"]},"teamList":{"description":"Teams List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"teams":{"type":"array","description":"List of teams.","items":{"type":"object","$ref":"#\/definitions\/team"},"x-example":""}},"required":["sum","teams"]},"membershipList":{"description":"Memberships List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"memberships":{"type":"array","description":"List of memberships.","items":{"type":"object","$ref":"#\/definitions\/membership"},"x-example":""}},"required":["sum","memberships"]},"functionList":{"description":"Functions List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"functions":{"type":"array","description":"List of functions.","items":{"type":"object","$ref":"#\/definitions\/function"},"x-example":""}},"required":["sum","functions"]},"tagList":{"description":"Tags List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"tags":{"type":"array","description":"List of tags.","items":{"type":"object","$ref":"#\/definitions\/tag"},"x-example":""}},"required":["sum","tags"]},"executionList":{"description":"Executions List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"executions":{"type":"array","description":"List of executions.","items":{"type":"object","$ref":"#\/definitions\/execution"},"x-example":""}},"required":["sum","executions"]},"projectList":{"description":"Projects List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"projects":{"type":"array","description":"List of projects.","items":{"type":"object","$ref":"#\/definitions\/project"},"x-example":""}},"required":["sum","projects"]},"webhookList":{"description":"Webhooks List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"webhooks":{"type":"array","description":"List of webhooks.","items":{"type":"object","$ref":"#\/definitions\/webhook"},"x-example":""}},"required":["sum","webhooks"]},"keyList":{"description":"API Keys List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"keys":{"type":"array","description":"List of keys.","items":{"type":"object","$ref":"#\/definitions\/key"},"x-example":""}},"required":["sum","keys"]},"platformList":{"description":"Platforms List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"platforms":{"type":"array","description":"List of platforms.","items":{"type":"object","$ref":"#\/definitions\/platform"},"x-example":""}},"required":["sum","platforms"]},"domainList":{"description":"Domains List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"domains":{"type":"array","description":"List of domains.","items":{"type":"object","$ref":"#\/definitions\/domain"},"x-example":""}},"required":["sum","domains"]},"countryList":{"description":"Countries List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"countries":{"type":"array","description":"List of countries.","items":{"type":"object","$ref":"#\/definitions\/country"},"x-example":""}},"required":["sum","countries"]},"continentList":{"description":"Continents List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"continents":{"type":"array","description":"List of continents.","items":{"type":"object","$ref":"#\/definitions\/continent"},"x-example":""}},"required":["sum","continents"]},"languageList":{"description":"Languages List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"languages":{"type":"array","description":"List of languages.","items":{"type":"object","$ref":"#\/definitions\/language"},"x-example":""}},"required":["sum","languages"]},"currencyList":{"description":"Currencies List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"currencies":{"type":"array","description":"List of currencies.","items":{"type":"object","$ref":"#\/definitions\/currency"},"x-example":""}},"required":["sum","currencies"]},"phoneList":{"description":"Phones List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"phones":{"type":"array","description":"List of phones.","items":{"type":"object","$ref":"#\/definitions\/phone"},"x-example":""}},"required":["sum","phones"]},"collection":{"description":"Collection","type":"object","properties":{"$id":{"type":"string","description":"Collection ID.","x-example":"5e5ea5c16897e"},"$read":{"type":"array","description":"Collection read permissions.","items":{"type":"string"},"x-example":"role:all"},"$write":{"type":"array","description":"Collection write permissions.","items":{"type":"string"},"x-example":"user:608f9da25e7e1"},"name":{"type":"string","description":"Collection name.","x-example":""},"attributes":{"type":"array","description":"Collection attributes.","items":{"type":"object","$ref":"#\/definitions\/attribute"},"x-example":{}},"indexes":{"type":"array","description":"Collection indexes.","items":{"type":"object","$ref":"#\/definitions\/index"},"x-example":{}},"attributesInQueue":{"type":"array","description":"Collection attributes in creation queue.","items":{"type":"object","$ref":"#\/definitions\/attribute"},"x-example":{}},"indexesInQueue":{"type":"array","description":"Collection indexes in creation queue.","items":{"type":"object","$ref":"#\/definitions\/index"},"x-example":{}}},"required":["$id","$read","$write","name","attributes","indexes","attributesInQueue","indexesInQueue"]},"attribute":{"description":"Attribute","type":"object","properties":{"$collection":{"type":"string","description":"Collection ID.","x-example":"5e5ea5c16d55"},"$id":{"type":"string","description":"Attribute ID.","x-example":"60ccf71b98a2d"},"type":{"type":"string","description":"Attribute type.","x-example":"string"},"size":{"type":"string","description":"Attribute size.","x-example":128},"required":{"type":"boolean","description":"Is attribute required?","x-example":true},"signed":{"type":"boolean","description":"Is attribute signed?","x-example":true},"array":{"type":"boolean","description":"Is attribute an array?","x-example":false},"filters":{"type":"array","description":"Attribute filters.","items":{"type":"string"},"x-example":[]}},"required":["$collection","$id","type","size","required","signed","array","filters"]},"index":{"description":"Index","type":"object","properties":{"$collection":{"type":"string","description":"Collection ID.","x-example":"5e5ea5c16d55"},"$id":{"type":"string","description":"Index ID.","x-example":""},"type":{"type":"string","description":"Index type.","x-example":""},"attributes":{"type":"array","description":"Index attributes.","items":{"type":"string"},"x-example":[]},"lengths":{"type":"array","description":"Index lengths.","items":{"type":"string"},"x-example":[]},"orders":{"type":"array","description":"Index orders.","items":{"type":"string"},"x-example":[]}},"required":["$collection","$id","type","attributes","lengths","orders"]},"document":{"description":"Document","type":"object","properties":{"$id":{"type":"string","description":"Document ID.","x-example":"5e5ea5c16897e"},"$collection":{"type":"string","description":"Collection ID.","x-example":"5e5ea5c15117e"},"$read":{"type":"array","description":"Document read permissions.","items":{"type":"string"},"x-example":"role:all"},"$write":{"type":"array","description":"Document write permissions.","items":{"type":"string"},"x-example":"user:608f9da25e7e1"}},"additionalProperties":true,"required":["$id","$collection","$read","$write"]},"log":{"description":"Log","type":"object","properties":{"event":{"type":"string","description":"Event name.","x-example":"account.sessions.create"},"ip":{"type":"string","description":"IP session in use when the session was created.","x-example":"127.0.0.1"},"time":{"type":"integer","description":"Log creation time in Unix timestamp.","x-example":1592981250,"format":"int32"},"osCode":{"type":"string","description":"Operating system code name. View list of [available options](https:\/\/github.com\/appwrite\/appwrite\/blob\/master\/docs\/lists\/os.json).","x-example":"Mac"},"osName":{"type":"string","description":"Operating system name.","x-example":"Mac"},"osVersion":{"type":"string","description":"Operating system version.","x-example":"Mac"},"clientType":{"type":"string","description":"Client type.","x-example":"browser"},"clientCode":{"type":"string","description":"Client code name. View list of [available options](https:\/\/github.com\/appwrite\/appwrite\/blob\/master\/docs\/lists\/clients.json).","x-example":"CM"},"clientName":{"type":"string","description":"Client name.","x-example":"Chrome Mobile iOS"},"clientVersion":{"type":"string","description":"Client version.","x-example":"84.0"},"clientEngine":{"type":"string","description":"Client engine name.","x-example":"WebKit"},"clientEngineVersion":{"type":"string","description":"Client engine name.","x-example":"605.1.15"},"deviceName":{"type":"string","description":"Device name.","x-example":"smartphone"},"deviceBrand":{"type":"string","description":"Device brand name.","x-example":"Google"},"deviceModel":{"type":"string","description":"Device model name.","x-example":"Nexus 5"},"countryCode":{"type":"string","description":"Country two-character ISO 3166-1 alpha code.","x-example":"US"},"countryName":{"type":"string","description":"Country name.","x-example":"United States"}},"required":["event","ip","time","osCode","osName","osVersion","clientType","clientCode","clientName","clientVersion","clientEngine","clientEngineVersion","deviceName","deviceBrand","deviceModel","countryCode","countryName"]},"user":{"description":"User","type":"object","properties":{"$id":{"type":"string","description":"User ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"User name.","x-example":"John Doe"},"registration":{"type":"integer","description":"User registration date in Unix timestamp.","x-example":1592981250,"format":"int32"},"status":{"type":"boolean","description":"User status. Pass `true` for enabled and `false` for disabled.","x-example":true},"passwordUpdate":{"type":"integer","description":"Unix timestamp of the most recent password update","x-example":1592981250,"format":"int32"},"email":{"type":"string","description":"User email address.","x-example":"john@appwrite.io"},"emailVerification":{"type":"boolean","description":"Email verification status.","x-example":true},"prefs":{"type":"object","description":"User preferences as a key-value object","x-example":{"theme":"pink","timezone":"UTC"},"items":{"type":"object","$ref":"#\/definitions\/preferences"}}},"required":["$id","name","registration","status","passwordUpdate","email","emailVerification","prefs"]},"preferences":{"description":"Preferences","type":"object","additionalProperties":true},"session":{"description":"Session","type":"object","properties":{"$id":{"type":"string","description":"Session ID.","x-example":"5e5ea5c16897e"},"userId":{"type":"string","description":"User ID.","x-example":"5e5bb8c16897e"},"expire":{"type":"integer","description":"Session expiration date in Unix timestamp.","x-example":1592981250,"format":"int32"},"provider":{"type":"string","description":"Session Provider.","x-example":"email"},"providerUid":{"type":"string","description":"Session Provider User ID.","x-example":"user@example.com"},"providerToken":{"type":"string","description":"Session Provider Token.","x-example":"MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3"},"ip":{"type":"string","description":"IP in use when the session was created.","x-example":"127.0.0.1"},"osCode":{"type":"string","description":"Operating system code name. View list of [available options](https:\/\/github.com\/appwrite\/appwrite\/blob\/master\/docs\/lists\/os.json).","x-example":"Mac"},"osName":{"type":"string","description":"Operating system name.","x-example":"Mac"},"osVersion":{"type":"string","description":"Operating system version.","x-example":"Mac"},"clientType":{"type":"string","description":"Client type.","x-example":"browser"},"clientCode":{"type":"string","description":"Client code name. View list of [available options](https:\/\/github.com\/appwrite\/appwrite\/blob\/master\/docs\/lists\/clients.json).","x-example":"CM"},"clientName":{"type":"string","description":"Client name.","x-example":"Chrome Mobile iOS"},"clientVersion":{"type":"string","description":"Client version.","x-example":"84.0"},"clientEngine":{"type":"string","description":"Client engine name.","x-example":"WebKit"},"clientEngineVersion":{"type":"string","description":"Client engine name.","x-example":"605.1.15"},"deviceName":{"type":"string","description":"Device name.","x-example":"smartphone"},"deviceBrand":{"type":"string","description":"Device brand name.","x-example":"Google"},"deviceModel":{"type":"string","description":"Device model name.","x-example":"Nexus 5"},"countryCode":{"type":"string","description":"Country two-character ISO 3166-1 alpha code.","x-example":"US"},"countryName":{"type":"string","description":"Country name.","x-example":"United States"},"current":{"type":"boolean","description":"Returns true if this the current user session.","x-example":true}},"required":["$id","userId","expire","provider","providerUid","providerToken","ip","osCode","osName","osVersion","clientType","clientCode","clientName","clientVersion","clientEngine","clientEngineVersion","deviceName","deviceBrand","deviceModel","countryCode","countryName","current"]},"token":{"description":"Token","type":"object","properties":{"$id":{"type":"string","description":"Token ID.","x-example":"bb8ea5c16897e"},"userId":{"type":"string","description":"User ID.","x-example":"5e5ea5c168bb8"},"secret":{"type":"string","description":"Token secret key. This will return an empty string unless the response is returned using an API key or as part of a webhook payload.","x-example":""},"expire":{"type":"integer","description":"Token expiration date in Unix timestamp.","x-example":1592981250,"format":"int32"}},"required":["$id","userId","secret","expire"]},"jwt":{"description":"JWT","type":"object","properties":{"jwt":{"type":"string","description":"JWT encoded string.","x-example":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"}},"required":["jwt"]},"locale":{"description":"Locale","type":"object","properties":{"ip":{"type":"string","description":"User IP address.","x-example":"127.0.0.1"},"countryCode":{"type":"string","description":"Country code in [ISO 3166-1](http:\/\/en.wikipedia.org\/wiki\/ISO_3166-1) two-character format","x-example":"US"},"country":{"type":"string","description":"Country name. This field support localization.","x-example":"United States"},"continentCode":{"type":"string","description":"Continent code. A two character continent code \"AF\" for Africa, \"AN\" for Antarctica, \"AS\" for Asia, \"EU\" for Europe, \"NA\" for North America, \"OC\" for Oceania, and \"SA\" for South America.","x-example":"NA"},"continent":{"type":"string","description":"Continent name. This field support localization.","x-example":"North America"},"eu":{"type":"boolean","description":"True if country is part of the Europian Union.","x-example":false},"currency":{"type":"string","description":"Currency code in [ISO 4217-1](http:\/\/en.wikipedia.org\/wiki\/ISO_4217) three-character format","x-example":"USD"}},"required":["ip","countryCode","country","continentCode","continent","eu","currency"]},"file":{"description":"File","type":"object","properties":{"$id":{"type":"string","description":"File ID.","x-example":"5e5ea5c16897e"},"$read":{"type":"array","description":"File read permissions.","items":{"type":"string"},"x-example":"role:all"},"$write":{"type":"array","description":"File write permissions.","items":{"type":"string"},"x-example":"user:608f9da25e7e1"},"name":{"type":"string","description":"File name.","x-example":"Pink.png"},"dateCreated":{"type":"integer","description":"File creation date in Unix timestamp.","x-example":1592981250,"format":"int32"},"signature":{"type":"string","description":"File MD5 signature.","x-example":"5d529fd02b544198ae075bd57c1762bb"},"mimeType":{"type":"string","description":"File mime type.","x-example":"image\/png"},"sizeOriginal":{"type":"integer","description":"File original size in bytes.","x-example":17890,"format":"int32"}},"required":["$id","$read","$write","name","dateCreated","signature","mimeType","sizeOriginal"]},"team":{"description":"Team","type":"object","properties":{"$id":{"type":"string","description":"Team ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"Team name.","x-example":"VIP"},"dateCreated":{"type":"integer","description":"Team creation date in Unix timestamp.","x-example":1592981250,"format":"int32"},"sum":{"type":"integer","description":"Total sum of team members.","x-example":7,"format":"int32"}},"required":["$id","name","dateCreated","sum"]},"membership":{"description":"Membership","type":"object","properties":{"$id":{"type":"string","description":"Membership ID.","x-example":"5e5ea5c16897e"},"userId":{"type":"string","description":"User ID.","x-example":"5e5ea5c16897e"},"teamId":{"type":"string","description":"Team ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"User name.","x-example":"VIP"},"email":{"type":"string","description":"User email address.","x-example":"john@appwrite.io"},"invited":{"type":"integer","description":"Date, the user has been invited to join the team in Unix timestamp.","x-example":1592981250,"format":"int32"},"joined":{"type":"integer","description":"Date, the user has accepted the invitation to join the team in Unix timestamp.","x-example":1592981250,"format":"int32"},"confirm":{"type":"boolean","description":"User confirmation status, true if the user has joined the team or false otherwise.","x-example":false},"roles":{"type":"array","description":"User list of roles","items":{"type":"string"},"x-example":"admin"}},"required":["$id","userId","teamId","name","email","invited","joined","confirm","roles"]},"function":{"description":"Function","type":"object","properties":{"$id":{"type":"string","description":"Function ID.","x-example":"5e5ea5c16897e"},"$permissions":{"type":"object","description":"Function permissions.","x-example":{},"items":{"type":"object","$ref":"#\/definitions\/permissions"}},"name":{"type":"string","description":"Function name.","x-example":"My Function"},"dateCreated":{"type":"integer","description":"Function creation date in Unix timestamp.","x-example":1592981250,"format":"int32"},"dateUpdated":{"type":"integer","description":"Function update date in Unix timestamp.","x-example":1592981257,"format":"int32"},"status":{"type":"string","description":"Function status. Possible values: disabled, enabled","x-example":"enabled"},"runtime":{"type":"string","description":"Function execution runtime.","x-example":"python-3.8"},"tag":{"type":"string","description":"Function active tag ID.","x-example":"5e5ea5c16897e"},"vars":{"type":"string","description":"Function environment variables.","x-example":{"key":"value"}},"events":{"type":"array","description":"Function trigger events.","items":{"type":"string"},"x-example":"account.create"},"schedule":{"type":"string","description":"Function execution schedult in CRON format.","x-example":"5 4 * * *"},"scheduleNext":{"type":"integer","description":"Function next scheduled execution date in Unix timestamp.","x-example":1592981292,"format":"int32"},"schedulePrevious":{"type":"integer","description":"Function next scheduled execution date in Unix timestamp.","x-example":1592981237,"format":"int32"},"timeout":{"type":"integer","description":"Function execution timeout in seconds.","x-example":1592981237,"format":"int32"}},"required":["$id","$permissions","name","dateCreated","dateUpdated","status","runtime","tag","vars","events","schedule","scheduleNext","schedulePrevious","timeout"]},"tag":{"description":"Tag","type":"object","properties":{"$id":{"type":"string","description":"Tag ID.","x-example":"5e5ea5c16897e"},"functionId":{"type":"string","description":"Function ID.","x-example":"5e5ea6g16897e"},"dateCreated":{"type":"integer","description":"The tag creation date in Unix timestamp.","x-example":1592981250,"format":"int32"},"command":{"type":"string","description":"The entrypoint command in use to execute the tag code.","x-example":"enabled"},"size":{"type":"string","description":"The code size in bytes.","x-example":"python-3.8"}},"required":["$id","functionId","dateCreated","command","size"]},"execution":{"description":"Execution","type":"object","properties":{"$id":{"type":"string","description":"Execution ID.","x-example":"5e5ea5c16897e"},"functionId":{"type":"string","description":"Function ID.","x-example":"5e5ea6g16897e"},"dateCreated":{"type":"integer","description":"The execution creation date in Unix timestamp.","x-example":1592981250,"format":"int32"},"trigger":{"type":"string","description":"The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`.","x-example":"http"},"status":{"type":"string","description":"The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`.","x-example":"processing"},"exitCode":{"type":"integer","description":"The script exit code.","x-example":0,"format":"int32"},"stdout":{"type":"string","description":"The script stdout output string. Logs the last 4,000 characters of the execution stdout output.","x-example":""},"stderr":{"type":"string","description":"The script stderr output string. Logs the last 4,000 characters of the execution stderr output","x-example":""},"time":{"type":"number","description":"The script execution time in seconds.","x-example":0.4,"format":"float"}},"required":["$id","functionId","dateCreated","trigger","status","exitCode","stdout","stderr","time"]},"project":{"description":"Project","type":"object","properties":{"$id":{"type":"string","description":"Project ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"Project name.","x-example":"New Project"},"description":{"type":"string","description":"Project description.","x-example":"This is a new project."},"teamId":{"type":"string","description":"Project team ID.","x-example":"1592981250"},"logo":{"type":"string","description":"Project logo file ID.","x-example":"5f5c451b403cb"},"url":{"type":"string","description":"Project website URL.","x-example":"5f5c451b403cb"},"legalName":{"type":"string","description":"Company legal name.","x-example":"Company LTD."},"legalCountry":{"type":"string","description":"Country code in [ISO 3166-1](http:\/\/en.wikipedia.org\/wiki\/ISO_3166-1) two-character format.","x-example":"US"},"legalState":{"type":"string","description":"State name.","x-example":"New York"},"legalCity":{"type":"string","description":"City name.","x-example":"New York City."},"legalAddress":{"type":"string","description":"Company Address.","x-example":"620 Eighth Avenue, New York, NY 10018"},"legalTaxId":{"type":"string","description":"Company Tax ID.","x-example":"131102020"},"usersAuthLimit":{"type":"integer","description":"Max users allowed. 0 is unlimited.","x-example":100,"format":"int32"},"platforms":{"type":"array","description":"List of Platforms.","items":{"type":"object","$ref":"#\/definitions\/platform"},"x-example":{}},"webhooks":{"type":"array","description":"List of Webhooks.","items":{"type":"object","$ref":"#\/definitions\/webhook"},"x-example":{}},"keys":{"type":"array","description":"List of API Keys.","items":{"type":"object","$ref":"#\/definitions\/key"},"x-example":{}},"domains":{"type":"array","description":"List of Domains.","items":{"type":"object","$ref":"#\/definitions\/domain"},"x-example":{}},"usersOauth2AmazonAppid":{"type":"string","description":"Amazon OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2AmazonSecret":{"type":"string","description":"Amazon OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2AppleAppid":{"type":"string","description":"Apple OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2AppleSecret":{"type":"string","description":"Apple OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2BitbucketAppid":{"type":"string","description":"BitBucket OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2BitbucketSecret":{"type":"string","description":"BitBucket OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2BitlyAppid":{"type":"string","description":"Bitly OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2BitlySecret":{"type":"string","description":"Bitly OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2BoxAppid":{"type":"string","description":"Box OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2BoxSecret":{"type":"string","description":"Box OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2DiscordAppid":{"type":"string","description":"Discord OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2DiscordSecret":{"type":"string","description":"Discord OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2DropboxAppid":{"type":"string","description":"Dropbox OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2DropboxSecret":{"type":"string","description":"Dropbox OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2FacebookAppid":{"type":"string","description":"Facebook OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2FacebookSecret":{"type":"string","description":"Facebook OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2GithubAppid":{"type":"string","description":"GitHub OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2GithubSecret":{"type":"string","description":"GitHub OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2GitlabAppid":{"type":"string","description":"GitLab OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2GitlabSecret":{"type":"string","description":"GitLab OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2GoogleAppid":{"type":"string","description":"Google OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2GoogleSecret":{"type":"string","description":"Google OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2LinkedinAppid":{"type":"string","description":"LinkedIn OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2LinkedinSecret":{"type":"string","description":"LinkedIn OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2MicrosoftAppid":{"type":"string","description":"Microsoft OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2MicrosoftSecret":{"type":"string","description":"Microsoft OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2PaypalAppid":{"type":"string","description":"PayPal OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2PaypalSecret":{"type":"string","description":"PayPal OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2PaypalSandboxAppid":{"type":"string","description":"PayPal OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2PaypalSandboxSecret":{"type":"string","description":"PayPal OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2SalesforceAppid":{"type":"string","description":"Salesforce OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2SalesforceSecret":{"type":"string","description":"Salesforce OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2SlackAppid":{"type":"string","description":"Slack OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2SlackSecret":{"type":"string","description":"Slack OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2SpotifyAppid":{"type":"string","description":"Spotify OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2SpotifySecret":{"type":"string","description":"Spotify OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2TradeshiftAppid":{"type":"string","description":"Tradeshift OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2TradeshiftSecret":{"type":"string","description":"Tradeshift OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2TradeshiftBoxAppid":{"type":"string","description":"Tradeshift OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2TradeshiftBoxSecret":{"type":"string","description":"Tradeshift OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2TwitchAppid":{"type":"string","description":"Twitch OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2TwitchSecret":{"type":"string","description":"Twitch OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2VkAppid":{"type":"string","description":"VK OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2VkSecret":{"type":"string","description":"VK OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2YahooAppid":{"type":"string","description":"Yahoo OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2YahooSecret":{"type":"string","description":"Yahoo OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2YandexAppid":{"type":"string","description":"Yandex OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2YandexSecret":{"type":"string","description":"Yandex OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2WordpressAppid":{"type":"string","description":"WordPress OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2WordpressSecret":{"type":"string","description":"WordPress OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2MockAppid":{"type":"string","description":"Mock OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2MockSecret":{"type":"string","description":"Mock OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersAuthEmailPassword":{"type":"boolean","description":"Email\/Password auth method status","x-example":true},"usersAuthAnonymous":{"type":"boolean","description":"Anonymous auth method status","x-example":true},"usersAuthInvites":{"type":"boolean","description":"Invites auth method status","x-example":true},"usersAuthJWT":{"type":"boolean","description":"JWT auth method status","x-example":true},"usersAuthPhone":{"type":"boolean","description":"Phone auth method status","x-example":true},"serviceStatusForAccount":{"type":"boolean","description":"Account service status","x-example":true},"serviceStatusForAvatars":{"type":"boolean","description":"Avatars service status","x-example":true},"serviceStatusForDatabase":{"type":"boolean","description":"Database service status","x-example":true},"serviceStatusForLocale":{"type":"boolean","description":"Locale service status","x-example":true},"serviceStatusForHealth":{"type":"boolean","description":"Health service status","x-example":true},"serviceStatusForStorage":{"type":"boolean","description":"Storage service status","x-example":true},"serviceStatusForTeams":{"type":"boolean","description":"Teams service status","x-example":true},"serviceStatusForUsers":{"type":"boolean","description":"Users service status","x-example":true},"serviceStatusForFunctions":{"type":"boolean","description":"Functions service status","x-example":true}},"required":["$id","name","description","teamId","logo","url","legalName","legalCountry","legalState","legalCity","legalAddress","legalTaxId","usersAuthLimit","platforms","webhooks","keys","domains","usersOauth2AmazonAppid","usersOauth2AmazonSecret","usersOauth2AppleAppid","usersOauth2AppleSecret","usersOauth2BitbucketAppid","usersOauth2BitbucketSecret","usersOauth2BitlyAppid","usersOauth2BitlySecret","usersOauth2BoxAppid","usersOauth2BoxSecret","usersOauth2DiscordAppid","usersOauth2DiscordSecret","usersOauth2DropboxAppid","usersOauth2DropboxSecret","usersOauth2FacebookAppid","usersOauth2FacebookSecret","usersOauth2GithubAppid","usersOauth2GithubSecret","usersOauth2GitlabAppid","usersOauth2GitlabSecret","usersOauth2GoogleAppid","usersOauth2GoogleSecret","usersOauth2LinkedinAppid","usersOauth2LinkedinSecret","usersOauth2MicrosoftAppid","usersOauth2MicrosoftSecret","usersOauth2PaypalAppid","usersOauth2PaypalSecret","usersOauth2PaypalSandboxAppid","usersOauth2PaypalSandboxSecret","usersOauth2SalesforceAppid","usersOauth2SalesforceSecret","usersOauth2SlackAppid","usersOauth2SlackSecret","usersOauth2SpotifyAppid","usersOauth2SpotifySecret","usersOauth2TradeshiftAppid","usersOauth2TradeshiftSecret","usersOauth2TradeshiftBoxAppid","usersOauth2TradeshiftBoxSecret","usersOauth2TwitchAppid","usersOauth2TwitchSecret","usersOauth2VkAppid","usersOauth2VkSecret","usersOauth2YahooAppid","usersOauth2YahooSecret","usersOauth2YandexAppid","usersOauth2YandexSecret","usersOauth2WordpressAppid","usersOauth2WordpressSecret","usersOauth2MockAppid","usersOauth2MockSecret","usersAuthEmailPassword","usersAuthAnonymous","usersAuthInvites","usersAuthJWT","usersAuthPhone","serviceStatusForAccount","serviceStatusForAvatars","serviceStatusForDatabase","serviceStatusForLocale","serviceStatusForHealth","serviceStatusForStorage","serviceStatusForTeams","serviceStatusForUsers","serviceStatusForFunctions"]},"webhook":{"description":"Webhook","type":"object","properties":{"$id":{"type":"string","description":"Webhook ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"Webhook name.","x-example":"My Webhook"},"url":{"type":"string","description":"Webhook URL endpoint.","x-example":"https:\/\/example.com\/webhook"},"events":{"type":"array","description":"Webhook trigger events.","items":{"type":"string"},"x-example":"database.collections.update"},"security":{"type":"boolean","description":"Indicated if SSL \/ TLS Certificate verification is enabled.","x-example":true},"httpUser":{"type":"string","description":"HTTP basic authentication username.","x-example":"username"},"httpPass":{"type":"string","description":"HTTP basic authentication password.","x-example":"password"}},"required":["$id","name","url","events","security","httpUser","httpPass"]},"key":{"description":"Key","type":"object","properties":{"$id":{"type":"string","description":"Key ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"Key name.","x-example":"My API Key"},"scopes":{"type":"array","description":"Allowed permission scopes.","items":{"type":"string"},"x-example":"users.read"},"secret":{"type":"string","description":"Secret key.","x-example":"919c2d18fb5d4...a2ae413da83346ad2"}},"required":["$id","name","scopes","secret"]},"domain":{"description":"Domain","type":"object","properties":{"$id":{"type":"string","description":"Domain ID.","x-example":"5e5ea5c16897e"},"domain":{"type":"string","description":"Domain name.","x-example":"appwrite.company.com"},"registerable":{"type":"string","description":"Registerable domain name.","x-example":"company.com"},"tld":{"type":"string","description":"TLD name.","x-example":"com"},"verification":{"type":"boolean","description":"Verification process status.","x-example":true},"certificateId":{"type":"string","description":"Certificate ID.","x-example":"6ejea5c13377e"}},"required":["$id","domain","registerable","tld","verification","certificateId"]},"platform":{"description":"Platform","type":"object","properties":{"$id":{"type":"string","description":"Platform ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"Platform name.","x-example":"My Web App"},"type":{"type":"string","description":"Platform type. Possible values are: web, flutter-ios, flutter-android, ios, android, and unity.","x-example":"My Web App"},"key":{"type":"string","description":"Platform Key. iOS bundle ID or Android package name. Empty string for other platforms.","x-example":"com.company.appname"},"store":{"type":"string","description":"App store or Google Play store ID.","x-example":""},"hostname":{"type":"string","description":"Web app hostname. Empty string for other platforms.","x-example":true},"httpUser":{"type":"string","description":"HTTP basic authentication username.","x-example":"username"},"httpPass":{"type":"string","description":"HTTP basic authentication password.","x-example":"password"}},"required":["$id","name","type","key","store","hostname","httpUser","httpPass"]},"country":{"description":"Country","type":"object","properties":{"name":{"type":"string","description":"Country name.","x-example":"United States"},"code":{"type":"string","description":"Country two-character ISO 3166-1 alpha code.","x-example":"US"}},"required":["name","code"]},"continent":{"description":"Continent","type":"object","properties":{"name":{"type":"string","description":"Continent name.","x-example":"Europe"},"code":{"type":"string","description":"Continent two letter code.","x-example":"EU"}},"required":["name","code"]},"language":{"description":"Language","type":"object","properties":{"name":{"type":"string","description":"Language name.","x-example":"Italian"},"code":{"type":"string","description":"Language two-character ISO 639-1 codes.","x-example":"it"},"nativeName":{"type":"string","description":"Language native name.","x-example":"Italiano"}},"required":["name","code","nativeName"]},"currency":{"description":"Currency","type":"object","properties":{"symbol":{"type":"string","description":"Currency symbol.","x-example":"$"},"name":{"type":"string","description":"Currency name.","x-example":"US dollar"},"symbolNative":{"type":"string","description":"Currency native symbol.","x-example":"$"},"decimalDigits":{"type":"integer","description":"Number of decimal digits.","x-example":2,"format":"int32"},"rounding":{"type":"number","description":"Currency digit rounding.","x-example":0,"format":"float"},"code":{"type":"string","description":"Currency code in [ISO 4217-1](http:\/\/en.wikipedia.org\/wiki\/ISO_4217) three-character format.","x-example":"USD"},"namePlural":{"type":"string","description":"Currency plural name","x-example":"US dollars"}},"required":["symbol","name","symbolNative","decimalDigits","rounding","code","namePlural"]},"phone":{"description":"Phone","type":"object","properties":{"code":{"type":"string","description":"Phone code.","x-example":"+1"},"countryCode":{"type":"string","description":"Country two-character ISO 3166-1 alpha code.","x-example":"US"},"countryName":{"type":"string","description":"Country name.","x-example":"United States"}},"required":["code","countryCode","countryName"]}},"externalDocs":{"description":"Full API docs, specs and tutorials","url":"https:\/\/appwrite.io\/docs"}} diff --git a/specs/swagger-appwrite.0.11.0.json b/specs/swagger-appwrite.0.11.0.json deleted file mode 100644 index c2b1deee00..0000000000 --- a/specs/swagger-appwrite.0.11.0.json +++ /dev/null @@ -1 +0,0 @@ -{"swagger":"2.0","info":{"version":"0.11.0","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","contact":{"name":"Appwrite Team","url":"https:\/\/appwrite.io\/support","email":"team@appwrite.io"},"license":{"name":"BSD-3-Clause","url":"https:\/\/raw.githubusercontent.com\/appwrite\/appwrite\/master\/LICENSE"}},"host":"appwrite.io","basePath":"\/v1","schemes":["https"],"consumes":["application\/json","multipart\/form-data"],"produces":["application\/json"],"securityDefinitions":{"Project":{"type":"apiKey","name":"X-Appwrite-Project","description":"Your project ID","in":"header","x-appwrite":{"demo":"5df5acd0d48c2"}},"Key":{"type":"apiKey","name":"X-Appwrite-Key","description":"Your secret API key","in":"header","x-appwrite":{"demo":"919c2d18fb5d4...a2ae413da83346ad2"}},"JWT":{"type":"apiKey","name":"X-Appwrite-JWT","description":"Your secret JSON Web Token","in":"header","x-appwrite":{"demo":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ..."}},"Locale":{"type":"apiKey","name":"X-Appwrite-Locale","description":"","in":"header","x-appwrite":{"demo":"en"}},"Mode":{"type":"apiKey","name":"X-Appwrite-Mode","description":"","in":"header","x-appwrite":{"demo":""}}},"paths":{"\/account":{"get":{"summary":"Get Account","operationId":"accountGet","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Get currently logged in user data as JSON object.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"get","weight":47,"cookies":false,"type":"","demo":"account\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/get.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}]},"post":{"summary":"Create Account","operationId":"accountCreate","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to allow a new user to register a new account in your project. After the user registration completes successfully, you can use the [\/account\/verfication](\/docs\/client\/account#accountCreateVerification) route to start verifying the user email address. To allow the new user to login to their new account, you need to create a new [account session](\/docs\/client\/account#accountCreateSession).","responses":{"201":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"create","weight":37,"cookies":false,"type":"","demo":"account\/create.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"public","platforms":["client"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"email":{"type":"string","description":"User email.","default":null,"x-example":"email@example.com"},"password":{"type":"string","description":"User password. Must be between 6 to 32 chars.","default":null,"x-example":"password"},"name":{"type":"string","description":"User name. Max length: 128 chars.","default":"","x-example":"[NAME]"}},"required":["email","password"]}}]},"delete":{"summary":"Delete Account","operationId":"accountDelete","consumes":["application\/json"],"produces":[],"tags":["account"],"description":"Delete a currently logged in user account. Behind the scene, the user record is not deleted but permanently blocked from any access. This is done to avoid deleted accounts being overtaken by new users with the same email address. Any user-related resources like documents or storage files should be deleted separately.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"delete","weight":56,"cookies":false,"type":"","demo":"account\/delete.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/delete.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}]}},"\/account\/email":{"patch":{"summary":"Update Account Email","operationId":"accountUpdateEmail","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Update currently logged in user account email address. After changing user address, user confirmation status is being reset and a new confirmation mail is sent. For security measures, user password is required to complete this request.\nThis endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updateEmail","weight":54,"cookies":false,"type":"","demo":"account\/update-email.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-email.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"email":{"type":"string","description":"User email.","default":null,"x-example":"email@example.com"},"password":{"type":"string","description":"User password. Must be between 6 to 32 chars.","default":null,"x-example":"password"}},"required":["email","password"]}}]}},"\/account\/jwt":{"post":{"summary":"Create Account JWT","operationId":"accountCreateJWT","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to create a JSON Web Token. You can use the resulting JWT to authenticate on behalf of the current user when working with the Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes from its creation and will be invalid if the user will logout in that time frame.","responses":{"201":{"description":"JWT","schema":{"$ref":"#\/definitions\/jwt"}}},"x-appwrite":{"method":"createJWT","weight":46,"cookies":false,"type":"","demo":"account\/create-j-w-t.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create-jwt.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},userId:{userId}","scope":"account","platforms":["client"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}]}},"\/account\/logs":{"get":{"summary":"Get Account Logs","operationId":"accountGetLogs","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Get currently logged in user list of latest security activity logs. Each log returns user IP address, location and date and time of log.","responses":{"200":{"description":"Logs List","schema":{"$ref":"#\/definitions\/logList"}}},"x-appwrite":{"method":"getLogs","weight":50,"cookies":false,"type":"","demo":"account\/get-logs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/get-logs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}]}},"\/account\/name":{"patch":{"summary":"Update Account Name","operationId":"accountUpdateName","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Update currently logged in user account name.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updateName","weight":52,"cookies":false,"type":"","demo":"account\/update-name.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-name.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"User name. Max length: 128 chars.","default":null,"x-example":"[NAME]"}},"required":["name"]}}]}},"\/account\/password":{"patch":{"summary":"Update Account Password","operationId":"accountUpdatePassword","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Update currently logged in user password. For validation, user is required to pass in the new password, and the old password. For users created with OAuth and Team Invites, oldPassword is optional.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updatePassword","weight":53,"cookies":false,"type":"","demo":"account\/update-password.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-password.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"password":{"type":"string","description":"New user password. Must be between 6 to 32 chars.","default":null,"x-example":"password"},"oldPassword":{"type":"string","description":"Old user password. Must be between 6 to 32 chars.","default":"","x-example":"password"}},"required":["password"]}}]}},"\/account\/prefs":{"get":{"summary":"Get Account Preferences","operationId":"accountGetPrefs","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Get currently logged in user preferences as a key-value object.","responses":{"200":{"description":"Preferences","schema":{"$ref":"#\/definitions\/preferences"}}},"x-appwrite":{"method":"getPrefs","weight":48,"cookies":false,"type":"","demo":"account\/get-prefs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/get-prefs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}]},"patch":{"summary":"Update Account Preferences","operationId":"accountUpdatePrefs","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Update currently logged in user account preferences. You can pass only the specific settings you wish to update.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updatePrefs","weight":55,"cookies":false,"type":"","demo":"account\/update-prefs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-prefs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"prefs":{"type":"object","description":"Prefs key-value JSON object.","default":null,"x-example":"{}"}},"required":["prefs"]}}]}},"\/account\/recovery":{"post":{"summary":"Create Password Recovery","operationId":"accountCreateRecovery","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Sends the user an email with a temporary secret key for password reset. When the user clicks the confirmation link he is redirected back to your app password reset URL with the secret key and email address values attached to the URL query string. Use the query string params to submit a request to the [PUT \/account\/recovery](\/docs\/client\/account#accountUpdateRecovery) endpoint to complete the process. The verification link sent to the user's email address is valid for 1 hour.","responses":{"201":{"description":"Token","schema":{"$ref":"#\/definitions\/token"}}},"x-appwrite":{"method":"createRecovery","weight":59,"cookies":false,"type":"","demo":"account\/create-recovery.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create-recovery.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},email:{param-email}","scope":"public","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"email":{"type":"string","description":"User email.","default":null,"x-example":"email@example.com"},"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"}},"required":["email","url"]}}]},"put":{"summary":"Create Password Recovery (confirmation)","operationId":"accountUpdateRecovery","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to complete the user account password reset. Both the **userId** and **secret** arguments will be passed as query parameters to the redirect URL you have provided when sending your request to the [POST \/account\/recovery](\/docs\/client\/account#accountCreateRecovery) endpoint.\n\nPlease note that in order to avoid a [Redirect Attack](https:\/\/github.com\/OWASP\/CheatSheetSeries\/blob\/master\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.","responses":{"200":{"description":"Token","schema":{"$ref":"#\/definitions\/token"}}},"x-appwrite":{"method":"updateRecovery","weight":60,"cookies":false,"type":"","demo":"account\/update-recovery.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-recovery.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},userId:{param-userId}","scope":"public","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"userId":{"type":"string","description":"User account UID address.","default":null,"x-example":"[USER_ID]"},"secret":{"type":"string","description":"Valid reset token.","default":null,"x-example":"[SECRET]"},"password":{"type":"string","description":"New password. Must be between 6 to 32 chars.","default":null,"x-example":"password"},"passwordAgain":{"type":"string","description":"New password again. Must be between 6 to 32 chars.","default":null,"x-example":"password"}},"required":["userId","secret","password","passwordAgain"]}}]}},"\/account\/sessions":{"get":{"summary":"Get Account Sessions","operationId":"accountGetSessions","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Get currently logged in user list of active sessions across different devices.","responses":{"200":{"description":"Sessions List","schema":{"$ref":"#\/definitions\/sessionList"}}},"x-appwrite":{"method":"getSessions","weight":49,"cookies":false,"type":"","demo":"account\/get-sessions.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/get-sessions.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}]},"post":{"summary":"Create Account Session","operationId":"accountCreateSession","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Allow the user to login into their account by providing a valid email and password combination. This route will create a new session for the user.","responses":{"201":{"description":"Session","schema":{"$ref":"#\/definitions\/session"}}},"x-appwrite":{"method":"createSession","weight":38,"cookies":false,"type":"","demo":"account\/create-session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create-session.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},email:{param-email}","scope":"public","platforms":["client"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"email":{"type":"string","description":"User email.","default":null,"x-example":"email@example.com"},"password":{"type":"string","description":"User password. Must be between 6 to 32 chars.","default":null,"x-example":"password"}},"required":["email","password"]}}]},"delete":{"summary":"Delete All Account Sessions","operationId":"accountDeleteSessions","consumes":["application\/json"],"produces":[],"tags":["account"],"description":"Delete all sessions from the user account and remove any sessions cookies from the end client.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteSessions","weight":58,"cookies":false,"type":"","demo":"account\/delete-sessions.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/delete-sessions.md","rate-limit":100,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}]}},"\/account\/sessions\/anonymous":{"post":{"summary":"Create Anonymous Session","operationId":"accountCreateAnonymousSession","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to allow a new user to register an anonymous account in your project. This route will also create a new session for the user. To allow the new user to convert an anonymous account to a normal account, you need to update its [email and password](\/docs\/client\/account#accountUpdateEmail) or create an [OAuth2 session](\/docs\/client\/account#accountCreateOAuth2Session).","responses":{"201":{"description":"Session","schema":{"$ref":"#\/definitions\/session"}}},"x-appwrite":{"method":"createAnonymousSession","weight":45,"cookies":false,"type":"","demo":"account\/create-anonymous-session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create-session-anonymous.md","rate-limit":50,"rate-time":3600,"rate-key":"ip:{ip}","scope":"public","platforms":["client"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}]}},"\/account\/sessions\/magic-url":{"post":{"summary":"Create Magic URL session","operationId":"accountCreateMagicURLSession","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Sends the user an email with a secret key for creating a session. When the user clicks the link in the email, the user is redirected back to the URL you provided with the secret key and userId values attached to the URL query string. Use the query string parameters to submit a request to the [PUT \/account\/sessions\/magic-url](\/docs\/client\/account#accountUpdateMagicURLSession) endpoint to complete the login process. The link sent to the user's email address is valid for 1 hour. If you are on a mobile device you can leave the URL parameter empty, so that the login completion will be handled by your Appwrite instance by default.","responses":{"201":{"description":"Token","schema":{"$ref":"#\/definitions\/token"}}},"x-appwrite":{"method":"createMagicURLSession","weight":43,"cookies":false,"type":"","demo":"account\/create-magic-u-r-l-session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create-magic-url-session.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},email:{param-email}","scope":"public","platforms":["client"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"email":{"type":"string","description":"User email.","default":null,"x-example":"email@example.com"},"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"}},"required":["email"]}}]},"put":{"summary":"Create Magic URL session (confirmation)","operationId":"accountUpdateMagicURLSession","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to complete creating the session with the Magic URL. Both the **userId** and **secret** arguments will be passed as query parameters to the redirect URL you have provided when sending your request to the [POST \/account\/sessions\/magic-url](\/docs\/client\/account#accountCreateMagicURLSession) endpoint.\n\nPlease note that in order to avoid a [Redirect Attack](https:\/\/github.com\/OWASP\/CheatSheetSeries\/blob\/master\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.","responses":{"200":{"description":"Session","schema":{"$ref":"#\/definitions\/session"}}},"x-appwrite":{"method":"updateMagicURLSession","weight":44,"cookies":false,"type":"","demo":"account\/update-magic-u-r-l-session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-magic-url-session.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},userId:{param-userId}","scope":"public","platforms":["client"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"userId":{"type":"string","description":"User unique ID.","default":null,"x-example":"[USER_ID]"},"secret":{"type":"string","description":"Valid verification token.","default":null,"x-example":"[SECRET]"}},"required":["userId","secret"]}}]}},"\/account\/sessions\/oauth2\/{provider}":{"get":{"summary":"Create Account Session with OAuth2","operationId":"accountCreateOAuth2Session","consumes":["application\/json"],"produces":["text\/html"],"tags":["account"],"description":"Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL's back to your app when login is completed.\n\nIf there is already an active session, the new session will be attached to the logged-in account. If there are no active sessions, the server will attempt to look for a user with the same email address as the email received from the OAuth2 provider and attach the new session to the existing user. If no matching user is found - the server will create a new user..\n","responses":{"301":{"description":"No content"}},"x-appwrite":{"method":"createOAuth2Session","weight":39,"cookies":false,"type":"webAuth","demo":"account\/create-o-auth2session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create-session-oauth2.md","rate-limit":50,"rate-time":3600,"rate-key":"ip:{ip}","scope":"public","platforms":["client"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"provider","description":"OAuth2 Provider. Currently, supported providers are: amazon, apple, bitbucket, bitly, box, discord, dropbox, facebook, github, gitlab, google, linkedin, microsoft, paypal, paypalSandbox, salesforce, slack, spotify, tradeshift, tradeshiftBox, twitch, vk, yahoo, yandex, wordpress.","required":true,"type":"string","x-example":"amazon","in":"path"},{"name":"success","description":"URL to redirect back to your app after a successful login attempt. 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.","required":false,"type":"string","format":"url","x-example":"https:\/\/example.com","default":"","in":"query"},{"name":"failure","description":"URL to redirect back to your app after a failed login attempt. 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.","required":false,"type":"string","format":"url","x-example":"https:\/\/example.com","default":"","in":"query"},{"name":"scopes","description":"A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes.","required":false,"type":"array","collectionFormat":"multi","items":{"type":"string"},"default":[],"in":"query"}]}},"\/account\/sessions\/{sessionId}":{"get":{"summary":"Get Session By ID","operationId":"accountGetSession","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to get a logged in user's session using a Session ID. Inputting 'current' will return the current session being used.","responses":{"200":{"description":"Session","schema":{"$ref":"#\/definitions\/session"}}},"x-appwrite":{"method":"getSession","weight":51,"cookies":false,"type":"","demo":"account\/get-session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/get-session.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"sessionId","description":"Session unique ID. Use the string 'current' to get the current device session.","required":true,"type":"string","x-example":"[SESSION_ID]","in":"path"}]},"delete":{"summary":"Delete Account Session","operationId":"accountDeleteSession","consumes":["application\/json"],"produces":[],"tags":["account"],"description":"Use this endpoint to log out the currently logged in user from all their account sessions across all of their different devices. When using the option id argument, only the session unique ID provider will be deleted.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteSession","weight":57,"cookies":false,"type":"","demo":"account\/delete-session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/delete-session.md","rate-limit":100,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"sessionId","description":"Session unique ID. Use the string 'current' to delete the current device session.","required":true,"type":"string","x-example":"[SESSION_ID]","in":"path"}]}},"\/account\/verification":{"post":{"summary":"Create Email Verification","operationId":"accountCreateVerification","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the **userId** and **secret** arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the **userId** and **secret** parameters. Learn more about how to [complete the verification process](\/docs\/client\/account#accountUpdateVerification). The verification link sent to the user's email address is valid for 7 days.\n\nPlease note that in order to avoid a [Redirect Attack](https:\/\/github.com\/OWASP\/CheatSheetSeries\/blob\/master\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.\n","responses":{"201":{"description":"Token","schema":{"$ref":"#\/definitions\/token"}}},"x-appwrite":{"method":"createVerification","weight":61,"cookies":false,"type":"","demo":"account\/create-verification.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create-verification.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},userId:{userId}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"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.","default":null,"x-example":"https:\/\/example.com"}},"required":["url"]}}]},"put":{"summary":"Create Email Verification (confirmation)","operationId":"accountUpdateVerification","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to complete the user email verification process. Use both the **userId** and **secret** parameters that were attached to your app URL to verify the user email ownership. If confirmed this route will return a 200 status code.","responses":{"200":{"description":"Token","schema":{"$ref":"#\/definitions\/token"}}},"x-appwrite":{"method":"updateVerification","weight":62,"cookies":false,"type":"","demo":"account\/update-verification.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-verification.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},userId:{param-userId}","scope":"public","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"userId":{"type":"string","description":"User unique ID.","default":null,"x-example":"[USER_ID]"},"secret":{"type":"string","description":"Valid verification token.","default":null,"x-example":"[SECRET]"}},"required":["userId","secret"]}}]}},"\/avatars\/browsers\/{code}":{"get":{"summary":"Get Browser Icon","operationId":"avatarsGetBrowser","consumes":["application\/json"],"produces":["image\/png"],"tags":["avatars"],"description":"You can use this endpoint to show different browser icons to your users. The code argument receives the browser code as it appears in your user \/account\/sessions endpoint. Use width, height and quality arguments to change the output settings.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getBrowser","weight":64,"cookies":false,"type":"location","demo":"avatars\/get-browser.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-browser.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"code","description":"Browser Code.","required":true,"type":"string","x-example":"aa","in":"path"},{"name":"width","description":"Image width. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"height","description":"Image height. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"quality","description":"Image quality. Pass an integer between 0 to 100. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"}]}},"\/avatars\/credit-cards\/{code}":{"get":{"summary":"Get Credit Card Icon","operationId":"avatarsGetCreditCard","consumes":["application\/json"],"produces":["image\/png"],"tags":["avatars"],"description":"The credit card endpoint will return you the icon of the credit card provider you need. Use width, height and quality arguments to change the output settings.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getCreditCard","weight":63,"cookies":false,"type":"location","demo":"avatars\/get-credit-card.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-credit-card.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"code","description":"Credit Card Code. Possible values: amex, argencard, cabal, censosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, union-china-pay, visa, mir, maestro.","required":true,"type":"string","x-example":"amex","in":"path"},{"name":"width","description":"Image width. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"height","description":"Image height. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"quality","description":"Image quality. Pass an integer between 0 to 100. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"}]}},"\/avatars\/favicon":{"get":{"summary":"Get Favicon","operationId":"avatarsGetFavicon","consumes":["application\/json"],"produces":["image\/*"],"tags":["avatars"],"description":"Use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL.\n","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getFavicon","weight":67,"cookies":false,"type":"location","demo":"avatars\/get-favicon.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-favicon.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"url","description":"Website URL which you want to fetch the favicon from.","required":true,"type":"string","format":"url","x-example":"https:\/\/example.com","in":"query"}]}},"\/avatars\/flags\/{code}":{"get":{"summary":"Get Country Flag","operationId":"avatarsGetFlag","consumes":["application\/json"],"produces":["image\/png"],"tags":["avatars"],"description":"You can use this endpoint to show different country flags icons to your users. The code argument receives the 2 letter country code. Use width, height and quality arguments to change the output settings.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getFlag","weight":65,"cookies":false,"type":"location","demo":"avatars\/get-flag.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-flag.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"code","description":"Country Code. ISO Alpha-2 country code format.","required":true,"type":"string","x-example":"af","in":"path"},{"name":"width","description":"Image width. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"height","description":"Image height. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"quality","description":"Image quality. Pass an integer between 0 to 100. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"}]}},"\/avatars\/image":{"get":{"summary":"Get Image from URL","operationId":"avatarsGetImage","consumes":["application\/json"],"produces":["image\/*"],"tags":["avatars"],"description":"Use this endpoint to fetch a remote image URL and crop it to any image size you want. This endpoint is very useful if you need to crop and display remote images in your app or in case you want to make sure a 3rd party image is properly served using a TLS protocol.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getImage","weight":66,"cookies":false,"type":"location","demo":"avatars\/get-image.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-image.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"url","description":"Image URL which you want to crop.","required":true,"type":"string","format":"url","x-example":"https:\/\/example.com","in":"query"},{"name":"width","description":"Resize preview image width, Pass an integer between 0 to 2000.","required":false,"type":"integer","format":"int32","x-example":0,"default":400,"in":"query"},{"name":"height","description":"Resize preview image height, Pass an integer between 0 to 2000.","required":false,"type":"integer","format":"int32","x-example":0,"default":400,"in":"query"}]}},"\/avatars\/initials":{"get":{"summary":"Get User Initials","operationId":"avatarsGetInitials","consumes":["application\/json"],"produces":["image\/png"],"tags":["avatars"],"description":"Use this endpoint to show your user initials avatar icon on your website or app. By default, this route will try to print your logged-in user name or email initials. You can also overwrite the user name if you pass the 'name' parameter. If no name is given and no user is logged, an empty avatar will be returned.\n\nYou can use the color and background params to change the avatar colors. By default, a random theme will be selected. The random theme will persist for the user's initials when reloading the same theme will always return for the same initials.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getInitials","weight":69,"cookies":false,"type":"location","demo":"avatars\/get-initials.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-initials.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"name","description":"Full Name. When empty, current user name or email will be used. Max length: 128 chars.","required":false,"type":"string","x-example":"[NAME]","default":"","in":"query"},{"name":"width","description":"Image width. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":500,"in":"query"},{"name":"height","description":"Image height. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":500,"in":"query"},{"name":"color","description":"Changes text color. By default a random color will be picked and stay will persistent to the given name.","required":false,"type":"string","default":"","in":"query"},{"name":"background","description":"Changes background color. By default a random color will be picked and stay will persistent to the given name.","required":false,"type":"string","default":"","in":"query"}]}},"\/avatars\/qr":{"get":{"summary":"Get QR Code","operationId":"avatarsGetQR","consumes":["application\/json"],"produces":["image\/png"],"tags":["avatars"],"description":"Converts a given plain text to a QR code image. You can use the query parameters to change the size and style of the resulting image.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getQR","weight":68,"cookies":false,"type":"location","demo":"avatars\/get-q-r.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-qr.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"text","description":"Plain text to be converted to QR code image.","required":true,"type":"string","x-example":"[TEXT]","in":"query"},{"name":"size","description":"QR code size. Pass an integer between 0 to 1000. Defaults to 400.","required":false,"type":"integer","format":"int32","x-example":0,"default":400,"in":"query"},{"name":"margin","description":"Margin from edge. Pass an integer between 0 to 10. Defaults to 1.","required":false,"type":"integer","format":"int32","x-example":0,"default":1,"in":"query"},{"name":"download","description":"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.","required":false,"type":"boolean","x-example":false,"default":false,"in":"query"}]}},"\/database\/collections":{"get":{"summary":"List Collections","operationId":"databaseListCollections","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Get a list of all the user collections. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project's collections. [Learn more about different API modes](\/docs\/admin).","responses":{"200":{"description":"Collections List","schema":{"$ref":"#\/definitions\/collectionList"}}},"x-appwrite":{"method":"listCollections","weight":71,"cookies":false,"type":"","demo":"database\/list-collections.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/list-collections.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Results offset. The default value is 0. Use this param to manage pagination.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create Collection","operationId":"databaseCreateCollection","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Create a new Collection.","responses":{"201":{"description":"Collection","schema":{"$ref":"#\/definitions\/collection"}}},"x-appwrite":{"method":"createCollection","weight":70,"cookies":false,"type":"","demo":"database\/create-collection.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/create-collection.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Collection name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"read":{"type":"array","description":"An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}},"write":{"type":"array","description":"An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}},"rules":{"type":"array","description":"Array of [rule objects](\/docs\/rules). Each rule define a collection field name, data type and validation.","default":null,"x-example":null,"items":{"type":"string"}}},"required":["name","read","write","rules"]}}]}},"\/database\/collections\/{collectionId}":{"get":{"summary":"Get Collection","operationId":"databaseGetCollection","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata.","responses":{"200":{"description":"Collection","schema":{"$ref":"#\/definitions\/collection"}}},"x-appwrite":{"method":"getCollection","weight":72,"cookies":false,"type":"","demo":"database\/get-collection.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/get-collection.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID.","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"}]},"put":{"summary":"Update Collection","operationId":"databaseUpdateCollection","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Update a collection by its unique ID.","responses":{"200":{"description":"Collection","schema":{"$ref":"#\/definitions\/collection"}}},"x-appwrite":{"method":"updateCollection","weight":73,"cookies":false,"type":"","demo":"database\/update-collection.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/update-collection.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID.","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Collection name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"read":{"type":"array","description":"An array of strings with read permissions. By default inherits the existing read permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}},"write":{"type":"array","description":"An array of strings with write permissions. By default inherits the existing write permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}},"rules":{"type":"array","description":"Array of [rule objects](\/docs\/rules). Each rule define a collection field name, data type and validation.","default":[],"x-example":null,"items":{"type":"string"}}},"required":["name"]}}]},"delete":{"summary":"Delete Collection","operationId":"databaseDeleteCollection","consumes":["application\/json"],"produces":[],"tags":["database"],"description":"Delete a collection by its unique ID. Only users with write permissions have access to delete this resource.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteCollection","weight":74,"cookies":false,"type":"","demo":"database\/delete-collection.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/delete-collection.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID.","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"}]}},"\/database\/collections\/{collectionId}\/documents":{"get":{"summary":"List Documents","operationId":"databaseListDocuments","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Get a list of all the user documents. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project's documents. [Learn more about different API modes](\/docs\/admin).","responses":{"200":{"description":"Documents List","schema":{"$ref":"#\/definitions\/documentList"}}},"x-appwrite":{"method":"listDocuments","weight":76,"cookies":false,"type":"","demo":"database\/list-documents.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/list-documents.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"documents.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"filters","description":"Array of filter strings. Each filter is constructed from a key name, comparison operator (=, !=, >, <, <=, >=) and a value. You can also use a dot (.) separator in attribute names to filter by child document attributes. Examples: 'name=John Doe' or 'category.$id>=5bed2d152c362'.","required":false,"type":"array","collectionFormat":"multi","items":{"type":"string"},"default":[],"in":"query"},{"name":"limit","description":"Maximum number of documents to return in response. Use this value to manage pagination. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Offset value. The default value is 0. Use this param to manage pagination.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"orderField","description":"Document field that results will be sorted by.","required":false,"type":"string","x-example":"[ORDER_FIELD]","default":"","in":"query"},{"name":"orderType","description":"Order direction. Possible values are DESC for descending order, or ASC for ascending order.","required":false,"type":"string","x-example":"DESC","default":"ASC","in":"query"},{"name":"orderCast","description":"Order field type casting. Possible values are int, string, date, time or datetime. The database will attempt to cast the order field to the value you pass here. The default value is a string.","required":false,"type":"string","x-example":"int","default":"string","in":"query"},{"name":"search","description":"Search query. Enter any free text search. The database will try to find a match against all document attributes and children. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"}]},"post":{"summary":"Create Document","operationId":"databaseCreateDocument","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](\/docs\/server\/database#databaseCreateCollection) API or directly from your database console.","responses":{"201":{"description":"Document","schema":{"$ref":"#\/definitions\/document"}}},"x-appwrite":{"method":"createDocument","weight":75,"cookies":false,"type":"","demo":"database\/create-document.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/create-document.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"documents.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"data":{"type":"object","description":"Document data as JSON object.","default":null,"x-example":"{}"},"read":{"type":"array","description":"An array of strings with read permissions. By default only the current user is granted with read permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}},"write":{"type":"array","description":"An array of strings with write permissions. By default only the current user is granted with write permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}},"parentDocument":{"type":"string","description":"Parent document unique ID. Use when you want your new document to be a child of a parent document.","default":"","x-example":"[PARENT_DOCUMENT]"},"parentProperty":{"type":"string","description":"Parent document property name. Use when you want your new document to be a child of a parent document.","default":"","x-example":null},"parentPropertyType":{"type":"string","description":"Parent document property connection type. You can set this value to **assign**, **append** or **prepend**, default value is assign. Use when you want your new document to be a child of a parent document.","default":"assign","x-example":"assign"}},"required":["data"]}}]}},"\/database\/collections\/{collectionId}\/documents\/{documentId}":{"get":{"summary":"Get Document","operationId":"databaseGetDocument","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Get a document by its unique ID. This endpoint response returns a JSON object with the document data.","responses":{"200":{"description":"Document","schema":{"$ref":"#\/definitions\/document"}}},"x-appwrite":{"method":"getDocument","weight":77,"cookies":false,"type":"","demo":"database\/get-document.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/get-document.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"documents.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"documentId","description":"Document unique ID.","required":true,"type":"string","x-example":"[DOCUMENT_ID]","in":"path"}]},"patch":{"summary":"Update Document","operationId":"databaseUpdateDocument","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated.","responses":{"200":{"description":"Document","schema":{"$ref":"#\/definitions\/document"}}},"x-appwrite":{"method":"updateDocument","weight":78,"cookies":false,"type":"","demo":"database\/update-document.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/update-document.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"documents.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"documentId","description":"Document unique ID.","required":true,"type":"string","x-example":"[DOCUMENT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"data":{"type":"object","description":"Document data as JSON object.","default":null,"x-example":"{}"},"read":{"type":"array","description":"An array of strings with read permissions. By default inherits the existing read permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}},"write":{"type":"array","description":"An array of strings with write permissions. By default inherits the existing write permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}}},"required":["data"]}}]},"delete":{"summary":"Delete Document","operationId":"databaseDeleteDocument","consumes":["application\/json"],"produces":[],"tags":["database"],"description":"Delete a document by its unique ID. This endpoint deletes only the parent documents, its attributes and relations to other documents. Child documents **will not** be deleted.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteDocument","weight":79,"cookies":false,"type":"","demo":"database\/delete-document.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/delete-document.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"documents.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"documentId","description":"Document unique ID.","required":true,"type":"string","x-example":"[DOCUMENT_ID]","in":"path"}]}},"\/functions":{"get":{"summary":"List Functions","operationId":"functionsList","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Get a list of all the project's functions. You can use the query params to filter your results.","responses":{"200":{"description":"Functions List","schema":{"$ref":"#\/definitions\/functionList"}}},"x-appwrite":{"method":"list","weight":169,"cookies":false,"type":"","demo":"functions\/list.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/list-functions.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Results offset. The default value is 0. Use this param to manage pagination.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create Function","operationId":"functionsCreate","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Create a new function. You can pass a list of [permissions](\/docs\/permissions) to allow different project users or team with access to execute the function using the client API.","responses":{"201":{"description":"Function","schema":{"$ref":"#\/definitions\/function"}}},"x-appwrite":{"method":"create","weight":168,"cookies":false,"type":"","demo":"functions\/create.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/create-function.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Function name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"execute":{"type":"array","description":"An array of strings with execution permissions. By default no user is granted with any execute permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}},"runtime":{"type":"string","description":"Execution runtime.","default":null,"x-example":"dotnet-5.0"},"vars":{"type":"object","description":"Key-value JSON object.","default":{},"x-example":"{}"},"events":{"type":"array","description":"Events list.","default":[],"x-example":null,"items":{"type":"string"}},"schedule":{"type":"string","description":"Schedule CRON syntax.","default":"","x-example":null},"timeout":{"type":"integer","description":"Function maximum execution time in seconds.","default":15,"x-example":1}},"required":["name","execute","runtime"]}}]}},"\/functions\/{functionId}":{"get":{"summary":"Get Function","operationId":"functionsGet","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Get a function by its unique ID.","responses":{"200":{"description":"Function","schema":{"$ref":"#\/definitions\/function"}}},"x-appwrite":{"method":"get","weight":170,"cookies":false,"type":"","demo":"functions\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/get-function.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"}]},"put":{"summary":"Update Function","operationId":"functionsUpdate","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Update function by its unique ID.","responses":{"200":{"description":"Function","schema":{"$ref":"#\/definitions\/function"}}},"x-appwrite":{"method":"update","weight":172,"cookies":false,"type":"","demo":"functions\/update.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/update-function.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Function name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"execute":{"type":"array","description":"An array of strings with execution permissions. By default no user is granted with any execute permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}},"vars":{"type":"object","description":"Key-value JSON object.","default":{},"x-example":"{}"},"events":{"type":"array","description":"Events list.","default":[],"x-example":null,"items":{"type":"string"}},"schedule":{"type":"string","description":"Schedule CRON syntax.","default":"","x-example":null},"timeout":{"type":"integer","description":"Function maximum execution time in seconds.","default":15,"x-example":1}},"required":["name","execute"]}}]},"delete":{"summary":"Delete Function","operationId":"functionsDelete","consumes":["application\/json"],"produces":[],"tags":["functions"],"description":"Delete a function by its unique ID.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"delete","weight":174,"cookies":false,"type":"","demo":"functions\/delete.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/delete-function.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"}]}},"\/functions\/{functionId}\/executions":{"get":{"summary":"List Executions","operationId":"functionsListExecutions","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Get a list of all the current user function execution logs. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project's executions. [Learn more about different API modes](\/docs\/admin).","responses":{"200":{"description":"Executions List","schema":{"$ref":"#\/definitions\/executionList"}}},"x-appwrite":{"method":"listExecutions","weight":180,"cookies":false,"type":"","demo":"functions\/list-executions.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/list-executions.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"execution.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Results offset. The default value is 0. Use this param to manage pagination.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create Execution","operationId":"functionsCreateExecution","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Trigger a function execution. The returned object will return you the current execution status. You can ping the `Get Execution` endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously.","responses":{"201":{"description":"Execution","schema":{"$ref":"#\/definitions\/execution"}}},"x-appwrite":{"method":"createExecution","weight":179,"cookies":false,"type":"","demo":"functions\/create-execution.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/create-execution.md","rate-limit":60,"rate-time":60,"rate-key":"url:{url},ip:{ip}","scope":"execution.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"data":{"type":"string","description":"String of custom data to send to function.","default":"","x-example":"[DATA]"}}}}]}},"\/functions\/{functionId}\/executions\/{executionId}":{"get":{"summary":"Get Execution","operationId":"functionsGetExecution","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Get a function execution log by its unique ID.","responses":{"200":{"description":"Execution","schema":{"$ref":"#\/definitions\/execution"}}},"x-appwrite":{"method":"getExecution","weight":181,"cookies":false,"type":"","demo":"functions\/get-execution.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/get-execution.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"execution.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"executionId","description":"Execution unique ID.","required":true,"type":"string","x-example":"[EXECUTION_ID]","in":"path"}]}},"\/functions\/{functionId}\/tag":{"patch":{"summary":"Update Function Tag","operationId":"functionsUpdateTag","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Update the function code tag ID using the unique function ID. Use this endpoint to switch the code tag that should be executed by the execution endpoint.","responses":{"200":{"description":"Function","schema":{"$ref":"#\/definitions\/function"}}},"x-appwrite":{"method":"updateTag","weight":173,"cookies":false,"type":"","demo":"functions\/update-tag.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/update-function-tag.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"tag":{"type":"string","description":"Tag unique ID.","default":null,"x-example":"[TAG]"}},"required":["tag"]}}]}},"\/functions\/{functionId}\/tags":{"get":{"summary":"List Tags","operationId":"functionsListTags","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Get a list of all the project's code tags. You can use the query params to filter your results.","responses":{"200":{"description":"Tags List","schema":{"$ref":"#\/definitions\/tagList"}}},"x-appwrite":{"method":"listTags","weight":176,"cookies":false,"type":"","demo":"functions\/list-tags.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/list-tags.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Results offset. The default value is 0. Use this param to manage pagination.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create Tag","operationId":"functionsCreateTag","consumes":["multipart\/form-data"],"produces":["application\/json"],"tags":["functions"],"description":"Create a new function code tag. Use this endpoint to upload a new version of your code function. To execute your newly uploaded code, you'll need to update the function's tag to use your new tag UID.\n\nThis endpoint accepts a tar.gz file compressed with your code. Make sure to include any dependencies your code has within the compressed file. You can learn more about code packaging in the [Appwrite Cloud Functions tutorial](\/docs\/functions).\n\nUse the \"command\" param to set the entry point used to execute your code.","responses":{"201":{"description":"Tag","schema":{"$ref":"#\/definitions\/tag"}}},"x-appwrite":{"method":"createTag","weight":175,"cookies":false,"type":"","demo":"functions\/create-tag.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/create-tag.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.write","platforms":["server"],"packaging":true,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"command","description":"Code execution command.","required":true,"type":"string","x-example":"[COMMAND]","in":"formData"},{"name":"code","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.","required":true,"type":"file","in":"formData"}]}},"\/functions\/{functionId}\/tags\/{tagId}":{"get":{"summary":"Get Tag","operationId":"functionsGetTag","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Get a code tag by its unique ID.","responses":{"200":{"description":"Tag","schema":{"$ref":"#\/definitions\/tag"}}},"x-appwrite":{"method":"getTag","weight":177,"cookies":false,"type":"","demo":"functions\/get-tag.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/get-tag.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"tagId","description":"Tag unique ID.","required":true,"type":"string","x-example":"[TAG_ID]","in":"path"}]},"delete":{"summary":"Delete Tag","operationId":"functionsDeleteTag","consumes":["application\/json"],"produces":[],"tags":["functions"],"description":"Delete a code tag by its unique ID.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteTag","weight":178,"cookies":false,"type":"","demo":"functions\/delete-tag.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/delete-tag.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"tagId","description":"Tag unique ID.","required":true,"type":"string","x-example":"[TAG_ID]","in":"path"}]}},"\/functions\/{functionId}\/usage":{"get":{"summary":"Get Function Usage","operationId":"functionsGetUsage","consumes":["application\/json"],"produces":[],"tags":["functions"],"description":"","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getUsage","weight":171,"cookies":false,"type":"","demo":"functions\/get-usage.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"range","description":"Date range.","required":false,"type":"string","x-example":"24h","default":"30d","in":"query"}]}},"\/health":{"get":{"summary":"Get HTTP","operationId":"healthGet","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Check the Appwrite HTTP server is up and responsive.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"get","weight":87,"cookies":false,"type":"","demo":"health\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/anti-virus":{"get":{"summary":"Get Anti virus","operationId":"healthGetAntiVirus","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Check the Appwrite Anti Virus server is up and connection is successful.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getAntiVirus","weight":99,"cookies":false,"type":"","demo":"health\/get-anti-virus.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-storage-anti-virus.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/cache":{"get":{"summary":"Get Cache","operationId":"healthGetCache","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Check the Appwrite in-memory cache server is up and connection is successful.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getCache","weight":90,"cookies":false,"type":"","demo":"health\/get-cache.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-cache.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/db":{"get":{"summary":"Get DB","operationId":"healthGetDB","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Check the Appwrite database server is up and connection is successful.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getDB","weight":89,"cookies":false,"type":"","demo":"health\/get-d-b.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-db.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/queue\/certificates":{"get":{"summary":"Get Certificate Queue","operationId":"healthGetQueueCertificates","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Get the number of certificates that are waiting to be issued against [Letsencrypt](https:\/\/letsencrypt.org\/) in the Appwrite internal queue server.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getQueueCertificates","weight":96,"cookies":false,"type":"","demo":"health\/get-queue-certificates.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-certificates.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/queue\/functions":{"get":{"summary":"Get Functions Queue","operationId":"healthGetQueueFunctions","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getQueueFunctions","weight":97,"cookies":false,"type":"","demo":"health\/get-queue-functions.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-functions.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/queue\/logs":{"get":{"summary":"Get Logs Queue","operationId":"healthGetQueueLogs","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Get the number of logs that are waiting to be processed in the Appwrite internal queue server.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getQueueLogs","weight":94,"cookies":false,"type":"","demo":"health\/get-queue-logs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-logs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/queue\/tasks":{"get":{"summary":"Get Tasks Queue","operationId":"healthGetQueueTasks","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Get the number of tasks that are waiting to be processed in the Appwrite internal queue server.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getQueueTasks","weight":93,"cookies":false,"type":"","demo":"health\/get-queue-tasks.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-tasks.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/queue\/usage":{"get":{"summary":"Get Usage Queue","operationId":"healthGetQueueUsage","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Get the number of usage stats that are waiting to be processed in the Appwrite internal queue server.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getQueueUsage","weight":95,"cookies":false,"type":"","demo":"health\/get-queue-usage.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-usage.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/queue\/webhooks":{"get":{"summary":"Get Webhooks Queue","operationId":"healthGetQueueWebhooks","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getQueueWebhooks","weight":92,"cookies":false,"type":"","demo":"health\/get-queue-webhooks.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-webhooks.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/storage\/local":{"get":{"summary":"Get Local Storage","operationId":"healthGetStorageLocal","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Check the Appwrite local storage device is up and connection is successful.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getStorageLocal","weight":98,"cookies":false,"type":"","demo":"health\/get-storage-local.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-storage-local.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/time":{"get":{"summary":"Get Time","operationId":"healthGetTime","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Check the Appwrite server time is synced with Google remote NTP server. We use this technology to smoothly handle leap seconds with no disruptive events. The [Network Time Protocol](https:\/\/en.wikipedia.org\/wiki\/Network_Time_Protocol) (NTP) is used by hundreds of millions of computers and devices to synchronize their clocks over the Internet. If your computer sets its own clock, it likely uses NTP.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getTime","weight":91,"cookies":false,"type":"","demo":"health\/get-time.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-time.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/locale":{"get":{"summary":"Get User Locale","operationId":"localeGet","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"Get the current user location based on IP. Returns an object with user country code, country name, continent name, continent code, ip address and suggested currency. You can use the locale header to get the data in a supported language.\n\n([IP Geolocation by DB-IP](https:\/\/db-ip.com))","responses":{"200":{"description":"Locale","schema":{"$ref":"#\/definitions\/locale"}}},"x-appwrite":{"method":"get","weight":80,"cookies":false,"type":"","demo":"locale\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-locale.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}]}},"\/locale\/continents":{"get":{"summary":"List Continents","operationId":"localeGetContinents","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"List of all continents. You can use the locale header to get the data in a supported language.","responses":{"200":{"description":"Continents List","schema":{"$ref":"#\/definitions\/continentList"}}},"x-appwrite":{"method":"getContinents","weight":84,"cookies":false,"type":"","demo":"locale\/get-continents.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-continents.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}]}},"\/locale\/countries":{"get":{"summary":"List Countries","operationId":"localeGetCountries","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"List of all countries. You can use the locale header to get the data in a supported language.","responses":{"200":{"description":"Countries List","schema":{"$ref":"#\/definitions\/countryList"}}},"x-appwrite":{"method":"getCountries","weight":81,"cookies":false,"type":"","demo":"locale\/get-countries.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-countries.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}]}},"\/locale\/countries\/eu":{"get":{"summary":"List EU Countries","operationId":"localeGetCountriesEU","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"List of all countries that are currently members of the EU. You can use the locale header to get the data in a supported language.","responses":{"200":{"description":"Countries List","schema":{"$ref":"#\/definitions\/countryList"}}},"x-appwrite":{"method":"getCountriesEU","weight":82,"cookies":false,"type":"","demo":"locale\/get-countries-e-u.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-countries-eu.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}]}},"\/locale\/countries\/phones":{"get":{"summary":"List Countries Phone Codes","operationId":"localeGetCountriesPhones","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"List of all countries phone codes. You can use the locale header to get the data in a supported language.","responses":{"200":{"description":"Phones List","schema":{"$ref":"#\/definitions\/phoneList"}}},"x-appwrite":{"method":"getCountriesPhones","weight":83,"cookies":false,"type":"","demo":"locale\/get-countries-phones.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-countries-phones.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}]}},"\/locale\/currencies":{"get":{"summary":"List Currencies","operationId":"localeGetCurrencies","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"List of all currencies, including currency symbol, name, plural, and decimal digits for all major and minor currencies. You can use the locale header to get the data in a supported language.","responses":{"200":{"description":"Currencies List","schema":{"$ref":"#\/definitions\/currencyList"}}},"x-appwrite":{"method":"getCurrencies","weight":85,"cookies":false,"type":"","demo":"locale\/get-currencies.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-currencies.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}]}},"\/locale\/languages":{"get":{"summary":"List Languages","operationId":"localeGetLanguages","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"List of all languages classified by ISO 639-1 including 2-letter code, name in English, and name in the respective language.","responses":{"200":{"description":"Languages List","schema":{"$ref":"#\/definitions\/languageList"}}},"x-appwrite":{"method":"getLanguages","weight":86,"cookies":false,"type":"","demo":"locale\/get-languages.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-languages.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}]}},"\/projects":{"get":{"summary":"List Projects","operationId":"projectsList","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Projects List","schema":{"$ref":"#\/definitions\/projectList"}}},"x-appwrite":{"method":"list","weight":102,"cookies":false,"type":"","demo":"projects\/list.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Results offset. The default value is 0. Use this param to manage pagination.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create Project","operationId":"projectsCreate","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"201":{"description":"Project","schema":{"$ref":"#\/definitions\/project"}}},"x-appwrite":{"method":"create","weight":101,"cookies":false,"type":"","demo":"projects\/create.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Project name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"teamId":{"type":"string","description":"Team unique ID.","default":null,"x-example":"[TEAM_ID]"},"description":{"type":"string","description":"Project description. Max length: 256 chars.","default":"","x-example":"[DESCRIPTION]"},"logo":{"type":"string","description":"Project logo.","default":"","x-example":"[LOGO]"},"url":{"type":"string","description":"Project URL.","default":"","x-example":"https:\/\/example.com"},"legalName":{"type":"string","description":"Project legal Name. Max length: 256 chars.","default":"","x-example":"[LEGAL_NAME]"},"legalCountry":{"type":"string","description":"Project legal Country. Max length: 256 chars.","default":"","x-example":"[LEGAL_COUNTRY]"},"legalState":{"type":"string","description":"Project legal State. Max length: 256 chars.","default":"","x-example":"[LEGAL_STATE]"},"legalCity":{"type":"string","description":"Project legal City. Max length: 256 chars.","default":"","x-example":"[LEGAL_CITY]"},"legalAddress":{"type":"string","description":"Project legal Address. Max length: 256 chars.","default":"","x-example":"[LEGAL_ADDRESS]"},"legalTaxId":{"type":"string","description":"Project legal Tax ID. Max length: 256 chars.","default":"","x-example":"[LEGAL_TAX_ID]"}},"required":["name","teamId"]}}]}},"\/projects\/{projectId}":{"get":{"summary":"Get Project","operationId":"projectsGet","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Project","schema":{"$ref":"#\/definitions\/project"}}},"x-appwrite":{"method":"get","weight":103,"cookies":false,"type":"","demo":"projects\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"}]},"patch":{"summary":"Update Project","operationId":"projectsUpdate","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Project","schema":{"$ref":"#\/definitions\/project"}}},"x-appwrite":{"method":"update","weight":105,"cookies":false,"type":"","demo":"projects\/update.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Project name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"description":{"type":"string","description":"Project description. Max length: 256 chars.","default":"","x-example":"[DESCRIPTION]"},"logo":{"type":"string","description":"Project logo.","default":"","x-example":"[LOGO]"},"url":{"type":"string","description":"Project URL.","default":"","x-example":"https:\/\/example.com"},"legalName":{"type":"string","description":"Project legal name. Max length: 256 chars.","default":"","x-example":"[LEGAL_NAME]"},"legalCountry":{"type":"string","description":"Project legal country. Max length: 256 chars.","default":"","x-example":"[LEGAL_COUNTRY]"},"legalState":{"type":"string","description":"Project legal state. Max length: 256 chars.","default":"","x-example":"[LEGAL_STATE]"},"legalCity":{"type":"string","description":"Project legal city. Max length: 256 chars.","default":"","x-example":"[LEGAL_CITY]"},"legalAddress":{"type":"string","description":"Project legal address. Max length: 256 chars.","default":"","x-example":"[LEGAL_ADDRESS]"},"legalTaxId":{"type":"string","description":"Project legal tax ID. Max length: 256 chars.","default":"","x-example":"[LEGAL_TAX_ID]"}},"required":["name"]}}]},"delete":{"summary":"Delete Project","operationId":"projectsDelete","consumes":["application\/json"],"produces":[],"tags":["projects"],"description":"","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"delete","weight":109,"cookies":false,"type":"","demo":"projects\/delete.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"password":{"type":"string","description":"Your user password for confirmation. Must be between 6 to 32 chars.","default":null,"x-example":"[PASSWORD]"}},"required":["password"]}}]}},"\/projects\/{projectId}\/auth\/limit":{"patch":{"summary":"Update Project users limit","operationId":"projectsUpdateAuthLimit","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Project","schema":{"$ref":"#\/definitions\/project"}}},"x-appwrite":{"method":"updateAuthLimit","weight":107,"cookies":false,"type":"","demo":"projects\/update-auth-limit.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"limit":{"type":"integer","description":"Set the max number of users allowed in this project. Use 0 for unlimited.","default":null,"x-example":null}},"required":["limit"]}}]}},"\/projects\/{projectId}\/auth\/{method}":{"patch":{"summary":"Update Project auth method status. Use this endpoint to enable or disable a given auth method for this project.","operationId":"projectsUpdateAuthStatus","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Project","schema":{"$ref":"#\/definitions\/project"}}},"x-appwrite":{"method":"updateAuthStatus","weight":108,"cookies":false,"type":"","demo":"projects\/update-auth-status.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"method","description":"Auth Method. Possible values: email-password,magic-url,anonymous,invites,jwt,phone","required":true,"type":"string","x-example":"email-password","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"status":{"type":"boolean","description":"Set the status of this auth method.","default":null,"x-example":false}},"required":["status"]}}]}},"\/projects\/{projectId}\/domains":{"get":{"summary":"List Domains","operationId":"projectsListDomains","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Domains List","schema":{"$ref":"#\/definitions\/domainList"}}},"x-appwrite":{"method":"listDomains","weight":131,"cookies":false,"type":"","demo":"projects\/list-domains.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"}]},"post":{"summary":"Create Domain","operationId":"projectsCreateDomain","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"201":{"description":"Domain","schema":{"$ref":"#\/definitions\/domain"}}},"x-appwrite":{"method":"createDomain","weight":130,"cookies":false,"type":"","demo":"projects\/create-domain.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"domain":{"type":"string","description":"Domain name.","default":null,"x-example":null}},"required":["domain"]}}]}},"\/projects\/{projectId}\/domains\/{domainId}":{"get":{"summary":"Get Domain","operationId":"projectsGetDomain","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Domain","schema":{"$ref":"#\/definitions\/domain"}}},"x-appwrite":{"method":"getDomain","weight":132,"cookies":false,"type":"","demo":"projects\/get-domain.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"domainId","description":"Domain unique ID.","required":true,"type":"string","x-example":"[DOMAIN_ID]","in":"path"}]},"delete":{"summary":"Delete Domain","operationId":"projectsDeleteDomain","consumes":["application\/json"],"produces":[],"tags":["projects"],"description":"","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteDomain","weight":134,"cookies":false,"type":"","demo":"projects\/delete-domain.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"domainId","description":"Domain unique ID.","required":true,"type":"string","x-example":"[DOMAIN_ID]","in":"path"}]}},"\/projects\/{projectId}\/domains\/{domainId}\/verification":{"patch":{"summary":"Update Domain Verification Status","operationId":"projectsUpdateDomainVerification","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Domain","schema":{"$ref":"#\/definitions\/domain"}}},"x-appwrite":{"method":"updateDomainVerification","weight":133,"cookies":false,"type":"","demo":"projects\/update-domain-verification.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"domainId","description":"Domain unique ID.","required":true,"type":"string","x-example":"[DOMAIN_ID]","in":"path"}]}},"\/projects\/{projectId}\/keys":{"get":{"summary":"List Keys","operationId":"projectsListKeys","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"API Keys List","schema":{"$ref":"#\/definitions\/keyList"}}},"x-appwrite":{"method":"listKeys","weight":116,"cookies":false,"type":"","demo":"projects\/list-keys.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"}]},"post":{"summary":"Create Key","operationId":"projectsCreateKey","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"201":{"description":"Key","schema":{"$ref":"#\/definitions\/key"}}},"x-appwrite":{"method":"createKey","weight":115,"cookies":false,"type":"","demo":"projects\/create-key.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Key name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"scopes":{"type":"array","description":"Key scopes list.","default":null,"x-example":null,"items":{"type":"string"}}},"required":["name","scopes"]}}]}},"\/projects\/{projectId}\/keys\/{keyId}":{"get":{"summary":"Get Key","operationId":"projectsGetKey","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Key","schema":{"$ref":"#\/definitions\/key"}}},"x-appwrite":{"method":"getKey","weight":117,"cookies":false,"type":"","demo":"projects\/get-key.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"keyId","description":"Key unique ID.","required":true,"type":"string","x-example":"[KEY_ID]","in":"path"}]},"put":{"summary":"Update Key","operationId":"projectsUpdateKey","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Key","schema":{"$ref":"#\/definitions\/key"}}},"x-appwrite":{"method":"updateKey","weight":118,"cookies":false,"type":"","demo":"projects\/update-key.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"keyId","description":"Key unique ID.","required":true,"type":"string","x-example":"[KEY_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Key name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"scopes":{"type":"array","description":"Key scopes list","default":null,"x-example":null,"items":{"type":"string"}}},"required":["name","scopes"]}}]},"delete":{"summary":"Delete Key","operationId":"projectsDeleteKey","consumes":["application\/json"],"produces":[],"tags":["projects"],"description":"","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteKey","weight":119,"cookies":false,"type":"","demo":"projects\/delete-key.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"keyId","description":"Key unique ID.","required":true,"type":"string","x-example":"[KEY_ID]","in":"path"}]}},"\/projects\/{projectId}\/oauth2":{"patch":{"summary":"Update Project OAuth2","operationId":"projectsUpdateOAuth2","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Project","schema":{"$ref":"#\/definitions\/project"}}},"x-appwrite":{"method":"updateOAuth2","weight":106,"cookies":false,"type":"","demo":"projects\/update-o-auth2.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"provider":{"type":"string","description":"Provider Name","default":null,"x-example":"amazon"},"appId":{"type":"string","description":"Provider app ID. Max length: 256 chars.","default":"","x-example":"[APP_ID]"},"secret":{"type":"string","description":"Provider secret key. Max length: 512 chars.","default":"","x-example":"[SECRET]"}},"required":["provider"]}}]}},"\/projects\/{projectId}\/platforms":{"get":{"summary":"List Platforms","operationId":"projectsListPlatforms","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Platforms List","schema":{"$ref":"#\/definitions\/platformList"}}},"x-appwrite":{"method":"listPlatforms","weight":126,"cookies":false,"type":"","demo":"projects\/list-platforms.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"}]},"post":{"summary":"Create Platform","operationId":"projectsCreatePlatform","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"201":{"description":"Platform","schema":{"$ref":"#\/definitions\/platform"}}},"x-appwrite":{"method":"createPlatform","weight":125,"cookies":false,"type":"","demo":"projects\/create-platform.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"type":{"type":"string","description":"Platform type.","default":null,"x-example":"web"},"name":{"type":"string","description":"Platform name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"key":{"type":"string","description":"Package name for Android or bundle ID for iOS or macOS. Max length: 256 chars.","default":"","x-example":"[KEY]"},"store":{"type":"string","description":"App store or Google Play store ID. Max length: 256 chars.","default":"","x-example":"[STORE]"},"hostname":{"type":"string","description":"Platform client hostname. Max length: 256 chars.","default":"","x-example":"[HOSTNAME]"}},"required":["type","name"]}}]}},"\/projects\/{projectId}\/platforms\/{platformId}":{"get":{"summary":"Get Platform","operationId":"projectsGetPlatform","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Platform","schema":{"$ref":"#\/definitions\/platform"}}},"x-appwrite":{"method":"getPlatform","weight":127,"cookies":false,"type":"","demo":"projects\/get-platform.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"platformId","description":"Platform unique ID.","required":true,"type":"string","x-example":"[PLATFORM_ID]","in":"path"}]},"put":{"summary":"Update Platform","operationId":"projectsUpdatePlatform","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Platform","schema":{"$ref":"#\/definitions\/platform"}}},"x-appwrite":{"method":"updatePlatform","weight":128,"cookies":false,"type":"","demo":"projects\/update-platform.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"platformId","description":"Platform unique ID.","required":true,"type":"string","x-example":"[PLATFORM_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Platform name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"key":{"type":"string","description":"Package name for android or bundle ID for iOS. Max length: 256 chars.","default":"","x-example":"[KEY]"},"store":{"type":"string","description":"App store or Google Play store ID. Max length: 256 chars.","default":"","x-example":"[STORE]"},"hostname":{"type":"string","description":"Platform client URL. Max length: 256 chars.","default":"","x-example":"[HOSTNAME]"}},"required":["name"]}}]},"delete":{"summary":"Delete Platform","operationId":"projectsDeletePlatform","consumes":["application\/json"],"produces":[],"tags":["projects"],"description":"","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deletePlatform","weight":129,"cookies":false,"type":"","demo":"projects\/delete-platform.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"platformId","description":"Platform unique ID.","required":true,"type":"string","x-example":"[PLATFORM_ID]","in":"path"}]}},"\/projects\/{projectId}\/tasks":{"get":{"summary":"List Tasks","operationId":"projectsListTasks","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Tasks List","schema":{"$ref":"#\/definitions\/taskList"}}},"x-appwrite":{"method":"listTasks","weight":121,"cookies":false,"type":"","demo":"projects\/list-tasks.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"}]},"post":{"summary":"Create Task","operationId":"projectsCreateTask","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"201":{"description":"Task","schema":{"$ref":"#\/definitions\/task"}}},"x-appwrite":{"method":"createTask","weight":120,"cookies":false,"type":"","demo":"projects\/create-task.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Task name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"status":{"type":"string","description":"Task status.","default":null,"x-example":"play"},"schedule":{"type":"string","description":"Task schedule CRON syntax.","default":null,"x-example":null},"security":{"type":"boolean","description":"Certificate verification, false for disabled or true for enabled.","default":null,"x-example":false},"httpMethod":{"type":"string","description":"Task HTTP method.","default":null,"x-example":"GET"},"httpUrl":{"type":"string","description":"Task HTTP URL","default":null,"x-example":"https:\/\/example.com"},"httpHeaders":{"type":"array","description":"Task HTTP headers list.","default":null,"x-example":null,"items":{"type":"string"}},"httpUser":{"type":"string","description":"Task HTTP user. Max length: 256 chars.","default":"","x-example":"[HTTP_USER]"},"httpPass":{"type":"string","description":"Task HTTP password. Max length: 256 chars.","default":"","x-example":"[HTTP_PASS]"}},"required":["name","status","schedule","security","httpMethod","httpUrl"]}}]}},"\/projects\/{projectId}\/tasks\/{taskId}":{"get":{"summary":"Get Task","operationId":"projectsGetTask","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Task","schema":{"$ref":"#\/definitions\/task"}}},"x-appwrite":{"method":"getTask","weight":122,"cookies":false,"type":"","demo":"projects\/get-task.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"taskId","description":"Task unique ID.","required":true,"type":"string","x-example":"[TASK_ID]","in":"path"}]},"put":{"summary":"Update Task","operationId":"projectsUpdateTask","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Task","schema":{"$ref":"#\/definitions\/task"}}},"x-appwrite":{"method":"updateTask","weight":123,"cookies":false,"type":"","demo":"projects\/update-task.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"taskId","description":"Task unique ID.","required":true,"type":"string","x-example":"[TASK_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Task name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"status":{"type":"string","description":"Task status.","default":null,"x-example":"play"},"schedule":{"type":"string","description":"Task schedule CRON syntax.","default":null,"x-example":null},"security":{"type":"boolean","description":"Certificate verification, false for disabled or true for enabled.","default":null,"x-example":false},"httpMethod":{"type":"string","description":"Task HTTP method.","default":null,"x-example":"GET"},"httpUrl":{"type":"string","description":"Task HTTP URL.","default":null,"x-example":"https:\/\/example.com"},"httpHeaders":{"type":"array","description":"Task HTTP headers list.","default":null,"x-example":null,"items":{"type":"string"}},"httpUser":{"type":"string","description":"Task HTTP user. Max length: 256 chars.","default":"","x-example":"[HTTP_USER]"},"httpPass":{"type":"string","description":"Task HTTP password. Max length: 256 chars.","default":"","x-example":"[HTTP_PASS]"}},"required":["name","status","schedule","security","httpMethod","httpUrl"]}}]},"delete":{"summary":"Delete Task","operationId":"projectsDeleteTask","consumes":["application\/json"],"produces":[],"tags":["projects"],"description":"","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteTask","weight":124,"cookies":false,"type":"","demo":"projects\/delete-task.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"taskId","description":"Task unique ID.","required":true,"type":"string","x-example":"[TASK_ID]","in":"path"}]}},"\/projects\/{projectId}\/usage":{"get":{"summary":"Get Project","operationId":"projectsGetUsage","consumes":["application\/json"],"produces":[],"tags":["projects"],"description":"","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getUsage","weight":104,"cookies":false,"type":"","demo":"projects\/get-usage.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"range","description":"Date range.","required":false,"type":"string","x-example":"24h","default":"30d","in":"query"}]}},"\/projects\/{projectId}\/webhooks":{"get":{"summary":"List Webhooks","operationId":"projectsListWebhooks","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Webhooks List","schema":{"$ref":"#\/definitions\/webhookList"}}},"x-appwrite":{"method":"listWebhooks","weight":111,"cookies":false,"type":"","demo":"projects\/list-webhooks.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"}]},"post":{"summary":"Create Webhook","operationId":"projectsCreateWebhook","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"201":{"description":"Webhook","schema":{"$ref":"#\/definitions\/webhook"}}},"x-appwrite":{"method":"createWebhook","weight":110,"cookies":false,"type":"","demo":"projects\/create-webhook.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Webhook name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"events":{"type":"array","description":"Events list.","default":null,"x-example":null,"items":{"type":"string"}},"url":{"type":"string","description":"Webhook URL.","default":null,"x-example":"https:\/\/example.com"},"security":{"type":"boolean","description":"Certificate verification, false for disabled or true for enabled.","default":null,"x-example":false},"httpUser":{"type":"string","description":"Webhook HTTP user. Max length: 256 chars.","default":"","x-example":"[HTTP_USER]"},"httpPass":{"type":"string","description":"Webhook HTTP password. Max length: 256 chars.","default":"","x-example":"[HTTP_PASS]"}},"required":["name","events","url","security"]}}]}},"\/projects\/{projectId}\/webhooks\/{webhookId}":{"get":{"summary":"Get Webhook","operationId":"projectsGetWebhook","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Webhook","schema":{"$ref":"#\/definitions\/webhook"}}},"x-appwrite":{"method":"getWebhook","weight":112,"cookies":false,"type":"","demo":"projects\/get-webhook.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"webhookId","description":"Webhook unique ID.","required":true,"type":"string","x-example":"[WEBHOOK_ID]","in":"path"}]},"put":{"summary":"Update Webhook","operationId":"projectsUpdateWebhook","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Webhook","schema":{"$ref":"#\/definitions\/webhook"}}},"x-appwrite":{"method":"updateWebhook","weight":113,"cookies":false,"type":"","demo":"projects\/update-webhook.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"webhookId","description":"Webhook unique ID.","required":true,"type":"string","x-example":"[WEBHOOK_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Webhook name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"events":{"type":"array","description":"Events list.","default":null,"x-example":null,"items":{"type":"string"}},"url":{"type":"string","description":"Webhook URL.","default":null,"x-example":"https:\/\/example.com"},"security":{"type":"boolean","description":"Certificate verification, false for disabled or true for enabled.","default":null,"x-example":false},"httpUser":{"type":"string","description":"Webhook HTTP user. Max length: 256 chars.","default":"","x-example":"[HTTP_USER]"},"httpPass":{"type":"string","description":"Webhook HTTP password. Max length: 256 chars.","default":"","x-example":"[HTTP_PASS]"}},"required":["name","events","url","security"]}}]},"delete":{"summary":"Delete Webhook","operationId":"projectsDeleteWebhook","consumes":["application\/json"],"produces":[],"tags":["projects"],"description":"","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteWebhook","weight":114,"cookies":false,"type":"","demo":"projects\/delete-webhook.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"webhookId","description":"Webhook unique ID.","required":true,"type":"string","x-example":"[WEBHOOK_ID]","in":"path"}]}},"\/storage\/files":{"get":{"summary":"List Files","operationId":"storageListFiles","consumes":["application\/json"],"produces":["application\/json"],"tags":["storage"],"description":"Get a list of all the user files. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project's files. [Learn more about different API modes](\/docs\/admin).","responses":{"200":{"description":"Files List","schema":{"$ref":"#\/definitions\/fileList"}}},"x-appwrite":{"method":"listFiles","weight":136,"cookies":false,"type":"","demo":"storage\/list-files.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/list-files.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Results offset. The default value is 0. Use this param to manage pagination.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create File","operationId":"storageCreateFile","consumes":["multipart\/form-data"],"produces":["application\/json"],"tags":["storage"],"description":"Create a new file. The user who creates the file will automatically be assigned to read and write access unless he has passed custom values for read and write arguments.","responses":{"201":{"description":"File","schema":{"$ref":"#\/definitions\/file"}}},"x-appwrite":{"method":"createFile","weight":135,"cookies":false,"type":"upload","demo":"storage\/create-file.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/create-file.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"file","description":"Binary file.","required":true,"type":"file","in":"formData"},{"name":"read","description":"An array of strings with read permissions. By default only the current user is granted with read permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","required":false,"type":"array","collectionFormat":"multi","items":{"type":"string"},"in":"formData"},{"name":"write","description":"An array of strings with write permissions. By default only the current user is granted with write permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","required":false,"type":"array","collectionFormat":"multi","items":{"type":"string"},"in":"formData"}]}},"\/storage\/files\/{fileId}":{"get":{"summary":"Get File","operationId":"storageGetFile","consumes":["application\/json"],"produces":["application\/json"],"tags":["storage"],"description":"Get a file by its unique ID. This endpoint response returns a JSON object with the file metadata.","responses":{"200":{"description":"File","schema":{"$ref":"#\/definitions\/file"}}},"x-appwrite":{"method":"getFile","weight":137,"cookies":false,"type":"","demo":"storage\/get-file.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/get-file.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"fileId","description":"File unique ID.","required":true,"type":"string","x-example":"[FILE_ID]","in":"path"}]},"put":{"summary":"Update File","operationId":"storageUpdateFile","consumes":["application\/json"],"produces":["application\/json"],"tags":["storage"],"description":"Update a file by its unique ID. Only users with write permissions have access to update this resource.","responses":{"200":{"description":"File","schema":{"$ref":"#\/definitions\/file"}}},"x-appwrite":{"method":"updateFile","weight":141,"cookies":false,"type":"","demo":"storage\/update-file.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/update-file.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"fileId","description":"File unique ID.","required":true,"type":"string","x-example":"[FILE_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"read":{"type":"array","description":"An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}},"write":{"type":"array","description":"An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}}},"required":["read","write"]}}]},"delete":{"summary":"Delete File","operationId":"storageDeleteFile","consumes":["application\/json"],"produces":[],"tags":["storage"],"description":"Delete a file by its unique ID. Only users with write permissions have access to delete this resource.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteFile","weight":142,"cookies":false,"type":"","demo":"storage\/delete-file.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/delete-file.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"fileId","description":"File unique ID.","required":true,"type":"string","x-example":"[FILE_ID]","in":"path"}]}},"\/storage\/files\/{fileId}\/download":{"get":{"summary":"Get File for Download","operationId":"storageGetFileDownload","consumes":["application\/json"],"produces":["*\/*"],"tags":["storage"],"description":"Get a file content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory.","responses":{"200":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getFileDownload","weight":139,"cookies":false,"type":"location","demo":"storage\/get-file-download.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/get-file-download.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"fileId","description":"File unique ID.","required":true,"type":"string","x-example":"[FILE_ID]","in":"path"}]}},"\/storage\/files\/{fileId}\/preview":{"get":{"summary":"Get File Preview","operationId":"storageGetFilePreview","consumes":["application\/json"],"produces":["image\/*"],"tags":["storage"],"description":"Get a file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets, will return the file icon image. You can also pass query string arguments for cutting and resizing your preview image.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getFilePreview","weight":138,"cookies":false,"type":"location","demo":"storage\/get-file-preview.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/get-file-preview.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"fileId","description":"File unique ID","required":true,"type":"string","x-example":"[FILE_ID]","in":"path"},{"name":"width","description":"Resize preview image width, Pass an integer between 0 to 4000.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"height","description":"Resize preview image height, Pass an integer between 0 to 4000.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"gravity","description":"Image crop gravity. Can be one of center,top-left,top,top-right,left,right,bottom-left,bottom,bottom-right","required":false,"type":"string","x-example":"center","default":"center","in":"query"},{"name":"quality","description":"Preview image quality. Pass an integer between 0 to 100. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"borderWidth","description":"Preview image border in pixels. Pass an integer between 0 to 100. Defaults to 0.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"borderColor","description":"Preview image border color. Use a valid HEX color, no # is needed for prefix.","required":false,"type":"string","default":"","in":"query"},{"name":"borderRadius","description":"Preview image border radius in pixels. Pass an integer between 0 to 4000.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"opacity","description":"Preview image opacity. Only works with images having an alpha channel (like png). Pass a number between 0 to 1.","required":false,"type":"number","format":"float","x-example":0,"default":1,"in":"query"},{"name":"rotation","description":"Preview image rotation in degrees. Pass an integer between 0 and 360.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"background","description":"Preview image background color. Only works with transparent images (png). Use a valid HEX color, no # is needed for prefix.","required":false,"type":"string","default":"","in":"query"},{"name":"output","description":"Output format type (jpeg, jpg, png, gif and webp).","required":false,"type":"string","x-example":"jpg","default":"","in":"query"}]}},"\/storage\/files\/{fileId}\/view":{"get":{"summary":"Get File for View","operationId":"storageGetFileView","consumes":["application\/json"],"produces":["*\/*"],"tags":["storage"],"description":"Get a file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header.","responses":{"200":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getFileView","weight":140,"cookies":false,"type":"location","demo":"storage\/get-file-view.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/get-file-view.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"fileId","description":"File unique ID.","required":true,"type":"string","x-example":"[FILE_ID]","in":"path"}]}},"\/teams":{"get":{"summary":"List Teams","operationId":"teamsList","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Get a list of all the current user teams. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project's teams. [Learn more about different API modes](\/docs\/admin).","responses":{"200":{"description":"Teams List","schema":{"$ref":"#\/definitions\/teamList"}}},"x-appwrite":{"method":"list","weight":144,"cookies":false,"type":"","demo":"teams\/list.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/list-teams.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Results offset. The default value is 0. Use this param to manage pagination.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create Team","operationId":"teamsCreate","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Create a new team. The user who creates the team will automatically be assigned as the owner of the team. The team owner can invite new members, who will be able add new owners and update or delete the team from your project.","responses":{"201":{"description":"Team","schema":{"$ref":"#\/definitions\/team"}}},"x-appwrite":{"method":"create","weight":143,"cookies":false,"type":"","demo":"teams\/create.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/create-team.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Team name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"roles":{"type":"array","description":"Array of strings. Use this param to set the roles in the team for the user who created it. The default role is **owner**. A role can be any string. Learn more about [roles and permissions](\/docs\/permissions). Max length for each role is 32 chars.","default":["owner"],"x-example":null,"items":{"type":"string"}}},"required":["name"]}}]}},"\/teams\/{teamId}":{"get":{"summary":"Get Team","operationId":"teamsGet","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Get a team by its unique ID. All team members have read access for this resource.","responses":{"200":{"description":"Team","schema":{"$ref":"#\/definitions\/team"}}},"x-appwrite":{"method":"get","weight":145,"cookies":false,"type":"","demo":"teams\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/get-team.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team unique ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"}]},"put":{"summary":"Update Team","operationId":"teamsUpdate","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Update a team by its unique ID. Only team owners have write access for this resource.","responses":{"200":{"description":"Team","schema":{"$ref":"#\/definitions\/team"}}},"x-appwrite":{"method":"update","weight":146,"cookies":false,"type":"","demo":"teams\/update.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/update-team.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team unique ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Team name. Max length: 128 chars.","default":null,"x-example":"[NAME]"}},"required":["name"]}}]},"delete":{"summary":"Delete Team","operationId":"teamsDelete","consumes":["application\/json"],"produces":[],"tags":["teams"],"description":"Delete a team by its unique ID. Only team owners have write access for this resource.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"delete","weight":147,"cookies":false,"type":"","demo":"teams\/delete.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/delete-team.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team unique ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"}]}},"\/teams\/{teamId}\/memberships":{"get":{"summary":"Get Team Memberships","operationId":"teamsGetMemberships","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Get a team members by the team unique ID. All team members have read access for this list of resources.","responses":{"200":{"description":"Memberships List","schema":{"$ref":"#\/definitions\/membershipList"}}},"x-appwrite":{"method":"getMemberships","weight":150,"cookies":false,"type":"","demo":"teams\/get-memberships.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/get-team-members.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team unique ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"},{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Results offset. The default value is 0. Use this param to manage pagination.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create Team Membership","operationId":"teamsCreateMembership","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Use this endpoint to invite a new member to join your team. If initiated from Client SDK, an email with a link to join the team will be sent to the new member's email address if the member doesn't exist in the project it will be created automatically. If initiated from server side SDKs, new member will automatically be added to the team.\n\nUse the 'URL' parameter to redirect the user from the invitation email back to your app. When the user is redirected, use the [Update Team Membership Status](\/docs\/client\/teams#teamsUpdateMembershipStatus) endpoint to allow the user to accept the invitation to the team. While calling from side SDKs the redirect url can be empty string.\n\nPlease note that in order to avoid a [Redirect Attacks](https:\/\/github.com\/OWASP\/CheatSheetSeries\/blob\/master\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URL's are the once from domains you have set when added your platforms in the console interface.","responses":{"201":{"description":"Membership","schema":{"$ref":"#\/definitions\/membership"}}},"x-appwrite":{"method":"createMembership","weight":148,"cookies":false,"type":"","demo":"teams\/create-membership.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/create-team-membership.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team unique ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"email":{"type":"string","description":"New team member email.","default":null,"x-example":"email@example.com"},"roles":{"type":"array","description":"Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](\/docs\/permissions). Max length for each role is 32 chars.","default":null,"x-example":null,"items":{"type":"string"}},"url":{"type":"string","description":"URL to redirect the user back to your app from the invitation email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.","default":null,"x-example":"https:\/\/example.com"},"name":{"type":"string","description":"New team member name. Max length: 128 chars.","default":"","x-example":"[NAME]"}},"required":["email","roles","url"]}}]}},"\/teams\/{teamId}\/memberships\/{membershipId}":{"patch":{"summary":"Update Membership Roles","operationId":"teamsUpdateMembershipRoles","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"","responses":{"200":{"description":"Membership","schema":{"$ref":"#\/definitions\/membership"}}},"x-appwrite":{"method":"updateMembershipRoles","weight":149,"cookies":false,"type":"","demo":"teams\/update-membership-roles.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/update-team-membership-roles.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team unique ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"},{"name":"membershipId","description":"Membership ID.","required":true,"type":"string","x-example":"[MEMBERSHIP_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"roles":{"type":"array","description":"Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](\/docs\/permissions). Max length for each role is 32 chars.","default":null,"x-example":null,"items":{"type":"string"}}},"required":["roles"]}}]},"delete":{"summary":"Delete Team Membership","operationId":"teamsDeleteMembership","consumes":["application\/json"],"produces":[],"tags":["teams"],"description":"This endpoint allows a user to leave a team or for a team owner to delete the membership of any other team member. You can also use this endpoint to delete a user membership even if it is not accepted.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteMembership","weight":152,"cookies":false,"type":"","demo":"teams\/delete-membership.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/delete-team-membership.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team unique ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"},{"name":"membershipId","description":"Membership ID.","required":true,"type":"string","x-example":"[MEMBERSHIP_ID]","in":"path"}]}},"\/teams\/{teamId}\/memberships\/{membershipId}\/status":{"patch":{"summary":"Update Team Membership Status","operationId":"teamsUpdateMembershipStatus","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Use this endpoint to allow a user to accept an invitation to join a team after being redirected back to your app from the invitation email recieved by the user.","responses":{"200":{"description":"Membership","schema":{"$ref":"#\/definitions\/membership"}}},"x-appwrite":{"method":"updateMembershipStatus","weight":151,"cookies":false,"type":"","demo":"teams\/update-membership-status.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/update-team-membership-status.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"public","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team unique ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"},{"name":"membershipId","description":"Membership ID.","required":true,"type":"string","x-example":"[MEMBERSHIP_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"userId":{"type":"string","description":"User unique ID.","default":null,"x-example":"[USER_ID]"},"secret":{"type":"string","description":"Secret key.","default":null,"x-example":"[SECRET]"}},"required":["userId","secret"]}}]}},"\/users":{"get":{"summary":"List Users","operationId":"usersList","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Get a list of all the project's users. You can use the query params to filter your results.","responses":{"200":{"description":"Users List","schema":{"$ref":"#\/definitions\/userList"}}},"x-appwrite":{"method":"list","weight":154,"cookies":false,"type":"","demo":"users\/list.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/list-users.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Results offset. The default value is 0. Use this param to manage pagination.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create User","operationId":"usersCreate","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Create a new user.","responses":{"201":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"create","weight":153,"cookies":false,"type":"","demo":"users\/create.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/create-user.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"email":{"type":"string","description":"User email.","default":null,"x-example":"email@example.com"},"password":{"type":"string","description":"User password. Must be between 6 to 32 chars.","default":null,"x-example":"password"},"name":{"type":"string","description":"User name. Max length: 128 chars.","default":"","x-example":"[NAME]"}},"required":["email","password"]}}]}},"\/users\/{userId}":{"get":{"summary":"Get User","operationId":"usersGet","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Get a user by its unique ID.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"get","weight":155,"cookies":false,"type":"","demo":"users\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/get-user.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"}]},"delete":{"summary":"Delete User","operationId":"usersDelete","consumes":["application\/json"],"produces":[],"tags":["users"],"description":"Delete a user by its unique ID.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"delete","weight":167,"cookies":false,"type":"","demo":"users\/delete.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/delete.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"}]}},"\/users\/{userId}\/email":{"patch":{"summary":"Update Email","operationId":"usersUpdateEmail","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Update the user email by its unique ID.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updateEmail","weight":163,"cookies":false,"type":"","demo":"users\/update-email.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/update-user-email.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"email":{"type":"string","description":"User email.","default":null,"x-example":"email@example.com"}},"required":["email"]}}]}},"\/users\/{userId}\/logs":{"get":{"summary":"Get User Logs","operationId":"usersGetLogs","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Get a user activity logs list by its unique ID.","responses":{"200":{"description":"Logs List","schema":{"$ref":"#\/definitions\/logList"}}},"x-appwrite":{"method":"getLogs","weight":158,"cookies":false,"type":"","demo":"users\/get-logs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/get-user-logs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"}]}},"\/users\/{userId}\/name":{"patch":{"summary":"Update Name","operationId":"usersUpdateName","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Update the user name by its unique ID.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updateName","weight":161,"cookies":false,"type":"","demo":"users\/update-name.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/update-user-name.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"User name. Max length: 128 chars.","default":null,"x-example":"[NAME]"}},"required":["name"]}}]}},"\/users\/{userId}\/password":{"patch":{"summary":"Update Password","operationId":"usersUpdatePassword","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Update the user password by its unique ID.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updatePassword","weight":162,"cookies":false,"type":"","demo":"users\/update-password.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/update-user-password.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"password":{"type":"string","description":"New user password. Must be between 6 to 32 chars.","default":null,"x-example":"password"}},"required":["password"]}}]}},"\/users\/{userId}\/prefs":{"get":{"summary":"Get User Preferences","operationId":"usersGetPrefs","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Get the user preferences by its unique ID.","responses":{"200":{"description":"Preferences","schema":{"$ref":"#\/definitions\/preferences"}}},"x-appwrite":{"method":"getPrefs","weight":156,"cookies":false,"type":"","demo":"users\/get-prefs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/get-user-prefs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"}]},"patch":{"summary":"Update User Preferences","operationId":"usersUpdatePrefs","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Update the user preferences by its unique ID. You can pass only the specific settings you wish to update.","responses":{"200":{"description":"Preferences","schema":{"$ref":"#\/definitions\/preferences"}}},"x-appwrite":{"method":"updatePrefs","weight":164,"cookies":false,"type":"","demo":"users\/update-prefs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/update-user-prefs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"prefs":{"type":"object","description":"Prefs key-value JSON object.","default":null,"x-example":"{}"}},"required":["prefs"]}}]}},"\/users\/{userId}\/sessions":{"get":{"summary":"Get User Sessions","operationId":"usersGetSessions","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Get the user sessions list by its unique ID.","responses":{"200":{"description":"Sessions List","schema":{"$ref":"#\/definitions\/sessionList"}}},"x-appwrite":{"method":"getSessions","weight":157,"cookies":false,"type":"","demo":"users\/get-sessions.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/get-user-sessions.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"}]},"delete":{"summary":"Delete User Sessions","operationId":"usersDeleteSessions","consumes":["application\/json"],"produces":[],"tags":["users"],"description":"Delete all user's sessions by using the user's unique ID.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteSessions","weight":166,"cookies":false,"type":"","demo":"users\/delete-sessions.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/delete-user-sessions.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"}]}},"\/users\/{userId}\/sessions\/{sessionId}":{"delete":{"summary":"Delete User Session","operationId":"usersDeleteSession","consumes":["application\/json"],"produces":[],"tags":["users"],"description":"Delete a user sessions by its unique ID.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteSession","weight":165,"cookies":false,"type":"","demo":"users\/delete-session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/delete-user-session.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"},{"name":"sessionId","description":"User unique session ID.","required":true,"type":"string","x-example":"[SESSION_ID]","in":"path"}]}},"\/users\/{userId}\/status":{"patch":{"summary":"Update User Status","operationId":"usersUpdateStatus","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Update the user status by its unique ID.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updateStatus","weight":159,"cookies":false,"type":"","demo":"users\/update-status.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/update-user-status.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"status":{"type":"integer","description":"User Status code. To activate the user pass 1, to block the user pass 2 and for disabling the user pass 0","default":null,"x-example":1}},"required":["status"]}}]}},"\/users\/{userId}\/verification":{"patch":{"summary":"Update Email Verification","operationId":"usersUpdateVerification","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Update the user email verification status by its unique ID.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updateVerification","weight":160,"cookies":false,"type":"","demo":"users\/update-verification.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/update-user-verification.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"emailVerification":{"type":"boolean","description":"User Email Verification Status.","default":null,"x-example":false}},"required":["emailVerification"]}}]}}},"tags":[{"name":"account","description":"The Account service allows you to authenticate and manage a user account."},{"name":"avatars","description":"The Avatars service aims to help you complete everyday tasks related to your app image, icons, and avatars."},{"name":"database","description":"The Database service allows you to create structured collections of documents, query and filter lists of documents"},{"name":"locale","description":"The Locale service allows you to customize your app based on your users' location."},{"name":"health","description":"The Health service allows you to both validate and monitor your Appwrite server's health."},{"name":"projects","description":"The Project service allows you to manage all the projects in your Appwrite server."},{"name":"storage","description":"The Storage service allows you to manage your project files."},{"name":"teams","description":"The Teams service allows you to group users of your project and to enable them to share read and write access to your project resources"},{"name":"users","description":"The Users service allows you to manage your project users."},{"name":"functions","description":"The Functions Service allows you view, create and manage your Cloud Functions."}],"definitions":{"collectionList":{"description":"Collections List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"collections":{"type":"array","description":"List of collections.","items":{"type":"object","$ref":"#\/definitions\/collection"},"x-example":""}},"required":["sum","collections"]},"documentList":{"description":"Documents List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"documents":{"type":"array","description":"List of documents.","items":{"type":"object","$ref":"#\/definitions\/document"},"x-example":""}},"required":["sum","documents"]},"userList":{"description":"Users List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"users":{"type":"array","description":"List of users.","items":{"type":"object","$ref":"#\/definitions\/user"},"x-example":""}},"required":["sum","users"]},"sessionList":{"description":"Sessions List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"sessions":{"type":"array","description":"List of sessions.","items":{"type":"object","$ref":"#\/definitions\/session"},"x-example":""}},"required":["sum","sessions"]},"logList":{"description":"Logs List","type":"object","properties":{"logs":{"type":"array","description":"List of logs.","items":{"type":"object","$ref":"#\/definitions\/log"},"x-example":""}},"required":["logs"]},"fileList":{"description":"Files List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"files":{"type":"array","description":"List of files.","items":{"type":"object","$ref":"#\/definitions\/file"},"x-example":""}},"required":["sum","files"]},"teamList":{"description":"Teams List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"teams":{"type":"array","description":"List of teams.","items":{"type":"object","$ref":"#\/definitions\/team"},"x-example":""}},"required":["sum","teams"]},"membershipList":{"description":"Memberships List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"memberships":{"type":"array","description":"List of memberships.","items":{"type":"object","$ref":"#\/definitions\/membership"},"x-example":""}},"required":["sum","memberships"]},"functionList":{"description":"Functions List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"functions":{"type":"array","description":"List of functions.","items":{"type":"object","$ref":"#\/definitions\/function"},"x-example":""}},"required":["sum","functions"]},"tagList":{"description":"Tags List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"tags":{"type":"array","description":"List of tags.","items":{"type":"object","$ref":"#\/definitions\/tag"},"x-example":""}},"required":["sum","tags"]},"executionList":{"description":"Executions List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"executions":{"type":"array","description":"List of executions.","items":{"type":"object","$ref":"#\/definitions\/execution"},"x-example":""}},"required":["sum","executions"]},"projectList":{"description":"Projects List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"projects":{"type":"array","description":"List of projects.","items":{"type":"object","$ref":"#\/definitions\/project"},"x-example":""}},"required":["sum","projects"]},"webhookList":{"description":"Webhooks List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"webhooks":{"type":"array","description":"List of webhooks.","items":{"type":"object","$ref":"#\/definitions\/webhook"},"x-example":""}},"required":["sum","webhooks"]},"keyList":{"description":"API Keys List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"keys":{"type":"array","description":"List of keys.","items":{"type":"object","$ref":"#\/definitions\/key"},"x-example":""}},"required":["sum","keys"]},"taskList":{"description":"Tasks List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"tasks":{"type":"array","description":"List of tasks.","items":{"type":"object","$ref":"#\/definitions\/task"},"x-example":""}},"required":["sum","tasks"]},"platformList":{"description":"Platforms List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"platforms":{"type":"array","description":"List of platforms.","items":{"type":"object","$ref":"#\/definitions\/platform"},"x-example":""}},"required":["sum","platforms"]},"domainList":{"description":"Domains List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"domains":{"type":"array","description":"List of domains.","items":{"type":"object","$ref":"#\/definitions\/domain"},"x-example":""}},"required":["sum","domains"]},"countryList":{"description":"Countries List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"countries":{"type":"array","description":"List of countries.","items":{"type":"object","$ref":"#\/definitions\/country"},"x-example":""}},"required":["sum","countries"]},"continentList":{"description":"Continents List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"continents":{"type":"array","description":"List of continents.","items":{"type":"object","$ref":"#\/definitions\/continent"},"x-example":""}},"required":["sum","continents"]},"languageList":{"description":"Languages List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"languages":{"type":"array","description":"List of languages.","items":{"type":"object","$ref":"#\/definitions\/language"},"x-example":""}},"required":["sum","languages"]},"currencyList":{"description":"Currencies List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"currencies":{"type":"array","description":"List of currencies.","items":{"type":"object","$ref":"#\/definitions\/currency"},"x-example":""}},"required":["sum","currencies"]},"phoneList":{"description":"Phones List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"phones":{"type":"array","description":"List of phones.","items":{"type":"object","$ref":"#\/definitions\/phone"},"x-example":""}},"required":["sum","phones"]},"permissions":{"description":"Permissions","type":"object","properties":{"read":{"type":"array","description":"Read permissions.","items":{"type":"string"},"x-example":"user:5e5ea5c16897e"},"write":{"type":"array","description":"Write permissions.","items":{"type":"string"},"x-example":"user:5e5ea5c16897e"}},"required":["read","write"]},"collection":{"description":"Collection","type":"object","properties":{"$id":{"type":"string","description":"Collection ID.","x-example":"5e5ea5c16897e"},"$permissions":{"type":"object","description":"Collection permissions.","x-example":{},"items":{"type":"object","$ref":"#\/definitions\/permissions"}},"name":{"type":"string","description":"Collection name.","x-example":"Movies"},"dateCreated":{"type":"integer","description":"Collection creation date in Unix timestamp.","x-example":1592981250,"format":"int32"},"dateUpdated":{"type":"integer","description":"Collection creation date in Unix timestamp.","x-example":1592981550,"format":"int32"},"rules":{"type":"array","description":"Collection rules.","items":{"type":"object","$ref":"#\/definitions\/rule"},"x-example":""}},"required":["$id","$permissions","name","dateCreated","dateUpdated","rules"]},"document":{"description":"Document","type":"object","properties":{"$id":{"type":"string","description":"Document ID.","x-example":"5e5ea5c16897e"},"$collection":{"type":"string","description":"Collection ID.","x-example":"5e5ea5c15117e"},"$permissions":{"type":"object","description":"Document permissions.","x-example":{},"items":{"type":"object","$ref":"#\/definitions\/permissions"}}},"additionalProperties":true,"required":["$id","$collection","$permissions"]},"rule":{"description":"Rule","type":"object","properties":{"$id":{"type":"string","description":"Rule ID.","x-example":"5e5ea5c16897e"},"$collection":{"type":"string","description":"Rule Collection.","x-example":"5e5e66c16897e"},"type":{"type":"string","description":"Rule type. Possible values: ","x-example":"title"},"key":{"type":"string","description":"Rule key.","x-example":"title"},"label":{"type":"string","description":"Rule label.","x-example":"Title"},"default":{"type":"string","description":"Rule default value.","x-example":"Movie Name"},"array":{"type":"boolean","description":"Is array?","x-example":false},"required":{"type":"boolean","description":"Is required?","x-example":true},"list":{"type":"array","description":"List of allowed values","items":{"type":"string"},"x-example":"5e5ea5c168099"}},"required":["$id","$collection","type","key","label","default","array","required","list"]},"log":{"description":"Log","type":"object","properties":{"event":{"type":"string","description":"Event name.","x-example":"account.sessions.create"},"ip":{"type":"string","description":"IP session in use when the session was created.","x-example":"127.0.0.1"},"time":{"type":"integer","description":"Log creation time in Unix timestamp.","x-example":1592981250,"format":"int32"},"osCode":{"type":"string","description":"Operating system code name. View list of [available options](https:\/\/github.com\/appwrite\/appwrite\/blob\/master\/docs\/lists\/os.json).","x-example":"Mac"},"osName":{"type":"string","description":"Operating system name.","x-example":"Mac"},"osVersion":{"type":"string","description":"Operating system version.","x-example":"Mac"},"clientType":{"type":"string","description":"Client type.","x-example":"browser"},"clientCode":{"type":"string","description":"Client code name. View list of [available options](https:\/\/github.com\/appwrite\/appwrite\/blob\/master\/docs\/lists\/clients.json).","x-example":"CM"},"clientName":{"type":"string","description":"Client name.","x-example":"Chrome Mobile iOS"},"clientVersion":{"type":"string","description":"Client version.","x-example":"84.0"},"clientEngine":{"type":"string","description":"Client engine name.","x-example":"WebKit"},"clientEngineVersion":{"type":"string","description":"Client engine name.","x-example":"605.1.15"},"deviceName":{"type":"string","description":"Device name.","x-example":"smartphone"},"deviceBrand":{"type":"string","description":"Device brand name.","x-example":"Google"},"deviceModel":{"type":"string","description":"Device model name.","x-example":"Nexus 5"},"countryCode":{"type":"string","description":"Country two-character ISO 3166-1 alpha code.","x-example":"US"},"countryName":{"type":"string","description":"Country name.","x-example":"United States"}},"required":["event","ip","time","osCode","osName","osVersion","clientType","clientCode","clientName","clientVersion","clientEngine","clientEngineVersion","deviceName","deviceBrand","deviceModel","countryCode","countryName"]},"user":{"description":"User","type":"object","properties":{"$id":{"type":"string","description":"User ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"User name.","x-example":"John Doe"},"registration":{"type":"integer","description":"User registration date in Unix timestamp.","x-example":1592981250,"format":"int32"},"status":{"type":"integer","description":"User status. 0 for Unactivated, 1 for active and 2 is blocked.","x-example":0,"format":"int32"},"passwordUpdate":{"type":"integer","description":"Unix timestamp of the most recent password update","x-example":1592981250,"format":"int32"},"email":{"type":"string","description":"User email address.","x-example":"john@appwrite.io"},"emailVerification":{"type":"boolean","description":"Email verification status.","x-example":true},"prefs":{"type":"object","description":"User preferences as a key-value object","x-example":{"theme":"pink","timezone":"UTC"},"items":{"type":"object","$ref":"#\/definitions\/preferences"}}},"required":["$id","name","registration","status","passwordUpdate","email","emailVerification","prefs"]},"preferences":{"description":"Preferences","type":"object","additionalProperties":true},"session":{"description":"Session","type":"object","properties":{"$id":{"type":"string","description":"Session ID.","x-example":"5e5ea5c16897e"},"userId":{"type":"string","description":"User ID.","x-example":"5e5bb8c16897e"},"expire":{"type":"integer","description":"Session expiration date in Unix timestamp.","x-example":1592981250,"format":"int32"},"provider":{"type":"string","description":"Session Provider.","x-example":"email"},"providerUid":{"type":"string","description":"Session Provider User ID.","x-example":"user@example.com"},"providerToken":{"type":"string","description":"Session Provider Token.","x-example":"MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3"},"ip":{"type":"string","description":"IP in use when the session was created.","x-example":"127.0.0.1"},"osCode":{"type":"string","description":"Operating system code name. View list of [available options](https:\/\/github.com\/appwrite\/appwrite\/blob\/master\/docs\/lists\/os.json).","x-example":"Mac"},"osName":{"type":"string","description":"Operating system name.","x-example":"Mac"},"osVersion":{"type":"string","description":"Operating system version.","x-example":"Mac"},"clientType":{"type":"string","description":"Client type.","x-example":"browser"},"clientCode":{"type":"string","description":"Client code name. View list of [available options](https:\/\/github.com\/appwrite\/appwrite\/blob\/master\/docs\/lists\/clients.json).","x-example":"CM"},"clientName":{"type":"string","description":"Client name.","x-example":"Chrome Mobile iOS"},"clientVersion":{"type":"string","description":"Client version.","x-example":"84.0"},"clientEngine":{"type":"string","description":"Client engine name.","x-example":"WebKit"},"clientEngineVersion":{"type":"string","description":"Client engine name.","x-example":"605.1.15"},"deviceName":{"type":"string","description":"Device name.","x-example":"smartphone"},"deviceBrand":{"type":"string","description":"Device brand name.","x-example":"Google"},"deviceModel":{"type":"string","description":"Device model name.","x-example":"Nexus 5"},"countryCode":{"type":"string","description":"Country two-character ISO 3166-1 alpha code.","x-example":"US"},"countryName":{"type":"string","description":"Country name.","x-example":"United States"},"current":{"type":"boolean","description":"Returns true if this the current user session.","x-example":true}},"required":["$id","userId","expire","provider","providerUid","providerToken","ip","osCode","osName","osVersion","clientType","clientCode","clientName","clientVersion","clientEngine","clientEngineVersion","deviceName","deviceBrand","deviceModel","countryCode","countryName","current"]},"token":{"description":"Token","type":"object","properties":{"$id":{"type":"string","description":"Token ID.","x-example":"bb8ea5c16897e"},"userId":{"type":"string","description":"User ID.","x-example":"5e5ea5c168bb8"},"secret":{"type":"string","description":"Token secret key. This will return an empty string unless the response is returned using an API key or as part of a webhook payload.","x-example":""},"expire":{"type":"integer","description":"Token expiration date in Unix timestamp.","x-example":1592981250,"format":"int32"}},"required":["$id","userId","secret","expire"]},"jwt":{"description":"JWT","type":"object","properties":{"jwt":{"type":"string","description":"JWT encoded string.","x-example":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"}},"required":["jwt"]},"locale":{"description":"Locale","type":"object","properties":{"ip":{"type":"string","description":"User IP address.","x-example":"127.0.0.1"},"countryCode":{"type":"string","description":"Country code in [ISO 3166-1](http:\/\/en.wikipedia.org\/wiki\/ISO_3166-1) two-character format","x-example":"US"},"country":{"type":"string","description":"Country name. This field support localization.","x-example":"United States"},"continentCode":{"type":"string","description":"Continent code. A two character continent code \"AF\" for Africa, \"AN\" for Antarctica, \"AS\" for Asia, \"EU\" for Europe, \"NA\" for North America, \"OC\" for Oceania, and \"SA\" for South America.","x-example":"NA"},"continent":{"type":"string","description":"Continent name. This field support localization.","x-example":"North America"},"eu":{"type":"boolean","description":"True if country is part of the Europian Union.","x-example":false},"currency":{"type":"string","description":"Currency code in [ISO 4217-1](http:\/\/en.wikipedia.org\/wiki\/ISO_4217) three-character format","x-example":"USD"}},"required":["ip","countryCode","country","continentCode","continent","eu","currency"]},"file":{"description":"File","type":"object","properties":{"$id":{"type":"string","description":"File ID.","x-example":"5e5ea5c16897e"},"$permissions":{"type":"object","description":"File permissions.","x-example":{},"items":{"type":"object","$ref":"#\/definitions\/permissions"}},"name":{"type":"string","description":"File name.","x-example":"Pink.png"},"dateCreated":{"type":"integer","description":"File creation date in Unix timestamp.","x-example":1592981250,"format":"int32"},"signature":{"type":"string","description":"File MD5 signature.","x-example":"5d529fd02b544198ae075bd57c1762bb"},"mimeType":{"type":"string","description":"File mime type.","x-example":"image\/png"},"sizeOriginal":{"type":"integer","description":"File original size in bytes.","x-example":17890,"format":"int32"}},"required":["$id","$permissions","name","dateCreated","signature","mimeType","sizeOriginal"]},"team":{"description":"Team","type":"object","properties":{"$id":{"type":"string","description":"Team ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"Team name.","x-example":"VIP"},"dateCreated":{"type":"integer","description":"Team creation date in Unix timestamp.","x-example":1592981250,"format":"int32"},"sum":{"type":"integer","description":"Total sum of team members.","x-example":7,"format":"int32"}},"required":["$id","name","dateCreated","sum"]},"membership":{"description":"Membership","type":"object","properties":{"$id":{"type":"string","description":"Membership ID.","x-example":"5e5ea5c16897e"},"userId":{"type":"string","description":"User ID.","x-example":"5e5ea5c16897e"},"teamId":{"type":"string","description":"Team ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"User name.","x-example":"VIP"},"email":{"type":"string","description":"User email address.","x-example":"john@appwrite.io"},"invited":{"type":"integer","description":"Date, the user has been invited to join the team in Unix timestamp.","x-example":1592981250,"format":"int32"},"joined":{"type":"integer","description":"Date, the user has accepted the invitation to join the team in Unix timestamp.","x-example":1592981250,"format":"int32"},"confirm":{"type":"boolean","description":"User confirmation status, true if the user has joined the team or false otherwise.","x-example":false},"roles":{"type":"array","description":"User list of roles","items":{"type":"string"},"x-example":"admin"}},"required":["$id","userId","teamId","name","email","invited","joined","confirm","roles"]},"function":{"description":"Function","type":"object","properties":{"$id":{"type":"string","description":"Function ID.","x-example":"5e5ea5c16897e"},"$permissions":{"type":"object","description":"Function permissions.","x-example":{},"items":{"type":"object","$ref":"#\/definitions\/permissions"}},"name":{"type":"string","description":"Function name.","x-example":"My Function"},"dateCreated":{"type":"integer","description":"Function creation date in Unix timestamp.","x-example":1592981250,"format":"int32"},"dateUpdated":{"type":"integer","description":"Function update date in Unix timestamp.","x-example":1592981257,"format":"int32"},"status":{"type":"string","description":"Function status. Possible values: disabled, enabled","x-example":"enabled"},"runtime":{"type":"string","description":"Function execution runtime.","x-example":"python-3.8"},"tag":{"type":"string","description":"Function active tag ID.","x-example":"5e5ea5c16897e"},"vars":{"type":"string","description":"Function environment variables.","x-example":{"key":"value"}},"events":{"type":"array","description":"Function trigger events.","items":{"type":"string"},"x-example":"account.create"},"schedule":{"type":"string","description":"Function execution schedult in CRON format.","x-example":"5 4 * * *"},"scheduleNext":{"type":"integer","description":"Function next scheduled execution date in Unix timestamp.","x-example":1592981292,"format":"int32"},"schedulePrevious":{"type":"integer","description":"Function next scheduled execution date in Unix timestamp.","x-example":1592981237,"format":"int32"},"timeout":{"type":"integer","description":"Function execution timeout in seconds.","x-example":1592981237,"format":"int32"}},"required":["$id","$permissions","name","dateCreated","dateUpdated","status","runtime","tag","vars","events","schedule","scheduleNext","schedulePrevious","timeout"]},"tag":{"description":"Tag","type":"object","properties":{"$id":{"type":"string","description":"Tag ID.","x-example":"5e5ea5c16897e"},"functionId":{"type":"string","description":"Function ID.","x-example":"5e5ea6g16897e"},"dateCreated":{"type":"integer","description":"The tag creation date in Unix timestamp.","x-example":1592981250,"format":"int32"},"command":{"type":"string","description":"The entrypoint command in use to execute the tag code.","x-example":"enabled"},"size":{"type":"string","description":"The code size in bytes.","x-example":"python-3.8"}},"required":["$id","functionId","dateCreated","command","size"]},"execution":{"description":"Execution","type":"object","properties":{"$id":{"type":"string","description":"Execution ID.","x-example":"5e5ea5c16897e"},"$permissions":{"type":"object","description":"Execution permissions.","x-example":{},"items":{"type":"object","$ref":"#\/definitions\/permissions"}},"functionId":{"type":"string","description":"Function ID.","x-example":"5e5ea6g16897e"},"dateCreated":{"type":"integer","description":"The execution creation date in Unix timestamp.","x-example":1592981250,"format":"int32"},"trigger":{"type":"string","description":"The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`.","x-example":"http"},"status":{"type":"string","description":"The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`.","x-example":"processing"},"exitCode":{"type":"integer","description":"The script exit code.","x-example":0,"format":"int32"},"stdout":{"type":"string","description":"The script stdout output string. Logs the last 4,000 characters of the execution stdout output.","x-example":""},"stderr":{"type":"string","description":"The script stderr output string. Logs the last 4,000 characters of the execution stderr output","x-example":""},"time":{"type":"number","description":"The script execution time in seconds.","x-example":0.4,"format":"float"}},"required":["$id","$permissions","functionId","dateCreated","trigger","status","exitCode","stdout","stderr","time"]},"project":{"description":"Project","type":"object","properties":{"$id":{"type":"string","description":"Project ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"Project name.","x-example":"New Project"},"description":{"type":"string","description":"Project description.","x-example":"This is a new project."},"teamId":{"type":"string","description":"Project team ID.","x-example":"1592981250"},"logo":{"type":"string","description":"Project logo file ID.","x-example":"5f5c451b403cb"},"url":{"type":"string","description":"Project website URL.","x-example":"5f5c451b403cb"},"legalName":{"type":"string","description":"Company legal name.","x-example":"Company LTD."},"legalCountry":{"type":"string","description":"Country code in [ISO 3166-1](http:\/\/en.wikipedia.org\/wiki\/ISO_3166-1) two-character format.","x-example":"US"},"legalState":{"type":"string","description":"State name.","x-example":"New York"},"legalCity":{"type":"string","description":"City name.","x-example":"New York City."},"legalAddress":{"type":"string","description":"Company Address.","x-example":"620 Eighth Avenue, New York, NY 10018"},"legalTaxId":{"type":"string","description":"Company Tax ID.","x-example":"131102020"},"usersAuthLimit":{"type":"integer","description":"Max users allowed. 0 is unlimited.","x-example":100,"format":"int32"},"platforms":{"type":"array","description":"List of Platforms.","items":{"type":"object","$ref":"#\/definitions\/platform"},"x-example":{}},"webhooks":{"type":"array","description":"List of Webhooks.","items":{"type":"object","$ref":"#\/definitions\/webhook"},"x-example":{}},"keys":{"type":"array","description":"List of API Keys.","items":{"type":"object","$ref":"#\/definitions\/key"},"x-example":{}},"domains":{"type":"array","description":"List of Domains.","items":{"type":"object","$ref":"#\/definitions\/domain"},"x-example":{}},"tasks":{"type":"array","description":"List of Tasks.","items":{"type":"object","$ref":"#\/definitions\/task"},"x-example":{}},"usersOauth2AmazonAppid":{"type":"string","description":"Amazon OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2AmazonSecret":{"type":"string","description":"Amazon OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2AppleAppid":{"type":"string","description":"Apple OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2AppleSecret":{"type":"string","description":"Apple OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2BitbucketAppid":{"type":"string","description":"BitBucket OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2BitbucketSecret":{"type":"string","description":"BitBucket OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2BitlyAppid":{"type":"string","description":"Bitly OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2BitlySecret":{"type":"string","description":"Bitly OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2BoxAppid":{"type":"string","description":"Box OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2BoxSecret":{"type":"string","description":"Box OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2DiscordAppid":{"type":"string","description":"Discord OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2DiscordSecret":{"type":"string","description":"Discord OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2DropboxAppid":{"type":"string","description":"Dropbox OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2DropboxSecret":{"type":"string","description":"Dropbox OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2FacebookAppid":{"type":"string","description":"Facebook OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2FacebookSecret":{"type":"string","description":"Facebook OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2GithubAppid":{"type":"string","description":"GitHub OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2GithubSecret":{"type":"string","description":"GitHub OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2GitlabAppid":{"type":"string","description":"GitLab OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2GitlabSecret":{"type":"string","description":"GitLab OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2GoogleAppid":{"type":"string","description":"Google OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2GoogleSecret":{"type":"string","description":"Google OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2LinkedinAppid":{"type":"string","description":"LinkedIn OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2LinkedinSecret":{"type":"string","description":"LinkedIn OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2MicrosoftAppid":{"type":"string","description":"Microsoft OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2MicrosoftSecret":{"type":"string","description":"Microsoft OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2PaypalAppid":{"type":"string","description":"PayPal OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2PaypalSecret":{"type":"string","description":"PayPal OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2PaypalSandboxAppid":{"type":"string","description":"PayPal OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2PaypalSandboxSecret":{"type":"string","description":"PayPal OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2SalesforceAppid":{"type":"string","description":"Salesforce OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2SalesforceSecret":{"type":"string","description":"Salesforce OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2SlackAppid":{"type":"string","description":"Slack OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2SlackSecret":{"type":"string","description":"Slack OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2SpotifyAppid":{"type":"string","description":"Spotify OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2SpotifySecret":{"type":"string","description":"Spotify OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2TradeshiftAppid":{"type":"string","description":"Tradeshift OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2TradeshiftSecret":{"type":"string","description":"Tradeshift OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2TradeshiftBoxAppid":{"type":"string","description":"Tradeshift OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2TradeshiftBoxSecret":{"type":"string","description":"Tradeshift OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2TwitchAppid":{"type":"string","description":"Twitch OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2TwitchSecret":{"type":"string","description":"Twitch OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2VkAppid":{"type":"string","description":"VK OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2VkSecret":{"type":"string","description":"VK OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2YahooAppid":{"type":"string","description":"Yahoo OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2YahooSecret":{"type":"string","description":"Yahoo OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2YandexAppid":{"type":"string","description":"Yandex OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2YandexSecret":{"type":"string","description":"Yandex OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2WordpressAppid":{"type":"string","description":"WordPress OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2WordpressSecret":{"type":"string","description":"WordPress OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2MockAppid":{"type":"string","description":"Mock OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2MockSecret":{"type":"string","description":"Mock OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersAuthEmailPassword":{"type":"boolean","description":"Email\/Password auth method status","x-example":true},"usersAuthMagicURL":{"type":"boolean","description":"Magic URL auth method status","x-example":true},"usersAuthAnonymous":{"type":"boolean","description":"Anonymous auth method status","x-example":true},"usersAuthInvites":{"type":"boolean","description":"Invites auth method status","x-example":true},"usersAuthJWT":{"type":"boolean","description":"JWT auth method status","x-example":true},"usersAuthPhone":{"type":"boolean","description":"Phone auth method status","x-example":true}},"required":["$id","name","description","teamId","logo","url","legalName","legalCountry","legalState","legalCity","legalAddress","legalTaxId","usersAuthLimit","platforms","webhooks","keys","domains","tasks","usersOauth2AmazonAppid","usersOauth2AmazonSecret","usersOauth2AppleAppid","usersOauth2AppleSecret","usersOauth2BitbucketAppid","usersOauth2BitbucketSecret","usersOauth2BitlyAppid","usersOauth2BitlySecret","usersOauth2BoxAppid","usersOauth2BoxSecret","usersOauth2DiscordAppid","usersOauth2DiscordSecret","usersOauth2DropboxAppid","usersOauth2DropboxSecret","usersOauth2FacebookAppid","usersOauth2FacebookSecret","usersOauth2GithubAppid","usersOauth2GithubSecret","usersOauth2GitlabAppid","usersOauth2GitlabSecret","usersOauth2GoogleAppid","usersOauth2GoogleSecret","usersOauth2LinkedinAppid","usersOauth2LinkedinSecret","usersOauth2MicrosoftAppid","usersOauth2MicrosoftSecret","usersOauth2PaypalAppid","usersOauth2PaypalSecret","usersOauth2PaypalSandboxAppid","usersOauth2PaypalSandboxSecret","usersOauth2SalesforceAppid","usersOauth2SalesforceSecret","usersOauth2SlackAppid","usersOauth2SlackSecret","usersOauth2SpotifyAppid","usersOauth2SpotifySecret","usersOauth2TradeshiftAppid","usersOauth2TradeshiftSecret","usersOauth2TradeshiftBoxAppid","usersOauth2TradeshiftBoxSecret","usersOauth2TwitchAppid","usersOauth2TwitchSecret","usersOauth2VkAppid","usersOauth2VkSecret","usersOauth2YahooAppid","usersOauth2YahooSecret","usersOauth2YandexAppid","usersOauth2YandexSecret","usersOauth2WordpressAppid","usersOauth2WordpressSecret","usersOauth2MockAppid","usersOauth2MockSecret","usersAuthEmailPassword","usersAuthMagicURL","usersAuthAnonymous","usersAuthInvites","usersAuthJWT","usersAuthPhone"]},"webhook":{"description":"Webhook","type":"object","properties":{"$id":{"type":"string","description":"Webhook ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"Webhook name.","x-example":"My Webhook"},"url":{"type":"string","description":"Webhook URL endpoint.","x-example":"https:\/\/example.com\/webhook"},"events":{"type":"array","description":"Webhook trigger events.","items":{"type":"string"},"x-example":"database.collections.update"},"security":{"type":"boolean","description":"Indicated if SSL \/ TLS Certificate verification is enabled.","x-example":true},"httpUser":{"type":"string","description":"HTTP basic authentication username.","x-example":"username"},"httpPass":{"type":"string","description":"HTTP basic authentication password.","x-example":"password"}},"required":["$id","name","url","events","security","httpUser","httpPass"]},"key":{"description":"Key","type":"object","properties":{"$id":{"type":"string","description":"Key ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"Key name.","x-example":"My API Key"},"scopes":{"type":"array","description":"Allowed permission scopes.","items":{"type":"string"},"x-example":"users.read"},"secret":{"type":"string","description":"Secret key.","x-example":"919c2d18fb5d4...a2ae413da83346ad2"}},"required":["$id","name","scopes","secret"]},"task":{"description":"Task","type":"object","properties":{"$id":{"type":"string","description":"Task ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"Task name.","x-example":"My Task"},"security":{"type":"boolean","description":"Indicated if SSL \/ TLS Certificate verification is enabled.","x-example":true},"httpMethod":{"type":"string","description":"Task HTTP Method.","x-example":"POST"},"httpUrl":{"type":"string","description":"Task HTTP URL.","x-example":"https:\/\/example.com\/task"},"httpHeaders":{"type":"array","description":"Task HTTP headers.","items":{"type":"string"},"x-example":"key:value"},"httpUser":{"type":"string","description":"HTTP basic authentication username.","x-example":"username"},"httpPass":{"type":"string","description":"HTTP basic authentication password.","x-example":"password"},"duration":{"type":"number","description":"Task duration in seconds.","x-example":1.2,"format":"float"},"delay":{"type":"number","description":"Task delay time in seconds.","x-example":1.2,"format":"float"},"failures":{"type":"integer","description":"Number of recurring task failures.","x-example":0,"format":"int32"},"schedule":{"type":"string","description":"Task schedule in CRON syntax.","x-example":"* * * * *"},"status":{"type":"string","description":"Task status. Possible values: play, pause","x-example":"enabled"},"updated":{"type":"integer","description":"Task last updated time in Unix timestamp.","x-example":1592981250,"format":"int32"},"previous":{"type":"integer","description":"Task previous run time in Unix timestamp.","x-example":1592981250,"format":"int32"},"next":{"type":"integer","description":"Task next run time in Unix timestamp.","x-example":1592981650,"format":"int32"}},"required":["$id","name","security","httpMethod","httpUrl","httpHeaders","httpUser","httpPass","duration","delay","failures","schedule","status","updated","previous","next"]},"domain":{"description":"Domain","type":"object","properties":{"$id":{"type":"string","description":"Domain ID.","x-example":"5e5ea5c16897e"},"domain":{"type":"string","description":"Domain name.","x-example":"appwrite.company.com"},"registerable":{"type":"string","description":"Registerable domain name.","x-example":"company.com"},"tld":{"type":"string","description":"TLD name.","x-example":"com"},"verification":{"type":"boolean","description":"Verification process status.","x-example":true},"certificateId":{"type":"string","description":"Certificate ID.","x-example":"6ejea5c13377e"}},"required":["$id","domain","registerable","tld","verification","certificateId"]},"platform":{"description":"Platform","type":"object","properties":{"$id":{"type":"string","description":"Platform ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"Platform name.","x-example":"My Web App"},"type":{"type":"string","description":"Platform type. Possible values are: web, flutter-ios, flutter-android, ios, android, and unity.","x-example":"My Web App"},"key":{"type":"string","description":"Platform Key. iOS bundle ID or Android package name. Empty string for other platforms.","x-example":"com.company.appname"},"store":{"type":"string","description":"App store or Google Play store ID.","x-example":""},"hostname":{"type":"string","description":"Web app hostname. Empty string for other platforms.","x-example":true},"httpUser":{"type":"string","description":"HTTP basic authentication username.","x-example":"username"},"httpPass":{"type":"string","description":"HTTP basic authentication password.","x-example":"password"}},"required":["$id","name","type","key","store","hostname","httpUser","httpPass"]},"country":{"description":"Country","type":"object","properties":{"name":{"type":"string","description":"Country name.","x-example":"United States"},"code":{"type":"string","description":"Country two-character ISO 3166-1 alpha code.","x-example":"US"}},"required":["name","code"]},"continent":{"description":"Continent","type":"object","properties":{"name":{"type":"string","description":"Continent name.","x-example":"Europe"},"code":{"type":"string","description":"Continent two letter code.","x-example":"EU"}},"required":["name","code"]},"language":{"description":"Language","type":"object","properties":{"name":{"type":"string","description":"Language name.","x-example":"Italian"},"code":{"type":"string","description":"Language two-character ISO 639-1 codes.","x-example":"it"},"nativeName":{"type":"string","description":"Language native name.","x-example":"Italiano"}},"required":["name","code","nativeName"]},"currency":{"description":"Currency","type":"object","properties":{"symbol":{"type":"string","description":"Currency symbol.","x-example":"$"},"name":{"type":"string","description":"Currency name.","x-example":"US dollar"},"symbolNative":{"type":"string","description":"Currency native symbol.","x-example":"$"},"decimalDigits":{"type":"integer","description":"Number of decimal digits.","x-example":2,"format":"int32"},"rounding":{"type":"number","description":"Currency digit rounding.","x-example":0,"format":"float"},"code":{"type":"string","description":"Currency code in [ISO 4217-1](http:\/\/en.wikipedia.org\/wiki\/ISO_4217) three-character format.","x-example":"USD"},"namePlural":{"type":"string","description":"Currency plural name","x-example":"US dollars"}},"required":["symbol","name","symbolNative","decimalDigits","rounding","code","namePlural"]},"phone":{"description":"Phone","type":"object","properties":{"code":{"type":"string","description":"Phone code.","x-example":"+1"},"countryCode":{"type":"string","description":"Country two-character ISO 3166-1 alpha code.","x-example":"US"},"countryName":{"type":"string","description":"Country name.","x-example":"United States"}},"required":["code","countryCode","countryName"]}},"externalDocs":{"description":"Full API docs, specs and tutorials","url":"https:\/\/appwrite.io\/docs"}} diff --git a/specs/swagger-appwrite.0.7.0.json b/specs/swagger-appwrite.0.7.0.json deleted file mode 100644 index 16a044116d..0000000000 --- a/specs/swagger-appwrite.0.7.0.json +++ /dev/null @@ -1 +0,0 @@ -{"swagger":"2.0","info":{"version":"0.7.0","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","contact":{"name":"Appwrite Team","url":"https:\/\/appwrite.io\/support","email":"team@appwrite.io"},"license":{"name":"BSD-3-Clause","url":"https:\/\/raw.githubusercontent.com\/appwrite\/appwrite\/master\/LICENSE"}},"host":"appwrite.io","basePath":"\/v1","schemes":["https"],"consumes":["application\/json","multipart\/form-data"],"produces":["application\/json"],"securityDefinitions":{"Project":{"type":"apiKey","name":"X-Appwrite-Project","description":"Your project ID","in":"header","x-appwrite":{"demo":"5df5acd0d48c2"}},"Key":{"type":"apiKey","name":"X-Appwrite-Key","description":"Your secret API key","in":"header","x-appwrite":{"demo":"919c2d18fb5d4...a2ae413da83346ad2"}},"Locale":{"type":"apiKey","name":"X-Appwrite-Locale","description":"","in":"header","x-appwrite":{"demo":"en"}},"Mode":{"type":"apiKey","name":"X-Appwrite-Mode","description":"","in":"header","x-appwrite":{"demo":""}}},"paths":{"\/account":{"get":{"summary":"Get Account","operationId":"accountGet","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Get currently logged in user data as JSON object.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"get","weight":42,"cookies":false,"type":"","demo":"account\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/get.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client"],"packaging":false},"security":[{"Project":[],"Key":[]}]},"post":{"summary":"Create Account","operationId":"accountCreate","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to allow a new user to register a new account in your project. After the user registration completes successfully, you can use the [\/account\/verfication](\/docs\/client\/account#accountCreateVerification) route to start verifying the user email address. To allow the new user to login to their new account, you need to create a new [account session](\/docs\/client\/account#accountCreateSession).","responses":{"201":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"create","weight":35,"cookies":false,"type":"","demo":"account\/create.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"public","platforms":["client"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"email":{"type":"string","description":"User email.","default":null,"x-example":"email@example.com"},"password":{"type":"string","description":"User password. Must be between 6 to 32 chars.","default":null,"x-example":"password"},"name":{"type":"string","description":"User name. Max length: 128 chars.","default":"","x-example":"[NAME]"}},"required":["email","password"]}}]},"delete":{"summary":"Delete Account","operationId":"accountDelete","consumes":["application\/json"],"produces":[],"tags":["account"],"description":"Delete a currently logged in user account. Behind the scene, the user record is not deleted but permanently blocked from any access. This is done to avoid deleted accounts being overtaken by new users with the same email address. Any user-related resources like documents or storage files should be deleted separately.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"delete","weight":50,"cookies":false,"type":"","demo":"account\/delete.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/delete.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client"],"packaging":false},"security":[{"Project":[],"Key":[]}]}},"\/account\/email":{"patch":{"summary":"Update Account Email","operationId":"accountUpdateEmail","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Update currently logged in user account email address. After changing user address, user confirmation status is being reset and a new confirmation mail is sent. For security measures, user password is required to complete this request.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updateEmail","weight":48,"cookies":false,"type":"","demo":"account\/update-email.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-email.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"email":{"type":"string","description":"User email.","default":null,"x-example":"email@example.com"},"password":{"type":"string","description":"User password. Must be between 6 to 32 chars.","default":null,"x-example":"password"}},"required":["email","password"]}}]}},"\/account\/logs":{"get":{"summary":"Get Account Logs","operationId":"accountGetLogs","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Get currently logged in user list of latest security activity logs. Each log returns user IP address, location and date and time of log.","responses":{"200":{"description":"Logs List","schema":{"$ref":"#\/definitions\/logList"}}},"x-appwrite":{"method":"getLogs","weight":45,"cookies":false,"type":"","demo":"account\/get-logs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/get-logs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client"],"packaging":false},"security":[{"Project":[],"Key":[]}]}},"\/account\/name":{"patch":{"summary":"Update Account Name","operationId":"accountUpdateName","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Update currently logged in user account name.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updateName","weight":46,"cookies":false,"type":"","demo":"account\/update-name.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-name.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"User name. Max length: 128 chars.","default":null,"x-example":"[NAME]"}},"required":["name"]}}]}},"\/account\/password":{"patch":{"summary":"Update Account Password","operationId":"accountUpdatePassword","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Update currently logged in user password. For validation, user is required to pass the password twice.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updatePassword","weight":47,"cookies":false,"type":"","demo":"account\/update-password.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-password.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"password":{"type":"string","description":"New user password. Must be between 6 to 32 chars.","default":null,"x-example":"password"},"oldPassword":{"type":"string","description":"Old user password. Must be between 6 to 32 chars.","default":null,"x-example":"password"}},"required":["password","oldPassword"]}}]}},"\/account\/prefs":{"get":{"summary":"Get Account Preferences","operationId":"accountGetPrefs","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Get currently logged in user preferences as a key-value object.","responses":{"200":{"description":"Any","schema":{"$ref":"#\/definitions\/any"}}},"x-appwrite":{"method":"getPrefs","weight":43,"cookies":false,"type":"","demo":"account\/get-prefs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/get-prefs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client"],"packaging":false},"security":[{"Project":[],"Key":[]}]},"patch":{"summary":"Update Account Preferences","operationId":"accountUpdatePrefs","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Update currently logged in user account preferences. You can pass only the specific settings you wish to update.","responses":{"200":{"description":"Any","schema":{"$ref":"#\/definitions\/any"}}},"x-appwrite":{"method":"updatePrefs","weight":49,"cookies":false,"type":"","demo":"account\/update-prefs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-prefs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"prefs":{"type":"object","description":"Prefs key-value JSON object.","default":null,"x-example":"{}"}},"required":["prefs"]}}]}},"\/account\/recovery":{"post":{"summary":"Create Password Recovery","operationId":"accountCreateRecovery","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Sends the user an email with a temporary secret key for password reset. When the user clicks the confirmation link he is redirected back to your app password reset URL with the secret key and email address values attached to the URL query string. Use the query string params to submit a request to the [PUT \/account\/recovery](\/docs\/client\/account#accountUpdateRecovery) endpoint to complete the process.","responses":{"201":{"description":"Token","schema":{"$ref":"#\/definitions\/token"}}},"x-appwrite":{"method":"createRecovery","weight":53,"cookies":false,"type":"","demo":"account\/create-recovery.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create-recovery.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},email:{param-email}","scope":"public","platforms":["client"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"email":{"type":"string","description":"User email.","default":null,"x-example":"email@example.com"},"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"}},"required":["email","url"]}}]},"put":{"summary":"Complete Password Recovery","operationId":"accountUpdateRecovery","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to complete the user account password reset. Both the **userId** and **secret** arguments will be passed as query parameters to the redirect URL you have provided when sending your request to the [POST \/account\/recovery](\/docs\/client\/account#accountCreateRecovery) endpoint.\n\nPlease note that in order to avoid a [Redirect Attack](https:\/\/github.com\/OWASP\/CheatSheetSeries\/blob\/master\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.","responses":{"200":{"description":"Token","schema":{"$ref":"#\/definitions\/token"}}},"x-appwrite":{"method":"updateRecovery","weight":54,"cookies":false,"type":"","demo":"account\/update-recovery.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-recovery.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},userId:{param-userId}","scope":"public","platforms":["client"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"userId":{"type":"string","description":"User account UID address.","default":null,"x-example":"[USER_ID]"},"secret":{"type":"string","description":"Valid reset token.","default":null,"x-example":"[SECRET]"},"password":{"type":"string","description":"New password. Must be between 6 to 32 chars.","default":null,"x-example":"password"},"passwordAgain":{"type":"string","description":"New password again. Must be between 6 to 32 chars.","default":null,"x-example":"password"}},"required":["userId","secret","password","passwordAgain"]}}]}},"\/account\/sessions":{"get":{"summary":"Get Account Sessions","operationId":"accountGetSessions","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Get currently logged in user list of active sessions across different devices.","responses":{"200":{"description":"Sessions List","schema":{"$ref":"#\/definitions\/sessionList"}}},"x-appwrite":{"method":"getSessions","weight":44,"cookies":false,"type":"","demo":"account\/get-sessions.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/get-sessions.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client"],"packaging":false},"security":[{"Project":[],"Key":[]}]},"post":{"summary":"Create Account Session","operationId":"accountCreateSession","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Allow the user to login into their account by providing a valid email and password combination. This route will create a new session for the user.","responses":{"201":{"description":"Session","schema":{"$ref":"#\/definitions\/session"}}},"x-appwrite":{"method":"createSession","weight":36,"cookies":false,"type":"","demo":"account\/create-session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create-session.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},email:{param-email}","scope":"public","platforms":["client"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"email":{"type":"string","description":"User email.","default":null,"x-example":"email@example.com"},"password":{"type":"string","description":"User password. Must be between 6 to 32 chars.","default":null,"x-example":"password"}},"required":["email","password"]}}]},"delete":{"summary":"Delete All Account Sessions","operationId":"accountDeleteSessions","consumes":["application\/json"],"produces":[],"tags":["account"],"description":"Delete all sessions from the user account and remove any sessions cookies from the end client.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteSessions","weight":52,"cookies":false,"type":"","demo":"account\/delete-sessions.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/delete-sessions.md","rate-limit":100,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client"],"packaging":false},"security":[{"Project":[],"Key":[]}]}},"\/account\/sessions\/oauth2\/{provider}":{"get":{"summary":"Create Account Session with OAuth2","operationId":"accountCreateOAuth2Session","consumes":["application\/json"],"produces":["text\/html"],"tags":["account"],"description":"Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL's back to your app when login is completed.","responses":{"301":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"createOAuth2Session","weight":37,"cookies":false,"type":"webAuth","demo":"account\/create-o-auth2session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create-session-oauth2.md","rate-limit":50,"rate-time":3600,"rate-key":"ip:{ip}","scope":"public","platforms":["client"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"provider","description":"OAuth2 Provider. Currently, supported providers are: amazon, apple, bitbucket, bitly, box, discord, dropbox, facebook, github, gitlab, google, linkedin, microsoft, paypal, paypalSandbox, salesforce, slack, spotify, tradeshift, tradeshiftBox, twitch, vk, yahoo, yandex, wordpress.","required":true,"type":"string","x-example":"amazon","in":"path"},{"name":"success","description":"URL to redirect back to your app after a successful login attempt. 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.","required":false,"type":"string","format":"url","x-example":"https:\/\/example.com","default":"https:\/\/appwrite.io\/auth\/oauth2\/success","in":"query"},{"name":"failure","description":"URL to redirect back to your app after a failed login attempt. 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.","required":false,"type":"string","format":"url","x-example":"https:\/\/example.com","default":"https:\/\/appwrite.io\/auth\/oauth2\/failure","in":"query"},{"name":"scopes","description":"A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes.","required":false,"type":"array","collectionFormat":"multi","items":{"type":"string"},"default":[],"in":"query"}]}},"\/account\/sessions\/{sessionId}":{"delete":{"summary":"Delete Account Session","operationId":"accountDeleteSession","consumes":["application\/json"],"produces":[],"tags":["account"],"description":"Use this endpoint to log out the currently logged in user from all their account sessions across all of their different devices. When using the option id argument, only the session unique ID provider will be deleted.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteSession","weight":51,"cookies":false,"type":"","demo":"account\/delete-session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/delete-session.md","rate-limit":100,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"sessionId","description":"Session unique ID. Use the string 'current' to delete the current device session.","required":true,"type":"string","x-example":"[SESSION_ID]","in":"path"}]}},"\/account\/verification":{"post":{"summary":"Create Email Verification","operationId":"accountCreateVerification","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the **userId** and **secret** arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the **userId** and **secret** parameters. Learn more about how to [complete the verification process](\/docs\/client\/account#accountUpdateVerification). \n\nPlease note that in order to avoid a [Redirect Attack](https:\/\/github.com\/OWASP\/CheatSheetSeries\/blob\/master\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.\n","responses":{"201":{"description":"Token","schema":{"$ref":"#\/definitions\/token"}}},"x-appwrite":{"method":"createVerification","weight":55,"cookies":false,"type":"","demo":"account\/create-verification.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create-verification.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},email:{param-email}","scope":"account","platforms":["client"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"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.","default":null,"x-example":"https:\/\/example.com"}},"required":["url"]}}]},"put":{"summary":"Complete Email Verification","operationId":"accountUpdateVerification","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to complete the user email verification process. Use both the **userId** and **secret** parameters that were attached to your app URL to verify the user email ownership. If confirmed this route will return a 200 status code.","responses":{"200":{"description":"Token","schema":{"$ref":"#\/definitions\/token"}}},"x-appwrite":{"method":"updateVerification","weight":56,"cookies":false,"type":"","demo":"account\/update-verification.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-verification.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},userId:{param-userId}","scope":"public","platforms":["client"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"userId":{"type":"string","description":"User unique ID.","default":null,"x-example":"[USER_ID]"},"secret":{"type":"string","description":"Valid verification token.","default":null,"x-example":"[SECRET]"}},"required":["userId","secret"]}}]}},"\/avatars\/browsers\/{code}":{"get":{"summary":"Get Browser Icon","operationId":"avatarsGetBrowser","consumes":["application\/json"],"produces":["image\/png"],"tags":["avatars"],"description":"You can use this endpoint to show different browser icons to your users. The code argument receives the browser code as it appears in your user \/account\/sessions endpoint. Use width, height and quality arguments to change the output settings.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getBrowser","weight":58,"cookies":false,"type":"location","demo":"avatars\/get-browser.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-browser.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"code","description":"Browser Code.","required":true,"type":"string","x-example":"aa","in":"path"},{"name":"width","description":"Image width. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"height","description":"Image height. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"quality","description":"Image quality. Pass an integer between 0 to 100. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"}]}},"\/avatars\/credit-cards\/{code}":{"get":{"summary":"Get Credit Card Icon","operationId":"avatarsGetCreditCard","consumes":["application\/json"],"produces":["image\/png"],"tags":["avatars"],"description":"The credit card endpoint will return you the icon of the credit card provider you need. Use width, height and quality arguments to change the output settings.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getCreditCard","weight":57,"cookies":false,"type":"location","demo":"avatars\/get-credit-card.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-credit-card.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"code","description":"Credit Card Code. Possible values: amex, argencard, cabal, censosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, union-china-pay, visa, mir, maestro.","required":true,"type":"string","x-example":"amex","in":"path"},{"name":"width","description":"Image width. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"height","description":"Image height. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"quality","description":"Image quality. Pass an integer between 0 to 100. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"}]}},"\/avatars\/favicon":{"get":{"summary":"Get Favicon","operationId":"avatarsGetFavicon","consumes":["application\/json"],"produces":["image\/*"],"tags":["avatars"],"description":"Use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL.\n","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getFavicon","weight":61,"cookies":false,"type":"location","demo":"avatars\/get-favicon.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-favicon.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"url","description":"Website URL which you want to fetch the favicon from.","required":true,"type":"string","format":"url","x-example":"https:\/\/example.com","in":"query"}]}},"\/avatars\/flags\/{code}":{"get":{"summary":"Get Country Flag","operationId":"avatarsGetFlag","consumes":["application\/json"],"produces":["image\/png"],"tags":["avatars"],"description":"You can use this endpoint to show different country flags icons to your users. The code argument receives the 2 letter country code. Use width, height and quality arguments to change the output settings.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getFlag","weight":59,"cookies":false,"type":"location","demo":"avatars\/get-flag.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-flag.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"code","description":"Country Code. ISO Alpha-2 country code format.","required":true,"type":"string","x-example":"af","in":"path"},{"name":"width","description":"Image width. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"height","description":"Image height. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"quality","description":"Image quality. Pass an integer between 0 to 100. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"}]}},"\/avatars\/image":{"get":{"summary":"Get Image from URL","operationId":"avatarsGetImage","consumes":["application\/json"],"produces":["image\/*"],"tags":["avatars"],"description":"Use this endpoint to fetch a remote image URL and crop it to any image size you want. This endpoint is very useful if you need to crop and display remote images in your app or in case you want to make sure a 3rd party image is properly served using a TLS protocol.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getImage","weight":60,"cookies":false,"type":"location","demo":"avatars\/get-image.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-image.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"url","description":"Image URL which you want to crop.","required":true,"type":"string","format":"url","x-example":"https:\/\/example.com","in":"query"},{"name":"width","description":"Resize preview image width, Pass an integer between 0 to 2000.","required":false,"type":"integer","format":"int32","x-example":0,"default":400,"in":"query"},{"name":"height","description":"Resize preview image height, Pass an integer between 0 to 2000.","required":false,"type":"integer","format":"int32","x-example":0,"default":400,"in":"query"}]}},"\/avatars\/initials":{"get":{"summary":"Get User Initials","operationId":"avatarsGetInitials","consumes":["application\/json"],"produces":["image\/png"],"tags":["avatars"],"description":"Use this endpoint to show your user initials avatar icon on your website or app. By default, this route will try to print your logged-in user name or email initials. You can also overwrite the user name if you pass the 'name' parameter. If no name is given and no user is logged, an empty avatar will be returned.\n\nYou can use the color and background params to change the avatar colors. By default, a random theme will be selected. The random theme will persist for the user's initials when reloading the same theme will always return for the same initials.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getInitials","weight":63,"cookies":false,"type":"location","demo":"avatars\/get-initials.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-initials.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"name","description":"Full Name. When empty, current user name or email will be used. Max length: 128 chars.","required":false,"type":"string","x-example":"[NAME]","default":"","in":"query"},{"name":"width","description":"Image width. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":500,"in":"query"},{"name":"height","description":"Image height. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":500,"in":"query"},{"name":"color","description":"Changes text color. By default a random color will be picked and stay will persistent to the given name.","required":false,"type":"string","default":"","in":"query"},{"name":"background","description":"Changes background color. By default a random color will be picked and stay will persistent to the given name.","required":false,"type":"string","default":"","in":"query"}]}},"\/avatars\/qr":{"get":{"summary":"Get QR Code","operationId":"avatarsGetQR","consumes":["application\/json"],"produces":["image\/png"],"tags":["avatars"],"description":"Converts a given plain text to a QR code image. You can use the query parameters to change the size and style of the resulting image.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getQR","weight":62,"cookies":false,"type":"location","demo":"avatars\/get-q-r.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-qr.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"text","description":"Plain text to be converted to QR code image.","required":true,"type":"string","x-example":"[TEXT]","in":"query"},{"name":"size","description":"QR code size. Pass an integer between 0 to 1000. Defaults to 400.","required":false,"type":"integer","format":"int32","x-example":0,"default":400,"in":"query"},{"name":"margin","description":"Margin from edge. Pass an integer between 0 to 10. Defaults to 1.","required":false,"type":"integer","format":"int32","x-example":0,"default":1,"in":"query"},{"name":"download","description":"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.","required":false,"type":"boolean","x-example":false,"default":false,"in":"query"}]}},"\/database\/collections":{"get":{"summary":"List Collections","operationId":"databaseListCollections","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Get a list of all the user collections. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project's collections. [Learn more about different API modes](\/docs\/admin).","responses":{"200":{"description":"Collections List","schema":{"$ref":"#\/definitions\/collectionList"}}},"x-appwrite":{"method":"listCollections","weight":65,"cookies":false,"type":"","demo":"database\/list-collections.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/list-collections.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.read","platforms":["server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Results offset. The default value is 0. Use this param to manage pagination.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create Collection","operationId":"databaseCreateCollection","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Create a new Collection.","responses":{"201":{"description":"Collection","schema":{"$ref":"#\/definitions\/collection"}}},"x-appwrite":{"method":"createCollection","weight":64,"cookies":false,"type":"","demo":"database\/create-collection.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/create-collection.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Collection name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"read":{"type":"array","description":"An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}},"write":{"type":"array","description":"An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}},"rules":{"type":"array","description":"Array of [rule objects](\/docs\/rules). Each rule define a collection field name, data type and validation.","default":null,"x-example":null,"items":{"type":"string"}}},"required":["name","read","write","rules"]}}]}},"\/database\/collections\/{collectionId}":{"get":{"summary":"Get Collection","operationId":"databaseGetCollection","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata.","responses":{"200":{"description":"Collection","schema":{"$ref":"#\/definitions\/collection"}}},"x-appwrite":{"method":"getCollection","weight":66,"cookies":false,"type":"","demo":"database\/get-collection.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/get-collection.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.read","platforms":["server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID.","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"}]},"put":{"summary":"Update Collection","operationId":"databaseUpdateCollection","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Update a collection by its unique ID.","responses":{"200":{"description":"Collection","schema":{"$ref":"#\/definitions\/collection"}}},"x-appwrite":{"method":"updateCollection","weight":67,"cookies":false,"type":"","demo":"database\/update-collection.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/update-collection.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID.","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Collection name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"read":{"type":"array","description":"An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions(\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}},"write":{"type":"array","description":"An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}},"rules":{"type":"array","description":"Array of [rule objects](\/docs\/rules). Each rule define a collection field name, data type and validation.","default":[],"x-example":null,"items":{"type":"string"}}},"required":["name","read","write"]}}]},"delete":{"summary":"Delete Collection","operationId":"databaseDeleteCollection","consumes":["application\/json"],"produces":[],"tags":["database"],"description":"Delete a collection by its unique ID. Only users with write permissions have access to delete this resource.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteCollection","weight":68,"cookies":false,"type":"","demo":"database\/delete-collection.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/delete-collection.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID.","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"}]}},"\/database\/collections\/{collectionId}\/documents":{"get":{"summary":"List Documents","operationId":"databaseListDocuments","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Get a list of all the user documents. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project's documents. [Learn more about different API modes](\/docs\/admin).","responses":{"200":{"description":"Documents List","schema":{"$ref":"#\/definitions\/documentList"}}},"x-appwrite":{"method":"listDocuments","weight":70,"cookies":false,"type":"","demo":"database\/list-documents.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/list-documents.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"documents.read","platforms":["client","server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"filters","description":"Array of filter strings. Each filter is constructed from a key name, comparison operator (=, !=, >, <, <=, >=) and a value. You can also use a dot (.) separator in attribute names to filter by child document attributes. Examples: 'name=John Doe' or 'category.$id>=5bed2d152c362'.","required":false,"type":"array","collectionFormat":"multi","items":{"type":"string"},"default":[],"in":"query"},{"name":"limit","description":"Maximum number of documents to return in response. Use this value to manage pagination. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Offset value. The default value is 0. Use this param to manage pagination.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"orderField","description":"Document field that results will be sorted by.","required":false,"type":"string","x-example":"[ORDER_FIELD]","default":"","in":"query"},{"name":"orderType","description":"Order direction. Possible values are DESC for descending order, or ASC for ascending order.","required":false,"type":"string","x-example":"DESC","default":"ASC","in":"query"},{"name":"orderCast","description":"Order field type casting. Possible values are int, string, date, time or datetime. The database will attempt to cast the order field to the value you pass here. The default value is a string.","required":false,"type":"string","x-example":"int","default":"string","in":"query"},{"name":"search","description":"Search query. Enter any free text search. The database will try to find a match against all document attributes and children. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"}]},"post":{"summary":"Create Document","operationId":"databaseCreateDocument","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](\/docs\/server\/database#databaseCreateCollection) API or directly from your database console.","responses":{"201":{"description":"Any","schema":{"$ref":"#\/definitions\/any"}}},"x-appwrite":{"method":"createDocument","weight":69,"cookies":false,"type":"","demo":"database\/create-document.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/create-document.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"documents.write","platforms":["client","server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"data":{"type":"object","description":"Document data as JSON object.","default":null,"x-example":"{}"},"read":{"type":"array","description":"An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}},"write":{"type":"array","description":"An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}},"parentDocument":{"type":"string","description":"Parent document unique ID. Use when you want your new document to be a child of a parent document.","default":"","x-example":"[PARENT_DOCUMENT]"},"parentProperty":{"type":"string","description":"Parent document property name. Use when you want your new document to be a child of a parent document.","default":"","x-example":null},"parentPropertyType":{"type":"string","description":"Parent document property connection type. You can set this value to **assign**, **append** or **prepend**, default value is assign. Use when you want your new document to be a child of a parent document.","default":"assign","x-example":"assign"}},"required":["data","read","write"]}}]}},"\/database\/collections\/{collectionId}\/documents\/{documentId}":{"get":{"summary":"Get Document","operationId":"databaseGetDocument","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Get a document by its unique ID. This endpoint response returns a JSON object with the document data.","responses":{"200":{"description":"Any","schema":{"$ref":"#\/definitions\/any"}}},"x-appwrite":{"method":"getDocument","weight":71,"cookies":false,"type":"","demo":"database\/get-document.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/get-document.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"documents.read","platforms":["client","server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"documentId","description":"Document unique ID.","required":true,"type":"string","x-example":"[DOCUMENT_ID]","in":"path"}]},"patch":{"summary":"Update Document","operationId":"databaseUpdateDocument","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated.","responses":{"200":{"description":"Any","schema":{"$ref":"#\/definitions\/any"}}},"x-appwrite":{"method":"updateDocument","weight":72,"cookies":false,"type":"","demo":"database\/update-document.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/update-document.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"documents.write","platforms":["client","server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"documentId","description":"Document unique ID.","required":true,"type":"string","x-example":"[DOCUMENT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"data":{"type":"object","description":"Document data as JSON object.","default":null,"x-example":"{}"},"read":{"type":"array","description":"An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}},"write":{"type":"array","description":"An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}}},"required":["data","read","write"]}}]},"delete":{"summary":"Delete Document","operationId":"databaseDeleteDocument","consumes":["application\/json"],"produces":[],"tags":["database"],"description":"Delete a document by its unique ID. This endpoint deletes only the parent documents, its attributes and relations to other documents. Child documents **will not** be deleted.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteDocument","weight":73,"cookies":false,"type":"","demo":"database\/delete-document.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/delete-document.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"documents.write","platforms":["client","server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"documentId","description":"Document unique ID.","required":true,"type":"string","x-example":"[DOCUMENT_ID]","in":"path"}]}},"\/functions":{"get":{"summary":"List Functions","operationId":"functionsList","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Get a list of all the project's functions. You can use the query params to filter your results.","responses":{"200":{"description":"Functions List","schema":{"$ref":"#\/definitions\/functionList"}}},"x-appwrite":{"method":"list","weight":156,"cookies":false,"type":"","demo":"functions\/list.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/list-functions.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.read","platforms":["server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Results offset. The default value is 0. Use this param to manage pagination.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create Function","operationId":"functionsCreate","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Create a new function. You can pass a list of [permissions](\/docs\/permissions) to allow different project users or team with access to execute the function using the client API.","responses":{"201":{"description":"Function","schema":{"$ref":"#\/definitions\/function"}}},"x-appwrite":{"method":"create","weight":155,"cookies":false,"type":"","demo":"functions\/create.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/create-function.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.write","platforms":["server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Function name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"execute":{"type":"array","description":"An array of strings with execution permissions. By default no user is granted with any execute permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}},"env":{"type":"string","description":"Execution enviornment.","default":null,"x-example":"node-14.5"},"vars":{"type":"object","description":"Key-value JSON object.","default":{},"x-example":"{}"},"events":{"type":"array","description":"Events list.","default":[],"x-example":null,"items":{"type":"string"}},"schedule":{"type":"string","description":"Schedule CRON syntax.","default":"","x-example":null},"timeout":{"type":"integer","description":"Function maximum execution time in seconds.","default":15,"x-example":1}},"required":["name","execute","env"]}}]}},"\/functions\/{functionId}":{"get":{"summary":"Get Function","operationId":"functionsGet","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Get a function by its unique ID.","responses":{"200":{"description":"Function","schema":{"$ref":"#\/definitions\/function"}}},"x-appwrite":{"method":"get","weight":157,"cookies":false,"type":"","demo":"functions\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/get-function.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.read","platforms":["server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"}]},"put":{"summary":"Update Function","operationId":"functionsUpdate","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Update function by its unique ID.","responses":{"200":{"description":"Function","schema":{"$ref":"#\/definitions\/function"}}},"x-appwrite":{"method":"update","weight":159,"cookies":false,"type":"","demo":"functions\/update.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/update-function.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.write","platforms":["server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Function name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"execute":{"type":"array","description":"An array of strings with execution permissions. By default no user is granted with any execute permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}},"vars":{"type":"object","description":"Key-value JSON object.","default":{},"x-example":"{}"},"events":{"type":"array","description":"Events list.","default":[],"x-example":null,"items":{"type":"string"}},"schedule":{"type":"string","description":"Schedule CRON syntax.","default":"","x-example":null},"timeout":{"type":"integer","description":"Function maximum execution time in seconds.","default":15,"x-example":1}},"required":["name","execute"]}}]},"delete":{"summary":"Delete Function","operationId":"functionsDelete","consumes":["application\/json"],"produces":[],"tags":["functions"],"description":"Delete a function by its unique ID.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"delete","weight":161,"cookies":false,"type":"","demo":"functions\/delete.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/delete-function.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.write","platforms":["server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"}]}},"\/functions\/{functionId}\/executions":{"get":{"summary":"List Executions","operationId":"functionsListExecutions","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Get a list of all the current user function execution logs. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project's teams. [Learn more about different API modes](\/docs\/admin).","responses":{"200":{"description":"Executions List","schema":{"$ref":"#\/definitions\/executionList"}}},"x-appwrite":{"method":"listExecutions","weight":167,"cookies":false,"type":"","demo":"functions\/list-executions.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/list-executions.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"execution.read","platforms":["client","server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Results offset. The default value is 0. Use this param to manage pagination.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create Execution","operationId":"functionsCreateExecution","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Trigger a function execution. The returned object will return you the current execution status. You can ping the `Get Execution` endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously.","responses":{"201":{"description":"Execution","schema":{"$ref":"#\/definitions\/execution"}}},"x-appwrite":{"method":"createExecution","weight":166,"cookies":false,"type":"","demo":"functions\/create-execution.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/create-execution.md","rate-limit":60,"rate-time":60,"rate-key":"url:{url},ip:{ip}","scope":"execution.write","platforms":["client","server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"}]}},"\/functions\/{functionId}\/executions\/{executionId}":{"get":{"summary":"Get Execution","operationId":"functionsGetExecution","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Get a function execution log by its unique ID.","responses":{"200":{"description":"Execution","schema":{"$ref":"#\/definitions\/execution"}}},"x-appwrite":{"method":"getExecution","weight":168,"cookies":false,"type":"","demo":"functions\/get-execution.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/get-execution.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"execution.read","platforms":["client","server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"executionId","description":"Execution unique ID.","required":true,"type":"string","x-example":"[EXECUTION_ID]","in":"path"}]}},"\/functions\/{functionId}\/tag":{"patch":{"summary":"Update Function Tag","operationId":"functionsUpdateTag","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Update the function code tag ID using the unique function ID. Use this endpoint to switch the code tag that should be executed by the execution endpoint.","responses":{"200":{"description":"Function","schema":{"$ref":"#\/definitions\/function"}}},"x-appwrite":{"method":"updateTag","weight":160,"cookies":false,"type":"","demo":"functions\/update-tag.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/update-function-tag.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.write","platforms":["server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"tag":{"type":"string","description":"Tag unique ID.","default":null,"x-example":"[TAG]"}},"required":["tag"]}}]}},"\/functions\/{functionId}\/tags":{"get":{"summary":"List Tags","operationId":"functionsListTags","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Get a list of all the project's code tags. You can use the query params to filter your results.","responses":{"200":{"description":"Tags List","schema":{"$ref":"#\/definitions\/tagList"}}},"x-appwrite":{"method":"listTags","weight":163,"cookies":false,"type":"","demo":"functions\/list-tags.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/list-tags.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.read","platforms":["server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Results offset. The default value is 0. Use this param to manage pagination.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create Tag","operationId":"functionsCreateTag","consumes":["multipart\/form-data"],"produces":["application\/json"],"tags":["functions"],"description":"Create a new function code tag. Use this endpoint to upload a new version of your code function. To execute your newly uploaded code, you'll need to update the function's tag to use your new tag UID.\n\nThis endpoint accepts a tar.gz file compressed with your code. Make sure to include any dependencies your code has within the compressed file. You can learn more about code packaging in the [Appwrite Cloud Functions tutorial](\/docs\/functions).\n\nUse the \"command\" param to set the entry point used to execute your code.","responses":{"201":{"description":"Tag","schema":{"$ref":"#\/definitions\/tag"}}},"x-appwrite":{"method":"createTag","weight":162,"cookies":false,"type":"","demo":"functions\/create-tag.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/create-tag.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.write","platforms":["server"],"packaging":true},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"command","description":"Code execution command.","required":true,"type":"string","x-example":"[COMMAND]","in":"formData"},{"name":"code","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.","required":true,"type":"file","in":"formData"}]}},"\/functions\/{functionId}\/tags\/{tagId}":{"get":{"summary":"Get Tag","operationId":"functionsGetTag","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Get a code tag by its unique ID.","responses":{"200":{"description":"Tag","schema":{"$ref":"#\/definitions\/tag"}}},"x-appwrite":{"method":"getTag","weight":164,"cookies":false,"type":"","demo":"functions\/get-tag.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/get-tag.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.read","platforms":["server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"tagId","description":"Tag unique ID.","required":true,"type":"string","x-example":"[TAG_ID]","in":"path"}]},"delete":{"summary":"Delete Tag","operationId":"functionsDeleteTag","consumes":["application\/json"],"produces":[],"tags":["functions"],"description":"Delete a code tag by its unique ID.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteTag","weight":165,"cookies":false,"type":"","demo":"functions\/delete-tag.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/delete-tag.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.write","platforms":["server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"tagId","description":"Tag unique ID.","required":true,"type":"string","x-example":"[TAG_ID]","in":"path"}]}},"\/functions\/{functionId}\/usage":{"get":{"summary":"Get Function Usage","operationId":"functionsGetUsage","consumes":["application\/json"],"produces":[],"tags":["functions"],"description":"","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getUsage","weight":158,"cookies":false,"type":"","demo":"functions\/get-usage.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.read","platforms":["console"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"range","description":"Date range.","required":false,"type":"string","x-example":"24h","default":"30d","in":"query"}]}},"\/health":{"get":{"summary":"Get HTTP","operationId":"healthGet","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Check the Appwrite HTTP server is up and responsive.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"get","weight":81,"cookies":false,"type":"","demo":"health\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false},"security":[{"Project":[],"Key":[]}]}},"\/health\/anti-virus":{"get":{"summary":"Get Anti virus","operationId":"healthGetAntiVirus","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Check the Appwrite Anti Virus server is up and connection is successful.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getAntiVirus","weight":93,"cookies":false,"type":"","demo":"health\/get-anti-virus.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-storage-anti-virus.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false},"security":[{"Project":[],"Key":[]}]}},"\/health\/cache":{"get":{"summary":"Get Cache","operationId":"healthGetCache","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Check the Appwrite in-memory cache server is up and connection is successful.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getCache","weight":84,"cookies":false,"type":"","demo":"health\/get-cache.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-cache.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false},"security":[{"Project":[],"Key":[]}]}},"\/health\/db":{"get":{"summary":"Get DB","operationId":"healthGetDB","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Check the Appwrite database server is up and connection is successful.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getDB","weight":83,"cookies":false,"type":"","demo":"health\/get-d-b.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-db.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false},"security":[{"Project":[],"Key":[]}]}},"\/health\/queue\/certificates":{"get":{"summary":"Get Certificate Queue","operationId":"healthGetQueueCertificates","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Get the number of certificates that are waiting to be issued against [Letsencrypt](https:\/\/letsencrypt.org\/) in the Appwrite internal queue server.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getQueueCertificates","weight":90,"cookies":false,"type":"","demo":"health\/get-queue-certificates.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-certificates.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false},"security":[{"Project":[],"Key":[]}]}},"\/health\/queue\/functions":{"get":{"summary":"Get Functions Queue","operationId":"healthGetQueueFunctions","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getQueueFunctions","weight":91,"cookies":false,"type":"","demo":"health\/get-queue-functions.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-functions.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false},"security":[{"Project":[],"Key":[]}]}},"\/health\/queue\/logs":{"get":{"summary":"Get Logs Queue","operationId":"healthGetQueueLogs","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Get the number of logs that are waiting to be processed in the Appwrite internal queue server.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getQueueLogs","weight":88,"cookies":false,"type":"","demo":"health\/get-queue-logs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-logs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false},"security":[{"Project":[],"Key":[]}]}},"\/health\/queue\/tasks":{"get":{"summary":"Get Tasks Queue","operationId":"healthGetQueueTasks","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Get the number of tasks that are waiting to be processed in the Appwrite internal queue server.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getQueueTasks","weight":87,"cookies":false,"type":"","demo":"health\/get-queue-tasks.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-tasks.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false},"security":[{"Project":[],"Key":[]}]}},"\/health\/queue\/usage":{"get":{"summary":"Get Usage Queue","operationId":"healthGetQueueUsage","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Get the number of usage stats that are waiting to be processed in the Appwrite internal queue server.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getQueueUsage","weight":89,"cookies":false,"type":"","demo":"health\/get-queue-usage.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-usage.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false},"security":[{"Project":[],"Key":[]}]}},"\/health\/queue\/webhooks":{"get":{"summary":"Get Webhooks Queue","operationId":"healthGetQueueWebhooks","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getQueueWebhooks","weight":86,"cookies":false,"type":"","demo":"health\/get-queue-webhooks.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-webhooks.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false},"security":[{"Project":[],"Key":[]}]}},"\/health\/storage\/local":{"get":{"summary":"Get Local Storage","operationId":"healthGetStorageLocal","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Check the Appwrite local storage device is up and connection is successful.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getStorageLocal","weight":92,"cookies":false,"type":"","demo":"health\/get-storage-local.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-storage-local.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false},"security":[{"Project":[],"Key":[]}]}},"\/health\/time":{"get":{"summary":"Get Time","operationId":"healthGetTime","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Check the Appwrite server time is synced with Google remote NTP server. We use this technology to smoothly handle leap seconds with no disruptive events. The [Network Time Protocol](https:\/\/en.wikipedia.org\/wiki\/Network_Time_Protocol) (NTP) is used by hundreds of millions of computers and devices to synchronize their clocks over the Internet. If your computer sets its own clock, it likely uses NTP.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getTime","weight":85,"cookies":false,"type":"","demo":"health\/get-time.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-time.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false},"security":[{"Project":[],"Key":[]}]}},"\/locale":{"get":{"summary":"Get User Locale","operationId":"localeGet","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"Get the current user location based on IP. Returns an object with user country code, country name, continent name, continent code, ip address and suggested currency. You can use the locale header to get the data in a supported language.\n\n([IP Geolocation by DB-IP](https:\/\/db-ip.com))","responses":{"200":{"description":"Locale","schema":{"$ref":"#\/definitions\/locale"}}},"x-appwrite":{"method":"get","weight":74,"cookies":false,"type":"","demo":"locale\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-locale.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server"],"packaging":false},"security":[{"Project":[],"Key":[]}]}},"\/locale\/continents":{"get":{"summary":"List Continents","operationId":"localeGetContinents","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"List of all continents. You can use the locale header to get the data in a supported language.","responses":{"200":{"description":"Continents List","schema":{"$ref":"#\/definitions\/continentList"}}},"x-appwrite":{"method":"getContinents","weight":78,"cookies":false,"type":"","demo":"locale\/get-continents.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-continents.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server"],"packaging":false},"security":[{"Project":[],"Key":[]}]}},"\/locale\/countries":{"get":{"summary":"List Countries","operationId":"localeGetCountries","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"List of all countries. You can use the locale header to get the data in a supported language.","responses":{"200":{"description":"Countries List","schema":{"$ref":"#\/definitions\/countryList"}}},"x-appwrite":{"method":"getCountries","weight":75,"cookies":false,"type":"","demo":"locale\/get-countries.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-countries.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server"],"packaging":false},"security":[{"Project":[],"Key":[]}]}},"\/locale\/countries\/eu":{"get":{"summary":"List EU Countries","operationId":"localeGetCountriesEU","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"List of all countries that are currently members of the EU. You can use the locale header to get the data in a supported language.","responses":{"200":{"description":"Countries List","schema":{"$ref":"#\/definitions\/countryList"}}},"x-appwrite":{"method":"getCountriesEU","weight":76,"cookies":false,"type":"","demo":"locale\/get-countries-e-u.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-countries-eu.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server"],"packaging":false},"security":[{"Project":[],"Key":[]}]}},"\/locale\/countries\/phones":{"get":{"summary":"List Countries Phone Codes","operationId":"localeGetCountriesPhones","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"List of all countries phone codes. You can use the locale header to get the data in a supported language.","responses":{"200":{"description":"Phones List","schema":{"$ref":"#\/definitions\/phoneList"}}},"x-appwrite":{"method":"getCountriesPhones","weight":77,"cookies":false,"type":"","demo":"locale\/get-countries-phones.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-countries-phones.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server"],"packaging":false},"security":[{"Project":[],"Key":[]}]}},"\/locale\/currencies":{"get":{"summary":"List Currencies","operationId":"localeGetCurrencies","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"List of all currencies, including currency symbol, name, plural, and decimal digits for all major and minor currencies. You can use the locale header to get the data in a supported language.","responses":{"200":{"description":"Currencies List","schema":{"$ref":"#\/definitions\/currencyList"}}},"x-appwrite":{"method":"getCurrencies","weight":79,"cookies":false,"type":"","demo":"locale\/get-currencies.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-currencies.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server"],"packaging":false},"security":[{"Project":[],"Key":[]}]}},"\/locale\/languages":{"get":{"summary":"List Languages","operationId":"localeGetLanguages","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"List of all languages classified by ISO 639-1 including 2-letter code, name in English, and name in the respective language.","responses":{"200":{"description":"Languages List","schema":{"$ref":"#\/definitions\/languageList"}}},"x-appwrite":{"method":"getLanguages","weight":80,"cookies":false,"type":"","demo":"locale\/get-languages.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-languages.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server"],"packaging":false},"security":[{"Project":[],"Key":[]}]}},"\/projects":{"get":{"summary":"List Projects","operationId":"projectsList","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Projects List","schema":{"$ref":"#\/definitions\/projectList"}}},"x-appwrite":{"method":"list","weight":96,"cookies":false,"type":"","demo":"projects\/list.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":[],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Results offset. The default value is 0. Use this param to manage pagination.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create Project","operationId":"projectsCreate","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"201":{"description":"Project","schema":{"$ref":"#\/definitions\/project"}}},"x-appwrite":{"method":"create","weight":95,"cookies":false,"type":"","demo":"projects\/create.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":[],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Project name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"teamId":{"type":"string","description":"Team unique ID.","default":null,"x-example":"[TEAM_ID]"},"description":{"type":"string","description":"Project description. Max length: 256 chars.","default":"","x-example":"[DESCRIPTION]"},"logo":{"type":"string","description":"Project logo.","default":"","x-example":"[LOGO]"},"url":{"type":"string","description":"Project URL.","default":"","x-example":"https:\/\/example.com"},"legalName":{"type":"string","description":"Project legal Name. Max length: 256 chars.","default":"","x-example":"[LEGAL_NAME]"},"legalCountry":{"type":"string","description":"Project legal Country. Max length: 256 chars.","default":"","x-example":"[LEGAL_COUNTRY]"},"legalState":{"type":"string","description":"Project legal State. Max length: 256 chars.","default":"","x-example":"[LEGAL_STATE]"},"legalCity":{"type":"string","description":"Project legal City. Max length: 256 chars.","default":"","x-example":"[LEGAL_CITY]"},"legalAddress":{"type":"string","description":"Project legal Address. Max length: 256 chars.","default":"","x-example":"[LEGAL_ADDRESS]"},"legalTaxId":{"type":"string","description":"Project legal Tax ID. Max length: 256 chars.","default":"","x-example":"[LEGAL_TAX_ID]"}},"required":["name","teamId"]}}]}},"\/projects\/{projectId}":{"get":{"summary":"Get Project","operationId":"projectsGet","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Project","schema":{"$ref":"#\/definitions\/project"}}},"x-appwrite":{"method":"get","weight":97,"cookies":false,"type":"","demo":"projects\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":[],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"}]},"patch":{"summary":"Update Project","operationId":"projectsUpdate","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Project","schema":{"$ref":"#\/definitions\/project"}}},"x-appwrite":{"method":"update","weight":99,"cookies":false,"type":"","demo":"projects\/update.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":[],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Project name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"description":{"type":"string","description":"Project description. Max length: 256 chars.","default":"","x-example":"[DESCRIPTION]"},"logo":{"type":"string","description":"Project logo.","default":"","x-example":"[LOGO]"},"url":{"type":"string","description":"Project URL.","default":"","x-example":"https:\/\/example.com"},"legalName":{"type":"string","description":"Project legal name. Max length: 256 chars.","default":"","x-example":"[LEGAL_NAME]"},"legalCountry":{"type":"string","description":"Project legal country. Max length: 256 chars.","default":"","x-example":"[LEGAL_COUNTRY]"},"legalState":{"type":"string","description":"Project legal state. Max length: 256 chars.","default":"","x-example":"[LEGAL_STATE]"},"legalCity":{"type":"string","description":"Project legal city. Max length: 256 chars.","default":"","x-example":"[LEGAL_CITY]"},"legalAddress":{"type":"string","description":"Project legal address. Max length: 256 chars.","default":"","x-example":"[LEGAL_ADDRESS]"},"legalTaxId":{"type":"string","description":"Project legal tax ID. Max length: 256 chars.","default":"","x-example":"[LEGAL_TAX_ID]"}},"required":["name"]}}]},"delete":{"summary":"Delete Project","operationId":"projectsDelete","consumes":["application\/json"],"produces":[],"tags":["projects"],"description":"","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"delete","weight":101,"cookies":false,"type":"","demo":"projects\/delete.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":[],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"password":{"type":"string","description":"Your user password for confirmation. Must be between 6 to 32 chars.","default":null,"x-example":"[PASSWORD]"}},"required":["password"]}}]}},"\/projects\/{projectId}\/domains":{"get":{"summary":"List Domains","operationId":"projectsListDomains","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Domains List","schema":{"$ref":"#\/definitions\/domainList"}}},"x-appwrite":{"method":"listDomains","weight":123,"cookies":false,"type":"","demo":"projects\/list-domains.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":[],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"}]},"post":{"summary":"Create Domain","operationId":"projectsCreateDomain","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"201":{"description":"Domain","schema":{"$ref":"#\/definitions\/domain"}}},"x-appwrite":{"method":"createDomain","weight":122,"cookies":false,"type":"","demo":"projects\/create-domain.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":[],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"domain":{"type":"string","description":"Domain name.","default":null,"x-example":null}},"required":["domain"]}}]}},"\/projects\/{projectId}\/domains\/{domainId}":{"get":{"summary":"Get Domain","operationId":"projectsGetDomain","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Domain","schema":{"$ref":"#\/definitions\/domain"}}},"x-appwrite":{"method":"getDomain","weight":124,"cookies":false,"type":"","demo":"projects\/get-domain.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":[],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"domainId","description":"Domain unique ID.","required":true,"type":"string","x-example":"[DOMAIN_ID]","in":"path"}]},"delete":{"summary":"Delete Domain","operationId":"projectsDeleteDomain","consumes":["application\/json"],"produces":[],"tags":["projects"],"description":"","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteDomain","weight":126,"cookies":false,"type":"","demo":"projects\/delete-domain.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":[],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"domainId","description":"Domain unique ID.","required":true,"type":"string","x-example":"[DOMAIN_ID]","in":"path"}]}},"\/projects\/{projectId}\/domains\/{domainId}\/verification":{"patch":{"summary":"Update Domain Verification Status","operationId":"projectsUpdateDomainVerification","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Domain","schema":{"$ref":"#\/definitions\/domain"}}},"x-appwrite":{"method":"updateDomainVerification","weight":125,"cookies":false,"type":"","demo":"projects\/update-domain-verification.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":[],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"domainId","description":"Domain unique ID.","required":true,"type":"string","x-example":"[DOMAIN_ID]","in":"path"}]}},"\/projects\/{projectId}\/keys":{"get":{"summary":"List Keys","operationId":"projectsListKeys","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"API Keys List","schema":{"$ref":"#\/definitions\/keyList"}}},"x-appwrite":{"method":"listKeys","weight":108,"cookies":false,"type":"","demo":"projects\/list-keys.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":[],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"}]},"post":{"summary":"Create Key","operationId":"projectsCreateKey","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"201":{"description":"Key","schema":{"$ref":"#\/definitions\/key"}}},"x-appwrite":{"method":"createKey","weight":107,"cookies":false,"type":"","demo":"projects\/create-key.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":[],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Key name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"scopes":{"type":"array","description":"Key scopes list.","default":null,"x-example":null,"items":{"type":"string"}}},"required":["name","scopes"]}}]}},"\/projects\/{projectId}\/keys\/{keyId}":{"get":{"summary":"Get Key","operationId":"projectsGetKey","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Key","schema":{"$ref":"#\/definitions\/key"}}},"x-appwrite":{"method":"getKey","weight":109,"cookies":false,"type":"","demo":"projects\/get-key.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":[],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"keyId","description":"Key unique ID.","required":true,"type":"string","x-example":"[KEY_ID]","in":"path"}]},"put":{"summary":"Update Key","operationId":"projectsUpdateKey","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Key","schema":{"$ref":"#\/definitions\/key"}}},"x-appwrite":{"method":"updateKey","weight":110,"cookies":false,"type":"","demo":"projects\/update-key.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":[],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"keyId","description":"Key unique ID.","required":true,"type":"string","x-example":"[KEY_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Key name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"scopes":{"type":"array","description":"Key scopes list","default":null,"x-example":null,"items":{"type":"string"}}},"required":["name","scopes"]}}]},"delete":{"summary":"Delete Key","operationId":"projectsDeleteKey","consumes":["application\/json"],"produces":[],"tags":["projects"],"description":"","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteKey","weight":111,"cookies":false,"type":"","demo":"projects\/delete-key.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":[],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"keyId","description":"Key unique ID.","required":true,"type":"string","x-example":"[KEY_ID]","in":"path"}]}},"\/projects\/{projectId}\/oauth2":{"patch":{"summary":"Update Project OAuth2","operationId":"projectsUpdateOAuth2","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Project","schema":{"$ref":"#\/definitions\/project"}}},"x-appwrite":{"method":"updateOAuth2","weight":100,"cookies":false,"type":"","demo":"projects\/update-o-auth2.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":[],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"provider":{"type":"string","description":"Provider Name","default":null,"x-example":"amazon"},"appId":{"type":"string","description":"Provider app ID. Max length: 256 chars.","default":"","x-example":"[APP_ID]"},"secret":{"type":"string","description":"Provider secret key. Max length: 512 chars.","default":"","x-example":"[SECRET]"}},"required":["provider"]}}]}},"\/projects\/{projectId}\/platforms":{"get":{"summary":"List Platforms","operationId":"projectsListPlatforms","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Platforms List","schema":{"$ref":"#\/definitions\/platformList"}}},"x-appwrite":{"method":"listPlatforms","weight":118,"cookies":false,"type":"","demo":"projects\/list-platforms.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":[],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"}]},"post":{"summary":"Create Platform","operationId":"projectsCreatePlatform","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"201":{"description":"Platform","schema":{"$ref":"#\/definitions\/platform"}}},"x-appwrite":{"method":"createPlatform","weight":117,"cookies":false,"type":"","demo":"projects\/create-platform.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":[],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"type":{"type":"string","description":"Platform type.","default":null,"x-example":"web"},"name":{"type":"string","description":"Platform name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"key":{"type":"string","description":"Package name for android or bundle ID for iOS. Max length: 256 chars.","default":"","x-example":"[KEY]"},"store":{"type":"string","description":"App store or Google Play store ID. Max length: 256 chars.","default":"","x-example":"[STORE]"},"hostname":{"type":"string","description":"Platform client hostname. Max length: 256 chars.","default":"","x-example":"[HOSTNAME]"}},"required":["type","name"]}}]}},"\/projects\/{projectId}\/platforms\/{platformId}":{"get":{"summary":"Get Platform","operationId":"projectsGetPlatform","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Platform","schema":{"$ref":"#\/definitions\/platform"}}},"x-appwrite":{"method":"getPlatform","weight":119,"cookies":false,"type":"","demo":"projects\/get-platform.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":[],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"platformId","description":"Platform unique ID.","required":true,"type":"string","x-example":"[PLATFORM_ID]","in":"path"}]},"put":{"summary":"Update Platform","operationId":"projectsUpdatePlatform","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Platform","schema":{"$ref":"#\/definitions\/platform"}}},"x-appwrite":{"method":"updatePlatform","weight":120,"cookies":false,"type":"","demo":"projects\/update-platform.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":[],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"platformId","description":"Platform unique ID.","required":true,"type":"string","x-example":"[PLATFORM_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Platform name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"key":{"type":"string","description":"Package name for android or bundle ID for iOS. Max length: 256 chars.","default":"","x-example":"[KEY]"},"store":{"type":"string","description":"App store or Google Play store ID. Max length: 256 chars.","default":"","x-example":"[STORE]"},"hostname":{"type":"string","description":"Platform client URL. Max length: 256 chars.","default":"","x-example":"[HOSTNAME]"}},"required":["name"]}}]},"delete":{"summary":"Delete Platform","operationId":"projectsDeletePlatform","consumes":["application\/json"],"produces":[],"tags":["projects"],"description":"","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deletePlatform","weight":121,"cookies":false,"type":"","demo":"projects\/delete-platform.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":[],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"platformId","description":"Platform unique ID.","required":true,"type":"string","x-example":"[PLATFORM_ID]","in":"path"}]}},"\/projects\/{projectId}\/tasks":{"get":{"summary":"List Tasks","operationId":"projectsListTasks","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Tasks List","schema":{"$ref":"#\/definitions\/taskList"}}},"x-appwrite":{"method":"listTasks","weight":113,"cookies":false,"type":"","demo":"projects\/list-tasks.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":[],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"}]},"post":{"summary":"Create Task","operationId":"projectsCreateTask","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"201":{"description":"Task","schema":{"$ref":"#\/definitions\/task"}}},"x-appwrite":{"method":"createTask","weight":112,"cookies":false,"type":"","demo":"projects\/create-task.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":[],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Task name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"status":{"type":"string","description":"Task status.","default":null,"x-example":"play"},"schedule":{"type":"string","description":"Task schedule CRON syntax.","default":null,"x-example":null},"security":{"type":"boolean","description":"Certificate verification, false for disabled or true for enabled.","default":null,"x-example":false},"httpMethod":{"type":"string","description":"Task HTTP method.","default":null,"x-example":"GET"},"httpUrl":{"type":"string","description":"Task HTTP URL","default":null,"x-example":"https:\/\/example.com"},"httpHeaders":{"type":"array","description":"Task HTTP headers list.","default":null,"x-example":null,"items":{"type":"string"}},"httpUser":{"type":"string","description":"Task HTTP user. Max length: 256 chars.","default":"","x-example":"[HTTP_USER]"},"httpPass":{"type":"string","description":"Task HTTP password. Max length: 256 chars.","default":"","x-example":"[HTTP_PASS]"}},"required":["name","status","schedule","security","httpMethod","httpUrl"]}}]}},"\/projects\/{projectId}\/tasks\/{taskId}":{"get":{"summary":"Get Task","operationId":"projectsGetTask","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Task","schema":{"$ref":"#\/definitions\/task"}}},"x-appwrite":{"method":"getTask","weight":114,"cookies":false,"type":"","demo":"projects\/get-task.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":[],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"taskId","description":"Task unique ID.","required":true,"type":"string","x-example":"[TASK_ID]","in":"path"}]},"put":{"summary":"Update Task","operationId":"projectsUpdateTask","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Task","schema":{"$ref":"#\/definitions\/task"}}},"x-appwrite":{"method":"updateTask","weight":115,"cookies":false,"type":"","demo":"projects\/update-task.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":[],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"taskId","description":"Task unique ID.","required":true,"type":"string","x-example":"[TASK_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Task name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"status":{"type":"string","description":"Task status.","default":null,"x-example":"play"},"schedule":{"type":"string","description":"Task schedule CRON syntax.","default":null,"x-example":null},"security":{"type":"boolean","description":"Certificate verification, false for disabled or true for enabled.","default":null,"x-example":false},"httpMethod":{"type":"string","description":"Task HTTP method.","default":null,"x-example":"GET"},"httpUrl":{"type":"string","description":"Task HTTP URL.","default":null,"x-example":"https:\/\/example.com"},"httpHeaders":{"type":"array","description":"Task HTTP headers list.","default":null,"x-example":null,"items":{"type":"string"}},"httpUser":{"type":"string","description":"Task HTTP user. Max length: 256 chars.","default":"","x-example":"[HTTP_USER]"},"httpPass":{"type":"string","description":"Task HTTP password. Max length: 256 chars.","default":"","x-example":"[HTTP_PASS]"}},"required":["name","status","schedule","security","httpMethod","httpUrl"]}}]},"delete":{"summary":"Delete Task","operationId":"projectsDeleteTask","consumes":["application\/json"],"produces":[],"tags":["projects"],"description":"","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteTask","weight":116,"cookies":false,"type":"","demo":"projects\/delete-task.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":[],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"taskId","description":"Task unique ID.","required":true,"type":"string","x-example":"[TASK_ID]","in":"path"}]}},"\/projects\/{projectId}\/usage":{"get":{"summary":"Get Project","operationId":"projectsGetUsage","consumes":["application\/json"],"produces":[],"tags":["projects"],"description":"","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getUsage","weight":98,"cookies":false,"type":"","demo":"projects\/get-usage.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":[],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"range","description":"Date range.","required":false,"type":"string","x-example":"24h","default":"30d","in":"query"}]}},"\/projects\/{projectId}\/webhooks":{"get":{"summary":"List Webhooks","operationId":"projectsListWebhooks","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Webhooks List","schema":{"$ref":"#\/definitions\/webhookList"}}},"x-appwrite":{"method":"listWebhooks","weight":103,"cookies":false,"type":"","demo":"projects\/list-webhooks.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":[],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"}]},"post":{"summary":"Create Webhook","operationId":"projectsCreateWebhook","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"201":{"description":"Webhook","schema":{"$ref":"#\/definitions\/webhook"}}},"x-appwrite":{"method":"createWebhook","weight":102,"cookies":false,"type":"","demo":"projects\/create-webhook.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":[],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Webhook name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"events":{"type":"array","description":"Events list.","default":null,"x-example":null,"items":{"type":"string"}},"url":{"type":"string","description":"Webhook URL.","default":null,"x-example":"https:\/\/example.com"},"security":{"type":"boolean","description":"Certificate verification, false for disabled or true for enabled.","default":null,"x-example":false},"httpUser":{"type":"string","description":"Webhook HTTP user. Max length: 256 chars.","default":"","x-example":"[HTTP_USER]"},"httpPass":{"type":"string","description":"Webhook HTTP password. Max length: 256 chars.","default":"","x-example":"[HTTP_PASS]"}},"required":["name","events","url","security"]}}]}},"\/projects\/{projectId}\/webhooks\/{webhookId}":{"get":{"summary":"Get Webhook","operationId":"projectsGetWebhook","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Webhook","schema":{"$ref":"#\/definitions\/webhook"}}},"x-appwrite":{"method":"getWebhook","weight":104,"cookies":false,"type":"","demo":"projects\/get-webhook.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":[],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"webhookId","description":"Webhook unique ID.","required":true,"type":"string","x-example":"[WEBHOOK_ID]","in":"path"}]},"put":{"summary":"Update Webhook","operationId":"projectsUpdateWebhook","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Webhook","schema":{"$ref":"#\/definitions\/webhook"}}},"x-appwrite":{"method":"updateWebhook","weight":105,"cookies":false,"type":"","demo":"projects\/update-webhook.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":[],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"webhookId","description":"Webhook unique ID.","required":true,"type":"string","x-example":"[WEBHOOK_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Webhook name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"events":{"type":"array","description":"Events list.","default":null,"x-example":null,"items":{"type":"string"}},"url":{"type":"string","description":"Webhook URL.","default":null,"x-example":"https:\/\/example.com"},"security":{"type":"boolean","description":"Certificate verification, false for disabled or true for enabled.","default":null,"x-example":false},"httpUser":{"type":"string","description":"Webhook HTTP user. Max length: 256 chars.","default":"","x-example":"[HTTP_USER]"},"httpPass":{"type":"string","description":"Webhook HTTP password. Max length: 256 chars.","default":"","x-example":"[HTTP_PASS]"}},"required":["name","events","url","security"]}}]},"delete":{"summary":"Delete Webhook","operationId":"projectsDeleteWebhook","consumes":["application\/json"],"produces":[],"tags":["projects"],"description":"","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteWebhook","weight":106,"cookies":false,"type":"","demo":"projects\/delete-webhook.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":[],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"webhookId","description":"Webhook unique ID.","required":true,"type":"string","x-example":"[WEBHOOK_ID]","in":"path"}]}},"\/storage\/files":{"get":{"summary":"List Files","operationId":"storageListFiles","consumes":["application\/json"],"produces":["application\/json"],"tags":["storage"],"description":"Get a list of all the user files. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project's files. [Learn more about different API modes](\/docs\/admin).","responses":{"200":{"description":"Files List","schema":{"$ref":"#\/definitions\/fileList"}}},"x-appwrite":{"method":"listFiles","weight":128,"cookies":false,"type":"","demo":"storage\/list-files.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/list-files.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.read","platforms":["client","server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Results offset. The default value is 0. Use this param to manage pagination.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create File","operationId":"storageCreateFile","consumes":["multipart\/form-data"],"produces":["application\/json"],"tags":["storage"],"description":"Create a new file. The user who creates the file will automatically be assigned to read and write access unless he has passed custom values for read and write arguments.","responses":{"201":{"description":"File","schema":{"$ref":"#\/definitions\/file"}}},"x-appwrite":{"method":"createFile","weight":127,"cookies":false,"type":"upload","demo":"storage\/create-file.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/create-file.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.write","platforms":["client","server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"file","description":"Binary file.","required":true,"type":"file","in":"formData"},{"name":"read","description":"An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","required":true,"type":"array","collectionFormat":"multi","items":{"type":"string"},"in":"formData"},{"name":"write","description":"An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","required":true,"type":"array","collectionFormat":"multi","items":{"type":"string"},"in":"formData"}]}},"\/storage\/files\/{fileId}":{"get":{"summary":"Get File","operationId":"storageGetFile","consumes":["application\/json"],"produces":["application\/json"],"tags":["storage"],"description":"Get a file by its unique ID. This endpoint response returns a JSON object with the file metadata.","responses":{"200":{"description":"File","schema":{"$ref":"#\/definitions\/file"}}},"x-appwrite":{"method":"getFile","weight":129,"cookies":false,"type":"","demo":"storage\/get-file.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/get-file.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.read","platforms":["client","server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"fileId","description":"File unique ID.","required":true,"type":"string","x-example":"[FILE_ID]","in":"path"}]},"put":{"summary":"Update File","operationId":"storageUpdateFile","consumes":["application\/json"],"produces":["application\/json"],"tags":["storage"],"description":"Update a file by its unique ID. Only users with write permissions have access to update this resource.","responses":{"200":{"description":"File","schema":{"$ref":"#\/definitions\/file"}}},"x-appwrite":{"method":"updateFile","weight":133,"cookies":false,"type":"","demo":"storage\/update-file.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/update-file.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.write","platforms":["client","server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"fileId","description":"File unique ID.","required":true,"type":"string","x-example":"[FILE_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"read":{"type":"array","description":"An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}},"write":{"type":"array","description":"An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}}},"required":["read","write"]}}]},"delete":{"summary":"Delete File","operationId":"storageDeleteFile","consumes":["application\/json"],"produces":[],"tags":["storage"],"description":"Delete a file by its unique ID. Only users with write permissions have access to delete this resource.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteFile","weight":134,"cookies":false,"type":"","demo":"storage\/delete-file.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/delete-file.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.write","platforms":["client","server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"fileId","description":"File unique ID.","required":true,"type":"string","x-example":"[FILE_ID]","in":"path"}]}},"\/storage\/files\/{fileId}\/download":{"get":{"summary":"Get File for Download","operationId":"storageGetFileDownload","consumes":["application\/json"],"produces":["*\/*"],"tags":["storage"],"description":"Get a file content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory.","responses":{"200":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getFileDownload","weight":131,"cookies":false,"type":"location","demo":"storage\/get-file-download.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/get-file-download.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.read","platforms":["client","server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"fileId","description":"File unique ID.","required":true,"type":"string","x-example":"[FILE_ID]","in":"path"}]}},"\/storage\/files\/{fileId}\/preview":{"get":{"summary":"Get File Preview","operationId":"storageGetFilePreview","consumes":["application\/json"],"produces":["image\/*"],"tags":["storage"],"description":"Get a file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets, will return the file icon image. You can also pass query string arguments for cutting and resizing your preview image.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getFilePreview","weight":130,"cookies":false,"type":"location","demo":"storage\/get-file-preview.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/get-file-preview.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.read","platforms":["client","server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"fileId","description":"File unique ID","required":true,"type":"string","x-example":"[FILE_ID]","in":"path"},{"name":"width","description":"Resize preview image width, Pass an integer between 0 to 4000.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"height","description":"Resize preview image height, Pass an integer between 0 to 4000.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"quality","description":"Preview image quality. Pass an integer between 0 to 100. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"background","description":"Preview image background color. Only works with transparent images (png). Use a valid HEX color, no # is needed for prefix.","required":false,"type":"string","default":"","in":"query"},{"name":"output","description":"Output format type (jpeg, jpg, png, gif and webp).","required":false,"type":"string","x-example":"jpg","default":"","in":"query"}]}},"\/storage\/files\/{fileId}\/view":{"get":{"summary":"Get File for View","operationId":"storageGetFileView","consumes":["application\/json"],"produces":["*\/*"],"tags":["storage"],"description":"Get a file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header.","responses":{"200":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getFileView","weight":132,"cookies":false,"type":"location","demo":"storage\/get-file-view.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/get-file-view.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.read","platforms":["client","server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"fileId","description":"File unique ID.","required":true,"type":"string","x-example":"[FILE_ID]","in":"path"}]}},"\/teams":{"get":{"summary":"List Teams","operationId":"teamsList","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Get a list of all the current user teams. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project's teams. [Learn more about different API modes](\/docs\/admin).","responses":{"200":{"description":"Teams List","schema":{"$ref":"#\/definitions\/teamList"}}},"x-appwrite":{"method":"list","weight":136,"cookies":false,"type":"","demo":"teams\/list.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/list-teams.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.read","platforms":["client","server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Results offset. The default value is 0. Use this param to manage pagination.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create Team","operationId":"teamsCreate","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Create a new team. The user who creates the team will automatically be assigned as the owner of the team. The team owner can invite new members, who will be able add new owners and update or delete the team from your project.","responses":{"201":{"description":"Team","schema":{"$ref":"#\/definitions\/team"}}},"x-appwrite":{"method":"create","weight":135,"cookies":false,"type":"","demo":"teams\/create.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/create-team.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.write","platforms":["client","server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Team name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"roles":{"type":"array","description":"Array of strings. Use this param to set the roles in the team for the user who created it. The default role is **owner**. A role can be any string. Learn more about [roles and permissions](\/docs\/permissions). Max length for each role is 32 chars.","default":["owner"],"x-example":null,"items":{"type":"string"}}},"required":["name"]}}]}},"\/teams\/{teamId}":{"get":{"summary":"Get Team","operationId":"teamsGet","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Get a team by its unique ID. All team members have read access for this resource.","responses":{"200":{"description":"Team","schema":{"$ref":"#\/definitions\/team"}}},"x-appwrite":{"method":"get","weight":137,"cookies":false,"type":"","demo":"teams\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/get-team.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.read","platforms":["client","server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"teamId","description":"Team unique ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"}]},"put":{"summary":"Update Team","operationId":"teamsUpdate","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Update a team by its unique ID. Only team owners have write access for this resource.","responses":{"200":{"description":"Team","schema":{"$ref":"#\/definitions\/team"}}},"x-appwrite":{"method":"update","weight":138,"cookies":false,"type":"","demo":"teams\/update.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/update-team.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.write","platforms":["client","server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"teamId","description":"Team unique ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Team name. Max length: 128 chars.","default":null,"x-example":"[NAME]"}},"required":["name"]}}]},"delete":{"summary":"Delete Team","operationId":"teamsDelete","consumes":["application\/json"],"produces":[],"tags":["teams"],"description":"Delete a team by its unique ID. Only team owners have write access for this resource.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"delete","weight":139,"cookies":false,"type":"","demo":"teams\/delete.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/delete-team.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.write","platforms":["client","server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"teamId","description":"Team unique ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"}]}},"\/teams\/{teamId}\/memberships":{"get":{"summary":"Get Team Memberships","operationId":"teamsGetMemberships","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Get a team members by the team unique ID. All team members have read access for this list of resources.","responses":{"200":{"description":"Memberships List","schema":{"$ref":"#\/definitions\/membershipList"}}},"x-appwrite":{"method":"getMemberships","weight":141,"cookies":false,"type":"","demo":"teams\/get-memberships.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/get-team-members.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.read","platforms":["client","server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"teamId","description":"Team unique ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"},{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Results offset. The default value is 0. Use this param to manage pagination.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create Team Membership","operationId":"teamsCreateMembership","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Use this endpoint to invite a new member to join your team. An email with a link to join the team will be sent to the new member email address if the member doesn't exist in the project it will be created automatically.\n\nUse the 'URL' parameter to redirect the user from the invitation email back to your app. When the user is redirected, use the [Update Team Membership Status](\/docs\/client\/teams#teamsUpdateMembershipStatus) endpoint to allow the user to accept the invitation to the team.\n\nPlease note that in order to avoid a [Redirect Attacks](https:\/\/github.com\/OWASP\/CheatSheetSeries\/blob\/master\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URL's are the once from domains you have set when added your platforms in the console interface.","responses":{"201":{"description":"Membership","schema":{"$ref":"#\/definitions\/membership"}}},"x-appwrite":{"method":"createMembership","weight":140,"cookies":false,"type":"","demo":"teams\/create-membership.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/create-team-membership.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.write","platforms":["client","server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"teamId","description":"Team unique ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"email":{"type":"string","description":"New team member email.","default":null,"x-example":"email@example.com"},"name":{"type":"string","description":"New team member name. Max length: 128 chars.","default":"","x-example":"[NAME]"},"roles":{"type":"array","description":"Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](\/docs\/permissions). Max length for each role is 32 chars.","default":null,"x-example":null,"items":{"type":"string"}},"url":{"type":"string","description":"URL to redirect the user back to your app from the invitation email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.","default":null,"x-example":"https:\/\/example.com"}},"required":["email","roles","url"]}}]}},"\/teams\/{teamId}\/memberships\/{inviteId}":{"delete":{"summary":"Delete Team Membership","operationId":"teamsDeleteMembership","consumes":["application\/json"],"produces":[],"tags":["teams"],"description":"This endpoint allows a user to leave a team or for a team owner to delete the membership of any other team member. You can also use this endpoint to delete a user membership even if it is not accepted.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteMembership","weight":143,"cookies":false,"type":"","demo":"teams\/delete-membership.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/delete-team-membership.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.write","platforms":["client","server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"teamId","description":"Team unique ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"},{"name":"inviteId","description":"Invite unique ID.","required":true,"type":"string","x-example":"[INVITE_ID]","in":"path"}]}},"\/teams\/{teamId}\/memberships\/{inviteId}\/status":{"patch":{"summary":"Update Team Membership Status","operationId":"teamsUpdateMembershipStatus","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Use this endpoint to allow a user to accept an invitation to join a team after being redirected back to your app from the invitation email recieved by the user.","responses":{"200":{"description":"Membership","schema":{"$ref":"#\/definitions\/membership"}}},"x-appwrite":{"method":"updateMembershipStatus","weight":142,"cookies":false,"type":"","demo":"teams\/update-membership-status.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/update-team-membership-status.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"public","platforms":["client"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"teamId","description":"Team unique ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"},{"name":"inviteId","description":"Invite unique ID.","required":true,"type":"string","x-example":"[INVITE_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"userId":{"type":"string","description":"User unique ID.","default":null,"x-example":"[USER_ID]"},"secret":{"type":"string","description":"Secret key.","default":null,"x-example":"[SECRET]"}},"required":["userId","secret"]}}]}},"\/users":{"get":{"summary":"List Users","operationId":"usersList","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Get a list of all the project's users. You can use the query params to filter your results.","responses":{"200":{"description":"Users List","schema":{"$ref":"#\/definitions\/userList"}}},"x-appwrite":{"method":"list","weight":145,"cookies":false,"type":"","demo":"users\/list.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/list-users.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.read","platforms":["server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Results offset. The default value is 0. Use this param to manage pagination.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create User","operationId":"usersCreate","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Create a new user.","responses":{"201":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"create","weight":144,"cookies":false,"type":"","demo":"users\/create.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/create-user.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"email":{"type":"string","description":"User email.","default":null,"x-example":"email@example.com"},"password":{"type":"string","description":"User password. Must be between 6 to 32 chars.","default":null,"x-example":"password"},"name":{"type":"string","description":"User name. Max length: 128 chars.","default":"","x-example":"[NAME]"}},"required":["email","password"]}}]}},"\/users\/{userId}":{"get":{"summary":"Get User","operationId":"usersGet","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Get a user by its unique ID.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"get","weight":146,"cookies":false,"type":"","demo":"users\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/get-user.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.read","platforms":["server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"}]},"delete":{"summary":"Delete User","operationId":"usersDeleteUser","consumes":["application\/json"],"produces":[],"tags":["users"],"description":"Delete a user by its unique ID.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteUser","weight":154,"cookies":false,"type":"","demo":"users\/delete-user.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/delete-user.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"}]}},"\/users\/{userId}\/logs":{"get":{"summary":"Get User Logs","operationId":"usersGetLogs","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Get a user activity logs list by its unique ID.","responses":{"200":{"description":"Logs List","schema":{"$ref":"#\/definitions\/logList"}}},"x-appwrite":{"method":"getLogs","weight":149,"cookies":false,"type":"","demo":"users\/get-logs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/get-user-logs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.read","platforms":["server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"}]}},"\/users\/{userId}\/prefs":{"get":{"summary":"Get User Preferences","operationId":"usersGetPrefs","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Get the user preferences by its unique ID.","responses":{"200":{"description":"Any","schema":{"$ref":"#\/definitions\/any"}}},"x-appwrite":{"method":"getPrefs","weight":147,"cookies":false,"type":"","demo":"users\/get-prefs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/get-user-prefs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.read","platforms":["server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"}]},"patch":{"summary":"Update User Preferences","operationId":"usersUpdatePrefs","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Update the user preferences by its unique ID. You can pass only the specific settings you wish to update.","responses":{"200":{"description":"Any","schema":{"$ref":"#\/definitions\/any"}}},"x-appwrite":{"method":"updatePrefs","weight":151,"cookies":false,"type":"","demo":"users\/update-prefs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/update-user-prefs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"prefs":{"type":"object","description":"Prefs key-value JSON object.","default":null,"x-example":"{}"}},"required":["prefs"]}}]}},"\/users\/{userId}\/sessions":{"get":{"summary":"Get User Sessions","operationId":"usersGetSessions","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Get the user sessions list by its unique ID.","responses":{"200":{"description":"Sessions List","schema":{"$ref":"#\/definitions\/sessionList"}}},"x-appwrite":{"method":"getSessions","weight":148,"cookies":false,"type":"","demo":"users\/get-sessions.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/get-user-sessions.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.read","platforms":["server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"}]},"delete":{"summary":"Delete User Sessions","operationId":"usersDeleteSessions","consumes":["application\/json"],"produces":[],"tags":["users"],"description":"Delete all user's sessions by using the user's unique ID.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteSessions","weight":153,"cookies":false,"type":"","demo":"users\/delete-sessions.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/delete-user-sessions.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"}]}},"\/users\/{userId}\/sessions\/{sessionId}":{"delete":{"summary":"Delete User Session","operationId":"usersDeleteSession","consumes":["application\/json"],"produces":[],"tags":["users"],"description":"Delete a user sessions by its unique ID.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteSession","weight":152,"cookies":false,"type":"","demo":"users\/delete-session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/delete-user-session.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"},{"name":"sessionId","description":"User unique session ID.","required":true,"type":"string","x-example":"[SESSION_ID]","in":"path"}]}},"\/users\/{userId}\/status":{"patch":{"summary":"Update User Status","operationId":"usersUpdateStatus","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Update the user status by its unique ID.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updateStatus","weight":150,"cookies":false,"type":"","demo":"users\/update-status.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/update-user-status.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"status":{"type":"string","description":"User Status code. To activate the user pass 1, to block the user pass 2 and for disabling the user pass 0","default":null,"x-example":1}},"required":["status"]}}]}}},"tags":[{"name":"account","description":"The Account service allows you to authenticate and manage a user account."},{"name":"avatars","description":"The Avatars service aims to help you complete everyday tasks related to your app image, icons, and avatars."},{"name":"database","description":"The Database service allows you to create structured collections of documents, query and filter lists of documents"},{"name":"locale","description":"The Locale service allows you to customize your app based on your users' location."},{"name":"health","description":"The Health service allows you to both validate and monitor your Appwrite server's health."},{"name":"projects","description":"The Project service allows you to manage all the projects in your Appwrite server."},{"name":"storage","description":"The Storage service allows you to manage your project files."},{"name":"teams","description":"The Teams service allows you to group users of your project and to enable them to share read and write access to your project resources"},{"name":"users","description":"The Users service allows you to manage your project users."},{"name":"functions","description":"The Functions Service allows you view, create and manage your Cloud Functions."}],"definitions":{"none":{"description":"None","type":"object"},"any":{"description":"Any","type":"object","additionalProperties":true},"error":{"description":"Error","type":"object","properties":{"message":{"type":"string","description":"Error message.","x-example":"Not found"},"code":{"type":"string","description":"Error code.","x-example":"404"},"version":{"type":"string","description":"Server version number.","x-example":"1.0"}},"required":["message","code","version"]},"errorDev":{"description":"Error","type":"object","properties":{"message":{"type":"string","description":"Error message.","x-example":"Not found"},"code":{"type":"string","description":"Error code.","x-example":"404"},"version":{"type":"string","description":"Server version number.","x-example":"1.0"},"file":{"type":"string","description":"File path.","x-example":"\/usr\/code\/vendor\/utopia-php\/framework\/src\/App.php"},"line":{"type":"integer","description":"Line number.","x-example":209,"format":"int32"},"trace":{"type":"array","description":"Error trace.","items":{"type":"string"},"x-example":""}},"required":["message","code","version","file","line","trace"]},"collectionList":{"description":"Collections List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"collections":{"type":"array","description":"List of collections.","items":{"type":"object","$ref":"#\/definitions\/collection"},"x-example":""}},"required":["sum","collections"]},"documentList":{"description":"Documents List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"documents":{"type":"array","description":"List of documents.","items":{"type":"object","$ref":"#\/definitions\/any"},"x-example":""}},"required":["sum","documents"]},"userList":{"description":"Users List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"users":{"type":"array","description":"List of users.","items":{"type":"object","$ref":"#\/definitions\/user"},"x-example":""}},"required":["sum","users"]},"sessionList":{"description":"Sessions List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"sessions":{"type":"array","description":"List of sessions.","items":{"type":"object","$ref":"#\/definitions\/session"},"x-example":""}},"required":["sum","sessions"]},"logList":{"description":"Logs List","type":"object","properties":{"logs":{"type":"array","description":"List of logs.","items":{"type":"object","$ref":"#\/definitions\/log"},"x-example":""}},"required":["logs"]},"fileList":{"description":"Files List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"files":{"type":"array","description":"List of files.","items":{"type":"object","$ref":"#\/definitions\/file"},"x-example":""}},"required":["sum","files"]},"teamList":{"description":"Teams List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"teams":{"type":"array","description":"List of teams.","items":{"type":"object","$ref":"#\/definitions\/team"},"x-example":""}},"required":["sum","teams"]},"membershipList":{"description":"Memberships List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"memberships":{"type":"array","description":"List of memberships.","items":{"type":"object","$ref":"#\/definitions\/membership"},"x-example":""}},"required":["sum","memberships"]},"functionList":{"description":"Functions List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"functions":{"type":"array","description":"List of functions.","items":{"type":"object","$ref":"#\/definitions\/function"},"x-example":""}},"required":["sum","functions"]},"tagList":{"description":"Tags List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"tags":{"type":"array","description":"List of tags.","items":{"type":"object","$ref":"#\/definitions\/tag"},"x-example":""}},"required":["sum","tags"]},"executionList":{"description":"Executions List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"executions":{"type":"array","description":"List of executions.","items":{"type":"object","$ref":"#\/definitions\/execution"},"x-example":""}},"required":["sum","executions"]},"projectList":{"description":"Projects List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"projects":{"type":"array","description":"List of projects.","items":{"type":"object","$ref":"#\/definitions\/project"},"x-example":""}},"required":["sum","projects"]},"webhookList":{"description":"Webhooks List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"webhooks":{"type":"array","description":"List of webhooks.","items":{"type":"object","$ref":"#\/definitions\/webhook"},"x-example":""}},"required":["sum","webhooks"]},"keyList":{"description":"API Keys List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"keys":{"type":"array","description":"List of keys.","items":{"type":"object","$ref":"#\/definitions\/key"},"x-example":""}},"required":["sum","keys"]},"taskList":{"description":"Tasks List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"tasks":{"type":"array","description":"List of tasks.","items":{"type":"object","$ref":"#\/definitions\/task"},"x-example":""}},"required":["sum","tasks"]},"platformList":{"description":"Platforms List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"platforms":{"type":"array","description":"List of platforms.","items":{"type":"object","$ref":"#\/definitions\/platform"},"x-example":""}},"required":["sum","platforms"]},"domainList":{"description":"Domains List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"domains":{"type":"array","description":"List of domains.","items":{"type":"object","$ref":"#\/definitions\/domain"},"x-example":""}},"required":["sum","domains"]},"countryList":{"description":"Countries List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"countries":{"type":"array","description":"List of countries.","items":{"type":"object","$ref":"#\/definitions\/country"},"x-example":""}},"required":["sum","countries"]},"continentList":{"description":"Continents List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"continents":{"type":"array","description":"List of continents.","items":{"type":"object","$ref":"#\/definitions\/continent"},"x-example":""}},"required":["sum","continents"]},"languageList":{"description":"Languages List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"languages":{"type":"array","description":"List of languages.","items":{"type":"object","$ref":"#\/definitions\/language"},"x-example":""}},"required":["sum","languages"]},"currencyList":{"description":"Currencies List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"currencies":{"type":"array","description":"List of currencies.","items":{"type":"object","$ref":"#\/definitions\/currency"},"x-example":""}},"required":["sum","currencies"]},"phoneList":{"description":"Phones List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"phones":{"type":"array","description":"List of phones.","items":{"type":"object","$ref":"#\/definitions\/phone"},"x-example":""}},"required":["sum","phones"]},"permissions":{"description":"Permissions","type":"object","properties":{"read":{"type":"array","description":"Read permissions.","items":{"type":"string"},"x-example":"user:5e5ea5c16897e"},"write":{"type":"array","description":"Write permissions.","items":{"type":"string"},"x-example":"user:5e5ea5c16897e"}},"required":["read","write"]},"collection":{"description":"Collection","type":"object","properties":{"$id":{"type":"string","description":"Collection ID.","x-example":"5e5ea5c16897e"},"$permissions":{"type":"object","description":"Collection permissions.","x-example":{},"items":{"type":"object","$ref":"#\/definitions\/permissions"}},"name":{"type":"string","description":"Collection name.","x-example":"Movies"},"dateCreated":{"type":"integer","description":"Collection creation date in Unix timestamp.","x-example":1592981250,"format":"int32"},"dateUpdated":{"type":"integer","description":"Collection creation date in Unix timestamp.","x-example":1592981550,"format":"int32"},"rules":{"type":"array","description":"Collection rules.","items":{"type":"object","$ref":"#\/definitions\/rule"},"x-example":""}},"required":["$id","$permissions","name","dateCreated","dateUpdated","rules"]},"rule":{"description":"Rule","type":"object","properties":{"$id":{"type":"string","description":"Rule ID.","x-example":"5e5ea5c16897e"},"$collection":{"type":"string","description":"Rule Collection.","x-example":"5e5e66c16897e"},"type":{"type":"string","description":"Rule type. Possible values: ","x-example":"title"},"key":{"type":"string","description":"Rule key.","x-example":"title"},"label":{"type":"string","description":"Rule label.","x-example":"Title"},"default":{"type":"string","description":"Rule default value.","x-example":"Movie Name"},"array":{"type":"boolean","description":"Is array?","x-example":false},"required":{"type":"boolean","description":"Is required?","x-example":true},"list":{"type":"array","description":"List of allowed values","items":{"type":"string"},"x-example":"5e5ea5c168099"}},"required":["$id","$collection","type","key","label","default","array","required","list"]},"log":{"description":"Log","type":"object","properties":{"event":{"type":"string","description":"Event name.","x-example":"account.sessions.create"},"ip":{"type":"string","description":"IP session in use when the session was created.","x-example":"127.0.0.1"},"time":{"type":"integer","description":"Log creation time in Unix timestamp.","x-example":1592981250,"format":"int32"},"osCode":{"type":"string","description":"Operating system code name. View list of [available options](https:\/\/github.com\/appwrite\/appwrite\/blob\/master\/docs\/lists\/os.json).","x-example":"Mac"},"osName":{"type":"string","description":"Operating system name.","x-example":"Mac"},"osVersion":{"type":"string","description":"Operating system version.","x-example":"Mac"},"clientType":{"type":"string","description":"Client type.","x-example":"browser"},"clientCode":{"type":"string","description":"Client code name. View list of [available options](https:\/\/github.com\/appwrite\/appwrite\/blob\/master\/docs\/lists\/clients.json).","x-example":"CM"},"clientName":{"type":"string","description":"Client name.","x-example":"Chrome Mobile iOS"},"clientVersion":{"type":"string","description":"Client version.","x-example":"84.0"},"clientEngine":{"type":"string","description":"Client engine name.","x-example":"WebKit"},"clientEngineVersion":{"type":"string","description":"Client engine name.","x-example":"605.1.15"},"deviceName":{"type":"string","description":"Device name.","x-example":"smartphone"},"deviceBrand":{"type":"string","description":"Device brand name.","x-example":"Google"},"deviceModel":{"type":"string","description":"Device model name.","x-example":"Nexus 5"},"countryCode":{"type":"string","description":"Country two-character ISO 3166-1 alpha code.","x-example":"US"},"countryName":{"type":"string","description":"Country name.","x-example":"United States"}},"required":["event","ip","time","osCode","osName","osVersion","clientType","clientCode","clientName","clientVersion","clientEngine","clientEngineVersion","deviceName","deviceBrand","deviceModel","countryCode","countryName"]},"user":{"description":"User","type":"object","properties":{"$id":{"type":"string","description":"User ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"User name.","x-example":"John Doe"},"registration":{"type":"integer","description":"User registration date in Unix timestamp.","x-example":1592981250,"format":"int32"},"status":{"type":"integer","description":"User status. 0 for Unactivated, 1 for active and 2 is blocked.","x-example":0,"format":"int32"},"email":{"type":"string","description":"User email address.","x-example":"john@appwrite.io"},"emailVerification":{"type":"boolean","description":"Email verification status.","x-example":true},"prefs":{"type":"string","description":"User preferences as a key-value object","x-example":{"theme":"pink","timezone":"UTC"}}},"required":["$id","name","registration","status","email","emailVerification","prefs"]},"session":{"description":"Session","type":"object","properties":{"$id":{"type":"string","description":"Session ID.","x-example":"5e5ea5c16897e"},"userId":{"type":"string","description":"User ID.","x-example":"5e5bb8c16897e"},"expire":{"type":"integer","description":"Session expiration date in Unix timestamp.","x-example":1592981250,"format":"int32"},"ip":{"type":"string","description":"IP in use when the session was created.","x-example":"127.0.0.1"},"osCode":{"type":"string","description":"Operating system code name. View list of [available options](https:\/\/github.com\/appwrite\/appwrite\/blob\/master\/docs\/lists\/os.json).","x-example":"Mac"},"osName":{"type":"string","description":"Operating system name.","x-example":"Mac"},"osVersion":{"type":"string","description":"Operating system version.","x-example":"Mac"},"clientType":{"type":"string","description":"Client type.","x-example":"browser"},"clientCode":{"type":"string","description":"Client code name. View list of [available options](https:\/\/github.com\/appwrite\/appwrite\/blob\/master\/docs\/lists\/clients.json).","x-example":"CM"},"clientName":{"type":"string","description":"Client name.","x-example":"Chrome Mobile iOS"},"clientVersion":{"type":"string","description":"Client version.","x-example":"84.0"},"clientEngine":{"type":"string","description":"Client engine name.","x-example":"WebKit"},"clientEngineVersion":{"type":"string","description":"Client engine name.","x-example":"605.1.15"},"deviceName":{"type":"string","description":"Device name.","x-example":"smartphone"},"deviceBrand":{"type":"string","description":"Device brand name.","x-example":"Google"},"deviceModel":{"type":"string","description":"Device model name.","x-example":"Nexus 5"},"countryCode":{"type":"string","description":"Country two-character ISO 3166-1 alpha code.","x-example":"US"},"countryName":{"type":"string","description":"Country name.","x-example":"United States"},"current":{"type":"boolean","description":"Returns true if this the current user session.","x-example":true}},"required":["$id","userId","expire","ip","osCode","osName","osVersion","clientType","clientCode","clientName","clientVersion","clientEngine","clientEngineVersion","deviceName","deviceBrand","deviceModel","countryCode","countryName","current"]},"token":{"description":"Token","type":"object","properties":{"$id":{"type":"string","description":"Token ID.","x-example":"bb8ea5c16897e"},"userId":{"type":"string","description":"User ID.","x-example":"5e5ea5c168bb8"},"secret":{"type":"string","description":"Token secret key. This will return an empty string unless the response is returned using an API key or as part of a webhook payload.","x-example":""},"expire":{"type":"integer","description":"Token expiration date in Unix timestamp.","x-example":1592981250,"format":"int32"}},"required":["$id","userId","secret","expire"]},"jwt":{"description":"JWT","type":"object","properties":{"jwt":{"type":"string","description":"JWT encoded string.","x-example":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"}},"required":["jwt"]},"locale":{"description":"Locale","type":"object","properties":{"ip":{"type":"string","description":"User IP address.","x-example":"127.0.0.1"},"countryCode":{"type":"string","description":"Country code in [ISO 3166-1](http:\/\/en.wikipedia.org\/wiki\/ISO_3166-1) two-character format","x-example":"US"},"country":{"type":"string","description":"Country name. This field support localization.","x-example":"United States"},"continentCode":{"type":"string","description":"Continent code. A two character continent code \"AF\" for Africa, \"AN\" for Antarctica, \"AS\" for Asia, \"EU\" for Europe, \"NA\" for North America, \"OC\" for Oceania, and \"SA\" for South America.","x-example":"NA"},"continent":{"type":"string","description":"Continent name. This field support localization.","x-example":"North America"},"eu":{"type":"boolean","description":"True if country is part of the Europian Union.","x-example":false},"currency":{"type":"string","description":"Currency code in [ISO 4217-1](http:\/\/en.wikipedia.org\/wiki\/ISO_4217) three-character format","x-example":"USD"}},"required":["ip","countryCode","country","continentCode","continent","eu","currency"]},"file":{"description":"File","type":"object","properties":{"$id":{"type":"string","description":"File ID.","x-example":"5e5ea5c16897e"},"$permissions":{"type":"object","description":"File permissions.","x-example":{},"items":{"type":"object","$ref":"#\/definitions\/permissions"}},"name":{"type":"string","description":"File name.","x-example":"Pink.png"},"dateCreated":{"type":"integer","description":"File creation date in Unix timestamp.","x-example":1592981250,"format":"int32"},"signature":{"type":"string","description":"File MD5 signature.","x-example":"5d529fd02b544198ae075bd57c1762bb"},"mimeType":{"type":"string","description":"File mime type.","x-example":"image\/png"},"sizeOriginal":{"type":"integer","description":"File original size in bytes.","x-example":17890,"format":"int32"}},"required":["$id","$permissions","name","dateCreated","signature","mimeType","sizeOriginal"]},"team":{"description":"Team","type":"object","properties":{"$id":{"type":"string","description":"Team ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"Team name.","x-example":"VIP"},"dateCreated":{"type":"integer","description":"Team creation date in Unix timestamp.","x-example":1592981250,"format":"int32"},"sum":{"type":"integer","description":"Total sum of team members.","x-example":7,"format":"int32"}},"required":["$id","name","dateCreated","sum"]},"membership":{"description":"Membership","type":"object","properties":{"$id":{"type":"string","description":"Membership ID.","x-example":"5e5ea5c16897e"},"userId":{"type":"string","description":"User ID.","x-example":"5e5ea5c16897e"},"teamId":{"type":"string","description":"Team ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"User name.","x-example":"VIP"},"email":{"type":"string","description":"User email address.","x-example":"john@appwrite.io"},"invited":{"type":"integer","description":"Date, the user has been invited to join the team in Unix timestamp.","x-example":1592981250,"format":"int32"},"joined":{"type":"integer","description":"Date, the user has accepted the invitation to join the team in Unix timestamp.","x-example":1592981250,"format":"int32"},"confirm":{"type":"boolean","description":"User confirmation status, true if the user has joined the team or false otherwise.","x-example":false},"roles":{"type":"array","description":"User list of roles","items":{"type":"string"},"x-example":"admin"}},"required":["$id","userId","teamId","name","email","invited","joined","confirm","roles"]},"function":{"description":"Function","type":"object","properties":{"$id":{"type":"string","description":"Function ID.","x-example":"5e5ea5c16897e"},"$permissions":{"type":"object","description":"Function permissions.","x-example":{},"items":{"type":"object","$ref":"#\/definitions\/permissions"}},"name":{"type":"string","description":"Function name.","x-example":"My Function"},"dateCreated":{"type":"integer","description":"Function creation date in Unix timestamp.","x-example":1592981250,"format":"int32"},"dateUpdated":{"type":"integer","description":"Function update date in Unix timestamp.","x-example":1592981257,"format":"int32"},"status":{"type":"string","description":"Function status. Possible values: disabled, enabled","x-example":"enabled"},"env":{"type":"string","description":"Function execution environment.","x-example":"python-3.8"},"tag":{"type":"string","description":"Function active tag ID.","x-example":"5e5ea5c16897e"},"vars":{"type":"string","description":"Function environment variables.","x-example":{"key":"value"}},"events":{"type":"array","description":"Function trigger events.","items":{"type":"string"},"x-example":"account.create"},"schedule":{"type":"string","description":"Function execution schedult in CRON format.","x-example":"5 4 * * *"},"scheduleNext":{"type":"integer","description":"Function next scheduled execution date in Unix timestamp.","x-example":1592981292,"format":"int32"},"schedulePrevious":{"type":"integer","description":"Function next scheduled execution date in Unix timestamp.","x-example":1592981237,"format":"int32"},"timeout":{"type":"integer","description":"Function execution timeout in seconds.","x-example":1592981237,"format":"int32"}},"required":["$id","$permissions","name","dateCreated","dateUpdated","status","env","tag","vars","events","schedule","scheduleNext","schedulePrevious","timeout"]},"tag":{"description":"Tag","type":"object","properties":{"$id":{"type":"string","description":"Tag ID.","x-example":"5e5ea5c16897e"},"functionId":{"type":"string","description":"Function ID.","x-example":"5e5ea6g16897e"},"dateCreated":{"type":"integer","description":"The tag creation date in Unix timestamp.","x-example":1592981250,"format":"int32"},"command":{"type":"string","description":"The entrypoint command in use to execute the tag code.","x-example":"enabled"},"size":{"type":"string","description":"The code size in bytes.","x-example":"python-3.8"}},"required":["$id","functionId","dateCreated","command","size"]},"execution":{"description":"Execution","type":"object","properties":{"$id":{"type":"string","description":"Execution ID.","x-example":"5e5ea5c16897e"},"functionId":{"type":"string","description":"Function ID.","x-example":"5e5ea6g16897e"},"dateCreated":{"type":"integer","description":"The execution creation date in Unix timestamp.","x-example":1592981250,"format":"int32"},"trigger":{"type":"string","description":"The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`.","x-example":"http"},"status":{"type":"string","description":"The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`.","x-example":"processing"},"exitCode":{"type":"integer","description":"The script exit code.","x-example":0,"format":"int32"},"stdout":{"type":"string","description":"The script stdout output string.","x-example":""},"stderr":{"type":"string","description":"The script stderr output string.","x-example":""},"time":{"type":"number","description":"The script execution time in seconds.","x-example":0.4,"format":"float"}},"required":["$id","functionId","dateCreated","trigger","status","exitCode","stdout","stderr","time"]},"project":{"description":"Project","type":"object","properties":{"$id":{"type":"string","description":"Project ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"Project name.","x-example":"New Project"},"description":{"type":"string","description":"Project description.","x-example":"This is a new project."},"teamId":{"type":"string","description":"Project team ID.","x-example":"1592981250"},"logo":{"type":"string","description":"Project logo file ID.","x-example":"5f5c451b403cb"},"url":{"type":"string","description":"Project website URL.","x-example":"5f5c451b403cb"},"legalName":{"type":"string","description":"Company legal name.","x-example":"Company LTD."},"legalCountry":{"type":"string","description":"Country code in [ISO 3166-1](http:\/\/en.wikipedia.org\/wiki\/ISO_3166-1) two-character format.","x-example":"US"},"legalState":{"type":"string","description":"State name.","x-example":"New York"},"legalCity":{"type":"string","description":"City name.","x-example":"New York City."},"legalAddress":{"type":"string","description":"Company Address.","x-example":"620 Eighth Avenue, New York, NY 10018"},"legalTaxId":{"type":"string","description":"Company Tax ID.","x-example":"131102020"},"platforms":{"type":"array","description":"List of Platforms.","items":{"type":"object","$ref":"#\/definitions\/platform"},"x-example":{}},"webhooks":{"type":"array","description":"List of Webhooks.","items":{"type":"object","$ref":"#\/definitions\/webhook"},"x-example":{}},"keys":{"type":"array","description":"List of API Keys.","items":{"type":"object","$ref":"#\/definitions\/key"},"x-example":{}},"domains":{"type":"array","description":"List of Domains.","items":{"type":"object","$ref":"#\/definitions\/domain"},"x-example":{}},"tasks":{"type":"array","description":"List of Tasks.","items":{"type":"object","$ref":"#\/definitions\/task"},"x-example":{}},"usersOauth2AmazonAppid":{"type":"string","description":"Amazon OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2AmazonSecret":{"type":"string","description":"Amazon OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2AppleAppid":{"type":"string","description":"Apple OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2AppleSecret":{"type":"string","description":"Apple OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2BitbucketAppid":{"type":"string","description":"BitBucket OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2BitbucketSecret":{"type":"string","description":"BitBucket OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2BitlyAppid":{"type":"string","description":"Bitly OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2BitlySecret":{"type":"string","description":"Bitly OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2BoxAppid":{"type":"string","description":"Box OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2BoxSecret":{"type":"string","description":"Box OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2DiscordAppid":{"type":"string","description":"Discord OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2DiscordSecret":{"type":"string","description":"Discord OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2DropboxAppid":{"type":"string","description":"Dropbox OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2DropboxSecret":{"type":"string","description":"Dropbox OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2FacebookAppid":{"type":"string","description":"Facebook OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2FacebookSecret":{"type":"string","description":"Facebook OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2GithubAppid":{"type":"string","description":"GitHub OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2GithubSecret":{"type":"string","description":"GitHub OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2GitlabAppid":{"type":"string","description":"GitLab OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2GitlabSecret":{"type":"string","description":"GitLab OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2GoogleAppid":{"type":"string","description":"Google OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2GoogleSecret":{"type":"string","description":"Google OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2LinkedinAppid":{"type":"string","description":"LinkedIn OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2LinkedinSecret":{"type":"string","description":"LinkedIn OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2MicrosoftAppid":{"type":"string","description":"Microsoft OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2MicrosoftSecret":{"type":"string","description":"Microsoft OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2PaypalAppid":{"type":"string","description":"PayPal OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2PaypalSecret":{"type":"string","description":"PayPal OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2PaypalSandboxAppid":{"type":"string","description":"PayPal (Sandbox) OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2PaypalSandboxSecret":{"type":"string","description":"PayPal (Sandbox) OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2SalesforceAppid":{"type":"string","description":"Salesforce OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2SalesforceSecret":{"type":"string","description":"Salesforce OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2SlackAppid":{"type":"string","description":"Slack OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2SlackSecret":{"type":"string","description":"Slack OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2SpotifyAppid":{"type":"string","description":"Spotify OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2SpotifySecret":{"type":"string","description":"Spotify OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2TradeshiftAppid":{"type":"string","description":"Tradeshift OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2TradeshiftSecret":{"type":"string","description":"Tradeshift OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2TradeshiftBoxAppid":{"type":"string","description":"Tradeshift Sandbox OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2TradeshiftBoxSecret":{"type":"string","description":"Tradeshift Sandbox OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2TwitchAppid":{"type":"string","description":"Twitch OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2TwitchSecret":{"type":"string","description":"Twitch OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2VkAppid":{"type":"string","description":"VK OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2VkSecret":{"type":"string","description":"VK OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2YahooAppid":{"type":"string","description":"Yahoo OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2YahooSecret":{"type":"string","description":"Yahoo OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2YandexAppid":{"type":"string","description":"Yandex OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2YandexSecret":{"type":"string","description":"Yandex OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2WordpressAppid":{"type":"string","description":"WordPress OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2WordpressSecret":{"type":"string","description":"WordPress OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2MockAppid":{"type":"string","description":"Mock OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2MockSecret":{"type":"string","description":"Mock OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."}},"required":["$id","name","description","teamId","logo","url","legalName","legalCountry","legalState","legalCity","legalAddress","legalTaxId","platforms","webhooks","keys","domains","tasks","usersOauth2AmazonAppid","usersOauth2AmazonSecret","usersOauth2AppleAppid","usersOauth2AppleSecret","usersOauth2BitbucketAppid","usersOauth2BitbucketSecret","usersOauth2BitlyAppid","usersOauth2BitlySecret","usersOauth2BoxAppid","usersOauth2BoxSecret","usersOauth2DiscordAppid","usersOauth2DiscordSecret","usersOauth2DropboxAppid","usersOauth2DropboxSecret","usersOauth2FacebookAppid","usersOauth2FacebookSecret","usersOauth2GithubAppid","usersOauth2GithubSecret","usersOauth2GitlabAppid","usersOauth2GitlabSecret","usersOauth2GoogleAppid","usersOauth2GoogleSecret","usersOauth2LinkedinAppid","usersOauth2LinkedinSecret","usersOauth2MicrosoftAppid","usersOauth2MicrosoftSecret","usersOauth2PaypalAppid","usersOauth2PaypalSecret","usersOauth2PaypalSandboxAppid","usersOauth2PaypalSandboxSecret","usersOauth2SalesforceAppid","usersOauth2SalesforceSecret","usersOauth2SlackAppid","usersOauth2SlackSecret","usersOauth2SpotifyAppid","usersOauth2SpotifySecret","usersOauth2TradeshiftAppid","usersOauth2TradeshiftSecret","usersOauth2TradeshiftBoxAppid","usersOauth2TradeshiftBoxSecret","usersOauth2TwitchAppid","usersOauth2TwitchSecret","usersOauth2VkAppid","usersOauth2VkSecret","usersOauth2YahooAppid","usersOauth2YahooSecret","usersOauth2YandexAppid","usersOauth2YandexSecret","usersOauth2WordpressAppid","usersOauth2WordpressSecret","usersOauth2MockAppid","usersOauth2MockSecret"]},"webhook":{"description":"Webhook","type":"object","properties":{"$id":{"type":"string","description":"Webhook ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"Webhook name.","x-example":"My Webhook"},"url":{"type":"string","description":"Webhook URL endpoint.","x-example":"https:\/\/example.com\/webhook"},"events":{"type":"array","description":"Webhook trigger events.","items":{"type":"string"},"x-example":"database.collections.update"},"security":{"type":"boolean","description":"Indicated if SSL \/ TLS Certificate verification is enabled.","x-example":true},"httpUser":{"type":"string","description":"HTTP basic authentication username.","x-example":"username"},"httpPass":{"type":"string","description":"HTTP basic authentication password.","x-example":"password"}},"required":["$id","name","url","events","security","httpUser","httpPass"]},"key":{"description":"Key","type":"object","properties":{"$id":{"type":"string","description":"Key ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"Key name.","x-example":"My API Key"},"scopes":{"type":"array","description":"Allowed permission scopes.","items":{"type":"string"},"x-example":"users.read"},"secret":{"type":"string","description":"Secret key.","x-example":"919c2d18fb5d4...a2ae413da83346ad2"}},"required":["$id","name","scopes","secret"]},"task":{"description":"Task","type":"object","properties":{"$id":{"type":"string","description":"Task ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"Task name.","x-example":"My Task"},"security":{"type":"boolean","description":"Indicated if SSL \/ TLS Certificate verification is enabled.","x-example":true},"httpMethod":{"type":"string","description":"Task HTTP Method.","x-example":"POST"},"httpUrl":{"type":"string","description":"Task HTTP URL.","x-example":"https:\/\/example.com\/task"},"httpHeaders":{"type":"array","description":"Task HTTP headers.","items":{"type":"string"},"x-example":"key:value"},"httpUser":{"type":"string","description":"HTTP basic authentication username.","x-example":"username"},"httpPass":{"type":"string","description":"HTTP basic authentication password.","x-example":"password"},"duration":{"type":"number","description":"Task duration in seconds.","x-example":1.2,"format":"float"},"delay":{"type":"number","description":"Task delay time in seconds.","x-example":1.2,"format":"float"},"failures":{"type":"integer","description":"Number of recurring task failures.","x-example":0,"format":"int32"},"schedule":{"type":"string","description":"Task schedule in CRON syntax.","x-example":"* * * * *"},"status":{"type":"string","description":"Task status. Possible values: play, pause","x-example":"enabled"},"updated":{"type":"integer","description":"Task last updated time in Unix timestamp.","x-example":1592981250,"format":"int32"},"previous":{"type":"integer","description":"Task previous run time in Unix timestamp.","x-example":1592981250,"format":"int32"},"next":{"type":"integer","description":"Task next run time in Unix timestamp.","x-example":1592981650,"format":"int32"}},"required":["$id","name","security","httpMethod","httpUrl","httpHeaders","httpUser","httpPass","duration","delay","failures","schedule","status","updated","previous","next"]},"domain":{"description":"Domain","type":"object","properties":{"$id":{"type":"string","description":"Domain ID.","x-example":"5e5ea5c16897e"},"domain":{"type":"string","description":"Domain name.","x-example":"appwrite.company.com"},"registerable":{"type":"string","description":"Registerable domain name.","x-example":"company.com"},"tld":{"type":"string","description":"TLD name.","x-example":"com"},"verification":{"type":"boolean","description":"Verification process status.","x-example":true},"certificateId":{"type":"string","description":"Certificate ID.","x-example":"6ejea5c13377e"}},"required":["$id","domain","registerable","tld","verification","certificateId"]},"platform":{"description":"Platform","type":"object","properties":{"$id":{"type":"string","description":"Platform ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"Platform name.","x-example":"My Web App"},"type":{"type":"string","description":"Platform type. Possible values are: web, flutter-ios, flutter-android, ios, android, and unity.","x-example":"My Web App"},"key":{"type":"string","description":"Platform Key. iOS bundle ID or Android package name. Empty string for other platforms.","x-example":"com.company.appname"},"hostname":{"type":"string","description":"Web app hostname. Empty string for other platforms.","x-example":true},"httpUser":{"type":"string","description":"HTTP basic authentication username.","x-example":"username"},"httpPass":{"type":"string","description":"HTTP basic authentication password.","x-example":"password"}},"required":["$id","name","type","key","hostname","httpUser","httpPass"]},"country":{"description":"Country","type":"object","properties":{"name":{"type":"string","description":"Country name.","x-example":"United States"},"code":{"type":"string","description":"Country two-character ISO 3166-1 alpha code.","x-example":"US"}},"required":["name","code"]},"continent":{"description":"Continent","type":"object","properties":{"name":{"type":"string","description":"Continent name.","x-example":"Europe"},"code":{"type":"string","description":"Continent two letter code.","x-example":"EU"}},"required":["name","code"]},"language":{"description":"Language","type":"object","properties":{"name":{"type":"string","description":"Language name.","x-example":"Italian"},"code":{"type":"string","description":"Language two-character ISO 639-1 codes.","x-example":"it"},"nativeName":{"type":"string","description":"Language native name.","x-example":"Italiano"}},"required":["name","code","nativeName"]},"currency":{"description":"Currency","type":"object","properties":{"symbol":{"type":"string","description":"Currency symbol.","x-example":"$"},"name":{"type":"string","description":"Currency name.","x-example":"US dollar"},"symbolNative":{"type":"string","description":"Currency native symbol.","x-example":"$"},"decimalDigits":{"type":"integer","description":"Number of decimal digits.","x-example":2,"format":"int32"},"rounding":{"type":"number","description":"Currency digit rounding.","x-example":0,"format":"float"},"code":{"type":"string","description":"Currency code in [ISO 4217-1](http:\/\/en.wikipedia.org\/wiki\/ISO_4217) three-character format.","x-example":"USD"},"namePlural":{"type":"string","description":"Currency plural name","x-example":"US dollars"}},"required":["symbol","name","symbolNative","decimalDigits","rounding","code","namePlural"]},"phone":{"description":"Phone","type":"object","properties":{"code":{"type":"string","description":"Phone code.","x-example":"+1"},"countryCode":{"type":"string","description":"Country two-character ISO 3166-1 alpha code.","x-example":"US"},"countryName":{"type":"string","description":"Country name.","x-example":"United States"}},"required":["code","countryCode","countryName"]}},"externalDocs":{"description":"Full API docs, specs and tutorials","url":"https:\/\/appwrite.io\/docs"}} \ No newline at end of file diff --git a/specs/swagger-appwrite.0.8.0.json b/specs/swagger-appwrite.0.8.0.json deleted file mode 100644 index 3564636303..0000000000 --- a/specs/swagger-appwrite.0.8.0.json +++ /dev/null @@ -1 +0,0 @@ -{"swagger":"2.0","info":{"version":"0.8.0","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","contact":{"name":"Appwrite Team","url":"https:\/\/appwrite.io\/support","email":"team@appwrite.io"},"license":{"name":"BSD-3-Clause","url":"https:\/\/raw.githubusercontent.com\/appwrite\/appwrite\/master\/LICENSE"}},"host":"appwrite.io","basePath":"\/v1","schemes":["https"],"consumes":["application\/json","multipart\/form-data"],"produces":["application\/json"],"securityDefinitions":{"Project":{"type":"apiKey","name":"X-Appwrite-Project","description":"Your project ID","in":"header","x-appwrite":{"demo":"5df5acd0d48c2"}},"Key":{"type":"apiKey","name":"X-Appwrite-Key","description":"Your secret API key","in":"header","x-appwrite":{"demo":"919c2d18fb5d4...a2ae413da83346ad2"}},"JWT":{"type":"apiKey","name":"X-Appwrite-JWT","description":"Your secret JSON Web Token","in":"header","x-appwrite":{"demo":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ..."}},"Locale":{"type":"apiKey","name":"X-Appwrite-Locale","description":"","in":"header","x-appwrite":{"demo":"en"}},"Mode":{"type":"apiKey","name":"X-Appwrite-Mode","description":"","in":"header","x-appwrite":{"demo":""}}},"paths":{"\/account":{"get":{"summary":"Get Account","operationId":"accountGet","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Get currently logged in user data as JSON object.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"get","weight":44,"cookies":false,"type":"","demo":"account\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/get.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}]},"post":{"summary":"Create Account","operationId":"accountCreate","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to allow a new user to register a new account in your project. After the user registration completes successfully, you can use the [\/account\/verfication](\/docs\/client\/account#accountCreateVerification) route to start verifying the user email address. To allow the new user to login to their new account, you need to create a new [account session](\/docs\/client\/account#accountCreateSession).","responses":{"201":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"create","weight":36,"cookies":false,"type":"","demo":"account\/create.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"public","platforms":["client"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"email":{"type":"string","description":"User email.","default":null,"x-example":"email@example.com"},"password":{"type":"string","description":"User password. Must be between 6 to 32 chars.","default":null,"x-example":"password"},"name":{"type":"string","description":"User name. Max length: 128 chars.","default":"","x-example":"[NAME]"}},"required":["email","password"]}}]},"delete":{"summary":"Delete Account","operationId":"accountDelete","consumes":["application\/json"],"produces":[],"tags":["account"],"description":"Delete a currently logged in user account. Behind the scene, the user record is not deleted but permanently blocked from any access. This is done to avoid deleted accounts being overtaken by new users with the same email address. Any user-related resources like documents or storage files should be deleted separately.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"delete","weight":52,"cookies":false,"type":"","demo":"account\/delete.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/delete.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}]}},"\/account\/email":{"patch":{"summary":"Update Account Email","operationId":"accountUpdateEmail","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Update currently logged in user account email address. After changing user address, user confirmation status is being reset and a new confirmation mail is sent. For security measures, user password is required to complete this request.\nThis endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updateEmail","weight":50,"cookies":false,"type":"","demo":"account\/update-email.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-email.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"email":{"type":"string","description":"User email.","default":null,"x-example":"email@example.com"},"password":{"type":"string","description":"User password. Must be between 6 to 32 chars.","default":null,"x-example":"password"}},"required":["email","password"]}}]}},"\/account\/jwt":{"post":{"summary":"Create Account JWT","operationId":"accountCreateJWT","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to create a JSON Web Token. You can use the resulting JWT to authenticate on behalf of the current user when working with the Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes from its creation and will be invalid if the user will logout.","responses":{"201":{"description":"JWT","schema":{"$ref":"#\/definitions\/jwt"}}},"x-appwrite":{"method":"createJWT","weight":43,"cookies":false,"type":"","demo":"account\/create-j-w-t.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create-jwt.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},userId:{param-userId}","scope":"account","platforms":["client"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}]}},"\/account\/logs":{"get":{"summary":"Get Account Logs","operationId":"accountGetLogs","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Get currently logged in user list of latest security activity logs. Each log returns user IP address, location and date and time of log.","responses":{"200":{"description":"Logs List","schema":{"$ref":"#\/definitions\/logList"}}},"x-appwrite":{"method":"getLogs","weight":47,"cookies":false,"type":"","demo":"account\/get-logs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/get-logs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}]}},"\/account\/name":{"patch":{"summary":"Update Account Name","operationId":"accountUpdateName","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Update currently logged in user account name.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updateName","weight":48,"cookies":false,"type":"","demo":"account\/update-name.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-name.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"User name. Max length: 128 chars.","default":null,"x-example":"[NAME]"}},"required":["name"]}}]}},"\/account\/password":{"patch":{"summary":"Update Account Password","operationId":"accountUpdatePassword","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Update currently logged in user password. For validation, user is required to pass in the new password, and the old password. For users created with OAuth and Team Invites, oldPassword is optional.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updatePassword","weight":49,"cookies":false,"type":"","demo":"account\/update-password.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-password.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"password":{"type":"string","description":"New user password. Must be between 6 to 32 chars.","default":null,"x-example":"password"},"oldPassword":{"type":"string","description":"Old user password. Must be between 6 to 32 chars.","default":"","x-example":"password"}},"required":["password"]}}]}},"\/account\/prefs":{"get":{"summary":"Get Account Preferences","operationId":"accountGetPrefs","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Get currently logged in user preferences as a key-value object.","responses":{"200":{"description":"Preferences","schema":{"$ref":"#\/definitions\/preferences"}}},"x-appwrite":{"method":"getPrefs","weight":45,"cookies":false,"type":"","demo":"account\/get-prefs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/get-prefs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}]},"patch":{"summary":"Update Account Preferences","operationId":"accountUpdatePrefs","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Update currently logged in user account preferences. You can pass only the specific settings you wish to update.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updatePrefs","weight":51,"cookies":false,"type":"","demo":"account\/update-prefs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-prefs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"prefs":{"type":"object","description":"Prefs key-value JSON object.","default":null,"x-example":"{}"}},"required":["prefs"]}}]}},"\/account\/recovery":{"post":{"summary":"Create Password Recovery","operationId":"accountCreateRecovery","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Sends the user an email with a temporary secret key for password reset. When the user clicks the confirmation link he is redirected back to your app password reset URL with the secret key and email address values attached to the URL query string. Use the query string params to submit a request to the [PUT \/account\/recovery](\/docs\/client\/account#accountUpdateRecovery) endpoint to complete the process. The verification link sent to the user's email address is valid for 1 hour.","responses":{"201":{"description":"Token","schema":{"$ref":"#\/definitions\/token"}}},"x-appwrite":{"method":"createRecovery","weight":55,"cookies":false,"type":"","demo":"account\/create-recovery.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create-recovery.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},email:{param-email}","scope":"public","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"email":{"type":"string","description":"User email.","default":null,"x-example":"email@example.com"},"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"}},"required":["email","url"]}}]},"put":{"summary":"Complete Password Recovery","operationId":"accountUpdateRecovery","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to complete the user account password reset. Both the **userId** and **secret** arguments will be passed as query parameters to the redirect URL you have provided when sending your request to the [POST \/account\/recovery](\/docs\/client\/account#accountCreateRecovery) endpoint.\n\nPlease note that in order to avoid a [Redirect Attack](https:\/\/github.com\/OWASP\/CheatSheetSeries\/blob\/master\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.","responses":{"200":{"description":"Token","schema":{"$ref":"#\/definitions\/token"}}},"x-appwrite":{"method":"updateRecovery","weight":56,"cookies":false,"type":"","demo":"account\/update-recovery.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-recovery.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},userId:{param-userId}","scope":"public","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"userId":{"type":"string","description":"User account UID address.","default":null,"x-example":"[USER_ID]"},"secret":{"type":"string","description":"Valid reset token.","default":null,"x-example":"[SECRET]"},"password":{"type":"string","description":"New password. Must be between 6 to 32 chars.","default":null,"x-example":"password"},"passwordAgain":{"type":"string","description":"New password again. Must be between 6 to 32 chars.","default":null,"x-example":"password"}},"required":["userId","secret","password","passwordAgain"]}}]}},"\/account\/sessions":{"get":{"summary":"Get Account Sessions","operationId":"accountGetSessions","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Get currently logged in user list of active sessions across different devices.","responses":{"200":{"description":"Sessions List","schema":{"$ref":"#\/definitions\/sessionList"}}},"x-appwrite":{"method":"getSessions","weight":46,"cookies":false,"type":"","demo":"account\/get-sessions.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/get-sessions.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}]},"post":{"summary":"Create Account Session","operationId":"accountCreateSession","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Allow the user to login into their account by providing a valid email and password combination. This route will create a new session for the user.","responses":{"201":{"description":"Session","schema":{"$ref":"#\/definitions\/session"}}},"x-appwrite":{"method":"createSession","weight":37,"cookies":false,"type":"","demo":"account\/create-session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create-session.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},email:{param-email}","scope":"public","platforms":["client"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"email":{"type":"string","description":"User email.","default":null,"x-example":"email@example.com"},"password":{"type":"string","description":"User password. Must be between 6 to 32 chars.","default":null,"x-example":"password"}},"required":["email","password"]}}]},"delete":{"summary":"Delete All Account Sessions","operationId":"accountDeleteSessions","consumes":["application\/json"],"produces":[],"tags":["account"],"description":"Delete all sessions from the user account and remove any sessions cookies from the end client.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteSessions","weight":54,"cookies":false,"type":"","demo":"account\/delete-sessions.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/delete-sessions.md","rate-limit":100,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}]}},"\/account\/sessions\/anonymous":{"post":{"summary":"Create Anonymous Session","operationId":"accountCreateAnonymousSession","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to allow a new user to register an anonymous account in your project. This route will also create a new session for the user. To allow the new user to convert an anonymous account to a normal account account, you need to update its [email and password](\/docs\/client\/account#accountUpdateEmail).","responses":{"201":{"description":"Session","schema":{"$ref":"#\/definitions\/session"}}},"x-appwrite":{"method":"createAnonymousSession","weight":42,"cookies":false,"type":"","demo":"account\/create-anonymous-session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create-session-anonymous.md","rate-limit":50,"rate-time":3600,"rate-key":"ip:{ip}","scope":"public","platforms":["client"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}]}},"\/account\/sessions\/oauth2\/{provider}":{"get":{"summary":"Create Account Session with OAuth2","operationId":"accountCreateOAuth2Session","consumes":["application\/json"],"produces":["text\/html"],"tags":["account"],"description":"Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL's back to your app when login is completed.","responses":{"301":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"createOAuth2Session","weight":38,"cookies":false,"type":"webAuth","demo":"account\/create-o-auth2session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create-session-oauth2.md","rate-limit":50,"rate-time":3600,"rate-key":"ip:{ip}","scope":"public","platforms":["client"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"provider","description":"OAuth2 Provider. Currently, supported providers are: amazon, apple, bitbucket, bitly, box, discord, dropbox, facebook, github, gitlab, google, linkedin, microsoft, paypal, paypalSandbox, salesforce, slack, spotify, tradeshift, tradeshiftBox, twitch, vk, yahoo, yandex, wordpress.","required":true,"type":"string","x-example":"amazon","in":"path"},{"name":"success","description":"URL to redirect back to your app after a successful login attempt. 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.","required":false,"type":"string","format":"url","x-example":"https:\/\/example.com","default":"https:\/\/appwrite.io\/auth\/oauth2\/success","in":"query"},{"name":"failure","description":"URL to redirect back to your app after a failed login attempt. 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.","required":false,"type":"string","format":"url","x-example":"https:\/\/example.com","default":"https:\/\/appwrite.io\/auth\/oauth2\/failure","in":"query"},{"name":"scopes","description":"A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes.","required":false,"type":"array","collectionFormat":"multi","items":{"type":"string"},"default":[],"in":"query"}]}},"\/account\/sessions\/{sessionId}":{"delete":{"summary":"Delete Account Session","operationId":"accountDeleteSession","consumes":["application\/json"],"produces":[],"tags":["account"],"description":"Use this endpoint to log out the currently logged in user from all their account sessions across all of their different devices. When using the option id argument, only the session unique ID provider will be deleted.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteSession","weight":53,"cookies":false,"type":"","demo":"account\/delete-session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/delete-session.md","rate-limit":100,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"sessionId","description":"Session unique ID. Use the string 'current' to delete the current device session.","required":true,"type":"string","x-example":"[SESSION_ID]","in":"path"}]}},"\/account\/verification":{"post":{"summary":"Create Email Verification","operationId":"accountCreateVerification","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the **userId** and **secret** arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the **userId** and **secret** parameters. Learn more about how to [complete the verification process](\/docs\/client\/account#accountUpdateVerification). The verification link sent to the user's email address is valid for 7 days.\n\nPlease note that in order to avoid a [Redirect Attack](https:\/\/github.com\/OWASP\/CheatSheetSeries\/blob\/master\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.\n","responses":{"201":{"description":"Token","schema":{"$ref":"#\/definitions\/token"}}},"x-appwrite":{"method":"createVerification","weight":57,"cookies":false,"type":"","demo":"account\/create-verification.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create-verification.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},email:{param-email}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"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.","default":null,"x-example":"https:\/\/example.com"}},"required":["url"]}}]},"put":{"summary":"Complete Email Verification","operationId":"accountUpdateVerification","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to complete the user email verification process. Use both the **userId** and **secret** parameters that were attached to your app URL to verify the user email ownership. If confirmed this route will return a 200 status code.","responses":{"200":{"description":"Token","schema":{"$ref":"#\/definitions\/token"}}},"x-appwrite":{"method":"updateVerification","weight":58,"cookies":false,"type":"","demo":"account\/update-verification.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-verification.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},userId:{param-userId}","scope":"public","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"userId":{"type":"string","description":"User unique ID.","default":null,"x-example":"[USER_ID]"},"secret":{"type":"string","description":"Valid verification token.","default":null,"x-example":"[SECRET]"}},"required":["userId","secret"]}}]}},"\/avatars\/browsers\/{code}":{"get":{"summary":"Get Browser Icon","operationId":"avatarsGetBrowser","consumes":["application\/json"],"produces":["image\/png"],"tags":["avatars"],"description":"You can use this endpoint to show different browser icons to your users. The code argument receives the browser code as it appears in your user \/account\/sessions endpoint. Use width, height and quality arguments to change the output settings.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getBrowser","weight":60,"cookies":false,"type":"location","demo":"avatars\/get-browser.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-browser.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"code","description":"Browser Code.","required":true,"type":"string","x-example":"aa","in":"path"},{"name":"width","description":"Image width. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"height","description":"Image height. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"quality","description":"Image quality. Pass an integer between 0 to 100. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"}]}},"\/avatars\/credit-cards\/{code}":{"get":{"summary":"Get Credit Card Icon","operationId":"avatarsGetCreditCard","consumes":["application\/json"],"produces":["image\/png"],"tags":["avatars"],"description":"The credit card endpoint will return you the icon of the credit card provider you need. Use width, height and quality arguments to change the output settings.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getCreditCard","weight":59,"cookies":false,"type":"location","demo":"avatars\/get-credit-card.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-credit-card.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"code","description":"Credit Card Code. Possible values: amex, argencard, cabal, censosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, union-china-pay, visa, mir, maestro.","required":true,"type":"string","x-example":"amex","in":"path"},{"name":"width","description":"Image width. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"height","description":"Image height. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"quality","description":"Image quality. Pass an integer between 0 to 100. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"}]}},"\/avatars\/favicon":{"get":{"summary":"Get Favicon","operationId":"avatarsGetFavicon","consumes":["application\/json"],"produces":["image\/*"],"tags":["avatars"],"description":"Use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL.\n","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getFavicon","weight":63,"cookies":false,"type":"location","demo":"avatars\/get-favicon.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-favicon.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"url","description":"Website URL which you want to fetch the favicon from.","required":true,"type":"string","format":"url","x-example":"https:\/\/example.com","in":"query"}]}},"\/avatars\/flags\/{code}":{"get":{"summary":"Get Country Flag","operationId":"avatarsGetFlag","consumes":["application\/json"],"produces":["image\/png"],"tags":["avatars"],"description":"You can use this endpoint to show different country flags icons to your users. The code argument receives the 2 letter country code. Use width, height and quality arguments to change the output settings.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getFlag","weight":61,"cookies":false,"type":"location","demo":"avatars\/get-flag.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-flag.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"code","description":"Country Code. ISO Alpha-2 country code format.","required":true,"type":"string","x-example":"af","in":"path"},{"name":"width","description":"Image width. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"height","description":"Image height. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"quality","description":"Image quality. Pass an integer between 0 to 100. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"}]}},"\/avatars\/image":{"get":{"summary":"Get Image from URL","operationId":"avatarsGetImage","consumes":["application\/json"],"produces":["image\/*"],"tags":["avatars"],"description":"Use this endpoint to fetch a remote image URL and crop it to any image size you want. This endpoint is very useful if you need to crop and display remote images in your app or in case you want to make sure a 3rd party image is properly served using a TLS protocol.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getImage","weight":62,"cookies":false,"type":"location","demo":"avatars\/get-image.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-image.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"url","description":"Image URL which you want to crop.","required":true,"type":"string","format":"url","x-example":"https:\/\/example.com","in":"query"},{"name":"width","description":"Resize preview image width, Pass an integer between 0 to 2000.","required":false,"type":"integer","format":"int32","x-example":0,"default":400,"in":"query"},{"name":"height","description":"Resize preview image height, Pass an integer between 0 to 2000.","required":false,"type":"integer","format":"int32","x-example":0,"default":400,"in":"query"}]}},"\/avatars\/initials":{"get":{"summary":"Get User Initials","operationId":"avatarsGetInitials","consumes":["application\/json"],"produces":["image\/png"],"tags":["avatars"],"description":"Use this endpoint to show your user initials avatar icon on your website or app. By default, this route will try to print your logged-in user name or email initials. You can also overwrite the user name if you pass the 'name' parameter. If no name is given and no user is logged, an empty avatar will be returned.\n\nYou can use the color and background params to change the avatar colors. By default, a random theme will be selected. The random theme will persist for the user's initials when reloading the same theme will always return for the same initials.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getInitials","weight":65,"cookies":false,"type":"location","demo":"avatars\/get-initials.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-initials.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"name","description":"Full Name. When empty, current user name or email will be used. Max length: 128 chars.","required":false,"type":"string","x-example":"[NAME]","default":"","in":"query"},{"name":"width","description":"Image width. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":500,"in":"query"},{"name":"height","description":"Image height. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":500,"in":"query"},{"name":"color","description":"Changes text color. By default a random color will be picked and stay will persistent to the given name.","required":false,"type":"string","default":"","in":"query"},{"name":"background","description":"Changes background color. By default a random color will be picked and stay will persistent to the given name.","required":false,"type":"string","default":"","in":"query"}]}},"\/avatars\/qr":{"get":{"summary":"Get QR Code","operationId":"avatarsGetQR","consumes":["application\/json"],"produces":["image\/png"],"tags":["avatars"],"description":"Converts a given plain text to a QR code image. You can use the query parameters to change the size and style of the resulting image.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getQR","weight":64,"cookies":false,"type":"location","demo":"avatars\/get-q-r.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-qr.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"text","description":"Plain text to be converted to QR code image.","required":true,"type":"string","x-example":"[TEXT]","in":"query"},{"name":"size","description":"QR code size. Pass an integer between 0 to 1000. Defaults to 400.","required":false,"type":"integer","format":"int32","x-example":0,"default":400,"in":"query"},{"name":"margin","description":"Margin from edge. Pass an integer between 0 to 10. Defaults to 1.","required":false,"type":"integer","format":"int32","x-example":0,"default":1,"in":"query"},{"name":"download","description":"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.","required":false,"type":"boolean","x-example":false,"default":false,"in":"query"}]}},"\/database\/collections":{"get":{"summary":"List Collections","operationId":"databaseListCollections","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Get a list of all the user collections. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project's collections. [Learn more about different API modes](\/docs\/admin).","responses":{"200":{"description":"Collections List","schema":{"$ref":"#\/definitions\/collectionList"}}},"x-appwrite":{"method":"listCollections","weight":67,"cookies":false,"type":"","demo":"database\/list-collections.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/list-collections.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Results offset. The default value is 0. Use this param to manage pagination.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create Collection","operationId":"databaseCreateCollection","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Create a new Collection.","responses":{"201":{"description":"Collection","schema":{"$ref":"#\/definitions\/collection"}}},"x-appwrite":{"method":"createCollection","weight":66,"cookies":false,"type":"","demo":"database\/create-collection.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/create-collection.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Collection name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"read":{"type":"array","description":"An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}},"write":{"type":"array","description":"An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}},"rules":{"type":"array","description":"Array of [rule objects](\/docs\/rules). Each rule define a collection field name, data type and validation.","default":null,"x-example":null,"items":{"type":"string"}}},"required":["name","read","write","rules"]}}]}},"\/database\/collections\/{collectionId}":{"get":{"summary":"Get Collection","operationId":"databaseGetCollection","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata.","responses":{"200":{"description":"Collection","schema":{"$ref":"#\/definitions\/collection"}}},"x-appwrite":{"method":"getCollection","weight":68,"cookies":false,"type":"","demo":"database\/get-collection.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/get-collection.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID.","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"}]},"put":{"summary":"Update Collection","operationId":"databaseUpdateCollection","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Update a collection by its unique ID.","responses":{"200":{"description":"Collection","schema":{"$ref":"#\/definitions\/collection"}}},"x-appwrite":{"method":"updateCollection","weight":69,"cookies":false,"type":"","demo":"database\/update-collection.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/update-collection.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID.","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Collection name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"read":{"type":"array","description":"An array of strings with read permissions. By default inherits the existing read permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}},"write":{"type":"array","description":"An array of strings with write permissions. By default inherits the existing write permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}},"rules":{"type":"array","description":"Array of [rule objects](\/docs\/rules). Each rule define a collection field name, data type and validation.","default":[],"x-example":null,"items":{"type":"string"}}},"required":["name"]}}]},"delete":{"summary":"Delete Collection","operationId":"databaseDeleteCollection","consumes":["application\/json"],"produces":[],"tags":["database"],"description":"Delete a collection by its unique ID. Only users with write permissions have access to delete this resource.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteCollection","weight":70,"cookies":false,"type":"","demo":"database\/delete-collection.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/delete-collection.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID.","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"}]}},"\/database\/collections\/{collectionId}\/documents":{"get":{"summary":"List Documents","operationId":"databaseListDocuments","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Get a list of all the user documents. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project's documents. [Learn more about different API modes](\/docs\/admin).","responses":{"200":{"description":"Documents List","schema":{"$ref":"#\/definitions\/documentList"}}},"x-appwrite":{"method":"listDocuments","weight":72,"cookies":false,"type":"","demo":"database\/list-documents.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/list-documents.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"documents.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"filters","description":"Array of filter strings. Each filter is constructed from a key name, comparison operator (=, !=, >, <, <=, >=) and a value. You can also use a dot (.) separator in attribute names to filter by child document attributes. Examples: 'name=John Doe' or 'category.$id>=5bed2d152c362'.","required":false,"type":"array","collectionFormat":"multi","items":{"type":"string"},"default":[],"in":"query"},{"name":"limit","description":"Maximum number of documents to return in response. Use this value to manage pagination. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Offset value. The default value is 0. Use this param to manage pagination.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"orderField","description":"Document field that results will be sorted by.","required":false,"type":"string","x-example":"[ORDER_FIELD]","default":"","in":"query"},{"name":"orderType","description":"Order direction. Possible values are DESC for descending order, or ASC for ascending order.","required":false,"type":"string","x-example":"DESC","default":"ASC","in":"query"},{"name":"orderCast","description":"Order field type casting. Possible values are int, string, date, time or datetime. The database will attempt to cast the order field to the value you pass here. The default value is a string.","required":false,"type":"string","x-example":"int","default":"string","in":"query"},{"name":"search","description":"Search query. Enter any free text search. The database will try to find a match against all document attributes and children. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"}]},"post":{"summary":"Create Document","operationId":"databaseCreateDocument","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](\/docs\/server\/database#databaseCreateCollection) API or directly from your database console.","responses":{"201":{"description":"Document","schema":{"$ref":"#\/definitions\/document"}}},"x-appwrite":{"method":"createDocument","weight":71,"cookies":false,"type":"","demo":"database\/create-document.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/create-document.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"documents.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"data":{"type":"object","description":"Document data as JSON object.","default":null,"x-example":"{}"},"read":{"type":"array","description":"An array of strings with read permissions. By default only the current user is granted with read permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}},"write":{"type":"array","description":"An array of strings with write permissions. By default only the current user is granted with write permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}},"parentDocument":{"type":"string","description":"Parent document unique ID. Use when you want your new document to be a child of a parent document.","default":"","x-example":"[PARENT_DOCUMENT]"},"parentProperty":{"type":"string","description":"Parent document property name. Use when you want your new document to be a child of a parent document.","default":"","x-example":null},"parentPropertyType":{"type":"string","description":"Parent document property connection type. You can set this value to **assign**, **append** or **prepend**, default value is assign. Use when you want your new document to be a child of a parent document.","default":"assign","x-example":"assign"}},"required":["data"]}}]}},"\/database\/collections\/{collectionId}\/documents\/{documentId}":{"get":{"summary":"Get Document","operationId":"databaseGetDocument","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Get a document by its unique ID. This endpoint response returns a JSON object with the document data.","responses":{"200":{"description":"Document","schema":{"$ref":"#\/definitions\/document"}}},"x-appwrite":{"method":"getDocument","weight":73,"cookies":false,"type":"","demo":"database\/get-document.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/get-document.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"documents.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"documentId","description":"Document unique ID.","required":true,"type":"string","x-example":"[DOCUMENT_ID]","in":"path"}]},"patch":{"summary":"Update Document","operationId":"databaseUpdateDocument","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated.","responses":{"200":{"description":"Document","schema":{"$ref":"#\/definitions\/document"}}},"x-appwrite":{"method":"updateDocument","weight":74,"cookies":false,"type":"","demo":"database\/update-document.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/update-document.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"documents.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"documentId","description":"Document unique ID.","required":true,"type":"string","x-example":"[DOCUMENT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"data":{"type":"object","description":"Document data as JSON object.","default":null,"x-example":"{}"},"read":{"type":"array","description":"An array of strings with read permissions. By default inherits the existing read permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}},"write":{"type":"array","description":"An array of strings with write permissions. By default inherits the existing write permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}}},"required":["data"]}}]},"delete":{"summary":"Delete Document","operationId":"databaseDeleteDocument","consumes":["application\/json"],"produces":[],"tags":["database"],"description":"Delete a document by its unique ID. This endpoint deletes only the parent documents, its attributes and relations to other documents. Child documents **will not** be deleted.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteDocument","weight":75,"cookies":false,"type":"","demo":"database\/delete-document.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/delete-document.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"documents.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"collectionId","description":"Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"documentId","description":"Document unique ID.","required":true,"type":"string","x-example":"[DOCUMENT_ID]","in":"path"}]}},"\/functions":{"get":{"summary":"List Functions","operationId":"functionsList","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Get a list of all the project's functions. You can use the query params to filter your results.","responses":{"200":{"description":"Functions List","schema":{"$ref":"#\/definitions\/functionList"}}},"x-appwrite":{"method":"list","weight":161,"cookies":false,"type":"","demo":"functions\/list.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/list-functions.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Results offset. The default value is 0. Use this param to manage pagination.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create Function","operationId":"functionsCreate","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Create a new function. You can pass a list of [permissions](\/docs\/permissions) to allow different project users or team with access to execute the function using the client API.","responses":{"201":{"description":"Function","schema":{"$ref":"#\/definitions\/function"}}},"x-appwrite":{"method":"create","weight":160,"cookies":false,"type":"","demo":"functions\/create.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/create-function.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Function name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"execute":{"type":"array","description":"An array of strings with execution permissions. By default no user is granted with any execute permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}},"env":{"type":"string","description":"Execution enviornment.","default":null,"x-example":"dotnet-3.1"},"vars":{"type":"object","description":"Key-value JSON object.","default":{},"x-example":"{}"},"events":{"type":"array","description":"Events list.","default":[],"x-example":null,"items":{"type":"string"}},"schedule":{"type":"string","description":"Schedule CRON syntax.","default":"","x-example":null},"timeout":{"type":"integer","description":"Function maximum execution time in seconds.","default":15,"x-example":1}},"required":["name","execute","env"]}}]}},"\/functions\/{functionId}":{"get":{"summary":"Get Function","operationId":"functionsGet","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Get a function by its unique ID.","responses":{"200":{"description":"Function","schema":{"$ref":"#\/definitions\/function"}}},"x-appwrite":{"method":"get","weight":162,"cookies":false,"type":"","demo":"functions\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/get-function.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"}]},"put":{"summary":"Update Function","operationId":"functionsUpdate","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Update function by its unique ID.","responses":{"200":{"description":"Function","schema":{"$ref":"#\/definitions\/function"}}},"x-appwrite":{"method":"update","weight":164,"cookies":false,"type":"","demo":"functions\/update.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/update-function.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Function name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"execute":{"type":"array","description":"An array of strings with execution permissions. By default no user is granted with any execute permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}},"vars":{"type":"object","description":"Key-value JSON object.","default":{},"x-example":"{}"},"events":{"type":"array","description":"Events list.","default":[],"x-example":null,"items":{"type":"string"}},"schedule":{"type":"string","description":"Schedule CRON syntax.","default":"","x-example":null},"timeout":{"type":"integer","description":"Function maximum execution time in seconds.","default":15,"x-example":1}},"required":["name","execute"]}}]},"delete":{"summary":"Delete Function","operationId":"functionsDelete","consumes":["application\/json"],"produces":[],"tags":["functions"],"description":"Delete a function by its unique ID.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"delete","weight":166,"cookies":false,"type":"","demo":"functions\/delete.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/delete-function.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"}]}},"\/functions\/{functionId}\/executions":{"get":{"summary":"List Executions","operationId":"functionsListExecutions","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Get a list of all the current user function execution logs. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project's executions. [Learn more about different API modes](\/docs\/admin).","responses":{"200":{"description":"Executions List","schema":{"$ref":"#\/definitions\/executionList"}}},"x-appwrite":{"method":"listExecutions","weight":172,"cookies":false,"type":"","demo":"functions\/list-executions.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/list-executions.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"execution.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Results offset. The default value is 0. Use this param to manage pagination.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create Execution","operationId":"functionsCreateExecution","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Trigger a function execution. The returned object will return you the current execution status. You can ping the `Get Execution` endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously.","responses":{"201":{"description":"Execution","schema":{"$ref":"#\/definitions\/execution"}}},"x-appwrite":{"method":"createExecution","weight":171,"cookies":false,"type":"","demo":"functions\/create-execution.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/create-execution.md","rate-limit":60,"rate-time":60,"rate-key":"url:{url},ip:{ip}","scope":"execution.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"data":{"type":"string","description":"String of custom data to send to function.","default":"","x-example":"[DATA]"}}}}]}},"\/functions\/{functionId}\/executions\/{executionId}":{"get":{"summary":"Get Execution","operationId":"functionsGetExecution","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Get a function execution log by its unique ID.","responses":{"200":{"description":"Execution","schema":{"$ref":"#\/definitions\/execution"}}},"x-appwrite":{"method":"getExecution","weight":173,"cookies":false,"type":"","demo":"functions\/get-execution.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/get-execution.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"execution.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"executionId","description":"Execution unique ID.","required":true,"type":"string","x-example":"[EXECUTION_ID]","in":"path"}]}},"\/functions\/{functionId}\/tag":{"patch":{"summary":"Update Function Tag","operationId":"functionsUpdateTag","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Update the function code tag ID using the unique function ID. Use this endpoint to switch the code tag that should be executed by the execution endpoint.","responses":{"200":{"description":"Function","schema":{"$ref":"#\/definitions\/function"}}},"x-appwrite":{"method":"updateTag","weight":165,"cookies":false,"type":"","demo":"functions\/update-tag.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/update-function-tag.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"tag":{"type":"string","description":"Tag unique ID.","default":null,"x-example":"[TAG]"}},"required":["tag"]}}]}},"\/functions\/{functionId}\/tags":{"get":{"summary":"List Tags","operationId":"functionsListTags","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Get a list of all the project's code tags. You can use the query params to filter your results.","responses":{"200":{"description":"Tags List","schema":{"$ref":"#\/definitions\/tagList"}}},"x-appwrite":{"method":"listTags","weight":168,"cookies":false,"type":"","demo":"functions\/list-tags.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/list-tags.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Results offset. The default value is 0. Use this param to manage pagination.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create Tag","operationId":"functionsCreateTag","consumes":["multipart\/form-data"],"produces":["application\/json"],"tags":["functions"],"description":"Create a new function code tag. Use this endpoint to upload a new version of your code function. To execute your newly uploaded code, you'll need to update the function's tag to use your new tag UID.\n\nThis endpoint accepts a tar.gz file compressed with your code. Make sure to include any dependencies your code has within the compressed file. You can learn more about code packaging in the [Appwrite Cloud Functions tutorial](\/docs\/functions).\n\nUse the \"command\" param to set the entry point used to execute your code.","responses":{"201":{"description":"Tag","schema":{"$ref":"#\/definitions\/tag"}}},"x-appwrite":{"method":"createTag","weight":167,"cookies":false,"type":"","demo":"functions\/create-tag.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/create-tag.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.write","platforms":["server"],"packaging":true,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"command","description":"Code execution command.","required":true,"type":"string","x-example":"[COMMAND]","in":"formData"},{"name":"code","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.","required":true,"type":"file","in":"formData"}]}},"\/functions\/{functionId}\/tags\/{tagId}":{"get":{"summary":"Get Tag","operationId":"functionsGetTag","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Get a code tag by its unique ID.","responses":{"200":{"description":"Tag","schema":{"$ref":"#\/definitions\/tag"}}},"x-appwrite":{"method":"getTag","weight":169,"cookies":false,"type":"","demo":"functions\/get-tag.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/get-tag.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"tagId","description":"Tag unique ID.","required":true,"type":"string","x-example":"[TAG_ID]","in":"path"}]},"delete":{"summary":"Delete Tag","operationId":"functionsDeleteTag","consumes":["application\/json"],"produces":[],"tags":["functions"],"description":"Delete a code tag by its unique ID.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteTag","weight":170,"cookies":false,"type":"","demo":"functions\/delete-tag.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/delete-tag.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"tagId","description":"Tag unique ID.","required":true,"type":"string","x-example":"[TAG_ID]","in":"path"}]}},"\/functions\/{functionId}\/usage":{"get":{"summary":"Get Function Usage","operationId":"functionsGetUsage","consumes":["application\/json"],"produces":[],"tags":["functions"],"description":"","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getUsage","weight":163,"cookies":false,"type":"","demo":"functions\/get-usage.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"functionId","description":"Function unique ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"range","description":"Date range.","required":false,"type":"string","x-example":"24h","default":"30d","in":"query"}]}},"\/health":{"get":{"summary":"Get HTTP","operationId":"healthGet","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Check the Appwrite HTTP server is up and responsive.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"get","weight":83,"cookies":false,"type":"","demo":"health\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/anti-virus":{"get":{"summary":"Get Anti virus","operationId":"healthGetAntiVirus","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Check the Appwrite Anti Virus server is up and connection is successful.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getAntiVirus","weight":95,"cookies":false,"type":"","demo":"health\/get-anti-virus.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-storage-anti-virus.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/cache":{"get":{"summary":"Get Cache","operationId":"healthGetCache","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Check the Appwrite in-memory cache server is up and connection is successful.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getCache","weight":86,"cookies":false,"type":"","demo":"health\/get-cache.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-cache.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/db":{"get":{"summary":"Get DB","operationId":"healthGetDB","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Check the Appwrite database server is up and connection is successful.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getDB","weight":85,"cookies":false,"type":"","demo":"health\/get-d-b.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-db.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/queue\/certificates":{"get":{"summary":"Get Certificate Queue","operationId":"healthGetQueueCertificates","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Get the number of certificates that are waiting to be issued against [Letsencrypt](https:\/\/letsencrypt.org\/) in the Appwrite internal queue server.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getQueueCertificates","weight":92,"cookies":false,"type":"","demo":"health\/get-queue-certificates.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-certificates.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/queue\/functions":{"get":{"summary":"Get Functions Queue","operationId":"healthGetQueueFunctions","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getQueueFunctions","weight":93,"cookies":false,"type":"","demo":"health\/get-queue-functions.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-functions.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/queue\/logs":{"get":{"summary":"Get Logs Queue","operationId":"healthGetQueueLogs","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Get the number of logs that are waiting to be processed in the Appwrite internal queue server.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getQueueLogs","weight":90,"cookies":false,"type":"","demo":"health\/get-queue-logs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-logs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/queue\/tasks":{"get":{"summary":"Get Tasks Queue","operationId":"healthGetQueueTasks","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Get the number of tasks that are waiting to be processed in the Appwrite internal queue server.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getQueueTasks","weight":89,"cookies":false,"type":"","demo":"health\/get-queue-tasks.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-tasks.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/queue\/usage":{"get":{"summary":"Get Usage Queue","operationId":"healthGetQueueUsage","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Get the number of usage stats that are waiting to be processed in the Appwrite internal queue server.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getQueueUsage","weight":91,"cookies":false,"type":"","demo":"health\/get-queue-usage.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-usage.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/queue\/webhooks":{"get":{"summary":"Get Webhooks Queue","operationId":"healthGetQueueWebhooks","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getQueueWebhooks","weight":88,"cookies":false,"type":"","demo":"health\/get-queue-webhooks.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-webhooks.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/storage\/local":{"get":{"summary":"Get Local Storage","operationId":"healthGetStorageLocal","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Check the Appwrite local storage device is up and connection is successful.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getStorageLocal","weight":94,"cookies":false,"type":"","demo":"health\/get-storage-local.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-storage-local.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/time":{"get":{"summary":"Get Time","operationId":"healthGetTime","consumes":["application\/json"],"produces":[],"tags":["health"],"description":"Check the Appwrite server time is synced with Google remote NTP server. We use this technology to smoothly handle leap seconds with no disruptive events. The [Network Time Protocol](https:\/\/en.wikipedia.org\/wiki\/Network_Time_Protocol) (NTP) is used by hundreds of millions of computers and devices to synchronize their clocks over the Internet. If your computer sets its own clock, it likely uses NTP.","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getTime","weight":87,"cookies":false,"type":"","demo":"health\/get-time.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-time.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/locale":{"get":{"summary":"Get User Locale","operationId":"localeGet","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"Get the current user location based on IP. Returns an object with user country code, country name, continent name, continent code, ip address and suggested currency. You can use the locale header to get the data in a supported language.\n\n([IP Geolocation by DB-IP](https:\/\/db-ip.com))","responses":{"200":{"description":"Locale","schema":{"$ref":"#\/definitions\/locale"}}},"x-appwrite":{"method":"get","weight":76,"cookies":false,"type":"","demo":"locale\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-locale.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}]}},"\/locale\/continents":{"get":{"summary":"List Continents","operationId":"localeGetContinents","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"List of all continents. You can use the locale header to get the data in a supported language.","responses":{"200":{"description":"Continents List","schema":{"$ref":"#\/definitions\/continentList"}}},"x-appwrite":{"method":"getContinents","weight":80,"cookies":false,"type":"","demo":"locale\/get-continents.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-continents.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}]}},"\/locale\/countries":{"get":{"summary":"List Countries","operationId":"localeGetCountries","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"List of all countries. You can use the locale header to get the data in a supported language.","responses":{"200":{"description":"Countries List","schema":{"$ref":"#\/definitions\/countryList"}}},"x-appwrite":{"method":"getCountries","weight":77,"cookies":false,"type":"","demo":"locale\/get-countries.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-countries.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}]}},"\/locale\/countries\/eu":{"get":{"summary":"List EU Countries","operationId":"localeGetCountriesEU","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"List of all countries that are currently members of the EU. You can use the locale header to get the data in a supported language.","responses":{"200":{"description":"Countries List","schema":{"$ref":"#\/definitions\/countryList"}}},"x-appwrite":{"method":"getCountriesEU","weight":78,"cookies":false,"type":"","demo":"locale\/get-countries-e-u.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-countries-eu.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}]}},"\/locale\/countries\/phones":{"get":{"summary":"List Countries Phone Codes","operationId":"localeGetCountriesPhones","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"List of all countries phone codes. You can use the locale header to get the data in a supported language.","responses":{"200":{"description":"Phones List","schema":{"$ref":"#\/definitions\/phoneList"}}},"x-appwrite":{"method":"getCountriesPhones","weight":79,"cookies":false,"type":"","demo":"locale\/get-countries-phones.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-countries-phones.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}]}},"\/locale\/currencies":{"get":{"summary":"List Currencies","operationId":"localeGetCurrencies","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"List of all currencies, including currency symbol, name, plural, and decimal digits for all major and minor currencies. You can use the locale header to get the data in a supported language.","responses":{"200":{"description":"Currencies List","schema":{"$ref":"#\/definitions\/currencyList"}}},"x-appwrite":{"method":"getCurrencies","weight":81,"cookies":false,"type":"","demo":"locale\/get-currencies.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-currencies.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}]}},"\/locale\/languages":{"get":{"summary":"List Languages","operationId":"localeGetLanguages","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"List of all languages classified by ISO 639-1 including 2-letter code, name in English, and name in the respective language.","responses":{"200":{"description":"Languages List","schema":{"$ref":"#\/definitions\/languageList"}}},"x-appwrite":{"method":"getLanguages","weight":82,"cookies":false,"type":"","demo":"locale\/get-languages.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-languages.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}]}},"\/projects":{"get":{"summary":"List Projects","operationId":"projectsList","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Projects List","schema":{"$ref":"#\/definitions\/projectList"}}},"x-appwrite":{"method":"list","weight":98,"cookies":false,"type":"","demo":"projects\/list.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Results offset. The default value is 0. Use this param to manage pagination.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create Project","operationId":"projectsCreate","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"201":{"description":"Project","schema":{"$ref":"#\/definitions\/project"}}},"x-appwrite":{"method":"create","weight":97,"cookies":false,"type":"","demo":"projects\/create.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Project name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"teamId":{"type":"string","description":"Team unique ID.","default":null,"x-example":"[TEAM_ID]"},"description":{"type":"string","description":"Project description. Max length: 256 chars.","default":"","x-example":"[DESCRIPTION]"},"logo":{"type":"string","description":"Project logo.","default":"","x-example":"[LOGO]"},"url":{"type":"string","description":"Project URL.","default":"","x-example":"https:\/\/example.com"},"legalName":{"type":"string","description":"Project legal Name. Max length: 256 chars.","default":"","x-example":"[LEGAL_NAME]"},"legalCountry":{"type":"string","description":"Project legal Country. Max length: 256 chars.","default":"","x-example":"[LEGAL_COUNTRY]"},"legalState":{"type":"string","description":"Project legal State. Max length: 256 chars.","default":"","x-example":"[LEGAL_STATE]"},"legalCity":{"type":"string","description":"Project legal City. Max length: 256 chars.","default":"","x-example":"[LEGAL_CITY]"},"legalAddress":{"type":"string","description":"Project legal Address. Max length: 256 chars.","default":"","x-example":"[LEGAL_ADDRESS]"},"legalTaxId":{"type":"string","description":"Project legal Tax ID. Max length: 256 chars.","default":"","x-example":"[LEGAL_TAX_ID]"}},"required":["name","teamId"]}}]}},"\/projects\/{projectId}":{"get":{"summary":"Get Project","operationId":"projectsGet","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Project","schema":{"$ref":"#\/definitions\/project"}}},"x-appwrite":{"method":"get","weight":99,"cookies":false,"type":"","demo":"projects\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"}]},"patch":{"summary":"Update Project","operationId":"projectsUpdate","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Project","schema":{"$ref":"#\/definitions\/project"}}},"x-appwrite":{"method":"update","weight":101,"cookies":false,"type":"","demo":"projects\/update.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Project name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"description":{"type":"string","description":"Project description. Max length: 256 chars.","default":"","x-example":"[DESCRIPTION]"},"logo":{"type":"string","description":"Project logo.","default":"","x-example":"[LOGO]"},"url":{"type":"string","description":"Project URL.","default":"","x-example":"https:\/\/example.com"},"legalName":{"type":"string","description":"Project legal name. Max length: 256 chars.","default":"","x-example":"[LEGAL_NAME]"},"legalCountry":{"type":"string","description":"Project legal country. Max length: 256 chars.","default":"","x-example":"[LEGAL_COUNTRY]"},"legalState":{"type":"string","description":"Project legal state. Max length: 256 chars.","default":"","x-example":"[LEGAL_STATE]"},"legalCity":{"type":"string","description":"Project legal city. Max length: 256 chars.","default":"","x-example":"[LEGAL_CITY]"},"legalAddress":{"type":"string","description":"Project legal address. Max length: 256 chars.","default":"","x-example":"[LEGAL_ADDRESS]"},"legalTaxId":{"type":"string","description":"Project legal tax ID. Max length: 256 chars.","default":"","x-example":"[LEGAL_TAX_ID]"}},"required":["name"]}}]},"delete":{"summary":"Delete Project","operationId":"projectsDelete","consumes":["application\/json"],"produces":[],"tags":["projects"],"description":"","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"delete","weight":105,"cookies":false,"type":"","demo":"projects\/delete.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"password":{"type":"string","description":"Your user password for confirmation. Must be between 6 to 32 chars.","default":null,"x-example":"[PASSWORD]"}},"required":["password"]}}]}},"\/projects\/{projectId}\/auth\/limit":{"patch":{"summary":"Update Project users limit","operationId":"projectsUpdateAuthLimit","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Project","schema":{"$ref":"#\/definitions\/project"}}},"x-appwrite":{"method":"updateAuthLimit","weight":103,"cookies":false,"type":"","demo":"projects\/update-auth-limit.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"limit":{"type":"string","description":"Set the max number of users allowed in this project. Use 0 for unlimited.","default":null,"x-example":null}},"required":["limit"]}}]}},"\/projects\/{projectId}\/auth\/{method}":{"patch":{"summary":"Update Project auth method status. Use this endpoint to enable or disable a given auth method for this project.","operationId":"projectsUpdateAuthStatus","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Project","schema":{"$ref":"#\/definitions\/project"}}},"x-appwrite":{"method":"updateAuthStatus","weight":104,"cookies":false,"type":"","demo":"projects\/update-auth-status.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"method","description":"Auth Method. Possible values: email-password,anonymous,invites,jwt,phone","required":true,"type":"string","x-example":"email-password","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"status":{"type":"boolean","description":"Set the status of this auth method.","default":null,"x-example":false}},"required":["status"]}}]}},"\/projects\/{projectId}\/domains":{"get":{"summary":"List Domains","operationId":"projectsListDomains","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Domains List","schema":{"$ref":"#\/definitions\/domainList"}}},"x-appwrite":{"method":"listDomains","weight":127,"cookies":false,"type":"","demo":"projects\/list-domains.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"}]},"post":{"summary":"Create Domain","operationId":"projectsCreateDomain","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"201":{"description":"Domain","schema":{"$ref":"#\/definitions\/domain"}}},"x-appwrite":{"method":"createDomain","weight":126,"cookies":false,"type":"","demo":"projects\/create-domain.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"domain":{"type":"string","description":"Domain name.","default":null,"x-example":null}},"required":["domain"]}}]}},"\/projects\/{projectId}\/domains\/{domainId}":{"get":{"summary":"Get Domain","operationId":"projectsGetDomain","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Domain","schema":{"$ref":"#\/definitions\/domain"}}},"x-appwrite":{"method":"getDomain","weight":128,"cookies":false,"type":"","demo":"projects\/get-domain.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"domainId","description":"Domain unique ID.","required":true,"type":"string","x-example":"[DOMAIN_ID]","in":"path"}]},"delete":{"summary":"Delete Domain","operationId":"projectsDeleteDomain","consumes":["application\/json"],"produces":[],"tags":["projects"],"description":"","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteDomain","weight":130,"cookies":false,"type":"","demo":"projects\/delete-domain.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"domainId","description":"Domain unique ID.","required":true,"type":"string","x-example":"[DOMAIN_ID]","in":"path"}]}},"\/projects\/{projectId}\/domains\/{domainId}\/verification":{"patch":{"summary":"Update Domain Verification Status","operationId":"projectsUpdateDomainVerification","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Domain","schema":{"$ref":"#\/definitions\/domain"}}},"x-appwrite":{"method":"updateDomainVerification","weight":129,"cookies":false,"type":"","demo":"projects\/update-domain-verification.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"domainId","description":"Domain unique ID.","required":true,"type":"string","x-example":"[DOMAIN_ID]","in":"path"}]}},"\/projects\/{projectId}\/keys":{"get":{"summary":"List Keys","operationId":"projectsListKeys","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"API Keys List","schema":{"$ref":"#\/definitions\/keyList"}}},"x-appwrite":{"method":"listKeys","weight":112,"cookies":false,"type":"","demo":"projects\/list-keys.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"}]},"post":{"summary":"Create Key","operationId":"projectsCreateKey","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"201":{"description":"Key","schema":{"$ref":"#\/definitions\/key"}}},"x-appwrite":{"method":"createKey","weight":111,"cookies":false,"type":"","demo":"projects\/create-key.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Key name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"scopes":{"type":"array","description":"Key scopes list.","default":null,"x-example":null,"items":{"type":"string"}}},"required":["name","scopes"]}}]}},"\/projects\/{projectId}\/keys\/{keyId}":{"get":{"summary":"Get Key","operationId":"projectsGetKey","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Key","schema":{"$ref":"#\/definitions\/key"}}},"x-appwrite":{"method":"getKey","weight":113,"cookies":false,"type":"","demo":"projects\/get-key.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"keyId","description":"Key unique ID.","required":true,"type":"string","x-example":"[KEY_ID]","in":"path"}]},"put":{"summary":"Update Key","operationId":"projectsUpdateKey","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Key","schema":{"$ref":"#\/definitions\/key"}}},"x-appwrite":{"method":"updateKey","weight":114,"cookies":false,"type":"","demo":"projects\/update-key.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"keyId","description":"Key unique ID.","required":true,"type":"string","x-example":"[KEY_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Key name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"scopes":{"type":"array","description":"Key scopes list","default":null,"x-example":null,"items":{"type":"string"}}},"required":["name","scopes"]}}]},"delete":{"summary":"Delete Key","operationId":"projectsDeleteKey","consumes":["application\/json"],"produces":[],"tags":["projects"],"description":"","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteKey","weight":115,"cookies":false,"type":"","demo":"projects\/delete-key.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"keyId","description":"Key unique ID.","required":true,"type":"string","x-example":"[KEY_ID]","in":"path"}]}},"\/projects\/{projectId}\/oauth2":{"patch":{"summary":"Update Project OAuth2","operationId":"projectsUpdateOAuth2","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Project","schema":{"$ref":"#\/definitions\/project"}}},"x-appwrite":{"method":"updateOAuth2","weight":102,"cookies":false,"type":"","demo":"projects\/update-o-auth2.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"provider":{"type":"string","description":"Provider Name","default":null,"x-example":"amazon"},"appId":{"type":"string","description":"Provider app ID. Max length: 256 chars.","default":"","x-example":"[APP_ID]"},"secret":{"type":"string","description":"Provider secret key. Max length: 512 chars.","default":"","x-example":"[SECRET]"}},"required":["provider"]}}]}},"\/projects\/{projectId}\/platforms":{"get":{"summary":"List Platforms","operationId":"projectsListPlatforms","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Platforms List","schema":{"$ref":"#\/definitions\/platformList"}}},"x-appwrite":{"method":"listPlatforms","weight":122,"cookies":false,"type":"","demo":"projects\/list-platforms.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"}]},"post":{"summary":"Create Platform","operationId":"projectsCreatePlatform","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"201":{"description":"Platform","schema":{"$ref":"#\/definitions\/platform"}}},"x-appwrite":{"method":"createPlatform","weight":121,"cookies":false,"type":"","demo":"projects\/create-platform.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"type":{"type":"string","description":"Platform type.","default":null,"x-example":"web"},"name":{"type":"string","description":"Platform name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"key":{"type":"string","description":"Package name for android or bundle ID for iOS. Max length: 256 chars.","default":"","x-example":"[KEY]"},"store":{"type":"string","description":"App store or Google Play store ID. Max length: 256 chars.","default":"","x-example":"[STORE]"},"hostname":{"type":"string","description":"Platform client hostname. Max length: 256 chars.","default":"","x-example":"[HOSTNAME]"}},"required":["type","name"]}}]}},"\/projects\/{projectId}\/platforms\/{platformId}":{"get":{"summary":"Get Platform","operationId":"projectsGetPlatform","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Platform","schema":{"$ref":"#\/definitions\/platform"}}},"x-appwrite":{"method":"getPlatform","weight":123,"cookies":false,"type":"","demo":"projects\/get-platform.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"platformId","description":"Platform unique ID.","required":true,"type":"string","x-example":"[PLATFORM_ID]","in":"path"}]},"put":{"summary":"Update Platform","operationId":"projectsUpdatePlatform","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Platform","schema":{"$ref":"#\/definitions\/platform"}}},"x-appwrite":{"method":"updatePlatform","weight":124,"cookies":false,"type":"","demo":"projects\/update-platform.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"platformId","description":"Platform unique ID.","required":true,"type":"string","x-example":"[PLATFORM_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Platform name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"key":{"type":"string","description":"Package name for android or bundle ID for iOS. Max length: 256 chars.","default":"","x-example":"[KEY]"},"store":{"type":"string","description":"App store or Google Play store ID. Max length: 256 chars.","default":"","x-example":"[STORE]"},"hostname":{"type":"string","description":"Platform client URL. Max length: 256 chars.","default":"","x-example":"[HOSTNAME]"}},"required":["name"]}}]},"delete":{"summary":"Delete Platform","operationId":"projectsDeletePlatform","consumes":["application\/json"],"produces":[],"tags":["projects"],"description":"","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deletePlatform","weight":125,"cookies":false,"type":"","demo":"projects\/delete-platform.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"platformId","description":"Platform unique ID.","required":true,"type":"string","x-example":"[PLATFORM_ID]","in":"path"}]}},"\/projects\/{projectId}\/tasks":{"get":{"summary":"List Tasks","operationId":"projectsListTasks","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Tasks List","schema":{"$ref":"#\/definitions\/taskList"}}},"x-appwrite":{"method":"listTasks","weight":117,"cookies":false,"type":"","demo":"projects\/list-tasks.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"}]},"post":{"summary":"Create Task","operationId":"projectsCreateTask","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"201":{"description":"Task","schema":{"$ref":"#\/definitions\/task"}}},"x-appwrite":{"method":"createTask","weight":116,"cookies":false,"type":"","demo":"projects\/create-task.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Task name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"status":{"type":"string","description":"Task status.","default":null,"x-example":"play"},"schedule":{"type":"string","description":"Task schedule CRON syntax.","default":null,"x-example":null},"security":{"type":"boolean","description":"Certificate verification, false for disabled or true for enabled.","default":null,"x-example":false},"httpMethod":{"type":"string","description":"Task HTTP method.","default":null,"x-example":"GET"},"httpUrl":{"type":"string","description":"Task HTTP URL","default":null,"x-example":"https:\/\/example.com"},"httpHeaders":{"type":"array","description":"Task HTTP headers list.","default":null,"x-example":null,"items":{"type":"string"}},"httpUser":{"type":"string","description":"Task HTTP user. Max length: 256 chars.","default":"","x-example":"[HTTP_USER]"},"httpPass":{"type":"string","description":"Task HTTP password. Max length: 256 chars.","default":"","x-example":"[HTTP_PASS]"}},"required":["name","status","schedule","security","httpMethod","httpUrl"]}}]}},"\/projects\/{projectId}\/tasks\/{taskId}":{"get":{"summary":"Get Task","operationId":"projectsGetTask","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Task","schema":{"$ref":"#\/definitions\/task"}}},"x-appwrite":{"method":"getTask","weight":118,"cookies":false,"type":"","demo":"projects\/get-task.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"taskId","description":"Task unique ID.","required":true,"type":"string","x-example":"[TASK_ID]","in":"path"}]},"put":{"summary":"Update Task","operationId":"projectsUpdateTask","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Task","schema":{"$ref":"#\/definitions\/task"}}},"x-appwrite":{"method":"updateTask","weight":119,"cookies":false,"type":"","demo":"projects\/update-task.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"taskId","description":"Task unique ID.","required":true,"type":"string","x-example":"[TASK_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Task name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"status":{"type":"string","description":"Task status.","default":null,"x-example":"play"},"schedule":{"type":"string","description":"Task schedule CRON syntax.","default":null,"x-example":null},"security":{"type":"boolean","description":"Certificate verification, false for disabled or true for enabled.","default":null,"x-example":false},"httpMethod":{"type":"string","description":"Task HTTP method.","default":null,"x-example":"GET"},"httpUrl":{"type":"string","description":"Task HTTP URL.","default":null,"x-example":"https:\/\/example.com"},"httpHeaders":{"type":"array","description":"Task HTTP headers list.","default":null,"x-example":null,"items":{"type":"string"}},"httpUser":{"type":"string","description":"Task HTTP user. Max length: 256 chars.","default":"","x-example":"[HTTP_USER]"},"httpPass":{"type":"string","description":"Task HTTP password. Max length: 256 chars.","default":"","x-example":"[HTTP_PASS]"}},"required":["name","status","schedule","security","httpMethod","httpUrl"]}}]},"delete":{"summary":"Delete Task","operationId":"projectsDeleteTask","consumes":["application\/json"],"produces":[],"tags":["projects"],"description":"","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteTask","weight":120,"cookies":false,"type":"","demo":"projects\/delete-task.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"taskId","description":"Task unique ID.","required":true,"type":"string","x-example":"[TASK_ID]","in":"path"}]}},"\/projects\/{projectId}\/usage":{"get":{"summary":"Get Project","operationId":"projectsGetUsage","consumes":["application\/json"],"produces":[],"tags":["projects"],"description":"","responses":{"500":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getUsage","weight":100,"cookies":false,"type":"","demo":"projects\/get-usage.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"range","description":"Date range.","required":false,"type":"string","x-example":"24h","default":"30d","in":"query"}]}},"\/projects\/{projectId}\/webhooks":{"get":{"summary":"List Webhooks","operationId":"projectsListWebhooks","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Webhooks List","schema":{"$ref":"#\/definitions\/webhookList"}}},"x-appwrite":{"method":"listWebhooks","weight":107,"cookies":false,"type":"","demo":"projects\/list-webhooks.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"}]},"post":{"summary":"Create Webhook","operationId":"projectsCreateWebhook","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"201":{"description":"Webhook","schema":{"$ref":"#\/definitions\/webhook"}}},"x-appwrite":{"method":"createWebhook","weight":106,"cookies":false,"type":"","demo":"projects\/create-webhook.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Webhook name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"events":{"type":"array","description":"Events list.","default":null,"x-example":null,"items":{"type":"string"}},"url":{"type":"string","description":"Webhook URL.","default":null,"x-example":"https:\/\/example.com"},"security":{"type":"boolean","description":"Certificate verification, false for disabled or true for enabled.","default":null,"x-example":false},"httpUser":{"type":"string","description":"Webhook HTTP user. Max length: 256 chars.","default":"","x-example":"[HTTP_USER]"},"httpPass":{"type":"string","description":"Webhook HTTP password. Max length: 256 chars.","default":"","x-example":"[HTTP_PASS]"}},"required":["name","events","url","security"]}}]}},"\/projects\/{projectId}\/webhooks\/{webhookId}":{"get":{"summary":"Get Webhook","operationId":"projectsGetWebhook","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Webhook","schema":{"$ref":"#\/definitions\/webhook"}}},"x-appwrite":{"method":"getWebhook","weight":108,"cookies":false,"type":"","demo":"projects\/get-webhook.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"webhookId","description":"Webhook unique ID.","required":true,"type":"string","x-example":"[WEBHOOK_ID]","in":"path"}]},"put":{"summary":"Update Webhook","operationId":"projectsUpdateWebhook","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Webhook","schema":{"$ref":"#\/definitions\/webhook"}}},"x-appwrite":{"method":"updateWebhook","weight":109,"cookies":false,"type":"","demo":"projects\/update-webhook.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"webhookId","description":"Webhook unique ID.","required":true,"type":"string","x-example":"[WEBHOOK_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Webhook name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"events":{"type":"array","description":"Events list.","default":null,"x-example":null,"items":{"type":"string"}},"url":{"type":"string","description":"Webhook URL.","default":null,"x-example":"https:\/\/example.com"},"security":{"type":"boolean","description":"Certificate verification, false for disabled or true for enabled.","default":null,"x-example":false},"httpUser":{"type":"string","description":"Webhook HTTP user. Max length: 256 chars.","default":"","x-example":"[HTTP_USER]"},"httpPass":{"type":"string","description":"Webhook HTTP password. Max length: 256 chars.","default":"","x-example":"[HTTP_PASS]"}},"required":["name","events","url","security"]}}]},"delete":{"summary":"Delete Webhook","operationId":"projectsDeleteWebhook","consumes":["application\/json"],"produces":[],"tags":["projects"],"description":"","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteWebhook","weight":110,"cookies":false,"type":"","demo":"projects\/delete-webhook.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"webhookId","description":"Webhook unique ID.","required":true,"type":"string","x-example":"[WEBHOOK_ID]","in":"path"}]}},"\/storage\/files":{"get":{"summary":"List Files","operationId":"storageListFiles","consumes":["application\/json"],"produces":["application\/json"],"tags":["storage"],"description":"Get a list of all the user files. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project's files. [Learn more about different API modes](\/docs\/admin).","responses":{"200":{"description":"Files List","schema":{"$ref":"#\/definitions\/fileList"}}},"x-appwrite":{"method":"listFiles","weight":132,"cookies":false,"type":"","demo":"storage\/list-files.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/list-files.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Results offset. The default value is 0. Use this param to manage pagination.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create File","operationId":"storageCreateFile","consumes":["multipart\/form-data"],"produces":["application\/json"],"tags":["storage"],"description":"Create a new file. The user who creates the file will automatically be assigned to read and write access unless he has passed custom values for read and write arguments.","responses":{"201":{"description":"File","schema":{"$ref":"#\/definitions\/file"}}},"x-appwrite":{"method":"createFile","weight":131,"cookies":false,"type":"upload","demo":"storage\/create-file.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/create-file.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"file","description":"Binary file.","required":true,"type":"file","in":"formData"},{"name":"read","description":"An array of strings with read permissions. By default only the current user is granted with read permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","required":false,"type":"array","collectionFormat":"multi","items":{"type":"string"},"in":"formData"},{"name":"write","description":"An array of strings with write permissions. By default only the current user is granted with write permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","required":false,"type":"array","collectionFormat":"multi","items":{"type":"string"},"in":"formData"}]}},"\/storage\/files\/{fileId}":{"get":{"summary":"Get File","operationId":"storageGetFile","consumes":["application\/json"],"produces":["application\/json"],"tags":["storage"],"description":"Get a file by its unique ID. This endpoint response returns a JSON object with the file metadata.","responses":{"200":{"description":"File","schema":{"$ref":"#\/definitions\/file"}}},"x-appwrite":{"method":"getFile","weight":133,"cookies":false,"type":"","demo":"storage\/get-file.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/get-file.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"fileId","description":"File unique ID.","required":true,"type":"string","x-example":"[FILE_ID]","in":"path"}]},"put":{"summary":"Update File","operationId":"storageUpdateFile","consumes":["application\/json"],"produces":["application\/json"],"tags":["storage"],"description":"Update a file by its unique ID. Only users with write permissions have access to update this resource.","responses":{"200":{"description":"File","schema":{"$ref":"#\/definitions\/file"}}},"x-appwrite":{"method":"updateFile","weight":137,"cookies":false,"type":"","demo":"storage\/update-file.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/update-file.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"fileId","description":"File unique ID.","required":true,"type":"string","x-example":"[FILE_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"read":{"type":"array","description":"An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}},"write":{"type":"array","description":"An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}}},"required":["read","write"]}}]},"delete":{"summary":"Delete File","operationId":"storageDeleteFile","consumes":["application\/json"],"produces":[],"tags":["storage"],"description":"Delete a file by its unique ID. Only users with write permissions have access to delete this resource.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteFile","weight":138,"cookies":false,"type":"","demo":"storage\/delete-file.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/delete-file.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"fileId","description":"File unique ID.","required":true,"type":"string","x-example":"[FILE_ID]","in":"path"}]}},"\/storage\/files\/{fileId}\/download":{"get":{"summary":"Get File for Download","operationId":"storageGetFileDownload","consumes":["application\/json"],"produces":["*\/*"],"tags":["storage"],"description":"Get a file content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory.","responses":{"200":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getFileDownload","weight":135,"cookies":false,"type":"location","demo":"storage\/get-file-download.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/get-file-download.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"fileId","description":"File unique ID.","required":true,"type":"string","x-example":"[FILE_ID]","in":"path"}]}},"\/storage\/files\/{fileId}\/preview":{"get":{"summary":"Get File Preview","operationId":"storageGetFilePreview","consumes":["application\/json"],"produces":["image\/*"],"tags":["storage"],"description":"Get a file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets, will return the file icon image. You can also pass query string arguments for cutting and resizing your preview image.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getFilePreview","weight":134,"cookies":false,"type":"location","demo":"storage\/get-file-preview.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/get-file-preview.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"fileId","description":"File unique ID","required":true,"type":"string","x-example":"[FILE_ID]","in":"path"},{"name":"width","description":"Resize preview image width, Pass an integer between 0 to 4000.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"height","description":"Resize preview image height, Pass an integer between 0 to 4000.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"quality","description":"Preview image quality. Pass an integer between 0 to 100. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"borderWidth","description":"Preview image border in pixels. Pass an integer between 0 to 100. Defaults to 0.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"borderColor","description":"Preview image border color. Use a valid HEX color, no # is needed for prefix.","required":false,"type":"string","default":"","in":"query"},{"name":"borderRadius","description":"Preview image border radius in pixels. Pass an integer between 0 to 4000.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"opacity","description":"Preview image opacity. Only works with images having an alpha channel (like png). Pass a number between 0 to 1.","required":false,"type":"number","format":"float","x-example":0,"default":1,"in":"query"},{"name":"rotation","description":"Preview image rotation in degrees. Pass an integer between 0 and 360.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"background","description":"Preview image background color. Only works with transparent images (png). Use a valid HEX color, no # is needed for prefix.","required":false,"type":"string","default":"","in":"query"},{"name":"output","description":"Output format type (jpeg, jpg, png, gif and webp).","required":false,"type":"string","x-example":"jpg","default":"","in":"query"}]}},"\/storage\/files\/{fileId}\/view":{"get":{"summary":"Get File for View","operationId":"storageGetFileView","consumes":["application\/json"],"produces":["*\/*"],"tags":["storage"],"description":"Get a file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header.","responses":{"200":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getFileView","weight":136,"cookies":false,"type":"location","demo":"storage\/get-file-view.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/get-file-view.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"fileId","description":"File unique ID.","required":true,"type":"string","x-example":"[FILE_ID]","in":"path"}]}},"\/teams":{"get":{"summary":"List Teams","operationId":"teamsList","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Get a list of all the current user teams. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project's teams. [Learn more about different API modes](\/docs\/admin).","responses":{"200":{"description":"Teams List","schema":{"$ref":"#\/definitions\/teamList"}}},"x-appwrite":{"method":"list","weight":140,"cookies":false,"type":"","demo":"teams\/list.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/list-teams.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Results offset. The default value is 0. Use this param to manage pagination.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create Team","operationId":"teamsCreate","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Create a new team. The user who creates the team will automatically be assigned as the owner of the team. The team owner can invite new members, who will be able add new owners and update or delete the team from your project.","responses":{"201":{"description":"Team","schema":{"$ref":"#\/definitions\/team"}}},"x-appwrite":{"method":"create","weight":139,"cookies":false,"type":"","demo":"teams\/create.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/create-team.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Team name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"roles":{"type":"array","description":"Array of strings. Use this param to set the roles in the team for the user who created it. The default role is **owner**. A role can be any string. Learn more about [roles and permissions](\/docs\/permissions). Max length for each role is 32 chars.","default":["owner"],"x-example":null,"items":{"type":"string"}}},"required":["name"]}}]}},"\/teams\/{teamId}":{"get":{"summary":"Get Team","operationId":"teamsGet","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Get a team by its unique ID. All team members have read access for this resource.","responses":{"200":{"description":"Team","schema":{"$ref":"#\/definitions\/team"}}},"x-appwrite":{"method":"get","weight":141,"cookies":false,"type":"","demo":"teams\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/get-team.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team unique ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"}]},"put":{"summary":"Update Team","operationId":"teamsUpdate","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Update a team by its unique ID. Only team owners have write access for this resource.","responses":{"200":{"description":"Team","schema":{"$ref":"#\/definitions\/team"}}},"x-appwrite":{"method":"update","weight":142,"cookies":false,"type":"","demo":"teams\/update.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/update-team.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team unique ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Team name. Max length: 128 chars.","default":null,"x-example":"[NAME]"}},"required":["name"]}}]},"delete":{"summary":"Delete Team","operationId":"teamsDelete","consumes":["application\/json"],"produces":[],"tags":["teams"],"description":"Delete a team by its unique ID. Only team owners have write access for this resource.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"delete","weight":143,"cookies":false,"type":"","demo":"teams\/delete.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/delete-team.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team unique ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"}]}},"\/teams\/{teamId}\/memberships":{"get":{"summary":"Get Team Memberships","operationId":"teamsGetMemberships","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Get a team members by the team unique ID. All team members have read access for this list of resources.","responses":{"200":{"description":"Memberships List","schema":{"$ref":"#\/definitions\/membershipList"}}},"x-appwrite":{"method":"getMemberships","weight":146,"cookies":false,"type":"","demo":"teams\/get-memberships.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/get-team-members.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team unique ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"},{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Results offset. The default value is 0. Use this param to manage pagination.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create Team Membership","operationId":"teamsCreateMembership","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Use this endpoint to invite a new member to join your team. An email with a link to join the team will be sent to the new member email address if the member doesn't exist in the project it will be created automatically.\n\nUse the 'URL' parameter to redirect the user from the invitation email back to your app. When the user is redirected, use the [Update Team Membership Status](\/docs\/client\/teams#teamsUpdateMembershipStatus) endpoint to allow the user to accept the invitation to the team.\n\nPlease note that in order to avoid a [Redirect Attacks](https:\/\/github.com\/OWASP\/CheatSheetSeries\/blob\/master\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URL's are the once from domains you have set when added your platforms in the console interface.","responses":{"201":{"description":"Membership","schema":{"$ref":"#\/definitions\/membership"}}},"x-appwrite":{"method":"createMembership","weight":144,"cookies":false,"type":"","demo":"teams\/create-membership.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/create-team-membership.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team unique ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"email":{"type":"string","description":"New team member email.","default":null,"x-example":"email@example.com"},"name":{"type":"string","description":"New team member name. Max length: 128 chars.","default":"","x-example":"[NAME]"},"roles":{"type":"array","description":"Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](\/docs\/permissions). Max length for each role is 32 chars.","default":null,"x-example":null,"items":{"type":"string"}},"url":{"type":"string","description":"URL to redirect the user back to your app from the invitation email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.","default":null,"x-example":"https:\/\/example.com"}},"required":["email","roles","url"]}}]}},"\/teams\/{teamId}\/memberships\/{membershipId}":{"patch":{"summary":"Update Membership Roles","operationId":"teamsUpdateMembershipRoles","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"","responses":{"200":{"description":"Membership","schema":{"$ref":"#\/definitions\/membership"}}},"x-appwrite":{"method":"updateMembershipRoles","weight":145,"cookies":false,"type":"","demo":"teams\/update-membership-roles.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/update-team-membership-roles.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team unique ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"},{"name":"membershipId","description":"Membership ID.","required":true,"type":"string","x-example":"[MEMBERSHIP_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"roles":{"type":"array","description":"Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](\/docs\/permissions). Max length for each role is 32 chars.","default":null,"x-example":null,"items":{"type":"string"}}},"required":["roles"]}}]},"delete":{"summary":"Delete Team Membership","operationId":"teamsDeleteMembership","consumes":["application\/json"],"produces":[],"tags":["teams"],"description":"This endpoint allows a user to leave a team or for a team owner to delete the membership of any other team member. You can also use this endpoint to delete a user membership even if it is not accepted.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteMembership","weight":148,"cookies":false,"type":"","demo":"teams\/delete-membership.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/delete-team-membership.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team unique ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"},{"name":"membershipId","description":"Membership ID.","required":true,"type":"string","x-example":"[MEMBERSHIP_ID]","in":"path"}]}},"\/teams\/{teamId}\/memberships\/{membershipId}\/status":{"patch":{"summary":"Update Team Membership Status","operationId":"teamsUpdateMembershipStatus","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Use this endpoint to allow a user to accept an invitation to join a team after being redirected back to your app from the invitation email recieved by the user.","responses":{"200":{"description":"Membership","schema":{"$ref":"#\/definitions\/membership"}}},"x-appwrite":{"method":"updateMembershipStatus","weight":147,"cookies":false,"type":"","demo":"teams\/update-membership-status.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/update-team-membership-status.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"public","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team unique ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"},{"name":"membershipId","description":"Membership ID.","required":true,"type":"string","x-example":"[MEMBERSHIP_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"userId":{"type":"string","description":"User unique ID.","default":null,"x-example":"[USER_ID]"},"secret":{"type":"string","description":"Secret key.","default":null,"x-example":"[SECRET]"}},"required":["userId","secret"]}}]}},"\/users":{"get":{"summary":"List Users","operationId":"usersList","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Get a list of all the project's users. You can use the query params to filter your results.","responses":{"200":{"description":"Users List","schema":{"$ref":"#\/definitions\/userList"}}},"x-appwrite":{"method":"list","weight":150,"cookies":false,"type":"","demo":"users\/list.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/list-users.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Results offset. The default value is 0. Use this param to manage pagination.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create User","operationId":"usersCreate","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Create a new user.","responses":{"201":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"create","weight":149,"cookies":false,"type":"","demo":"users\/create.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/create-user.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"email":{"type":"string","description":"User email.","default":null,"x-example":"email@example.com"},"password":{"type":"string","description":"User password. Must be between 6 to 32 chars.","default":null,"x-example":"password"},"name":{"type":"string","description":"User name. Max length: 128 chars.","default":"","x-example":"[NAME]"}},"required":["email","password"]}}]}},"\/users\/{userId}":{"get":{"summary":"Get User","operationId":"usersGet","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Get a user by its unique ID.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"get","weight":151,"cookies":false,"type":"","demo":"users\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/get-user.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"}]},"delete":{"summary":"Delete User","operationId":"usersDelete","consumes":["application\/json"],"produces":[],"tags":["users"],"description":"Delete a user by its unique ID.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"delete","weight":159,"cookies":false,"type":"","demo":"users\/delete.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/delete.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"}]}},"\/users\/{userId}\/logs":{"get":{"summary":"Get User Logs","operationId":"usersGetLogs","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Get a user activity logs list by its unique ID.","responses":{"200":{"description":"Logs List","schema":{"$ref":"#\/definitions\/logList"}}},"x-appwrite":{"method":"getLogs","weight":154,"cookies":false,"type":"","demo":"users\/get-logs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/get-user-logs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"}]}},"\/users\/{userId}\/prefs":{"get":{"summary":"Get User Preferences","operationId":"usersGetPrefs","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Get the user preferences by its unique ID.","responses":{"200":{"description":"Preferences","schema":{"$ref":"#\/definitions\/preferences"}}},"x-appwrite":{"method":"getPrefs","weight":152,"cookies":false,"type":"","demo":"users\/get-prefs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/get-user-prefs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"}]},"patch":{"summary":"Update User Preferences","operationId":"usersUpdatePrefs","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Update the user preferences by its unique ID. You can pass only the specific settings you wish to update.","responses":{"200":{"description":"Preferences","schema":{"$ref":"#\/definitions\/preferences"}}},"x-appwrite":{"method":"updatePrefs","weight":156,"cookies":false,"type":"","demo":"users\/update-prefs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/update-user-prefs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"prefs":{"type":"object","description":"Prefs key-value JSON object.","default":null,"x-example":"{}"}},"required":["prefs"]}}]}},"\/users\/{userId}\/sessions":{"get":{"summary":"Get User Sessions","operationId":"usersGetSessions","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Get the user sessions list by its unique ID.","responses":{"200":{"description":"Sessions List","schema":{"$ref":"#\/definitions\/sessionList"}}},"x-appwrite":{"method":"getSessions","weight":153,"cookies":false,"type":"","demo":"users\/get-sessions.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/get-user-sessions.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"}]},"delete":{"summary":"Delete User Sessions","operationId":"usersDeleteSessions","consumes":["application\/json"],"produces":[],"tags":["users"],"description":"Delete all user's sessions by using the user's unique ID.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteSessions","weight":158,"cookies":false,"type":"","demo":"users\/delete-sessions.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/delete-user-sessions.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"}]}},"\/users\/{userId}\/sessions\/{sessionId}":{"delete":{"summary":"Delete User Session","operationId":"usersDeleteSession","consumes":["application\/json"],"produces":[],"tags":["users"],"description":"Delete a user sessions by its unique ID.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteSession","weight":157,"cookies":false,"type":"","demo":"users\/delete-session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/delete-user-session.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"},{"name":"sessionId","description":"User unique session ID.","required":true,"type":"string","x-example":"[SESSION_ID]","in":"path"}]}},"\/users\/{userId}\/status":{"patch":{"summary":"Update User Status","operationId":"usersUpdateStatus","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Update the user status by its unique ID.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updateStatus","weight":155,"cookies":false,"type":"","demo":"users\/update-status.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/update-user-status.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User unique ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"status":{"type":"integer","description":"User Status code. To activate the user pass 1, to block the user pass 2 and for disabling the user pass 0","default":null,"x-example":1}},"required":["status"]}}]}}},"tags":[{"name":"account","description":"The Account service allows you to authenticate and manage a user account."},{"name":"avatars","description":"The Avatars service aims to help you complete everyday tasks related to your app image, icons, and avatars."},{"name":"database","description":"The Database service allows you to create structured collections of documents, query and filter lists of documents"},{"name":"locale","description":"The Locale service allows you to customize your app based on your users' location."},{"name":"health","description":"The Health service allows you to both validate and monitor your Appwrite server's health."},{"name":"projects","description":"The Project service allows you to manage all the projects in your Appwrite server."},{"name":"storage","description":"The Storage service allows you to manage your project files."},{"name":"teams","description":"The Teams service allows you to group users of your project and to enable them to share read and write access to your project resources"},{"name":"users","description":"The Users service allows you to manage your project users."},{"name":"functions","description":"The Functions Service allows you view, create and manage your Cloud Functions."}],"definitions":{"error":{"description":"Error","type":"object","properties":{"message":{"type":"string","description":"Error message.","x-example":"Not found"},"code":{"type":"string","description":"Error code.","x-example":"404"},"version":{"type":"string","description":"Server version number.","x-example":"1.0"}},"required":["message","code","version"]},"collectionList":{"description":"Collections List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"collections":{"type":"array","description":"List of collections.","items":{"type":"object","$ref":"#\/definitions\/collection"},"x-example":""}},"required":["sum","collections"]},"documentList":{"description":"Documents List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"documents":{"type":"array","description":"List of documents.","items":{"type":"object","$ref":"#\/definitions\/document"},"x-example":""}},"required":["sum","documents"]},"userList":{"description":"Users List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"users":{"type":"array","description":"List of users.","items":{"type":"object","$ref":"#\/definitions\/user"},"x-example":""}},"required":["sum","users"]},"sessionList":{"description":"Sessions List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"sessions":{"type":"array","description":"List of sessions.","items":{"type":"object","$ref":"#\/definitions\/session"},"x-example":""}},"required":["sum","sessions"]},"logList":{"description":"Logs List","type":"object","properties":{"logs":{"type":"array","description":"List of logs.","items":{"type":"object","$ref":"#\/definitions\/log"},"x-example":""}},"required":["logs"]},"fileList":{"description":"Files List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"files":{"type":"array","description":"List of files.","items":{"type":"object","$ref":"#\/definitions\/file"},"x-example":""}},"required":["sum","files"]},"teamList":{"description":"Teams List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"teams":{"type":"array","description":"List of teams.","items":{"type":"object","$ref":"#\/definitions\/team"},"x-example":""}},"required":["sum","teams"]},"membershipList":{"description":"Memberships List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"memberships":{"type":"array","description":"List of memberships.","items":{"type":"object","$ref":"#\/definitions\/membership"},"x-example":""}},"required":["sum","memberships"]},"functionList":{"description":"Functions List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"functions":{"type":"array","description":"List of functions.","items":{"type":"object","$ref":"#\/definitions\/function"},"x-example":""}},"required":["sum","functions"]},"tagList":{"description":"Tags List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"tags":{"type":"array","description":"List of tags.","items":{"type":"object","$ref":"#\/definitions\/tag"},"x-example":""}},"required":["sum","tags"]},"executionList":{"description":"Executions List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"executions":{"type":"array","description":"List of executions.","items":{"type":"object","$ref":"#\/definitions\/execution"},"x-example":""}},"required":["sum","executions"]},"projectList":{"description":"Projects List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"projects":{"type":"array","description":"List of projects.","items":{"type":"object","$ref":"#\/definitions\/project"},"x-example":""}},"required":["sum","projects"]},"webhookList":{"description":"Webhooks List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"webhooks":{"type":"array","description":"List of webhooks.","items":{"type":"object","$ref":"#\/definitions\/webhook"},"x-example":""}},"required":["sum","webhooks"]},"keyList":{"description":"API Keys List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"keys":{"type":"array","description":"List of keys.","items":{"type":"object","$ref":"#\/definitions\/key"},"x-example":""}},"required":["sum","keys"]},"taskList":{"description":"Tasks List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"tasks":{"type":"array","description":"List of tasks.","items":{"type":"object","$ref":"#\/definitions\/task"},"x-example":""}},"required":["sum","tasks"]},"platformList":{"description":"Platforms List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"platforms":{"type":"array","description":"List of platforms.","items":{"type":"object","$ref":"#\/definitions\/platform"},"x-example":""}},"required":["sum","platforms"]},"domainList":{"description":"Domains List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"domains":{"type":"array","description":"List of domains.","items":{"type":"object","$ref":"#\/definitions\/domain"},"x-example":""}},"required":["sum","domains"]},"countryList":{"description":"Countries List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"countries":{"type":"array","description":"List of countries.","items":{"type":"object","$ref":"#\/definitions\/country"},"x-example":""}},"required":["sum","countries"]},"continentList":{"description":"Continents List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"continents":{"type":"array","description":"List of continents.","items":{"type":"object","$ref":"#\/definitions\/continent"},"x-example":""}},"required":["sum","continents"]},"languageList":{"description":"Languages List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"languages":{"type":"array","description":"List of languages.","items":{"type":"object","$ref":"#\/definitions\/language"},"x-example":""}},"required":["sum","languages"]},"currencyList":{"description":"Currencies List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"currencies":{"type":"array","description":"List of currencies.","items":{"type":"object","$ref":"#\/definitions\/currency"},"x-example":""}},"required":["sum","currencies"]},"phoneList":{"description":"Phones List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"phones":{"type":"array","description":"List of phones.","items":{"type":"object","$ref":"#\/definitions\/phone"},"x-example":""}},"required":["sum","phones"]},"permissions":{"description":"Permissions","type":"object","properties":{"read":{"type":"array","description":"Read permissions.","items":{"type":"string"},"x-example":"user:5e5ea5c16897e"},"write":{"type":"array","description":"Write permissions.","items":{"type":"string"},"x-example":"user:5e5ea5c16897e"}},"required":["read","write"]},"collection":{"description":"Collection","type":"object","properties":{"$id":{"type":"string","description":"Collection ID.","x-example":"5e5ea5c16897e"},"$permissions":{"type":"object","description":"Collection permissions.","x-example":{},"items":{"type":"object","$ref":"#\/definitions\/permissions"}},"name":{"type":"string","description":"Collection name.","x-example":"Movies"},"dateCreated":{"type":"integer","description":"Collection creation date in Unix timestamp.","x-example":1592981250,"format":"int32"},"dateUpdated":{"type":"integer","description":"Collection creation date in Unix timestamp.","x-example":1592981550,"format":"int32"},"rules":{"type":"array","description":"Collection rules.","items":{"type":"object","$ref":"#\/definitions\/rule"},"x-example":""}},"required":["$id","$permissions","name","dateCreated","dateUpdated","rules"]},"document":{"description":"Document","type":"object","properties":{"$id":{"type":"string","description":"Document ID.","x-example":"5e5ea5c16897e"},"$collection":{"type":"string","description":"Collection ID.","x-example":"5e5ea5c15117e"},"$permissions":{"type":"object","description":"Document permissions.","x-example":{},"items":{"type":"object","$ref":"#\/definitions\/permissions"}}},"additionalProperties":true,"required":["$id","$collection","$permissions"]},"rule":{"description":"Rule","type":"object","properties":{"$id":{"type":"string","description":"Rule ID.","x-example":"5e5ea5c16897e"},"$collection":{"type":"string","description":"Rule Collection.","x-example":"5e5e66c16897e"},"type":{"type":"string","description":"Rule type. Possible values: ","x-example":"title"},"key":{"type":"string","description":"Rule key.","x-example":"title"},"label":{"type":"string","description":"Rule label.","x-example":"Title"},"default":{"type":"string","description":"Rule default value.","x-example":"Movie Name"},"array":{"type":"boolean","description":"Is array?","x-example":false},"required":{"type":"boolean","description":"Is required?","x-example":true},"list":{"type":"array","description":"List of allowed values","items":{"type":"string"},"x-example":"5e5ea5c168099"}},"required":["$id","$collection","type","key","label","default","array","required","list"]},"log":{"description":"Log","type":"object","properties":{"event":{"type":"string","description":"Event name.","x-example":"account.sessions.create"},"ip":{"type":"string","description":"IP session in use when the session was created.","x-example":"127.0.0.1"},"time":{"type":"integer","description":"Log creation time in Unix timestamp.","x-example":1592981250,"format":"int32"},"osCode":{"type":"string","description":"Operating system code name. View list of [available options](https:\/\/github.com\/appwrite\/appwrite\/blob\/master\/docs\/lists\/os.json).","x-example":"Mac"},"osName":{"type":"string","description":"Operating system name.","x-example":"Mac"},"osVersion":{"type":"string","description":"Operating system version.","x-example":"Mac"},"clientType":{"type":"string","description":"Client type.","x-example":"browser"},"clientCode":{"type":"string","description":"Client code name. View list of [available options](https:\/\/github.com\/appwrite\/appwrite\/blob\/master\/docs\/lists\/clients.json).","x-example":"CM"},"clientName":{"type":"string","description":"Client name.","x-example":"Chrome Mobile iOS"},"clientVersion":{"type":"string","description":"Client version.","x-example":"84.0"},"clientEngine":{"type":"string","description":"Client engine name.","x-example":"WebKit"},"clientEngineVersion":{"type":"string","description":"Client engine name.","x-example":"605.1.15"},"deviceName":{"type":"string","description":"Device name.","x-example":"smartphone"},"deviceBrand":{"type":"string","description":"Device brand name.","x-example":"Google"},"deviceModel":{"type":"string","description":"Device model name.","x-example":"Nexus 5"},"countryCode":{"type":"string","description":"Country two-character ISO 3166-1 alpha code.","x-example":"US"},"countryName":{"type":"string","description":"Country name.","x-example":"United States"}},"required":["event","ip","time","osCode","osName","osVersion","clientType","clientCode","clientName","clientVersion","clientEngine","clientEngineVersion","deviceName","deviceBrand","deviceModel","countryCode","countryName"]},"user":{"description":"User","type":"object","properties":{"$id":{"type":"string","description":"User ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"User name.","x-example":"John Doe"},"registration":{"type":"integer","description":"User registration date in Unix timestamp.","x-example":1592981250,"format":"int32"},"status":{"type":"integer","description":"User status. 0 for Unactivated, 1 for active and 2 is blocked.","x-example":0,"format":"int32"},"passwordUpdate":{"type":"integer","description":"Unix timestamp of the most recent password update","x-example":1592981250,"format":"int32"},"email":{"type":"string","description":"User email address.","x-example":"john@appwrite.io"},"emailVerification":{"type":"boolean","description":"Email verification status.","x-example":true},"prefs":{"type":"object","description":"User preferences as a key-value object","x-example":{"theme":"pink","timezone":"UTC"},"items":{"type":"object","$ref":"#\/definitions\/preferences"}}},"required":["$id","name","registration","status","passwordUpdate","email","emailVerification","prefs"]},"preferences":{"description":"Preferences","type":"object","additionalProperties":true},"session":{"description":"Session","type":"object","properties":{"$id":{"type":"string","description":"Session ID.","x-example":"5e5ea5c16897e"},"userId":{"type":"string","description":"User ID.","x-example":"5e5bb8c16897e"},"expire":{"type":"integer","description":"Session expiration date in Unix timestamp.","x-example":1592981250,"format":"int32"},"provider":{"type":"string","description":"Session Provider.","x-example":"email"},"providerUid":{"type":"string","description":"Session Provider User ID.","x-example":"user@example.com"},"providerToken":{"type":"string","description":"Session Provider Token.","x-example":"MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3"},"ip":{"type":"string","description":"IP in use when the session was created.","x-example":"127.0.0.1"},"osCode":{"type":"string","description":"Operating system code name. View list of [available options](https:\/\/github.com\/appwrite\/appwrite\/blob\/master\/docs\/lists\/os.json).","x-example":"Mac"},"osName":{"type":"string","description":"Operating system name.","x-example":"Mac"},"osVersion":{"type":"string","description":"Operating system version.","x-example":"Mac"},"clientType":{"type":"string","description":"Client type.","x-example":"browser"},"clientCode":{"type":"string","description":"Client code name. View list of [available options](https:\/\/github.com\/appwrite\/appwrite\/blob\/master\/docs\/lists\/clients.json).","x-example":"CM"},"clientName":{"type":"string","description":"Client name.","x-example":"Chrome Mobile iOS"},"clientVersion":{"type":"string","description":"Client version.","x-example":"84.0"},"clientEngine":{"type":"string","description":"Client engine name.","x-example":"WebKit"},"clientEngineVersion":{"type":"string","description":"Client engine name.","x-example":"605.1.15"},"deviceName":{"type":"string","description":"Device name.","x-example":"smartphone"},"deviceBrand":{"type":"string","description":"Device brand name.","x-example":"Google"},"deviceModel":{"type":"string","description":"Device model name.","x-example":"Nexus 5"},"countryCode":{"type":"string","description":"Country two-character ISO 3166-1 alpha code.","x-example":"US"},"countryName":{"type":"string","description":"Country name.","x-example":"United States"},"current":{"type":"boolean","description":"Returns true if this the current user session.","x-example":true}},"required":["$id","userId","expire","provider","providerUid","providerToken","ip","osCode","osName","osVersion","clientType","clientCode","clientName","clientVersion","clientEngine","clientEngineVersion","deviceName","deviceBrand","deviceModel","countryCode","countryName","current"]},"token":{"description":"Token","type":"object","properties":{"$id":{"type":"string","description":"Token ID.","x-example":"bb8ea5c16897e"},"userId":{"type":"string","description":"User ID.","x-example":"5e5ea5c168bb8"},"secret":{"type":"string","description":"Token secret key. This will return an empty string unless the response is returned using an API key or as part of a webhook payload.","x-example":""},"expire":{"type":"integer","description":"Token expiration date in Unix timestamp.","x-example":1592981250,"format":"int32"}},"required":["$id","userId","secret","expire"]},"jwt":{"description":"JWT","type":"object","properties":{"jwt":{"type":"string","description":"JWT encoded string.","x-example":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"}},"required":["jwt"]},"locale":{"description":"Locale","type":"object","properties":{"ip":{"type":"string","description":"User IP address.","x-example":"127.0.0.1"},"countryCode":{"type":"string","description":"Country code in [ISO 3166-1](http:\/\/en.wikipedia.org\/wiki\/ISO_3166-1) two-character format","x-example":"US"},"country":{"type":"string","description":"Country name. This field support localization.","x-example":"United States"},"continentCode":{"type":"string","description":"Continent code. A two character continent code \"AF\" for Africa, \"AN\" for Antarctica, \"AS\" for Asia, \"EU\" for Europe, \"NA\" for North America, \"OC\" for Oceania, and \"SA\" for South America.","x-example":"NA"},"continent":{"type":"string","description":"Continent name. This field support localization.","x-example":"North America"},"eu":{"type":"boolean","description":"True if country is part of the Europian Union.","x-example":false},"currency":{"type":"string","description":"Currency code in [ISO 4217-1](http:\/\/en.wikipedia.org\/wiki\/ISO_4217) three-character format","x-example":"USD"}},"required":["ip","countryCode","country","continentCode","continent","eu","currency"]},"file":{"description":"File","type":"object","properties":{"$id":{"type":"string","description":"File ID.","x-example":"5e5ea5c16897e"},"$permissions":{"type":"object","description":"File permissions.","x-example":{},"items":{"type":"object","$ref":"#\/definitions\/permissions"}},"name":{"type":"string","description":"File name.","x-example":"Pink.png"},"dateCreated":{"type":"integer","description":"File creation date in Unix timestamp.","x-example":1592981250,"format":"int32"},"signature":{"type":"string","description":"File MD5 signature.","x-example":"5d529fd02b544198ae075bd57c1762bb"},"mimeType":{"type":"string","description":"File mime type.","x-example":"image\/png"},"sizeOriginal":{"type":"integer","description":"File original size in bytes.","x-example":17890,"format":"int32"}},"required":["$id","$permissions","name","dateCreated","signature","mimeType","sizeOriginal"]},"team":{"description":"Team","type":"object","properties":{"$id":{"type":"string","description":"Team ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"Team name.","x-example":"VIP"},"dateCreated":{"type":"integer","description":"Team creation date in Unix timestamp.","x-example":1592981250,"format":"int32"},"sum":{"type":"integer","description":"Total sum of team members.","x-example":7,"format":"int32"}},"required":["$id","name","dateCreated","sum"]},"membership":{"description":"Membership","type":"object","properties":{"$id":{"type":"string","description":"Membership ID.","x-example":"5e5ea5c16897e"},"userId":{"type":"string","description":"User ID.","x-example":"5e5ea5c16897e"},"teamId":{"type":"string","description":"Team ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"User name.","x-example":"VIP"},"email":{"type":"string","description":"User email address.","x-example":"john@appwrite.io"},"invited":{"type":"integer","description":"Date, the user has been invited to join the team in Unix timestamp.","x-example":1592981250,"format":"int32"},"joined":{"type":"integer","description":"Date, the user has accepted the invitation to join the team in Unix timestamp.","x-example":1592981250,"format":"int32"},"confirm":{"type":"boolean","description":"User confirmation status, true if the user has joined the team or false otherwise.","x-example":false},"roles":{"type":"array","description":"User list of roles","items":{"type":"string"},"x-example":"admin"}},"required":["$id","userId","teamId","name","email","invited","joined","confirm","roles"]},"function":{"description":"Function","type":"object","properties":{"$id":{"type":"string","description":"Function ID.","x-example":"5e5ea5c16897e"},"$permissions":{"type":"object","description":"Function permissions.","x-example":{},"items":{"type":"object","$ref":"#\/definitions\/permissions"}},"name":{"type":"string","description":"Function name.","x-example":"My Function"},"dateCreated":{"type":"integer","description":"Function creation date in Unix timestamp.","x-example":1592981250,"format":"int32"},"dateUpdated":{"type":"integer","description":"Function update date in Unix timestamp.","x-example":1592981257,"format":"int32"},"status":{"type":"string","description":"Function status. Possible values: disabled, enabled","x-example":"enabled"},"env":{"type":"string","description":"Function execution environment.","x-example":"python-3.8"},"tag":{"type":"string","description":"Function active tag ID.","x-example":"5e5ea5c16897e"},"vars":{"type":"string","description":"Function environment variables.","x-example":{"key":"value"}},"events":{"type":"array","description":"Function trigger events.","items":{"type":"string"},"x-example":"account.create"},"schedule":{"type":"string","description":"Function execution schedult in CRON format.","x-example":"5 4 * * *"},"scheduleNext":{"type":"integer","description":"Function next scheduled execution date in Unix timestamp.","x-example":1592981292,"format":"int32"},"schedulePrevious":{"type":"integer","description":"Function next scheduled execution date in Unix timestamp.","x-example":1592981237,"format":"int32"},"timeout":{"type":"integer","description":"Function execution timeout in seconds.","x-example":1592981237,"format":"int32"}},"required":["$id","$permissions","name","dateCreated","dateUpdated","status","env","tag","vars","events","schedule","scheduleNext","schedulePrevious","timeout"]},"tag":{"description":"Tag","type":"object","properties":{"$id":{"type":"string","description":"Tag ID.","x-example":"5e5ea5c16897e"},"functionId":{"type":"string","description":"Function ID.","x-example":"5e5ea6g16897e"},"dateCreated":{"type":"integer","description":"The tag creation date in Unix timestamp.","x-example":1592981250,"format":"int32"},"command":{"type":"string","description":"The entrypoint command in use to execute the tag code.","x-example":"enabled"},"size":{"type":"string","description":"The code size in bytes.","x-example":"python-3.8"}},"required":["$id","functionId","dateCreated","command","size"]},"execution":{"description":"Execution","type":"object","properties":{"$id":{"type":"string","description":"Execution ID.","x-example":"5e5ea5c16897e"},"functionId":{"type":"string","description":"Function ID.","x-example":"5e5ea6g16897e"},"dateCreated":{"type":"integer","description":"The execution creation date in Unix timestamp.","x-example":1592981250,"format":"int32"},"trigger":{"type":"string","description":"The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`.","x-example":"http"},"status":{"type":"string","description":"The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`.","x-example":"processing"},"exitCode":{"type":"integer","description":"The script exit code.","x-example":0,"format":"int32"},"stdout":{"type":"string","description":"The script stdout output string.","x-example":""},"stderr":{"type":"string","description":"The script stderr output string.","x-example":""},"time":{"type":"number","description":"The script execution time in seconds.","x-example":0.4,"format":"float"}},"required":["$id","functionId","dateCreated","trigger","status","exitCode","stdout","stderr","time"]},"project":{"description":"Project","type":"object","properties":{"$id":{"type":"string","description":"Project ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"Project name.","x-example":"New Project"},"description":{"type":"string","description":"Project description.","x-example":"This is a new project."},"teamId":{"type":"string","description":"Project team ID.","x-example":"1592981250"},"logo":{"type":"string","description":"Project logo file ID.","x-example":"5f5c451b403cb"},"url":{"type":"string","description":"Project website URL.","x-example":"5f5c451b403cb"},"legalName":{"type":"string","description":"Company legal name.","x-example":"Company LTD."},"legalCountry":{"type":"string","description":"Country code in [ISO 3166-1](http:\/\/en.wikipedia.org\/wiki\/ISO_3166-1) two-character format.","x-example":"US"},"legalState":{"type":"string","description":"State name.","x-example":"New York"},"legalCity":{"type":"string","description":"City name.","x-example":"New York City."},"legalAddress":{"type":"string","description":"Company Address.","x-example":"620 Eighth Avenue, New York, NY 10018"},"legalTaxId":{"type":"string","description":"Company Tax ID.","x-example":"131102020"},"usersAuthLimit":{"type":"boolean","description":"Max users allowed. 0 is unlimited.","x-example":100},"platforms":{"type":"array","description":"List of Platforms.","items":{"type":"object","$ref":"#\/definitions\/platform"},"x-example":{}},"webhooks":{"type":"array","description":"List of Webhooks.","items":{"type":"object","$ref":"#\/definitions\/webhook"},"x-example":{}},"keys":{"type":"array","description":"List of API Keys.","items":{"type":"object","$ref":"#\/definitions\/key"},"x-example":{}},"domains":{"type":"array","description":"List of Domains.","items":{"type":"object","$ref":"#\/definitions\/domain"},"x-example":{}},"tasks":{"type":"array","description":"List of Tasks.","items":{"type":"object","$ref":"#\/definitions\/task"},"x-example":{}},"usersOauth2AmazonAppid":{"type":"string","description":"Amazon OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2AmazonSecret":{"type":"string","description":"Amazon OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2AppleAppid":{"type":"string","description":"Apple OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2AppleSecret":{"type":"string","description":"Apple OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2BitbucketAppid":{"type":"string","description":"BitBucket OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2BitbucketSecret":{"type":"string","description":"BitBucket OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2BitlyAppid":{"type":"string","description":"Bitly OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2BitlySecret":{"type":"string","description":"Bitly OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2BoxAppid":{"type":"string","description":"Box OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2BoxSecret":{"type":"string","description":"Box OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2DiscordAppid":{"type":"string","description":"Discord OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2DiscordSecret":{"type":"string","description":"Discord OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2DropboxAppid":{"type":"string","description":"Dropbox OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2DropboxSecret":{"type":"string","description":"Dropbox OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2FacebookAppid":{"type":"string","description":"Facebook OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2FacebookSecret":{"type":"string","description":"Facebook OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2GithubAppid":{"type":"string","description":"GitHub OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2GithubSecret":{"type":"string","description":"GitHub OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2GitlabAppid":{"type":"string","description":"GitLab OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2GitlabSecret":{"type":"string","description":"GitLab OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2GoogleAppid":{"type":"string","description":"Google OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2GoogleSecret":{"type":"string","description":"Google OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2LinkedinAppid":{"type":"string","description":"LinkedIn OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2LinkedinSecret":{"type":"string","description":"LinkedIn OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2MicrosoftAppid":{"type":"string","description":"Microsoft OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2MicrosoftSecret":{"type":"string","description":"Microsoft OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2PaypalAppid":{"type":"string","description":"PayPal OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2PaypalSecret":{"type":"string","description":"PayPal OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2PaypalSandboxAppid":{"type":"string","description":"PayPal OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2PaypalSandboxSecret":{"type":"string","description":"PayPal OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2SalesforceAppid":{"type":"string","description":"Salesforce OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2SalesforceSecret":{"type":"string","description":"Salesforce OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2SlackAppid":{"type":"string","description":"Slack OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2SlackSecret":{"type":"string","description":"Slack OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2SpotifyAppid":{"type":"string","description":"Spotify OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2SpotifySecret":{"type":"string","description":"Spotify OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2TradeshiftAppid":{"type":"string","description":"Tradeshift OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2TradeshiftSecret":{"type":"string","description":"Tradeshift OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2TradeshiftBoxAppid":{"type":"string","description":"Tradeshift OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2TradeshiftBoxSecret":{"type":"string","description":"Tradeshift OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2TwitchAppid":{"type":"string","description":"Twitch OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2TwitchSecret":{"type":"string","description":"Twitch OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2VkAppid":{"type":"string","description":"VK OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2VkSecret":{"type":"string","description":"VK OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2YahooAppid":{"type":"string","description":"Yahoo OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2YahooSecret":{"type":"string","description":"Yahoo OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2YandexAppid":{"type":"string","description":"Yandex OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2YandexSecret":{"type":"string","description":"Yandex OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2WordpressAppid":{"type":"string","description":"WordPress OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2WordpressSecret":{"type":"string","description":"WordPress OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersOauth2MockAppid":{"type":"string","description":"Mock OAuth app ID.","x-example":"123247283472834787438"},"usersOauth2MockSecret":{"type":"string","description":"Mock OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"usersAuthEmailPassword":{"type":"boolean","description":"Email\/Password auth method status","x-example":true},"usersAuthAnonymous":{"type":"boolean","description":"Anonymous auth method status","x-example":true},"usersAuthInvites":{"type":"boolean","description":"Invites auth method status","x-example":true},"usersAuthJWT":{"type":"boolean","description":"JWT auth method status","x-example":true},"usersAuthPhone":{"type":"boolean","description":"Phone auth method status","x-example":true}},"required":["$id","name","description","teamId","logo","url","legalName","legalCountry","legalState","legalCity","legalAddress","legalTaxId","usersAuthLimit","platforms","webhooks","keys","domains","tasks","usersOauth2AmazonAppid","usersOauth2AmazonSecret","usersOauth2AppleAppid","usersOauth2AppleSecret","usersOauth2BitbucketAppid","usersOauth2BitbucketSecret","usersOauth2BitlyAppid","usersOauth2BitlySecret","usersOauth2BoxAppid","usersOauth2BoxSecret","usersOauth2DiscordAppid","usersOauth2DiscordSecret","usersOauth2DropboxAppid","usersOauth2DropboxSecret","usersOauth2FacebookAppid","usersOauth2FacebookSecret","usersOauth2GithubAppid","usersOauth2GithubSecret","usersOauth2GitlabAppid","usersOauth2GitlabSecret","usersOauth2GoogleAppid","usersOauth2GoogleSecret","usersOauth2LinkedinAppid","usersOauth2LinkedinSecret","usersOauth2MicrosoftAppid","usersOauth2MicrosoftSecret","usersOauth2PaypalAppid","usersOauth2PaypalSecret","usersOauth2PaypalSandboxAppid","usersOauth2PaypalSandboxSecret","usersOauth2SalesforceAppid","usersOauth2SalesforceSecret","usersOauth2SlackAppid","usersOauth2SlackSecret","usersOauth2SpotifyAppid","usersOauth2SpotifySecret","usersOauth2TradeshiftAppid","usersOauth2TradeshiftSecret","usersOauth2TradeshiftBoxAppid","usersOauth2TradeshiftBoxSecret","usersOauth2TwitchAppid","usersOauth2TwitchSecret","usersOauth2VkAppid","usersOauth2VkSecret","usersOauth2YahooAppid","usersOauth2YahooSecret","usersOauth2YandexAppid","usersOauth2YandexSecret","usersOauth2WordpressAppid","usersOauth2WordpressSecret","usersOauth2MockAppid","usersOauth2MockSecret","usersAuthEmailPassword","usersAuthAnonymous","usersAuthInvites","usersAuthJWT","usersAuthPhone"]},"webhook":{"description":"Webhook","type":"object","properties":{"$id":{"type":"string","description":"Webhook ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"Webhook name.","x-example":"My Webhook"},"url":{"type":"string","description":"Webhook URL endpoint.","x-example":"https:\/\/example.com\/webhook"},"events":{"type":"array","description":"Webhook trigger events.","items":{"type":"string"},"x-example":"database.collections.update"},"security":{"type":"boolean","description":"Indicated if SSL \/ TLS Certificate verification is enabled.","x-example":true},"httpUser":{"type":"string","description":"HTTP basic authentication username.","x-example":"username"},"httpPass":{"type":"string","description":"HTTP basic authentication password.","x-example":"password"}},"required":["$id","name","url","events","security","httpUser","httpPass"]},"key":{"description":"Key","type":"object","properties":{"$id":{"type":"string","description":"Key ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"Key name.","x-example":"My API Key"},"scopes":{"type":"array","description":"Allowed permission scopes.","items":{"type":"string"},"x-example":"users.read"},"secret":{"type":"string","description":"Secret key.","x-example":"919c2d18fb5d4...a2ae413da83346ad2"}},"required":["$id","name","scopes","secret"]},"task":{"description":"Task","type":"object","properties":{"$id":{"type":"string","description":"Task ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"Task name.","x-example":"My Task"},"security":{"type":"boolean","description":"Indicated if SSL \/ TLS Certificate verification is enabled.","x-example":true},"httpMethod":{"type":"string","description":"Task HTTP Method.","x-example":"POST"},"httpUrl":{"type":"string","description":"Task HTTP URL.","x-example":"https:\/\/example.com\/task"},"httpHeaders":{"type":"array","description":"Task HTTP headers.","items":{"type":"string"},"x-example":"key:value"},"httpUser":{"type":"string","description":"HTTP basic authentication username.","x-example":"username"},"httpPass":{"type":"string","description":"HTTP basic authentication password.","x-example":"password"},"duration":{"type":"number","description":"Task duration in seconds.","x-example":1.2,"format":"float"},"delay":{"type":"number","description":"Task delay time in seconds.","x-example":1.2,"format":"float"},"failures":{"type":"integer","description":"Number of recurring task failures.","x-example":0,"format":"int32"},"schedule":{"type":"string","description":"Task schedule in CRON syntax.","x-example":"* * * * *"},"status":{"type":"string","description":"Task status. Possible values: play, pause","x-example":"enabled"},"updated":{"type":"integer","description":"Task last updated time in Unix timestamp.","x-example":1592981250,"format":"int32"},"previous":{"type":"integer","description":"Task previous run time in Unix timestamp.","x-example":1592981250,"format":"int32"},"next":{"type":"integer","description":"Task next run time in Unix timestamp.","x-example":1592981650,"format":"int32"}},"required":["$id","name","security","httpMethod","httpUrl","httpHeaders","httpUser","httpPass","duration","delay","failures","schedule","status","updated","previous","next"]},"domain":{"description":"Domain","type":"object","properties":{"$id":{"type":"string","description":"Domain ID.","x-example":"5e5ea5c16897e"},"domain":{"type":"string","description":"Domain name.","x-example":"appwrite.company.com"},"registerable":{"type":"string","description":"Registerable domain name.","x-example":"company.com"},"tld":{"type":"string","description":"TLD name.","x-example":"com"},"verification":{"type":"boolean","description":"Verification process status.","x-example":true},"certificateId":{"type":"string","description":"Certificate ID.","x-example":"6ejea5c13377e"}},"required":["$id","domain","registerable","tld","verification","certificateId"]},"platform":{"description":"Platform","type":"object","properties":{"$id":{"type":"string","description":"Platform ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"Platform name.","x-example":"My Web App"},"type":{"type":"string","description":"Platform type. Possible values are: web, flutter-ios, flutter-android, ios, android, and unity.","x-example":"My Web App"},"key":{"type":"string","description":"Platform Key. iOS bundle ID or Android package name. Empty string for other platforms.","x-example":"com.company.appname"},"store":{"type":"string","description":"App store or Google Play store ID.","x-example":""},"hostname":{"type":"string","description":"Web app hostname. Empty string for other platforms.","x-example":true},"httpUser":{"type":"string","description":"HTTP basic authentication username.","x-example":"username"},"httpPass":{"type":"string","description":"HTTP basic authentication password.","x-example":"password"}},"required":["$id","name","type","key","store","hostname","httpUser","httpPass"]},"country":{"description":"Country","type":"object","properties":{"name":{"type":"string","description":"Country name.","x-example":"United States"},"code":{"type":"string","description":"Country two-character ISO 3166-1 alpha code.","x-example":"US"}},"required":["name","code"]},"continent":{"description":"Continent","type":"object","properties":{"name":{"type":"string","description":"Continent name.","x-example":"Europe"},"code":{"type":"string","description":"Continent two letter code.","x-example":"EU"}},"required":["name","code"]},"language":{"description":"Language","type":"object","properties":{"name":{"type":"string","description":"Language name.","x-example":"Italian"},"code":{"type":"string","description":"Language two-character ISO 639-1 codes.","x-example":"it"},"nativeName":{"type":"string","description":"Language native name.","x-example":"Italiano"}},"required":["name","code","nativeName"]},"currency":{"description":"Currency","type":"object","properties":{"symbol":{"type":"string","description":"Currency symbol.","x-example":"$"},"name":{"type":"string","description":"Currency name.","x-example":"US dollar"},"symbolNative":{"type":"string","description":"Currency native symbol.","x-example":"$"},"decimalDigits":{"type":"integer","description":"Number of decimal digits.","x-example":2,"format":"int32"},"rounding":{"type":"number","description":"Currency digit rounding.","x-example":0,"format":"float"},"code":{"type":"string","description":"Currency code in [ISO 4217-1](http:\/\/en.wikipedia.org\/wiki\/ISO_4217) three-character format.","x-example":"USD"},"namePlural":{"type":"string","description":"Currency plural name","x-example":"US dollars"}},"required":["symbol","name","symbolNative","decimalDigits","rounding","code","namePlural"]},"phone":{"description":"Phone","type":"object","properties":{"code":{"type":"string","description":"Phone code.","x-example":"+1"},"countryCode":{"type":"string","description":"Country two-character ISO 3166-1 alpha code.","x-example":"US"},"countryName":{"type":"string","description":"Country name.","x-example":"United States"}},"required":["code","countryCode","countryName"]}},"externalDocs":{"description":"Full API docs, specs and tutorials","url":"https:\/\/appwrite.io\/docs"}} \ No newline at end of file diff --git a/specs/swagger2-latest-console.json b/specs/swagger2-latest-console.json deleted file mode 100644 index 145eab2678..0000000000 --- a/specs/swagger2-latest-console.json +++ /dev/null @@ -1 +0,0 @@ -{"swagger":"2.0","info":{"version":"0.12.3","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","contact":{"name":"Appwrite Team","url":"https:\/\/appwrite.io\/support","email":"team@appwrite.io"},"license":{"name":"BSD-3-Clause","url":"https:\/\/raw.githubusercontent.com\/appwrite\/appwrite\/master\/LICENSE"}},"host":"HOSTNAME","basePath":"\/v1","schemes":["https"],"consumes":["application\/json","multipart\/form-data"],"produces":["application\/json"],"securityDefinitions":{"Project":{"type":"apiKey","name":"X-Appwrite-Project","description":"Your project ID","in":"header","x-appwrite":{"demo":"5df5acd0d48c2"}},"Key":{"type":"apiKey","name":"X-Appwrite-Key","description":"Your secret API key","in":"header","x-appwrite":{"demo":"919c2d18fb5d4...a2ae413da83346ad2"}},"JWT":{"type":"apiKey","name":"X-Appwrite-JWT","description":"Your secret JSON Web Token","in":"header","x-appwrite":{"demo":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ..."}},"Locale":{"type":"apiKey","name":"X-Appwrite-Locale","description":"","in":"header","x-appwrite":{"demo":"en"}},"Mode":{"type":"apiKey","name":"X-Appwrite-Mode","description":"","in":"header","x-appwrite":{"demo":""}}},"paths":{"\/account":{"get":{"summary":"Get Account","operationId":"accountGet","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Get currently logged in user data as JSON object.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"get","weight":47,"cookies":false,"type":"","demo":"account\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/get.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}]},"post":{"summary":"Create Account","operationId":"accountCreate","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to allow a new user to register a new account in your project. After the user registration completes successfully, you can use the [\/account\/verfication](\/docs\/client\/account#accountCreateVerification) route to start verifying the user email address. To allow the new user to login to their new account, you need to create a new [account session](\/docs\/client\/account#accountCreateSession).","responses":{"201":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"create","weight":37,"cookies":false,"type":"","demo":"account\/create.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"public","platforms":["client"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"userId":{"type":"string","description":"Unique Id. Choose your own unique ID or pass the string \"unique()\" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.","default":null,"x-example":"[USER_ID]"},"email":{"type":"string","description":"User email.","default":null,"x-example":"email@example.com"},"password":{"type":"string","description":"User password. Must be at least 8 chars.","default":null,"x-example":"password"},"name":{"type":"string","description":"User name. Max length: 128 chars.","default":"","x-example":"[NAME]"}},"required":["userId","email","password"]}}]},"delete":{"summary":"Delete Account","operationId":"accountDelete","consumes":["application\/json"],"produces":[],"tags":["account"],"description":"Delete a currently logged in user account. Behind the scene, the user record is not deleted but permanently blocked from any access. This is done to avoid deleted accounts being overtaken by new users with the same email address. Any user-related resources like documents or storage files should be deleted separately.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"delete","weight":56,"cookies":false,"type":"","demo":"account\/delete.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/delete.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}]}},"\/account\/email":{"patch":{"summary":"Update Account Email","operationId":"accountUpdateEmail","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Update currently logged in user account email address. After changing user address, the user confirmation status will get reset. A new confirmation email is not sent automatically however you can use the send confirmation email endpoint again to send the confirmation email. For security measures, user password is required to complete this request.\nThis endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password.\n","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updateEmail","weight":54,"cookies":false,"type":"","demo":"account\/update-email.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-email.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"email":{"type":"string","description":"User email.","default":null,"x-example":"email@example.com"},"password":{"type":"string","description":"User password. Must be at least 8 chars.","default":null,"x-example":"password"}},"required":["email","password"]}}]}},"\/account\/jwt":{"post":{"summary":"Create Account JWT","operationId":"accountCreateJWT","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to create a JSON Web Token. You can use the resulting JWT to authenticate on behalf of the current user when working with the Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes from its creation and will be invalid if the user will logout in that time frame.","responses":{"201":{"description":"JWT","schema":{"$ref":"#\/definitions\/jwt"}}},"x-appwrite":{"method":"createJWT","weight":46,"cookies":false,"type":"","demo":"account\/create-j-w-t.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create-jwt.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},userId:{userId}","scope":"account","platforms":["client"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}]}},"\/account\/logs":{"get":{"summary":"Get Account Logs","operationId":"accountGetLogs","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Get currently logged in user list of latest security activity logs. Each log returns user IP address, location and date and time of log.","responses":{"200":{"description":"Logs List","schema":{"$ref":"#\/definitions\/logList"}}},"x-appwrite":{"method":"getLogs","weight":50,"cookies":false,"type":"","demo":"account\/get-logs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/get-logs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"limit","description":"Maximum number of logs to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Offset value. The default value is 0. Use this value to manage pagination. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"}]}},"\/account\/name":{"patch":{"summary":"Update Account Name","operationId":"accountUpdateName","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Update currently logged in user account name.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updateName","weight":52,"cookies":false,"type":"","demo":"account\/update-name.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-name.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"User name. Max length: 128 chars.","default":null,"x-example":"[NAME]"}},"required":["name"]}}]}},"\/account\/password":{"patch":{"summary":"Update Account Password","operationId":"accountUpdatePassword","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Update currently logged in user password. For validation, user is required to pass in the new password, and the old password. For users created with OAuth and Team Invites, oldPassword is optional.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updatePassword","weight":53,"cookies":false,"type":"","demo":"account\/update-password.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-password.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"password":{"type":"string","description":"New user password. Must be at least 8 chars.","default":null,"x-example":"password"},"oldPassword":{"type":"string","description":"Current user password. Must be at least 8 chars.","default":"","x-example":"password"}},"required":["password"]}}]}},"\/account\/prefs":{"get":{"summary":"Get Account Preferences","operationId":"accountGetPrefs","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Get currently logged in user preferences as a key-value object.","responses":{"200":{"description":"Preferences","schema":{"$ref":"#\/definitions\/preferences"}}},"x-appwrite":{"method":"getPrefs","weight":48,"cookies":false,"type":"","demo":"account\/get-prefs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/get-prefs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}]},"patch":{"summary":"Update Account Preferences","operationId":"accountUpdatePrefs","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Update currently logged in user account preferences. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updatePrefs","weight":55,"cookies":false,"type":"","demo":"account\/update-prefs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-prefs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"prefs":{"type":"object","description":"Prefs key-value JSON object.","default":{},"x-example":"{}"}},"required":["prefs"]}}]}},"\/account\/recovery":{"post":{"summary":"Create Password Recovery","operationId":"accountCreateRecovery","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Sends the user an email with a temporary secret key for password reset. When the user clicks the confirmation link he is redirected back to your app password reset URL with the secret key and email address values attached to the URL query string. Use the query string params to submit a request to the [PUT \/account\/recovery](\/docs\/client\/account#accountUpdateRecovery) endpoint to complete the process. The verification link sent to the user's email address is valid for 1 hour.","responses":{"201":{"description":"Token","schema":{"$ref":"#\/definitions\/token"}}},"x-appwrite":{"method":"createRecovery","weight":60,"cookies":false,"type":"","demo":"account\/create-recovery.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create-recovery.md","rate-limit":10,"rate-time":3600,"rate-key":["url:{url},email:{param-email}","ip:{ip}"],"scope":"public","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"email":{"type":"string","description":"User email.","default":null,"x-example":"email@example.com"},"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"}},"required":["email","url"]}}]},"put":{"summary":"Create Password Recovery (confirmation)","operationId":"accountUpdateRecovery","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to complete the user account password reset. Both the **userId** and **secret** arguments will be passed as query parameters to the redirect URL you have provided when sending your request to the [POST \/account\/recovery](\/docs\/client\/account#accountCreateRecovery) endpoint.\n\nPlease note that in order to avoid a [Redirect Attack](https:\/\/github.com\/OWASP\/CheatSheetSeries\/blob\/master\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.","responses":{"200":{"description":"Token","schema":{"$ref":"#\/definitions\/token"}}},"x-appwrite":{"method":"updateRecovery","weight":61,"cookies":false,"type":"","demo":"account\/update-recovery.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-recovery.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},userId:{param-userId}","scope":"public","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"userId":{"type":"string","description":"User ID.","default":null,"x-example":"[USER_ID]"},"secret":{"type":"string","description":"Valid reset token.","default":null,"x-example":"[SECRET]"},"password":{"type":"string","description":"New user password. Must be at least 8 chars.","default":null,"x-example":"password"},"passwordAgain":{"type":"string","description":"Repeat new user password. Must be at least 8 chars.","default":null,"x-example":"password"}},"required":["userId","secret","password","passwordAgain"]}}]}},"\/account\/sessions":{"get":{"summary":"Get Account Sessions","operationId":"accountGetSessions","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Get currently logged in user list of active sessions across different devices.","responses":{"200":{"description":"Sessions List","schema":{"$ref":"#\/definitions\/sessionList"}}},"x-appwrite":{"method":"getSessions","weight":49,"cookies":false,"type":"","demo":"account\/get-sessions.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/get-sessions.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}]},"post":{"summary":"Create Account Session","operationId":"accountCreateSession","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Allow the user to login into their account by providing a valid email and password combination. This route will create a new session for the user.","responses":{"201":{"description":"Session","schema":{"$ref":"#\/definitions\/session"}}},"x-appwrite":{"method":"createSession","weight":38,"cookies":false,"type":"","demo":"account\/create-session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create-session.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},email:{param-email}","scope":"public","platforms":["client"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"email":{"type":"string","description":"User email.","default":null,"x-example":"email@example.com"},"password":{"type":"string","description":"User password. Must be at least 8 chars.","default":null,"x-example":"password"}},"required":["email","password"]}}]},"delete":{"summary":"Delete All Account Sessions","operationId":"accountDeleteSessions","consumes":["application\/json"],"produces":[],"tags":["account"],"description":"Delete all sessions from the user account and remove any sessions cookies from the end client.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteSessions","weight":59,"cookies":false,"type":"","demo":"account\/delete-sessions.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/delete-sessions.md","rate-limit":100,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}]}},"\/account\/sessions\/anonymous":{"post":{"summary":"Create Anonymous Session","operationId":"accountCreateAnonymousSession","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to allow a new user to register an anonymous account in your project. This route will also create a new session for the user. To allow the new user to convert an anonymous account to a normal account, you need to update its [email and password](\/docs\/client\/account#accountUpdateEmail) or create an [OAuth2 session](\/docs\/client\/account#accountCreateOAuth2Session).","responses":{"201":{"description":"Session","schema":{"$ref":"#\/definitions\/session"}}},"x-appwrite":{"method":"createAnonymousSession","weight":45,"cookies":false,"type":"","demo":"account\/create-anonymous-session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create-session-anonymous.md","rate-limit":50,"rate-time":3600,"rate-key":"ip:{ip}","scope":"public","platforms":["client"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}]}},"\/account\/sessions\/magic-url":{"post":{"summary":"Create Magic URL session","operationId":"accountCreateMagicURLSession","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Sends the user an email with a secret key for creating a session. When the user clicks the link in the email, the user is redirected back to the URL you provided with the secret key and userId values attached to the URL query string. Use the query string parameters to submit a request to the [PUT \/account\/sessions\/magic-url](\/docs\/client\/account#accountUpdateMagicURLSession) endpoint to complete the login process. The link sent to the user's email address is valid for 1 hour. If you are on a mobile device you can leave the URL parameter empty, so that the login completion will be handled by your Appwrite instance by default.","responses":{"201":{"description":"Token","schema":{"$ref":"#\/definitions\/token"}}},"x-appwrite":{"method":"createMagicURLSession","weight":43,"cookies":false,"type":"","demo":"account\/create-magic-u-r-l-session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create-magic-url-session.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},email:{param-email}","scope":"public","platforms":["client"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"userId":{"type":"string","description":"Unique Id. Choose your own unique ID or pass the string \"unique()\" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.","default":null,"x-example":"[USER_ID]"},"email":{"type":"string","description":"User email.","default":null,"x-example":"email@example.com"},"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"}},"required":["userId","email"]}}]},"put":{"summary":"Create Magic URL session (confirmation)","operationId":"accountUpdateMagicURLSession","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to complete creating the session with the Magic URL. Both the **userId** and **secret** arguments will be passed as query parameters to the redirect URL you have provided when sending your request to the [POST \/account\/sessions\/magic-url](\/docs\/client\/account#accountCreateMagicURLSession) endpoint.\n\nPlease note that in order to avoid a [Redirect Attack](https:\/\/github.com\/OWASP\/CheatSheetSeries\/blob\/master\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.","responses":{"200":{"description":"Session","schema":{"$ref":"#\/definitions\/session"}}},"x-appwrite":{"method":"updateMagicURLSession","weight":44,"cookies":false,"type":"","demo":"account\/update-magic-u-r-l-session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-magic-url-session.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},userId:{param-userId}","scope":"public","platforms":["client"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"userId":{"type":"string","description":"User ID.","default":null,"x-example":"[USER_ID]"},"secret":{"type":"string","description":"Valid verification token.","default":null,"x-example":"[SECRET]"}},"required":["userId","secret"]}}]}},"\/account\/sessions\/oauth2\/{provider}":{"get":{"summary":"Create Account Session with OAuth2","operationId":"accountCreateOAuth2Session","consumes":["application\/json"],"produces":["text\/html"],"tags":["account"],"description":"Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL's back to your app when login is completed.\n\nIf there is already an active session, the new session will be attached to the logged-in account. If there are no active sessions, the server will attempt to look for a user with the same email address as the email received from the OAuth2 provider and attach the new session to the existing user. If no matching user is found - the server will create a new user..\n","responses":{"301":{"description":"No content"}},"x-appwrite":{"method":"createOAuth2Session","weight":39,"cookies":false,"type":"webAuth","demo":"account\/create-o-auth2session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create-session-oauth2.md","rate-limit":50,"rate-time":3600,"rate-key":"ip:{ip}","scope":"public","platforms":["client"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"provider","description":"OAuth2 Provider. Currently, supported providers are: amazon, apple, bitbucket, bitly, box, discord, dropbox, facebook, github, gitlab, google, linkedin, microsoft, notion, paypal, paypalSandbox, salesforce, slack, spotify, tradeshift, tradeshiftBox, twitch, vk, yahoo, yammer, yandex, wordpress, stripe.","required":true,"type":"string","x-example":"amazon","in":"path"},{"name":"success","description":"URL to redirect back to your app after a successful login attempt. 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.","required":false,"type":"string","format":"url","x-example":"https:\/\/example.com","default":"","in":"query"},{"name":"failure","description":"URL to redirect back to your app after a failed login attempt. 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.","required":false,"type":"string","format":"url","x-example":"https:\/\/example.com","default":"","in":"query"},{"name":"scopes","description":"A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes.","required":false,"type":"array","collectionFormat":"multi","items":{"type":"string"},"default":[],"in":"query"}]}},"\/account\/sessions\/{sessionId}":{"get":{"summary":"Get Session By ID","operationId":"accountGetSession","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to get a logged in user's session using a Session ID. Inputting 'current' will return the current session being used.","responses":{"200":{"description":"Session","schema":{"$ref":"#\/definitions\/session"}}},"x-appwrite":{"method":"getSession","weight":51,"cookies":false,"type":"","demo":"account\/get-session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/get-session.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"sessionId","description":"Session ID. Use the string 'current' to get the current device session.","required":true,"type":"string","x-example":"[SESSION_ID]","in":"path"}]},"patch":{"summary":"Update Session (Refresh Tokens)","operationId":"accountUpdateSession","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"","responses":{"200":{"description":"Session","schema":{"$ref":"#\/definitions\/session"}}},"x-appwrite":{"method":"updateSession","weight":58,"cookies":false,"type":"","demo":"account\/update-session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-session.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"sessionId","description":"Session ID. Use the string 'current' to update the current device session.","required":true,"type":"string","x-example":"[SESSION_ID]","in":"path"}]},"delete":{"summary":"Delete Account Session","operationId":"accountDeleteSession","consumes":["application\/json"],"produces":[],"tags":["account"],"description":"Use this endpoint to log out the currently logged in user from all their account sessions across all of their different devices. When using the Session ID argument, only the unique session ID provided is deleted.\n","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteSession","weight":57,"cookies":false,"type":"","demo":"account\/delete-session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/delete-session.md","rate-limit":100,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"sessionId","description":"Session ID. Use the string 'current' to delete the current device session.","required":true,"type":"string","x-example":"[SESSION_ID]","in":"path"}]}},"\/account\/verification":{"post":{"summary":"Create Email Verification","operationId":"accountCreateVerification","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the **userId** and **secret** arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the **userId** and **secret** parameters. Learn more about how to [complete the verification process](\/docs\/client\/account#accountUpdateVerification). The verification link sent to the user's email address is valid for 7 days.\n\nPlease note that in order to avoid a [Redirect Attack](https:\/\/github.com\/OWASP\/CheatSheetSeries\/blob\/master\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.\n","responses":{"201":{"description":"Token","schema":{"$ref":"#\/definitions\/token"}}},"x-appwrite":{"method":"createVerification","weight":62,"cookies":false,"type":"","demo":"account\/create-verification.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/create-verification.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},userId:{userId}","scope":"account","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"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.","default":null,"x-example":"https:\/\/example.com"}},"required":["url"]}}]},"put":{"summary":"Create Email Verification (confirmation)","operationId":"accountUpdateVerification","consumes":["application\/json"],"produces":["application\/json"],"tags":["account"],"description":"Use this endpoint to complete the user email verification process. Use both the **userId** and **secret** parameters that were attached to your app URL to verify the user email ownership. If confirmed this route will return a 200 status code.","responses":{"200":{"description":"Token","schema":{"$ref":"#\/definitions\/token"}}},"x-appwrite":{"method":"updateVerification","weight":63,"cookies":false,"type":"","demo":"account\/update-verification.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/account\/update-verification.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},userId:{param-userId}","scope":"public","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"userId":{"type":"string","description":"User ID.","default":null,"x-example":"[USER_ID]"},"secret":{"type":"string","description":"Valid verification token.","default":null,"x-example":"[SECRET]"}},"required":["userId","secret"]}}]}},"\/avatars\/browsers\/{code}":{"get":{"summary":"Get Browser Icon","operationId":"avatarsGetBrowser","consumes":["application\/json"],"produces":["image\/png"],"tags":["avatars"],"description":"You can use this endpoint to show different browser icons to your users. The code argument receives the browser code as it appears in your user \/account\/sessions endpoint. Use width, height and quality arguments to change the output settings.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getBrowser","weight":65,"cookies":false,"type":"location","demo":"avatars\/get-browser.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-browser.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"code","description":"Browser Code.","required":true,"type":"string","x-example":"aa","in":"path"},{"name":"width","description":"Image width. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"height","description":"Image height. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"quality","description":"Image quality. Pass an integer between 0 to 100. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"}]}},"\/avatars\/credit-cards\/{code}":{"get":{"summary":"Get Credit Card Icon","operationId":"avatarsGetCreditCard","consumes":["application\/json"],"produces":["image\/png"],"tags":["avatars"],"description":"The credit card endpoint will return you the icon of the credit card provider you need. Use width, height and quality arguments to change the output settings.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getCreditCard","weight":64,"cookies":false,"type":"location","demo":"avatars\/get-credit-card.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-credit-card.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"code","description":"Credit Card Code. Possible values: amex, argencard, cabal, censosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, union-china-pay, visa, mir, maestro.","required":true,"type":"string","x-example":"amex","in":"path"},{"name":"width","description":"Image width. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"height","description":"Image height. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"quality","description":"Image quality. Pass an integer between 0 to 100. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"}]}},"\/avatars\/favicon":{"get":{"summary":"Get Favicon","operationId":"avatarsGetFavicon","consumes":["application\/json"],"produces":["image\/*"],"tags":["avatars"],"description":"Use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL.\n","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getFavicon","weight":68,"cookies":false,"type":"location","demo":"avatars\/get-favicon.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-favicon.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"url","description":"Website URL which you want to fetch the favicon from.","required":true,"type":"string","format":"url","x-example":"https:\/\/example.com","in":"query"}]}},"\/avatars\/flags\/{code}":{"get":{"summary":"Get Country Flag","operationId":"avatarsGetFlag","consumes":["application\/json"],"produces":["image\/png"],"tags":["avatars"],"description":"You can use this endpoint to show different country flags icons to your users. The code argument receives the 2 letter country code. Use width, height and quality arguments to change the output settings.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getFlag","weight":66,"cookies":false,"type":"location","demo":"avatars\/get-flag.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-flag.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"code","description":"Country Code. ISO Alpha-2 country code format.","required":true,"type":"string","x-example":"af","in":"path"},{"name":"width","description":"Image width. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"height","description":"Image height. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"quality","description":"Image quality. Pass an integer between 0 to 100. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"}]}},"\/avatars\/image":{"get":{"summary":"Get Image from URL","operationId":"avatarsGetImage","consumes":["application\/json"],"produces":["image\/*"],"tags":["avatars"],"description":"Use this endpoint to fetch a remote image URL and crop it to any image size you want. This endpoint is very useful if you need to crop and display remote images in your app or in case you want to make sure a 3rd party image is properly served using a TLS protocol.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getImage","weight":67,"cookies":false,"type":"location","demo":"avatars\/get-image.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-image.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"url","description":"Image URL which you want to crop.","required":true,"type":"string","format":"url","x-example":"https:\/\/example.com","in":"query"},{"name":"width","description":"Resize preview image width, Pass an integer between 0 to 2000.","required":false,"type":"integer","format":"int32","x-example":0,"default":400,"in":"query"},{"name":"height","description":"Resize preview image height, Pass an integer between 0 to 2000.","required":false,"type":"integer","format":"int32","x-example":0,"default":400,"in":"query"}]}},"\/avatars\/initials":{"get":{"summary":"Get User Initials","operationId":"avatarsGetInitials","consumes":["application\/json"],"produces":["image\/png"],"tags":["avatars"],"description":"Use this endpoint to show your user initials avatar icon on your website or app. By default, this route will try to print your logged-in user name or email initials. You can also overwrite the user name if you pass the 'name' parameter. If no name is given and no user is logged, an empty avatar will be returned.\n\nYou can use the color and background params to change the avatar colors. By default, a random theme will be selected. The random theme will persist for the user's initials when reloading the same theme will always return for the same initials.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getInitials","weight":70,"cookies":false,"type":"location","demo":"avatars\/get-initials.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-initials.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"name","description":"Full Name. When empty, current user name or email will be used. Max length: 128 chars.","required":false,"type":"string","x-example":"[NAME]","default":"","in":"query"},{"name":"width","description":"Image width. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":500,"in":"query"},{"name":"height","description":"Image height. Pass an integer between 0 to 2000. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":500,"in":"query"},{"name":"color","description":"Changes text color. By default a random color will be picked and stay will persistent to the given name.","required":false,"type":"string","default":"","in":"query"},{"name":"background","description":"Changes background color. By default a random color will be picked and stay will persistent to the given name.","required":false,"type":"string","default":"","in":"query"}]}},"\/avatars\/qr":{"get":{"summary":"Get QR Code","operationId":"avatarsGetQR","consumes":["application\/json"],"produces":["image\/png"],"tags":["avatars"],"description":"Converts a given plain text to a QR code image. You can use the query parameters to change the size and style of the resulting image.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getQR","weight":69,"cookies":false,"type":"location","demo":"avatars\/get-q-r.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/avatars\/get-qr.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"avatars.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"text","description":"Plain text to be converted to QR code image.","required":true,"type":"string","x-example":"[TEXT]","in":"query"},{"name":"size","description":"QR code size. Pass an integer between 0 to 1000. Defaults to 400.","required":false,"type":"integer","format":"int32","x-example":0,"default":400,"in":"query"},{"name":"margin","description":"Margin from edge. Pass an integer between 0 to 10. Defaults to 1.","required":false,"type":"integer","format":"int32","x-example":0,"default":1,"in":"query"},{"name":"download","description":"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.","required":false,"type":"boolean","x-example":false,"default":false,"in":"query"}]}},"\/database\/collections":{"get":{"summary":"List Collections","operationId":"databaseListCollections","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Get a list of all the user collections. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project's collections. [Learn more about different API modes](\/docs\/admin).","responses":{"200":{"description":"Collections List","schema":{"$ref":"#\/definitions\/collectionList"}}},"x-appwrite":{"method":"listCollections","weight":72,"cookies":false,"type":"","demo":"database\/list-collections.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/list-collections.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Maximum number of collection to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Offset value. The default value is 0. Use this param to manage pagination. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"cursor","description":"ID of the collection used as the starting point for the query, excluding the collection itself. Should be used for efficient pagination when working with large sets of data.","required":false,"type":"string","x-example":"[CURSOR]","default":"","in":"query"},{"name":"cursorDirection","description":"Direction of the cursor.","required":false,"type":"string","x-example":"after","default":"after","in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create Collection","operationId":"databaseCreateCollection","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Create a new Collection.","responses":{"201":{"description":"Collection","schema":{"$ref":"#\/definitions\/collection"}}},"x-appwrite":{"method":"createCollection","weight":71,"cookies":false,"type":"","demo":"database\/create-collection.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/create-collection.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"collectionId":{"type":"string","description":"Unique Id. Choose your own unique ID or pass the string \"unique()\" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.","default":null,"x-example":"[COLLECTION_ID]"},"name":{"type":"string","description":"Collection name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"permission":{"type":"string","description":"Permissions type model to use for reading documents in this collection. You can use collection-level permission set once on the collection using the `read` and `write` params, or you can set document-level permission where each document read and write params will decide who has access to read and write to each document individually. [learn more about permissions](https:\/\/appwrite.io\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":"document"},"read":{"type":"array","description":"An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](https:\/\/appwrite.io\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":"[\"role:all\"]","items":{"type":"string"}},"write":{"type":"array","description":"An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](https:\/\/appwrite.io\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":"[\"role:all\"]","items":{"type":"string"}}},"required":["collectionId","name","permission","read","write"]}}]}},"\/database\/collections\/{collectionId}":{"get":{"summary":"Get Collection","operationId":"databaseGetCollection","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata.","responses":{"200":{"description":"Collection","schema":{"$ref":"#\/definitions\/collection"}}},"x-appwrite":{"method":"getCollection","weight":73,"cookies":false,"type":"","demo":"database\/get-collection.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/get-collection.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID.","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"}]},"put":{"summary":"Update Collection","operationId":"databaseUpdateCollection","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Update a collection by its unique ID.","responses":{"200":{"description":"Collection","schema":{"$ref":"#\/definitions\/collection"}}},"x-appwrite":{"method":"updateCollection","weight":77,"cookies":false,"type":"","demo":"database\/update-collection.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/update-collection.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID.","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Collection name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"permission":{"type":"string","description":"Permissions type model to use for reading documents in this collection. You can use collection-level permission set once on the collection using the `read` and `write` params, or you can set document-level permission where each document read and write params will decide who has access to read and write to each document individually. [learn more about permissions](https:\/\/appwrite.io\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":"document"},"read":{"type":"array","description":"An array of strings with read permissions. By default inherits the existing read permissions. [learn more about permissions](https:\/\/appwrite.io\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":"[\"role:all\"]","items":{"type":"string"}},"write":{"type":"array","description":"An array of strings with write permissions. By default inherits the existing write permissions. [learn more about permissions](https:\/\/appwrite.io\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":"[\"role:all\"]","items":{"type":"string"}},"enabled":{"type":"boolean","description":"Is collection enabled?","default":true,"x-example":false}},"required":["name","permission"]}}]},"delete":{"summary":"Delete Collection","operationId":"databaseDeleteCollection","consumes":["application\/json"],"produces":[],"tags":["database"],"description":"Delete a collection by its unique ID. Only users with write permissions have access to delete this resource.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteCollection","weight":78,"cookies":false,"type":"","demo":"database\/delete-collection.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/delete-collection.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID.","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"}]}},"\/database\/collections\/{collectionId}\/attributes":{"get":{"summary":"List Attributes","operationId":"databaseListAttributes","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"","responses":{"200":{"description":"Attributes List","schema":{"$ref":"#\/definitions\/attributeList"}}},"x-appwrite":{"method":"listAttributes","weight":87,"cookies":false,"type":"","demo":"database\/list-attributes.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/list-attributes.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"}]}},"\/database\/collections\/{collectionId}\/attributes\/boolean":{"post":{"summary":"Create Boolean Attribute","operationId":"databaseCreateBooleanAttribute","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Create a boolean attribute.\n","responses":{"201":{"description":"AttributeBoolean","schema":{"$ref":"#\/definitions\/attributeBoolean"}}},"x-appwrite":{"method":"createBooleanAttribute","weight":86,"cookies":false,"type":"","demo":"database\/create-boolean-attribute.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/create-boolean-attribute.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"key":{"type":"string","description":"Attribute Key.","default":null,"x-example":null},"required":{"type":"boolean","description":"Is attribute required?","default":null,"x-example":false},"default":{"type":"boolean","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","default":null,"x-example":false},"array":{"type":"boolean","description":"Is attribute an array?","default":false,"x-example":false}},"required":["key","required"]}}]}},"\/database\/collections\/{collectionId}\/attributes\/email":{"post":{"summary":"Create Email Attribute","operationId":"databaseCreateEmailAttribute","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Create an email attribute.\n","responses":{"201":{"description":"AttributeEmail","schema":{"$ref":"#\/definitions\/attributeEmail"}}},"x-appwrite":{"method":"createEmailAttribute","weight":80,"cookies":false,"type":"","demo":"database\/create-email-attribute.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/create-email-attribute.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"key":{"type":"string","description":"Attribute Key.","default":null,"x-example":null},"required":{"type":"boolean","description":"Is attribute required?","default":null,"x-example":false},"default":{"type":"string","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","default":null,"x-example":"email@example.com"},"array":{"type":"boolean","description":"Is attribute an array?","default":false,"x-example":false}},"required":["key","required"]}}]}},"\/database\/collections\/{collectionId}\/attributes\/enum":{"post":{"summary":"Create Enum Attribute","operationId":"databaseCreateEnumAttribute","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"","responses":{"201":{"description":"AttributeEnum","schema":{"$ref":"#\/definitions\/attributeEnum"}}},"x-appwrite":{"method":"createEnumAttribute","weight":81,"cookies":false,"type":"","demo":"database\/create-enum-attribute.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/create-attribute-enum.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"key":{"type":"string","description":"Attribute Key.","default":null,"x-example":null},"elements":{"type":"array","description":"Array of elements in enumerated type. Uses length of longest element to determine size.","default":null,"x-example":null,"items":{"type":"string"}},"required":{"type":"boolean","description":"Is attribute required?","default":null,"x-example":false},"default":{"type":"string","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","default":null,"x-example":"[DEFAULT]"},"array":{"type":"boolean","description":"Is attribute an array?","default":false,"x-example":false}},"required":["key","elements","required"]}}]}},"\/database\/collections\/{collectionId}\/attributes\/float":{"post":{"summary":"Create Float Attribute","operationId":"databaseCreateFloatAttribute","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Create a float attribute. Optionally, minimum and maximum values can be provided.\n","responses":{"201":{"description":"AttributeFloat","schema":{"$ref":"#\/definitions\/attributeFloat"}}},"x-appwrite":{"method":"createFloatAttribute","weight":85,"cookies":false,"type":"","demo":"database\/create-float-attribute.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/create-float-attribute.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"key":{"type":"string","description":"Attribute Key.","default":null,"x-example":null},"required":{"type":"boolean","description":"Is attribute required?","default":null,"x-example":false},"min":{"type":"number","description":"Minimum value to enforce on new documents","default":null,"x-example":null},"max":{"type":"number","description":"Maximum value to enforce on new documents","default":null,"x-example":null},"default":{"type":"number","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","default":null,"x-example":null},"array":{"type":"boolean","description":"Is attribute an array?","default":false,"x-example":false}},"required":["key","required"]}}]}},"\/database\/collections\/{collectionId}\/attributes\/integer":{"post":{"summary":"Create Integer Attribute","operationId":"databaseCreateIntegerAttribute","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Create an integer attribute. Optionally, minimum and maximum values can be provided.\n","responses":{"201":{"description":"AttributeInteger","schema":{"$ref":"#\/definitions\/attributeInteger"}}},"x-appwrite":{"method":"createIntegerAttribute","weight":84,"cookies":false,"type":"","demo":"database\/create-integer-attribute.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/create-integer-attribute.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"key":{"type":"string","description":"Attribute Key.","default":null,"x-example":null},"required":{"type":"boolean","description":"Is attribute required?","default":null,"x-example":false},"min":{"type":"integer","description":"Minimum value to enforce on new documents","default":null,"x-example":null},"max":{"type":"integer","description":"Maximum value to enforce on new documents","default":null,"x-example":null},"default":{"type":"integer","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","default":null,"x-example":null},"array":{"type":"boolean","description":"Is attribute an array?","default":false,"x-example":false}},"required":["key","required"]}}]}},"\/database\/collections\/{collectionId}\/attributes\/ip":{"post":{"summary":"Create IP Address Attribute","operationId":"databaseCreateIpAttribute","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Create IP address attribute.\n","responses":{"201":{"description":"AttributeIP","schema":{"$ref":"#\/definitions\/attributeIp"}}},"x-appwrite":{"method":"createIpAttribute","weight":82,"cookies":false,"type":"","demo":"database\/create-ip-attribute.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/create-ip-attribute.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"key":{"type":"string","description":"Attribute Key.","default":null,"x-example":null},"required":{"type":"boolean","description":"Is attribute required?","default":null,"x-example":false},"default":{"type":"string","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","default":null,"x-example":null},"array":{"type":"boolean","description":"Is attribute an array?","default":false,"x-example":false}},"required":["key","required"]}}]}},"\/database\/collections\/{collectionId}\/attributes\/string":{"post":{"summary":"Create String Attribute","operationId":"databaseCreateStringAttribute","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Create a string attribute.\n","responses":{"201":{"description":"AttributeString","schema":{"$ref":"#\/definitions\/attributeString"}}},"x-appwrite":{"method":"createStringAttribute","weight":79,"cookies":false,"type":"","demo":"database\/create-string-attribute.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/create-string-attribute.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"key":{"type":"string","description":"Attribute Key.","default":null,"x-example":null},"size":{"type":"integer","description":"Attribute size for text attributes, in number of characters.","default":null,"x-example":1},"required":{"type":"boolean","description":"Is attribute required?","default":null,"x-example":false},"default":{"type":"string","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","default":null,"x-example":"[DEFAULT]"},"array":{"type":"boolean","description":"Is attribute an array?","default":false,"x-example":false}},"required":["key","size","required"]}}]}},"\/database\/collections\/{collectionId}\/attributes\/url":{"post":{"summary":"Create URL Attribute","operationId":"databaseCreateUrlAttribute","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Create a URL attribute.\n","responses":{"201":{"description":"AttributeURL","schema":{"$ref":"#\/definitions\/attributeUrl"}}},"x-appwrite":{"method":"createUrlAttribute","weight":83,"cookies":false,"type":"","demo":"database\/create-url-attribute.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/create-url-attribute.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"key":{"type":"string","description":"Attribute Key.","default":null,"x-example":null},"required":{"type":"boolean","description":"Is attribute required?","default":null,"x-example":false},"default":{"type":"string","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","default":null,"x-example":"https:\/\/example.com"},"array":{"type":"boolean","description":"Is attribute an array?","default":false,"x-example":false}},"required":["key","required"]}}]}},"\/database\/collections\/{collectionId}\/attributes\/{key}":{"get":{"summary":"Get Attribute","operationId":"databaseGetAttribute","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"","responses":{"200":{"description":"AttributeBoolean, or AttributeInteger, or AttributeFloat, or AttributeEmail, or AttributeEnum, or AttributeURL, or AttributeIP, or AttributeString","schema":{"x-oneOf":[{"$ref":"#\/definitions\/attributeBoolean"},{"$ref":"#\/definitions\/attributeInteger"},{"$ref":"#\/definitions\/attributeFloat"},{"$ref":"#\/definitions\/attributeEmail"},{"$ref":"#\/definitions\/attributeEnum"},{"$ref":"#\/definitions\/attributeUrl"},{"$ref":"#\/definitions\/attributeIp"},{"$ref":"#\/definitions\/attributeString"}]}}},"x-appwrite":{"method":"getAttribute","weight":88,"cookies":false,"type":"","demo":"database\/get-attribute.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/get-attribute.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"key","description":"Attribute Key.","required":true,"type":"string","in":"path"}]},"delete":{"summary":"Delete Attribute","operationId":"databaseDeleteAttribute","consumes":["application\/json"],"produces":[],"tags":["database"],"description":"","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteAttribute","weight":89,"cookies":false,"type":"","demo":"database\/delete-attribute.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/delete-attribute.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"key","description":"Attribute Key.","required":true,"type":"string","in":"path"}]}},"\/database\/collections\/{collectionId}\/documents":{"get":{"summary":"List Documents","operationId":"databaseListDocuments","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Get a list of all the user documents. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project's documents. [Learn more about different API modes](\/docs\/admin).","responses":{"200":{"description":"Documents List","schema":{"$ref":"#\/definitions\/documentList"}}},"x-appwrite":{"method":"listDocuments","weight":95,"cookies":false,"type":"","demo":"database\/list-documents.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/list-documents.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"documents.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"queries","description":"Array of query strings.","required":false,"type":"array","collectionFormat":"multi","items":{"type":"string"},"default":[],"in":"query"},{"name":"limit","description":"Maximum number of documents to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Offset value. The default value is 0. Use this value to manage pagination. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"cursor","description":"ID of the document used as the starting point for the query, excluding the document itself. Should be used for efficient pagination when working with large sets of data. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"string","x-example":"[CURSOR]","default":"","in":"query"},{"name":"cursorDirection","description":"Direction of the cursor.","required":false,"type":"string","x-example":"after","default":"after","in":"query"},{"name":"orderAttributes","description":"Array of attributes used to sort results.","required":false,"type":"array","collectionFormat":"multi","items":{"type":"string"},"default":[],"in":"query"},{"name":"orderTypes","description":"Array of order directions for sorting attribtues. Possible values are DESC for descending order, or ASC for ascending order.","required":false,"type":"array","collectionFormat":"multi","items":{"type":"string"},"default":[],"in":"query"}]},"post":{"summary":"Create Document","operationId":"databaseCreateDocument","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](\/docs\/server\/database#databaseCreateCollection) API or directly from your database console.","responses":{"201":{"description":"Document","schema":{"$ref":"#\/definitions\/document"}}},"x-appwrite":{"method":"createDocument","weight":94,"cookies":false,"type":"","demo":"database\/create-document.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/create-document.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"documents.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection). Make sure to define attributes before creating documents.","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"documentId":{"type":"string","description":"Document ID. Choose your own unique ID or pass the string \"unique()\" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.","default":null,"x-example":"[DOCUMENT_ID]"},"data":{"type":"object","description":"Document data as JSON object.","default":{},"x-example":"{}"},"read":{"type":"array","description":"An array of strings with read permissions. By default only the current user is granted with read permissions. [learn more about permissions](https:\/\/appwrite.io\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":"[\"role:all\"]","items":{"type":"string"}},"write":{"type":"array","description":"An array of strings with write permissions. By default only the current user is granted with write permissions. [learn more about permissions](https:\/\/appwrite.io\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":"[\"role:all\"]","items":{"type":"string"}}},"required":["documentId","data"]}}]}},"\/database\/collections\/{collectionId}\/documents\/{documentId}":{"get":{"summary":"Get Document","operationId":"databaseGetDocument","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Get a document by its unique ID. This endpoint response returns a JSON object with the document data.","responses":{"200":{"description":"Document","schema":{"$ref":"#\/definitions\/document"}}},"x-appwrite":{"method":"getDocument","weight":96,"cookies":false,"type":"","demo":"database\/get-document.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/get-document.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"documents.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"documentId","description":"Document ID.","required":true,"type":"string","x-example":"[DOCUMENT_ID]","in":"path"}]},"patch":{"summary":"Update Document","operationId":"databaseUpdateDocument","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated.","responses":{"200":{"description":"Document","schema":{"$ref":"#\/definitions\/document"}}},"x-appwrite":{"method":"updateDocument","weight":98,"cookies":false,"type":"","demo":"database\/update-document.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/update-document.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"documents.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"collectionId","description":"Collection ID.","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"documentId","description":"Document ID.","required":true,"type":"string","x-example":"[DOCUMENT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"data":{"type":"object","description":"Document data as JSON object.","default":{},"x-example":"{}"},"read":{"type":"array","description":"An array of strings with read permissions. By default inherits the existing read permissions. [learn more about permissions](https:\/\/appwrite.io\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":"[\"role:all\"]","items":{"type":"string"}},"write":{"type":"array","description":"An array of strings with write permissions. By default inherits the existing write permissions. [learn more about permissions](https:\/\/appwrite.io\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":"[\"role:all\"]","items":{"type":"string"}}},"required":["data"]}}]},"delete":{"summary":"Delete Document","operationId":"databaseDeleteDocument","consumes":["application\/json"],"produces":[],"tags":["database"],"description":"Delete a document by its unique ID. This endpoint deletes only the parent documents, its attributes and relations to other documents. Child documents **will not** be deleted.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteDocument","weight":99,"cookies":false,"type":"","demo":"database\/delete-document.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/delete-document.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"documents.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"documentId","description":"Document ID.","required":true,"type":"string","x-example":"[DOCUMENT_ID]","in":"path"}]}},"\/database\/collections\/{collectionId}\/documents\/{documentId}\/logs":{"get":{"summary":"List Document Logs","operationId":"databaseListDocumentLogs","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Get the document activity logs list by its unique ID.","responses":{"200":{"description":"Logs List","schema":{"$ref":"#\/definitions\/logList"}}},"x-appwrite":{"method":"listDocumentLogs","weight":97,"cookies":false,"type":"","demo":"database\/list-document-logs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/get-document-logs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"documents.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"collectionId","description":"Collection ID.","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"documentId","description":"Document ID.","required":true,"type":"string","x-example":"[DOCUMENT_ID]","in":"path"},{"name":"limit","description":"Maximum number of logs to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Offset value. The default value is 0. Use this value to manage pagination. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"}]}},"\/database\/collections\/{collectionId}\/indexes":{"get":{"summary":"List Indexes","operationId":"databaseListIndexes","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"","responses":{"200":{"description":"Indexes List","schema":{"$ref":"#\/definitions\/indexList"}}},"x-appwrite":{"method":"listIndexes","weight":91,"cookies":false,"type":"","demo":"database\/list-indexes.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/list-indexes.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"}]},"post":{"summary":"Create Index","operationId":"databaseCreateIndex","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"","responses":{"201":{"description":"Index","schema":{"$ref":"#\/definitions\/index"}}},"x-appwrite":{"method":"createIndex","weight":90,"cookies":false,"type":"","demo":"database\/create-index.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/create-index.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"key":{"type":"string","description":"Index Key.","default":null,"x-example":null},"type":{"type":"string","description":"Index type.","default":null,"x-example":"key"},"attributes":{"type":"array","description":"Array of attributes to index.","default":null,"x-example":null,"items":{"type":"string"}},"orders":{"type":"array","description":"Array of index orders.","default":[],"x-example":null,"items":{"type":"string"}}},"required":["key","type","attributes"]}}]}},"\/database\/collections\/{collectionId}\/indexes\/{key}":{"get":{"summary":"Get Index","operationId":"databaseGetIndex","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"","responses":{"200":{"description":"Index","schema":{"$ref":"#\/definitions\/index"}}},"x-appwrite":{"method":"getIndex","weight":92,"cookies":false,"type":"","demo":"database\/get-index.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/get-index.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"key","description":"Index Key.","required":true,"type":"string","in":"path"}]},"delete":{"summary":"Delete Index","operationId":"databaseDeleteIndex","consumes":["application\/json"],"produces":[],"tags":["database"],"description":"","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteIndex","weight":93,"cookies":false,"type":"","demo":"database\/delete-index.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/delete-index.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"collectionId","description":"Collection ID. You can create a new collection using the Database service [server integration](https:\/\/appwrite.io\/docs\/server\/database#createCollection).","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"key","description":"Index Key.","required":true,"type":"string","in":"path"}]}},"\/database\/collections\/{collectionId}\/logs":{"get":{"summary":"List Collection Logs","operationId":"databaseListCollectionLogs","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"Get the collection activity logs list by its unique ID.","responses":{"200":{"description":"Logs List","schema":{"$ref":"#\/definitions\/logList"}}},"x-appwrite":{"method":"listCollectionLogs","weight":76,"cookies":false,"type":"","demo":"database\/list-collection-logs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/database\/get-collection-logs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"collectionId","description":"Collection ID.","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"},{"name":"limit","description":"Maximum number of logs to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Offset value. The default value is 0. Use this value to manage pagination. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"}]}},"\/database\/usage":{"get":{"summary":"Get usage stats for the database","operationId":"databaseGetUsage","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"","responses":{"200":{"description":"UsageDatabase","schema":{"$ref":"#\/definitions\/usageDatabase"}}},"x-appwrite":{"method":"getUsage","weight":74,"cookies":false,"type":"","demo":"database\/get-usage.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"range","description":"Date range.","required":false,"type":"string","x-example":"24h","default":"30d","in":"query"}]}},"\/database\/{collectionId}\/usage":{"get":{"summary":"Get usage stats for a collection","operationId":"databaseGetCollectionUsage","consumes":["application\/json"],"produces":["application\/json"],"tags":["database"],"description":"","responses":{"200":{"description":"UsageCollection","schema":{"$ref":"#\/definitions\/usageCollection"}}},"x-appwrite":{"method":"getCollectionUsage","weight":75,"cookies":false,"type":"","demo":"database\/get-collection-usage.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"collections.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"range","description":"Date range.","required":false,"type":"string","x-example":"24h","default":"30d","in":"query"},{"name":"collectionId","description":"Collection ID.","required":true,"type":"string","x-example":"[COLLECTION_ID]","in":"path"}]}},"\/functions":{"get":{"summary":"List Functions","operationId":"functionsList","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Get a list of all the project's functions. You can use the query params to filter your results.","responses":{"200":{"description":"Functions List","schema":{"$ref":"#\/definitions\/functionList"}}},"x-appwrite":{"method":"list","weight":193,"cookies":false,"type":"","demo":"functions\/list.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/list-functions.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Maximum number of functions to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Offset value. The default value is 0. Use this value to manage pagination. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"cursor","description":"ID of the function used as the starting point for the query, excluding the function itself. Should be used for efficient pagination when working with large sets of data. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"string","x-example":"[CURSOR]","default":"","in":"query"},{"name":"cursorDirection","description":"Direction of the cursor.","required":false,"type":"string","x-example":"after","default":"after","in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create Function","operationId":"functionsCreate","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Create a new function. You can pass a list of [permissions](\/docs\/permissions) to allow different project users or team with access to execute the function using the client API.","responses":{"201":{"description":"Function","schema":{"$ref":"#\/definitions\/function"}}},"x-appwrite":{"method":"create","weight":192,"cookies":false,"type":"","demo":"functions\/create.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/create-function.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"functionId":{"type":"string","description":"Function ID. Choose your own unique ID or pass the string \"unique()\" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.","default":null,"x-example":"[FUNCTION_ID]"},"name":{"type":"string","description":"Function name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"execute":{"type":"array","description":"An array of strings with execution permissions. By default no user is granted with any execute permissions. [learn more about permissions](https:\/\/appwrite.io\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}},"runtime":{"type":"string","description":"Execution runtime.","default":null,"x-example":"node-14.5"},"vars":{"type":"object","description":"Key-value JSON object that will be passed to the function as environment variables.","default":[],"x-example":"{}"},"events":{"type":"array","description":"Events list.","default":[],"x-example":null,"items":{"type":"string"}},"schedule":{"type":"string","description":"Schedule CRON syntax.","default":"","x-example":null},"timeout":{"type":"integer","description":"Function maximum execution time in seconds.","default":15,"x-example":1}},"required":["functionId","name","execute","runtime"]}}]}},"\/functions\/runtimes":{"get":{"summary":"List the currently active function runtimes.","operationId":"functionsListRuntimes","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Get a list of all runtimes that are currently active in your project.","responses":{"200":{"description":"Runtimes List","schema":{"$ref":"#\/definitions\/runtimeList"}}},"x-appwrite":{"method":"listRuntimes","weight":194,"cookies":false,"type":"","demo":"functions\/list-runtimes.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/list-runtimes.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/functions\/{functionId}":{"get":{"summary":"Get Function","operationId":"functionsGet","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Get a function by its unique ID.","responses":{"200":{"description":"Function","schema":{"$ref":"#\/definitions\/function"}}},"x-appwrite":{"method":"get","weight":195,"cookies":false,"type":"","demo":"functions\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/get-function.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"}]},"put":{"summary":"Update Function","operationId":"functionsUpdate","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Update function by its unique ID.","responses":{"200":{"description":"Function","schema":{"$ref":"#\/definitions\/function"}}},"x-appwrite":{"method":"update","weight":197,"cookies":false,"type":"","demo":"functions\/update.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/update-function.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Function name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"execute":{"type":"array","description":"An array of strings with execution permissions. By default no user is granted with any execute permissions. [learn more about permissions](https:\/\/appwrite.io\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":null,"items":{"type":"string"}},"vars":{"type":"object","description":"Key-value JSON object that will be passed to the function as environment variables.","default":[],"x-example":"{}"},"events":{"type":"array","description":"Events list.","default":[],"x-example":null,"items":{"type":"string"}},"schedule":{"type":"string","description":"Schedule CRON syntax.","default":"","x-example":null},"timeout":{"type":"integer","description":"Maximum execution time in seconds.","default":15,"x-example":1}},"required":["name","execute"]}}]},"delete":{"summary":"Delete Function","operationId":"functionsDelete","consumes":["application\/json"],"produces":[],"tags":["functions"],"description":"Delete a function by its unique ID.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"delete","weight":199,"cookies":false,"type":"","demo":"functions\/delete.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/delete-function.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"}]}},"\/functions\/{functionId}\/deployments":{"get":{"summary":"List Deployments","operationId":"functionsListDeployments","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Get a list of all the project's code deployments. You can use the query params to filter your results.","responses":{"200":{"description":"Deployments List","schema":{"$ref":"#\/definitions\/deploymentList"}}},"x-appwrite":{"method":"listDeployments","weight":201,"cookies":false,"type":"","demo":"functions\/list-deployments.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/list-deployments.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Maximum number of deployments to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Offset value. The default value is 0. Use this value to manage pagination. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"cursor","description":"ID of the deployment used as the starting point for the query, excluding the deployment itself. Should be used for efficient pagination when working with large sets of data. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"string","x-example":"[CURSOR]","default":"","in":"query"},{"name":"cursorDirection","description":"Direction of the cursor.","required":false,"type":"string","x-example":"after","default":"after","in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create Deployment","operationId":"functionsCreateDeployment","consumes":["multipart\/form-data"],"produces":["application\/json"],"tags":["functions"],"description":"Create a new function code deployment. Use this endpoint to upload a new version of your code function. To execute your newly uploaded code, you'll need to update the function's deployment to use your new deployment UID.\n\nThis endpoint accepts a tar.gz file compressed with your code. Make sure to include any dependencies your code has within the compressed file. You can learn more about code packaging in the [Appwrite Cloud Functions tutorial](\/docs\/functions).\n\nUse the \"command\" param to set the entry point used to execute your code.","responses":{"201":{"description":"Deployment","schema":{"$ref":"#\/definitions\/deployment"}}},"x-appwrite":{"method":"createDeployment","weight":200,"cookies":false,"type":"","demo":"functions\/create-deployment.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/create-deployment.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.write","platforms":["server"],"packaging":true,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"entrypoint","description":"Entrypoint File.","required":true,"type":"string","x-example":"[ENTRYPOINT]","in":"formData"},{"name":"code","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.","required":true,"type":"file","in":"formData"},{"name":"activate","description":"Automatically activate the deployment when it is finished building.","required":true,"type":"boolean","x-example":false,"in":"formData"}]}},"\/functions\/{functionId}\/deployments\/{deploymentId}":{"get":{"summary":"Get Deployment","operationId":"functionsGetDeployment","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Get a code deployment by its unique ID.","responses":{"200":{"description":"Deployments List","schema":{"$ref":"#\/definitions\/deploymentList"}}},"x-appwrite":{"method":"getDeployment","weight":202,"cookies":false,"type":"","demo":"functions\/get-deployment.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/get-deployment.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"deploymentId","description":"Deployment ID.","required":true,"type":"string","x-example":"[DEPLOYMENT_ID]","in":"path"}]},"patch":{"summary":"Update Function Deployment","operationId":"functionsUpdateDeployment","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Update the function code deployment ID using the unique function ID. Use this endpoint to switch the code deployment that should be executed by the execution endpoint.","responses":{"200":{"description":"Function","schema":{"$ref":"#\/definitions\/function"}}},"x-appwrite":{"method":"updateDeployment","weight":198,"cookies":false,"type":"","demo":"functions\/update-deployment.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/update-function-deployment.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"deploymentId","description":"Deployment ID.","required":true,"type":"string","x-example":"[DEPLOYMENT_ID]","in":"path"}]},"delete":{"summary":"Delete Deployment","operationId":"functionsDeleteDeployment","consumes":["application\/json"],"produces":[],"tags":["functions"],"description":"Delete a code deployment by its unique ID.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteDeployment","weight":203,"cookies":false,"type":"","demo":"functions\/delete-deployment.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/delete-deployment.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"functionId","description":"Function ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"deploymentId","description":"Deployment ID.","required":true,"type":"string","x-example":"[DEPLOYMENT_ID]","in":"path"}]}},"\/functions\/{functionId}\/deployments\/{deploymentId}\/builds\/{buildId}":{"post":{"summary":"Retry Build","operationId":"functionsRetryBuild","consumes":["application\/json"],"produces":[],"tags":["functions"],"description":"","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"retryBuild","weight":207,"cookies":false,"type":"","demo":"functions\/retry-build.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/retry-build.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"functionId","description":"Function ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"deploymentId","description":"Deployment ID.","required":true,"type":"string","x-example":"[DEPLOYMENT_ID]","in":"path"},{"name":"buildId","description":"Build unique ID.","required":true,"type":"string","x-example":"[BUILD_ID]","in":"path"}]}},"\/functions\/{functionId}\/executions":{"get":{"summary":"List Executions","operationId":"functionsListExecutions","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Get a list of all the current user function execution logs. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project's executions. [Learn more about different API modes](\/docs\/admin).","responses":{"200":{"description":"Executions List","schema":{"$ref":"#\/definitions\/executionList"}}},"x-appwrite":{"method":"listExecutions","weight":205,"cookies":false,"type":"","demo":"functions\/list-executions.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/list-executions.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"execution.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"functionId","description":"Function ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"limit","description":"Maximum number of executions to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Offset value. The default value is 0. Use this value to manage pagination. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"cursor","description":"ID of the execution used as the starting point for the query, excluding the execution itself. Should be used for efficient pagination when working with large sets of data. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"string","x-example":"[CURSOR]","default":"","in":"query"},{"name":"cursorDirection","description":"Direction of the cursor.","required":false,"type":"string","x-example":"after","default":"after","in":"query"}]},"post":{"summary":"Create Execution","operationId":"functionsCreateExecution","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Trigger a function execution. The returned object will return you the current execution status. You can ping the `Get Execution` endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously.","responses":{"201":{"description":"Execution","schema":{"$ref":"#\/definitions\/execution"}}},"x-appwrite":{"method":"createExecution","weight":204,"cookies":false,"type":"","demo":"functions\/create-execution.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/create-execution.md","rate-limit":60,"rate-time":60,"rate-key":"url:{url},ip:{ip}","scope":"execution.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"functionId","description":"Function ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"data":{"type":"string","description":"String of custom data to send to function.","default":"","x-example":"[DATA]"},"async":{"type":"boolean","description":"Execute code asynchronously. Default value is true.","default":true,"x-example":false}}}}]}},"\/functions\/{functionId}\/executions\/{executionId}":{"get":{"summary":"Get Execution","operationId":"functionsGetExecution","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"Get a function execution log by its unique ID.","responses":{"200":{"description":"Execution","schema":{"$ref":"#\/definitions\/execution"}}},"x-appwrite":{"method":"getExecution","weight":206,"cookies":false,"type":"","demo":"functions\/get-execution.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/functions\/get-execution.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"execution.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"functionId","description":"Function ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"executionId","description":"Execution ID.","required":true,"type":"string","x-example":"[EXECUTION_ID]","in":"path"}]}},"\/functions\/{functionId}\/usage":{"get":{"summary":"Get Function Usage","operationId":"functionsGetUsage","consumes":["application\/json"],"produces":["application\/json"],"tags":["functions"],"description":"","responses":{"200":{"description":"UsageFunctions","schema":{"$ref":"#\/definitions\/usageFunctions"}}},"x-appwrite":{"method":"getUsage","weight":196,"cookies":false,"type":"","demo":"functions\/get-usage.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"functions.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"functionId","description":"Function ID.","required":true,"type":"string","x-example":"[FUNCTION_ID]","in":"path"},{"name":"range","description":"Date range.","required":false,"type":"string","x-example":"24h","default":"30d","in":"query"}]}},"\/health":{"get":{"summary":"Get HTTP","operationId":"healthGet","consumes":["application\/json"],"produces":["application\/json"],"tags":["health"],"description":"Check the Appwrite HTTP server is up and responsive.","responses":{"200":{"description":"Health Status","schema":{"$ref":"#\/definitions\/healthStatus"}}},"x-appwrite":{"method":"get","weight":107,"cookies":false,"type":"","demo":"health\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/anti-virus":{"get":{"summary":"Get Antivirus","operationId":"healthGetAntivirus","consumes":["application\/json"],"produces":["application\/json"],"tags":["health"],"description":"Check the Appwrite Antivirus server is up and connection is successful.","responses":{"200":{"description":"Health Antivirus","schema":{"$ref":"#\/definitions\/healthAntivirus"}}},"x-appwrite":{"method":"getAntivirus","weight":118,"cookies":false,"type":"","demo":"health\/get-antivirus.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-storage-anti-virus.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/cache":{"get":{"summary":"Get Cache","operationId":"healthGetCache","consumes":["application\/json"],"produces":["application\/json"],"tags":["health"],"description":"Check the Appwrite in-memory cache server is up and connection is successful.","responses":{"200":{"description":"Health Status","schema":{"$ref":"#\/definitions\/healthStatus"}}},"x-appwrite":{"method":"getCache","weight":110,"cookies":false,"type":"","demo":"health\/get-cache.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-cache.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/db":{"get":{"summary":"Get DB","operationId":"healthGetDB","consumes":["application\/json"],"produces":["application\/json"],"tags":["health"],"description":"Check the Appwrite database server is up and connection is successful.","responses":{"200":{"description":"Health Status","schema":{"$ref":"#\/definitions\/healthStatus"}}},"x-appwrite":{"method":"getDB","weight":109,"cookies":false,"type":"","demo":"health\/get-d-b.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-db.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/queue\/certificates":{"get":{"summary":"Get Certificates Queue","operationId":"healthGetQueueCertificates","consumes":["application\/json"],"produces":["application\/json"],"tags":["health"],"description":"Get the number of certificates that are waiting to be issued against [Letsencrypt](https:\/\/letsencrypt.org\/) in the Appwrite internal queue server.","responses":{"200":{"description":"Health Queue","schema":{"$ref":"#\/definitions\/healthQueue"}}},"x-appwrite":{"method":"getQueueCertificates","weight":115,"cookies":false,"type":"","demo":"health\/get-queue-certificates.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-certificates.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/queue\/functions":{"get":{"summary":"Get Functions Queue","operationId":"healthGetQueueFunctions","consumes":["application\/json"],"produces":["application\/json"],"tags":["health"],"description":"","responses":{"200":{"description":"Health Queue","schema":{"$ref":"#\/definitions\/healthQueue"}}},"x-appwrite":{"method":"getQueueFunctions","weight":116,"cookies":false,"type":"","demo":"health\/get-queue-functions.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-functions.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/queue\/logs":{"get":{"summary":"Get Logs Queue","operationId":"healthGetQueueLogs","consumes":["application\/json"],"produces":["application\/json"],"tags":["health"],"description":"Get the number of logs that are waiting to be processed in the Appwrite internal queue server.","responses":{"200":{"description":"Health Queue","schema":{"$ref":"#\/definitions\/healthQueue"}}},"x-appwrite":{"method":"getQueueLogs","weight":113,"cookies":false,"type":"","demo":"health\/get-queue-logs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-logs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/queue\/usage":{"get":{"summary":"Get Usage Queue","operationId":"healthGetQueueUsage","consumes":["application\/json"],"produces":["application\/json"],"tags":["health"],"description":"Get the number of usage stats that are waiting to be processed in the Appwrite internal queue server.","responses":{"200":{"description":"Health Queue","schema":{"$ref":"#\/definitions\/healthQueue"}}},"x-appwrite":{"method":"getQueueUsage","weight":114,"cookies":false,"type":"","demo":"health\/get-queue-usage.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-usage.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/queue\/webhooks":{"get":{"summary":"Get Webhooks Queue","operationId":"healthGetQueueWebhooks","consumes":["application\/json"],"produces":["application\/json"],"tags":["health"],"description":"Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server.","responses":{"200":{"description":"Health Queue","schema":{"$ref":"#\/definitions\/healthQueue"}}},"x-appwrite":{"method":"getQueueWebhooks","weight":112,"cookies":false,"type":"","demo":"health\/get-queue-webhooks.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-webhooks.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/storage\/local":{"get":{"summary":"Get Local Storage","operationId":"healthGetStorageLocal","consumes":["application\/json"],"produces":["application\/json"],"tags":["health"],"description":"Check the Appwrite local storage device is up and connection is successful.","responses":{"200":{"description":"Health Status","schema":{"$ref":"#\/definitions\/healthStatus"}}},"x-appwrite":{"method":"getStorageLocal","weight":117,"cookies":false,"type":"","demo":"health\/get-storage-local.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-storage-local.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/health\/time":{"get":{"summary":"Get Time","operationId":"healthGetTime","consumes":["application\/json"],"produces":["application\/json"],"tags":["health"],"description":"Check the Appwrite server time is synced with Google remote NTP server. We use this technology to smoothly handle leap seconds with no disruptive events. The [Network Time Protocol](https:\/\/en.wikipedia.org\/wiki\/Network_Time_Protocol) (NTP) is used by hundreds of millions of computers and devices to synchronize their clocks over the Internet. If your computer sets its own clock, it likely uses NTP.","responses":{"200":{"description":"Health Time","schema":{"$ref":"#\/definitions\/healthTime"}}},"x-appwrite":{"method":"getTime","weight":111,"cookies":false,"type":"","demo":"health\/get-time.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-time.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"health.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}]}},"\/locale":{"get":{"summary":"Get User Locale","operationId":"localeGet","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"Get the current user location based on IP. Returns an object with user country code, country name, continent name, continent code, ip address and suggested currency. You can use the locale header to get the data in a supported language.\n\n([IP Geolocation by DB-IP](https:\/\/db-ip.com))","responses":{"200":{"description":"Locale","schema":{"$ref":"#\/definitions\/locale"}}},"x-appwrite":{"method":"get","weight":100,"cookies":false,"type":"","demo":"locale\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-locale.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}]}},"\/locale\/continents":{"get":{"summary":"List Continents","operationId":"localeGetContinents","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"List of all continents. You can use the locale header to get the data in a supported language.","responses":{"200":{"description":"Continents List","schema":{"$ref":"#\/definitions\/continentList"}}},"x-appwrite":{"method":"getContinents","weight":104,"cookies":false,"type":"","demo":"locale\/get-continents.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-continents.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}]}},"\/locale\/countries":{"get":{"summary":"List Countries","operationId":"localeGetCountries","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"List of all countries. You can use the locale header to get the data in a supported language.","responses":{"200":{"description":"Countries List","schema":{"$ref":"#\/definitions\/countryList"}}},"x-appwrite":{"method":"getCountries","weight":101,"cookies":false,"type":"","demo":"locale\/get-countries.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-countries.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}]}},"\/locale\/countries\/eu":{"get":{"summary":"List EU Countries","operationId":"localeGetCountriesEU","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"List of all countries that are currently members of the EU. You can use the locale header to get the data in a supported language.","responses":{"200":{"description":"Countries List","schema":{"$ref":"#\/definitions\/countryList"}}},"x-appwrite":{"method":"getCountriesEU","weight":102,"cookies":false,"type":"","demo":"locale\/get-countries-e-u.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-countries-eu.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}]}},"\/locale\/countries\/phones":{"get":{"summary":"List Countries Phone Codes","operationId":"localeGetCountriesPhones","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"List of all countries phone codes. You can use the locale header to get the data in a supported language.","responses":{"200":{"description":"Phones List","schema":{"$ref":"#\/definitions\/phoneList"}}},"x-appwrite":{"method":"getCountriesPhones","weight":103,"cookies":false,"type":"","demo":"locale\/get-countries-phones.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-countries-phones.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}]}},"\/locale\/currencies":{"get":{"summary":"List Currencies","operationId":"localeGetCurrencies","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"List of all currencies, including currency symbol, name, plural, and decimal digits for all major and minor currencies. You can use the locale header to get the data in a supported language.","responses":{"200":{"description":"Currencies List","schema":{"$ref":"#\/definitions\/currencyList"}}},"x-appwrite":{"method":"getCurrencies","weight":105,"cookies":false,"type":"","demo":"locale\/get-currencies.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-currencies.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}]}},"\/locale\/languages":{"get":{"summary":"List Languages","operationId":"localeGetLanguages","consumes":["application\/json"],"produces":["application\/json"],"tags":["locale"],"description":"List of all languages classified by ISO 639-1 including 2-letter code, name in English, and name in the respective language.","responses":{"200":{"description":"Languages List","schema":{"$ref":"#\/definitions\/languageList"}}},"x-appwrite":{"method":"getLanguages","weight":106,"cookies":false,"type":"","demo":"locale\/get-languages.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/locale\/get-languages.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"locale.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}]}},"\/projects":{"get":{"summary":"List Projects","operationId":"projectsList","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Projects List","schema":{"$ref":"#\/definitions\/projectList"}}},"x-appwrite":{"method":"list","weight":121,"cookies":false,"type":"","demo":"projects\/list.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Results offset. The default value is 0. Use this param to manage pagination. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"cursor","description":"ID of the project used as the starting point for the query, excluding the project itself. Should be used for efficient pagination when working with large sets of data. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"string","x-example":"[CURSOR]","default":"","in":"query"},{"name":"cursorDirection","description":"Direction of the cursor.","required":false,"type":"string","x-example":"after","default":"after","in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create Project","operationId":"projectsCreate","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"201":{"description":"Project","schema":{"$ref":"#\/definitions\/project"}}},"x-appwrite":{"method":"create","weight":120,"cookies":false,"type":"","demo":"projects\/create.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"projectId":{"type":"string","description":"Unique Id. Choose your own unique ID or pass the string \"unique()\" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.","default":null,"x-example":"[PROJECT_ID]"},"name":{"type":"string","description":"Project name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"teamId":{"type":"string","description":"Team unique ID.","default":null,"x-example":"[TEAM_ID]"},"description":{"type":"string","description":"Project description. Max length: 256 chars.","default":"","x-example":"[DESCRIPTION]"},"logo":{"type":"string","description":"Project logo.","default":"","x-example":"[LOGO]"},"url":{"type":"string","description":"Project URL.","default":"","x-example":"https:\/\/example.com"},"legalName":{"type":"string","description":"Project legal Name. Max length: 256 chars.","default":"","x-example":"[LEGAL_NAME]"},"legalCountry":{"type":"string","description":"Project legal Country. Max length: 256 chars.","default":"","x-example":"[LEGAL_COUNTRY]"},"legalState":{"type":"string","description":"Project legal State. Max length: 256 chars.","default":"","x-example":"[LEGAL_STATE]"},"legalCity":{"type":"string","description":"Project legal City. Max length: 256 chars.","default":"","x-example":"[LEGAL_CITY]"},"legalAddress":{"type":"string","description":"Project legal Address. Max length: 256 chars.","default":"","x-example":"[LEGAL_ADDRESS]"},"legalTaxId":{"type":"string","description":"Project legal Tax ID. Max length: 256 chars.","default":"","x-example":"[LEGAL_TAX_ID]"}},"required":["projectId","name","teamId"]}}]}},"\/projects\/{projectId}":{"get":{"summary":"Get Project","operationId":"projectsGet","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Project","schema":{"$ref":"#\/definitions\/project"}}},"x-appwrite":{"method":"get","weight":122,"cookies":false,"type":"","demo":"projects\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"}]},"patch":{"summary":"Update Project","operationId":"projectsUpdate","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Project","schema":{"$ref":"#\/definitions\/project"}}},"x-appwrite":{"method":"update","weight":124,"cookies":false,"type":"","demo":"projects\/update.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Project name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"description":{"type":"string","description":"Project description. Max length: 256 chars.","default":"","x-example":"[DESCRIPTION]"},"logo":{"type":"string","description":"Project logo.","default":"","x-example":"[LOGO]"},"url":{"type":"string","description":"Project URL.","default":"","x-example":"https:\/\/example.com"},"legalName":{"type":"string","description":"Project legal name. Max length: 256 chars.","default":"","x-example":"[LEGAL_NAME]"},"legalCountry":{"type":"string","description":"Project legal country. Max length: 256 chars.","default":"","x-example":"[LEGAL_COUNTRY]"},"legalState":{"type":"string","description":"Project legal state. Max length: 256 chars.","default":"","x-example":"[LEGAL_STATE]"},"legalCity":{"type":"string","description":"Project legal city. Max length: 256 chars.","default":"","x-example":"[LEGAL_CITY]"},"legalAddress":{"type":"string","description":"Project legal address. Max length: 256 chars.","default":"","x-example":"[LEGAL_ADDRESS]"},"legalTaxId":{"type":"string","description":"Project legal tax ID. Max length: 256 chars.","default":"","x-example":"[LEGAL_TAX_ID]"}},"required":["name"]}}]},"delete":{"summary":"Delete Project","operationId":"projectsDelete","consumes":["application\/json"],"produces":[],"tags":["projects"],"description":"","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"delete","weight":129,"cookies":false,"type":"","demo":"projects\/delete.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"password":{"type":"string","description":"Your user password for confirmation. Must be at least 8 chars.","default":null,"x-example":"password"}},"required":["password"]}}]}},"\/projects\/{projectId}\/auth\/limit":{"patch":{"summary":"Update Project users limit","operationId":"projectsUpdateAuthLimit","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Project","schema":{"$ref":"#\/definitions\/project"}}},"x-appwrite":{"method":"updateAuthLimit","weight":127,"cookies":false,"type":"","demo":"projects\/update-auth-limit.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"limit":{"type":"integer","description":"Set the max number of users allowed in this project. Use 0 for unlimited.","default":null,"x-example":0}},"required":["limit"]}}]}},"\/projects\/{projectId}\/auth\/{method}":{"patch":{"summary":"Update Project auth method status. Use this endpoint to enable or disable a given auth method for this project.","operationId":"projectsUpdateAuthStatus","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Project","schema":{"$ref":"#\/definitions\/project"}}},"x-appwrite":{"method":"updateAuthStatus","weight":128,"cookies":false,"type":"","demo":"projects\/update-auth-status.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"method","description":"Auth Method. Possible values: email-password,magic-url,anonymous,invites,jwt,phone","required":true,"type":"string","x-example":"email-password","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"status":{"type":"boolean","description":"Set the status of this auth method.","default":null,"x-example":false}},"required":["status"]}}]}},"\/projects\/{projectId}\/domains":{"get":{"summary":"List Domains","operationId":"projectsListDomains","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Domains List","schema":{"$ref":"#\/definitions\/domainList"}}},"x-appwrite":{"method":"listDomains","weight":146,"cookies":false,"type":"","demo":"projects\/list-domains.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"}]},"post":{"summary":"Create Domain","operationId":"projectsCreateDomain","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"201":{"description":"Domain","schema":{"$ref":"#\/definitions\/domain"}}},"x-appwrite":{"method":"createDomain","weight":145,"cookies":false,"type":"","demo":"projects\/create-domain.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"domain":{"type":"string","description":"Domain name.","default":null,"x-example":null}},"required":["domain"]}}]}},"\/projects\/{projectId}\/domains\/{domainId}":{"get":{"summary":"Get Domain","operationId":"projectsGetDomain","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Domain","schema":{"$ref":"#\/definitions\/domain"}}},"x-appwrite":{"method":"getDomain","weight":147,"cookies":false,"type":"","demo":"projects\/get-domain.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"domainId","description":"Domain unique ID.","required":true,"type":"string","x-example":"[DOMAIN_ID]","in":"path"}]},"delete":{"summary":"Delete Domain","operationId":"projectsDeleteDomain","consumes":["application\/json"],"produces":[],"tags":["projects"],"description":"","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteDomain","weight":149,"cookies":false,"type":"","demo":"projects\/delete-domain.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"domainId","description":"Domain unique ID.","required":true,"type":"string","x-example":"[DOMAIN_ID]","in":"path"}]}},"\/projects\/{projectId}\/domains\/{domainId}\/verification":{"patch":{"summary":"Update Domain Verification Status","operationId":"projectsUpdateDomainVerification","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Domain","schema":{"$ref":"#\/definitions\/domain"}}},"x-appwrite":{"method":"updateDomainVerification","weight":148,"cookies":false,"type":"","demo":"projects\/update-domain-verification.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"domainId","description":"Domain unique ID.","required":true,"type":"string","x-example":"[DOMAIN_ID]","in":"path"}]}},"\/projects\/{projectId}\/keys":{"get":{"summary":"List Keys","operationId":"projectsListKeys","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"API Keys List","schema":{"$ref":"#\/definitions\/keyList"}}},"x-appwrite":{"method":"listKeys","weight":136,"cookies":false,"type":"","demo":"projects\/list-keys.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"}]},"post":{"summary":"Create Key","operationId":"projectsCreateKey","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"201":{"description":"Key","schema":{"$ref":"#\/definitions\/key"}}},"x-appwrite":{"method":"createKey","weight":135,"cookies":false,"type":"","demo":"projects\/create-key.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Key name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"scopes":{"type":"array","description":"Key scopes list.","default":null,"x-example":null,"items":{"type":"string"}}},"required":["name","scopes"]}}]}},"\/projects\/{projectId}\/keys\/{keyId}":{"get":{"summary":"Get Key","operationId":"projectsGetKey","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Key","schema":{"$ref":"#\/definitions\/key"}}},"x-appwrite":{"method":"getKey","weight":137,"cookies":false,"type":"","demo":"projects\/get-key.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"keyId","description":"Key unique ID.","required":true,"type":"string","x-example":"[KEY_ID]","in":"path"}]},"put":{"summary":"Update Key","operationId":"projectsUpdateKey","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Key","schema":{"$ref":"#\/definitions\/key"}}},"x-appwrite":{"method":"updateKey","weight":138,"cookies":false,"type":"","demo":"projects\/update-key.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"keyId","description":"Key unique ID.","required":true,"type":"string","x-example":"[KEY_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Key name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"scopes":{"type":"array","description":"Key scopes list","default":null,"x-example":null,"items":{"type":"string"}}},"required":["name","scopes"]}}]},"delete":{"summary":"Delete Key","operationId":"projectsDeleteKey","consumes":["application\/json"],"produces":[],"tags":["projects"],"description":"","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteKey","weight":139,"cookies":false,"type":"","demo":"projects\/delete-key.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"keyId","description":"Key unique ID.","required":true,"type":"string","x-example":"[KEY_ID]","in":"path"}]}},"\/projects\/{projectId}\/oauth2":{"patch":{"summary":"Update Project OAuth2","operationId":"projectsUpdateOAuth2","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Project","schema":{"$ref":"#\/definitions\/project"}}},"x-appwrite":{"method":"updateOAuth2","weight":126,"cookies":false,"type":"","demo":"projects\/update-o-auth2.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"provider":{"type":"string","description":"Provider Name","default":null,"x-example":"amazon"},"appId":{"type":"string","description":"Provider app ID. Max length: 256 chars.","default":"","x-example":"[APP_ID]"},"secret":{"type":"string","description":"Provider secret key. Max length: 512 chars.","default":"","x-example":"[SECRET]"}},"required":["provider"]}}]}},"\/projects\/{projectId}\/platforms":{"get":{"summary":"List Platforms","operationId":"projectsListPlatforms","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Platforms List","schema":{"$ref":"#\/definitions\/platformList"}}},"x-appwrite":{"method":"listPlatforms","weight":141,"cookies":false,"type":"","demo":"projects\/list-platforms.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"}]},"post":{"summary":"Create Platform","operationId":"projectsCreatePlatform","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"201":{"description":"Platform","schema":{"$ref":"#\/definitions\/platform"}}},"x-appwrite":{"method":"createPlatform","weight":140,"cookies":false,"type":"","demo":"projects\/create-platform.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"type":{"type":"string","description":"Platform type.","default":null,"x-example":"web"},"name":{"type":"string","description":"Platform name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"key":{"type":"string","description":"Package name for Android or bundle ID for iOS or macOS. Max length: 256 chars.","default":"","x-example":"[KEY]"},"store":{"type":"string","description":"App store or Google Play store ID. Max length: 256 chars.","default":"","x-example":"[STORE]"},"hostname":{"type":"string","description":"Platform client hostname. Max length: 256 chars.","default":"","x-example":"[HOSTNAME]"}},"required":["type","name"]}}]}},"\/projects\/{projectId}\/platforms\/{platformId}":{"get":{"summary":"Get Platform","operationId":"projectsGetPlatform","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Platform","schema":{"$ref":"#\/definitions\/platform"}}},"x-appwrite":{"method":"getPlatform","weight":142,"cookies":false,"type":"","demo":"projects\/get-platform.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"platformId","description":"Platform unique ID.","required":true,"type":"string","x-example":"[PLATFORM_ID]","in":"path"}]},"put":{"summary":"Update Platform","operationId":"projectsUpdatePlatform","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Platform","schema":{"$ref":"#\/definitions\/platform"}}},"x-appwrite":{"method":"updatePlatform","weight":143,"cookies":false,"type":"","demo":"projects\/update-platform.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"platformId","description":"Platform unique ID.","required":true,"type":"string","x-example":"[PLATFORM_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Platform name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"key":{"type":"string","description":"Package name for android or bundle ID for iOS. Max length: 256 chars.","default":"","x-example":"[KEY]"},"store":{"type":"string","description":"App store or Google Play store ID. Max length: 256 chars.","default":"","x-example":"[STORE]"},"hostname":{"type":"string","description":"Platform client URL. Max length: 256 chars.","default":"","x-example":"[HOSTNAME]"}},"required":["name"]}}]},"delete":{"summary":"Delete Platform","operationId":"projectsDeletePlatform","consumes":["application\/json"],"produces":[],"tags":["projects"],"description":"","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deletePlatform","weight":144,"cookies":false,"type":"","demo":"projects\/delete-platform.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"platformId","description":"Platform unique ID.","required":true,"type":"string","x-example":"[PLATFORM_ID]","in":"path"}]}},"\/projects\/{projectId}\/service":{"patch":{"summary":"Update service status","operationId":"projectsUpdateServiceStatus","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Project","schema":{"$ref":"#\/definitions\/project"}}},"x-appwrite":{"method":"updateServiceStatus","weight":125,"cookies":false,"type":"","demo":"projects\/update-service-status.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"service":{"type":"string","description":"Service name.","default":null,"x-example":"account"},"status":{"type":"boolean","description":"Service status.","default":null,"x-example":false}},"required":["service","status"]}}]}},"\/projects\/{projectId}\/usage":{"get":{"summary":"Get usage stats for a project","operationId":"projectsGetUsage","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"UsageProject","schema":{"$ref":"#\/definitions\/usageProject"}}},"x-appwrite":{"method":"getUsage","weight":123,"cookies":false,"type":"","demo":"projects\/get-usage.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"range","description":"Date range.","required":false,"type":"string","x-example":"24h","default":"30d","in":"query"}]}},"\/projects\/{projectId}\/webhooks":{"get":{"summary":"List Webhooks","operationId":"projectsListWebhooks","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Webhooks List","schema":{"$ref":"#\/definitions\/webhookList"}}},"x-appwrite":{"method":"listWebhooks","weight":131,"cookies":false,"type":"","demo":"projects\/list-webhooks.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"}]},"post":{"summary":"Create Webhook","operationId":"projectsCreateWebhook","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"201":{"description":"Webhook","schema":{"$ref":"#\/definitions\/webhook"}}},"x-appwrite":{"method":"createWebhook","weight":130,"cookies":false,"type":"","demo":"projects\/create-webhook.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Webhook name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"events":{"type":"array","description":"Events list.","default":null,"x-example":null,"items":{"type":"string"}},"url":{"type":"string","description":"Webhook URL.","default":null,"x-example":"https:\/\/example.com"},"security":{"type":"boolean","description":"Certificate verification, false for disabled or true for enabled.","default":null,"x-example":false},"httpUser":{"type":"string","description":"Webhook HTTP user. Max length: 256 chars.","default":"","x-example":"[HTTP_USER]"},"httpPass":{"type":"string","description":"Webhook HTTP password. Max length: 256 chars.","default":"","x-example":"[HTTP_PASS]"}},"required":["name","events","url","security"]}}]}},"\/projects\/{projectId}\/webhooks\/{webhookId}":{"get":{"summary":"Get Webhook","operationId":"projectsGetWebhook","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Webhook","schema":{"$ref":"#\/definitions\/webhook"}}},"x-appwrite":{"method":"getWebhook","weight":132,"cookies":false,"type":"","demo":"projects\/get-webhook.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"webhookId","description":"Webhook unique ID.","required":true,"type":"string","x-example":"[WEBHOOK_ID]","in":"path"}]},"put":{"summary":"Update Webhook","operationId":"projectsUpdateWebhook","consumes":["application\/json"],"produces":["application\/json"],"tags":["projects"],"description":"","responses":{"200":{"description":"Webhook","schema":{"$ref":"#\/definitions\/webhook"}}},"x-appwrite":{"method":"updateWebhook","weight":133,"cookies":false,"type":"","demo":"projects\/update-webhook.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"webhookId","description":"Webhook unique ID.","required":true,"type":"string","x-example":"[WEBHOOK_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Webhook name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"events":{"type":"array","description":"Events list.","default":null,"x-example":null,"items":{"type":"string"}},"url":{"type":"string","description":"Webhook URL.","default":null,"x-example":"https:\/\/example.com"},"security":{"type":"boolean","description":"Certificate verification, false for disabled or true for enabled.","default":null,"x-example":false},"httpUser":{"type":"string","description":"Webhook HTTP user. Max length: 256 chars.","default":"","x-example":"[HTTP_USER]"},"httpPass":{"type":"string","description":"Webhook HTTP password. Max length: 256 chars.","default":"","x-example":"[HTTP_PASS]"}},"required":["name","events","url","security"]}}]},"delete":{"summary":"Delete Webhook","operationId":"projectsDeleteWebhook","consumes":["application\/json"],"produces":[],"tags":["projects"],"description":"","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteWebhook","weight":134,"cookies":false,"type":"","demo":"projects\/delete-webhook.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"projects.write","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"projectId","description":"Project unique ID.","required":true,"type":"string","x-example":"[PROJECT_ID]","in":"path"},{"name":"webhookId","description":"Webhook unique ID.","required":true,"type":"string","x-example":"[WEBHOOK_ID]","in":"path"}]}},"\/storage\/buckets":{"get":{"summary":"List buckets","operationId":"storageListBuckets","consumes":["application\/json"],"produces":["application\/json"],"tags":["storage"],"description":"Get a list of all the storage buckets. You can use the query params to filter your results.","responses":{"200":{"description":"Buckets List","schema":{"$ref":"#\/definitions\/bucketList"}}},"x-appwrite":{"method":"listBuckets","weight":151,"cookies":false,"type":"","demo":"storage\/list-buckets.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/list-buckets.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"buckets.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Results offset. The default value is 0. Use this param to manage pagination.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"cursor","description":"ID of the bucket used as the starting point for the query, excluding the bucket itself. Should be used for efficient pagination when working with large sets of data.","required":false,"type":"string","x-example":"[CURSOR]","default":"","in":"query"},{"name":"cursorDirection","description":"Direction of the cursor.","required":false,"type":"string","x-example":"after","default":"after","in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create bucket","operationId":"storageCreateBucket","consumes":["application\/json"],"produces":["application\/json"],"tags":["storage"],"description":"Create a new storage bucket.","responses":{"201":{"description":"Bucket","schema":{"$ref":"#\/definitions\/bucket"}}},"x-appwrite":{"method":"createBucket","weight":150,"cookies":false,"type":"","demo":"storage\/create-bucket.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/create-bucket.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"buckets.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"bucketId":{"type":"string","description":"Unique Id. Choose your own unique ID or pass the string `unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.","default":null,"x-example":"[BUCKET_ID]"},"name":{"type":"string","description":"Bucket name","default":null,"x-example":"[NAME]"},"permission":{"type":"string","description":"Permissions type model to use for reading files in this bucket. You can use bucket-level permission set once on the bucket using the `read` and `write` params, or you can set file-level permission where each file read and write params will decide who has access to read and write to each file individually. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":"file"},"read":{"type":"array","description":"An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":"[\"role:all\"]","items":{"type":"string"}},"write":{"type":"array","description":"An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":"[\"role:all\"]","items":{"type":"string"}},"enabled":{"type":"boolean","description":"Is bucket enabled?","default":true,"x-example":false},"maximumFileSize":{"type":"integer","description":"Maximum file size allowed in bytes. Maximum allowed value is 30MB. For self-hosted setups you can change the max limit by changing the `_APP_STORAGE_LIMIT` environment variable. [Learn more about storage environment variables](docs\/environment-variables#storage)","default":30000000,"x-example":null},"allowedFileExtensions":{"type":"array","description":"Allowed file extensions","default":[],"x-example":null,"items":{"type":"string"}},"encryption":{"type":"boolean","description":"Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled","default":true,"x-example":false},"antivirus":{"type":"boolean","description":"Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled","default":true,"x-example":false}},"required":["bucketId","name","permission"]}}]}},"\/storage\/buckets\/{bucketId}":{"get":{"summary":"Get Bucket","operationId":"storageGetBucket","consumes":["application\/json"],"produces":["application\/json"],"tags":["storage"],"description":"Get a storage bucket by its unique ID. This endpoint response returns a JSON object with the storage bucket metadata.","responses":{"200":{"description":"Bucket","schema":{"$ref":"#\/definitions\/bucket"}}},"x-appwrite":{"method":"getBucket","weight":152,"cookies":false,"type":"","demo":"storage\/get-bucket.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/get-bucket.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"buckets.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"bucketId","description":"Bucket unique ID.","required":true,"type":"string","x-example":"[BUCKET_ID]","in":"path"}]},"put":{"summary":"Update Bucket","operationId":"storageUpdateBucket","consumes":["application\/json"],"produces":["application\/json"],"tags":["storage"],"description":"Update a storage bucket by its unique ID.","responses":{"200":{"description":"Bucket","schema":{"$ref":"#\/definitions\/bucket"}}},"x-appwrite":{"method":"updateBucket","weight":153,"cookies":false,"type":"","demo":"storage\/update-bucket.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/update-bucket.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"buckets.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"bucketId","description":"Bucket unique ID.","required":true,"type":"string","x-example":"[BUCKET_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"Bucket name","default":null,"x-example":"[NAME]"},"permission":{"type":"string","description":"Permissions type model to use for reading files in this bucket. You can use bucket-level permission set once on the bucket using the `read` and `write` params, or you can set file-level permission where each file read and write params will decide who has access to read and write to each file individually. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":"file"},"read":{"type":"array","description":"An array of strings with read permissions. By default inherits the existing read permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":"[\"role:all\"]","items":{"type":"string"}},"write":{"type":"array","description":"An array of strings with write permissions. By default inherits the existing write permissions. [learn more about permissions](\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":"[\"role:all\"]","items":{"type":"string"}},"enabled":{"type":"boolean","description":"Is bucket enabled?","default":true,"x-example":false},"maximumFileSize":{"type":"integer","description":"Maximum file size allowed in bytes. Maximum allowed value is 30MB. For self hosted version you can change the limit by changing _APP_STORAGE_LIMIT environment variable. [Learn more about storage environment variables](docs\/environment-variables#storage)","default":null,"x-example":null},"allowedFileExtensions":{"type":"array","description":"Allowed file extensions","default":[],"x-example":null,"items":{"type":"string"}},"encryption":{"type":"boolean","description":"Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled","default":true,"x-example":false},"antivirus":{"type":"boolean","description":"Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled","default":true,"x-example":false}},"required":["name","permission"]}}]},"delete":{"summary":"Delete Bucket","operationId":"storageDeleteBucket","consumes":["application\/json"],"produces":[],"tags":["storage"],"description":"Delete a storage bucket by its unique ID.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteBucket","weight":154,"cookies":false,"type":"","demo":"storage\/delete-bucket.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/delete-bucket.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"buckets.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"bucketId","description":"Bucket unique ID.","required":true,"type":"string","x-example":"[BUCKET_ID]","in":"path"}]}},"\/storage\/buckets\/{bucketId}\/files":{"get":{"summary":"List Files","operationId":"storageListFiles","consumes":["application\/json"],"produces":["application\/json"],"tags":["storage"],"description":"Get a list of all the user files. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project's files. [Learn more about different API modes](\/docs\/admin).","responses":{"200":{"description":"Files List","schema":{"$ref":"#\/definitions\/fileList"}}},"x-appwrite":{"method":"listFiles","weight":156,"cookies":false,"type":"","demo":"storage\/list-files.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/list-files.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"bucketId","description":"Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](\/docs\/server\/storage#createBucket).","required":true,"type":"string","x-example":"[BUCKET_ID]","in":"path"},{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Maximum number of files to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Offset value. The default value is 0. Use this param to manage pagination. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"cursor","description":"ID of the file used as the starting point for the query, excluding the file itself. Should be used for efficient pagination when working with large sets of data. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"string","x-example":"[CURSOR]","default":"","in":"query"},{"name":"cursorDirection","description":"Direction of the cursor.","required":false,"type":"string","x-example":"after","default":"after","in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create File","operationId":"storageCreateFile","consumes":["multipart\/form-data"],"produces":["application\/json"],"tags":["storage"],"description":"Create a new file. Before using this route, you should create a new bucket resource using either a [server integration](\/docs\/server\/database#storageCreateBucket) API or directly from your Appwrite console.\n\nLarger files should be uploaded using multiple requests with the [content-range](https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTTP\/Headers\/Content-Range) header to send a partial request with a maximum supported chunk of `5MB`. The `content-range` header values should always be in bytes.\n\nWhen the first request is sent, the server will return the **File** object, and the subsequent part request must include the file's **id** in `x-appwrite-id` header to allow the server to know that the partial upload is for the existing file and not for a new one.\n\nIf you're creating a new file using one of the Appwrite SDKs, all the chunking logic will be managed by the SDK internally.\n","responses":{"201":{"description":"File","schema":{"$ref":"#\/definitions\/file"}}},"x-appwrite":{"method":"createFile","weight":155,"cookies":false,"type":"upload","demo":"storage\/create-file.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/create-file.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"bucketId","description":"Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](\/docs\/server\/storage#createBucket).","required":true,"type":"string","x-example":"[BUCKET_ID]","in":"path"},{"name":"fileId","description":"File ID. Choose your own unique ID or pass the string \"unique()\" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.","required":true,"x-upload-id":true,"type":"string","x-example":"[FILE_ID]","in":"formData"},{"name":"file","description":"Binary file.","required":true,"type":"file","in":"formData"},{"name":"read","description":"An array of strings with read permissions. By default only the current user is granted with read permissions. [learn more about permissions](https:\/\/appwrite.io\/docs\/permissions) and get a full list of available permissions.","required":false,"type":"array","collectionFormat":"multi","items":{"type":"string"},"x-example":"[\"role:all\"]","in":"formData"},{"name":"write","description":"An array of strings with write permissions. By default only the current user is granted with write permissions. [learn more about permissions](https:\/\/appwrite.io\/docs\/permissions) and get a full list of available permissions.","required":false,"type":"array","collectionFormat":"multi","items":{"type":"string"},"x-example":"[\"role:all\"]","in":"formData"}]}},"\/storage\/buckets\/{bucketId}\/files\/{fileId}":{"get":{"summary":"Get File","operationId":"storageGetFile","consumes":["application\/json"],"produces":["application\/json"],"tags":["storage"],"description":"Get a file by its unique ID. This endpoint response returns a JSON object with the file metadata.","responses":{"200":{"description":"File","schema":{"$ref":"#\/definitions\/file"}}},"x-appwrite":{"method":"getFile","weight":157,"cookies":false,"type":"","demo":"storage\/get-file.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/get-file.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"bucketId","description":"Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](\/docs\/server\/storage#createBucket).","required":true,"type":"string","x-example":"[BUCKET_ID]","in":"path"},{"name":"fileId","description":"File ID.","required":true,"type":"string","x-example":"[FILE_ID]","in":"path"}]},"put":{"summary":"Update File","operationId":"storageUpdateFile","consumes":["application\/json"],"produces":["application\/json"],"tags":["storage"],"description":"Update a file by its unique ID. Only users with write permissions have access to update this resource.","responses":{"200":{"description":"File","schema":{"$ref":"#\/definitions\/file"}}},"x-appwrite":{"method":"updateFile","weight":161,"cookies":false,"type":"","demo":"storage\/update-file.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/update-file.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"bucketId","description":"Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](\/docs\/server\/storage#createBucket).","required":true,"type":"string","x-example":"[BUCKET_ID]","in":"path"},{"name":"fileId","description":"File unique ID.","required":true,"type":"string","x-example":"[FILE_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"read":{"type":"array","description":"An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](https:\/\/appwrite.io\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":"[\"role:all\"]","items":{"type":"string"}},"write":{"type":"array","description":"An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](https:\/\/appwrite.io\/docs\/permissions) and get a full list of available permissions.","default":null,"x-example":"[\"role:all\"]","items":{"type":"string"}}}}}]},"delete":{"summary":"Delete File","operationId":"storageDeleteFile","consumes":["application\/json"],"produces":[],"tags":["storage"],"description":"Delete a file by its unique ID. Only users with write permissions have access to delete this resource.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteFile","weight":162,"cookies":false,"type":"","demo":"storage\/delete-file.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/delete-file.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"bucketId","description":"Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](\/docs\/server\/storage#createBucket).","required":true,"type":"string","x-example":"[BUCKET_ID]","in":"path"},{"name":"fileId","description":"File ID.","required":true,"type":"string","x-example":"[FILE_ID]","in":"path"}]}},"\/storage\/buckets\/{bucketId}\/files\/{fileId}\/download":{"get":{"summary":"Get File for Download","operationId":"storageGetFileDownload","consumes":["application\/json"],"produces":["*\/*"],"tags":["storage"],"description":"Get a file content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory.","responses":{"200":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getFileDownload","weight":159,"cookies":false,"type":"location","demo":"storage\/get-file-download.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/get-file-download.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"bucketId","description":"Storage bucket ID. You can create a new storage bucket using the Storage service [server integration](\/docs\/server\/storage#createBucket).","required":true,"type":"string","x-example":"[BUCKET_ID]","in":"path"},{"name":"fileId","description":"File ID.","required":true,"type":"string","x-example":"[FILE_ID]","in":"path"}]}},"\/storage\/buckets\/{bucketId}\/files\/{fileId}\/preview":{"get":{"summary":"Get File Preview","operationId":"storageGetFilePreview","consumes":["application\/json"],"produces":["image\/*"],"tags":["storage"],"description":"Get a file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets, will return the file icon image. You can also pass query string arguments for cutting and resizing your preview image. Preview is supported only for image files smaller than 10MB.","responses":{"200":{"description":"Image","schema":{"type":"file"}}},"x-appwrite":{"method":"getFilePreview","weight":158,"cookies":false,"type":"location","demo":"storage\/get-file-preview.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/get-file-preview.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"bucketId","description":"Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](\/docs\/server\/storage#createBucket).","required":true,"type":"string","x-example":"[BUCKET_ID]","in":"path"},{"name":"fileId","description":"File ID","required":true,"type":"string","x-example":"[FILE_ID]","in":"path"},{"name":"width","description":"Resize preview image width, Pass an integer between 0 to 4000.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"height","description":"Resize preview image height, Pass an integer between 0 to 4000.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"gravity","description":"Image crop gravity. Can be one of center,top-left,top,top-right,left,right,bottom-left,bottom,bottom-right","required":false,"type":"string","x-example":"center","default":"center","in":"query"},{"name":"quality","description":"Preview image quality. Pass an integer between 0 to 100. Defaults to 100.","required":false,"type":"integer","format":"int32","x-example":0,"default":100,"in":"query"},{"name":"borderWidth","description":"Preview image border in pixels. Pass an integer between 0 to 100. Defaults to 0.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"borderColor","description":"Preview image border color. Use a valid HEX color, no # is needed for prefix.","required":false,"type":"string","default":"","in":"query"},{"name":"borderRadius","description":"Preview image border radius in pixels. Pass an integer between 0 to 4000.","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"opacity","description":"Preview image opacity. Only works with images having an alpha channel (like png). Pass a number between 0 to 1.","required":false,"type":"number","format":"float","x-example":0,"default":1,"in":"query"},{"name":"rotation","description":"Preview image rotation in degrees. Pass an integer between -360 and 360.","required":false,"type":"integer","format":"int32","x-example":-360,"default":0,"in":"query"},{"name":"background","description":"Preview image background color. Only works with transparent images (png). Use a valid HEX color, no # is needed for prefix.","required":false,"type":"string","default":"","in":"query"},{"name":"output","description":"Output format type (jpeg, jpg, png, gif and webp).","required":false,"type":"string","x-example":"jpg","default":"","in":"query"}]}},"\/storage\/buckets\/{bucketId}\/files\/{fileId}\/view":{"get":{"summary":"Get File for View","operationId":"storageGetFileView","consumes":["application\/json"],"produces":["*\/*"],"tags":["storage"],"description":"Get a file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header.","responses":{"200":{"description":"File","schema":{"type":"file"}}},"x-appwrite":{"method":"getFileView","weight":160,"cookies":false,"type":"location","demo":"storage\/get-file-view.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/storage\/get-file-view.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"bucketId","description":"Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](\/docs\/server\/storage#createBucket).","required":true,"type":"string","x-example":"[BUCKET_ID]","in":"path"},{"name":"fileId","description":"File ID.","required":true,"type":"string","x-example":"[FILE_ID]","in":"path"}]}},"\/storage\/usage":{"get":{"summary":"Get usage stats for storage","operationId":"storageGetUsage","consumes":["application\/json"],"produces":["application\/json"],"tags":["storage"],"description":"","responses":{"200":{"description":"StorageUsage","schema":{"$ref":"#\/definitions\/usageStorage"}}},"x-appwrite":{"method":"getUsage","weight":163,"cookies":false,"type":"","demo":"storage\/get-usage.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"range","description":"Date range.","required":false,"type":"string","x-example":"24h","default":"30d","in":"query"}]}},"\/storage\/{bucketId}\/usage":{"get":{"summary":"Get usage stats for a storage bucket","operationId":"storageGetBucketUsage","consumes":["application\/json"],"produces":["application\/json"],"tags":["storage"],"description":"","responses":{"200":{"description":"UsageBuckets","schema":{"$ref":"#\/definitions\/usageBuckets"}}},"x-appwrite":{"method":"getBucketUsage","weight":164,"cookies":false,"type":"","demo":"storage\/get-bucket-usage.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"files.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"bucketId","description":"Bucket ID.","required":true,"type":"string","x-example":"[BUCKET_ID]","in":"path"},{"name":"range","description":"Date range.","required":false,"type":"string","x-example":"24h","default":"30d","in":"query"}]}},"\/teams":{"get":{"summary":"List Teams","operationId":"teamsList","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Get a list of all the teams in which the current user is a member. You can use the parameters to filter your results.\r\n\r\nIn admin mode, this endpoint returns a list of all the teams in the current project. [Learn more about different API modes](\/docs\/admin).","responses":{"200":{"description":"Teams List","schema":{"$ref":"#\/definitions\/teamList"}}},"x-appwrite":{"method":"list","weight":166,"cookies":false,"type":"","demo":"teams\/list.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/list-teams.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Maximum number of teams to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Offset value. The default value is 0. Use this param to manage pagination. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"cursor","description":"ID of the team used as the starting point for the query, excluding the team itself. Should be used for efficient pagination when working with large sets of data. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"string","x-example":"[CURSOR]","default":"","in":"query"},{"name":"cursorDirection","description":"Direction of the cursor.","required":false,"type":"string","x-example":"after","default":"after","in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create Team","operationId":"teamsCreate","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Create a new team. The user who creates the team will automatically be assigned as the owner of the team. Only the users with the owner role can invite new members, add new owners and delete or update the team.","responses":{"201":{"description":"Team","schema":{"$ref":"#\/definitions\/team"}}},"x-appwrite":{"method":"create","weight":165,"cookies":false,"type":"","demo":"teams\/create.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/create-team.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"teamId":{"type":"string","description":"Team ID. Choose your own unique ID or pass the string \"unique()\" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.","default":null,"x-example":"[TEAM_ID]"},"name":{"type":"string","description":"Team name. Max length: 128 chars.","default":null,"x-example":"[NAME]"},"roles":{"type":"array","description":"Array of strings. Use this param to set the roles in the team for the user who created it. The default role is **owner**. A role can be any string. Learn more about [roles and permissions](\/docs\/permissions). Max length for each role is 32 chars.","default":["owner"],"x-example":null,"items":{"type":"string"}}},"required":["teamId","name"]}}]}},"\/teams\/{teamId}":{"get":{"summary":"Get Team","operationId":"teamsGet","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Get a team by its ID. All team members have read access for this resource.","responses":{"200":{"description":"Team","schema":{"$ref":"#\/definitions\/team"}}},"x-appwrite":{"method":"get","weight":167,"cookies":false,"type":"","demo":"teams\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/get-team.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"}]},"put":{"summary":"Update Team","operationId":"teamsUpdate","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Update a team using its ID. Only members with the owner role can update the team.","responses":{"200":{"description":"Team","schema":{"$ref":"#\/definitions\/team"}}},"x-appwrite":{"method":"update","weight":168,"cookies":false,"type":"","demo":"teams\/update.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/update-team.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"New team name. Max length: 128 chars.","default":null,"x-example":"[NAME]"}},"required":["name"]}}]},"delete":{"summary":"Delete Team","operationId":"teamsDelete","consumes":["application\/json"],"produces":[],"tags":["teams"],"description":"Delete a team using its ID. Only team members with the owner role can delete the team.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"delete","weight":169,"cookies":false,"type":"","demo":"teams\/delete.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/delete-team.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"}]}},"\/teams\/{teamId}\/memberships":{"get":{"summary":"Get Team Memberships","operationId":"teamsGetMemberships","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Use this endpoint to list a team's members using the team's ID. All team members have read access to this endpoint.","responses":{"200":{"description":"Memberships List","schema":{"$ref":"#\/definitions\/membershipList"}}},"x-appwrite":{"method":"getMemberships","weight":171,"cookies":false,"type":"","demo":"teams\/get-memberships.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/get-team-members.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"},{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Maximum number of memberships to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Offset value. The default value is 0. Use this value to manage pagination. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"cursor","description":"ID of the membership used as the starting point for the query, excluding the membership itself. Should be used for efficient pagination when working with large sets of data. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"string","x-example":"[CURSOR]","default":"","in":"query"},{"name":"cursorDirection","description":"Direction of the cursor.","required":false,"type":"string","x-example":"after","default":"after","in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create Team Membership","operationId":"teamsCreateMembership","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Invite a new member to join your team. If initiated from the client SDK, an email with a link to join the team will be sent to the member's email address and an account will be created for them should they not be signed up already. If initiated from server-side SDKs, the new member will automatically be added to the team.\n\nUse the 'url' parameter to redirect the user from the invitation email back to your app. When the user is redirected, use the [Update Team Membership Status](\/docs\/client\/teams#teamsUpdateMembershipStatus) endpoint to allow the user to accept the invitation to the team. \n\nPlease note that to avoid a [Redirect Attack](https:\/\/github.com\/OWASP\/CheatSheetSeries\/blob\/master\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URL's are the once from domains you have set when adding your platforms in the console interface.","responses":{"201":{"description":"Membership","schema":{"$ref":"#\/definitions\/membership"}}},"x-appwrite":{"method":"createMembership","weight":170,"cookies":false,"type":"","demo":"teams\/create-membership.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/create-team-membership.md","rate-limit":10,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"email":{"type":"string","description":"Email of the new team member.","default":null,"x-example":"email@example.com"},"roles":{"type":"array","description":"Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](\/docs\/permissions). Max length for each role is 32 chars.","default":null,"x-example":null,"items":{"type":"string"}},"url":{"type":"string","description":"URL to redirect the user back to your app from the invitation email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.","default":null,"x-example":"https:\/\/example.com"},"name":{"type":"string","description":"Name of the new team member. Max length: 128 chars.","default":"","x-example":"[NAME]"}},"required":["email","roles","url"]}}]}},"\/teams\/{teamId}\/memberships\/{membershipId}":{"get":{"summary":"Get Team Membership","operationId":"teamsGetMembership","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Get a team member by the membership unique id. All team members have read access for this resource.","responses":{"200":{"description":"Memberships List","schema":{"$ref":"#\/definitions\/membershipList"}}},"x-appwrite":{"method":"getMembership","weight":172,"cookies":false,"type":"","demo":"teams\/get-membership.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/get-team-member.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.read","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"},{"name":"membershipId","description":"Membership ID.","required":true,"type":"string","x-example":"[MEMBERSHIP_ID]","in":"path"}]},"patch":{"summary":"Update Membership Roles","operationId":"teamsUpdateMembershipRoles","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Modify the roles of a team member. Only team members with the owner role have access to this endpoint. Learn more about [roles and permissions](\/docs\/permissions).","responses":{"200":{"description":"Membership","schema":{"$ref":"#\/definitions\/membership"}}},"x-appwrite":{"method":"updateMembershipRoles","weight":173,"cookies":false,"type":"","demo":"teams\/update-membership-roles.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/update-team-membership-roles.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"},{"name":"membershipId","description":"Membership ID.","required":true,"type":"string","x-example":"[MEMBERSHIP_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"roles":{"type":"array","description":"An array of strings. Use this param to set the user's roles in the team. A role can be any string. Learn more about [roles and permissions](https:\/\/appwrite.io\/docs\/permissions). Max length for each role is 32 chars.","default":null,"x-example":null,"items":{"type":"string"}}},"required":["roles"]}}]},"delete":{"summary":"Delete Team Membership","operationId":"teamsDeleteMembership","consumes":["application\/json"],"produces":[],"tags":["teams"],"description":"This endpoint allows a user to leave a team or for a team owner to delete the membership of any other team member. You can also use this endpoint to delete a user membership even if it is not accepted.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteMembership","weight":175,"cookies":false,"type":"","demo":"teams\/delete-membership.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/delete-team-membership.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"teams.write","platforms":["client","server","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"},{"name":"membershipId","description":"Membership ID.","required":true,"type":"string","x-example":"[MEMBERSHIP_ID]","in":"path"}]}},"\/teams\/{teamId}\/memberships\/{membershipId}\/status":{"patch":{"summary":"Update Team Membership Status","operationId":"teamsUpdateMembershipStatus","consumes":["application\/json"],"produces":["application\/json"],"tags":["teams"],"description":"Use this endpoint to allow a user to accept an invitation to join a team after being redirected back to your app from the invitation email received by the user.\n\nIf the request is successful, a session for the user is automatically created.\n","responses":{"200":{"description":"Membership","schema":{"$ref":"#\/definitions\/membership"}}},"x-appwrite":{"method":"updateMembershipStatus","weight":174,"cookies":false,"type":"","demo":"teams\/update-membership-status.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/teams\/update-team-membership-status.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"public","platforms":["client","server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"JWT":[]}],"parameters":[{"name":"teamId","description":"Team ID.","required":true,"type":"string","x-example":"[TEAM_ID]","in":"path"},{"name":"membershipId","description":"Membership ID.","required":true,"type":"string","x-example":"[MEMBERSHIP_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"userId":{"type":"string","description":"User ID.","default":null,"x-example":"[USER_ID]"},"secret":{"type":"string","description":"Secret key.","default":null,"x-example":"[SECRET]"}},"required":["userId","secret"]}}]}},"\/users":{"get":{"summary":"List Users","operationId":"usersList","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Get a list of all the project's users. You can use the query params to filter your results.","responses":{"200":{"description":"Users List","schema":{"$ref":"#\/definitions\/userList"}}},"x-appwrite":{"method":"list","weight":177,"cookies":false,"type":"","demo":"users\/list.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/list-users.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"search","description":"Search term to filter your list results. Max length: 256 chars.","required":false,"type":"string","x-example":"[SEARCH]","default":"","in":"query"},{"name":"limit","description":"Maximum number of users to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Offset value. The default value is 0. Use this param to manage pagination. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"},{"name":"cursor","description":"ID of the user used as the starting point for the query, excluding the user itself. Should be used for efficient pagination when working with large sets of data. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"string","x-example":"[CURSOR]","default":"","in":"query"},{"name":"cursorDirection","description":"Direction of the cursor.","required":false,"type":"string","x-example":"after","default":"after","in":"query"},{"name":"orderType","description":"Order result by ASC or DESC order.","required":false,"type":"string","x-example":"ASC","default":"ASC","in":"query"}]},"post":{"summary":"Create User","operationId":"usersCreate","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Create a new user.","responses":{"201":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"create","weight":176,"cookies":false,"type":"","demo":"users\/create.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/create-user.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"payload","in":"body","schema":{"type":"object","properties":{"userId":{"type":"string","description":"User ID. Choose your own unique ID or pass the string \"unique()\" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.","default":null,"x-example":"[USER_ID]"},"email":{"type":"string","description":"User email.","default":null,"x-example":"email@example.com"},"password":{"type":"string","description":"User password. Must be at least 8 chars.","default":null,"x-example":"password"},"name":{"type":"string","description":"User name. Max length: 128 chars.","default":"","x-example":"[NAME]"}},"required":["userId","email","password"]}}]}},"\/users\/usage":{"get":{"summary":"Get usage stats for the users API","operationId":"usersGetUsage","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"","responses":{"200":{"description":"UsageUsers","schema":{"$ref":"#\/definitions\/usageUsers"}}},"x-appwrite":{"method":"getUsage","weight":191,"cookies":false,"type":"","demo":"users\/get-usage.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.read","platforms":["console"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[]}],"parameters":[{"name":"range","description":"Date range.","required":false,"type":"string","x-example":"24h","default":"30d","in":"query"},{"name":"provider","description":"Provider Name.","required":false,"type":"string","x-example":"email","default":"","in":"query"}]}},"\/users\/{userId}":{"get":{"summary":"Get User","operationId":"usersGet","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Get a user by its unique ID.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"get","weight":178,"cookies":false,"type":"","demo":"users\/get.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/get-user.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"}]},"delete":{"summary":"Delete User","operationId":"usersDelete","consumes":["application\/json"],"produces":[],"tags":["users"],"description":"Delete a user by its unique ID.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"delete","weight":190,"cookies":false,"type":"","demo":"users\/delete.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/delete.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"}]}},"\/users\/{userId}\/email":{"patch":{"summary":"Update Email","operationId":"usersUpdateEmail","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Update the user email by its unique ID.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updateEmail","weight":186,"cookies":false,"type":"","demo":"users\/update-email.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/update-user-email.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"email":{"type":"string","description":"User email.","default":null,"x-example":"email@example.com"}},"required":["email"]}}]}},"\/users\/{userId}\/logs":{"get":{"summary":"Get User Logs","operationId":"usersGetLogs","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Get the user activity logs list by its unique ID.","responses":{"200":{"description":"Logs List","schema":{"$ref":"#\/definitions\/logList"}}},"x-appwrite":{"method":"getLogs","weight":181,"cookies":false,"type":"","demo":"users\/get-logs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/get-user-logs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"},{"name":"limit","description":"Maximum number of logs to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.","required":false,"type":"integer","format":"int32","x-example":0,"default":25,"in":"query"},{"name":"offset","description":"Offset value. The default value is 0. Use this value to manage pagination. [learn more about pagination](https:\/\/appwrite.io\/docs\/pagination)","required":false,"type":"integer","format":"int32","x-example":0,"default":0,"in":"query"}]}},"\/users\/{userId}\/name":{"patch":{"summary":"Update Name","operationId":"usersUpdateName","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Update the user name by its unique ID.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updateName","weight":184,"cookies":false,"type":"","demo":"users\/update-name.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/update-user-name.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"name":{"type":"string","description":"User name. Max length: 128 chars.","default":null,"x-example":"[NAME]"}},"required":["name"]}}]}},"\/users\/{userId}\/password":{"patch":{"summary":"Update Password","operationId":"usersUpdatePassword","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Update the user password by its unique ID.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updatePassword","weight":185,"cookies":false,"type":"","demo":"users\/update-password.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/update-user-password.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"password":{"type":"string","description":"New user password. Must be at least 8 chars.","default":null,"x-example":"password"}},"required":["password"]}}]}},"\/users\/{userId}\/prefs":{"get":{"summary":"Get User Preferences","operationId":"usersGetPrefs","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Get the user preferences by its unique ID.","responses":{"200":{"description":"Preferences","schema":{"$ref":"#\/definitions\/preferences"}}},"x-appwrite":{"method":"getPrefs","weight":179,"cookies":false,"type":"","demo":"users\/get-prefs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/get-user-prefs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"}]},"patch":{"summary":"Update User Preferences","operationId":"usersUpdatePrefs","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Update the user preferences by its unique ID. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded.","responses":{"200":{"description":"Preferences","schema":{"$ref":"#\/definitions\/preferences"}}},"x-appwrite":{"method":"updatePrefs","weight":187,"cookies":false,"type":"","demo":"users\/update-prefs.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/update-user-prefs.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"prefs":{"type":"object","description":"Prefs key-value JSON object.","default":{},"x-example":"{}"}},"required":["prefs"]}}]}},"\/users\/{userId}\/sessions":{"get":{"summary":"Get User Sessions","operationId":"usersGetSessions","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Get the user sessions list by its unique ID.","responses":{"200":{"description":"Sessions List","schema":{"$ref":"#\/definitions\/sessionList"}}},"x-appwrite":{"method":"getSessions","weight":180,"cookies":false,"type":"","demo":"users\/get-sessions.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/get-user-sessions.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.read","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"}]},"delete":{"summary":"Delete User Sessions","operationId":"usersDeleteSessions","consumes":["application\/json"],"produces":[],"tags":["users"],"description":"Delete all user's sessions by using the user's unique ID.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteSessions","weight":189,"cookies":false,"type":"","demo":"users\/delete-sessions.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/delete-user-sessions.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"}]}},"\/users\/{userId}\/sessions\/{sessionId}":{"delete":{"summary":"Delete User Session","operationId":"usersDeleteSession","consumes":["application\/json"],"produces":[],"tags":["users"],"description":"Delete a user sessions by its unique ID.","responses":{"204":{"description":"No content"}},"x-appwrite":{"method":"deleteSession","weight":188,"cookies":false,"type":"","demo":"users\/delete-session.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/delete-user-session.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"},{"name":"sessionId","description":"Session ID.","required":true,"type":"string","x-example":"[SESSION_ID]","in":"path"}]}},"\/users\/{userId}\/status":{"patch":{"summary":"Update User Status","operationId":"usersUpdateStatus","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Update the user status by its unique ID.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updateStatus","weight":182,"cookies":false,"type":"","demo":"users\/update-status.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/update-user-status.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"status":{"type":"boolean","description":"User Status. To activate the user pass `true` and to block the user pass `false`.","default":null,"x-example":false}},"required":["status"]}}]}},"\/users\/{userId}\/verification":{"patch":{"summary":"Update Email Verification","operationId":"usersUpdateVerification","consumes":["application\/json"],"produces":["application\/json"],"tags":["users"],"description":"Update the user email verification status by its unique ID.","responses":{"200":{"description":"User","schema":{"$ref":"#\/definitions\/user"}}},"x-appwrite":{"method":"updateVerification","weight":183,"cookies":false,"type":"","demo":"users\/update-verification.md","edit":"https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/users\/update-user-verification.md","rate-limit":0,"rate-time":3600,"rate-key":"url:{url},ip:{ip}","scope":"users.write","platforms":["server"],"packaging":false,"auth":{"Project":[]}},"security":[{"Project":[],"Key":[]}],"parameters":[{"name":"userId","description":"User ID.","required":true,"type":"string","x-example":"[USER_ID]","in":"path"},{"name":"payload","in":"body","schema":{"type":"object","properties":{"emailVerification":{"type":"boolean","description":"User email verification status.","default":null,"x-example":false}},"required":["emailVerification"]}}]}}},"tags":[{"name":"account","description":"The Account service allows you to authenticate and manage a user account."},{"name":"avatars","description":"The Avatars service aims to help you complete everyday tasks related to your app image, icons, and avatars."},{"name":"database","description":"The Database service allows you to create structured collections of documents, query and filter lists of documents"},{"name":"locale","description":"The Locale service allows you to customize your app based on your users' location."},{"name":"health","description":"The Health service allows you to both validate and monitor your Appwrite server's health."},{"name":"projects","description":"The Project service allows you to manage all the projects in your Appwrite server."},{"name":"storage","description":"The Storage service allows you to manage your project files."},{"name":"teams","description":"The Teams service allows you to group users of your project and to enable them to share read and write access to your project resources"},{"name":"users","description":"The Users service allows you to manage your project users."},{"name":"functions","description":"The Functions Service allows you view, create and manage your Cloud Functions."}],"definitions":{"documentList":{"description":"Documents List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"documents":{"type":"array","description":"List of documents.","items":{"type":"object","$ref":"#\/definitions\/document"},"x-example":""}},"required":["sum","documents"]},"collectionList":{"description":"Collections List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"collections":{"type":"array","description":"List of collections.","items":{"type":"object","$ref":"#\/definitions\/collection"},"x-example":""}},"required":["sum","collections"]},"indexList":{"description":"Indexes List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"indexes":{"type":"array","description":"List of indexes.","items":{"type":"object","$ref":"#\/definitions\/index"},"x-example":""}},"required":["sum","indexes"]},"userList":{"description":"Users List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"users":{"type":"array","description":"List of users.","items":{"type":"object","$ref":"#\/definitions\/user"},"x-example":""}},"required":["sum","users"]},"sessionList":{"description":"Sessions List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"sessions":{"type":"array","description":"List of sessions.","items":{"type":"object","$ref":"#\/definitions\/session"},"x-example":""}},"required":["sum","sessions"]},"logList":{"description":"Logs List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"logs":{"type":"array","description":"List of logs.","items":{"type":"object","$ref":"#\/definitions\/log"},"x-example":""}},"required":["sum","logs"]},"fileList":{"description":"Files List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"files":{"type":"array","description":"List of files.","items":{"type":"object","$ref":"#\/definitions\/file"},"x-example":""}},"required":["sum","files"]},"bucketList":{"description":"Buckets List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"buckets":{"type":"array","description":"List of buckets.","items":{"type":"object","$ref":"#\/definitions\/bucket"},"x-example":""}},"required":["sum","buckets"]},"teamList":{"description":"Teams List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"teams":{"type":"array","description":"List of teams.","items":{"type":"object","$ref":"#\/definitions\/team"},"x-example":""}},"required":["sum","teams"]},"membershipList":{"description":"Memberships List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"memberships":{"type":"array","description":"List of memberships.","items":{"type":"object","$ref":"#\/definitions\/membership"},"x-example":""}},"required":["sum","memberships"]},"functionList":{"description":"Functions List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"functions":{"type":"array","description":"List of functions.","items":{"type":"object","$ref":"#\/definitions\/function"},"x-example":""}},"required":["sum","functions"]},"runtimeList":{"description":"Runtimes List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"runtimes":{"type":"array","description":"List of runtimes.","items":{"type":"object","$ref":"#\/definitions\/runtime"},"x-example":""}},"required":["sum","runtimes"]},"deploymentList":{"description":"Deployments List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"deployments":{"type":"array","description":"List of deployments.","items":{"type":"object","$ref":"#\/definitions\/deployment"},"x-example":""}},"required":["sum","deployments"]},"executionList":{"description":"Executions List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"executions":{"type":"array","description":"List of executions.","items":{"type":"object","$ref":"#\/definitions\/execution"},"x-example":""}},"required":["sum","executions"]},"projectList":{"description":"Projects List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"projects":{"type":"array","description":"List of projects.","items":{"type":"object","$ref":"#\/definitions\/project"},"x-example":""}},"required":["sum","projects"]},"webhookList":{"description":"Webhooks List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"webhooks":{"type":"array","description":"List of webhooks.","items":{"type":"object","$ref":"#\/definitions\/webhook"},"x-example":""}},"required":["sum","webhooks"]},"keyList":{"description":"API Keys List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"keys":{"type":"array","description":"List of keys.","items":{"type":"object","$ref":"#\/definitions\/key"},"x-example":""}},"required":["sum","keys"]},"platformList":{"description":"Platforms List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"platforms":{"type":"array","description":"List of platforms.","items":{"type":"object","$ref":"#\/definitions\/platform"},"x-example":""}},"required":["sum","platforms"]},"domainList":{"description":"Domains List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"domains":{"type":"array","description":"List of domains.","items":{"type":"object","$ref":"#\/definitions\/domain"},"x-example":""}},"required":["sum","domains"]},"countryList":{"description":"Countries List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"countries":{"type":"array","description":"List of countries.","items":{"type":"object","$ref":"#\/definitions\/country"},"x-example":""}},"required":["sum","countries"]},"continentList":{"description":"Continents List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"continents":{"type":"array","description":"List of continents.","items":{"type":"object","$ref":"#\/definitions\/continent"},"x-example":""}},"required":["sum","continents"]},"languageList":{"description":"Languages List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"languages":{"type":"array","description":"List of languages.","items":{"type":"object","$ref":"#\/definitions\/language"},"x-example":""}},"required":["sum","languages"]},"currencyList":{"description":"Currencies List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"currencies":{"type":"array","description":"List of currencies.","items":{"type":"object","$ref":"#\/definitions\/currency"},"x-example":""}},"required":["sum","currencies"]},"phoneList":{"description":"Phones List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"phones":{"type":"array","description":"List of phones.","items":{"type":"object","$ref":"#\/definitions\/phone"},"x-example":""}},"required":["sum","phones"]},"metricList":{"description":"Metric List","type":"object","properties":{"sum":{"type":"integer","description":"Total number of items available on the server.","x-example":5,"format":"int32"},"metrics":{"type":"array","description":"List of metrics.","items":{"type":"object","$ref":"#\/definitions\/metric"},"x-example":""}},"required":["sum","metrics"]},"collection":{"description":"Collection","type":"object","properties":{"$id":{"type":"string","description":"Collection ID.","x-example":"5e5ea5c16897e"},"$read":{"type":"array","description":"Collection read permissions.","items":{"type":"string"},"x-example":"role:all"},"$write":{"type":"array","description":"Collection write permissions.","items":{"type":"string"},"x-example":"user:608f9da25e7e1"},"name":{"type":"string","description":"Collection name.","x-example":"My Collection"},"enabled":{"type":"boolean","description":"Collection enabled.","x-example":false},"permission":{"type":"string","description":"Collection permission model. Possible values: `document` or `collection`","x-example":"document"},"attributes":{"type":"array","description":"Collection attributes.","items":{"x-anyOf":[{"$ref":"#\/definitions\/attributeBoolean"},{"$ref":"#\/definitions\/attributeInteger"},{"$ref":"#\/definitions\/attributeFloat"},{"$ref":"#\/definitions\/attributeEmail"},{"$ref":"#\/definitions\/attributeEnum"},{"$ref":"#\/definitions\/attributeUrl"},{"$ref":"#\/definitions\/attributeIp"},{"$ref":"#\/definitions\/attributeString"}]},"x-example":{}},"indexes":{"type":"array","description":"Collection indexes.","items":{"type":"object","$ref":"#\/definitions\/index"},"x-example":{}}},"required":["$id","$read","$write","name","enabled","permission","attributes","indexes"]},"attributeList":{"description":"Attributes List","type":"object","properties":{"sum":{"type":"integer","description":"Total sum of items in the list.","x-example":5,"format":"int32"},"attributes":{"type":"array","description":"List of attributes.","items":{"x-anyOf":[{"$ref":"#\/definitions\/attributeBoolean"},{"$ref":"#\/definitions\/attributeInteger"},{"$ref":"#\/definitions\/attributeFloat"},{"$ref":"#\/definitions\/attributeEmail"},{"$ref":"#\/definitions\/attributeEnum"},{"$ref":"#\/definitions\/attributeUrl"},{"$ref":"#\/definitions\/attributeIp"},{"$ref":"#\/definitions\/attributeString"}]},"x-example":""}},"required":["sum","attributes"]},"attributeString":{"description":"AttributeString","type":"object","properties":{"key":{"type":"string","description":"Attribute Key.","x-example":"fullName"},"type":{"type":"string","description":"Attribute type.","x-example":"string"},"status":{"type":"string","description":"Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed`","x-example":"available"},"required":{"type":"boolean","description":"Is attribute required?","x-example":true},"array":{"type":"boolean","description":"Is attribute an array?","x-example":false,"x-nullable":true},"size":{"type":"integer","description":"Attribute size.","x-example":128,"format":"int32"},"default":{"type":"string","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","x-example":"default","x-nullable":true}},"required":["key","type","status","required","size"]},"attributeInteger":{"description":"AttributeInteger","type":"object","properties":{"key":{"type":"string","description":"Attribute Key.","x-example":"fullName"},"type":{"type":"string","description":"Attribute type.","x-example":"string"},"status":{"type":"string","description":"Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed`","x-example":"available"},"required":{"type":"boolean","description":"Is attribute required?","x-example":true},"array":{"type":"boolean","description":"Is attribute an array?","x-example":false,"x-nullable":true},"min":{"type":"integer","description":"Minimum value to enforce for new documents.","x-example":1,"format":"int32","x-nullable":true},"max":{"type":"integer","description":"Maximum value to enforce for new documents.","x-example":10,"format":"int32","x-nullable":true},"default":{"type":"integer","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","x-example":10,"format":"int32","x-nullable":true}},"required":["key","type","status","required"]},"attributeFloat":{"description":"AttributeFloat","type":"object","properties":{"key":{"type":"string","description":"Attribute Key.","x-example":"fullName"},"type":{"type":"string","description":"Attribute type.","x-example":"string"},"status":{"type":"string","description":"Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed`","x-example":"available"},"required":{"type":"boolean","description":"Is attribute required?","x-example":true},"array":{"type":"boolean","description":"Is attribute an array?","x-example":false,"x-nullable":true},"min":{"type":"number","description":"Minimum value to enforce for new documents.","x-example":1.5,"format":"double","x-nullable":true},"max":{"type":"number","description":"Maximum value to enforce for new documents.","x-example":10.5,"format":"double","x-nullable":true},"default":{"type":"number","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","x-example":2.5,"format":"double","x-nullable":true}},"required":["key","type","status","required"]},"attributeBoolean":{"description":"AttributeBoolean","type":"object","properties":{"key":{"type":"string","description":"Attribute Key.","x-example":"fullName"},"type":{"type":"string","description":"Attribute type.","x-example":"string"},"status":{"type":"string","description":"Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed`","x-example":"available"},"required":{"type":"boolean","description":"Is attribute required?","x-example":true},"array":{"type":"boolean","description":"Is attribute an array?","x-example":false,"x-nullable":true},"default":{"type":"boolean","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","x-example":false,"x-nullable":true}},"required":["key","type","status","required"]},"attributeEmail":{"description":"AttributeEmail","type":"object","properties":{"key":{"type":"string","description":"Attribute Key.","x-example":"fullName"},"type":{"type":"string","description":"Attribute type.","x-example":"string"},"status":{"type":"string","description":"Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed`","x-example":"available"},"required":{"type":"boolean","description":"Is attribute required?","x-example":true},"array":{"type":"boolean","description":"Is attribute an array?","x-example":false,"x-nullable":true},"format":{"type":"string","description":"String format.","x-example":"email"},"default":{"type":"string","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","x-example":"default@example.com","x-nullable":true}},"required":["key","type","status","required","format"]},"attributeEnum":{"description":"AttributeEnum","type":"object","properties":{"key":{"type":"string","description":"Attribute Key.","x-example":"fullName"},"type":{"type":"string","description":"Attribute type.","x-example":"string"},"status":{"type":"string","description":"Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed`","x-example":"available"},"required":{"type":"boolean","description":"Is attribute required?","x-example":true},"array":{"type":"boolean","description":"Is attribute an array?","x-example":false,"x-nullable":true},"elements":{"type":"array","description":"Array of elements in enumerated type.","items":{"type":"string"},"x-example":"element"},"format":{"type":"string","description":"String format.","x-example":"enum"},"default":{"type":"string","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","x-example":"element","x-nullable":true}},"required":["key","type","status","required","elements","format"]},"attributeIp":{"description":"AttributeIP","type":"object","properties":{"key":{"type":"string","description":"Attribute Key.","x-example":"fullName"},"type":{"type":"string","description":"Attribute type.","x-example":"string"},"status":{"type":"string","description":"Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed`","x-example":"available"},"required":{"type":"boolean","description":"Is attribute required?","x-example":true},"array":{"type":"boolean","description":"Is attribute an array?","x-example":false,"x-nullable":true},"format":{"type":"string","description":"String format.","x-example":"ip"},"default":{"type":"string","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","x-example":"192.0.2.0","x-nullable":true}},"required":["key","type","status","required","format"]},"attributeUrl":{"description":"AttributeURL","type":"object","properties":{"key":{"type":"string","description":"Attribute Key.","x-example":"fullName"},"type":{"type":"string","description":"Attribute type.","x-example":"string"},"status":{"type":"string","description":"Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed`","x-example":"available"},"required":{"type":"boolean","description":"Is attribute required?","x-example":true},"array":{"type":"boolean","description":"Is attribute an array?","x-example":false,"x-nullable":true},"format":{"type":"string","description":"String format.","x-example":"url"},"default":{"type":"string","description":"Default value for attribute when not provided. Cannot be set when attribute is required.","x-example":"http:\/\/example.com","x-nullable":true}},"required":["key","type","status","required","format"]},"index":{"description":"Index","type":"object","properties":{"key":{"type":"string","description":"Index Key.","x-example":"index1"},"type":{"type":"string","description":"Index type.","x-example":"primary"},"status":{"type":"string","description":"Index status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed`","x-example":"available"},"attributes":{"type":"array","description":"Index attributes.","items":{"type":"string"},"x-example":[]},"orders":{"type":"array","description":"Index orders.","items":{"type":"string"},"x-example":[]}},"required":["key","type","status","attributes","orders"]},"document":{"description":"Document","type":"object","properties":{"$id":{"type":"string","description":"Document ID.","x-example":"5e5ea5c16897e"},"$collection":{"type":"string","description":"Collection ID.","x-example":"5e5ea5c15117e"},"$read":{"type":"array","description":"Document read permissions.","items":{"type":"string"},"x-example":"role:all"},"$write":{"type":"array","description":"Document write permissions.","items":{"type":"string"},"x-example":"user:608f9da25e7e1"}},"additionalProperties":true,"required":["$id","$collection","$read","$write"]},"log":{"description":"Log","type":"object","properties":{"event":{"type":"string","description":"Event name.","x-example":"account.sessions.create"},"userId":{"type":"string","description":"User ID.","x-example":"610fc2f985ee0"},"userEmail":{"type":"string","description":"User Email.","x-example":"john@appwrite.io"},"userName":{"type":"string","description":"User Name.","x-example":"John Doe"},"mode":{"type":"string","description":"API mode when event triggered.","x-example":"admin"},"ip":{"type":"string","description":"IP session in use when the session was created.","x-example":"127.0.0.1"},"time":{"type":"integer","description":"Log creation time in Unix timestamp.","x-example":1592981250,"format":"int32"},"osCode":{"type":"string","description":"Operating system code name. View list of [available options](https:\/\/github.com\/appwrite\/appwrite\/blob\/master\/docs\/lists\/os.json).","x-example":"Mac"},"osName":{"type":"string","description":"Operating system name.","x-example":"Mac"},"osVersion":{"type":"string","description":"Operating system version.","x-example":"Mac"},"clientType":{"type":"string","description":"Client type.","x-example":"browser"},"clientCode":{"type":"string","description":"Client code name. View list of [available options](https:\/\/github.com\/appwrite\/appwrite\/blob\/master\/docs\/lists\/clients.json).","x-example":"CM"},"clientName":{"type":"string","description":"Client name.","x-example":"Chrome Mobile iOS"},"clientVersion":{"type":"string","description":"Client version.","x-example":"84.0"},"clientEngine":{"type":"string","description":"Client engine name.","x-example":"WebKit"},"clientEngineVersion":{"type":"string","description":"Client engine name.","x-example":"605.1.15"},"deviceName":{"type":"string","description":"Device name.","x-example":"smartphone"},"deviceBrand":{"type":"string","description":"Device brand name.","x-example":"Google"},"deviceModel":{"type":"string","description":"Device model name.","x-example":"Nexus 5"},"countryCode":{"type":"string","description":"Country two-character ISO 3166-1 alpha code.","x-example":"US"},"countryName":{"type":"string","description":"Country name.","x-example":"United States"}},"required":["event","userId","userEmail","userName","mode","ip","time","osCode","osName","osVersion","clientType","clientCode","clientName","clientVersion","clientEngine","clientEngineVersion","deviceName","deviceBrand","deviceModel","countryCode","countryName"]},"user":{"description":"User","type":"object","properties":{"$id":{"type":"string","description":"User ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"User name.","x-example":"John Doe"},"registration":{"type":"integer","description":"User registration date in Unix timestamp.","x-example":1592981250,"format":"int32"},"status":{"type":"boolean","description":"User status. Pass `true` for enabled and `false` for disabled.","x-example":true},"passwordUpdate":{"type":"integer","description":"Unix timestamp of the most recent password update","x-example":1592981250,"format":"int32"},"email":{"type":"string","description":"User email address.","x-example":"john@appwrite.io"},"emailVerification":{"type":"boolean","description":"Email verification status.","x-example":true},"prefs":{"type":"object","description":"User preferences as a key-value object","x-example":{"theme":"pink","timezone":"UTC"},"items":{"type":"object","$ref":"#\/definitions\/preferences"}}},"required":["$id","name","registration","status","passwordUpdate","email","emailVerification","prefs"]},"preferences":{"description":"Preferences","type":"object","additionalProperties":true},"session":{"description":"Session","type":"object","properties":{"$id":{"type":"string","description":"Session ID.","x-example":"5e5ea5c16897e"},"userId":{"type":"string","description":"User ID.","x-example":"5e5bb8c16897e"},"expire":{"type":"integer","description":"Session expiration date in Unix timestamp.","x-example":1592981250,"format":"int32"},"provider":{"type":"string","description":"Session Provider.","x-example":"email"},"providerUid":{"type":"string","description":"Session Provider User ID.","x-example":"user@example.com"},"providerAccessToken":{"type":"string","description":"Session Provider Access Token.","x-example":"MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3"},"providerAccessTokenExpiry":{"type":"integer","description":"Date, the Unix timestamp of when the access token expires.","x-example":1592981250,"format":"int32"},"providerRefreshToken":{"type":"string","description":"Session Provider Refresh Token.","x-example":"MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3"},"ip":{"type":"string","description":"IP in use when the session was created.","x-example":"127.0.0.1"},"osCode":{"type":"string","description":"Operating system code name. View list of [available options](https:\/\/github.com\/appwrite\/appwrite\/blob\/master\/docs\/lists\/os.json).","x-example":"Mac"},"osName":{"type":"string","description":"Operating system name.","x-example":"Mac"},"osVersion":{"type":"string","description":"Operating system version.","x-example":"Mac"},"clientType":{"type":"string","description":"Client type.","x-example":"browser"},"clientCode":{"type":"string","description":"Client code name. View list of [available options](https:\/\/github.com\/appwrite\/appwrite\/blob\/master\/docs\/lists\/clients.json).","x-example":"CM"},"clientName":{"type":"string","description":"Client name.","x-example":"Chrome Mobile iOS"},"clientVersion":{"type":"string","description":"Client version.","x-example":"84.0"},"clientEngine":{"type":"string","description":"Client engine name.","x-example":"WebKit"},"clientEngineVersion":{"type":"string","description":"Client engine name.","x-example":"605.1.15"},"deviceName":{"type":"string","description":"Device name.","x-example":"smartphone"},"deviceBrand":{"type":"string","description":"Device brand name.","x-example":"Google"},"deviceModel":{"type":"string","description":"Device model name.","x-example":"Nexus 5"},"countryCode":{"type":"string","description":"Country two-character ISO 3166-1 alpha code.","x-example":"US"},"countryName":{"type":"string","description":"Country name.","x-example":"United States"},"current":{"type":"boolean","description":"Returns true if this the current user session.","x-example":true}},"required":["$id","userId","expire","provider","providerUid","providerAccessToken","providerAccessTokenExpiry","providerRefreshToken","ip","osCode","osName","osVersion","clientType","clientCode","clientName","clientVersion","clientEngine","clientEngineVersion","deviceName","deviceBrand","deviceModel","countryCode","countryName","current"]},"token":{"description":"Token","type":"object","properties":{"$id":{"type":"string","description":"Token ID.","x-example":"bb8ea5c16897e"},"userId":{"type":"string","description":"User ID.","x-example":"5e5ea5c168bb8"},"secret":{"type":"string","description":"Token secret key. This will return an empty string unless the response is returned using an API key or as part of a webhook payload.","x-example":""},"expire":{"type":"integer","description":"Token expiration date in Unix timestamp.","x-example":1592981250,"format":"int32"}},"required":["$id","userId","secret","expire"]},"jwt":{"description":"JWT","type":"object","properties":{"jwt":{"type":"string","description":"JWT encoded string.","x-example":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"}},"required":["jwt"]},"locale":{"description":"Locale","type":"object","properties":{"ip":{"type":"string","description":"User IP address.","x-example":"127.0.0.1"},"countryCode":{"type":"string","description":"Country code in [ISO 3166-1](http:\/\/en.wikipedia.org\/wiki\/ISO_3166-1) two-character format","x-example":"US"},"country":{"type":"string","description":"Country name. This field support localization.","x-example":"United States"},"continentCode":{"type":"string","description":"Continent code. A two character continent code \"AF\" for Africa, \"AN\" for Antarctica, \"AS\" for Asia, \"EU\" for Europe, \"NA\" for North America, \"OC\" for Oceania, and \"SA\" for South America.","x-example":"NA"},"continent":{"type":"string","description":"Continent name. This field support localization.","x-example":"North America"},"eu":{"type":"boolean","description":"True if country is part of the Europian Union.","x-example":false},"currency":{"type":"string","description":"Currency code in [ISO 4217-1](http:\/\/en.wikipedia.org\/wiki\/ISO_4217) three-character format","x-example":"USD"}},"required":["ip","countryCode","country","continentCode","continent","eu","currency"]},"file":{"description":"File","type":"object","properties":{"$id":{"type":"string","description":"File ID.","x-example":"5e5ea5c16897e"},"bucketId":{"type":"string","description":"Bucket ID.","x-example":"5e5ea5c16897e"},"$read":{"type":"array","description":"File read permissions.","items":{"type":"string"},"x-example":"role:all"},"$write":{"type":"array","description":"File write permissions.","items":{"type":"string"},"x-example":"user:608f9da25e7e1"},"name":{"type":"string","description":"File name.","x-example":"Pink.png"},"dateCreated":{"type":"integer","description":"File creation date in Unix timestamp.","x-example":1592981250,"format":"int32"},"signature":{"type":"string","description":"File MD5 signature.","x-example":"5d529fd02b544198ae075bd57c1762bb"},"mimeType":{"type":"string","description":"File mime type.","x-example":"image\/png"},"sizeOriginal":{"type":"integer","description":"File original size in bytes.","x-example":17890,"format":"int32"},"chunksTotal":{"type":"integer","description":"Total number of chunks available","x-example":17890,"format":"int32"},"chunksUploaded":{"type":"integer","description":"Total number of chunks uploaded","x-example":17890,"format":"int32"}},"required":["$id","bucketId","$read","$write","name","dateCreated","signature","mimeType","sizeOriginal","chunksTotal","chunksUploaded"]},"bucket":{"description":"Bucket","type":"object","properties":{"$id":{"type":"string","description":"Bucket ID.","x-example":"5e5ea5c16897e"},"$read":{"type":"array","description":"File read permissions.","items":{"type":"string"},"x-example":["role:all"]},"$write":{"type":"array","description":"File write permissions.","items":{"type":"string"},"x-example":["user:608f9da25e7e1"]},"permission":{"type":"string","description":"Bucket permission model. Possible values: `bucket` or `file`","x-example":"file"},"dateCreated":{"type":"integer","description":"Bucket creation date in Unix timestamp.","x-example":1592981250,"format":"int32"},"dateUpdated":{"type":"integer","description":"Bucket update date in Unix timestamp.","x-example":1592981250,"format":"int32"},"name":{"type":"string","description":"Bucket name.","x-example":"Documents"},"enabled":{"type":"boolean","description":"Bucket enabled.","x-example":false},"maximumFileSize":{"type":"integer","description":"Maximum file size supported.","x-example":100,"format":"int32"},"allowedFileExtensions":{"type":"array","description":"Allowed file extensions.","items":{"type":"string"},"x-example":["jpg","png"]},"encryption":{"type":"boolean","description":"Bucket is encrypted.","x-example":false},"antivirus":{"type":"boolean","description":"Virus scanning is enabled.","x-example":false}},"required":["$id","$read","$write","permission","dateCreated","dateUpdated","name","enabled","maximumFileSize","allowedFileExtensions","encryption","antivirus"]},"team":{"description":"Team","type":"object","properties":{"$id":{"type":"string","description":"Team ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"Team name.","x-example":"VIP"},"dateCreated":{"type":"integer","description":"Team creation date in Unix timestamp.","x-example":1592981250,"format":"int32"},"sum":{"type":"integer","description":"Total sum of team members.","x-example":7,"format":"int32"}},"required":["$id","name","dateCreated","sum"]},"membership":{"description":"Membership","type":"object","properties":{"$id":{"type":"string","description":"Membership ID.","x-example":"5e5ea5c16897e"},"userId":{"type":"string","description":"User ID.","x-example":"5e5ea5c16897e"},"teamId":{"type":"string","description":"Team ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"User name.","x-example":"VIP"},"email":{"type":"string","description":"User email address.","x-example":"john@appwrite.io"},"invited":{"type":"integer","description":"Date, the user has been invited to join the team in Unix timestamp.","x-example":1592981250,"format":"int32"},"joined":{"type":"integer","description":"Date, the user has accepted the invitation to join the team in Unix timestamp.","x-example":1592981250,"format":"int32"},"confirm":{"type":"boolean","description":"User confirmation status, true if the user has joined the team or false otherwise.","x-example":false},"roles":{"type":"array","description":"User list of roles","items":{"type":"string"},"x-example":"admin"}},"required":["$id","userId","teamId","name","email","invited","joined","confirm","roles"]},"function":{"description":"Function","type":"object","properties":{"$id":{"type":"string","description":"Function ID.","x-example":"5e5ea5c16897e"},"execute":{"type":"array","description":"Execution permissions.","items":{"type":"string"},"x-example":"role:member"},"name":{"type":"string","description":"Function name.","x-example":"My Function"},"dateCreated":{"type":"integer","description":"Function creation date in Unix timestamp.","x-example":1592981250,"format":"int32"},"dateUpdated":{"type":"integer","description":"Function update date in Unix timestamp.","x-example":1592981257,"format":"int32"},"status":{"type":"string","description":"Function status. Possible values: `disabled`, `enabled`","x-example":"enabled"},"runtime":{"type":"string","description":"Function execution runtime.","x-example":"python-3.8"},"deployment":{"type":"string","description":"Function's active deployment ID.","x-example":"5e5ea5c16897e"},"vars":{"type":"object","description":"Function environment variables.","x-example":{"key":"value"}},"events":{"type":"array","description":"Function trigger events.","items":{"type":"string"},"x-example":"account.create"},"schedule":{"type":"string","description":"Function execution schedult in CRON format.","x-example":"5 4 * * *"},"scheduleNext":{"type":"integer","description":"Function next scheduled execution date in Unix timestamp.","x-example":1592981292,"format":"int32"},"schedulePrevious":{"type":"integer","description":"Function next scheduled execution date in Unix timestamp.","x-example":1592981237,"format":"int32"},"timeout":{"type":"integer","description":"Function execution timeout in seconds.","x-example":1592981237,"format":"int32"}},"required":["$id","execute","name","dateCreated","dateUpdated","status","runtime","deployment","vars","events","schedule","scheduleNext","schedulePrevious","timeout"]},"runtime":{"description":"Runtime","type":"object","properties":{"$id":{"type":"string","description":"Runtime ID.","x-example":"python-3.8"},"name":{"type":"string","description":"Runtime Name.","x-example":"Python"},"version":{"type":"string","description":"Runtime version.","x-example":"3.8"},"base":{"type":"string","description":"Base Docker image used to build the runtime.","x-example":"python:3.8-alpine"},"image":{"type":"string","description":"Image name of Docker Hub.","x-example":"appwrite\\\/runtime-for-python:3.8"},"logo":{"type":"string","description":"Name of the logo image.","x-example":"python.png"},"supports":{"type":"array","description":"List of supported architectures.","items":{"type":"string"},"x-example":"amd64"}},"required":["$id","name","version","base","image","logo","supports"]},"deployment":{"description":"Deployment","type":"object","properties":{"$id":{"type":"string","description":"Deployment ID.","x-example":"5e5ea5c16897e"},"resourceId":{"type":"string","description":"Resource ID.","x-example":"5e5ea6g16897e"},"resourceType":{"type":"string","description":"Resource type.","x-example":"functions"},"dateCreated":{"type":"integer","description":"The deployment creation date in Unix timestamp.","x-example":1592981250,"format":"int32"},"entrypoint":{"type":"string","description":"The entrypoint file to use to execute the deployment code.","x-example":"enabled"},"size":{"type":"integer","description":"The code size in bytes.","x-example":128,"format":"int32"},"buildId":{"type":"string","description":"The current build ID.","x-example":"5e5ea5c16897e"},"activate":{"type":"boolean","description":"Whether the deployment should be automatically activated.","x-example":true},"status":{"type":"string","description":"The deployment status.","x-example":"enabled"},"buildStdout":{"type":"string","description":"The build stdout.","x-example":"enabled"},"buildStderr":{"type":"string","description":"The build stderr.","x-example":"enabled"}},"required":["$id","resourceId","resourceType","dateCreated","entrypoint","size","buildId","activate","status","buildStdout","buildStderr"]},"execution":{"description":"Execution","type":"object","properties":{"$id":{"type":"string","description":"Execution ID.","x-example":"5e5ea5c16897e"},"$read":{"type":"array","description":"Execution read permissions.","items":{"type":"string"},"x-example":"role:all"},"functionId":{"type":"string","description":"Function ID.","x-example":"5e5ea6g16897e"},"dateCreated":{"type":"integer","description":"The execution creation date in Unix timestamp.","x-example":1592981250,"format":"int32"},"trigger":{"type":"string","description":"The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`.","x-example":"http"},"status":{"type":"string","description":"The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`.","x-example":"processing"},"statusCode":{"type":"integer","description":"The script status code.","x-example":0,"format":"int32"},"stdout":{"type":"string","description":"The script stdout output string. Logs the last 4,000 characters of the execution stdout output.","x-example":""},"stderr":{"type":"string","description":"The script stderr output string. Logs the last 4,000 characters of the execution stderr output","x-example":""},"time":{"type":"number","description":"The script execution time in seconds.","x-example":0.4,"format":"double"}},"required":["$id","$read","functionId","dateCreated","trigger","status","statusCode","stdout","stderr","time"]},"project":{"description":"Project","type":"object","properties":{"$id":{"type":"string","description":"Project ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"Project name.","x-example":"New Project"},"description":{"type":"string","description":"Project description.","x-example":"This is a new project."},"teamId":{"type":"string","description":"Project team ID.","x-example":"1592981250"},"logo":{"type":"string","description":"Project logo file ID.","x-example":"5f5c451b403cb"},"url":{"type":"string","description":"Project website URL.","x-example":"5f5c451b403cb"},"legalName":{"type":"string","description":"Company legal name.","x-example":"Company LTD."},"legalCountry":{"type":"string","description":"Country code in [ISO 3166-1](http:\/\/en.wikipedia.org\/wiki\/ISO_3166-1) two-character format.","x-example":"US"},"legalState":{"type":"string","description":"State name.","x-example":"New York"},"legalCity":{"type":"string","description":"City name.","x-example":"New York City."},"legalAddress":{"type":"string","description":"Company Address.","x-example":"620 Eighth Avenue, New York, NY 10018"},"legalTaxId":{"type":"string","description":"Company Tax ID.","x-example":"131102020"},"authLimit":{"type":"integer","description":"Max users allowed. 0 is unlimited.","x-example":100,"format":"int32"},"platforms":{"type":"array","description":"List of Platforms.","items":{"type":"object","$ref":"#\/definitions\/platform"},"x-example":{}},"webhooks":{"type":"array","description":"List of Webhooks.","items":{"type":"object","$ref":"#\/definitions\/webhook"},"x-example":{}},"keys":{"type":"array","description":"List of API Keys.","items":{"type":"object","$ref":"#\/definitions\/key"},"x-example":{}},"domains":{"type":"array","description":"List of Domains.","items":{"type":"object","$ref":"#\/definitions\/domain"},"x-example":{}},"providerAmazonAppid":{"type":"string","description":"Amazon OAuth app ID.","x-example":"123247283472834787438"},"providerAmazonSecret":{"type":"string","description":"Amazon OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerAppleAppid":{"type":"string","description":"Apple OAuth app ID.","x-example":"123247283472834787438"},"providerAppleSecret":{"type":"string","description":"Apple OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerBitbucketAppid":{"type":"string","description":"BitBucket OAuth app ID.","x-example":"123247283472834787438"},"providerBitbucketSecret":{"type":"string","description":"BitBucket OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerBitlyAppid":{"type":"string","description":"Bitly OAuth app ID.","x-example":"123247283472834787438"},"providerBitlySecret":{"type":"string","description":"Bitly OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerBoxAppid":{"type":"string","description":"Box OAuth app ID.","x-example":"123247283472834787438"},"providerBoxSecret":{"type":"string","description":"Box OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerDiscordAppid":{"type":"string","description":"Discord OAuth app ID.","x-example":"123247283472834787438"},"providerDiscordSecret":{"type":"string","description":"Discord OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerDropboxAppid":{"type":"string","description":"Dropbox OAuth app ID.","x-example":"123247283472834787438"},"providerDropboxSecret":{"type":"string","description":"Dropbox OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerFacebookAppid":{"type":"string","description":"Facebook OAuth app ID.","x-example":"123247283472834787438"},"providerFacebookSecret":{"type":"string","description":"Facebook OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerGithubAppid":{"type":"string","description":"GitHub OAuth app ID.","x-example":"123247283472834787438"},"providerGithubSecret":{"type":"string","description":"GitHub OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerGitlabAppid":{"type":"string","description":"GitLab OAuth app ID.","x-example":"123247283472834787438"},"providerGitlabSecret":{"type":"string","description":"GitLab OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerGoogleAppid":{"type":"string","description":"Google OAuth app ID.","x-example":"123247283472834787438"},"providerGoogleSecret":{"type":"string","description":"Google OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerLinkedinAppid":{"type":"string","description":"LinkedIn OAuth app ID.","x-example":"123247283472834787438"},"providerLinkedinSecret":{"type":"string","description":"LinkedIn OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerMicrosoftAppid":{"type":"string","description":"Microsoft OAuth app ID.","x-example":"123247283472834787438"},"providerMicrosoftSecret":{"type":"string","description":"Microsoft OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerNotionAppid":{"type":"string","description":"Notion OAuth app ID.","x-example":"123247283472834787438"},"providerNotionSecret":{"type":"string","description":"Notion OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerPaypalAppid":{"type":"string","description":"PayPal OAuth app ID.","x-example":"123247283472834787438"},"providerPaypalSecret":{"type":"string","description":"PayPal OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerPaypalSandboxAppid":{"type":"string","description":"PayPal OAuth app ID.","x-example":"123247283472834787438"},"providerPaypalSandboxSecret":{"type":"string","description":"PayPal OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerSalesforceAppid":{"type":"string","description":"Salesforce OAuth app ID.","x-example":"123247283472834787438"},"providerSalesforceSecret":{"type":"string","description":"Salesforce OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerSlackAppid":{"type":"string","description":"Slack OAuth app ID.","x-example":"123247283472834787438"},"providerSlackSecret":{"type":"string","description":"Slack OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerSpotifyAppid":{"type":"string","description":"Spotify OAuth app ID.","x-example":"123247283472834787438"},"providerSpotifySecret":{"type":"string","description":"Spotify OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerTradeshiftAppid":{"type":"string","description":"Tradeshift OAuth app ID.","x-example":"123247283472834787438"},"providerTradeshiftSecret":{"type":"string","description":"Tradeshift OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerTradeshiftBoxAppid":{"type":"string","description":"Tradeshift OAuth app ID.","x-example":"123247283472834787438"},"providerTradeshiftBoxSecret":{"type":"string","description":"Tradeshift OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerTwitchAppid":{"type":"string","description":"Twitch OAuth app ID.","x-example":"123247283472834787438"},"providerTwitchSecret":{"type":"string","description":"Twitch OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerVkAppid":{"type":"string","description":"VK OAuth app ID.","x-example":"123247283472834787438"},"providerVkSecret":{"type":"string","description":"VK OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerYahooAppid":{"type":"string","description":"Yahoo OAuth app ID.","x-example":"123247283472834787438"},"providerYahooSecret":{"type":"string","description":"Yahoo OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerYammerAppid":{"type":"string","description":"Yammer OAuth app ID.","x-example":"123247283472834787438"},"providerYammerSecret":{"type":"string","description":"Yammer OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerYandexAppid":{"type":"string","description":"Yandex OAuth app ID.","x-example":"123247283472834787438"},"providerYandexSecret":{"type":"string","description":"Yandex OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerWordpressAppid":{"type":"string","description":"WordPress OAuth app ID.","x-example":"123247283472834787438"},"providerWordpressSecret":{"type":"string","description":"WordPress OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerStripeAppid":{"type":"string","description":"Stripe OAuth app ID.","x-example":"123247283472834787438"},"providerStripeSecret":{"type":"string","description":"Stripe OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"providerMockAppid":{"type":"string","description":"Mock OAuth app ID.","x-example":"123247283472834787438"},"providerMockSecret":{"type":"string","description":"Mock OAuth secret ID.","x-example":"djsgudsdsewe43434343dd34..."},"authEmailPassword":{"type":"boolean","description":"Email\/Password auth method status","x-example":true},"authUsersAuthMagicURL":{"type":"boolean","description":"Magic URL auth method status","x-example":true},"authAnonymous":{"type":"boolean","description":"Anonymous auth method status","x-example":true},"authInvites":{"type":"boolean","description":"Invites auth method status","x-example":true},"authJWT":{"type":"boolean","description":"JWT auth method status","x-example":true},"authPhone":{"type":"boolean","description":"Phone auth method status","x-example":true},"serviceStatusForAccount":{"type":"boolean","description":"Account service status","x-example":true},"serviceStatusForAvatars":{"type":"boolean","description":"Avatars service status","x-example":true},"serviceStatusForDatabase":{"type":"boolean","description":"Database service status","x-example":true},"serviceStatusForLocale":{"type":"boolean","description":"Locale service status","x-example":true},"serviceStatusForHealth":{"type":"boolean","description":"Health service status","x-example":true},"serviceStatusForStorage":{"type":"boolean","description":"Storage service status","x-example":true},"serviceStatusForTeams":{"type":"boolean","description":"Teams service status","x-example":true},"serviceStatusForUsers":{"type":"boolean","description":"Users service status","x-example":true},"serviceStatusForFunctions":{"type":"boolean","description":"Functions service status","x-example":true}},"required":["$id","name","description","teamId","logo","url","legalName","legalCountry","legalState","legalCity","legalAddress","legalTaxId","authLimit","platforms","webhooks","keys","domains","providerAmazonAppid","providerAmazonSecret","providerAppleAppid","providerAppleSecret","providerBitbucketAppid","providerBitbucketSecret","providerBitlyAppid","providerBitlySecret","providerBoxAppid","providerBoxSecret","providerDiscordAppid","providerDiscordSecret","providerDropboxAppid","providerDropboxSecret","providerFacebookAppid","providerFacebookSecret","providerGithubAppid","providerGithubSecret","providerGitlabAppid","providerGitlabSecret","providerGoogleAppid","providerGoogleSecret","providerLinkedinAppid","providerLinkedinSecret","providerMicrosoftAppid","providerMicrosoftSecret","providerNotionAppid","providerNotionSecret","providerPaypalAppid","providerPaypalSecret","providerPaypalSandboxAppid","providerPaypalSandboxSecret","providerSalesforceAppid","providerSalesforceSecret","providerSlackAppid","providerSlackSecret","providerSpotifyAppid","providerSpotifySecret","providerTradeshiftAppid","providerTradeshiftSecret","providerTradeshiftBoxAppid","providerTradeshiftBoxSecret","providerTwitchAppid","providerTwitchSecret","providerVkAppid","providerVkSecret","providerYahooAppid","providerYahooSecret","providerYammerAppid","providerYammerSecret","providerYandexAppid","providerYandexSecret","providerWordpressAppid","providerWordpressSecret","providerStripeAppid","providerStripeSecret","providerMockAppid","providerMockSecret","authEmailPassword","authUsersAuthMagicURL","authAnonymous","authInvites","authJWT","authPhone","serviceStatusForAccount","serviceStatusForAvatars","serviceStatusForDatabase","serviceStatusForLocale","serviceStatusForHealth","serviceStatusForStorage","serviceStatusForTeams","serviceStatusForUsers","serviceStatusForFunctions"]},"webhook":{"description":"Webhook","type":"object","properties":{"$id":{"type":"string","description":"Webhook ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"Webhook name.","x-example":"My Webhook"},"url":{"type":"string","description":"Webhook URL endpoint.","x-example":"https:\/\/example.com\/webhook"},"events":{"type":"array","description":"Webhook trigger events.","items":{"type":"string"},"x-example":"database.collections.update"},"security":{"type":"boolean","description":"Indicated if SSL \/ TLS Certificate verification is enabled.","x-example":true},"httpUser":{"type":"string","description":"HTTP basic authentication username.","x-example":"username"},"httpPass":{"type":"string","description":"HTTP basic authentication password.","x-example":"password"}},"required":["$id","name","url","events","security","httpUser","httpPass"]},"key":{"description":"Key","type":"object","properties":{"$id":{"type":"string","description":"Key ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"Key name.","x-example":"My API Key"},"scopes":{"type":"array","description":"Allowed permission scopes.","items":{"type":"string"},"x-example":"users.read"},"secret":{"type":"string","description":"Secret key.","x-example":"919c2d18fb5d4...a2ae413da83346ad2"}},"required":["$id","name","scopes","secret"]},"domain":{"description":"Domain","type":"object","properties":{"$id":{"type":"string","description":"Domain ID.","x-example":"5e5ea5c16897e"},"domain":{"type":"string","description":"Domain name.","x-example":"appwrite.company.com"},"registerable":{"type":"string","description":"Registerable domain name.","x-example":"company.com"},"tld":{"type":"string","description":"TLD name.","x-example":"com"},"verification":{"type":"boolean","description":"Verification process status.","x-example":true},"certificateId":{"type":"string","description":"Certificate ID.","x-example":"6ejea5c13377e"}},"required":["$id","domain","registerable","tld","verification","certificateId"]},"platform":{"description":"Platform","type":"object","properties":{"$id":{"type":"string","description":"Platform ID.","x-example":"5e5ea5c16897e"},"name":{"type":"string","description":"Platform name.","x-example":"My Web App"},"type":{"type":"string","description":"Platform type. Possible values are: web, flutter-ios, flutter-android, ios, android, and unity.","x-example":"My Web App"},"key":{"type":"string","description":"Platform Key. iOS bundle ID or Android package name. Empty string for other platforms.","x-example":"com.company.appname"},"store":{"type":"string","description":"App store or Google Play store ID.","x-example":""},"hostname":{"type":"string","description":"Web app hostname. Empty string for other platforms.","x-example":true},"httpUser":{"type":"string","description":"HTTP basic authentication username.","x-example":"username"},"httpPass":{"type":"string","description":"HTTP basic authentication password.","x-example":"password"}},"required":["$id","name","type","key","store","hostname","httpUser","httpPass"]},"country":{"description":"Country","type":"object","properties":{"name":{"type":"string","description":"Country name.","x-example":"United States"},"code":{"type":"string","description":"Country two-character ISO 3166-1 alpha code.","x-example":"US"}},"required":["name","code"]},"continent":{"description":"Continent","type":"object","properties":{"name":{"type":"string","description":"Continent name.","x-example":"Europe"},"code":{"type":"string","description":"Continent two letter code.","x-example":"EU"}},"required":["name","code"]},"language":{"description":"Language","type":"object","properties":{"name":{"type":"string","description":"Language name.","x-example":"Italian"},"code":{"type":"string","description":"Language two-character ISO 639-1 codes.","x-example":"it"},"nativeName":{"type":"string","description":"Language native name.","x-example":"Italiano"}},"required":["name","code","nativeName"]},"currency":{"description":"Currency","type":"object","properties":{"symbol":{"type":"string","description":"Currency symbol.","x-example":"$"},"name":{"type":"string","description":"Currency name.","x-example":"US dollar"},"symbolNative":{"type":"string","description":"Currency native symbol.","x-example":"$"},"decimalDigits":{"type":"integer","description":"Number of decimal digits.","x-example":2,"format":"int32"},"rounding":{"type":"number","description":"Currency digit rounding.","x-example":0,"format":"double"},"code":{"type":"string","description":"Currency code in [ISO 4217-1](http:\/\/en.wikipedia.org\/wiki\/ISO_4217) three-character format.","x-example":"USD"},"namePlural":{"type":"string","description":"Currency plural name","x-example":"US dollars"}},"required":["symbol","name","symbolNative","decimalDigits","rounding","code","namePlural"]},"phone":{"description":"Phone","type":"object","properties":{"code":{"type":"string","description":"Phone code.","x-example":"+1"},"countryCode":{"type":"string","description":"Country two-character ISO 3166-1 alpha code.","x-example":"US"},"countryName":{"type":"string","description":"Country name.","x-example":"United States"}},"required":["code","countryCode","countryName"]},"healthAntivirus":{"description":"Health Antivirus","type":"object","properties":{"version":{"type":"string","description":"Antivirus version.","x-example":"1.0.0"},"status":{"type":"string","description":"Antivirus status. Possible values can are: `disabled`, `offline`, `online`","x-example":"online"}},"required":["version","status"]},"healthQueue":{"description":"Health Queue","type":"object","properties":{"size":{"type":"integer","description":"Amount of actions in the queue.","x-example":8,"format":"int32"}},"required":["size"]},"healthStatus":{"description":"Health Status","type":"object","properties":{"ping":{"type":"integer","description":"Duration in milliseconds how long the health check took.","x-example":128,"format":"int32"},"status":{"type":"string","description":"Service status. Possible values can are: `pass`, `fail`","x-example":"pass"}},"required":["ping","status"]},"healthTime":{"description":"Health Time","type":"object","properties":{"remoteTime":{"type":"integer","description":"Current unix timestamp on trustful remote server.","x-example":1639490751,"format":"int32"},"localTime":{"type":"integer","description":"Current unix timestamp of local server where Appwrite runs.","x-example":1639490844,"format":"int32"},"diff":{"type":"integer","description":"Difference of unix remote and local timestamps in milliseconds.","x-example":93,"format":"int32"}},"required":["remoteTime","localTime","diff"]},"usageDatabase":{"description":"UsageDatabase","type":"object","properties":{"range":{"type":"string","description":"The time range of the usage stats.","x-example":"30d"},"documentsCount":{"type":"array","description":"Aggregated stats for total number of documents.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"collectionsCount":{"type":"array","description":"Aggregated stats for total number of collections.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"documentsCreate":{"type":"array","description":"Aggregated stats for documents created.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"documentsRead":{"type":"array","description":"Aggregated stats for documents read.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"documentsUpdate":{"type":"array","description":"Aggregated stats for documents updated.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"documentsDelete":{"type":"array","description":"Aggregated stats for documents deleted.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"collectionsCreate":{"type":"array","description":"Aggregated stats for collections created.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"collectionsRead":{"type":"array","description":"Aggregated stats for collections read.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"collectionsUpdate":{"type":"array","description":"Aggregated stats for collections updated.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"collectionsDelete":{"type":"array","description":"Aggregated stats for collections delete.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}}},"required":["range","documentsCount","collectionsCount","documentsCreate","documentsRead","documentsUpdate","documentsDelete","collectionsCreate","collectionsRead","collectionsUpdate","collectionsDelete"]},"usageCollection":{"description":"UsageCollection","type":"object","properties":{"range":{"type":"string","description":"The time range of the usage stats.","x-example":"30d"},"documentsCount":{"type":"array","description":"Aggregated stats for total number of documents.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"documentsCreate":{"type":"array","description":"Aggregated stats for documents created.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"documentsRead":{"type":"array","description":"Aggregated stats for documents read.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"documentsUpdate":{"type":"array","description":"Aggregated stats for documents updated.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"documentsDelete":{"type":"array","description":"Aggregated stats for documents deleted.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}}},"required":["range","documentsCount","documentsCreate","documentsRead","documentsUpdate","documentsDelete"]},"usageUsers":{"description":"UsageUsers","type":"object","properties":{"range":{"type":"string","description":"The time range of the usage stats.","x-example":"30d"},"usersCount":{"type":"array","description":"Aggregated stats for total number of users.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"usersCreate":{"type":"array","description":"Aggregated stats for users created.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"usersRead":{"type":"array","description":"Aggregated stats for users read.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"usersUpdate":{"type":"array","description":"Aggregated stats for users updated.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"usersDelete":{"type":"array","description":"Aggregated stats for users deleted.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"sessionsCreate":{"type":"array","description":"Aggregated stats for sessions created.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"sessionsProviderCreate":{"type":"array","description":"Aggregated stats for sessions created for a provider ( email, anonymous or oauth2 ).","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"sessionsDelete":{"type":"array","description":"Aggregated stats for sessions deleted.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}}},"required":["range","usersCount","usersCreate","usersRead","usersUpdate","usersDelete","sessionsCreate","sessionsProviderCreate","sessionsDelete"]},"usageStorage":{"description":"StorageUsage","type":"object","properties":{"range":{"type":"string","description":"The time range of the usage stats.","x-example":"30d"},"filesStorage":{"type":"array","description":"Aggregated stats for the occupied storage size by files (in bytes).","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"tagsStorage":{"type":"array","description":"Aggregated stats for the occupied storage size by tags (in bytes).","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"filesCount":{"type":"array","description":"Aggregated stats for total number of files.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"bucketsCount":{"type":"array","description":"Aggregated stats for total number of buckets.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"bucketsCreate":{"type":"array","description":"Aggregated stats for buckets created.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"bucketsRead":{"type":"array","description":"Aggregated stats for buckets read.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"bucketsUpdate":{"type":"array","description":"Aggregated stats for buckets updated.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"bucketsDelete":{"type":"array","description":"Aggregated stats for buckets deleted.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"filesCreate":{"type":"array","description":"Aggregated stats for files created.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"filesRead":{"type":"array","description":"Aggregated stats for files read.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"filesUpdate":{"type":"array","description":"Aggregated stats for files updated.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"filesDelete":{"type":"array","description":"Aggregated stats for files deleted.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}}},"required":["range","filesStorage","tagsStorage","filesCount","bucketsCount","bucketsCreate","bucketsRead","bucketsUpdate","bucketsDelete","filesCreate","filesRead","filesUpdate","filesDelete"]},"usageBuckets":{"description":"UsageBuckets","type":"object","properties":{"range":{"type":"string","description":"The time range of the usage stats.","x-example":"30d"},"filesCount":{"type":"array","description":"Aggregated stats for total number of files in this bucket.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"filesStorage":{"type":"array","description":"Aggregated stats for total storage of files in this bucket.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"filesCreate":{"type":"array","description":"Aggregated stats for files created.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"filesRead":{"type":"array","description":"Aggregated stats for files read.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"filesUpdate":{"type":"array","description":"Aggregated stats for files updated.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"filesDelete":{"type":"array","description":"Aggregated stats for files deleted.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}}},"required":["range","filesCount","filesStorage","filesCreate","filesRead","filesUpdate","filesDelete"]},"usageFunctions":{"description":"UsageFunctions","type":"object","properties":{"range":{"type":"string","description":"The time range of the usage stats.","x-example":"30d"},"functionsExecutions":{"type":"array","description":"Aggregated stats for function executions.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"functionsFailures":{"type":"array","description":"Aggregated stats for function execution failures.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"functionsCompute":{"type":"array","description":"Aggregated stats for function execution duration.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}}},"required":["range","functionsExecutions","functionsFailures","functionsCompute"]},"usageProject":{"description":"UsageProject","type":"object","properties":{"range":{"type":"string","description":"The time range of the usage stats.","x-example":"30d"},"requests":{"type":"array","description":"Aggregated stats for number of requests.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"network":{"type":"array","description":"Aggregated stats for consumed bandwidth.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"functions":{"type":"array","description":"Aggregated stats for function executions.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"documents":{"type":"array","description":"Aggregated stats for number of documents.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"collections":{"type":"array","description":"Aggregated stats for number of collections.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"users":{"type":"array","description":"Aggregated stats for number of users.","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}},"storage":{"type":"array","description":"Aggregated stats for the occupied storage size (in bytes).","items":{"type":"object","$ref":"#\/definitions\/metricList"},"x-example":{}}},"required":["range","requests","network","functions","documents","collections","users","storage"]}},"externalDocs":{"description":"Full API docs, specs and tutorials","url":"https:\/\/appwrite.io\/docs"}} \ No newline at end of file diff --git a/src/SDK/Language.php b/src/SDK/Language.php index 9d902357f1..0a7a259f7a 100644 --- a/src/SDK/Language.php +++ b/src/SDK/Language.php @@ -2,15 +2,15 @@ namespace Appwrite\SDK; -abstract class Language { - - const TYPE_INTEGER = 'integer'; - const TYPE_NUMBER = 'number'; - const TYPE_STRING = 'string'; - const TYPE_BOOLEAN = 'boolean'; - const TYPE_ARRAY = 'array'; - const TYPE_OBJECT = 'object'; - const TYPE_FILE = 'file'; +abstract class Language +{ + public const TYPE_INTEGER = 'integer'; + public const TYPE_NUMBER = 'number'; + public const TYPE_STRING = 'string'; + public const TYPE_BOOLEAN = 'boolean'; + public const TYPE_ARRAY = 'array'; + public const TYPE_OBJECT = 'object'; + public const TYPE_FILE = 'file'; /** * @var array @@ -20,47 +20,47 @@ abstract class Language { /** * @return string */ - abstract public function getName(); + abstract public function getName(): string; /** - * @return array + * @return array */ - abstract public function getKeywords(); + abstract public function getKeywords(): array; /** - * @return array + * @return array */ - abstract public function getIdentifierOverrides(); + abstract public function getIdentifierOverrides(): array; /** - * @return array + * @return array */ - abstract public function getFiles(); + abstract public function getFiles(): array; /** - * @param $type + * @param array $parameter * @return string */ - abstract public function getTypeName($type); + abstract public function getTypeName(array $parameter): string; /** * @param array $param * @return string */ - abstract public function getParamDefault(array $param); + abstract public function getParamDefault(array $param): string; /** * @param array $param * @return string */ - abstract public function getParamExample(array $param); + abstract public function getParamExample(array $param): string; /** * @param string $key * @param string $value * @return Language */ - public function setParam($key, $value) + public function setParam(string $key, string $value): Language { $this->params[$key] = $value; @@ -70,8 +70,31 @@ public function setParam($key, $value) /** * @return array */ - public function getParams() + public function getParams(): array { return $this->params; } -} \ No newline at end of file + + /** + * Language specific filters. + * @return array + */ + public function getFilters(): array + { + return []; + } + + protected function toUpperCaseWords(string $value): string + { + return ucfirst($this->toCamelCase($value)); + } + + protected function toCamelCase($str): string + { + $str = preg_replace('/[^a-z0-9' . implode("", []) . ']+/i', ' ', $str); + $str = trim($str); + $str = ucwords($str); + $str = str_replace(" ", "", $str); + return lcfirst($str); + } +} diff --git a/src/SDK/Language/Android.php b/src/SDK/Language/Android.php index 06b67681a0..5d3e90bb06 100644 --- a/src/SDK/Language/Android.php +++ b/src/SDK/Language/Android.php @@ -2,13 +2,12 @@ namespace Appwrite\SDK\Language; - -class Android extends Kotlin { - +class Android extends Kotlin +{ /** * @return string */ - public function getName() + public function getName(): string { return 'Android'; } @@ -16,10 +15,10 @@ public function getName() /** * @return array */ - public function getFiles() + public function getFiles(): array { return [ - // Config for root project + // Config for root project [ 'scope' => 'copy', 'destination' => '.github/workflows/publish.yml', @@ -100,12 +99,27 @@ public function getFiles() 'destination' => 'settings.gradle', 'template' => '/android/settings.gradle', ], - // Config for project :library + // Config for project :library [ 'scope' => 'default', 'destination' => '/library/src/main/java/{{ sdk.namespace | caseSlash }}/Client.kt', 'template' => '/android/library/src/main/java/io/appwrite/Client.kt.twig', ], + [ + 'scope' => 'default', + 'destination' => '/library/src/main/java/{{ sdk.namespace | caseSlash }}/Permission.kt', + 'template' => '/android/library/src/main/java/io/appwrite/Permission.kt.twig', + ], + [ + 'scope' => 'default', + 'destination' => '/library/src/main/java/{{ sdk.namespace | caseSlash }}/Role.kt', + 'template' => '/android/library/src/main/java/io/appwrite/Role.kt.twig', + ], + [ + 'scope' => 'default', + 'destination' => '/library/src/main/java/{{ sdk.namespace | caseSlash }}/ID.kt', + 'template' => '/android/library/src/main/java/io/appwrite/ID.kt.twig', + ], [ 'scope' => 'default', 'destination' => '/library/src/main/java/{{ sdk.namespace | caseSlash }}/Query.kt', @@ -121,6 +135,11 @@ public function getFiles() 'destination' => '/library/src/main/java/{{ sdk.namespace | caseSlash }}/extensions/JsonExtensions.kt', 'template' => '/android/library/src/main/java/io/appwrite/extensions/JsonExtensions.kt.twig', ], + [ + 'scope' => 'default', + 'destination' => '/library/src/main/java/{{ sdk.namespace | caseSlash }}/extensions/TypeExtensions.kt', + 'template' => '/android/library/src/main/java/io/appwrite/extensions/TypeExtensions.kt.twig', + ], [ 'scope' => 'default', 'destination' => '/library/src/main/java/{{ sdk.namespace | caseSlash }}/extensions/CollectionExtensions.kt', @@ -131,6 +150,11 @@ public function getFiles() 'destination' => '/library/src/main/java/{{ sdk.namespace | caseSlash }}/json/PreciseNumberAdapter.kt', 'template' => '/android/library/src/main/java/io/appwrite/json/PreciseNumberAdapter.kt.twig', ], + [ + 'scope' => 'default', + 'destination' => '/library/src/main/java/{{ sdk.namespace | caseSlash }}/models/InputFile.kt', + 'template' => '/android/library/src/main/java/io/appwrite/models/InputFile.kt.twig', + ], [ 'scope' => 'default', 'destination' => '/library/src/main/java/{{ sdk.namespace | caseSlash }}/models/RealtimeModels.kt', @@ -171,6 +195,11 @@ public function getFiles() 'destination' => '/library/src/main/java/{{ sdk.namespace | caseSlash }}/cookies/Extensions.kt', 'template' => '/android/library/src/main/java/io/appwrite/cookies/Extensions.kt.twig', ], + [ + 'scope' => 'default', + 'destination' => '/library/src/main/java/{{ sdk.namespace | caseSlash }}/coroutines/Callback.kt', + 'template' => '/android/library/src/main/java/io/appwrite/coroutines/Callback.kt.twig', + ], [ 'scope' => 'default', 'destination' => '/library/src/main/java/{{ sdk.namespace | caseSlash }}/cookies/stores/InMemoryCookieStore.kt', diff --git a/src/SDK/Language/SwiftClient.php b/src/SDK/Language/Apple.php similarity index 85% rename from src/SDK/Language/SwiftClient.php rename to src/SDK/Language/Apple.php index f54069c910..7bbffae320 100644 --- a/src/SDK/Language/SwiftClient.php +++ b/src/SDK/Language/Apple.php @@ -2,309 +2,261 @@ namespace Appwrite\SDK\Language; -class SwiftClient extends Swift { - +class Apple extends Swift +{ /** * @return string */ - public function getName() + public function getName(): string { - return 'SwiftClient'; + return 'Apple'; } - public function getFiles() + public function getFiles(): array { return \array_merge(parent::getFiles(), [ [ 'scope' => 'default', 'destination' => '/Sources/{{ spec.title | caseUcfirst}}/OAuth/WebAuthComponent.swift', 'template' => '/swift/Sources/OAuth/WebAuthComponent.swift.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/Sources/{{ spec.title | caseUcfirst}}/OAuth/View+OAuth.swift', 'template' => '/swift/Sources/OAuth/View+OAuth.swift.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/Sources/{{ spec.title | caseUcfirst}}/Models/RealtimeModels.swift', 'template' => '/swift/Sources/Models/RealtimeModels.swift.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/Sources/{{ spec.title | caseUcfirst}}/Services/Realtime.swift', 'template' => '/swift/Sources/Services/Realtime.swift.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/Sources/{{ spec.title | caseUcfirst}}/WebSockets/HTTPHandler.swift', 'template' => '/swift/Sources/WebSockets/HTTPHandler.swift.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/Sources/{{ spec.title | caseUcfirst}}/WebSockets/MessageHandler.swift', 'template' => '/swift/Sources/WebSockets/MessageHandler.swift.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/Sources/{{ spec.title | caseUcfirst}}/WebSockets/WebSocketClient.swift', 'template' => '/swift/Sources/WebSockets/WebSocketClient.swift.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/Sources/{{ spec.title | caseUcfirst}}/WebSockets/WebSocketClientDelegate.swift', 'template' => '/swift/Sources/WebSockets/WebSocketClientDelegate.swift.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/Sources/{{ spec.title | caseUcfirst}}/WebSockets/WebSocketClientError.swift', 'template' => '/swift/Sources/WebSockets/WebSocketClientError.swift.twig', - 'minify' => false, ], // Config for project example-swiftui [ 'scope' => 'default', 'destination' => '/example-swiftui/iOS/Info.plist', 'template' => '/swift/example-swiftui/iOS/Info.plist', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/example-swiftui/iOS/ImagePicker+iOS.swift', 'template' => '/swift/example-swiftui/iOS/ImagePicker+iOS.swift', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/example-swiftui/iOS/Keyboard.swift', 'template' => '/swift/example-swiftui/iOS/Keyboard.swift', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/example-swiftui/macOS/ImagePicker+macOS.swift', 'template' => '/swift/example-swiftui/macOS/ImagePicker+macOS.swift', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/example-swiftui/macOS/Info.plist', 'template' => '/swift/example-swiftui/macOS/Info.plist', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/example-swiftui/macOS/macOS.entitlements', 'template' => '/swift/example-swiftui/macOS/macOS.entitlements', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/example-swiftui/Shared/Assets.xcassets/AccentColor.colorset/Contents.json', 'template' => '/swift/example-swiftui/Shared/Assets.xcassets/AccentColor.colorset/Contents.json', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/example-swiftui/Shared/Assets.xcassets/AppIcon.appiconset/Contents.json', 'template' => '/swift/example-swiftui/Shared/Assets.xcassets/AppIcon.appiconset/Contents.json', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/example-swiftui/Shared/Assets.xcassets/Contents.json', 'template' => '/swift/example-swiftui/Shared/Assets.xcassets/Contents.json', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/example-swiftui/Shared/Image/OSImage.swift', 'template' => '/swift/example-swiftui/Shared/Image/OSImage.swift', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/example-swiftui/Shared/ExampleApp.swift', 'template' => '/swift/example-swiftui/Shared/ExampleApp.swift', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/example-swiftui/Shared/ExampleView.swift', 'template' => '/swift/example-swiftui/Shared/ExampleView.swift', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/example-swiftui/Shared/ExampleViewModel.swift', 'template' => '/swift/example-swiftui/Shared/ExampleViewModel.swift', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/example-swiftui/Shared/ImagePicker.swift', 'template' => '/swift/example-swiftui/Shared/ImagePicker.swift', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/example-swiftui/Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist', 'template' => '/swift/example-swiftui/Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/example-swiftui/Example.xcodeproj/project.pbxproj', 'template' => '/swift/example-swiftui/Example.xcodeproj/project.pbxproj', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/example-swiftui/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata', 'template' => '/swift/example-swiftui/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/example-swiftui/Tests iOS/Info.plist', 'template' => '/swift/example-swiftui/Tests iOS/Info.plist', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/example-swiftui/Tests iOS/Tests_iOS.swift', 'template' => '/swift/example-swiftui/Tests iOS/Tests_iOS.swift', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/example-swiftui/Tests macOS/Info.plist', 'template' => '/swift/example-swiftui/Tests macOS/Info.plist', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/example-swiftui/Tests macOS/Tests_macOS.swift', 'template' => '/swift/example-swiftui/Tests macOS/Tests_macOS.swift', - 'minify' => false, ], // Config for project example-uikit [ 'scope' => 'default', 'destination' => '/example-uikit/UIKitExample/Assets.xcassets/AccentColor.colorset/Contents.json', 'template' => '/swift/example-uikit/UIKitExample/Assets.xcassets/AccentColor.colorset/Contents.json', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/example-uikit/UIKitExample/Assets.xcassets/AppIcon.appiconset/Contents.json', 'template' => '/swift/example-uikit/UIKitExample/Assets.xcassets/AppIcon.appiconset/Contents.json', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/example-uikit/UIKitExample/Assets.xcassets/Contents.json', 'template' => '/swift/example-uikit/UIKitExample/Assets.xcassets/Contents.json', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/example-uikit/UIKitExample/Base.lproj/LaunchScreen.storyboard', 'template' => '/swift/example-uikit/UIKitExample/Base.lproj/LaunchScreen.storyboard', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/example-uikit/UIKitExample/Base.lproj/Main.storyboard', 'template' => '/swift/example-uikit/UIKitExample/Base.lproj/Main.storyboard', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/example-uikit/UIKitExample/AppDelegate.swift', 'template' => '/swift/example-uikit/UIKitExample/AppDelegate.swift', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/example-uikit/UIKitExample/ImagePicker.swift', 'template' => '/swift/example-uikit/UIKitExample/ImagePicker.swift', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/example-uikit/UIKitExample/Info.plist', 'template' => '/swift/example-uikit/UIKitExample/Info.plist', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/example-uikit/UIKitExample/SceneDelegate.swift', 'template' => '/swift/example-uikit/UIKitExample/SceneDelegate.swift', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/example-uikit/UIKitExample/ViewController.swift', 'template' => '/swift/example-uikit/UIKitExample/ViewController.swift', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/example-uikit/UIKitExample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved', 'template' => '/swift/example-uikit/UIKitExample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/example-uikit/UIKitExample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist', 'template' => '/swift/example-uikit/UIKitExample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/example-uikit/UIKitExample.xcodeproj/project.pbxproj', 'template' => '/swift/example-uikit/UIKitExample.xcodeproj/project.pbxproj', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/example-uikit/UIKitExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata', 'template' => '/swift/example-uikit/UIKitExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/example-uikit/UIKitExampleTests/Info.plist', 'template' => '/swift/example-uikit/UIKitExampleTests/Info.plist', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/example-uikit/UIKitExampleTests/UIKitExampleTests.swift', 'template' => '/swift/example-uikit/UIKitExampleTests/UIKitExampleTests.swift', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/example-uikit/UIKitExampleUITests/Info.plist', 'template' => '/swift/example-uikit/UIKitExampleUITests/Info.plist', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/example-uikit/UIKitExampleUITests/UIKitExampleUITests.swift', 'template' => '/swift/example-uikit/UIKitExampleUITests/UIKitExampleUITests.swift', - 'minify' => false, ], ]); } -} \ No newline at end of file +} diff --git a/src/SDK/Language/CLI.php b/src/SDK/Language/CLI.php index 306cf15be4..0b894bf668 100644 --- a/src/SDK/Language/CLI.php +++ b/src/SDK/Language/CLI.php @@ -4,7 +4,6 @@ class CLI extends Node { - /** * @var array */ @@ -19,7 +18,7 @@ class CLI extends Node * @param string $name * @return $this */ - public function setExecutableName($name) + public function setExecutableName(string $name): self { $this->setParam('executableName', $name); @@ -30,7 +29,7 @@ public function setExecutableName($name) * @param string $logo * @return $this */ - public function setLogo($logo) + public function setLogo(string $logo): self { $this->setParam('logo', $logo); @@ -41,7 +40,7 @@ public function setLogo($logo) * @param string $logo * @return $this */ - public function setLogoUnescaped($logo) + public function setLogoUnescaped(string $logo): self { $this->setParam('logoUnescaped', $logo); @@ -51,7 +50,7 @@ public function setLogoUnescaped($logo) /** * @return string */ - public function getName() + public function getName(): string { return 'cli'; } @@ -59,20 +58,18 @@ public function getName() /** * @return array */ - public function getFiles() + public function getFiles(): array { return [ [ 'scope' => 'default', 'destination' => 'README.md', 'template' => 'cli/README.md.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'package.json', 'template' => 'cli/package.json.twig', - 'minify' => false, ], [ 'scope' => 'default', @@ -84,115 +81,96 @@ public function getFiles() 'scope' => 'default', 'destination' => 'LICENSE.md', 'template' => 'cli/LICENSE.md.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'install.sh', 'template' => 'cli/install.sh.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'install.ps1', 'template' => 'cli/install.ps1.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'index.js', 'template' => 'cli/index.js.twig', - 'minify' => false, ], [ 'scope' => 'method', 'destination' => 'docs/examples/{{service.name | caseLower}}/{{method.name | caseDash}}.md', 'template' => 'cli/docs/example.md.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '.gitignore', 'template' => 'cli/.gitignore', - 'minify' => false, ], [ 'scope' => 'method', 'destination' => 'Formula/{{ language.params.executableName }}.rb', 'template' => 'cli/Formula/formula.rb.twig', - 'minify' => false, ], [ 'scope' => 'copy', 'destination' => '.github/workflows/npm-publish.yml', 'template' => 'cli/.github/workflows/npm-publish.yml', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'lib/sdks.js', 'template' => 'cli/lib/sdks.js.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'lib/questions.js', 'template' => 'cli/lib/questions.js.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'lib/parser.js', 'template' => 'cli/lib/parser.js.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'lib/exception.js', 'template' => 'cli/lib/exception.js.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'lib/config.js', 'template' => 'cli/lib/config.js.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'lib/client.js', 'template' => 'cli/lib/client.js.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'lib/utils.js', 'template' => 'cli/lib/utils.js.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'lib/commands/init.js', 'template' => 'cli/lib/commands/init.js.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'lib/commands/deploy.js', 'template' => 'cli/lib/commands/deploy.js.twig', - 'minify' => false, ], [ 'scope' => 'service', 'destination' => '/lib/commands/{{service.name | caseDash}}.js', 'template' => 'cli/lib/commands/command.js.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'lib/commands/generic.js', 'template' => 'cli/lib/commands/generic.js.twig', - 'minify' => false, ] ]; } @@ -201,14 +179,14 @@ public function getFiles() * @param array $param * @return string */ - public function getParamExample(array $param) + public function getParamExample(array $param): string { $type = $param['type'] ?? ''; $example = $param['example'] ?? ''; $output = ''; - if(empty($example) && $example !== 0 && $example !== false) { + if (empty($example) && $example !== 0 && $example !== false) { switch ($type) { case self::TYPE_NUMBER: case self::TYPE_INTEGER: @@ -228,11 +206,10 @@ public function getParamExample(array $param) $output .= "'path/to/file.png'"; break; } - } - else { + } else { switch ($type) { case self::TYPE_ARRAY: - if(strpos($example, '[') !== false && strpos($example, ']') !== false) { + if (str_contains($example, '[') && str_contains($example, ']')) { $trimmed = substr($example, 1, -1); $split = explode(',', $trimmed); $output .= implode(' ', $split); diff --git a/src/SDK/Language/Dart.php b/src/SDK/Language/Dart.php index 5f78f3a7c2..16c7040925 100644 --- a/src/SDK/Language/Dart.php +++ b/src/SDK/Language/Dart.php @@ -3,9 +3,10 @@ namespace Appwrite\SDK\Language; use Appwrite\SDK\Language; +use Twig\TwigFilter; -class Dart extends Language { - +class Dart extends Language +{ /** * @var array */ @@ -17,7 +18,7 @@ class Dart extends Language { * @param string $name * @return $this */ - public function setPackageName($name) + public function setPackageName(string $name): self { $this->setParam('packageName', $name); @@ -27,7 +28,7 @@ public function setPackageName($name) /** * @return string */ - public function getName() + public function getName(): string { return 'Dart'; } @@ -37,7 +38,7 @@ public function getName() * * @return array */ - public function getKeywords() + public function getKeywords(): array { return [ "abstract", @@ -109,59 +110,57 @@ public function getKeywords() /** * @return array */ - public function getIdentifierOverrides() + public function getIdentifierOverrides(): array { - return ['Function' => 'Func']; + return ['Function' => 'Func', 'default' => 'xdefault', 'required' => 'xrequired', 'async' => 'xasync']; } /** - * @param $type + * @param array $parameter * @return string */ - public function getTypeName($type) + public function getTypeName(array $parameter): string { - switch ($type) { + switch ($parameter['type']) { case self::TYPE_INTEGER: return 'int'; - break; case self::TYPE_STRING: return 'String'; - break; case self::TYPE_FILE: return 'InputFile'; - break; case self::TYPE_BOOLEAN: return 'bool'; - break; case self::TYPE_ARRAY: - return 'List'; - case self::TYPE_OBJECT: - return 'Map'; + if (!empty($parameter['array']['type'])) { + return 'List<' . $this->getTypeName($parameter['array']) . '>'; + } + return 'List'; + case self::TYPE_OBJECT: + return 'Map'; case self::TYPE_NUMBER: return 'double'; - break; } - return $type; + return $parameter['type']; } /** * @param array $param * @return string */ - public function getParamDefault(array $param) + public function getParamDefault(array $param): string { $type = $param['type'] ?? ''; $default = $param['default'] ?? ''; $required = $param['required'] ?? ''; - if($required) { + if ($required) { return ''; } $output = ' = '; - if(empty($default) && $default !== 0 && $default !== false) { + if (empty($default) && $default !== 0 && $default !== false) { switch ($type) { case self::TYPE_OBJECT: $output .= 'const {}'; @@ -180,8 +179,7 @@ public function getParamDefault(array $param) $output .= "''"; break; } - } - else { + } else { switch ($type) { case self::TYPE_NUMBER: case self::TYPE_INTEGER: @@ -189,7 +187,7 @@ public function getParamDefault(array $param) break; case self::TYPE_OBJECT: case self::TYPE_ARRAY: - $output .= 'const '.$default; + $output .= 'const ' . $default; break; case self::TYPE_BOOLEAN: $output .= ($default) ? 'true' : 'false'; @@ -207,14 +205,14 @@ public function getParamDefault(array $param) * @param array $param * @return string */ - public function getParamExample(array $param) + public function getParamExample(array $param): string { $type = $param['type'] ?? ''; $example = $param['example'] ?? ''; $output = ''; - if(empty($example) && $example !== 0 && $example !== false) { + if (empty($example) && $example !== 0 && $example !== false) { switch ($type) { case self::TYPE_FILE: $output .= 'InputFile(path: \'./path-to-files/image.jpg\', filename: \'image.jpg\')'; @@ -222,7 +220,7 @@ public function getParamExample(array $param) case self::TYPE_NUMBER: case self::TYPE_INTEGER: $output .= '0'; - break; + break; case self::TYPE_BOOLEAN: $output .= 'false'; break; @@ -236,8 +234,7 @@ public function getParamExample(array $param) $output .= '[]'; break; } - } - else { + } else { switch ($type) { case self::TYPE_OBJECT: case self::TYPE_FILE: @@ -261,177 +258,172 @@ public function getParamExample(array $param) /** * @return array */ - public function getFiles() + public function getFiles(): array { return [ [ 'scope' => 'default', 'destination' => 'README.md', 'template' => 'dart/README.md.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/example/README.md', 'template' => 'dart/example/README.md.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'CHANGELOG.md', 'template' => 'dart/CHANGELOG.md.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'LICENSE', 'template' => 'dart/LICENSE.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/lib/src/client.dart', 'template' => 'dart/lib/src/client.dart.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/lib/src/client_base.dart', 'template' => 'dart/lib/src/client_base.dart.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/lib/src/client_browser.dart', 'template' => 'dart/lib/src/client_browser.dart.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/lib/src/client_io.dart', 'template' => 'dart/lib/src/client_io.dart.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/lib/src/client_mixin.dart', 'template' => 'dart/lib/src/client_mixin.dart.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/lib/src/client_stub.dart', 'template' => 'dart/lib/src/client_stub.dart.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/lib/src/exception.dart', 'template' => 'dart/lib/src/exception.dart.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/lib/src/upload_progress.dart', 'template' => 'dart/lib/src/upload_progress.dart.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/lib/src/response.dart', 'template' => 'dart/lib/src/response.dart.twig', - 'minify' => false, + ], + [ + 'scope' => 'default', + 'destination' => '/lib/permission.dart', + 'template' => 'dart/lib/permission.dart.twig', + ], + [ + 'scope' => 'default', + 'destination' => '/lib/role.dart', + 'template' => 'dart/lib/role.dart.twig', + ], + [ + 'scope' => 'default', + 'destination' => '/lib/id.dart', + 'template' => 'dart/lib/id.dart.twig', ], [ 'scope' => 'default', 'destination' => '/lib/query.dart', 'template' => 'dart/lib/query.dart.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/lib/{{ language.params.packageName }}.dart', 'template' => 'dart/lib/package.dart.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/pubspec.yaml', 'template' => 'dart/pubspec.yaml.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/lib/client_io.dart', 'template' => 'dart/lib/client_io.dart.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/lib/client_browser.dart', 'template' => 'dart/lib/client_browser.dart.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/lib/src/service.dart', 'template' => 'dart/lib/src/service.dart.twig', - 'minify' => false, ], [ - 'scope' => 'default', - 'destination' => '/lib/src/enums.dart', - 'template' => 'dart/lib/src/enums.dart.twig', - 'minify' => false, - ], + 'scope' => 'default', + 'destination' => '/lib/src/enums.dart', + 'template' => 'dart/lib/src/enums.dart.twig', + ], [ - 'scope' => 'default', - 'destination' => '/lib/models.dart', - 'template' => 'dart/lib/models.dart.twig', - 'minify' => false, - ], + 'scope' => 'default', + 'destination' => '/lib/src/models/model.dart', + 'template' => 'dart/lib/src/models/model_base.dart.twig', + ], + [ + 'scope' => 'default', + 'destination' => '/lib/models.dart', + 'template' => 'dart/lib/models.dart.twig', + ], [ 'scope' => 'service', 'destination' => '/lib/services/{{service.name | caseDash}}.dart', 'template' => 'dart/lib/services/service.dart.twig', - 'minify' => false, ], [ 'scope' => 'definition', 'destination' => '/lib/src/models/{{definition.name | caseSnake }}.dart', 'template' => 'dart/lib/src/models/model.dart.twig', - 'minify' => false, ], [ 'scope' => 'method', 'destination' => 'docs/examples/{{service.name | caseLower}}/{{method.name | caseDash}}.md', 'template' => 'dart/docs/example.md.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '.travis.yml', 'template' => 'dart/.travis.yml.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'lib/src/input_file.dart', 'template' => 'dart/lib/src/input_file.dart.twig', - 'minify' => false, - ], - [ - 'scope' => 'default', - 'destination' => 'lib/src/chunked_upload_io.dart', - 'template' => 'dart/lib/src/chunked_upload_io.dart.twig', - 'minify' => false, - ], - [ - 'scope' => 'default', - 'destination' => 'lib/src/chunked_upload_stub.dart', - 'template' => 'dart/lib/src/chunked_upload_stub.dart.twig', - 'minify' => false, ], ]; } + + public function getFilters(): array + { + return [ + new TwigFilter('dartComment', function ($value) { + $value = explode("\n", $value); + foreach ($value as $key => $line) { + $value[$key] = " /// " . wordwrap($value[$key], 75, "\n /// "); + } + return implode("\n", $value); + }, ['is_safe' => ['html']]), + ]; + } } diff --git a/src/SDK/Language/Deno.php b/src/SDK/Language/Deno.php index 57063607f7..1fdef0c0da 100644 --- a/src/SDK/Language/Deno.php +++ b/src/SDK/Language/Deno.php @@ -7,7 +7,7 @@ class Deno extends JS /** * @return string */ - public function getName() + public function getName(): string { return 'Deno'; } @@ -15,120 +15,126 @@ public function getName() /** * @return array */ - public function getFiles() + public function getFiles(): array { return [ [ 'scope' => 'default', 'destination' => 'mod.ts', 'template' => 'deno/mod.ts.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'src/client.ts', 'template' => 'deno/src/client.ts.twig', - 'minify' => false, + ], + [ + 'scope' => 'default', + 'destination' => 'src/permission.ts', + 'template' => 'deno/src/permission.ts.twig', + ], + [ + 'scope' => 'default', + 'destination' => 'src/role.ts', + 'template' => 'deno/src/role.ts.twig', + ], + [ + 'scope' => 'default', + 'destination' => 'src/id.ts', + 'template' => 'deno/src/id.ts.twig', ], [ 'scope' => 'default', 'destination' => 'src/query.ts', 'template' => 'deno/src/query.ts.twig', - 'minify' => false, + ], + [ + 'scope' => 'default', + 'destination' => 'src/inputFile.ts', + 'template' => 'deno/src/inputFile.ts.twig', ], [ 'scope' => 'default', 'destination' => '/src/service.ts', 'template' => 'deno/src/service.ts.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/src/models.d.ts', 'template' => 'deno/src/models.d.ts.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/src/exception.ts', 'template' => 'deno/src/exception.ts.twig', - 'minify' => false, ], [ 'scope' => 'service', 'destination' => '/src/services/{{service.name | caseDash}}.ts', 'template' => 'deno/src/services/service.ts.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'README.md', 'template' => 'deno/README.md.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'CHANGELOG.md', 'template' => 'deno/CHANGELOG.md.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'LICENSE', 'template' => 'deno/LICENSE.twig', - 'minify' => false, ], [ 'scope' => 'method', 'destination' => 'docs/examples/{{service.name | caseLower}}/{{method.name | caseDash}}.md', 'template' => 'deno/docs/example.md.twig', - 'minify' => false, ], ]; } - /** - * @param $type + /** + * @param array $parameter * @return string */ - public function getTypeName($type) + public function getTypeName(array $parameter): string { - switch ($type) { + switch ($parameter['type']) { case self::TYPE_INTEGER: return 'number'; - break; case self::TYPE_STRING: return 'string'; - break; case self::TYPE_FILE: - return 'string'; - break; + return 'InputFile'; case self::TYPE_BOOLEAN: return 'boolean'; - break; case self::TYPE_ARRAY: + if (!empty($parameter['array']['type'])) { + return $this->getTypeName($parameter['array']) . '[]'; + } return 'string[]'; - break; case self::TYPE_OBJECT: return 'object'; - break; } - return $type; + return $parameter['type']; } /** * @param array $param * @return string */ - public function getParamExample(array $param) + public function getParamExample(array $param): string { $type = $param['type'] ?? ''; $example = $param['example'] ?? ''; $output = ''; - if(empty($example) && $example !== 0 && $example !== false) { + if (empty($example) && $example !== 0 && $example !== false) { switch ($type) { case self::TYPE_NUMBER: case self::TYPE_INTEGER: @@ -145,11 +151,10 @@ public function getParamExample(array $param) $output .= '{}'; break; case self::TYPE_FILE: - $output .= "'file.png'"; + $output .= "InputFile.fromPath('/path/to/file.png', 'file.png')"; break; } - } - else { + } else { switch ($type) { case self::TYPE_NUMBER: case self::TYPE_INTEGER: @@ -164,7 +169,7 @@ public function getParamExample(array $param) $output .= "'{$example}'"; break; case self::TYPE_FILE: - $output .= "'file.png'"; + $output .= "InputFile.fromPath('/path/to/file.png', 'file.png')"; break; } } diff --git a/src/SDK/Language/DotNet.php b/src/SDK/Language/DotNet.php index 609e025638..985453203c 100644 --- a/src/SDK/Language/DotNet.php +++ b/src/SDK/Language/DotNet.php @@ -3,13 +3,14 @@ namespace Appwrite\SDK\Language; use Appwrite\SDK\Language; +use Twig\TwigFilter; -class DotNet extends Language { - +class DotNet extends Language +{ /** * @return string */ - public function getName() + public function getName(): string { return 'DotNet'; } @@ -19,7 +20,7 @@ public function getName() * * @return array */ - public function getKeywords() + public function getKeywords(): array { return [ 'abstract', @@ -135,7 +136,7 @@ public function getKeywords() /** * @return array */ - public function getIdentifierOverrides() + public function getIdentifierOverrides(): array { return [ 'Jwt' => 'JWT' @@ -146,49 +147,46 @@ public function getIdentifierOverrides() * @param $type * @return string */ - public function getTypeName($type) + public function getTypeName(array $parameter): string { - switch ($type) { + switch ($parameter['type']) { case self::TYPE_INTEGER: return 'int'; - break; case self::TYPE_STRING: return 'string'; - break; case self::TYPE_FILE: return 'FileInfo'; - break; case self::TYPE_BOOLEAN: return 'bool'; - break; case self::TYPE_ARRAY: + if (!empty($parameter['array']['type'])) { + return 'List<' . $this->getTypeName($parameter['array']) . '>'; + } return 'List'; - break; case self::TYPE_OBJECT: return 'object'; - break; } - return $type; + return $parameter['type']; } /** * @param array $param * @return string */ - public function getParamDefault(array $param) + public function getParamDefault(array $param): string { $type = $param['type'] ?? ''; $default = $param['default'] ?? ''; $required = $param['required'] ?? ''; - if($required) { + if ($required) { return ''; } $output = ' = '; - if(empty($default) && $default !== 0 && $default !== false) { + if (empty($default) && $default !== 0 && $default !== false) { switch ($type) { case self::TYPE_INTEGER: case self::TYPE_ARRAY: @@ -200,8 +198,7 @@ public function getParamDefault(array $param) $output .= '""'; break; } - } - else { + } else { switch ($type) { case self::TYPE_INTEGER: $output .= $default; @@ -226,14 +223,14 @@ public function getParamDefault(array $param) * @param array $param * @return string */ - public function getParamExample(array $param) + public function getParamExample(array $param): string { $type = $param['type'] ?? ''; $example = $param['example'] ?? ''; $output = ''; - if(empty($example) && $example !== 0 && $example !== false) { + if (empty($example) && $example !== 0 && $example !== false) { switch ($type) { case self::TYPE_FILE: $output .= 'new File("./path-to-files/image.jpg")'; @@ -241,7 +238,7 @@ public function getParamExample(array $param) case self::TYPE_NUMBER: case self::TYPE_INTEGER: $output .= '0'; - break; + break; case self::TYPE_BOOLEAN: $output .= 'false'; break; @@ -255,8 +252,7 @@ public function getParamExample(array $param) $output .= '[List]'; break; } - } - else { + } else { switch ($type) { case self::TYPE_FILE: case self::TYPE_NUMBER: @@ -282,44 +278,38 @@ public function getParamExample(array $param) /** * @return array */ - public function getFiles() + public function getFiles(): array { return [ [ 'scope' => 'default', 'destination' => 'README.md', 'template' => 'dotnet/README.md.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'CHANGELOG.md', 'template' => 'dotnet/CHANGELOG.md.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'LICENSE', 'template' => 'dotnet/LICENSE.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '.travis.yml', 'template' => 'dotnet/.travis.yml.twig', - 'minify' => false, ], [ 'scope' => 'method', 'destination' => 'docs/examples/{{service.name | caseLower}}/{{method.name | caseDash}}.md', 'template' => 'dotnet/docs/example.md.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/src/Appwrite.sln', 'template' => 'dotnet/src/Appwrite.sln', - 'minify' => false, ], [ 'scope' => 'copy', @@ -330,51 +320,55 @@ public function getFiles() 'scope' => 'default', 'destination' => '/src/Appwrite/Appwrite.csproj', 'template' => 'dotnet/src/Appwrite/Appwrite.csproj.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/{{ sdk.namespace | caseSlash }}/src/Appwrite/Client.cs', 'template' => 'dotnet/src/Appwrite/Client.cs.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/{{ sdk.namespace | caseSlash }}/src/Appwrite/Helpers/ExtensionMethods.cs', 'template' => 'dotnet/src/Appwrite/Helpers/ExtensionMethods.cs', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/{{ sdk.namespace | caseSlash }}/src/Appwrite/Models/OrderType.cs', 'template' => 'dotnet/src/Appwrite/Models/OrderType.cs.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/{{ sdk.namespace | caseSlash }}/src/Appwrite/Models/Rule.cs', 'template' => 'dotnet/src/Appwrite/Models/Rule.cs.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/{{ sdk.namespace | caseSlash }}/src/Appwrite/Models/Exception.cs', 'template' => 'dotnet/src/Appwrite/Models/Exception.cs.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/{{ sdk.namespace | caseSlash }}/src/Appwrite/Services/Service.cs', 'template' => 'dotnet/src/Appwrite/Services/Service.cs.twig', - 'minify' => false, ], [ 'scope' => 'service', 'destination' => '/{{ sdk.namespace | caseSlash }}/src/Appwrite/Services/{{service.name | caseUcfirst}}.cs', 'template' => 'dotnet/src/Appwrite/Services/ServiceTemplate.cs.twig', - 'minify' => false, ] ]; } -} + public function getFilters(): array + { + return [ + new TwigFilter('dotnetComment', function ($value) { + $value = explode("\n", $value); + foreach ($value as $key => $line) { + $value[$key] = " /// " . wordwrap($line, 75, "\n /// "); + } + return implode("\n", $value); + }, ['is_safe' => ['html']]) + ]; + } +} diff --git a/src/SDK/Language/Flutter.php b/src/SDK/Language/Flutter.php index 30186331b3..1b5dea3792 100644 --- a/src/SDK/Language/Flutter.php +++ b/src/SDK/Language/Flutter.php @@ -2,8 +2,8 @@ namespace Appwrite\SDK\Language; -class Flutter extends Dart { - +class Flutter extends Dart +{ /** * @var array */ @@ -14,7 +14,7 @@ class Flutter extends Dart { /** * @return string */ - public function getName() + public function getName(): string { return 'Flutter'; } @@ -22,272 +22,233 @@ public function getName() /** * @return array */ - public function getFiles() + public function getFiles(): array { return [ + [ + 'scope' => 'default', + 'destination' => '/lib/src/response.dart', + 'template' => 'dart/lib/src/response.dart.twig', + ], + [ + 'scope' => 'default', + 'destination' => '/lib/src/service.dart', + 'template' => 'dart/lib/src/service.dart.twig', + ], + [ + 'scope' => 'default', + 'destination' => '/lib/src/models/model.dart', + 'template' => 'dart/lib/src/models/model_base.dart.twig', + ], + [ + 'scope' => 'default', + 'destination' => '/lib/src/enums.dart', + 'template' => 'dart/lib/src/enums.dart.twig', + ], + [ + 'scope' => 'default', + 'destination' => '/lib/src/exception.dart', + 'template' => 'dart/lib/src/exception.dart.twig', + ], + [ + 'scope' => 'default', + 'destination' => '/lib/src/upload_progress.dart', + 'template' => 'dart/lib/src/upload_progress.dart.twig', + ], + [ + 'scope' => 'default', + 'destination' => '/lib/models.dart', + 'template' => 'dart/lib/models.dart.twig', + ], + [ + 'scope' => 'default', + 'destination' => '/lib/permission.dart', + 'template' => 'dart/lib/permission.dart.twig', + ], + [ + 'scope' => 'default', + 'destination' => '/lib/role.dart', + 'template' => 'dart/lib/role.dart.twig', + ], + [ + 'scope' => 'default', + 'destination' => '/lib/id.dart', + 'template' => 'dart/lib/id.dart.twig', + ], + [ + 'scope' => 'default', + 'destination' => '/lib/query.dart', + 'template' => 'dart/lib/query.dart.twig', + ], + [ + 'scope' => 'definition', + 'destination' => '/lib/src/models/{{definition.name | caseSnake }}.dart', + 'template' => 'dart/lib/src/models/model.dart.twig', + ], + [ + 'scope' => 'default', + 'destination' => 'lib/src/input_file.dart', + 'template' => 'dart/lib/src/input_file.dart.twig', + ], [ 'scope' => 'default', 'destination' => 'README.md', 'template' => 'flutter/README.md.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/example/README.md', 'template' => 'flutter/example/README.md.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/example/pubspec.yaml', 'template' => 'flutter/example/pubspec.yaml.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'CHANGELOG.md', 'template' => 'flutter/CHANGELOG.md.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'LICENSE', 'template' => 'flutter/LICENSE.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/lib/src/client.dart', 'template' => 'flutter/lib/src/client.dart.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/lib/src/client_base.dart', 'template' => 'flutter/lib/src/client_base.dart.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/lib/src/client_browser.dart', 'template' => 'flutter/lib/src/client_browser.dart.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/lib/src/client_io.dart', 'template' => 'flutter/lib/src/client_io.dart.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/lib/src/client_mixin.dart', 'template' => 'flutter/lib/src/client_mixin.dart.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/lib/src/client_stub.dart', 'template' => 'flutter/lib/src/client_stub.dart.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/lib/src/realtime.dart', 'template' => 'flutter/lib/src/realtime.dart.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/lib/src/realtime_base.dart', 'template' => 'flutter/lib/src/realtime_base.dart.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/lib/src/realtime_browser.dart', 'template' => 'flutter/lib/src/realtime_browser.dart.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/lib/src/realtime_io.dart', 'template' => 'flutter/lib/src/realtime_io.dart.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/lib/src/realtime_mixin.dart', 'template' => 'flutter/lib/src/realtime_mixin.dart.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/lib/src/realtime_stub.dart', 'template' => 'flutter/lib/src/realtime_stub.dart.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/lib/src/realtime_subscription.dart', 'template' => 'flutter/lib/src/realtime_subscription.dart.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/lib/src/realtime_message.dart', 'template' => 'flutter/lib/src/realtime_message.dart.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/lib/src/realtime_response.dart', 'template' => 'flutter/lib/src/realtime_response.dart.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/lib/src/realtime_response_connected.dart', 'template' => 'flutter/lib/src/realtime_response_connected.dart.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/lib/src/cookie_manager.dart', 'template' => 'flutter/lib/src/cookie_manager.dart.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/lib/src/interceptor.dart', 'template' => 'flutter/lib/src/interceptor.dart.twig', - 'minify' => false, - ], - [ - 'scope' => 'default', - 'destination' => '/lib/src/response.dart', - 'template' => 'flutter/lib/src/response.dart.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/lib/{{ language.params.packageName }}.dart', 'template' => 'flutter/lib/package.dart.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/lib/client_io.dart', 'template' => 'flutter/lib/client_io.dart.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/lib/client_browser.dart', 'template' => 'flutter/lib/client_browser.dart.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/lib/realtime_io.dart', 'template' => 'flutter/lib/realtime_io.dart.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/lib/realtime_browser.dart', 'template' => 'flutter/lib/realtime_browser.dart.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/pubspec.yaml', 'template' => 'flutter/pubspec.yaml.twig', - 'minify' => false, ], - [ - 'scope' => 'default', - 'destination' => '/lib/src/service.dart', - 'template' => 'flutter/lib/src/service.dart.twig', - 'minify' => false, - ], - [ - 'scope' => 'default', - 'destination' => '/lib/src/models/model.dart', - 'template' => 'flutter/lib/src/models/model_base.dart.twig', - 'minify' => false, - ], - [ - 'scope' => 'default', - 'destination' => '/lib/src/enums.dart', - 'template' => 'flutter/lib/src/enums.dart.twig', - 'minify' => false, - ], - [ - 'scope' => 'default', - 'destination' => '/lib/src/exception.dart', - 'template' => 'flutter/lib/src/exception.dart.twig', - 'minify' => false, - ], - [ - 'scope' => 'default', - 'destination' => '/lib/src/upload_progress.dart', - 'template' => 'dart/lib/src/upload_progress.dart.twig', - 'minify' => false, - ], - [ - 'scope' => 'default', - 'destination' => '/lib/models.dart', - 'template' => 'flutter/lib/models.dart.twig', - 'minify' => false, - ], - [ - 'scope' => 'default', - 'destination' => '/lib/query.dart', - 'template' => 'flutter/lib/query.dart.twig', - 'minify' => false, - ], [ 'scope' => 'service', 'destination' => '/lib/services/{{service.name | caseDash}}.dart', 'template' => 'flutter/lib/services/service.dart.twig', - 'minify' => false, - ], - [ - 'scope' => 'definition', - 'destination' => '/lib/src/models/{{definition.name | caseSnake }}.dart', - 'template' => '/flutter/lib/src/models/model.dart.twig', - 'minify' => false, ], [ 'scope' => 'method', 'destination' => 'docs/examples/{{service.name | caseLower}}/{{method.name | caseDash}}.md', 'template' => 'flutter/docs/example.md.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '.travis.yml', 'template' => 'flutter/.travis.yml.twig', - 'minify' => false, - ], - [ - 'scope' => 'default', - 'destination' => 'lib/src/input_file.dart', - 'template' => 'flutter/lib/src/input_file.dart.twig', - 'minify' => false, - ], - [ - 'scope' => 'default', - 'destination' => 'lib/src/chunked_upload_io.dart', - 'template' => 'flutter/lib/src/chunked_upload_io.dart.twig', - 'minify' => false, - ], - [ - 'scope' => 'default', - 'destination' => 'lib/src/chunked_upload_stub.dart', - 'template' => 'flutter/lib/src/chunked_upload_stub.dart.twig', - 'minify' => false, ], ]; } diff --git a/src/SDK/Language/Go.php b/src/SDK/Language/Go.php index 97c023c22b..ebb4347e60 100644 --- a/src/SDK/Language/Go.php +++ b/src/SDK/Language/Go.php @@ -3,13 +3,14 @@ namespace Appwrite\SDK\Language; use Appwrite\SDK\Language; +use Twig\TwigFilter; -class Go extends Language { - +class Go extends Language +{ /** * @return string */ - public function getName() + public function getName(): string { return 'Go'; } @@ -19,7 +20,7 @@ public function getName() * * @return array */ - public function getKeywords() + public function getKeywords(): array { return [ 'bool', @@ -46,7 +47,7 @@ public function getKeywords() /** * @return array */ - public function getIdentifierOverrides() + public function getIdentifierOverrides(): array { return []; } @@ -54,75 +55,67 @@ public function getIdentifierOverrides() /** * @return array */ - public function getFiles() + public function getFiles(): array { return [ [ 'scope' => 'default', 'destination' => 'go.mod', 'template' => 'go/go.mod.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'example/main.go', 'template' => 'go/main.go.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'README.md', 'template' => 'go/README.md.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'CHANGELOG.md', 'template' => 'go/CHANGELOG.md.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'LICENSE', 'template' => 'go/LICENSE.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '{{ spec.title | caseLower}}/client.go', 'template' => 'go/client.go.twig', - 'minify' => false, ], [ 'scope' => 'service', 'destination' => '{{ spec.title | caseLower}}/{{service.name | caseDash}}.go', 'template' => 'go/services/service.go.twig', - 'minify' => false, ], [ 'scope' => 'method', 'destination' => 'docs/examples/{{service.name | caseLower}}/{{method.name | caseDash}}.md', 'template' => 'go/docs/example.md.twig', - 'minify' => false, ], ]; } /** - * @param $type + * @param array $parameter + * @param array $nestedTypes * @return string */ - public function getTypeName($type) + public function getTypeName(array $parameter): string { - switch ($type) { + switch ($parameter['type']) { case self::TYPE_INTEGER: return 'int'; case self::TYPE_NUMBER: return 'float64'; + case self::TYPE_FILE: case self::TYPE_STRING: return 'string'; - case self::TYPE_FILE: - return 'string'; // '*os.File'; case self::TYPE_BOOLEAN: return 'bool'; case self::TYPE_OBJECT: @@ -131,26 +124,26 @@ public function getTypeName($type) return '[]interface{}'; } - return $type; + return $parameter['type']; } /** * @param array $param * @return string */ - public function getParamDefault(array $param) + public function getParamDefault(array $param): string { $type = $param['type'] ?? ''; $default = $param['default'] ?? ''; $required = $param['required'] ?? ''; - if($required) { + if ($required) { return ''; } $output = ' = '; - if(empty($default) && $default !== 0 && $default !== false) { + if (empty($default) && $default !== 0 && $default !== false) { switch ($type) { case self::TYPE_NUMBER: case self::TYPE_INTEGER: @@ -167,8 +160,7 @@ public function getParamDefault(array $param) $output .= '[]'; break; } - } - else { + } else { switch ($type) { case self::TYPE_NUMBER: case self::TYPE_INTEGER: @@ -194,14 +186,14 @@ public function getParamDefault(array $param) * @param array $param * @return string */ - public function getParamExample(array $param) + public function getParamExample(array $param): string { $type = $param['type'] ?? ''; $example = $param['example'] ?? ''; $output = ''; - if(empty($example) && $example !== 0 && $example !== false) { + if (empty($example) && $example !== 0 && $example !== false) { switch ($type) { case self::TYPE_NUMBER: case self::TYPE_INTEGER: @@ -221,8 +213,7 @@ public function getParamExample(array $param) $output .= "file"; break; } - } - else { + } else { switch ($type) { case self::TYPE_NUMBER: case self::TYPE_INTEGER: @@ -246,4 +237,17 @@ public function getParamExample(array $param) return $output; } + + public function getFilters(): array + { + return [ + new TwigFilter('godocComment', function ($value) { + $value = explode("\n", $value); + foreach ($value as $key => $line) { + $value[$key] = "// " . wordwrap($line, 75, "\n// "); + } + return implode("\n", $value); + }, ['is_safe' => ['html']]) + ]; + } } diff --git a/src/SDK/Language/GraphQL.php b/src/SDK/Language/GraphQL.php new file mode 100644 index 0000000000..628f7598f7 --- /dev/null +++ b/src/SDK/Language/GraphQL.php @@ -0,0 +1,185 @@ +getTypeName($parameter['array']) . ']'; + break; + } + $type = '[String]'; + break; + case self::TYPE_OBJECT: + $type = 'JSON'; + break; + } + + if (empty($type)) { + $type = $parameter['type']; + } + + if ($parameter['required'] ?? false) { + $type .= '!'; + } + + return $type; + } + + /** + * @param array $param + * @return string + */ + public function getParamDefault(array $param): string + { + $type = $param['type'] ?? ''; + $default = $param['default'] ?? ''; + $required = $param['required'] ?? ''; + + if ($required) { + return ''; + } + + $output = ''; + + if (empty($default) && $default !== 0 && $default !== false) { + switch ($type) { + case self::TYPE_OBJECT: + $output .= '{}'; + break; + case self::TYPE_NUMBER: + case self::TYPE_INTEGER: + $output .= '0'; + break; + case self::TYPE_BOOLEAN: + $output .= 'false'; + break; + case self::TYPE_ARRAY: + $output .= '[]'; + break; + case self::TYPE_STRING: + $output .= '""'; + break; + } + } else { + switch ($type) { + case self::TYPE_OBJECT: + case self::TYPE_NUMBER: + case self::TYPE_ARRAY: + case self::TYPE_INTEGER: + $output .= $default; + break; + case self::TYPE_BOOLEAN: + $output .= ($default) ? 'true' : 'false'; + break; + case self::TYPE_STRING: + $output .= '"' . $default . '"'; + break; + } + } + + return $output; + } + + /** + * @param array $param + * @return string + */ + public function getParamExample(array $param): string + { + $type = $param['type'] ?? ''; + $example = $param['example'] ?? ''; + + $output = ''; + + if (empty($example) && $example !== 0 && $example !== false) { + switch ($type) { + case self::TYPE_FILE: + $output .= 'null'; + break; + case self::TYPE_NUMBER: + case self::TYPE_INTEGER: + $output .= '0'; + break; + case self::TYPE_BOOLEAN: + $output .= 'false'; + break; + case self::TYPE_STRING: + $output .= '""'; + break; + case self::TYPE_OBJECT: + $output .= '"{}"'; + break; + case self::TYPE_ARRAY: + $output .= '[]'; + break; + } + } else { + switch ($type) { + case self::TYPE_FILE: + case self::TYPE_NUMBER: + case self::TYPE_INTEGER: + case self::TYPE_ARRAY: + $output .= $example; + break; + case self::TYPE_STRING: + case self::TYPE_OBJECT: + $output .= '"' . $example . '"'; + break; + case self::TYPE_BOOLEAN: + $output .= ($example) ? 'true' : 'false'; + break; + } + } + + return $output; + } + + /** + * @return array + */ + public function getFiles(): array + { + return [ + [ + 'scope' => 'method', + 'destination' => 'docs/examples/{{service.name | caseLower}}/{{method.name | caseDash}}.md', + 'template' => '/graphql/docs/example.md.twig', + 'exclude' => [ + 'services' => [['name' => 'graphql']], + 'methods' => [['type' => 'webAuth']], + ], + ], + ]; + } +} diff --git a/src/SDK/Language/HTTP.php b/src/SDK/Language/HTTP.php index fa384484c7..1e674c945a 100644 --- a/src/SDK/Language/HTTP.php +++ b/src/SDK/Language/HTTP.php @@ -3,23 +3,16 @@ namespace Appwrite\SDK\Language; use Appwrite\SDK\Language; +use Exception; -class HTTP extends Language { - - /** - * @return string - */ - public function getName() - { - return 'HTTP'; - } - +abstract class HTTP extends Language +{ /** * Get Language Keywords List * * @return array */ - public function getKeywords() + public function getKeywords(): array { return []; } @@ -27,167 +20,18 @@ public function getKeywords() /** * @return array */ - public function getIdentifierOverrides() + public function getIdentifierOverrides(): array { return []; } /** - * @param $type - * @return string - */ - public function getTypeName($type) - { - switch ($type) { - case self::TYPE_INTEGER: - return 'int'; - break; - case self::TYPE_STRING: - return 'String'; - break; - case self::TYPE_FILE: - return 'MultipartFile'; - break; - case self::TYPE_BOOLEAN: - return 'bool'; - break; - case self::TYPE_ARRAY: - return 'List'; - case self::TYPE_OBJECT: - return 'dynamic'; - break; - } - - return $type; - } - - /** - * @param array $param - * @return string - */ - public function getParamDefault(array $param) - { - $type = $param['type'] ?? ''; - $default = $param['default'] ?? ''; - $required = $param['required'] ?? ''; - - if($required) { - return ''; - } - - $output = ''; - - if(empty($default) && $default !== 0 && $default !== false) { - switch ($type) { - case self::TYPE_OBJECT: - $output .= '{}'; - break; - case self::TYPE_NUMBER: - case self::TYPE_INTEGER: - $output .= '0'; - break; - case self::TYPE_BOOLEAN: - $output .= 'false'; - break; - case self::TYPE_ARRAY: - $output .= '[]'; - break; - case self::TYPE_STRING: - $output .= '""'; - break; - } - } - else { - switch ($type) { - case self::TYPE_OBJECT: - case self::TYPE_NUMBER: - case self::TYPE_INTEGER: - $output .= $default; - break; - case self::TYPE_ARRAY: - $output .= $default; - break; - case self::TYPE_BOOLEAN: - $output .= ($default) ? 'true' : 'false'; - break; - case self::TYPE_STRING: - $output .= '"'.$default .'"'; - break; - } - } - - return $output; - } - - /** - * @param array $param + * @param array $parameter * @return string + * @throws Exception */ - public function getParamExample(array $param) + public function getTypeName(array $parameter): string { - $type = $param['type'] ?? ''; - $example = $param['example'] ?? ''; - - $output = ''; - - if(empty($example) && $example !== 0 && $example !== false) { - switch ($type) { - case self::TYPE_FILE: - $output .= 'cf 94 84 24 8d c4 91 10 0f dc 54 26 6c 8e 4b bc -e8 ee 55 94 29 e7 94 89 19 26 28 01 26 29 3f 16...'; - break; - case self::TYPE_NUMBER: - case self::TYPE_INTEGER: - $output .= '0'; - break; - case self::TYPE_BOOLEAN: - $output .= 'false'; - break; - case self::TYPE_STRING: - $output .= ""; - break; - case self::TYPE_OBJECT: - $output .= '{}'; - break; - case self::TYPE_ARRAY: - $output .= '[]'; - break; - } - } - else { - switch ($type) { - case self::TYPE_OBJECT: - case self::TYPE_FILE: - case self::TYPE_NUMBER: - case self::TYPE_INTEGER: - case self::TYPE_ARRAY: - $output .= $example; - break; - case self::TYPE_BOOLEAN: - $output .= ($example) ? 'true' : 'false'; - break; - case self::TYPE_STRING: - $output .= $example; - break; - } - } - - return $output; - } - - /** - * @return array - */ - public function getFiles() - { - return [ - [ - 'scope' => 'method', - 'destination' => 'docs/examples/{{service.name | caseLower}}/{{method.name | caseDash}}', - 'template' => '/http/docs/example.md.twig', - 'minify' => false, - ], - ]; + throw new Exception('Method not supported for HTTP APIs'); } } - diff --git a/src/SDK/Language/JS.php b/src/SDK/Language/JS.php index 41ebf28021..3ed496b240 100644 --- a/src/SDK/Language/JS.php +++ b/src/SDK/Language/JS.php @@ -4,8 +4,8 @@ use Appwrite\SDK\Language; -abstract class JS extends Language { - +abstract class JS extends Language +{ protected $params = [ 'npmPackage' => 'packageName', 'bowerPackage' => 'packageName', @@ -15,7 +15,7 @@ abstract class JS extends Language { * @param string $name * @return $this */ - public function setNPMPackage($name) + public function setNPMPackage(string $name): self { $this->setParam('npmPackage', $name); @@ -26,7 +26,7 @@ public function setNPMPackage($name) * @param string $name * @return $this */ - public function setBowerPackage($name) + public function setBowerPackage(string $name): self { $this->setParam('bowerPackage', $name); @@ -38,122 +38,124 @@ public function setBowerPackage($name) * * @return array */ - public function getKeywords() + public function getKeywords(): array { return [ 'abstract', - 'arguments', - 'await', // new in ECMAScript 5 and 6. - 'boolean', - 'break', - 'byte', - 'case', - 'catch', - 'char', - 'class', // new in ECMAScript 5 and 6. - 'const', - 'continue', - 'debugger', - 'default', - 'delete', - 'do', - 'double', - 'else', - 'enum', // new in ECMAScript 5 and 6. - 'eval', - 'export', // new in ECMAScript 5 and 6. - 'extends', // new in ECMAScript 5 and 6. - 'false', - 'final', - 'finally', - 'float', - 'for', - 'function', - 'goto', - 'if', - 'implements', - 'import', // new in ECMAScript 5 and 6. - 'in', - 'instanceof', - 'int', - 'interface', - 'let', // new in ECMAScript 5 and 6. - 'long', - 'native', - 'new', - 'null', - 'package', - 'private', - 'protected', - 'public', - 'return', - 'short', - 'static', - 'super', // new in ECMAScript 5 and 6. - 'switch', - 'synchronized', - 'this', - 'throw', - 'throws', - 'transient', - 'true', - 'try', - 'typeof', - 'var', - 'void', - 'volatile', - 'while', - 'with', - 'yield', + 'arguments', + 'await', // new in ECMAScript 5 and 6. + 'boolean', + 'break', + 'byte', + 'case', + 'catch', + 'char', + 'class', // new in ECMAScript 5 and 6. + 'const', + 'continue', + 'debugger', + 'default', + 'delete', + 'do', + 'double', + 'else', + 'enum', // new in ECMAScript 5 and 6. + 'eval', + 'export', // new in ECMAScript 5 and 6. + 'extends', // new in ECMAScript 5 and 6. + 'false', + 'final', + 'finally', + 'float', + 'for', + 'function', + 'goto', + 'if', + 'implements', + 'import', // new in ECMAScript 5 and 6. + 'in', + 'instanceof', + 'int', + 'interface', + 'let', // new in ECMAScript 5 and 6. + 'long', + 'native', + 'new', + 'null', + 'package', + 'private', + 'protected', + 'public', + 'return', + 'short', + 'static', + 'super', // new in ECMAScript 5 and 6. + 'switch', + 'synchronized', + 'this', + 'throw', + 'throws', + 'transient', + 'true', + 'try', + 'typeof', + 'var', + 'void', + 'volatile', + 'while', + 'with', + 'yield', ]; } /** * @return array */ - public function getIdentifierOverrides() + public function getIdentifierOverrides(): array { return []; } /** - * @param $type + * @param array $parameter + * @param array $nestedTypes * @return string */ - public function getTypeName($type) + public function getTypeName(array $parameter): string { - switch ($type) { + switch ($parameter['type']) { case self::TYPE_INTEGER: case self::TYPE_NUMBER: return 'number'; - break; case self::TYPE_ARRAY: + if (!empty($parameter['array']['type'])) { + return $this->getTypeName($parameter['array']) . '[]'; + } return 'string[]'; case self::TYPE_FILE: return 'File'; - break; } - return $type; + return $parameter['type']; } /** * @param array $param * @return string */ - public function getParamDefault(array $param) + public function getParamDefault(array $param): string { $type = $param['type'] ?? ''; $default = $param['default'] ?? ''; $required = $param['required'] ?? ''; - if($required) { + if ($required) { return ''; } $output = ' = '; - if(empty($default) && $default !== 0 && $default !== false) { + if (empty($default) && $default !== 0 && $default !== false) { switch ($type) { case self::TYPE_NUMBER: case self::TYPE_INTEGER: @@ -170,8 +172,7 @@ public function getParamDefault(array $param) $output .= '{}'; break; } - } - else { + } else { switch ($type) { case self::TYPE_NUMBER: case self::TYPE_INTEGER: diff --git a/src/SDK/Language/Kotlin.php b/src/SDK/Language/Kotlin.php index c5d75be898..f6a2af02b5 100644 --- a/src/SDK/Language/Kotlin.php +++ b/src/SDK/Language/Kotlin.php @@ -3,13 +3,14 @@ namespace Appwrite\SDK\Language; use Appwrite\SDK\Language; +use Twig\TwigFilter; -class Kotlin extends Language { - +class Kotlin extends Language +{ /** * @return string */ - public function getName() + public function getName(): string { return 'Kotlin'; } @@ -19,7 +20,7 @@ public function getName() * * @return array */ - public function getKeywords() + public function getKeywords(): array { return [ "abstract", @@ -92,7 +93,7 @@ public function getKeywords() /** * @return array */ - public function getIdentifierOverrides() + public function getIdentifierOverrides(): array { return []; } @@ -101,9 +102,9 @@ public function getIdentifierOverrides() * @param $type * @return string */ - public function getTypeName($type) + public function getTypeName(array $parameter): string { - switch ($type) { + switch ($parameter['type']) { case self::TYPE_INTEGER: return 'Long'; case self::TYPE_NUMBER: @@ -111,35 +112,38 @@ public function getTypeName($type) case self::TYPE_STRING: return 'String'; case self::TYPE_FILE: - return 'File'; + return 'InputFile'; case self::TYPE_BOOLEAN: return 'Boolean'; case self::TYPE_ARRAY: - return 'List'; - case self::TYPE_OBJECT: - return 'Any'; + if (!empty($parameter['array']['type'])) { + return 'List<' . $this->getTypeName($parameter['array']) . '>'; + } + return 'List'; + case self::TYPE_OBJECT: + return 'Any'; } - return $type; + return $parameter['type']; } /** * @param array $param * @return string */ - public function getParamDefault(array $param) + public function getParamDefault(array $param): string { $type = $param['type'] ?? ''; $default = $param['default'] ?? ''; $required = $param['required'] ?? ''; - if($required) { + if ($required) { return ''; } $output = ' = '; - if(empty($default) && $default !== 0 && $default !== false) { + if (empty($default) && $default !== 0 && $default !== false) { switch ($type) { case self::TYPE_INTEGER: $output .= '-1'; @@ -158,14 +162,13 @@ public function getParamDefault(array $param) $output .= '""'; break; } - } - else { + } else { switch ($type) { case self::TYPE_INTEGER: $output .= $default; break; case self::TYPE_NUMBER: - $output .= sprintf("%.1f",$default);; + $output .= sprintf("%.1f", $default); break; case self::TYPE_BOOLEAN: $output .= ($default) ? 'true' : 'false'; @@ -187,22 +190,22 @@ public function getParamDefault(array $param) * @param array $param * @return string */ - public function getParamExample(array $param) + public function getParamExample(array $param): string { $type = $param['type'] ?? ''; $example = $param['example'] ?? ''; $output = ''; - if(empty($example) && $example !== 0 && $example !== false) { + if (empty($example) && $example !== 0 && $example !== false) { switch ($type) { case self::TYPE_FILE: - $output .= 'File("file.png")'; + $output .= 'InputFile.fromPath("file.png")'; break; case self::TYPE_NUMBER: case self::TYPE_INTEGER: $output .= '0'; - break; + break; case self::TYPE_BOOLEAN: $output .= 'false'; break; @@ -216,8 +219,7 @@ public function getParamExample(array $param) $output .= 'listOf()'; break; } - } - else { + } else { switch ($type) { case self::TYPE_OBJECT: $output .= 'mapOf( "a" to "b" )'; @@ -225,9 +227,17 @@ public function getParamExample(array $param) case self::TYPE_FILE: case self::TYPE_NUMBER: case self::TYPE_INTEGER: - case self::TYPE_ARRAY: $output .= $example; break; + case self::TYPE_ARRAY: + if (\str_starts_with($example, '[')) { + $example = \substr($example, 1); + } + if (\str_ends_with($example, ']')) { + $example = \substr($example, 0, -1); + } + $output .= 'listOf(' . $example . ')'; + break; case self::TYPE_BOOLEAN: $output .= ($example) ? 'true' : 'false'; break; @@ -243,27 +253,24 @@ public function getParamExample(array $param) /** * @return array */ - public function getFiles() + public function getFiles(): array { return [ - // Config for root project + // Config for root project [ 'scope' => 'copy', 'destination' => '.github/workflows/publish.yml', 'template' => '/kotlin/.github/workflows/publish.yml', - 'minify' => false, ], [ 'scope' => 'method', 'destination' => 'docs/examples/kotlin/{{service.name | caseLower}}/{{method.name | caseDash}}.md', 'template' => '/kotlin/docs/kotlin/example.md.twig', - 'minify' => false, ], [ 'scope' => 'method', 'destination' => 'docs/examples/java/{{service.name | caseLower}}/{{method.name | caseDash}}.md', 'template' => '/kotlin/docs/java/example.md.twig', - 'minify' => false, ], [ 'scope' => 'copy', @@ -274,135 +281,241 @@ public function getFiles() 'scope' => 'copy', 'destination' => 'gradle/wrapper/gradle-wrapper.properties', 'template' => '/kotlin/gradle/wrapper/gradle-wrapper.properties', - 'minify' => false, ], [ 'scope' => 'copy', 'destination' => 'scripts/configure.gradle', 'template' => '/kotlin/scripts/configure.gradle', - 'minify' => false, ], [ 'scope' => 'copy', 'destination' => 'scripts/publish.gradle', 'template' => '/kotlin/scripts/publish.gradle', - 'minify' => false, ], [ 'scope' => 'copy', 'destination' => 'scripts/setup.gradle', 'template' => '/kotlin/scripts/setup.gradle', - 'minify' => false, ], [ 'scope' => 'copy', 'destination' => '.gitignore', 'template' => '/kotlin/.gitignore', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'build.gradle', 'template' => '/kotlin/build.gradle.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'CHANGELOG.md', 'template' => '/kotlin/CHANGELOG.md.twig', - 'minify' => false, ], [ 'scope' => 'copy', 'destination' => 'gradle.properties', 'template' => '/kotlin/gradle.properties', - 'minify' => false, ], [ 'scope' => 'copy', 'destination' => 'gradlew', 'template' => '/kotlin/gradlew', - 'minify' => false, ], [ 'scope' => 'copy', 'destination' => 'gradlew.bat', 'template' => '/kotlin/gradlew.bat', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'LICENSE.md', 'template' => '/kotlin/LICENSE.md.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'README.md', 'template' => '/kotlin/README.md.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'settings.gradle', 'template' => '/kotlin/settings.gradle.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/src/main/kotlin/{{ sdk.namespace | caseSlash }}/Client.kt', 'template' => '/kotlin/src/main/kotlin/io/appwrite/Client.kt.twig', - 'minify' => false, + ], + [ + 'scope' => 'default', + 'destination' => '/src/main/kotlin/{{ sdk.namespace | caseSlash }}/Permission.kt', + 'template' => '/kotlin/src/main/kotlin/io/appwrite/Permission.kt.twig', + ], + [ + 'scope' => 'default', + 'destination' => '/src/main/kotlin/{{ sdk.namespace | caseSlash }}/Role.kt', + 'template' => '/kotlin/src/main/kotlin/io/appwrite/Role.kt.twig', + ], + [ + 'scope' => 'default', + 'destination' => '/src/main/kotlin/{{ sdk.namespace | caseSlash }}/ID.kt', + 'template' => '/kotlin/src/main/kotlin/io/appwrite/ID.kt.twig', ], [ 'scope' => 'default', 'destination' => '/src/main/kotlin/{{ sdk.namespace | caseSlash }}/Query.kt', 'template' => '/kotlin/src/main/kotlin/io/appwrite/Query.kt.twig', - 'minify' => false, + ], + [ + 'scope' => 'default', + 'destination' => '/src/main/kotlin/{{ sdk.namespace | caseSlash }}/coroutines/Callback.kt', + 'template' => '/android/library/src/main/java/io/appwrite/coroutines/Callback.kt.twig', ], [ 'scope' => 'default', 'destination' => '/src/main/kotlin/{{ sdk.namespace | caseSlash }}/exceptions/{{spec.title | caseUcfirst}}Exception.kt', 'template' => '/kotlin/src/main/kotlin/io/appwrite/exceptions/Exception.kt.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/src/main/kotlin/{{ sdk.namespace | caseSlash }}/extensions/JsonExtensions.kt', 'template' => '/kotlin/src/main/kotlin/io/appwrite/extensions/JsonExtensions.kt.twig', + ], + [ + 'scope' => 'default', + 'destination' => '/src/main/kotlin/{{ sdk.namespace | caseSlash }}/extensions/TypeExtensions.kt', + 'template' => '/kotlin/src/main/kotlin/io/appwrite/extensions/TypeExtensions.kt.twig', 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/src/main/kotlin/{{ sdk.namespace | caseSlash }}/json/PreciseNumberAdapter.kt', 'template' => '/kotlin/src/main/kotlin/io/appwrite/json/PreciseNumberAdapter.kt.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/src/main/kotlin/{{ sdk.namespace | caseSlash }}/services/Service.kt', 'template' => '/kotlin/src/main/kotlin/io/appwrite/services/Service.kt.twig', - 'minify' => false, ], [ 'scope' => 'service', 'destination' => '/src/main/kotlin/{{ sdk.namespace | caseSlash }}/services/{{service.name | caseUcfirst}}.kt', 'template' => '/kotlin/src/main/kotlin/io/appwrite/services/ServiceTemplate.kt.twig', - 'minify' => false, + ], + [ + 'scope' => 'default', + 'destination' => '/src/main/kotlin/{{ sdk.namespace | caseSlash }}/models/InputFile.kt', + 'template' => '/kotlin/src/main/kotlin/io/appwrite/models/InputFile.kt.twig', ], [ 'scope' => 'default', 'destination' => '/src/main/kotlin/{{ sdk.namespace | caseSlash }}/models/UploadProgress.kt', 'template' => '/kotlin/src/main/kotlin/io/appwrite/models/UploadProgress.kt.twig', - 'minify' => false, ], [ 'scope' => 'definition', 'destination' => '/src/main/kotlin/{{ sdk.namespace | caseSlash }}/models/{{ definition.name | caseUcfirst }}.kt', 'template' => '/kotlin/src/main/kotlin/io/appwrite/models/Model.kt.twig', - 'minify' => false, ], ]; } -} + public function getFilters(): array + { + return [ + new TwigFilter('returnType', function (array $method, array $spec, string $namespace, string $generic = 'T') { + return $this->getReturnType($method, $spec, $namespace, $generic); + }), + new TwigFilter('modelType', function (array $property, array $spec, string $generic = 'T') { + return $this->getModelType($property, $spec, $generic); + }), + new TwigFilter('propertyType', function (array $property, array $spec, string $generic = 'T') { + return $this->getPropertyType($property, $spec, $generic); + }), + new TwigFilter('hasGenericType', function (string $model, array $spec) { + return $this->hasGenericType($model, $spec); + }), + ]; + } + + protected function getReturnType(array $method, array $spec, string $namespace, string $generic = 'T'): string + { + if ($method['type'] === 'webAuth') { + return 'Bool'; + } + if ($method['type'] === 'location') { + return 'ByteArray'; + } + + if ( + !\array_key_exists('responseModel', $method) + || empty($method['responseModel']) + || $method['responseModel'] === 'any' + ) { + return 'Any'; + } + + $ret = $this->toUpperCaseWords($method['responseModel']); + + if ($this->hasGenericType($method['responseModel'], $spec)) { + $ret .= '<' . $generic . '>'; + } + + return $namespace . '.models.' . $ret; + } + + protected function getModelType(array $definition, array $spec, string $generic = 'T'): string + { + if ($this->hasGenericType($definition['name'], $spec)) { + return $this->toUpperCaseWords($definition['name']) . '<' . $generic . '>'; + } + return $this->toUpperCaseWords($definition['name']); + } + + protected function getPropertyType(array $property, array $spec, string $generic = 'T'): string + { + if (\array_key_exists('sub_schema', $property)) { + $type = $this->toUpperCaseWords($property['sub_schema']); + + if ($this->hasGenericType($property['sub_schema'], $spec)) { + $type .= '<' . $generic . '>'; + } + + if ($property['type'] === 'array') { + $type = 'List<' . $type . '>'; + } + } else { + $type = $this->getTypeName($property); + } + + if (!$property['required']) { + $type .= '?'; + } + + return $type; + } + + protected function hasGenericType(?string $model, array $spec): string + { + if (empty($model) || $model === 'any') { + return false; + } + + $model = $spec['definitions'][$model]; + + if ($model['additionalProperties']) { + return true; + } + + foreach ($model['properties'] as $property) { + if (!\array_key_exists('sub_schema', $property) || !$property['sub_schema']) { + continue; + } + + return $this->hasGenericType($property['sub_schema'], $spec); + } + + return false; + } +} diff --git a/src/SDK/Language/Node.php b/src/SDK/Language/Node.php index dbb3daf3cd..435e1cce0d 100644 --- a/src/SDK/Language/Node.php +++ b/src/SDK/Language/Node.php @@ -7,115 +7,124 @@ class Node extends JS /** * @return string */ - public function getName() + public function getName(): string { return 'NodeJS'; } /** - * @param $type + * @param array $parameter + * @param array $nestedTypes * @return string */ - public function getTypeName($type) + public function getTypeName(array $parameter): string { - switch ($type) { + switch ($parameter['type']) { case self::TYPE_INTEGER: case self::TYPE_NUMBER: return 'number'; - break; case self::TYPE_ARRAY: + if (!empty($parameter['array']['type'])) { + return $this->getTypeName($parameter['array']) . '[]'; + } return 'string[]'; case self::TYPE_FILE: - return 'string'; - break; + return 'InputFile'; } - return $type; + return $parameter['type']; } /** * @return array */ - public function getFiles() + public function getFiles(): array { return [ [ 'scope' => 'default', 'destination' => 'index.js', 'template' => 'node/index.js.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'index.d.ts', 'template' => 'node/index.d.ts.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'lib/client.js', 'template' => 'node/lib/client.js.twig', - 'minify' => false, + ], + [ + 'scope' => 'default', + 'destination' => 'lib/permission.js', + 'template' => 'node/lib/permission.js.twig', + ], + [ + 'scope' => 'default', + 'destination' => 'lib/role.js', + 'template' => 'node/lib/role.js.twig', + ], + [ + 'scope' => 'default', + 'destination' => 'lib/id.js', + 'template' => 'node/lib/id.js.twig', ], [ 'scope' => 'default', 'destination' => 'lib/query.js', 'template' => 'node/lib/query.js.twig', - 'minify' => false, + ], + [ + 'scope' => 'default', + 'destination' => 'lib/inputFile.js', + 'template' => 'node/lib/inputFile.js.twig', ], [ 'scope' => 'default', 'destination' => '/lib/service.js', 'template' => 'node/lib/service.js.twig', - 'minify' => false, ], [ 'scope' => 'service', 'destination' => '/lib/services/{{service.name | caseDash}}.js', 'template' => 'node/lib/services/service.js.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'README.md', 'template' => 'node/README.md.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'CHANGELOG.md', 'template' => 'node/CHANGELOG.md.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'LICENSE', 'template' => 'node/LICENSE.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'package.json', 'template' => 'node/package.json.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'lib/exception.js', 'template' => 'node/lib/exception.js.twig', - 'minify' => false, ], [ 'scope' => 'method', 'destination' => 'docs/examples/{{service.name | caseLower}}/{{method.name | caseDash}}.md', 'template' => 'node/docs/example.md.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '.travis.yml', 'template' => 'node/.travis.yml.twig', - 'minify' => false, ], ]; } @@ -124,14 +133,14 @@ public function getFiles() * @param array $param * @return string */ - public function getParamExample(array $param) + public function getParamExample(array $param): string { $type = $param['type'] ?? ''; $example = $param['example'] ?? ''; $output = ''; - if(empty($example) && $example !== 0 && $example !== false) { + if (empty($example) && $example !== 0 && $example !== false) { switch ($type) { case self::TYPE_NUMBER: case self::TYPE_INTEGER: @@ -148,11 +157,10 @@ public function getParamExample(array $param) $output .= '{}'; break; case self::TYPE_FILE: - $output .= "'file.png'"; + $output .= "InputFile.fromPath('/path/to/file.png', 'file.png')"; break; } - } - else { + } else { switch ($type) { case self::TYPE_NUMBER: case self::TYPE_INTEGER: @@ -167,11 +175,11 @@ public function getParamExample(array $param) $output .= "'{$example}'"; break; case self::TYPE_FILE: - $output .= "'file.png'"; + $output .= "InputFile.fromPath('/path/to/file.png', 'file.png')"; break; } } return $output; } -} \ No newline at end of file +} diff --git a/src/SDK/Language/PHP.php b/src/SDK/Language/PHP.php index a5d789d232..527ba6f477 100644 --- a/src/SDK/Language/PHP.php +++ b/src/SDK/Language/PHP.php @@ -3,9 +3,10 @@ namespace Appwrite\SDK\Language; use Appwrite\SDK\Language; +use Twig\TwigFilter; -class PHP extends Language { - +class PHP extends Language +{ /** * @var array */ @@ -18,7 +19,7 @@ class PHP extends Language { * @param string $name * @return $this */ - public function setComposerVendor($name) + public function setComposerVendor(string $name): self { $this->setParam('composerVendor', $name); @@ -29,7 +30,7 @@ public function setComposerVendor($name) * @param string $name * @return $this */ - public function setComposerPackage($name) + public function setComposerPackage(string $name): self { $this->setParam('composerPackage', $name); @@ -39,7 +40,7 @@ public function setComposerPackage($name) /** * @return string */ - public function getName() + public function getName(): string { return 'PHP'; } @@ -49,81 +50,81 @@ public function getName() * * @return array */ - public function getKeywords() + public function getKeywords(): array { return [ '__halt_compiler', - 'abstract', - 'and', - 'array', - 'as', - 'break', - 'callable', - 'case', - 'catch', - 'class', - 'clone', - 'const', - 'continue', - 'declare', - 'default', - 'die', - 'do', - 'echo', - 'else', - 'elseif', - 'empty', - 'enddeclare', - 'endfor', - 'endforeach', - 'endif', - 'endswitch', - 'endwhile', - 'eval', - 'exit', - 'extends', - 'final', - 'for', - 'foreach', - 'function', - 'global', - 'goto', - 'if', - 'implements', - 'include', - 'include_once', - 'instanceof', - 'insteadof', - 'interface', - 'isset', - 'list', - 'namespace', - 'new', - 'or', - 'print', - 'private', - 'protected', - 'public', - 'require', - 'require_once', - 'return', - 'static', - 'switch', - 'throw', - 'trait', - 'try', - 'unset', - 'use', - 'var', - 'while', - 'xor' + 'abstract', + 'and', + 'array', + 'as', + 'break', + 'callable', + 'case', + 'catch', + 'class', + 'clone', + 'const', + 'continue', + 'declare', + 'default', + 'die', + 'do', + 'echo', + 'else', + 'elseif', + 'empty', + 'enddeclare', + 'endfor', + 'endforeach', + 'endif', + 'endswitch', + 'endwhile', + 'eval', + 'exit', + 'extends', + 'final', + 'for', + 'foreach', + 'function', + 'global', + 'goto', + 'if', + 'implements', + 'include', + 'include_once', + 'instanceof', + 'insteadof', + 'interface', + 'isset', + 'list', + 'namespace', + 'new', + 'or', + 'print', + 'private', + 'protected', + 'public', + 'require', + 'require_once', + 'return', + 'static', + 'switch', + 'throw', + 'trait', + 'try', + 'unset', + 'use', + 'var', + 'while', + 'xor' ]; } /** * @return array */ - public function getIdentifierOverrides() + public function getIdentifierOverrides(): array { return []; } @@ -131,86 +132,99 @@ public function getIdentifierOverrides() /** * @return array */ - public function getFiles() + public function getFiles(): array { return [ [ 'scope' => 'default', 'destination' => 'README.md', 'template' => 'php/README.md.twig', - 'minify' => false, //'block' => 'default', ], [ 'scope' => 'default', 'destination' => 'CHANGELOG.md', 'template' => 'php/CHANGELOG.md.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'LICENSE', 'template' => 'php/LICENSE.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'composer.json', 'template' => 'php/composer.json.twig', - 'minify' => false, ], [ 'scope' => 'service', 'destination' => 'docs/{{service.name | caseLower}}.md', 'template' => 'php/docs/service.md.twig', - 'minify' => false, ], [ 'scope' => 'method', 'destination' => 'docs/examples/{{service.name | caseLower}}/{{method.name | caseDash}}.md', 'template' => 'php/docs/example.md.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'src/{{ spec.title | caseUcfirst}}/Client.php', 'template' => 'php/src/Client.php.twig', - 'minify' => false, + ], + [ + 'scope' => 'default', + 'destination' => 'src/{{ spec.title | caseUcfirst}}/Permission.php', + 'template' => 'php/src/Permission.php.twig', + ], + [ + 'scope' => 'default', + 'destination' => 'src/{{ spec.title | caseUcfirst}}/Role.php', + 'template' => 'php/src/Role.php.twig', + ], + [ + 'scope' => 'default', + 'destination' => 'src/{{ spec.title | caseUcfirst}}/ID.php', + 'template' => 'php/src/ID.php.twig', ], [ 'scope' => 'default', 'destination' => 'src/{{ spec.title | caseUcfirst}}/Query.php', 'template' => 'php/src/Query.php.twig', - 'minify' => false, + ], + [ + 'scope' => 'default', + 'destination' => 'src/{{ spec.title | caseUcfirst}}/InputFile.php', + 'template' => 'php/src/InputFile.php.twig', ], [ 'scope' => 'default', 'destination' => 'src/{{ spec.title | caseUcfirst}}/{{ spec.title | caseUcfirst}}Exception.php', 'template' => 'php/src/Exception.php.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/src/{{ spec.title | caseUcfirst}}/Service.php', 'template' => 'php/src/Service.php.twig', - 'minify' => false, ], [ 'scope' => 'service', 'destination' => '/src/{{ spec.title | caseUcfirst}}/Services/{{service.name | caseUcfirst}}.php', 'template' => 'php/src/Services/Service.php.twig', - 'minify' => false, ], ]; } /** - * @param $type + * @param array $parameter + * @param array $nestedTypes * @return string */ - public function getTypeName($type) + public function getTypeName(array $parameter): string { - switch ($type) { + switch ($parameter['type']) { + case self::TYPE_STRING: + $type = 'string'; + break; case self::TYPE_BOOLEAN: $type = 'bool'; break; @@ -218,11 +232,12 @@ public function getTypeName($type) case self::TYPE_INTEGER: $type = 'int'; break; + case self::TYPE_ARRAY: case self::TYPE_OBJECT: $type = 'array'; break; case self::TYPE_FILE: - $type = 'string'; + $type = 'InputFile'; break; } @@ -233,19 +248,19 @@ public function getTypeName($type) * @param array $param * @return string */ - public function getParamDefault(array $param) + public function getParamDefault(array $param): string { $type = $param['type'] ?? ''; $default = $param['default'] ?? ''; $required = $param['required'] ?? ''; - if($required) { + if ($required) { return ''; } $output = ' = '; - if(empty($default) && $default !== 0 && $default !== false) { + if (empty($default) && $default !== 0 && $default !== false) { switch ($type) { case self::TYPE_NUMBER: case self::TYPE_INTEGER: @@ -260,8 +275,7 @@ public function getParamDefault(array $param) $output .= '[]'; break; } - } - else { + } else { switch ($type) { case self::TYPE_NUMBER: case self::TYPE_INTEGER: @@ -287,14 +301,14 @@ public function getParamDefault(array $param) * @param array $param * @return string */ - public function getParamExample(array $param) + public function getParamExample(array $param): string { $type = $param['type'] ?? ''; $example = $param['example'] ?? ''; $output = ''; - if(empty($example) && $example !== 0 && $example !== false) { + if (empty($example) && $example !== 0 && $example !== false) { switch ($type) { case self::TYPE_NUMBER: case self::TYPE_INTEGER: @@ -309,11 +323,10 @@ public function getParamExample(array $param) $output .= '[]'; break; case self::TYPE_FILE: - $output .= "'file.png'"; + $output .= "InputFile::withPath('file.png')"; break; } - } - else { + } else { switch ($type) { case self::TYPE_NUMBER: case self::TYPE_INTEGER: @@ -330,7 +343,7 @@ public function getParamExample(array $param) $output .= "'{$example}'"; break; case self::TYPE_FILE: - $output .= "'file.png'"; + $output .= "InputFile::withPath('file.png')"; break; } } @@ -340,20 +353,38 @@ public function getParamExample(array $param) /** * Converts JSON Object To PHP Native Assoc Array - * + * * @var $data array */ - protected function jsonToAssoc(array $data):string + protected function jsonToAssoc(array $data): string { $output = '['; - - foreach($data as $key => $node) { + + foreach ($data as $key => $node) { $value = (is_array($node)) ? $this->jsonToAssoc($node) : $node; - $output .= '\''.$key.'\' => '.((is_string($node)) ? '\''.$value.'\'' : $value).(($key !== array_key_last($data)) ? ', ' : ''); + $output .= '\'' . $key . '\' => ' . ((is_string($node)) ? '\'' . $value . '\'' : $value) . (($key !== \array_key_last($data)) ? ', ' : ''); } $output .= ']'; return $output; } + + protected function getReturn(array $method): string + { + if (($method['emptyResponse'] ?? true) || $method['type'] === 'location') { + return 'string'; + } + + return 'array'; + } + + public function getFilters(): array + { + return [ + new TwigFilter('getReturn', function ($value) { + return $this->getReturn($value); + }) + ]; + } } diff --git a/src/SDK/Language/Python.php b/src/SDK/Language/Python.php index a49940fb2f..c8d19e639b 100644 --- a/src/SDK/Language/Python.php +++ b/src/SDK/Language/Python.php @@ -5,8 +5,8 @@ use Appwrite\SDK\Language; use Exception; -class Python extends Language { - +class Python extends Language +{ protected $params = [ 'pipPackage' => 'packageName', ]; @@ -15,7 +15,7 @@ class Python extends Language { * @param string $name * @return $this */ - public function setPipPackage($name) + public function setPipPackage(string $name): self { $this->setParam('pipPackage', $name); @@ -25,7 +25,7 @@ public function setPipPackage($name) /** * @return string */ - public function getName() + public function getName(): string { return 'Python'; } @@ -35,7 +35,7 @@ public function getName() * * @return array */ - public function getKeywords() + public function getKeywords(): array { return [ 'False', @@ -78,7 +78,7 @@ public function getKeywords() /** * @return array */ - public function getIdentifierOverrides() + public function getIdentifierOverrides(): array { return []; } @@ -86,131 +86,113 @@ public function getIdentifierOverrides() /** * @return array */ - public function getFiles() + public function getFiles(): array { return [ [ 'scope' => 'default', 'destination' => 'README.md', 'template' => 'python/README.md.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'CHANGELOG.md', 'template' => 'python/CHANGELOG.md.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'LICENSE', 'template' => 'python/LICENSE.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'setup.py', 'template' => 'python/setup.py.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'setup.cfg', 'template' => 'python/setup.cfg.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'requirements.txt', 'template' => 'python/requirements.txt.twig', - 'minify' => false, - ], - /*[ - 'scope' => 'service', - 'destination' => 'docs/{{service.name | caseSnake}}.md', - 'template' => 'python/docs/service.md.twig', - 'minify' => false, - ], - [ - 'scope' => 'service', - 'destination' => 'docs/{{service.name | caseSnake}}.md', - 'template' => 'python/docs/service.md.twig', - 'minify' => false, ], - [ - 'scope' => 'method', - 'destination' => 'docs/examples/{{service.name | caseSnake}}/{{method.name | caseSnake}}.md', - 'template' => 'python/docs/example.md.twig', - 'minify' => false, - ],*/ [ 'scope' => 'default', 'destination' => '{{ spec.title | caseSnake}}/__init__.py', 'template' => 'python/package/__init__.py.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '{{ spec.title | caseSnake}}/client.py', 'template' => 'python/package/client.py.twig', - 'minify' => false, + ], + [ + 'scope' => 'default', + 'destination' => '{{ spec.title | caseSnake}}/permission.py', + 'template' => 'python/package/permission.py.twig', + ], + [ + 'scope' => 'default', + 'destination' => '{{ spec.title | caseSnake}}/role.py', + 'template' => 'python/package/role.py.twig', + ], + [ + 'scope' => 'default', + 'destination' => '{{ spec.title | caseSnake}}/id.py', + 'template' => 'python/package/id.py.twig', ], [ 'scope' => 'default', 'destination' => '{{ spec.title | caseSnake}}/query.py', 'template' => 'python/package/query.py.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '{{ spec.title | caseSnake}}/exception.py', 'template' => 'python/package/exception.py.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '{{ spec.title | caseSnake}}/input_file.py', 'template' => 'python/package/input_file.py.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '{{ spec.title | caseSnake}}/service.py', 'template' => 'python/package/service.py.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '{{ spec.title | caseSnake}}/services/__init__.py', 'template' => 'python/package/services/__init__.py.twig', - 'minify' => false, ], [ 'scope' => 'service', 'destination' => '{{ spec.title | caseSnake}}/services/{{service.name | caseSnake}}.py', 'template' => 'python/package/services/service.py.twig', - 'minify' => false, ], [ 'scope' => 'method', 'destination' => 'docs/examples/{{service.name | caseLower}}/{{method.name | caseDash}}.md', 'template' => 'python/docs/example.md.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '.travis.yml', 'template' => 'python/.travis.yml.twig', - 'minify' => false, ], ]; } /** - * @param $type + * @param array $parameter * @return string + * @throws Exception */ - public function getTypeName($type) + public function getTypeName(array $parameter): string { throw new Exception('Method not supported for Python SDKs'); } @@ -219,19 +201,19 @@ public function getTypeName($type) * @param array $param * @return string */ - public function getParamDefault(array $param) + public function getParamDefault(array $param): string { $type = $param['type'] ?? ''; $default = $param['default'] ?? ''; $required = $param['required'] ?? ''; - if($required) { + if ($required) { return ''; } $output = '='; - if(empty($default) && $default !== 0 && $default !== false) { + if (empty($default) && $default !== 0 && $default !== false) { switch ($type) { case self::TYPE_NUMBER: case self::TYPE_INTEGER: @@ -249,8 +231,7 @@ public function getParamDefault(array $param) $output .= '{}'; break; } - } - else { + } else { switch ($type) { case self::TYPE_NUMBER: case self::TYPE_INTEGER: @@ -259,7 +240,6 @@ public function getParamDefault(array $param) $output .= $default; break; case self::TYPE_FILE: - #$output .= json_encode($default); $output .= '{}'; break; case self::TYPE_BOOLEAN: @@ -278,14 +258,14 @@ public function getParamDefault(array $param) * @param array $param * @return string */ - public function getParamExample(array $param) + public function getParamExample(array $param): string { $type = $param['type'] ?? ''; $example = $param['example'] ?? ''; $output = ''; - if(empty($example) && $example !== 0 && $example !== false) { + if (empty($example) && $example !== 0 && $example !== false) { switch ($type) { case self::TYPE_NUMBER: case self::TYPE_INTEGER: @@ -302,11 +282,10 @@ public function getParamExample(array $param) $output .= '{}'; break; case self::TYPE_FILE: - $output .= "'file.png'"; + $output .= "InputFile.from_path('file.png')"; break; } - } - else { + } else { switch ($type) { case self::TYPE_NUMBER: case self::TYPE_INTEGER: @@ -321,7 +300,7 @@ public function getParamExample(array $param) $output .= "'{$example}'"; break; case self::TYPE_FILE: - $output .= "'file.png'"; + $output .= "InputFile.from_path('file.png')"; break; } } diff --git a/src/SDK/Language/REST.php b/src/SDK/Language/REST.php new file mode 100644 index 0000000000..1d2ff1907f --- /dev/null +++ b/src/SDK/Language/REST.php @@ -0,0 +1,149 @@ + 'method', + 'destination' => 'docs/examples/{{service.name | caseLower}}/{{method.name | caseDash}}.md', + 'template' => '/rest/docs/example.md.twig', + ], + ]; + } +} diff --git a/src/SDK/Language/Ruby.php b/src/SDK/Language/Ruby.php index c8b5eea41d..d05021146a 100644 --- a/src/SDK/Language/Ruby.php +++ b/src/SDK/Language/Ruby.php @@ -3,9 +3,10 @@ namespace Appwrite\SDK\Language; use Appwrite\SDK\Language; +use Twig\TwigFilter; -class Ruby extends Language { - +class Ruby extends Language +{ protected $params = [ 'gemPackage' => 'gemName', ]; @@ -14,7 +15,7 @@ class Ruby extends Language { * @param string $name * @return $this */ - public function setGemPackage($name) + public function setGemPackage(string $name): self { $this->setParam('gemPackage', $name); @@ -24,7 +25,7 @@ public function setGemPackage($name) /** * @return string */ - public function getName() + public function getName(): string { return 'Ruby'; } @@ -34,52 +35,52 @@ public function getName() * * @return array */ - public function getKeywords() + public function getKeywords(): array { return [ 'BEGIN', - 'END', - 'alias', - 'and', - 'begin', - 'break', - 'case', - 'class', - 'def', - 'defined?', - 'do', - 'else', - 'module', - 'next', - 'nil', - 'not', - 'or', - 'redo', - 'rescue', - 'retry', - 'return', - 'self', - 'super', - 'then', - 'elsif', - 'end', - 'false', - 'ensure', - 'for', - 'if', - 'true', - 'undef', - 'unless', - 'until', - 'when', - 'while', + 'END', + 'alias', + 'and', + 'begin', + 'break', + 'case', + 'class', + 'def', + 'defined?', + 'do', + 'else', + 'module', + 'next', + 'nil', + 'not', + 'or', + 'redo', + 'rescue', + 'retry', + 'return', + 'self', + 'super', + 'then', + 'elsif', + 'end', + 'false', + 'ensure', + 'for', + 'if', + 'true', + 'undef', + 'unless', + 'until', + 'when', + 'while', ]; } /** * @return array */ - public function getIdentifierOverrides() + public function getIdentifierOverrides(): array { return []; } @@ -87,134 +88,144 @@ public function getIdentifierOverrides() /** * @return array */ - public function getFiles() + public function getFiles(): array { return [ [ 'scope' => 'default', 'destination' => 'README.md', 'template' => 'ruby/README.md.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'CHANGELOG.md', 'template' => 'ruby/CHANGELOG.md.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'LICENSE', 'template' => 'ruby/LICENSE.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'Gemfile', 'template' => 'ruby/Gemfile.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '{{ spec.title | caseDash }}.gemspec', 'template' => 'ruby/gemspec.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'lib/{{ spec.title | caseDash }}.rb', 'template' => 'ruby/lib/container.rb.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'lib/{{ spec.title | caseDash }}/client.rb', 'template' => 'ruby/lib/container/client.rb.twig', - 'minify' => false, + ], + [ + 'scope' => 'default', + 'destination' => 'lib/{{ spec.title | caseDash }}/permission.rb', + 'template' => 'ruby/lib/container/permission.rb.twig', + ], + [ + 'scope' => 'default', + 'destination' => 'lib/{{ spec.title | caseDash }}/role.rb', + 'template' => 'ruby/lib/container/role.rb.twig', + ], + [ + 'scope' => 'default', + 'destination' => 'lib/{{ spec.title | caseDash }}/id.rb', + 'template' => 'ruby/lib/container/id.rb.twig', ], [ 'scope' => 'default', 'destination' => 'lib/{{ spec.title | caseDash }}/query.rb', 'template' => 'ruby/lib/container/query.rb.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'lib/{{ spec.title | caseDash }}/service.rb', 'template' => 'ruby/lib/container/service.rb.twig', - 'minify' => false, ], [ 'scope' => 'default', - 'destination' => 'lib/{{ spec.title | caseDash }}/file.rb', - 'template' => 'ruby/lib/container/file.rb.twig', - 'minify' => false, + 'destination' => 'lib/{{ spec.title | caseDash }}/input_file.rb', + 'template' => 'ruby/lib/container/input_file.rb.twig', ], [ 'scope' => 'default', 'destination' => 'lib/{{ spec.title | caseDash }}/exception.rb', 'template' => 'ruby/lib/container/exception.rb.twig', - 'minify' => false, ], [ 'scope' => 'service', 'destination' => '/lib/{{ spec.title | caseDash}}/services/{{service.name | caseDash}}.rb', 'template' => 'ruby/lib/container/services/service.rb.twig', - 'minify' => false, ], [ 'scope' => 'method', 'destination' => 'docs/examples/{{service.name | caseLower}}/{{method.name | caseDash}}.md', 'template' => 'ruby/docs/example.md.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '.travis.yml', 'template' => 'ruby/.travis.yml.twig', - 'minify' => false, ], [ 'scope' => 'definition', 'destination' => '/lib/{{ spec.title | caseDash }}/models/{{ definition.name | caseSnake }}.rb', 'template' => 'ruby/lib/container/models/model.rb.twig', - 'minify' => false, ], ]; } /** - * @param $type + * @param array $parameter + * @param array $nestedTypes * @return string */ - public function getTypeName($type) + public function getTypeName(array $parameter): string { - switch ($type) { + switch ($parameter['type']) { case self::TYPE_INTEGER: + return 'Integer'; case self::TYPE_NUMBER: - return 'number'; + return 'Float'; + case self::TYPE_STRING: + return 'String'; + case self::TYPE_ARRAY: + return 'Array'; + case self::TYPE_OBJECT: + return 'Hash'; + case self::TYPE_BOOLEAN: + return ''; + default: + return $parameter['type']; } - - return $type; } /** * @param array $param * @return string */ - public function getParamDefault(array $param) + public function getParamDefault(array $param): string { $type = $param['type'] ?? ''; $default = $param['default'] ?? ''; $required = $param['required'] ?? ''; - if($required) { + if ($required) { return ':'; } $output = ': '; - if(empty($default) && $default !== 0 && $default !== false) { + if (empty($default) && $default !== 0 && $default !== false) { switch ($type) { case self::TYPE_NUMBER: case self::TYPE_INTEGER: @@ -231,8 +242,7 @@ public function getParamDefault(array $param) $output .= '{}'; break; } - } - else { + } else { switch ($type) { case self::TYPE_NUMBER: case self::TYPE_INTEGER: @@ -256,14 +266,14 @@ public function getParamDefault(array $param) * @param array $param * @return string */ - public function getParamExample(array $param) + public function getParamExample(array $param): string { $type = $param['type'] ?? ''; $example = $param['example'] ?? ''; $output = ''; - if(empty($example) && $example !== 0 && $example !== false) { + if (empty($example) && $example !== 0 && $example !== false) { switch ($type) { case self::TYPE_NUMBER: case self::TYPE_INTEGER: @@ -275,16 +285,15 @@ public function getParamExample(array $param) break; case self::TYPE_ARRAY: $output .= '[]'; - break; + break; case self::TYPE_OBJECT: $output .= '{}'; break; case self::TYPE_FILE: - $output .= "'dir/file.png'"; + $output .= "InputFile.from_path('dir/file.png')"; break; } - } - else { + } else { switch ($type) { case self::TYPE_NUMBER: case self::TYPE_INTEGER: @@ -301,7 +310,7 @@ public function getParamExample(array $param) $output .= "'{$example}'"; break; case self::TYPE_FILE: - $output .= "'file.png'"; + $output .= "InputFile.from_path('dir/file.png')"; break; } } @@ -311,20 +320,34 @@ public function getParamExample(array $param) /** * Converts JSON Object To Ruby Native Hash - * + * + * @return string * @var $data array */ - protected function jsonToHash(array $data):string + protected function jsonToHash(array $data): string { $output = '{'; - - foreach($data as $key => $node) { + + foreach ($data as $key => $node) { $value = (is_array($node)) ? $this->jsonToHash($node) : $node; - $output .= '"'.$key.'" => '.((is_string($node)) ? '"'.$value.'"' : $value).(($key !== array_key_last($data)) ? ', ' : ''); + $output .= '"' . $key . '" => ' . ((is_string($node)) ? '"' . $value . '"' : $value) . (($key !== array_key_last($data)) ? ', ' : ''); } $output .= '}'; return $output; } + + public function getFilters(): array + { + return [ + new TwigFilter('rubyComment', function ($value) { + $value = explode("\n", $value); + foreach ($value as $key => $line) { + $value[$key] = " # " . wordwrap($line, 75, "\n # "); + } + return implode("\n", $value); + }, ['is_safe' => ['html']]) + ]; + } } diff --git a/src/SDK/Language/Swift.php b/src/SDK/Language/Swift.php index 11c6ca6e65..edb0213ecc 100644 --- a/src/SDK/Language/Swift.php +++ b/src/SDK/Language/Swift.php @@ -3,13 +3,14 @@ namespace Appwrite\SDK\Language; use Appwrite\SDK\Language; +use Twig\TwigFilter; -class Swift extends Language { - +class Swift extends Language +{ /** * @return string */ - public function getName() + public function getName(): string { return 'Swift'; } @@ -19,7 +20,7 @@ public function getName() * * @return array */ - public function getKeywords() + public function getKeywords(): array { return [ "class", @@ -92,7 +93,7 @@ public function getKeywords() /** * @return array */ - public function getIdentifierOverrides() + public function getIdentifierOverrides(): array { return []; } @@ -100,199 +101,189 @@ public function getIdentifierOverrides() /** * @return array */ - public function getFiles() + public function getFiles(): array { return [ [ 'scope' => 'default', 'destination' => 'README.md', 'template' => 'swift/README.md.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'CHANGELOG.md', 'template' => 'swift/CHANGELOG.md.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'LICENSE', 'template' => 'swift/LICENSE.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'Package.swift', 'template' => 'swift/Package.swift.twig', - 'minify' => false, ], [ 'scope' => 'method', 'destination' => 'docs/examples/{{service.name | caseLower}}/{{method.name | caseDash}}.md', 'template' => 'swift/docs/example.md.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/Tests/{{ spec.title | caseUcfirst}}Tests/Tests.swift', 'template' => 'swift/Tests/Tests.swift.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/Sources/{{ spec.title | caseUcfirst}}/Client.swift', 'template' => 'swift/Sources/Client.swift.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/Sources/{{ spec.title | caseUcfirst}}/Models/{{ spec.title | caseUcfirst}}Error.swift', 'template' => '/swift/Sources/Models/Error.swift.twig', - 'minify' => false, ], [ 'scope' => 'default', - 'destination' => '/Sources/{{ spec.title | caseUcfirst}}/Models/File.swift', - 'template' => 'swift/Sources/Models/File.swift.twig', - 'minify' => false, + 'destination' => '/Sources/{{ spec.title | caseUcfirst}}/Models/InputFile.swift', + 'template' => 'swift/Sources/Models/InputFile.swift.twig', + ], + [ + 'scope' => 'default', + 'destination' => '/Sources/{{ spec.title | caseUcfirst}}/Permission.swift', + 'template' => 'swift/Sources/Permission.swift.twig', + ], + [ + 'scope' => 'default', + 'destination' => '/Sources/{{ spec.title | caseUcfirst}}/Role.swift', + 'template' => 'swift/Sources/Role.swift.twig', + ], + [ + 'scope' => 'default', + 'destination' => '/Sources/{{ spec.title | caseUcfirst}}/ID.swift', + 'template' => 'swift/Sources/ID.swift.twig', ], [ 'scope' => 'default', - 'destination' => '/Sources/{{ spec.title | caseUcfirst}}/Models/Query.swift', - 'template' => 'swift/Sources/Models/Query.swift.twig', - 'minify' => false, + 'destination' => '/Sources/{{ spec.title | caseUcfirst}}/Query.swift', + 'template' => 'swift/Sources/Query.swift.twig', ], [ 'scope' => 'default', 'destination' => '/Sources/{{ spec.title | caseUcfirst}}/Models/UploadProgress.swift', 'template' => 'swift/Sources/Models/UploadProgress.swift.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/Sources/{{ spec.title | caseUcfirst}}/Extensions/Codable+JSON.swift', 'template' => 'swift/Sources/Extensions/Codable+JSON.swift.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/Sources/{{ spec.title | caseUcfirst}}/Extensions/Cookie+Codable.swift', 'template' => 'swift/Sources/Extensions/Cookie+Codable.swift.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/Sources/{{ spec.title | caseUcfirst}}/Extensions/HTTPClientRequest+Cookies.swift', 'template' => 'swift/Sources/Extensions/HTTPClientRequest+Cookies.swift.twig', - 'minify' => false, + ], + [ + 'scope' => 'default', + 'destination' => '/Sources/{{ spec.title | caseUcfirst}}/Extensions/String+MimeTypes.swift', + 'template' => 'swift/Sources/Extensions/String+MimeTypes.swift.twig', ], [ 'scope' => 'default', 'destination' => '/Sources/{{ spec.title | caseUcfirst}}/StreamingDelegate.swift', 'template' => 'swift/Sources/StreamingDelegate.swift.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/Sources/{{ spec.title | caseUcfirst}}/Services/Service.swift', 'template' => 'swift/Sources/Service.swift.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/Sources/{{ spec.title | caseUcfirst}}/DeviceInfo/iOS/iOSDeviceInfo.swift', 'template' => 'swift/Sources/DeviceInfo/iOS/iOSDeviceInfo.swift', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/Sources/{{ spec.title | caseUcfirst}}/DeviceInfo/iOS/UIDevice+ModelName.swift', 'template' => 'swift/Sources/DeviceInfo/iOS/UIDevice+ModelName.swift', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/Sources/{{ spec.title | caseUcfirst}}/DeviceInfo/Linux/LinuxDeviceInfo.swift', 'template' => 'swift/Sources/DeviceInfo/Linux/LinuxDeviceInfo.swift', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/Sources/{{ spec.title | caseUcfirst}}/DeviceInfo/MacOS/MacOSDeviceInfo.swift', 'template' => 'swift/Sources/DeviceInfo/MacOS/MacOSDeviceInfo.swift', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/Sources/{{ spec.title | caseUcfirst}}/DeviceInfo/MacOS/CwlSysCtl.swift', 'template' => 'swift/Sources/DeviceInfo/MacOS/CwlSysCtl.swift', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/Sources/{{ spec.title | caseUcfirst}}/DeviceInfo/Windows/WindowsDeviceInfo.swift', 'template' => 'swift/Sources/DeviceInfo/Windows/WindowsDeviceInfo.swift', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/Sources/{{ spec.title | caseUcfirst}}/DeviceInfo/OSDeviceInfo.swift', 'template' => 'swift/Sources/DeviceInfo/OSDeviceInfo.swift', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/Sources/{{ spec.title | caseUcfirst}}/PackageInfo/Apple/PackageInfo+Apple.swift', 'template' => 'swift/Sources/PackageInfo/Apple/PackageInfo+Apple.swift', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/Sources/{{ spec.title | caseUcfirst}}/PackageInfo/Linux/PackageInfo+Linux.swift', 'template' => 'swift/Sources/PackageInfo/Linux/PackageInfo+Linux.swift', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/Sources/{{ spec.title | caseUcfirst}}/PackageInfo/Windows/PackageInfo+Windows.swift', 'template' => 'swift/Sources/PackageInfo/Windows/PackageInfo+Windows.swift', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/Sources/{{ spec.title | caseUcfirst}}/PackageInfo/OSPackageInfo.swift', 'template' => 'swift/Sources/PackageInfo/OSPackageInfo.swift', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '/Sources/{{ spec.title | caseUcfirst}}/PackageInfo/PackageInfo.swift', 'template' => 'swift/Sources/PackageInfo/PackageInfo.swift', - 'minify' => false, ], [ 'scope' => 'service', 'destination' => '/Sources/{{ spec.title | caseUcfirst}}/Services/{{service.name | caseUcfirst}}.swift', 'template' => 'swift/Sources/Services/Service.swift.twig', - 'minify' => false, ], [ 'scope' => 'definition', 'destination' => '/Sources/{{ spec.title | caseUcfirst}}Models/{{ definition.name | caseUcfirst }}.swift', 'template' => '/swift/Sources/Models/Model.swift.twig', - 'minify' => false, ], ]; } /** - * @param $type + * @param array $parameter * @return string */ - public function getTypeName($type) + public function getTypeName(array $parameter): string { - switch ($type) { + switch ($parameter['type']) { case self::TYPE_INTEGER: return 'Int'; case self::TYPE_NUMBER: @@ -300,35 +291,38 @@ public function getTypeName($type) case self::TYPE_STRING: return 'String'; case self::TYPE_FILE: - return 'File'; + return 'InputFile'; case self::TYPE_BOOLEAN: return 'Bool'; case self::TYPE_ARRAY: - return '[Any]'; + if (!empty($parameter['array']['type'])) { + return '[' . $this->getTypeName($parameter['array']) . ']'; + } + return '[Any]'; case self::TYPE_OBJECT: return 'Any'; } - return $type; + return $parameter['type']; } /** * @param array $param * @return string */ - public function getParamDefault(array $param) + public function getParamDefault(array $param): string { $type = $param['type'] ?? ''; $default = $param['default'] ?? ''; $required = $param['required'] ?? ''; - if($required) { + if ($required) { return ''; } $output = ' = '; - if(empty($default) && $default !== 0 && $default !== false) { + if (empty($default) && $default !== 0 && $default !== false) { switch ($type) { case self::TYPE_INTEGER: case self::TYPE_NUMBER: @@ -349,14 +343,13 @@ public function getParamDefault(array $param) default: echo $type; } - } - else { + } else { switch ($type) { case self::TYPE_INTEGER: $output .= $default; break; case self::TYPE_NUMBER: - $output .= sprintf("%.1f",$default); + $output .= sprintf("%.1f", $default); break; case self::TYPE_BOOLEAN: $output .= ($default) ? 'true' : 'false'; @@ -379,17 +372,17 @@ public function getParamDefault(array $param) * @param array $param * @return string */ - public function getParamExample(array $param) + public function getParamExample(array $param): string { $type = $param['type'] ?? ''; $example = $param['example'] ?? ''; $output = ''; - if(empty($example) && $example !== 0 && $example !== false) { + if (empty($example) && $example !== 0 && $example !== false) { switch ($type) { case self::TYPE_FILE: - $output .= 'File(name: "image.jpg", buffer: yourByteBuffer)'; + $output .= 'InputFile.fromPath("file.png")'; break; case self::TYPE_NUMBER: case self::TYPE_INTEGER: @@ -404,9 +397,11 @@ public function getParamExample(array $param) case self::TYPE_ARRAY: $output .= '[]'; break; + case self::TYPE_OBJECT: + $output .= '[:]'; + break; } - } - else { + } else { switch ($type) { case self::TYPE_FILE: case self::TYPE_NUMBER: @@ -420,9 +415,117 @@ public function getParamExample(array $param) case self::TYPE_STRING: $output .= "\"{$example}\""; break; + case self::TYPE_OBJECT: + $output .= '[:]'; + break; } } return $output; } + + public function getFilters(): array + { + return [ + new TwigFilter('swiftComment', function ($value) { + $value = explode("\n", $value); + foreach ($value as $key => $line) { + $value[$key] = " /// " . wordwrap($line, 75, "\n /// "); + } + return implode("\n", $value); + }, ['is_safe' => ['html']]), + new TwigFilter('returnType', function (array $method, array $spec, string $generic = 'T') { + return $this->getReturnType($method, $spec, $generic); + }), + new TwigFilter('modelType', function (array $property, array $spec, string $generic = 'T : Codable') { + return $this->getModelType($property, $spec, $generic); + }), + new TwigFilter('propertyType', function (array $property, array $spec, string $generic = 'T') { + return $this->getPropertyType($property, $spec, $generic); + }), + new TwigFilter('hasGenericType', function (string $model, array $spec) { + return $this->hasGenericType($model, $spec); + }), + ]; + } + + protected function getReturnType(array $method, array $spec, string $generic): string + { + if ($method['type'] === 'webAuth') { + return 'Bool'; + } + if ($method['type'] === 'location') { + return 'ByteBuffer'; + } + + if ( + !\array_key_exists('responseModel', $method) + || empty($method['responseModel']) + || $method['responseModel'] === 'any' + ) { + return 'Any'; + } + + $ret = $this->toUpperCaseWords($method['responseModel']); + + if ($this->hasGenericType($method['responseModel'], $spec)) { + $ret .= '<' . $generic . '>'; + } + + return \ucfirst($spec['title']) . 'Models.' . $ret; + } + + protected function getModelType(array $definition, array $spec, string $generic): string + { + if ($this->hasGenericType($definition['name'], $spec)) { + return $this->toUpperCaseWords($definition['name']) . '<' . $generic . '>'; + } + return $this->toUpperCaseWords($definition['name']); + } + + protected function getPropertyType(array $property, array $spec, string $generic): string + { + if (\array_key_exists('sub_schema', $property)) { + $type = $this->toUpperCaseWords($property['sub_schema']); + + if ($this->hasGenericType($property['sub_schema'], $spec)) { + $type .= '<' . $generic . '>'; + } + + if ($property['type'] === 'array') { + $type = '[' . $type . ']'; + } + } else { + $type = $this->getTypeName($property); + } + + if (!$property['required']) { + $type .= '?'; + } + + return $type; + } + + protected function hasGenericType(?string $model, array $spec): string + { + if (empty($model) || $model === 'any') { + return false; + } + + $model = $spec['definitions'][$model]; + + if ($model['additionalProperties']) { + return true; + } + + foreach ($model['properties'] as $property) { + if (!\array_key_exists('sub_schema', $property) || !$property['sub_schema']) { + continue; + } + + return $this->hasGenericType($property['sub_schema'], $spec); + } + + return false; + } } diff --git a/src/SDK/Language/Web.php b/src/SDK/Language/Web.php index 32f75d592a..26ec511361 100644 --- a/src/SDK/Language/Web.php +++ b/src/SDK/Language/Web.php @@ -2,12 +2,14 @@ namespace Appwrite\SDK\Language; -class Web extends JS { +use Twig\TwigFilter; +class Web extends JS +{ /** * @return string */ - public function getName() + public function getName(): string { return 'Web'; } @@ -15,74 +17,103 @@ public function getName() /** * @return array */ - public function getFiles() + public function getFiles(): array { return [ [ 'scope' => 'default', - 'destination' => 'src/sdk.ts', - 'template' => '/web/src/sdk.ts.twig', - 'minify' => false, + 'destination' => 'src/index.ts', + 'template' => 'web/src/index.ts.twig', + ], + [ + 'scope' => 'default', + 'destination' => 'src/client.ts', + 'template' => 'web/src/client.ts.twig', + ], + [ + 'scope' => 'default', + 'destination' => 'src/service.ts', + 'template' => 'web/src/service.ts.twig', + ], + [ + 'scope' => 'service', + 'destination' => 'src/services/{{service.name | caseDash}}.ts', + 'template' => 'web/src/services/template.ts.twig', + ], + [ + 'scope' => 'default', + 'destination' => 'src/models.ts', + 'template' => 'web/src/models.ts.twig', + ], + [ + 'scope' => 'default', + 'destination' => 'src/permission.ts', + 'template' => 'web/src/permission.ts.twig', + ], + [ + 'scope' => 'default', + 'destination' => 'src/role.ts', + 'template' => 'web/src/role.ts.twig', + ], + [ + 'scope' => 'default', + 'destination' => 'src/id.ts', + 'template' => 'web/src/id.ts.twig', + ], + [ + 'scope' => 'default', + 'destination' => 'src/query.ts', + 'template' => 'web/src/query.ts.twig', ], [ 'scope' => 'default', 'destination' => 'README.md', 'template' => 'web/README.md.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'CHANGELOG.md', 'template' => 'web/CHANGELOG.md.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'LICENSE', 'template' => 'web/LICENSE.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'package.json', 'template' => 'web/package.json.twig', - 'minify' => false, ], [ 'scope' => 'method', 'destination' => 'docs/examples/{{service.name | caseLower}}/{{method.name | caseDash}}.md', 'template' => 'web/docs/example.md.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'tsconfig.json', 'template' => '/web/tsconfig.json.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'rollup.config.js', 'template' => '/web/rollup.config.js.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'dist/cjs/package.json', 'template' => '/web/dist/cjs/package.json.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => 'dist/esm/package.json', 'template' => '/web/dist/esm/package.json.twig', - 'minify' => false, ], [ 'scope' => 'default', 'destination' => '.travis.yml', 'template' => 'web/.travis.yml.twig', - 'minify' => false, ], ]; } @@ -91,14 +122,14 @@ public function getFiles() * @param array $param * @return string */ - public function getParamExample(array $param) + public function getParamExample(array $param): string { $type = $param['type'] ?? ''; $example = $param['example'] ?? ''; $output = ''; - if(empty($example) && $example !== 0 && $example !== false) { + if (empty($example) && $example !== 0 && $example !== false) { switch ($type) { case self::TYPE_NUMBER: case self::TYPE_INTEGER: @@ -118,8 +149,7 @@ public function getParamExample(array $param) $output .= "document.getElementById('uploader').files[0]"; break; } - } - else { + } else { switch ($type) { case self::TYPE_NUMBER: case self::TYPE_INTEGER: @@ -141,4 +171,164 @@ public function getParamExample(array $param) return $output; } + + public function getTypeName(array $parameter, array $method = []): string + { + switch ($parameter['type']) { + case self::TYPE_INTEGER: + case self::TYPE_NUMBER: + return 'number'; + case self::TYPE_ARRAY: + if (!empty($parameter['array']['type'])) { + return $this->getTypeName($parameter['array']) . '[]'; + } + return 'string[]'; + case self::TYPE_FILE: + return 'File'; + case self::TYPE_OBJECT: + if (empty($method)) { + return $parameter['type']; + } + switch ($method['responseModel']) { + case 'user': + return "Partial"; + case 'document': + if ($method['method'] === 'post') { + return "Omit"; + } + if ($method['method'] === 'patch') { + return "Partial>"; + } + } + } + + return $parameter['type']; + } + + protected function populateGenerics(string $model, array $spec, array &$generics, bool $skipFirst = false) + { + if (!$skipFirst && $spec['definitions'][$model]['additionalProperties']) { + $generics[] = $this->toUpperCaseWords($model); + } + + $properties = $spec['definitions'][$model]['properties']; + + foreach ($properties as $property) { + if (array_key_exists('sub_schema', $property) && $property['sub_schema']) { + $this->populateGenerics($property['sub_schema'], $spec, $generics); + } + } + } + + public function getGenerics(string $model, array $spec, bool $skipFirst = false): string + { + $generics = []; + + if (array_key_exists($model, $spec['definitions'])) { + $this->populateGenerics($model, $spec, $generics, $skipFirst); + } + + if (empty($generics)) { + return ''; + } + + $generics = array_unique($generics); + $generics = array_map(fn ($type) => "{$type} extends Models.{$type}", $generics); + + return '<' . implode(', ', $generics) . '>'; + } + + public function getReturn(array $method, array $spec): string + { + if ($method['type'] === 'webAuth') { + return 'void | URL'; + } elseif ($method['type'] === 'location') { + return 'URL'; + } + + if (array_key_exists('responseModel', $method) && !empty($method['responseModel']) && $method['responseModel'] !== 'any') { + $ret = 'Promise<'; + + if ( + array_key_exists($method['responseModel'], $spec['definitions']) && + array_key_exists('additionalProperties', $spec['definitions'][$method['responseModel']]) && + !$spec['definitions'][$method['responseModel']]['additionalProperties'] + ) { + $ret .= 'Models.'; + } + + $ret .= $this->toUpperCaseWords($method['responseModel']); + + $models = []; + + $this->populateGenerics($method['responseModel'], $spec, $models); + + $models = array_unique($models); + $models = array_filter($models, fn ($model) => $model != $this->toUpperCaseWords($method['responseModel'])); + + if (!empty($models)) { + $ret .= '<' . implode(', ', $models) . '>'; + } + + $ret .= '>'; + + return $ret; + } + return 'Promise<{}>'; + } + + public function getSubSchema(array $property, array $spec): string + { + if (array_key_exists('sub_schema', $property)) { + $ret = ''; + $generics = []; + $this->populateGenerics($property['sub_schema'], $spec, $generics); + + $generics = array_filter($generics, fn ($model) => $model != $this->toUpperCaseWords($property['sub_schema'])); + + $ret .= $this->toUpperCaseWords($property['sub_schema']); + if (!empty($generics)) { + $ret .= '<' . implode(', ', $generics) . '>'; + } + if ($property['type'] === 'array') { + $ret .= '[]'; + } + + return $ret; + } + + return $this->getTypeName($property); + } + + public function getFilters(): array + { + return [ + new TwigFilter('getPropertyType', function ($value, $method = []) { + return $this->getTypeName($value, $method); + }), + new TwigFilter('getSubSchema', function (array $property, array $spec) { + return $this->getSubSchema($property, $spec); + }), + new TwigFilter('getGenerics', function (string $model, array $spec, bool $skipAdditional = false) { + return $this->getGenerics($model, $spec, $skipAdditional); + }), + new TwigFilter('getReturn', function (array $method, array $spec) { + return $this->getReturn($method, $spec); + }), + new TwigFilter('comment2', function ($value) { + $value = explode("\n", $value); + foreach ($value as $key => $line) { + $value[$key] = " * " . wordwrap($line, 75, "\n * "); + } + return implode("\n", $value); + }, ['is_safe' => ['html']]), + new TwigFilter('comment3', function ($value) { + $value = explode("\n", $value); + foreach ($value as $key => $line) { + $value[$key] = " * " . wordwrap($line, 75, "\n * "); + } + return implode("\n", $value); + }, ['is_safe' => ['html']]), + ]; + } } diff --git a/src/SDK/SDK.php b/src/SDK/SDK.php index 9c555d4e95..73a75ce39c 100644 --- a/src/SDK/SDK.php +++ b/src/SDK/SDK.php @@ -4,43 +4,52 @@ use Exception; use Appwrite\Spec\Spec; +use Throwable; use Twig\Environment; +use Twig\Error\LoaderError; +use Twig\Error\RuntimeError; +use Twig\Error\SyntaxError; +use Twig\Extension\DebugExtension; use Twig\Loader\FilesystemLoader; use Twig\TemplateWrapper; use Twig\TwigFilter; use MatthiasMullie\Minify; +use Twig_Error_Loader; +use Twig_Error_Runtime; +use Twig_Error_Syntax; class SDK { /** - * @var Language + * @var Language|null */ - protected $language = null; + protected ?Language $language = null; /** - * @var Spec + * @var Spec|null */ - protected $spec = null; + protected ?Spec $spec = null; /** - * @var Environment + * @var Environment|null */ - protected $twig = null; + protected ?Environment $twig = null; /** * @var array */ - protected $defaultHeaders = []; + protected array $defaultHeaders = []; /** * @var array */ - protected $params = [ + protected array $params = [ 'namespace' => '', 'name' => '', 'description' => '', 'shortDescription' => '', 'version' => '', + 'platform' => '', 'license' => '', 'licenseContent' => '', 'gitURL' => '', @@ -74,8 +83,16 @@ public function __construct(Language $language, Spec $spec) $this->twig = new Environment(new FilesystemLoader(__DIR__ . '/../../templates'), [ 'debug' => true - ] ); - $this->twig->addExtension(new \Twig\Extension\DebugExtension()); + ]); + + /** + * Add language specific filters + */ + foreach ($this->language->getFilters() as $filter) { + $this->twig->addFilter($filter); + } + + $this->twig->addExtension(new DebugExtension()); $this->twig->addFilter(new TwigFilter('caseLower', function ($value) { return strtolower((string)$value); @@ -84,13 +101,16 @@ public function __construct(Language $language, Spec $spec) return strtoupper((string)$value); })); $this->twig->addFilter(new TwigFilter('caseUcfirst', function ($value) { - return ucfirst((string)$this->helperCamelCase($value)); + return ucfirst($this->helperCamelCase($value)); + })); + $this->twig->addFilter(new TwigFilter('caseUcwords', function ($value) { + return ucwords($value, " -_"); })); $this->twig->addFilter(new TwigFilter('caseLcfirst', function ($value) { return lcfirst((string)$value); })); $this->twig->addFilter(new TwigFilter('caseCamel', function ($value) { - return (string)$this->helperCamelCase($value); + return $this->helperCamelCase($value); })); $this->twig->addFilter(new TwigFilter('caseDash', function ($value) { return str_replace([' ', '_'], '-', strtolower(preg_replace('/([a-zA-Z])(?=[A-Z])/', '$1-', $value))); @@ -129,55 +149,13 @@ public function __construct(Language $language, Spec $spec) $this->twig->addFilter(new TwigFilter('comment1', function ($value) { $value = explode("\n", $value); foreach ($value as $key => $line) { - $value[$key] = " * " . wordwrap($value[$key], 75, "\n * "); - } - return implode("\n", $value); - }, ['is_safe' => ['html']])); - $this->twig->addFilter(new TwigFilter('comment2', function ($value) { - $value = explode("\n", $value); - foreach ($value as $key => $line) { - $value[$key] = " * " . wordwrap($value[$key], 75, "\n * "); - } - return implode("\n", $value); - }, ['is_safe' => ['html']])); - $this->twig->addFilter(new TwigFilter('comment3', function ($value) { - $value = explode("\n", $value); - foreach ($value as $key => $line) { - $value[$key] = " * " . wordwrap($value[$key], 75, "\n * "); - } - return implode("\n", $value); - }, ['is_safe' => ['html']])); - $this->twig->addFilter(new TwigFilter('dartComment', function ($value) { - $value = explode("\n", $value); - foreach ($value as $key => $line) { - $value[$key] = " /// " . wordwrap($value[$key], 75, "\n /// "); - } - return implode("\n", $value); - }, ['is_safe' => ['html']])); - $this->twig->addFilter(new TwigFilter('dotnetComment', function ($value) { - $value = explode("\n", $value); - foreach ($value as $key => $line) { - $value[$key] = " /// " . wordwrap($value[$key], 75, "\n /// "); - } - return implode("\n", $value); - }, ['is_safe' => ['html']])); - $this->twig->addFilter(new TwigFilter('swiftComment', function ($value) { - $value = explode("\n", $value); - foreach ($value as $key => $line) { - $value[$key] = " /// " . wordwrap($value[$key], 75, "\n /// "); - } - return implode("\n", $value); - }, ['is_safe' => ['html']])); - $this->twig->addFilter(new TwigFilter('rubyComment', function ($value) { - $value = explode("\n", $value); - foreach ($value as $key => $line) { - $value[$key] = " # " . wordwrap($line, 75, "\n # "); + $value[$key] = " * " . wordwrap($line, 75, "\n * "); } return implode("\n", $value); }, ['is_safe' => ['html']])); $this->twig->addFilter(new TwigFilter('escapeDollarSign', function ($value) { return str_replace('$', '\$', $value); - }, ['is_safe'=>['html']])); + }, ['is_safe' => ['html']])); $this->twig->addFilter(new TwigFilter('paramsQuery', function ($value) { $query = ''; @@ -191,39 +169,24 @@ public function __construct(Language $language, Spec $spec) $this->twig->addFilter(new TwigFilter('html', function ($value) { return $value; }, ['is_safe' => ['html']])); - $this->twig->addFilter(new TwigFilter('godocComment', function ($value) { - $value = explode("\n", $value); - foreach ($value as $key => $line) { - $value[$key] = "// " . wordwrap($value[$key], 75, "\n// "); - } - return implode("\n", $value); - }, ['is_safe' => ['html']])); $this->twig->addFilter(new TwigFilter('escapeKeyword', function ($value) use ($language) { - if(in_array($value, $language->getKeywords())) { + if (in_array($value, $language->getKeywords())) { return 'x' . $value; } return $value; }, ['is_safe' => ['html']])); - $this->twig->addFilter(new TwigFilter('ucFirstAndEscape', function ($value) use ($language) { - $value = ucfirst((string)$this->helperCamelCase($value)); - if(in_array($value, $language->getKeywords())) { - $value = 'x' . $value; - } - - return ucfirst((string)$this->helperCamelCase($value)); - }, ['is_safe' => ['html']])); $this->twig->addFilter(new TwigFilter('caseHTML', function ($value) { return $value; }, ['is_safe' => ['html']])); $this->twig->addFilter(new TwigFilter('removeDollarSign', function ($value) { - return str_replace('$','',$value); + return str_replace('$', '', $value); })); $this->twig->addFilter(new TwigFilter('unescape', function ($value) { return html_entity_decode($value); })); $this->twig->addFilter(new TwigFilter('overrideIdentifier', function ($value) use ($language) { - if(isset($language->getIdentifierOverrides()[$value])) { + if (isset($language->getIdentifierOverrides()[$value])) { return $language->getIdentifierOverrides()[$value]; } return $value; @@ -234,30 +197,31 @@ public function __construct(Language $language, Spec $spec) * @param array $headers * @return $this */ - public function setDefaultHeaders($headers) { + public function setDefaultHeaders(array $headers): SDK + { $this->defaultHeaders = $headers; - + return $this; } /** - * @param string $text + * @param string $namespace * @return $this */ - public function setNamespace($text) + public function setNamespace(string $namespace): SDK { - $this->setParam('namespace', $text); + $this->setParam('namespace', $namespace); return $this; } /** - * @param string $text + * @param string $name * @return $this */ - public function setName($text) + public function setName(string $name): SDK { - $this->setParam('name', $text); + $this->setParam('name', $name); return $this; } @@ -266,7 +230,7 @@ public function setName($text) * @param string $text * @return $this */ - public function setDescription($text) + public function setDescription(string $text): SDK { $this->setParam('description', $text); @@ -274,10 +238,10 @@ public function setDescription($text) } /** - * @param string $name + * @param string $text * @return $this */ - public function setShortDescription($text) + public function setShortDescription(string $text): SDK { $this->setParam('shortDescription', $text); @@ -285,23 +249,34 @@ public function setShortDescription($text) } /** - * @param string $text + * @param string $version * @return $this */ - public function setVersion($text) + public function setVersion(string $version): SDK { - $this->setParam('version', $text); + $this->setParam('version', $version); return $this; } /** - * @param string $text + * @param string $platform * @return $this */ - public function setLicense($text) + public function setPlatform(string $platform): SDK { - $this->setParam('license', $text); + $this->setParam('platform', $platform); + + return $this; + } + + /** + * @param string $license + * @return $this + */ + public function setLicense(string $license): SDK + { + $this->setParam('license', $license); return $this; } @@ -310,7 +285,7 @@ public function setLicense($text) * @param string $content * @return $this */ - public function setLicenseContent($content) + public function setLicenseContent(string $content): SDK { $this->setParam('licenseContent', $content); @@ -318,10 +293,10 @@ public function setLicenseContent($content) } /** - * @param $url + * @param string $url * @return $this */ - public function setGitRepo($url) + public function setGitRepo(string $url): SDK { $this->setParam('gitRepo', $url); @@ -329,10 +304,10 @@ public function setGitRepo($url) } /** - * @param $name + * @param string $name * @return $this */ - public function setGitRepoName($name) + public function setGitRepoName(string $name): SDK { $this->setParam('gitRepoName', $name); @@ -340,10 +315,10 @@ public function setGitRepoName($name) } /** - * @param $name + * @param string $name * @return $this */ - public function setGitUserName($name) + public function setGitUserName(string $name): SDK { $this->setParam('gitUserName', $name); @@ -351,10 +326,10 @@ public function setGitUserName($name) } /** - * @param $url + * @param string $url * @return $this */ - public function setGitURL($url) + public function setGitURL(string $url): SDK { $this->setParam('gitURL', $url); @@ -362,10 +337,10 @@ public function setGitURL($url) } /** - * @param $url + * @param string $url * @return $this */ - public function setLogo($url) + public function setLogo(string $url): SDK { $this->setParam('logo', $url); @@ -373,10 +348,10 @@ public function setLogo($url) } /** - * @param $url + * @param string $url * @return $this */ - public function setURL($url) + public function setURL(string $url): SDK { $this->setParam('url', $url); @@ -384,10 +359,10 @@ public function setURL($url) } /** - * @param $text + * @param string $text * @return $this */ - public function setShareText($text) + public function setShareText(string $text): SDK { $this->setParam('shareText', $text); @@ -395,10 +370,10 @@ public function setShareText($text) } /** - * @param $user + * @param string $user * @return $this */ - public function setShareVia($user) + public function setShareVia(string $user): SDK { $this->setParam('shareVia', $user); @@ -406,10 +381,10 @@ public function setShareVia($user) } /** - * @param $url + * @param string $url * @return $this */ - public function setShareURL($url) + public function setShareURL(string $url): SDK { $this->setParam('shareURL', $url); @@ -417,10 +392,10 @@ public function setShareURL($url) } /** - * @param $tags string comma separated list + * @param string $tags Comma separated list * @return $this */ - public function setShareTags($tags) + public function setShareTags(string $tags): SDK { $this->setParam('shareTags', $tags); @@ -428,10 +403,10 @@ public function setShareTags($tags) } /** - * @param $message string + * @param string $message * @return $this */ - public function setWarning($message) + public function setWarning(string $message): SDK { $this->setParam('warning', $message); @@ -442,7 +417,7 @@ public function setWarning($message) * @param $message string * @return $this */ - public function setGettingStarted($message) + public function setGettingStarted(string $message): SDK { $this->setParam('gettingStarted', $message); @@ -450,10 +425,10 @@ public function setGettingStarted($message) } /** - * @param $text string + * @param string $text * @return $this */ - public function setReadme($text) + public function setReadme(string $text): SDK { $this->setParam('readme', $text); @@ -461,10 +436,10 @@ public function setReadme($text) } /** - * @param $text string + * @param string $text * @return $this */ - public function setChangelog($text) + public function setChangelog(string $text): SDK { $this->setParam('changelog', $text); @@ -472,10 +447,10 @@ public function setChangelog($text) } /** - * @param $text string + * @param string $text * @return $this */ - public function setExamples($text) + public function setExamples(string $text): SDK { $this->setParam('examples', $text); @@ -487,7 +462,7 @@ public function setExamples($text) * @param string $url * @return $this */ - public function setDiscord(string $channel, string $url) + public function setDiscord(string $channel, string $url): SDK { $this->setParam('discordChannel', $channel); $this->setParam('discordUrl', $url); @@ -499,7 +474,7 @@ public function setDiscord(string $channel, string $url) * @param string $handle * @return $this */ - public function setTwitter(string $handle) + public function setTwitter(string $handle): SDK { $this->setParam('twitterHandle', $handle); @@ -510,7 +485,7 @@ public function setTwitter(string $handle) * @param string $test * @return $this */ - public function setTest(string $test) + public function setTest(string $test): SDK { $this->setParam('test', $test); @@ -522,7 +497,7 @@ public function setTest(string $test) * @param string $value * @return SDK */ - public function setParam($key, $value) + public function setParam(string $key, string $value): SDK { $this->params[$key] = $value; @@ -530,10 +505,10 @@ public function setParam($key, $value) } /** - * @param $name + * @param string $name * @return string */ - public function getParam($name) + public function getParam(string $name): string { return $this->params[$name] ?? ''; } @@ -541,19 +516,19 @@ public function getParam($name) /** * @return array */ - public function getParams() + public function getParams(): array { return $this->params; } /** - * @param $target - * @throws \Throwable - * @throws \Twig_Error_Loader - * @throws \Twig_Error_Runtime - * @throws \Twig_Error_Syntax + * @param string $target + * @throws Throwable + * @throws LoaderError + * @throws RuntimeError + * @throws SyntaxError */ - public function generate($target) + public function generate(string $target): void { $params = [ 'spec' => [ @@ -563,7 +538,7 @@ public function generate($target) 'version' => $this->spec->getVersion(), 'endpoint' => $this->spec->getEndpoint(), 'host' => parse_url($this->spec->getEndpoint(), PHP_URL_HOST), - 'basePath' => $this->spec->getAttribute('basePath',''), + 'basePath' => $this->spec->getAttribute('basePath', ''), 'licenseName' => $this->spec->getLicenseName(), 'licenseURL' => $this->spec->getLicenseURL(), 'contactName' => $this->spec->getContactName(), @@ -585,12 +560,12 @@ public function generate($target) foreach ($this->language->getFiles() as $file) { if ($file['scope'] != 'copy') { - $template = $this->twig->load($file['template']); /* @var $template \Twig\TemplateWrapper */ + $template = $this->twig->load($file['template']); /* @var $template TemplateWrapper */ } $destination = $target . '/' . $file['destination']; $block = $file['block'] ?? null; $minify = $file['minify'] ?? false; - + switch ($file['scope']) { case 'default': $this->render($template, $destination, $block, $params, $minify); @@ -599,12 +574,13 @@ public function generate($target) if (!file_exists(dirname($destination))) { mkdir(dirname($destination), 0777, true); } - copy(realpath(__DIR__.'/../../templates/' . $file['template']), $destination); + copy(realpath(__DIR__ . '/../../templates/' . $file['template']), $destination); break; case 'service': foreach ($this->spec->getServices() as $key => $service) { $methods = $this->spec->getMethods($key); $params['service'] = [ + 'globalParams' => $service['globalParams'] ?? [], 'description' => $service['description'] ?? '', 'name' => $key, 'features' => [ @@ -615,14 +591,21 @@ public function generate($target) 'methods' => $methods, ]; + if ($this->exclude($file, $params)) { + continue; + } + $this->render($template, $destination, $block, $params, $minify); } break; case 'definition': foreach ($this->spec->getDefinitions() as $key => $definition) { - $params['definition'] = $definition; + if ($this->exclude($file, $params)) { + continue; + } + $this->render($template, $destination, $block, $params, $minify); } break; @@ -632,6 +615,7 @@ public function generate($target) $params['service'] = [ 'name' => $key, 'methods' => $methods, + 'globalParams' => $service['globalParams'] ?? [], 'features' => [ 'upload' => $this->hasUploads($methods), 'location' => $this->hasLocation($methods), @@ -641,6 +625,11 @@ public function generate($target) foreach ($methods as $method) { $params['method'] = $method; + + if ($this->exclude($file, $params)) { + continue; + } + $this->render($template, $destination, $block, $params, $minify); } } @@ -650,12 +639,83 @@ public function generate($target) } /** + * Determine if a file should be excluded from generation. + * + * Allows for files to be excluded based on: + * - Service name or feature + * - Method name or type + * - Definition name + * + * @param $file + * @param $params * @return bool */ - protected function hasUploads($methods):bool + protected function exclude($file, $params): bool { - foreach($methods as $method) { - if(isset($method['type']) && $method['type'] === 'upload') { + $exclude = $file['exclude'] ?? []; + + $services = []; + $features = []; + foreach ($exclude['services'] ?? [] as $service) { + if (isset($service['name'])) { + $services[] = $service['name']; + } + if (isset($service['feature'])) { + $features[] = $service['feature']; + } + } + + $methods = []; + $types = []; + foreach ($exclude['methods'] ?? [] as $method) { + if (isset($method['name'])) { + $methods[] = $method['name']; + } + if (isset($method['type'])) { + $types[] = $method['type']; + } + } + + $definitions = []; + foreach ($exclude['definitions'] ?? [] as $definition) { + if (isset($definition['name'])) { + $definitions[] = $definition['name']; + } + } + + if (\in_array($params['service']['name'] ?? '', $services)) { + return true; + } + + foreach ($features as $feature) { + if ($params['service']['features'][$feature] ?? false) { + return true; + } + } + + if (\in_array($params['method']['name'] ?? '', $methods)) { + return true; + } + + if (\in_array($params['method']['type'] ?? '', $types)) { + return true; + } + + if (\in_array($params['definition']['name'] ?? '', $definitions)) { + return true; + } + + return false; + } + + /** + * @param array $methods + * @return bool + */ + protected function hasUploads(array $methods): bool + { + foreach ($methods as $method) { + if (isset($method['type']) && $method['type'] === 'upload') { return true; } } @@ -664,12 +724,13 @@ protected function hasUploads($methods):bool } /** + * @param array $methods * @return bool */ - protected function hasLocation($methods):bool + protected function hasLocation(array $methods): bool { - foreach($methods as $method) { - if(isset($method['type']) && $method['type'] === 'location') { + foreach ($methods as $method) { + if (isset($method['type']) && $method['type'] === 'location') { return true; } } @@ -678,12 +739,13 @@ protected function hasLocation($methods):bool } /** + * @param array $methods * @return bool */ - protected function hasWebAuth($methods):bool + protected function hasWebAuth(array $methods): bool { - foreach($methods as $method) { - if(isset($method['type']) && $method['type'] === 'webAuth') { + foreach ($methods as $method) { + if (isset($method['type']) && $method['type'] === 'webAuth') { return true; } } @@ -694,15 +756,15 @@ protected function hasWebAuth($methods):bool /** * @param TemplateWrapper $template * @param string $destination - * @param string $block + * @param string|null $block * @param array $params * @param bool $minify * - * @throws \Throwable - * @throws \Twig_Error_Loader - * @throws \Twig_Error_Syntax + * @throws Throwable + * @throws Twig_Error_Loader + * @throws Twig_Error_Syntax */ - protected function render(TemplateWrapper $template, $destination, $block, $params = [], $minify = false) + protected function render(TemplateWrapper $template, string $destination, ?string $block, array $params = [], bool $minify = false): void { $destination = $this->twig->createTemplate($destination); $destination = $destination->render($params); @@ -732,16 +794,15 @@ protected function render(TemplateWrapper $template, $destination, $block, $para break; default: throw new Exception('No minifier found for ' . $ext . ' file'); - break; } } } /** - * @param string $str + * @param string|null $str * @return string */ - protected function helperCamelCase($str): string + protected function helperCamelCase(?string $str): string { if ($str == null) { return ''; diff --git a/src/Spec/Spec.php b/src/Spec/Spec.php index 137b789d78..6ffbbba530 100644 --- a/src/Spec/Spec.php +++ b/src/Spec/Spec.php @@ -5,14 +5,11 @@ use Exception; use ArrayObject; -abstract class Spec extends ArrayObject { - - const FORMAT_OPEN_API_3 = 'Open API 3'; - const FORMAT_SWAGGER_2 = 'Swagger 2'; - - const SET_TYPE_ASSIGN = 'assign'; - const SET_TYPE_PREPEND = 'prepend'; - const SET_TYPE_APPEND = 'append'; +abstract class Spec extends ArrayObject +{ + private const SET_TYPE_ASSIGN = 'assign'; + private const SET_TYPE_PREPEND = 'prepend'; + private const SET_TYPE_APPEND = 'append'; /** * Spec constructor. @@ -23,10 +20,10 @@ public function __construct($input) { if (filter_var($input, FILTER_VALIDATE_URL)) { $data = file_get_contents($input, false, stream_context_create([ - "ssl" => ['verify_peer' => false, 'allow_self_signed'=> true] + "ssl" => ['verify_peer' => false, 'allow_self_signed' => true] ])); - if(!$data) { + if (!$data) { throw new Exception('Can\'t read data from ' . $input); } @@ -35,8 +32,7 @@ public function __construct($input) try { $input = json_decode($input, true); - } - catch (Exception $e) { + } catch (Exception $e) { throw new Exception('Failed to parse spec: ' . $e->getMessage()); } @@ -129,8 +125,8 @@ public function getAttribute($name, $default = null) $temp = &$this; - foreach($name as $key) { - if(!isset($temp[$key])) { + foreach ($name as $key) { + if (!isset($temp[$key])) { return $default; } @@ -147,7 +143,7 @@ public function getAttribute($name, $default = null) * * @param string $key * @param mixed $value - * @param string $type + * @param array $parameter * @return mixed */ public function setAttribute($key, $value, $type = self::SET_TYPE_ASSIGN) @@ -158,7 +154,7 @@ public function setAttribute($key, $value, $type = self::SET_TYPE_ASSIGN) break; case self::SET_TYPE_APPEND: $this[$key] = (!isset($this[$key]) || !is_array($this[$key])) ? [] : $this[$key]; - array_push($this[$key], $value); + $this[$key][] = $value; break; case self::SET_TYPE_PREPEND: $this[$key] = (!isset($this[$key]) || !is_array($this[$key])) ? [] : $this[$key]; @@ -168,4 +164,4 @@ public function setAttribute($key, $value, $type = self::SET_TYPE_ASSIGN) return $this; } -} \ No newline at end of file +} diff --git a/src/Spec/Spec/Service.php b/src/Spec/Spec/Service.php index 184dfff217..c57d0a09fd 100644 --- a/src/Spec/Spec/Service.php +++ b/src/Spec/Spec/Service.php @@ -1,5 +1,9 @@ getMethods($tag); $list[$tag] = [ 'name' => $tag, - 'methods' => $this->getMethods($tag), + 'methods' => $methods, ]; } } @@ -132,27 +132,32 @@ public function getServices() public function getMethods($service) { $list = []; - $security = $this->getAttribute('securityDefinitions', []); $paths = $this->getAttribute('paths', []); foreach ($paths as $pathName => $path) { foreach ($path as $methodName => $method) { - $auth = $method['x-appwrite']['auth'] ?? []; + $methodAuth = $method['x-appwrite']['auth'] ?? []; + $methodSecurity = $method['security'][0] ?? []; if (isset($method['tags']) && is_array($method['tags']) && in_array($service, $method['tags'])) { - if (isset($auth) && is_array($auth)) { - foreach ($auth as $i => $node) { - $auth[$i] = (array_key_exists($i, $security)) ? $security[$i] : []; - } + foreach ($methodAuth as $i => $node) { + $methodAuth[$i] = (array_key_exists($i, $security)) ? $security[$i] : []; + } + foreach ($methodSecurity as $i => $node) { + $methodSecurity[$i] = (array_key_exists($i, $security)) ? $security[$i] : []; } $responses = $method['responses']; $responseModel = ''; - foreach($responses as $code => $desc) { - if(isset($desc['schema']) && isset($desc['schema']['$ref'])) { + $emptyResponse = true; + foreach ($responses as $code => $desc) { + if ($code != '204') { + $emptyResponse = false; + } + if (isset($desc['schema']) && isset($desc['schema']['$ref'])) { $responseModel = $desc['schema']['$ref']; - if(!empty($responseModel)) { + if (!empty($responseModel)) { $responseModel = str_replace('#/definitions/', '', $responseModel); } } @@ -166,7 +171,8 @@ public function getMethods($service) 'packaging' => $method['x-appwrite']['packaging'] ?? false, 'title' => $method['summary'] ?? '', 'description' => $method['description'] ?? '', - 'security' => [$auth] ?? [], + 'auth' => [$methodAuth] ?? [], + 'security' => [$methodSecurity] ?? [], 'consumes' => $method['consumes'] ?? [], 'cookies' => $method['x-appwrite']['cookies'] ?? false, 'type' => $method['x-appwrite']['type'] ?? false, @@ -178,9 +184,14 @@ public function getMethods($service) 'query' => [], 'body' => [], ], + 'emptyResponse' => $emptyResponse, 'responseModel' => $responseModel, ]; + if ($output['type'] == 'graphql') { + $output['headers']['x-sdk-graphql'] = "true"; + } + if (isset($method['consumes']) && is_array($method['consumes'])) { foreach ($method['consumes'] as $consume) { $output['headers']['content-type'] = $consume; @@ -232,7 +243,6 @@ public function getMethods($service) $param['type'] = $value['type'] ?? null; $param['description'] = $value['description'] ?? ''; $param['required'] = (in_array($key, $bodyRequired)); - $param['default'] = $value['default'] ?? null; $param['example'] = $value['x-example'] ?? null; $param['isUploadID'] = $value['x-upload-id'] ?? false; $param['array'] = [ @@ -249,8 +259,6 @@ public function getMethods($service) } continue 2; - - break; } $output['parameters']['all'][] = $param; @@ -278,7 +286,6 @@ public function getGlobalHeaders() $security = $this->getAttribute('securityDefinitions', []); foreach ($security as $key => $definition) { - if (isset($definition['in']) && $definition['in'] === 'header') { $list[] = [ 'key' => $key, @@ -291,38 +298,41 @@ public function getGlobalHeaders() return $list; } - public function getDefinitions() { + public function getDefinitions() + { $list = []; - $definition = $this->getAttribute('definitions',[]); + $definition = $this->getAttribute('definitions', []); foreach ($definition as $key => $schema) { - if($key == 'any') continue; + if ($key == 'any') { + continue; + } $sch = [ "name" => $key, - "properties"=> $schema['properties'] ?? [], - "description"=> $schema['description'] ?? [], + "properties" => $schema['properties'] ?? [], + "description" => $schema['description'] ?? [], "required" => $schema['required'] ?? [], "additionalProperties" => $schema['additionalProperties'] ?? [] ]; - if(isset($sch['properties'])) { - foreach($sch['properties'] as $name => $def) { + if (isset($sch['properties'])) { + foreach ($sch['properties'] as $name => $def) { $sch['properties'][$name]['name'] = $name; $sch['properties'][$name]['description'] = $def['description']; - $sch['properties'][$name]['required'] = in_array($name,$sch['required']); - if(isset($def['items']['$ref'])) { + $sch['properties'][$name]['required'] = in_array($name, $sch['required']); + if (isset($def['items']['$ref'])) { //nested model $sch['properties'][$name]['sub_schema'] = str_replace('#/definitions/', '', $def['items']['$ref']); } - if(isset($def['items']['x-anyOf'])) { + if (isset($def['items']['x-anyOf'])) { //nested model $sch['properties'][$name]['sub_schemas'] = \array_map(fn($schema) => str_replace('#/definitions/', '', $schema['$ref']), $def['items']['x-anyOf']); } - if(isset($def['items']['x-oneOf'])) { + if (isset($def['items']['x-oneOf'])) { //nested model $sch['properties'][$name]['sub_schemas'] = \array_map(fn($schema) => str_replace('#/definitions/', '', $schema['$ref']), $def['items']['x-oneOf']); } - } + } } $list[$key] = $sch; } diff --git a/templates/android/LICENSE.md.twig b/templates/android/LICENSE.md.twig index 0e8c361b49..854eb19494 100644 --- a/templates/android/LICENSE.md.twig +++ b/templates/android/LICENSE.md.twig @@ -1 +1 @@ -{{sdk.licenseContent}} \ No newline at end of file +{{sdk.licenseContent | raw}} \ No newline at end of file diff --git a/templates/android/build.gradle.twig b/templates/android/build.gradle.twig index 79f6b0b8c7..d475d546d7 100644 --- a/templates/android/build.gradle.twig +++ b/templates/android/build.gradle.twig @@ -2,7 +2,7 @@ apply plugin: 'io.github.gradle-nexus.publish-plugin' // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = "1.5.31" + ext.kotlin_version = "1.7.10" version System.getenv("SDK_VERSION") repositories { maven { url "https://plugins.gradle.org/m2/" } @@ -10,7 +10,7 @@ buildscript { mavenCentral() } dependencies { - classpath "com.android.tools.build:gradle:4.2.0" + classpath "com.android.tools.build:gradle:4.2.2" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath 'io.github.gradle-nexus:publish-plugin:1.1.0' diff --git a/templates/android/docs/java/example.md.twig b/templates/android/docs/java/example.md.twig index 88743d0a28..3056462784 100644 --- a/templates/android/docs/java/example.md.twig +++ b/templates/android/docs/java/example.md.twig @@ -1,90 +1,43 @@ -import androidx.appcompat.app.AppCompatActivity -import android.os.Bundle -import kotlinx.coroutines.GlobalScope -import kotlinx.coroutines.launch -import {{ sdk.namespace | caseDot }}.Client -import {{ sdk.namespace | caseDot }}.services.{{ service.name | caseUcfirst }} - -public class MainActivity extends AppCompatActivity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_main); +import {{ sdk.namespace | caseDot }}.Client; +import {{ sdk.namespace | caseDot }}.coroutines.CoroutineCallback; +{% if method.parameters.all | filter((param) => param.type == 'file') | length > 0 %} +import {{ sdk.namespace | caseDot }}.models.InputFile; +{% endif %} +import {{ sdk.namespace | caseDot }}.services.{{ service.name | caseUcfirst }}; - Client client = new Client(getApplicationContext()) -{% if method.security|length > 0 %} - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint -{% for node in method.security %} +Client client = new Client(context) +{% if method.auth|length > 0 %} + .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint +{% for node in method.auth %} {% for key,header in node|keys %} - .set{{header | caseUcfirst}}("{{node[header]['x-appwrite']['demo']}}"){% if loop.last %};{% endif %} // {{node[header].description}} -{% endfor %} -{% endfor %} -{% endif %} + .set{{header | caseUcfirst}}("{{node[header]['x-appwrite']['demo']}}"){% if loop.last %};{% endif %} // {{node[header].description}} +{% endfor %}{% endfor %}{% endif %} - {{ service.name | caseUcfirst }} {{ service.name | caseCamel }} = new {{ service.name | caseUcfirst }}(client); +{{ service.name | caseUcfirst }} {{ service.name | caseCamel }} = new {{ service.name | caseUcfirst }}(client); - {{ service.name | caseCamel }}.{{ method.name | caseCamel }}({% if method.parameters.all | length == 0 %}new Continuation() { - @NotNull - @Override - public CoroutineContext getContext() { - return EmptyCoroutineContext.INSTANCE; - } +{{ service.name | caseCamel }}.{{ method.name | caseCamel }}({% if method.parameters.all | length == 0 %}new CoroutineCallback<>((result, error) -> { + if (error != null) + error.printStackTrace(); + return; + } - @Override - public void resumeWith(@NotNull Object o) { - String json = ""; - try { - if (o instanceof Result.Failure) { - Result.Failure failure = (Result.Failure) o; - throw failure.exception; - }{% if method.type != "webAuth" %} else { - Response response = (Response) o; - json = response.body().string(); - }{% endif %} - - } - } catch (Throwable th) { - Log.e("ERROR", th.toString()); - } - } - });{% endif %} + Log.d("Appwrite", result.toString()); +}));{% endif %} -{% if method.type == "webAuth" %} - this, -{% endif %} {% for parameter in method.parameters.all %} {% if parameter.required %} - {{ parameter | paramExample }}{% if not loop.last %}, {% endif %} + {{ parameter | paramExample }}{% if not loop.last %},{% endif %} {% endif %} {% if loop.last %} - new Continuation() { - @NotNull - @Override - public CoroutineContext getContext() { - return EmptyCoroutineContext.INSTANCE; - } - - @Override - public void resumeWith(@NotNull Object o) { - String json = ""; - try { - if (o instanceof Result.Failure) { - Result.Failure failure = (Result.Failure) o; - throw failure.exception; - }{% if method.type != "webAuth" %} else { - Response response = (Response) o; - json = response.body().string(); - }{% endif %} - - } catch (Throwable th) { - Log.e("ERROR", th.toString()); - } - } - } - ); + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); {% endif %} -{% endfor %} - } -} \ No newline at end of file +{% endfor %} \ No newline at end of file diff --git a/templates/android/docs/kotlin/example.md.twig b/templates/android/docs/kotlin/example.md.twig index d9169895e3..9176c6a142 100644 --- a/templates/android/docs/kotlin/example.md.twig +++ b/templates/android/docs/kotlin/example.md.twig @@ -1,44 +1,27 @@ -import androidx.appcompat.app.AppCompatActivity -import android.os.Bundle -import kotlinx.coroutines.GlobalScope -import kotlinx.coroutines.launch import {{ sdk.namespace | caseDot }}.Client +{% if method.parameters.all | filter((param) => param.type == 'file') | length > 0 %} +import {{ sdk.namespace | caseDot }}.models.InputFile +{% endif %} import {{ sdk.namespace | caseDot }}.services.{{ service.name | caseUcfirst }} -class MainActivity : AppCompatActivity() { - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - setContentView(R.layout.activity_main) - - val client = Client(applicationContext) -{% if method.security|length > 0 %} - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint -{% for node in method.security %} +val client = Client(context) +{% if method.auth|length > 0 %} + .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint +{% for node in method.auth %} {% for key,header in node|keys %} - .set{{header | caseUcfirst}}("{{node[header]['x-appwrite']['demo']}}") // {{node[header].description}} -{% endfor %} -{% endfor %} -{% endif %} + .set{{header | caseUcfirst}}("{{node[header]['x-appwrite']['demo']}}") // {{node[header].description}} +{% endfor %}{% endfor %}{% endif %} - val {{ service.name | caseCamel }} = {{ service.name | caseUcfirst }}(client) +val {{ service.name | caseCamel }} = {{ service.name | caseUcfirst }}(client) - GlobalScope.launch { -{% if method.type == 'webAuth' %} {% elseif method.type == 'location' %} val result = {% else %} val response = {% endif %}{{ service.name | caseCamel }}.{{ method.name | caseCamel }}({% if method.parameters.all | length == 0 %}){% endif %} +{% if method.type == 'webAuth' %}{% elseif method.type == 'location' %}val result = {% else %}val response = {% endif %}{{ service.name | caseCamel }}.{{ method.name | caseCamel }}({% if method.parameters.all | length == 0 %}){% endif %} -{% if method.type == "webAuth" %} - activity = this@MainActivity, -{% endif %} {% for parameter in method.parameters.all %} {% if parameter.required %} - {{parameter.name}} = {{ parameter | paramExample }}{% if not loop.last %},{% endif %} + {{parameter.name}} = {{ parameter | paramExample }}{% if not loop.last %},{% endif %} {% endif %} {% if loop.last %} - ) +) {% endif %} -{% endfor %} -{% if method.type == 'webAuth' %}{% elseif method.type == 'location' %} println(result); // Resource URL{% else %} val json = response.body?.string(){% endif %} - - } - } -} \ No newline at end of file +{% endfor %} \ No newline at end of file diff --git a/templates/android/example-java/src/main/java/io/appwrite/example_java/MainActivity.java.twig b/templates/android/example-java/src/main/java/io/appwrite/example_java/MainActivity.java.twig index 153c93a3f0..dfc0e7fb06 100644 --- a/templates/android/example-java/src/main/java/io/appwrite/example_java/MainActivity.java.twig +++ b/templates/android/example-java/src/main/java/io/appwrite/example_java/MainActivity.java.twig @@ -1,18 +1,13 @@ package io.appwrite.example_java; -import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; -import org.jetbrains.annotations.NotNull; + +import androidx.appcompat.app.AppCompatActivity; + import {{ sdk.namespace | caseDot }}.Client; -import {{ sdk.namespace | caseDot }}.exceptions.{{ spec.title | caseUcfirst }}Exception; -import {{ sdk.namespace | caseDot }}.extensions.JsonExtensionsKt; -import {{ sdk.namespace | caseDot }}.models.Session; +import {{ sdk.namespace | caseDot }}.coroutines.CoroutineCallback; import {{ sdk.namespace | caseDot }}.services.Account; -import kotlin.Result; -import kotlin.coroutines.Continuation; -import kotlin.coroutines.CoroutineContext; -import kotlin.coroutines.EmptyCoroutineContext; public class MainActivity extends AppCompatActivity { @@ -27,31 +22,13 @@ public class MainActivity extends AppCompatActivity { Account account = new Account(client); - try { - account.createSession("test7@test.com","password", new Continuation() { - @NotNull - @Override - public CoroutineContext getContext() { - return EmptyCoroutineContext.INSTANCE; - } - - @Override - public void resumeWith(@NotNull Object o) { - try { - if (o instanceof Result.Failure) { - Result.Failure failure = (Result.Failure) o; - throw failure.exception; - } else { - Session session = (Session) o; - Log.d("RESPONSE", JsonExtensionsKt.toJson(session)); - } - } catch (Throwable th) { - Log.e("ERROR", th.toString()); - } - } - }); - } catch (AppwriteException e) { - e.printStackTrace(); - } + account.createEmailSession("test7@test.com", "password", new CoroutineCallback<>((session, error) -> { + if (error != null) { + Log.e("Appwrite", error.getMessage()); + return; + } + + Log.d("Appwrite", session.toMap().toString()); + })); } } \ No newline at end of file diff --git a/templates/android/example/src/main/java/io/appwrite/android/ui/accounts/AccountsViewModel.kt.twig b/templates/android/example/src/main/java/io/appwrite/android/ui/accounts/AccountsViewModel.kt.twig index e0657edf1d..530f7e7bb2 100644 --- a/templates/android/example/src/main/java/io/appwrite/android/ui/accounts/AccountsViewModel.kt.twig +++ b/templates/android/example/src/main/java/io/appwrite/android/ui/accounts/AccountsViewModel.kt.twig @@ -29,7 +29,7 @@ class AccountsViewModel : ViewModel() { fun onLogin(email: Editable, password: Editable) { viewModelScope.launch { try { - val session = accountService.createSession(email.toString(), password.toString()) + val session = accountService.createEmailSession(email.toString(), password.toString()) _response.postValue(Event(session.toJson())) } catch (e: {{ spec.title | caseUcfirst }}Exception) { _error.postValue(Event(e)) diff --git a/templates/android/library/build.gradle.twig b/templates/android/library/build.gradle.twig index 614bf90bb6..518c597392 100644 --- a/templates/android/library/build.gradle.twig +++ b/templates/android/library/build.gradle.twig @@ -22,11 +22,11 @@ ext { version PUBLISH_VERSION android { - compileSdkVersion(31) + compileSdkVersion(33) defaultConfig { minSdkVersion(21) - targetSdkVersion(31) + targetSdkVersion(33) versionCode = 1 versionName = "1.0" buildConfigField "String", "SDK_VERSION", "\"${PUBLISH_VERSION}\"" @@ -54,27 +54,27 @@ android { dependencies { implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:${org.jetbrains.kotlin.config.KotlinCompilerVersion.VERSION}") - api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2") - api("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2") + api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.1") + api("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.1") - api(platform("com.squareup.okhttp3:okhttp-bom:4.9.0")) + api(platform("com.squareup.okhttp3:okhttp-bom:4.10.0")) api("com.squareup.okhttp3:okhttp") implementation("com.squareup.okhttp3:okhttp-urlconnection") implementation("com.squareup.okhttp3:logging-interceptor") - implementation("com.google.code.gson:gson:2.8.7") + implementation("com.google.code.gson:gson:2.9.0") - implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.3.1") - implementation("androidx.lifecycle:lifecycle-common-java8:2.3.1") - implementation("androidx.appcompat:appcompat:1.3.1") - implementation("androidx.fragment:fragment-ktx:1.3.6") - implementation("androidx.activity:activity-ktx:1.3.1") - implementation("androidx.browser:browser:1.3.0") + implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.5.1") + implementation("androidx.lifecycle:lifecycle-common-java8:2.5.1") + implementation("androidx.appcompat:appcompat:1.5.1") + implementation("androidx.fragment:fragment-ktx:1.5.3") + implementation("androidx.activity:activity-ktx:1.6.0") + implementation("androidx.browser:browser:1.4.0") testImplementation 'junit:junit:4.+' testImplementation "androidx.test.ext:junit-ktx:1.1.3" testImplementation "androidx.test:core-ktx:1.4.0" testImplementation "org.robolectric:robolectric:4.5.1" - testApi("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.5.1") + testApi("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.1") } apply from: "${rootProject.projectDir}/scripts/publish-module.gradle" \ No newline at end of file diff --git a/templates/android/library/src/main/java/io/appwrite/Client.kt.twig b/templates/android/library/src/main/java/io/appwrite/Client.kt.twig index d681e0653e..930b74edd5 100644 --- a/templates/android/library/src/main/java/io/appwrite/Client.kt.twig +++ b/templates/android/library/src/main/java/io/appwrite/Client.kt.twig @@ -9,6 +9,7 @@ import {{ sdk.namespace | caseDot }}.cookies.stores.SharedPreferencesCookieStore import {{ sdk.namespace | caseDot }}.exceptions.{{ spec.title | caseUcfirst }}Exception import {{ sdk.namespace | caseDot }}.extensions.fromJson import {{ sdk.namespace | caseDot }}.json.PreciseNumberAdapter +import {{ sdk.namespace | caseDot }}.models.InputFile import {{ sdk.namespace | caseDot }}.models.UploadProgress import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers @@ -39,7 +40,7 @@ import kotlin.coroutines.resume class Client @JvmOverloads constructor( context: Context, - var endPoint: String = "https://appwrite.io/v1", + var endPoint: String = "{{spec.endpoint}}", var endPointRealtime: String? = null, private var selfSigned: Boolean = false ) : CoroutineScope { @@ -84,7 +85,10 @@ class Client @JvmOverloads constructor( "content-type" to "application/json", "origin" to "{{ spec.title | caseLower }}-android://${context.packageName}", "user-agent" to "${context.packageName}/${appVersion}, ${System.getProperty("http.agent")}", - "x-sdk-version" to "{{spec.title | caseDash}}:{{ language.name | caseLower }}:${BuildConfig.SDK_VERSION}"{% if spec.global.defaultHeaders | length > 0 %},{% endif %} + "x-sdk-name" to "{{ sdk.name }}", + "x-sdk-platform" to "{{ sdk.platform }}", + "x-sdk-language" to "{{ language.name | caseLower }}", + "x-sdk-version" to "{{ sdk.version }}"{% if spec.global.defaultHeaders | length > 0 %},{% endif %} {% for key,header in spec.global.defaultHeaders %} "{{ key | caseLower }}" to "{{ header }}"{% if not loop.last %},{% endif %} @@ -226,7 +230,7 @@ class Client @JvmOverloads constructor( headers: Map = mapOf(), params: Map = mapOf(), responseType: Class, - converter: ((Map) -> T)? = null + converter: ((Any) -> T)? = null ): T { val filteredParams = params.filterValues { it != null } @@ -317,19 +321,34 @@ class Client @JvmOverloads constructor( headers: MutableMap, params: MutableMap, responseType: Class, - converter: ((Map) -> T), + converter: ((Any) -> T), paramName: String, idParamName: String? = null, onProgress: ((UploadProgress) -> Unit)? = null, ): T { - val file = params[paramName] as File - val size = file.length() + var file: RandomAccessFile? = null + val input = params[paramName] as InputFile + val size: Long = when(input.sourceType) { + "path", "file" -> { + file = RandomAccessFile(input.path, "r") + file.length() + } + "bytes" -> { + (input.data as ByteArray).size.toLong() + } + else -> throw UnsupportedOperationException() + } if (size < CHUNK_SIZE) { + val data = when(input.sourceType) { + "file", "path" -> File(input.path).asRequestBody() + "bytes" -> (input.data as ByteArray).toRequestBody(input.mimeType.toMediaType()) + else -> throw UnsupportedOperationException() + } params[paramName] = MultipartBody.Part.createFormData( paramName, - file.name, - file.asRequestBody() + input.filename, + data ) return call( method = "POST", @@ -341,7 +360,6 @@ class Client @JvmOverloads constructor( ) } - val input = RandomAccessFile(file, "r") val buffer = ByteArray(CHUNK_SIZE) var offset = 0L var result: Map<*, *>? = null @@ -360,12 +378,29 @@ class Client @JvmOverloads constructor( } while (offset < size) { - input.seek(offset) - input.read(buffer) + when(input.sourceType) { + "file", "path" -> { + file!!.seek(offset) + file!!.read(buffer) + } + "bytes" -> { + val end = if (offset + CHUNK_SIZE < size) { + offset + CHUNK_SIZE + } else { + size - 1 + } + (input.data as ByteArray).copyInto( + buffer, + startIndex = offset.toInt(), + endIndex = end.toInt() + ) + } + else -> throw UnsupportedOperationException() + } params[paramName] = MultipartBody.Part.createFormData( paramName, - file.name, + input.filename, buffer.toRequestBody() ) @@ -409,7 +444,7 @@ class Client @JvmOverloads constructor( private suspend fun awaitResponse( request: Request, responseType: Class, - converter: ((Map) -> T)? = null + converter: ((Any) -> T)? = null ) = suspendCancellableCoroutine { http.newCall(request).enqueue(object : Callback { override fun onFailure(call: Call, e: IOException) { @@ -470,9 +505,9 @@ class Client @JvmOverloads constructor( it.resume(true as T) return } - val map = gson.fromJson>( + val map = gson.fromJson( body, - object : TypeToken>(){}.type + object : TypeToken(){}.type ) it.resume( converter?.invoke(map) ?: map as T diff --git a/templates/android/library/src/main/java/io/appwrite/ID.kt.twig b/templates/android/library/src/main/java/io/appwrite/ID.kt.twig new file mode 100644 index 0000000000..3ac3c98b04 --- /dev/null +++ b/templates/android/library/src/main/java/io/appwrite/ID.kt.twig @@ -0,0 +1,10 @@ +package {{ sdk.namespace | caseDot }} + +class ID { + companion object { + fun custom(id: String): String + = id + fun unique(): String + = "unique()" + } +} \ No newline at end of file diff --git a/templates/android/library/src/main/java/io/appwrite/Permission.kt.twig b/templates/android/library/src/main/java/io/appwrite/Permission.kt.twig new file mode 100644 index 0000000000..33e5b741c9 --- /dev/null +++ b/templates/android/library/src/main/java/io/appwrite/Permission.kt.twig @@ -0,0 +1,21 @@ +package {{ sdk.namespace | caseDot }} + +class Permission { + companion object { + fun read(role: String): String { + return "read(\"${role}\")" + } + fun write(role: String): String { + return "write(\"${role}\")" + } + fun create(role: String): String { + return "create(\"${role}\")" + } + fun update(role: String): String { + return "update(\"${role}\")" + } + fun delete(role: String): String { + return "delete(\"${role}\")" + } + } +} \ No newline at end of file diff --git a/templates/android/library/src/main/java/io/appwrite/Query.kt.twig b/templates/android/library/src/main/java/io/appwrite/Query.kt.twig index 7783dff78b..7103c1bc2a 100644 --- a/templates/android/library/src/main/java/io/appwrite/Query.kt.twig +++ b/templates/android/library/src/main/java/io/appwrite/Query.kt.twig @@ -6,20 +6,32 @@ class Query { fun notEqual(attribute: String, value: Any) = Query.addQuery(attribute, "notEqual", value) - fun lesser(attribute: String, value: Any) = Query.addQuery(attribute, "lesser", value) + fun lessThan(attribute: String, value: Any) = Query.addQuery(attribute, "lessThan", value) - fun lesserEqual(attribute: String, value: Any) = Query.addQuery(attribute, "lesserEqual", value) + fun lessThanEqual(attribute: String, value: Any) = Query.addQuery(attribute, "lessThanEqual", value) - fun greater(attribute: String, value: Any) = Query.addQuery(attribute, "greater", value) + fun greaterThan(attribute: String, value: Any) = Query.addQuery(attribute, "greaterThan", value) - fun greaterEqual(attribute: String, value: Any) = Query.addQuery(attribute, "greaterEqual", value) + fun greaterThanEqual(attribute: String, value: Any) = Query.addQuery(attribute, "greaterThanEqual", value) fun search(attribute: String, value: String) = Query.addQuery(attribute, "search", value) - private fun addQuery(attribute: String, oper: String, value: Any): String { + fun orderAsc(attribute: String) = "orderAsc(\"${attribute}\")" + + fun orderDesc(attribute: String) = "orderDesc(\"${attribute}\")" + + fun cursorBefore(documentId: String) = "cursorBefore(\"${documentId}\")" + + fun cursorAfter(documentId: String) = "cursorAfter(\"${documentId}\")" + + fun limit(limit: Int) = "limit(${limit})" + + fun offset(offset: Int) = "offset(${offset})" + + private fun addQuery(attribute: String, method: String, value: Any): String { return when (value) { - is List<*> -> "${attribute}.${oper}(${value.map{it -> parseValues(it!!)}.joinToString(",")})" - else -> "${attribute}.${oper}(${Query.parseValues(value)})" + is List<*> -> "${method}(\"${attribute}\", [${value.map{it -> parseValues(it!!)}.joinToString(",")}])" + else -> "${method}(\"${attribute}\", [${Query.parseValues(value)}])" } } private fun parseValues(value: Any): String { diff --git a/templates/android/library/src/main/java/io/appwrite/Role.kt.twig b/templates/android/library/src/main/java/io/appwrite/Role.kt.twig new file mode 100644 index 0000000000..d5f59c3a64 --- /dev/null +++ b/templates/android/library/src/main/java/io/appwrite/Role.kt.twig @@ -0,0 +1,29 @@ +package {{ sdk.namespace | caseDot }} + +class Role { + companion object { + fun any(): String = "any" + + fun user(id: String, status: String = ""): String = if(status.isEmpty()) { + "user:$id" + } else { + "user:$id/$status" + } + + fun users(status: String = ""): String = if(status.isEmpty()) { + "users" + } else { + "users/$status" + } + + fun guests(): String = "guests" + + fun team(id: String, role: String = ""): String = if(role.isEmpty()) { + "team:$id" + } else { + "team:$id/$role" + } + + fun member(id: String): String = "member:$id" + } +} \ No newline at end of file diff --git a/templates/android/library/src/main/java/io/appwrite/coroutines/Callback.kt.twig b/templates/android/library/src/main/java/io/appwrite/coroutines/Callback.kt.twig new file mode 100644 index 0000000000..279be06c39 --- /dev/null +++ b/templates/android/library/src/main/java/io/appwrite/coroutines/Callback.kt.twig @@ -0,0 +1,18 @@ +package {{ sdk.namespace | caseDot }}.coroutines + +import kotlinx.coroutines.Dispatchers +import kotlin.coroutines.Continuation +import kotlin.coroutines.CoroutineContext + +interface Callback { + fun onComplete(result: T?, error: Throwable?) +} + +class CoroutineCallback @JvmOverloads constructor( + private val callback: Callback, + override val context: CoroutineContext = Dispatchers.Default +) : Continuation { + override fun resumeWith(result: Result) { + callback.onComplete(result.getOrNull(), result.exceptionOrNull()) + } +} \ No newline at end of file diff --git a/templates/android/library/src/main/java/io/appwrite/extensions/TypeExtensions.kt.twig b/templates/android/library/src/main/java/io/appwrite/extensions/TypeExtensions.kt.twig new file mode 100644 index 0000000000..60ae417882 --- /dev/null +++ b/templates/android/library/src/main/java/io/appwrite/extensions/TypeExtensions.kt.twig @@ -0,0 +1,8 @@ +package {{ sdk.namespace | caseDot }}.extensions + +import kotlin.reflect.KClass +import kotlin.reflect.typeOf + +inline fun classOf(): Class { + return (typeOf().classifier!! as KClass).java +} \ No newline at end of file diff --git a/templates/android/library/src/main/java/io/appwrite/models/InputFile.kt.twig b/templates/android/library/src/main/java/io/appwrite/models/InputFile.kt.twig new file mode 100644 index 0000000000..382267a0d0 --- /dev/null +++ b/templates/android/library/src/main/java/io/appwrite/models/InputFile.kt.twig @@ -0,0 +1,37 @@ +package {{ sdk.namespace | caseDot }}.models + +import java.io.File +import java.net.URLConnection +import java.nio.file.Files +import java.nio.file.Paths + +class InputFile private constructor() { + + lateinit var path: String + lateinit var filename: String + lateinit var mimeType: String + lateinit var sourceType: String + lateinit var data: Any + + companion object { + fun fromFile(file: File) = InputFile().apply { + path = file.canonicalPath + filename = file.name + mimeType = Files.probeContentType(Paths.get(file.canonicalPath)) + ?: URLConnection.guessContentTypeFromName(filename) + ?: "" + sourceType = "file" + } + + fun fromPath(path: String): InputFile = fromFile(File(path)).apply { + sourceType = "path" + } + + fun fromBytes(bytes: ByteArray, filename: String = "", mimeType: String = "") = InputFile().apply { + this.filename = filename + this.mimeType = mimeType + data = bytes + sourceType = "bytes" + } + } +} \ No newline at end of file diff --git a/templates/android/library/src/main/java/io/appwrite/models/Model.kt.twig b/templates/android/library/src/main/java/io/appwrite/models/Model.kt.twig index 90775de2cf..6b049555cb 100644 --- a/templates/android/library/src/main/java/io/appwrite/models/Model.kt.twig +++ b/templates/android/library/src/main/java/io/appwrite/models/Model.kt.twig @@ -1,62 +1,71 @@ -{% macro sub_schema(property) %}{% if property.sub_schema %}{% if property.type == 'array' %}List<{{property.sub_schema | caseUcfirst}}>{% else %}{{property.sub_schema | caseUcfirst}}{% endif %}{% else %}{% if property.type == 'object' and property.additionalProperties %}Map{% else %}{{property.type | typeName}}{% endif %}{% endif %}{% endmacro %} package {{ sdk.namespace | caseDot }}.models import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast /** * {{ definition.description }} */ -data class {{ definition.name | caseUcfirst }}( -{% for property in definition.properties %} +{% if definition.properties | length != 0 or definition.additionalProperties %}data {% endif %}class {{ definition | modelType(spec) | raw }}( + {%~ for property in definition.properties %} /** * {{ property.description }} - * */ @SerializedName("{{ property.name | escapeKeyword | escapeDollarSign}}") - {% if property.required %}val{% else%}var{% endif %} {{ property.name | escapeKeyword | removeDollarSign }}: {{_self.sub_schema(property)}}{% if not property.required %}?{% endif %}{% if not loop.last or (loop.last and definition.additionalProperties) %},{{ "\n" }}{% endif %} + {% if property.required -%} val + {%- else -%} var + {%- endif %} {{ property.name | escapeKeyword | removeDollarSign }}: {{ property | propertyType(spec) | raw }}, -{% endfor %} -{% if definition.additionalProperties %} - val data: Map -{% endif %} + {%~ endfor %} + {%~ if definition.additionalProperties %} + /** + * Additional properties + */ + @SerializedName("data") + val data: T + {%~ endif %} ) { - companion object { - @Suppress("UNCHECKED_CAST") - fun from(map: Map) = {{ definition.name | caseUcfirst }}( -{% for property in definition.properties %} - {{ property.name | escapeKeyword | removeDollarSign }} = {% if property.sub_schema %}{% if property.type == 'array' %}(map["{{ property.name | escapeDollarSign }}"] as List>).map { {{property.sub_schema | caseUcfirst}}.from(map = it) }{% else %}{{property.sub_schema | caseUcfirst}}.from(map = map["{{property.name | escapeDollarSign }}"] as Map){% endif %}{% else %}{% if property.type == "integer" or property.type == "number" %}({% endif %}map["{{ property.name | escapeDollarSign }}"]{% if property.type == "integer" or property.type == "number" %} as{% if not property.required %}?{% endif %} Number){% endif %}{% if property.type == "integer" %}{% if not property.required %}?{% endif %}.toLong(){% elseif property.type == "number" %}{% if not property.required %}?{% endif %}.toDouble(){% else %} as{% if not property.required %}?{% endif %} {{ _self.sub_schema(property) }}{% endif %}{% endif %}{% if not loop.last or (loop.last and definition.additionalProperties) %},{% endif %} - -{% endfor %} -{% if definition.additionalProperties %} - data = map -{% endif %} - ) - } - fun toMap(): Map = mapOf( -{% for property in definition.properties %} - "{{ property.name | escapeDollarSign }}" to {% if property.sub_schema %}{% if property.type == 'array' %}{{property.name | escapeKeyword | removeDollarSign}}.map { it.toMap() }{% else %}{{property.name | escapeKeyword | removeDollarSign}}.toMap(){% endif %}{% else %}{{property.name | escapeKeyword | removeDollarSign}}{% endif %} as Any{% if not loop.last or (loop.last and definition.additionalProperties) %},{% endif %} - -{% endfor %} -{% if definition.additionalProperties %} - "data" to data -{% endif %} + {%~ for property in definition.properties %} + "{{ property.name | escapeDollarSign }}" to {% if property.sub_schema %}{% if property.type == 'array' %}{{property.name | escapeKeyword | removeDollarSign}}.map { it.toMap() }{% else %}{{property.name | escapeKeyword | removeDollarSign}}.toMap(){% endif %}{% else %}{{property.name | escapeKeyword | removeDollarSign}}{% endif %} as Any, + {%~ endfor %} + {%~ if definition.additionalProperties %} + "data" to data!!.jsonCast(to = Map::class.java) + {%~ endif %} ) -{% if definition.additionalProperties %} - fun convertTo(fromJson: (Map) -> T): T { - return fromJson(data) - } -{% endif %} -{% for property in definition.properties %} -{% if property.sub_schema %} -{% for def in spec.definitions %} -{% if def.name == property.sub_schema and def.additionalProperties and property.type == 'array' %} + companion object { + {%~ if definition.name | hasGenericType(spec) %} + operator fun invoke( + {%~ for property in definition.properties %} + {{ property.name | escapeKeyword | removeDollarSign }}: {{ property | propertyType(spec, 'Map') | raw }}, + {%~ endfor %} + {%~ if definition.additionalProperties %} + data: Map + {%~ endif %} + ) = {{ definition | modelType(spec, 'Map') | raw }}( + {%~ for property in definition.properties %} + {{ property.name | escapeKeyword | removeDollarSign }}, + {%~ endfor %} + {%~ if definition.additionalProperties %} + data + {%~ endif %} + ) + {%~ endif %} - fun convertTo(fromJson: (Map) -> T) = - {{property.name | removeDollarSign}}.map { it.convertTo(fromJson = fromJson) } -{% endif %} -{% endfor %} -{% endif %} -{% endfor %} + @Suppress("UNCHECKED_CAST") + fun {% if definition.name | hasGenericType(spec) %} {% endif %}from( + map: Map, + {%~ if definition.name | hasGenericType(spec) %} + nestedType: Class + {%~ endif %} + ) = {{ definition | modelType(spec) | raw }}( + {%~ for property in definition.properties %} + {{ property.name | escapeKeyword | removeDollarSign }} = {% if property.sub_schema %}{% if property.type == 'array' %}(map["{{ property.name | escapeDollarSign }}"] as List>).map { {{ property.sub_schema | caseUcfirst }}.from(map = it{% if definition.name | hasGenericType(spec) %}, nestedType{% endif %}) }{% else %}{{ property.sub_schema | caseUcfirst }}.from(map = map["{{property.name | escapeDollarSign }}"] as Map{% if definition.name | hasGenericType(spec) %}, nestedType{% endif %}){% endif %}{% else %}{% if property.type == "integer" or property.type == "number" %}({% endif %}map["{{ property.name | escapeDollarSign }}"]{% if property.type == "integer" or property.type == "number" %} as{% if not property.required %}?{% endif %} Number){% endif %}{% if property.type == "integer" %}{% if not property.required %}?{% endif %}.toLong(){% elseif property.type == "number" %}{% if not property.required %}?{% endif %}.toDouble(){% else %} as{% if not property.required %}?{% endif %} {{ property | propertyType(spec) | raw }}{% endif %}{% endif %}, + {%~ endfor %} + {%~ if definition.additionalProperties %} + data = map.jsonCast(to = nestedType) + {%~ endif %} + ) + } } \ No newline at end of file diff --git a/templates/android/library/src/main/java/io/appwrite/models/RealtimeModels.kt.twig b/templates/android/library/src/main/java/io/appwrite/models/RealtimeModels.kt.twig index 5d48aff021..f131ecd538 100644 --- a/templates/android/library/src/main/java/io/appwrite/models/RealtimeModels.kt.twig +++ b/templates/android/library/src/main/java/io/appwrite/models/RealtimeModels.kt.twig @@ -23,7 +23,7 @@ open class RealtimeResponse( data class RealtimeResponseEvent( val events: Collection, val channels: Collection, - val timestamp: Long, + val timestamp: String, var payload: T ) diff --git a/templates/android/library/src/main/java/io/appwrite/services/ServiceTemplate.kt.twig b/templates/android/library/src/main/java/io/appwrite/services/ServiceTemplate.kt.twig index ffa18dfa6a..f665880bde 100644 --- a/templates/android/library/src/main/java/io/appwrite/services/ServiceTemplate.kt.twig +++ b/templates/android/library/src/main/java/io/appwrite/services/ServiceTemplate.kt.twig @@ -1,65 +1,69 @@ -{% macro parameter(parameter) %}{{ parameter.name | caseCamel }}: {{ parameter.type | typeName }}{% if not parameter.required %}? = null{% endif %}{% endmacro %} -{% macro method_parameters(parameters, consumes) %} -{% if parameters.all|length > 0 %}{% for parameter in parameters.all %}{{ '\n\t\t' }}{{ _self.parameter(parameter) }}{% if not loop.last %}{{ ',' }}{% endif %}{% endfor %}{% if 'multipart/form-data' in consumes %}, onProgress: ((UploadProgress) -> Unit)? = null{% endif %}{% endif %} -{% endmacro %} -{% macro methodNeedsSecurityParameters(method) %} -{% if (method.type == "webAuth" or method.type == "location") and method.security|length > 0 %}{{ true }}{% else %}{{false}}{% endif %} -{% endmacro %} -{% macro resultType(namespace, method) %} -{% if method.type == "webAuth" %}Bool{% elseif method.type == "location" %}ByteArray{% elseif not method.responseModel or method.responseModel == 'any' %}Any{% else %}{{ namespace | caseDot}}.models.{{method.responseModel | caseUcfirst}}{% endif %} -{% endmacro %} package {{ sdk.namespace | caseDot }}.services import android.net.Uri import {{ sdk.namespace | caseDot }}.Client import {{ sdk.namespace | caseDot }}.models.* +import {{ sdk.namespace | caseDot }}.exceptions.{{ spec.title | caseUcfirst }}Exception +import {{ sdk.namespace | caseDot }}.extensions.classOf {% if service.features.webAuth %} import {{ sdk.namespace | caseDot }}.WebAuthComponent import androidx.activity.ComponentActivity {% endif %} -import {{ sdk.namespace | caseDot }}.exceptions.{{ spec.title | caseUcfirst }}Exception import okhttp3.Cookie -import okhttp3.Response {% if (service.features.webAuth or service.features.location) %} import okhttp3.HttpUrl import okhttp3.HttpUrl.Companion.toHttpUrl {% endif %} import java.io.File -class {{ service.name | caseUcfirst }}(client: Client) : Service(client) { +/** + * {{ service.description | raw | replace({"\n": "", "\r": ""}) }} +**/ +class {{ service.name | caseUcfirst }} : Service { + + public constructor (client: Client) : super(client) { } {% for method in service.methods %} /** * {{ method.title }} * -{% if method.description %} -{{ method.description|comment1 }} + * {{ method.description | raw | replace({"\n": "", "\r": ""}) }} * -{% endif %} -{% for parameter in method.parameters.all %} - * @param {{ parameter.name | caseCamel }} {{ parameter.description }} -{% endfor %} - * {% if method.type != "webAuth" %}@return [{{ _self.resultType(sdk.namespace, method) }}]{% endif %} - + {%~ for parameter in method.parameters.all %} + * @param {{ parameter.name | caseCamel }} {{ parameter.description | raw }} + {%~ endfor %} + {%~ if method.type != "webAuth" %} + * @return [{{ method | returnType(spec, sdk.namespace | caseDot) | raw }}] + {%~ endif %} */ + {%~ if method.parameters.all | reduce((carry, param) => carry or not param.required) %} @JvmOverloads - @Throws({{ spec.title | caseUcfirst }}Exception::class) - suspend fun {{ method.name | caseCamel }}({% if method.type == "webAuth" %}{{ '\n\t\t' }}activity: ComponentActivity{% if method.parameters.all | length > 0 %}, {% endif %}{% endif %}{{ _self.method_parameters(method.parameters, method.consumes) }}{% if method.parameters.all|length > 0 %}{{ '\n\t' }}{% endif %}){% if method.type != "webAuth" %}: {{ _self.resultType(sdk.namespace, method) }}{% endif %} { - val path = "{{ method.path }}"{% for parameter in method.parameters.path %}.replace("{{ '{' ~ parameter.name | caseCamel ~ '}' }}", {{ parameter.name | caseCamel }}){% endfor %} + {%~ endif %} + suspend fun {% if method.responseModel | hasGenericType(spec) %}{{ '' | raw }} {% endif %}{{ method.name | caseCamel }}( + {%~ if method.type == "webAuth" %} + activity: ComponentActivity, + {%~ endif %} + {%~ for parameter in method.parameters.all %} + {{ parameter.name | caseCamel }}: {{ parameter | typeName }}{%~ if not parameter.required %}? = null{% endif %}, + {%~ endfor %} + {%~ if method.responseModel | hasGenericType(spec) %} + nestedType: Class, + {%~ endif %} + {%~ if 'multipart/form-data' in method.consumes %} + onProgress: ((UploadProgress) -> Unit)? = null + {%~ endif %} + ){% if method.type != "webAuth" %}: {{ method | returnType(spec, sdk.namespace | caseDot) | raw }}{% endif %} { + val path = "{{ method.path }}" + {%~ for parameter in method.parameters.path %} + .replace("{{ '{' ~ parameter.name | caseCamel ~ '}' }}", {{ parameter.name | caseCamel }}) + {%~ endfor %} val params = mutableMapOf( -{% for parameter in method.parameters.query | merge(method.parameters.body) %} - "{{ parameter.name }}" to {{ parameter.name | caseCamel }}{% if not loop.last or _self.methodNeedsSecurityParameters(method) %},{% endif %} - -{% endfor %} -{% if _self.methodNeedsSecurityParameters(method) %} -{% for node in method.security %} -{% for key,header in node|keys %} - "{{header|caseLower}}" to client.config["{{header|caseLower}}"]{% if not loop.last %},{% endif %} - -{% endfor %}{% endfor %}{% endif %} + {%~ for parameter in method.parameters.query | merge(method.parameters.body) %} + "{{ parameter.name }}" to {{ parameter.name | caseCamel }}, + {%~ endfor %} ) -{% if method.type == 'webAuth' %} + {%~ if method.type == 'webAuth' %} val query = mutableListOf() params.forEach { when (it.value) { @@ -102,60 +106,109 @@ class {{ service.name | caseUcfirst }}(client: Client) : Service(client) { listOf(cookie) ) } -{% elseif method.type == 'location' %} + {%~ elseif method.type == 'location' %} return client.call( "{{ method.method | caseUpper }}", path, params = params, - responseType = {{ _self.resultType(sdk.namespace, method) }}::class.java + responseType = {{ method | returnType(spec, sdk.namespace | caseDot) | raw }}::class.java ) -{% else %} + {%~ else %} val headers = mutableMapOf( -{{ method.headers|map((header, key) => " \"#{key}\" to \"#{header}\"")|join(',\n')|raw }} + {%~ for key, header in method.headers %} + "{{ key }}" to "{{ header }}", + {%~ endfor %} ) -{% if method.responseModel %} - val converter: (Map) -> {{ _self.resultType(sdk.namespace, method) }} = { -{% if method.responseModel == 'any' %} + {%~ if method.responseModel %} + val converter: (Any) -> {{ method | returnType(spec, sdk.namespace | caseDot) | raw }} = { + {% if method.responseModel == 'any' %} it -{% else %} - {{ _self.resultType(sdk.namespace, method) }}.from(map = it) -{% endif %} + {% else %} + {{sdk.namespace | caseDot}}.models.{{ method.responseModel | caseUcfirst }}.from(map = it as Map{% if method.responseModel | hasGenericType(spec) %}, nestedType{% endif %}) + {% endif %} } -{% endif %} -{% if 'multipart/form-data' in method.consumes %} + {%~ endif %} + {%~ if 'multipart/form-data' in method.consumes %} val idParamName: String? = {% if method.parameters.all | filter(p => p.isUploadID) | length > 0 %}{% for parameter in method.parameters.all | filter(parameter => parameter.isUploadID) %}"{{ parameter.name }}"{% endfor %}{% else %}null{% endif %} -{% for parameter in method.parameters.all %} -{% if parameter.type == 'file' %} + {%~ for parameter in method.parameters.all %} + {%~ if parameter.type == 'file' %} val paramName = "{{ parameter.name }}" -{% endif %} -{% endfor %} + {%~ endif %} + {%~ endfor %} return client.chunkedUpload( path, headers, params, - responseType = {{ _self.resultType(sdk.namespace, method) }}::class.java, -{% if method.responseModel %} + responseType = {{ method | returnType(spec, sdk.namespace | caseDot) | raw }}::class.java, + {%~ if method.responseModel %} converter, -{% endif %} + {%~ endif %} paramName, idParamName, onProgress, ) -{% else %} + {%~ else %} return client.call( "{{ method.method | caseUpper }}", path, headers, params, - responseType = {{ _self.resultType(sdk.namespace, method) }}::class.java, -{% if method.responseModel %} + {%~ if method.responseModel | hasGenericType(spec) %} + responseType = classOf(), + {%~ else %} + responseType = {{ method | returnType(spec, sdk.namespace | caseDot) | raw }}::class.java, + {%~ endif %} + {%~ if method.responseModel %} converter, -{% endif %} + {%~ endif %} ) -{% endif %} -{% endif %} + {%~ endif %} + {%~ endif %} } - -{% endfor %} + + {%~ if method.responseModel | hasGenericType(spec) %} + /** + * {{ method.title }} + * + * {{ method.description | raw | replace({"\n": "", "\r": ""}) }} + * + {%~ for parameter in method.parameters.all %} + * @param {{ parameter.name | caseCamel }} {{ parameter.description | raw }} + {%~ endfor %} + {%~ if method.type != "webAuth" %} + * @return [{{ method | returnType(spec, sdk.namespace | caseDot) | raw }}] + {%~ endif %} + */ + {%~ if method.parameters.all | reduce((carry, param) => carry or not param.required) %} + @JvmOverloads + {%~ endif %} + @Throws({{ spec.title | caseUcfirst }}Exception::class) + suspend fun {{ method.name | caseCamel }}( + {%~ if method.type == "webAuth" %} + activity: ComponentActivity, + {%~ endif %} + {%~ for parameter in method.parameters.all %} + {{ parameter.name | caseCamel }}: {{ parameter | typeName }}{%~ if not parameter.required %}? = null{% endif %}, + {%~ endfor %} + {%~ if 'multipart/form-data' in method.consumes %} + onProgress: ((UploadProgress) -> Unit)? = null + {%~ endif %} + ) = {{ method.name | caseCamel }}( + {%~ if method.type == "webAuth" %} + activity, + {%~ endif %} + {%~ for parameter in method.parameters.all %} + {{ parameter.name | caseCamel }}, + {%~ endfor %} + {%~ if method.responseModel | hasGenericType(spec) %} + nestedType = classOf(), + {%~ endif %} + {%~ if 'multipart/form-data' in method.consumes %} + onProgress = onProgress + {%~ endif %} + ) + {%~ endif %} + + {%~ endfor %} } \ No newline at end of file diff --git a/templates/cli/.github/workflows/npm-publish.yml b/templates/cli/.github/workflows/npm-publish.yml index d74ebb51cb..d4184aadcf 100644 --- a/templates/cli/.github/workflows/npm-publish.yml +++ b/templates/cli/.github/workflows/npm-publish.yml @@ -31,7 +31,14 @@ jobs: npm run mac-x64 npm run mac-arm64 - name: Publish NPM library - run: npm publish + run: | + if ${{ contains(github.event.release.tag_name, '-RC') }}; then + echo "Publishing Release Candidate ${{ github.event.release.tag_name}} to NPM" + npm publish --tag next + else + echo "Publishing ${{ github.event.release.tag_name}} to NPM" + npm publish + fi env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - uses: fnkr/github-action-ghr@v1 diff --git a/templates/cli/Formula/formula.rb.twig b/templates/cli/Formula/formula.rb.twig index d7274f3646..c2c6878d8d 100644 --- a/templates/cli/Formula/formula.rb.twig +++ b/templates/cli/Formula/formula.rb.twig @@ -4,7 +4,7 @@ class {{ spec.title| caseUcfirst }} < Formula desc "CLI is a Node based command-line tool for {{ spec.title| caseUcfirst }} API" homepage "{{ sdk.url }}" license "{{ sdk.license }}" - head "https://github.com/{{ sdk.gitUserName }}/{{ sdk.gitRepoName | caseDash }}.git", branch: "main" + head "https://github.com/{{ sdk.gitUserName }}/{{ sdk.gitRepoName | caseDash }}.git", branch: "master" depends_on "node" diff --git a/templates/cli/LICENSE.md.twig b/templates/cli/LICENSE.md.twig index 0e8c361b49..854eb19494 100644 --- a/templates/cli/LICENSE.md.twig +++ b/templates/cli/LICENSE.md.twig @@ -1 +1 @@ -{{sdk.licenseContent}} \ No newline at end of file +{{sdk.licenseContent | raw}} \ No newline at end of file diff --git a/templates/cli/lib/client.js.twig b/templates/cli/lib/client.js.twig index fa05257ee6..aca94bb5e2 100644 --- a/templates/cli/lib/client.js.twig +++ b/templates/cli/lib/client.js.twig @@ -12,8 +12,11 @@ class Client { this.endpoint = '{{spec.endpoint}}'; this.headers = { 'content-type': '', - 'x-sdk-version': '{{spec.title | caseDash}}:{{ language.name | caseLower }}:{{ sdk.version }}', - 'User-Agent' : `{{spec.title | caseUcfirst}}CLI/{{ sdk.version }} (${os.type()} ${os.version()}; ${os.arch()})`, + 'x-sdk-name': '{{ sdk.name }}', + 'x-sdk-platform': '{{ sdk.platform }}', + 'x-sdk-language': '{{ language.name | caseLower }}', + 'x-sdk-version': '{{ sdk.version }}', + 'user-agent' : `{{spec.title | caseUcfirst}}CLI/{{ sdk.version }} (${os.type()} ${os.version()}; ${os.arch()})`, {% for key,header in spec.global.defaultHeaders %} '{{key}}' : '{{header}}', {% endfor %} @@ -134,6 +137,7 @@ class Client { method.toUpperCase() === "GET" || contentType.startsWith("multipart/form-data") ? formData : params, json: contentType.startsWith("application/json"), transformRequest: method.toUpperCase() === "GET" || contentType.startsWith("multipart/form-data") ? undefined : (data) => JSONbig.stringify(data), + transformResponse: [ (data) => data ? JSONbig.parse(data) : data ], responseType: responseType, }; try { diff --git a/templates/cli/lib/commands/command.js.twig b/templates/cli/lib/commands/command.js.twig index df4b4c548a..ad9155b37a 100644 --- a/templates/cli/lib/commands/command.js.twig +++ b/templates/cli/lib/commands/command.js.twig @@ -15,7 +15,7 @@ const {{ service.name | caseLower }} = new Command("{{ service.name | caseLower {% for method in service.methods %} const {{ service.name | caseLower }}{{ method.name | caseUcfirst }} = async ({ {% for parameter in method.parameters.all %}{{ parameter.name | caseCamel | escapeKeyword }}, {% endfor %}parseOutput = true, sdk = undefined{% if 'multipart/form-data' in method.consumes %}, onProgress = () => {}{% endif %}{% if method.type == 'location' %}, destination{% endif %}}) => { {% for parameter in method.parameters.all %} - /* @param {{ '{' }}{{ parameter.type | typeName }}{{ '}' }} {{ parameter.name | caseCamel | escapeKeyword }} */ + /* @param {{ '{' }}{{ parameter | typeName }}{{ '}' }} {{ parameter.name | caseCamel | escapeKeyword }} */ {% endfor %} let client = !sdk ? await {% if service.name == "projects" %}sdkForConsole(){% else %}sdkForProject(){% endif %} : sdk; @@ -222,7 +222,7 @@ const {{ service.name | caseLower }}{{ method.name | caseUcfirst }} = async ({ { {% autoescape false %} .description(`{{ method.description | replace({'`':'\''}) | replace({'\n':' '}) | replace({'\n \n':' '}) }}`) {% for parameter in method.parameters.all %} - .{% if parameter.required %}requiredOption{% else %}option{% endif %}(`--{{ parameter.name | escapeKeyword }} <{{ parameter.name | escapeKeyword }}{% if parameter.array.type|length > 0 %}...{% endif %}>`, `{{ parameter.description | replace({'`':'\''}) | replace({'\n':' '}) | replace({'\n \n':' '}) }}`{% if parameter.type|typeName == 'boolean' %}, parseBool{% elseif parameter.type|typeName == 'number' %}, parseInteger{% endif %}) + .{% if parameter.required %}requiredOption{% else %}option{% endif %}(`--{{ parameter.name | escapeKeyword }} <{{ parameter.name | escapeKeyword }}{% if parameter.array.type|length > 0 %}...{% endif %}>`, `{{ parameter.description | replace({'`':'\''}) | replace({'\n':' '}) | replace({'\n \n':' '}) }}`{% if parameter | typeName == 'boolean' %}, parseBool{% elseif parameter | typeName == 'number' %}, parseInteger{% endif %}) {% endfor %} {% if method.type == 'location' %} .requiredOption(`--destination `, `output file path.`) diff --git a/templates/cli/lib/commands/deploy.js.twig b/templates/cli/lib/commands/deploy.js.twig index a0d80516e3..d0a3d9b26a 100644 --- a/templates/cli/lib/commands/deploy.js.twig +++ b/templates/cli/lib/commands/deploy.js.twig @@ -2,40 +2,49 @@ const inquirer = require("inquirer"); const JSONbig = require("json-bigint")({ storeAsString: false }); const { Command } = require("commander"); const { localConfig } = require("../config"); -const { questionsDeployFunctions, questionsGetEntrypoint, questionsDeployCollections } = require("../questions"); +const { questionsDeployTeams, questionsDeployFunctions, questionsGetEntrypoint, questionsDeployCollections, questionsConfirmDeployCollections } = require("../questions"); const { actionRunner, success, log, error, commandDescriptions } = require("../parser"); -const { functionsGet, functionsCreate, functionsUpdate, functionsCreateDeployment, functionsUpdateDeployment } = require('./functions'); +const { functionsGet, functionsCreate, functionsUpdate, functionsCreateDeployment, functionsUpdateDeployment, functionsListVariables, functionsDeleteVariable, functionsCreateVariable } = require('./functions'); const { - databaseCreateBooleanAttribute, - databaseGetCollection, - databaseCreateCollection, - databaseCreateStringAttribute, - databaseCreateIntegerAttribute, - databaseCreateFloatAttribute, - databaseCreateEmailAttribute, - databaseCreateIndex, - databaseCreateUrlAttribute, - databaseCreateIpAttribute, - databaseCreateEnumAttribute, - databaseDeleteAttribute, - databaseListAttributes, - databaseListIndexes, - databaseDeleteIndex -} = require("./database"); + databasesGet, + databasesCreate, + databasesCreateBooleanAttribute, + databasesGetCollection, + databasesCreateCollection, + databasesCreateStringAttribute, + databasesCreateIntegerAttribute, + databasesCreateFloatAttribute, + databasesCreateEmailAttribute, + databasesCreateDatetimeAttribute, + databasesCreateIndex, + databasesCreateUrlAttribute, + databasesCreateIpAttribute, + databasesCreateEnumAttribute, + databasesDeleteAttribute, + databasesListAttributes, + databasesListIndexes, + databasesDeleteIndex +} = require("./databases"); +const { + teamsGet, + teamsUpdate, + teamsCreate +} = require("./teams"); const POOL_DEBOUNCE = 2000; // in milliseconds const POOL_MAX_DEBOUNCES = 30; const awaitPools = { - wipeAttributes: async (collectionId, iteration = 1) => { + wipeAttributes: async (databaseId, collectionId, iteration = 1) => { if (iteration > POOL_MAX_DEBOUNCES) { return false; } // TODO: Pagination? - const { attributes: remoteAttributes } = await databaseListAttributes({ + const { attributes: remoteAttributes } = await databasesListAttributes({ + databaseId, collectionId, - limit: 100, + queries: [ 'limit(100)' ], parseOutput: false }); @@ -44,17 +53,18 @@ const awaitPools = { } await new Promise(resolve => setTimeout(resolve, POOL_DEBOUNCE)); - return await awaitPools.wipeAttributes(collectionId, iteration + 1); + return await awaitPools.wipeAttributes(databaseId, collectionId, iteration + 1); }, - wipeIndexes: async (collectionId, iteration = 1) => { + wipeIndexes: async (databaseId, collectionId, iteration = 1) => { if (iteration > POOL_MAX_DEBOUNCES) { return false; } // TODO: Pagination? - const { indexes: remoteIndexes } = await databaseListIndexes({ + const { indexes: remoteIndexes } = await databasesListIndexes({ + databaseId, collectionId, - limit: 100, + queries: [ 'limit(100)' ], parseOutput: false }); @@ -63,17 +73,18 @@ const awaitPools = { } await new Promise(resolve => setTimeout(resolve, POOL_DEBOUNCE)); - return await awaitPools.wipeIndexes(collectionId, iteration + 1); + return await awaitPools.wipeIndexes(databaseId, collectionId, iteration + 1); }, - expectAttributes: async (collectionId, attributeKeys, iteration = 1) => { + expectAttributes: async (databaseId, collectionId, attributeKeys, iteration = 1) => { if (iteration > POOL_MAX_DEBOUNCES) { return false; } // TODO: Pagination? - const { attributes: remoteAttributes } = await databaseListAttributes({ + const { attributes: remoteAttributes } = await databasesListAttributes({ + databaseId, collectionId, - limit: 100, + queries: [ 'limit(100)' ], parseOutput: false }); @@ -94,17 +105,18 @@ const awaitPools = { } await new Promise(resolve => setTimeout(resolve, POOL_DEBOUNCE)); - return await awaitPools.expectAttributes(collectionId, attributeKeys, iteration + 1); + return await awaitPools.expectAttributes(databaseId, collectionId, attributeKeys, iteration + 1); }, - expectIndexes: async (collectionId, indexKeys, iteration = 1) => { + expectIndexes: async (databaseId, collectionId, indexKeys, iteration = 1) => { if (iteration > POOL_MAX_DEBOUNCES) { return false; } // TODO: Pagination? - const { indexes: remoteIndexes } = await databaseListIndexes({ + const { indexes: remoteIndexes } = await databasesListIndexes({ + databaseId, collectionId, - limit: 100, + queries: [ 'limit(100)' ], parseOutput: false }); @@ -125,32 +137,49 @@ const awaitPools = { } await new Promise(resolve => setTimeout(resolve, POOL_DEBOUNCE)); - return await awaitPools.expectIndexes(collectionId, indexKeys, iteration + 1); + return await awaitPools.expectIndexes(databaseId, collectionId, indexKeys, iteration + 1); }, } const deploy = new Command("deploy") .description(commandDescriptions['deploy']) - .option("--all", "Flag to deploy collections and functions") - .action(actionRunner(async ({ all }, command) => { - if (all == undefined) { - command.help() - } - - try { - await deployFunction(); - } catch (e) { - error(e.message); - } - await deployCollection() + .action(actionRunner(async (_options, command) => { + command.help() })); -const deployFunction = async () => { +const deployFunction = async ({ functionId, all, yes } = {}) => { let response = {}; - let answers = await inquirer.prompt(questionsDeployFunctions) - let functions = answers.functions.map((func) => JSONbig.parse(func)) + const functionIds = []; + + if(functionId) { + functionIds.push(functionId); + } else if(all) { + const functions = localConfig.getFunctions(); + if (functions.length === 0) { + throw new Error("No functions found in the current directory."); + } + functionIds.push(...functions.map((func, idx) => { + return func.$id; + })); + } + + if(functionIds.length <= 0) { + const answers = await inquirer.prompt(questionsDeployFunctions[0]); + functionIds.push(...answers.functions); + } + + let functions = functionIds.map((id) => { + const functions = localConfig.getFunctions(); + const func = functions.find((f) => f.$id === id); + + if(!func) { + throw new Error("Function '" + id + "' not found.") + } + return func; + }); + for (let func of functions) { log(`Deploying function ${func.name} ( ${func['$id']} )`) @@ -164,6 +193,46 @@ const deployFunction = async () => { throw new Error(`Runtime missmatch! (local=${func.runtime},remote=${response.runtime}) Please delete remote function or update your appwrite.json`); } + if(func.variables) { + // Delete existing variables + + // TODO: Pagination? + const { variables: remoteVariables } = await functionsListVariables({ + functionId: func['$id'], + queries: [ 'limit(100)' ], + parseOutput: false + }); + + if(remoteVariables.length > 0) { + if(!yes) { + const variableAnswers = await inquirer.prompt(questionsDeployFunctions[1]) + + if (variableAnswers.override !== "YES") { + log(`Received "${variableAnswers.override}". Skipping ${func.name} ( ${func['$id']} )`); + continue; + } + } + + await Promise.all(remoteVariables.map(async remoteVariable => { + await functionsDeleteVariable({ + functionId: func['$id'], + variableId: remoteVariable['$id'], + parseOutput: false + }); + })); + } + + // Deploy local variables + await Promise.all(Object.keys(func.variables).map(async localVariableKey => { + await functionsCreateVariable({ + functionId: func['$id'], + key: localVariableKey, + value: func.variables[localVariableKey], + parseOutput: false + }); + })); + } + response = await functionsUpdate({ functionId: func['$id'], name: func.name, @@ -230,12 +299,13 @@ const deployFunction = async () => { } } -const createAttribute = async (collectionId, attribute) => { +const createAttribute = async (databaseId, collectionId, attribute) => { switch (attribute.type) { case 'string': switch (attribute.format) { case 'email': - return await databaseCreateEmailAttribute({ + return await databasesCreateEmailAttribute({ + databaseId, collectionId, key: attribute.key, required: attribute.required, @@ -244,7 +314,8 @@ const createAttribute = async (collectionId, attribute) => { parseOutput: false }) case 'url': - return await databaseCreateUrlAttribute({ + return await databasesCreateUrlAttribute({ + databaseId, collectionId, key: attribute.key, required: attribute.required, @@ -253,7 +324,8 @@ const createAttribute = async (collectionId, attribute) => { parseOutput: false }) case 'ip': - return await databaseCreateIpAttribute({ + return await databasesCreateIpAttribute({ + databaseId, collectionId, key: attribute.key, required: attribute.required, @@ -262,7 +334,8 @@ const createAttribute = async (collectionId, attribute) => { parseOutput: false }) case 'enum': - return await databaseCreateEnumAttribute({ + return await databasesCreateEnumAttribute({ + databaseId, collectionId, key: attribute.key, elements: attribute.elements, @@ -272,7 +345,8 @@ const createAttribute = async (collectionId, attribute) => { parseOutput: false }) default: - return await databaseCreateStringAttribute({ + return await databasesCreateStringAttribute({ + databaseId, collectionId, key: attribute.key, size: attribute.size, @@ -284,7 +358,8 @@ const createAttribute = async (collectionId, attribute) => { } case 'integer': - return await databaseCreateIntegerAttribute({ + return await databasesCreateIntegerAttribute({ + databaseId, collectionId, key: attribute.key, required: attribute.required, @@ -295,7 +370,8 @@ const createAttribute = async (collectionId, attribute) => { parseOutput: false }) case 'double': - return databaseCreateFloatAttribute({ + return databasesCreateFloatAttribute({ + databaseId, collectionId, key: attribute.key, required: attribute.required, @@ -306,7 +382,18 @@ const createAttribute = async (collectionId, attribute) => { parseOutput: false }) case 'boolean': - return databaseCreateBooleanAttribute({ + return databasesCreateBooleanAttribute({ + databaseId, + collectionId, + key: attribute.key, + required: attribute.required, + xdefault: attribute.default, + array: attribute.array, + parseOutput: false + }) + case 'datetime': + return databasesCreateDatetimeAttribute({ + databaseId, collectionId, key: attribute.key, required: attribute.required, @@ -317,74 +404,120 @@ const createAttribute = async (collectionId, attribute) => { } } -const deployCollection = async () => { +const deployCollection = async ({ all, yes } = {}) => { let response = {}; - let answers = await inquirer.prompt(questionsDeployCollections[0]) - let collections = answers.collections.map((collection) => JSONbig.parse(collection)); + + let collectionIds = []; + const configCollections = localConfig.getCollections(); + + if(all) { + if (configCollections.length === 0) { + throw new Error("No collections found in the current directory. Run `{{ language.params.executableName }} init collection` to fetch all your collections."); + } + collectionIds.push(...configCollections.map((c) => c.$id)); + } + + if(collectionIds.length <= 0) { + let answers = await inquirer.prompt(questionsDeployCollections[0]) + collectionIds.push(...answers.collections); + } + + let collections = []; + + for(const collectionId of collectionIds) { + const idCollections = configCollections.filter((c) => c.$id === collectionId); + collections.push(...idCollections); + } for (let collection of collections) { log(`Deploying collection ${collection.name} ( ${collection['$id']} )`) + + let databaseId; + + try { + const database = await databasesGet({ + databaseId: collection.databaseId, + parseOutput: false, + }); + databaseId = database.$id; + } catch(err) { + log(`Database ${collection.databaseId} not found. Creating it now...`); + const database = await databasesCreate({ + databaseId: collection.databaseId, + name: collection.databaseId, + parseOutput: false, + }); + databaseId = database.$id; + } + try { - response = await databaseGetCollection({ + response = await databasesGetCollection({ + databaseId, collectionId: collection['$id'], parseOutput: false, }) log(`Collection ${collection.name} ( ${collection['$id']} ) already exists.`); - answers = await inquirer.prompt(questionsDeployCollections[1]) - if (answers.override !== "YES") { - log(`Received "${answers.override}". Skipping ${collection.name} ( ${collection['$id']} )`); - continue; + if(!yes) { + answers = await inquirer.prompt(questionsDeployCollections[1]) + if (answers.override !== "YES") { + log(`Received "${answers.override}". Skipping ${collection.name} ( ${collection['$id']} )`); + continue; + } } log(`Updating attributes ... `); // TODO: Pagination? - const { indexes: remoteIndexes } = await databaseListIndexes({ + const { indexes: remoteIndexes } = await databasesListIndexes({ + databaseId, collectionId: collection['$id'], - limit: 100, + queries: [ 'limit(100)' ], parseOutput: false }); await Promise.all(remoteIndexes.map(async index => { - await databaseDeleteIndex({ + await databasesDeleteIndex({ + databaseId, collectionId: collection['$id'], key: index.key, parseOutput: false }); })); - const deleteIndexesPoolStatus = await awaitPools.wipeIndexes(collection['$id']); + const deleteIndexesPoolStatus = await awaitPools.wipeIndexes(databaseId, collection['$id']); if (!deleteIndexesPoolStatus) { throw new Error("Index deletion did not finish for too long."); } // TODO: Pagination? - const { attributes: remoteAttributes } = await databaseListAttributes({ + const { attributes: remoteAttributes } = await databasesListAttributes({ + databaseId, collectionId: collection['$id'], - limit: 100, + queries: [ 'limit(100)' ], parseOutput: false }); await Promise.all(remoteAttributes.map(async attribute => { - await databaseDeleteAttribute({ + await databasesDeleteAttribute({ + databaseId, collectionId: collection['$id'], key: attribute.key, parseOutput: false }); })); - const deleteAttributesPoolStatus = await awaitPools.wipeAttributes(collection['$id']); + const deleteAttributesPoolStatus = await awaitPools.wipeAttributes(databaseId, collection['$id']); if (!deleteAttributesPoolStatus) { throw new Error("Attribute deletion did not finish for too long."); } await Promise.all(collection.attributes.map(async attribute => { - await createAttribute(collection['$id'], attribute); + await createAttribute(databaseId, collection['$id'], attribute); })); const attributeKeys = collection.attributes.map(attribute => attribute.key); - const createPoolStatus = await awaitPools.expectAttributes(collection['$id'], attributeKeys); + const createPoolStatus = await awaitPools.expectAttributes(databaseId, collection['$id'], attributeKeys); if (!createPoolStatus) { throw new Error("Attribute creation did not finish for too long."); } @@ -393,7 +526,8 @@ const deployCollection = async () => { log(`Creating indexes ...`) await Promise.all(collection.indexes.map(async index => { - await databaseCreateIndex({ + await databasesCreateIndex({ + databaseId, collectionId: collection['$id'], key: index.key, type: index.type, @@ -404,7 +538,7 @@ const deployCollection = async () => { })); const indexKeys = collection.indexes.map(attribute => attribute.key); - const indexPoolStatus = await awaitPools.expectIndexes(collection['$id'], indexKeys); + const indexPoolStatus = await awaitPools.expectIndexes(databaseId, collection['$id'], indexKeys); if (!indexPoolStatus) { throw new Error("Index creation did not finish for too long."); } @@ -413,22 +547,22 @@ const deployCollection = async () => { } catch (e) { if (e.code == 404) { log(`Collection ${collection.name} does not exist in the project. Creating ... `); - response = await databaseCreateCollection({ + response = await databasesCreateCollection({ + databaseId, collectionId: collection['$id'], name: collection.name, - permission: collection.permission, - read: collection['$read'], - write: collection['$write'], + documentSecurity: collection.documentSecurity, + permissions: collection['$permissions'], parseOutput: false }) log(`Creating attributes ... `); await Promise.all(collection.attributes.map(async attribute => { - await createAttribute(collection['$id'], attribute); + await createAttribute(databaseId, collection['$id'], attribute); })); const attributeKeys = collection.attributes.map(attribute => attribute.key); - const attributePoolStatus = await awaitPools.expectAttributes(collection['$id'], attributeKeys); + const attributePoolStatus = await awaitPools.expectAttributes(databaseId, collection['$id'], attributeKeys); if (!attributePoolStatus) { throw new Error("Attribute creation did not finish for too long."); } @@ -437,7 +571,8 @@ const deployCollection = async () => { log(`Creating indexes ...`); await Promise.all(collection.indexes.map(async index => { - await databaseCreateIndex({ + await databasesCreateIndex({ + databaseId, collectionId: collection['$id'], key: index.key, type: index.type, @@ -448,7 +583,7 @@ const deployCollection = async () => { })); const indexKeys = collection.indexes.map(attribute => attribute.key); - const indexPoolStatus = await awaitPools.expectIndexes(collection['$id'], indexKeys); + const indexPoolStatus = await awaitPools.expectIndexes(databaseId, collection['$id'], indexKeys); if (!indexPoolStatus) { throw new Error("Index creation did not finish for too long."); } @@ -463,16 +598,98 @@ const deployCollection = async () => { } } +const deployTeam = async ({ all, yes } = {}) => { + let response = {}; + + let teamIds = []; + const configTeams = localConfig.getTeams(); + + if(all) { + if (configTeams.length === 0) { + throw new Error("No teams found in the current directory. Run `appwrite init team` to fetch all your teams."); + } + teamIds.push(...configTeams.map((t) => t.$id)); + } + + if(teamIds.length === 0) { + let answers = await inquirer.prompt(questionsDeployTeams[0]) + teamIds.push(...answers.teams); + } + + let teams = []; + + for(const teamId of teamIds) { + const idTeams = configTeams.filter((t) => t.$id === teamId); + teams.push(...idTeams); + } + + for (let team of teams) { + log(`Deploying team ${team.name} ( ${team['$id']} )`) + + try { + response = await teamsGet({ + teamId: team['$id'], + parseOutput: false, + }) + log(`Team ${team.name} ( ${team['$id']} ) already exists.`); + + if(!yes) { + answers = await inquirer.prompt(questionsDeployTeams[1]) + if (answers.override !== "YES") { + log(`Received "${answers.override}". Skipping ${team.name} ( ${team['$id']} )`); + continue; + } + } + + log(`Updating team ...`) + + await teamsUpdate({ + teamId: team['$id'], + name: team.name, + parseOutput: false + }); + + success(`Deployed ${team.name} ( ${team['$id']} )`); + } catch (e) { + if (e.code == 404) { + log(`Team ${team.name} does not exist in the project. Creating ... `); + + response = await teamsCreate({ + teamId: team['$id'], + name: team.name, + parseOutput: false + }) + + success(`Deployed ${team.name} ( ${team['$id']} )`); + } else { + throw e; + } + } + } +} + deploy .command("function") .description("Deploy functions in the current directory.") + .option(`--functionId `, `Function ID`) + .option(`--all`, `Flag to deploy all functions`) + .option(`--yes`, `Flag to confirm all warnings`) .action(actionRunner(deployFunction)); deploy .command("collection") .description("Deploy collections in the current project.") + .option(`--all`, `Flag to deploy all functions`) + .option(`--yes`, `Flag to confirm all warnings`) .action(actionRunner(deployCollection)); +deploy + .command("team") + .description("Deploy teams in the current project.") + .option(`--all`, `Flag to deploy all teams`) + .option(`--yes`, `Flag to confirm all warnings`) + .action(actionRunner(deployTeam)); + module.exports = { deploy } \ No newline at end of file diff --git a/templates/cli/lib/commands/generic.js.twig b/templates/cli/lib/commands/generic.js.twig index 581848f746..1b99644afb 100644 --- a/templates/cli/lib/commands/generic.js.twig +++ b/templates/cli/lib/commands/generic.js.twig @@ -6,7 +6,7 @@ const { globalConfig, localConfig } = require("../config"); const { actionRunner, success, parseBool, commandDescriptions, log, parse } = require("../parser"); {% if sdk.test != "true" %} const { questionsLogin } = require("../questions"); -const { accountCreateSession, accountDeleteSession } = require("./account"); +const { accountCreateEmailSession, accountDeleteSession } = require("./account"); const login = new Command("login") .description(commandDescriptions['login']) @@ -15,7 +15,7 @@ const login = new Command("login") let client = await sdkForConsole(false); - await accountCreateSession({ + await accountCreateEmailSession({ email: answers.email, password: answers.password, parseOutput: false, @@ -44,9 +44,9 @@ const logout = new Command("logout") const client = new Command("client") .description(commandDescriptions['client']) .option("--selfSigned ", "Configure the CLI to use a self-signed certificate ( true or false )", parseBool) - .option("--endpoint ", "Set your Apwrite server endpoint") - .option("--projectId ", "Set your Apwrite project ID") - .option("--key ", "Set your Apwrite server's API key") + .option("--endpoint ", "Set your Appwrite server endpoint") + .option("--projectId ", "Set your Appwrite project ID") + .option("--key ", "Set your Appwrite server's API key") .option("--debug", "Print CLI debug information") .option("--reset", "Reset the CLI configuration") .action(actionRunner(async ({ selfSigned, endpoint, projectId, key, debug, reset }, command) => { diff --git a/templates/cli/lib/commands/init.js.twig b/templates/cli/lib/commands/init.js.twig index c7ea84ba9a..4a790df2e3 100644 --- a/templates/cli/lib/commands/init.js.twig +++ b/templates/cli/lib/commands/init.js.twig @@ -3,25 +3,19 @@ const path = require("path"); const childProcess = require('child_process'); const { Command } = require("commander"); const inquirer = require("inquirer"); -const { teamsCreate } = require("./teams"); +const { teamsCreate, teamsList } = require("./teams"); const { projectsCreate } = require("./projects"); const { functionsCreate } = require("./functions"); -const { databaseListCollections } = require("./database"); +const { databasesListCollections, databasesList } = require("./databases"); const { sdkForConsole } = require("../sdks"); const { localConfig } = require("../config"); -const { questionsInitProject, questionsInitFunction } = require("../questions"); +const { questionsInitProject, questionsInitFunction, questionsInitCollection } = require("../questions"); const { success, log, actionRunner, commandDescriptions } = require("../parser"); const init = new Command("init") .description(commandDescriptions['init']) - .option("--all", "Flag to initialize projects and collection") - .action(actionRunner(async ({ all }, command) => { - if (all == undefined) { - command.help() - } - - await initProject(); - await initCollection() + .action(actionRunner(async (_options, command) => { + command.help(); })); const initProject = async () => { @@ -40,7 +34,7 @@ const initProject = async () => { let teamId = response['$id']; response = await projectsCreate({ - projectId: 'unique()', + projectId: answers.id, name: answers.project, teamId, parseOutput: false @@ -54,9 +48,19 @@ const initProject = async () => { } const initFunction = async () => { + // TODO: Add CI/CD support (ID, name, runtime) let answers = await inquirer.prompt(questionsInitFunction) + let functionFolder = path.join(process.cwd(), 'functions'); + + if (!fs.existsSync(functionFolder)) { + fs.mkdirSync(functionFolder, { + recursive: true + }); + } + + const functionDir = path.join(functionFolder, answers.name); - if (fs.existsSync(path.join(process.cwd(), 'functions', answers.name))) { + if (fs.existsSync(functionDir)) { throw new Error(`( ${answers.name} ) already exists in the current directory. Please choose another name.`); } @@ -65,26 +69,59 @@ const initFunction = async () => { } let response = await functionsCreate({ - functionId: 'unique()', + functionId: answers.id, name: answers.name, runtime: answers.runtime.id, parseOutput: false }) - let command = ` - mkdir -m 777 -p 'functions/${answers.name}' && \ - cd 'functions/${answers.name}' && \ - git init && \ - git remote add -f origin https://github.com/{{ sdk.gitUserName }}/functions-starter && \ - git config core.sparseCheckout true && \ - echo '${answers.runtime.id}' >> .git/info/sparse-checkout && \ - git pull origin main && \ - rm -rf .git && \ - mv ${answers.runtime.id}/* . && \ - rm -rf ${answers.runtime.id}`; - - // Execute the child process but do not print any std output - childProcess.execSync(command, { stdio: 'pipe' }); + fs.mkdirSync(functionDir, "777"); + + let gitInitCommands = "git clone --depth 1 --sparse https://github.com/{{ sdk.gitUserName }}/functions-starter ."; // depth prevents fetching older commits reducing the amount fetched + + let gitPullCommands = `git sparse-checkout add ${answers.runtime.id}`; + + /* Force use CMD as powershell does not support && */ + if (process.platform == 'win32') { + gitInitCommands = 'cmd /c "' + gitInitCommands + '"'; + gitPullCommands = 'cmd /c "' + gitPullCommands + '"'; + } + + /* Execute the child process but do not print any std output */ + try { + childProcess.execSync(gitInitCommands, { stdio: 'pipe', cwd: functionDir }); + childProcess.execSync(gitPullCommands, { stdio: 'pipe', cwd: functionDir }); + } catch (error) { + /* Specialised errors with recommended actions to take */ + if (error.message.includes('error: unknown option')) { + throw new Error(`${error.message} \n\nSuggestion: Try updating your git to the latest version, then trying to run this command again.`) + } else if (error.message.includes('is not recognized as an internal or external command,') || error.message.includes('command not found')) { + throw new Error(`${error.message} \n\nSuggestion: It appears that git is not installed, try installing git then trying to run this command again.`) + } else { + throw error; + } + } + + fs.rmSync(path.join(functionDir, ".git"), { recursive: true }); + const copyRecursiveSync = (src, dest) => { + let exists = fs.existsSync(src); + let stats = exists && fs.statSync(src); + let isDirectory = exists && stats.isDirectory(); + if (isDirectory) { + if (!fs.existsSync(dest)) { + fs.mkdirSync(dest); + } + + fs.readdirSync(src).forEach(function(childItemName) { + copyRecursiveSync(path.join(src, childItemName), path.join(dest, childItemName)); + }); + } else { + fs.copyFileSync(src, dest); + } + }; + copyRecursiveSync(path.join(functionDir, answers.runtime.id), functionDir); + + fs.rmSync(`${functionDir}/${answers.runtime.id}`, { recursive: true, force: true }); const readmePath = path.join(process.cwd(), 'functions', answers.name, 'README.md'); const readmeFile = fs.readFileSync(readmePath).toString(); @@ -110,19 +147,58 @@ const initFunction = async () => { success(); } -const initCollection = async () => { +const initCollection = async ({ all, databaseId } = {}) => { + const databaseIds = []; + + if(databaseId) { + databaseIds.push(databaseId); + } else if(all) { + let allDatabases = await databasesList({ + parseOutput: false + }) + + databaseIds.push(...allDatabases.databases.map((d) => d.$id)); + } + + if(databaseIds.length <= 0) { + let answers = await inquirer.prompt(questionsInitCollection) + if (!answers.databases) process.exit(1) + databaseIds.push(...answers.databases); + } + + for(const databaseId of databaseIds) { + // TODO: Pagination? + let response = await databasesListCollections({ + databaseId, + queries: [ 'limit(100)' ], + parseOutput: false + }) + + let collections = response.collections; + log(`Found ${collections.length} collections`); + + collections.forEach(async collection => { + log(`Fetching ${collection.name} ...`); + localConfig.addCollection(collection); + }); + } + + success(); +} + +const initTeam = async () => { // TODO: Pagination? - let response = await databaseListCollections({ - limit: 100, + let response = await teamsList({ + queries: [ 'limit(100)' ], parseOutput: false }) - let collections = response.collections; - log(`Found ${collections.length} collections`); + let teams = response.teams; + log(`Found ${teams.length} teams`); - collections.forEach(async collection => { - log(`Fetching ${collection.name} ...`); - localConfig.addCollection(collection); + teams.forEach(async team => { + log(`Fetching ${team.name} ...`); + localConfig.addTeam(team); }); success(); @@ -141,8 +217,15 @@ init init .command("collection") .description("Initialise your {{ spec.title|caseUcfirst }} collections") + .option(`--databaseId `, `Database ID`) + .option(`--all`, `Flag to initialize all databases`) .action(actionRunner(initCollection)) +init + .command("team") + .description("Initialise your Appwrite teams") + .action(actionRunner(initTeam)) + module.exports = { init, }; diff --git a/templates/cli/lib/config.js.twig b/templates/cli/lib/config.js.twig index 1511997f9d..da4428def9 100644 --- a/templates/cli/lib/config.js.twig +++ b/templates/cli/lib/config.js.twig @@ -166,6 +166,45 @@ class Local extends Config { this.set("collections", collections); } + getTeams() { + if (!this.has("teams")) { + return []; + } + return this.get("teams"); + } + + getTeam($id) { + if (!this.has("teams")) { + return {}; + } + + let teams = this.get("teams"); + for (let i = 0; i < teams.length; i++) { + if (teams[i]['$id'] == $id) { + return teams[i]; + } + } + + return {}; + } + + addTeam(props) { + if (!this.has("teams")) { + this.set("teams", []); + } + + let teams = this.get("teams"); + for (let i = 0; i < teams.length; i++) { + if (teams[i]['$id'] == props['$id']) { + teams[i] = props; + this.set("teams", teams); + return; + } + } + teams.push(props); + this.set("teams", teams); + } + getProject() { if (!this.has("projectId") || !this.has("projectName")) { return {}; diff --git a/templates/cli/lib/parser.js.twig b/templates/cli/lib/parser.js.twig index ced68e50d9..a96b8f707c 100644 --- a/templates/cli/lib/parser.js.twig +++ b/templates/cli/lib/parser.js.twig @@ -150,7 +150,7 @@ const logo = {{ language.params.logo | raw }}; const commandDescriptions = { "account": `The account command allows you to authenticate and manage a user account.`, "avatars": `The avatars command aims to help you complete everyday tasks related to your app image, icons, and avatars.`, - "database": `The database command allows you to create structured collections of documents, query and filter lists of documents.`, + "databases": `The databases command allows you to create structured collections of documents, query and filter lists of documents.`, "deploy": `The deploy command provides a convenient wrapper for deploying your functions and collections.`, "functions": `The functions command allows you view, create and manage your Cloud Functions.`, "health": `The health command allows you to both validate and monitor your {{ spec.title|caseUcfirst }} server's health.`, diff --git a/templates/cli/lib/questions.js.twig b/templates/cli/lib/questions.js.twig index bdab4fa05c..4bbe41884b 100644 --- a/templates/cli/lib/questions.js.twig +++ b/templates/cli/lib/questions.js.twig @@ -1,6 +1,7 @@ const { localConfig } = require('./config'); const { projectsList } = require('./commands/projects'); const { functionsListRuntimes } = require('./commands/functions'); +const { databasesList } = require('./commands/databases'); const JSONbig = require("json-bigint")({ storeAsString: false }); const getIgnores = (runtime) => { @@ -108,6 +109,15 @@ const questionsInitProject = [ return answers.start == "new"; }, }, + { + type: "input", + name: "id", + message: "What ID would you like to have for your project?", + default: "unique()", + when(answers) { + return answers.start == "new"; + }, + }, { type: "list", name: "project", @@ -146,6 +156,12 @@ const questionsInitFunction = [ message: "What would you like to name your function?", default: "My Awesome Function" }, + { + type: "input", + name: "id", + message: "What ID would you like to have for your function?", + default: "unique()" + }, { type: "list", name: "runtime", @@ -166,6 +182,31 @@ const questionsInitFunction = [ } ]; +const questionsInitCollection = [ + { + type: "checkbox", + name: "databases", + message: "From which database would you like to init collections?", + choices: async () => { + let response = await databasesList({ + parseOutput: false + }) + let databases = response["databases"] + + if(databases.length <= 0) { + throw new Error("No databases found. Please create one in project console.") + } + let choices = databases.map((database, idx) => { + return { + name: `${database.name} (${database.$id})`, + value: database.$id + } + }) + return choices; + } + } +]; + const questionsLogin = [ { type: "input", @@ -204,13 +245,18 @@ const questionsDeployFunctions = [ } let choices = functions.map((func, idx) => { return { - name: `${func.name} (${func['$id']})`, - value: JSONbig.stringify(func) + name: `${func.name} (${func.$id})`, + value: func.$id } }) return choices; } - } + }, + { + type: "input", + name: "override", + message: 'Are you sure you want to override this function\'s variables? This can lead to loss of secrets! Type "YES" to confirm.' + }, ] const questionsDeployCollections = [ @@ -226,7 +272,7 @@ const questionsDeployCollections = [ let choices = collections.map((collection, idx) => { return { name: `${collection.name} (${collection['$id']})`, - value: JSONbig.stringify(collection) + value: collection.$id } }) return choices; @@ -254,11 +300,39 @@ const questionsGetEntrypoint = [ }, ] +const questionsDeployTeams = [ + { + type: "checkbox", + name: "teams", + message: "Which teams would you like to deploy?", + choices: () => { + let teams = localConfig.getTeams(); + if (teams.length === 0) { + throw new Error("No teams found in the current directory. Run `appwrite init team` to fetch all your teams."); + } + let choices = teams.map((team, idx) => { + return { + name: `${team.name} (${team['$id']})`, + value: team.$id + } + }) + return choices; + } + }, + { + type: "input", + name: "override", + message: 'Are you sure you want to override this team? This can lead to loss of data! Type "YES" to confirm.' + }, +] + module.exports = { questionsInitProject, questionsLogin, questionsInitFunction, + questionsInitCollection, questionsDeployFunctions, questionsDeployCollections, + questionsDeployTeams, questionsGetEntrypoint }; diff --git a/templates/dart/LICENSE.twig b/templates/dart/LICENSE.twig index 0e8c361b49..854eb19494 100644 --- a/templates/dart/LICENSE.twig +++ b/templates/dart/LICENSE.twig @@ -1 +1 @@ -{{sdk.licenseContent}} \ No newline at end of file +{{sdk.licenseContent | raw}} \ No newline at end of file diff --git a/templates/dart/base/requests/api.twig b/templates/dart/base/requests/api.twig new file mode 100644 index 0000000000..950658e818 --- /dev/null +++ b/templates/dart/base/requests/api.twig @@ -0,0 +1,13 @@ +{% import 'dart/base/utils.twig' as utils %} + final Map params = { + {{ utils.map_parameter(method.parameters.query) }} + {{ utils.map_parameter(method.parameters.body) }} + }; + + final Map headers = { + {{ utils.map_headers(method.headers) }} + }; + + final res = await client.call(HttpMethod.{{ method.method | caseLower }}, path: path, params: params, headers: headers); + + return {% if method.responseModel and method.responseModel != 'any' %}models.{{method.responseModel | caseUcfirst | overrideIdentifier}}.fromMap(res.data){% else %} res.data{% endif %}; diff --git a/templates/dart/base/requests/file.twig b/templates/dart/base/requests/file.twig new file mode 100644 index 0000000000..97d3bcf1a3 --- /dev/null +++ b/templates/dart/base/requests/file.twig @@ -0,0 +1,31 @@ +{% import 'dart/base/utils.twig' as utils %} + final Map params = { + {{ utils.map_parameter(method.parameters.query) }} + {{ utils.map_parameter(method.parameters.body) }} + }; + + final Map headers = { + {{ utils.map_headers(method.headers) }} + }; + +{% if 'multipart/form-data' in method.consumes %} + String idParamName = ''; +{% for parameter in method.parameters.all %} +{% if parameter.type == 'file' %} + final paramName = '{{ parameter.name }}'; +{% endif %} +{% if parameter.isUploadID %} + idParamName = '{{ parameter.name }}'; +{% endif %} +{% endfor %} + final res = await client.chunkedUpload( + path: path, + params: params, + paramName: paramName, + idParamName: idParamName, + headers: headers, + onProgress: onProgress, + ); + + return {% if method.responseModel and method.responseModel != 'any' %}models.{{method.responseModel | caseUcfirst | overrideIdentifier}}.fromMap(res.data){% else %} res.data{% endif %}; +{% endif %} diff --git a/templates/dart/base/requests/location.twig b/templates/dart/base/requests/location.twig new file mode 100644 index 0000000000..ab3e3dc4a1 --- /dev/null +++ b/templates/dart/base/requests/location.twig @@ -0,0 +1,14 @@ +{% import 'dart/base/utils.twig' as utils %} + final Map params = { + {{ utils.map_parameter(method.parameters.query) }} + {{ utils.map_parameter(method.parameters.body) }} +{% if method.auth|length > 0 %}{% for node in method.auth %} +{% for key,header in node|keys %} + '{{header|caseLower}}': client.config['{{header|caseLower}}'], +{% endfor %} +{% endfor %} +{% endif %} + }; + + final res = await client.call(HttpMethod.{{ method.method | caseLower }}, path: path, params: params, responseType: ResponseType.bytes); + return res.data; \ No newline at end of file diff --git a/templates/dart/base/requests/oauth.twig b/templates/dart/base/requests/oauth.twig new file mode 100644 index 0000000000..237079f364 --- /dev/null +++ b/templates/dart/base/requests/oauth.twig @@ -0,0 +1,34 @@ +{% import 'dart/base/utils.twig' as utils %} + final Map params = { + {{ utils.map_parameter(method.parameters.query) }} + {{ utils.map_parameter(method.parameters.body) }} +{% if method.auth|length > 0 %} +{% for node in method.auth %} +{% for key,header in node|keys %} + '{{header|caseLower}}': client.config['{{header|caseLower}}'], +{% endfor %} +{% endfor %} +{% endif %} + }; + + final List query = []; + + params.forEach((key, value) { + if (value is List) { + for (var item in value) { + query.add(Uri.encodeComponent(key + '[]') + '=' + Uri.encodeComponent(item)); + } + } else if(value != null) { + query.add(Uri.encodeComponent(key) + '=' + Uri.encodeComponent(value)); + } + }); + + Uri endpoint = Uri.parse(client.endPoint); + Uri url = Uri(scheme: endpoint.scheme, + host: endpoint.host, + port: endpoint.port, + path: endpoint.path + path, + query: query.join('&') + ); + + return client.webAuth(url); \ No newline at end of file diff --git a/templates/dart/base/utils.twig b/templates/dart/base/utils.twig new file mode 100644 index 0000000000..8d58c497f6 --- /dev/null +++ b/templates/dart/base/utils.twig @@ -0,0 +1,11 @@ +{% macro map_parameter(parameters) %} +{% for parameter in parameters %} +'{{ parameter.name }}': {{ parameter.name | caseCamel | overrideIdentifier }}, +{% endfor %} +{% endmacro %} + +{% macro map_headers(headers) %} +{% for key, header in headers %} +'{{ key }}': '{{ header }}', +{% endfor %} +{% endmacro %} diff --git a/templates/dart/docs/example.md.twig b/templates/dart/docs/example.md.twig index 05717ef9ae..0a0e59863f 100644 --- a/templates/dart/docs/example.md.twig +++ b/templates/dart/docs/example.md.twig @@ -5,12 +5,12 @@ import 'package:{{ language.params.packageName }}/{{ language.params.packageName void main() { // Init SDK Client client = Client(); - {{ service.name | caseUcfirst }} {{ service.name | caseCamel }} = {{service.name | caseUcfirst}}(client); + {{ service.name | caseUcfirst }} {{ service.name | caseCamel }} = {{service.name | caseUcfirst}}(client{% if service.globalParams | length %}{% for parameter in service.globalParams %}, {{ parameter.name | caseCamel | overrideIdentifier }}: {{ parameter | paramExample }}{% endfor %}{% endif %}); -{% if method.security|length > 0 %} +{% if method.auth|length > 0 %} client .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint -{% for node in method.security %} +{% for node in method.auth %} {% for key,header in node|keys %} .set{{header}}('{{node[header]['x-appwrite']['demo']}}') // {{node[header].description}} {% endfor %} @@ -22,9 +22,9 @@ void main() { // Init SDK {% endif %} {% if parameter.required %} - {{ parameter.name | caseCamel }}: {{ parameter | paramExample | replace({'': (parameter.name | caseCamel) }) | raw }}, + {{ parameter.name | caseCamel | overrideIdentifier }}: {{ parameter | paramExample | replace({'': (parameter.name | caseCamel) }) | raw }}, {% endif %} -{% endfor %}{% if method.parameters.all|length > 0 %} {% endif %}); +{% endfor %}{% if method.parameters.all | length > 0 %} {% endif %}); result .then((response) { diff --git a/templates/dart/lib/id.dart.twig b/templates/dart/lib/id.dart.twig new file mode 100644 index 0000000000..30360f557a --- /dev/null +++ b/templates/dart/lib/id.dart.twig @@ -0,0 +1,13 @@ +part of {{ language.params.packageName }}; + +class ID { + ID._(); + + static String unique() { + return 'unique()'; + } + + static String custom(String id) { + return id; + } +} \ No newline at end of file diff --git a/templates/dart/lib/models.dart.twig b/templates/dart/lib/models.dart.twig index b617be3e0f..da68b7f326 100644 --- a/templates/dart/lib/models.dart.twig +++ b/templates/dart/lib/models.dart.twig @@ -1,5 +1,6 @@ library {{ language.params.packageName }}.models; +part 'src/models/model.dart'; {% for definition in spec.definitions %} part 'src/models/{{definition.name | caseSnake}}.dart'; {% endfor %} \ No newline at end of file diff --git a/templates/dart/lib/package.dart.twig b/templates/dart/lib/package.dart.twig index df3ed39081..ea7931d7dc 100644 --- a/templates/dart/lib/package.dart.twig +++ b/templates/dart/lib/package.dart.twig @@ -2,8 +2,6 @@ library {{ language.params.packageName }}; import 'dart:async'; import 'dart:typed_data'; -import 'src/chunked_upload_stub.dart' - if (dart.library.io) 'src/chunked_upload_io.dart'; import 'src/enums.dart'; import 'src/client.dart'; import 'src/service.dart'; @@ -16,9 +14,11 @@ export 'src/client.dart'; export 'src/exception.dart'; export 'src/input_file.dart'; export 'src/upload_progress.dart'; -export 'package:http/http.dart' show MultipartFile; part 'query.dart'; +part 'permission.dart'; +part 'role.dart'; +part 'id.dart'; {% for service in spec.services %} part 'services/{{service.name | caseDash}}.dart'; {% endfor %} diff --git a/templates/dart/lib/permission.dart.twig b/templates/dart/lib/permission.dart.twig new file mode 100644 index 0000000000..618f25bb09 --- /dev/null +++ b/templates/dart/lib/permission.dart.twig @@ -0,0 +1,21 @@ +part of {{ language.params.packageName }}; + +class Permission { + Permission._(); + + static String read(String role) { + return 'read("$role")'; + } + static String write(String role) { + return 'write("$role")'; + } + static String create(String role) { + return 'create("$role")'; + } + static String update(String role) { + return 'update("$role")'; + } + static String delete(String role) { + return 'delete("$role")'; + } +} diff --git a/templates/dart/lib/query.dart.twig b/templates/dart/lib/query.dart.twig index d1b95e2cdf..70b6141de3 100644 --- a/templates/dart/lib/query.dart.twig +++ b/templates/dart/lib/query.dart.twig @@ -1,31 +1,45 @@ part of {{ language.params.packageName }}; class Query { + Query._(); + static equal(String attribute, dynamic value) => _addQuery(attribute, 'equal', value); static notEqual(String attribute, dynamic value) => _addQuery(attribute, 'notEqual', value); - static lesser(String attribute, dynamic value) => - _addQuery(attribute, 'lesser', value); + static lessThan(String attribute, dynamic value) => + _addQuery(attribute, 'lessThan', value); - static lesserEqual(String attribute, dynamic value) => - _addQuery(attribute, 'lesserEqual', value); + static lessThanEqual(String attribute, dynamic value) => + _addQuery(attribute, 'lessThanEqual', value); - static greater(String attribute, dynamic value) => - _addQuery(attribute, 'greater', value); + static greaterThan(String attribute, dynamic value) => + _addQuery(attribute, 'greaterThan', value); - static greaterEqual(String attribute, dynamic value) => - _addQuery(attribute, 'greaterEqual', value); + static greaterThanEqual(String attribute, dynamic value) => + _addQuery(attribute, 'greaterThanEqual', value); static search(String attribute, String value) => _addQuery(attribute, 'search', value); - static String _addQuery(String attribute, String oper, dynamic value) => (value + static String orderAsc(String attribute) => 'orderAsc("$attribute")'; + + static String orderDesc(String attribute) => 'orderDesc("$attribute")'; + + static String cursorBefore(String id) => 'cursorBefore("$id")'; + + static String cursorAfter(String id) => 'cursorAfter("$id")'; + + static String limit(int limit) => 'limit($limit)'; + + static String offset(int offset) => 'offset($offset)'; + + static String _addQuery(String attribute, String method, dynamic value) => (value is List) - ? '$attribute.$oper(${value.map((item) => parseValues(item)).join(",")})' - : '$attribute.$oper(${parseValues(value)})'; + ? '$method("$attribute", [${value.map((item) => parseValues(item)).join(",")}])' + : '$method("$attribute", [${parseValues(value)}])'; static String parseValues(dynamic value) => (value is String) ? '"$value"' : '$value'; diff --git a/templates/dart/lib/role.dart.twig b/templates/dart/lib/role.dart.twig new file mode 100644 index 0000000000..9b4461c85c --- /dev/null +++ b/templates/dart/lib/role.dart.twig @@ -0,0 +1,38 @@ +part of {{ language.params.packageName }}; + +class Role { + Role._(); + + static String any() { + return 'any'; + } + + static String user(String id, [String status = '']) { + if(status.isEmpty) { + return 'user:$id'; + } + return 'user:$id/$status'; + } + + static String users([String status = '']) { + if(status.isEmpty) { + return 'users'; + } + return 'users/$status'; + } + + static String guests() { + return 'guests'; + } + + static String team(String id, [String role = '']) { + if(role.isEmpty) { + return 'team:$id'; + } + return 'team:$id/$role'; + } + + static String member(String id) { + return 'member:$id'; + } +} \ No newline at end of file diff --git a/templates/dart/lib/services/service.dart.twig b/templates/dart/lib/services/service.dart.twig index 1a5390b2af..7853a059e9 100644 --- a/templates/dart/lib/services/service.dart.twig +++ b/templates/dart/lib/services/service.dart.twig @@ -1,90 +1,36 @@ part of {{ language.params.packageName }}; -{% macro parameter(parameter) %} -{% if parameter.required %}required {{ parameter.type | typeName }}{% else %}{{ parameter.type | typeName }}?{% endif %} {{ parameter.name | caseCamel | escapeKeyword }}{% endmacro %} +{% macro parameter(parameter) %}{% if parameter.required %}required {{ parameter | typeName }}{% else %}{{ parameter | typeName }}?{% endif %} {{ parameter.name | caseCamel | overrideIdentifier }}{% endmacro %} {% macro method_parameters(parameters, consumes) %} -{% if parameters.all|length > 0 %}{{ '{' }}{% for parameter in parameters.all %}{{ _self.parameter(parameter) }}{% if not loop.last %}, {% endif %}{% endfor %}{% if 'multipart/form-data' in consumes %}, Function(UploadProgress)? onProgress{% endif %}{{ '}' }}{% endif %} +{% if parameters|length > 0 %}{{ '{' }}{% for parameter in parameters %}{{ _self.parameter(parameter) }}{% if not loop.last %}, {% endif %}{% endfor %}{% if 'multipart/form-data' in consumes %}, Function(UploadProgress)? onProgress{% endif %}{{ '}' }}{% endif %} +{% endmacro %} +{% macro service_params(parameters) %} +{% if parameters|length > 0 %}{{ ', {' }}{% for parameter in parameters %}{% if parameter.required %}required {% endif %}this.{{ parameter.name | caseCamel | overrideIdentifier }}{% if not loop.last %}, {% endif %}{% endfor %}{{ '}' }}{% endif %} {% endmacro %} -{% macro map_parameter(parameter) %}'{{ parameter.name }}': {{ parameter.name | caseCamel | escapeKeyword }},{% endmacro %} {%if service.description %} -{{ service.description|dartComment}} +{{- service.description|dartComment}} {% endif %} class {{ service.name | caseUcfirst }} extends Service { - {{ service.name | caseUcfirst }}(Client client): super(client); -{% for method in service.methods %} + {{ service.name | caseUcfirst }}(super.client); - /// {{ method.title }} -{% if method.description %} - /// +{% for method in service.methods %} + /// {{ method.title }} +{%~ if method.description %} + /// {{ method.description | dartComment }} - /// + /// {% endif %} - {% if method.type == 'webAuth' %}Future{% elseif method.type == 'location' %} Future {% else %} {% if method.responseModel and method.responseModel != 'any' %}Future{% else %}Future{% endif %}{% endif %} {{ method.name | caseCamel }}({{ _self.method_parameters(method.parameters, method.consumes) }}) async { - final String path = '{{ method.path }}'{% for parameter in method.parameters.path %}.replaceAll('{{ '{' }}{{ parameter.name | caseCamel }}{{ '}' }}', {{ parameter.name | caseCamel | escapeKeyword }}){% endfor %}; - - final Map params = { -{% for parameter in method.parameters.query %} - {{ _self.map_parameter(parameter) }} -{% endfor %} -{% for parameter in method.parameters.body %} - {{ _self.map_parameter(parameter) }} -{% endfor %} -{% if method.type == 'location' %} -{% if method.security|length > 0 %} -{% for node in method.security %} -{% for key,header in node|keys %} - '{{header|caseLower}}': client.config['{{header|caseLower}}'], -{% endfor %} -{% endfor %} -{% endif %} -{% endif %} - }; - -{% if method.type == 'location' %} - final res = await client.call(HttpMethod.{{ method.method | caseLower }}, path: path, params: params, responseType: ResponseType.bytes); - return res.data; -{% else %} - final Map headers = { -{% for key, header in method.headers %} - '{{ key }}': '{{ header }}', -{% endfor %} - }; - + {% if method.type == 'location' %}Future{% else %}{% if method.responseModel and method.responseModel != 'any' %}Future{% else %}Future{% endif %}{% endif %} {{ method.name | caseCamel }}({{ _self.method_parameters(method.parameters.all, method.consumes) }}) async { + final String path = '{{ method.path }}'{% for parameter in method.parameters.path %}.replaceAll('{{ '{' }}{{ parameter.name | caseCamel }}{{ '}' }}', {{ parameter.name | caseCamel | overrideIdentifier }}){% endfor %}; {% if 'multipart/form-data' in method.consumes %} - dynamic res; - if(identical(0, 0.0)) { -{% for parameter in method.parameters.all %} -{% if parameter.type == 'file' %} - params['{{ parameter.name }}'] = {{ parameter.name }}.file; -{% endif %} -{% endfor %} - res = await client.call(HttpMethod.{{ method.method | caseLower }}, path: path, params: params, headers: headers); - } else { - String idParamName = ''; -{% for parameter in method.parameters.all %} -{% if parameter.type == 'file' %} - final paramName = '{{ parameter.name }}'; -{% endif %} -{% if parameter.isUploadID %} - idParamName = '{{ parameter.name }}'; -{% endif %} -{% endfor %} - res = await chunkedUpload( - client: client, - path: path, - params: params, - paramName: paramName, - idParamName: idParamName, - headers: headers, - onProgress: onProgress, - ); - } +{{ include('dart/base/requests/file.twig') }} +{% elseif method.type == 'location' %} +{{ include('dart/base/requests/location.twig') }} {% else %} - final res = await client.call(HttpMethod.{{ method.method | caseLower }}, path: path, params: params, headers: headers); -{% endif %} - return {% if method.responseModel and method.responseModel != 'any' %}models.{{method.responseModel | caseUcfirst | overrideIdentifier}}.fromMap(res.data){% else %} res.data{% endif %}; +{{ include('dart/base/requests/api.twig') }} {% endif %} + } {% endfor %} } \ No newline at end of file diff --git a/templates/dart/lib/src/chunked_upload_io.dart.twig b/templates/dart/lib/src/chunked_upload_io.dart.twig deleted file mode 100644 index 710b07c35a..0000000000 --- a/templates/dart/lib/src/chunked_upload_io.dart.twig +++ /dev/null @@ -1,78 +0,0 @@ -import 'client.dart'; -import 'dart:io' as io; -import 'enums.dart'; -import 'package:http/http.dart' as http; -import 'response.dart'; -import 'dart:math'; -import 'input_file.dart'; -import 'exception.dart'; -import 'upload_progress.dart'; - -Future chunkedUpload({ - required Client client, - required String path, - required Map params, - required String paramName, - required String idParamName, - required Map headers, - Function(UploadProgress)? onProgress, -}) async { - InputFile file = params[paramName]; - if (file.path == null) { - throw AppwriteException("File path must be provided for dart:io"); - } - io.File iofile = io.File(file.path!); - final size = await iofile.length(); - - late Response res; - if (size <= Client.CHUNK_SIZE) { - params[paramName] = await http.MultipartFile.fromPath(paramName, file.path!, filename: file.filename); - return client.call( - HttpMethod.post, - path: path, - params: params, - headers: headers, - ); - } - - var offset = 0; - if(idParamName.isNotEmpty && params[idParamName] != 'unique()') { - //make a request to check if a file already exists - try { - res = await client.call( - HttpMethod.get, - path: path + '/' + params[idParamName], - headers: headers, - ); - final int chunksUploaded = res.data['chunksUploaded'] as int; - offset = min(size, chunksUploaded * Client.CHUNK_SIZE); - } on {{spec.title | caseUcfirst}}Exception catch (_) {} - } - // read chunk and upload each chunk - final raf = iofile.openSync(mode: io.FileMode.read); - - while (offset < size) { - raf.setPositionSync(offset); - final chunk = raf.readSync(Client.CHUNK_SIZE); - params[paramName] = - http.MultipartFile.fromBytes(paramName, chunk, filename: file.filename); - headers['content-range'] = - 'bytes $offset-${min(((offset + Client.CHUNK_SIZE) - 1), size)}/$size'; - res = await client.call(HttpMethod.post, - path: path, headers: headers, params: params); - offset += Client.CHUNK_SIZE; - if(offset < size) { - headers['x-{{spec.title | caseLower }}-id'] = res.data['\$id']; - } - final progress = UploadProgress( - $id: res.data['\$id'] ?? '', - progress: min(offset-1,size)/size * 100, - sizeUploaded: min(offset-1,size), - chunksTotal: res.data['chunksTotal'] ?? 0, - chunksUploaded: res.data['chunksUploaded'] ?? 0, - ); - onProgress?.call(progress); - } - raf.close(); - return res; -} diff --git a/templates/dart/lib/src/chunked_upload_stub.dart.twig b/templates/dart/lib/src/chunked_upload_stub.dart.twig deleted file mode 100644 index da8e8ca835..0000000000 --- a/templates/dart/lib/src/chunked_upload_stub.dart.twig +++ /dev/null @@ -1,14 +0,0 @@ -import 'response.dart'; -import 'client.dart'; -import 'upload_progress.dart'; - -Future chunkedUpload({ - required Client client, - required String path, - required Map params, - required String paramName, - required String idParamName, - required Map headers, - Function(UploadProgress)? onProgress -}) => - throw UnsupportedError('Cannot redirect to url without dart:html'); diff --git a/templates/dart/lib/src/client.dart.twig b/templates/dart/lib/src/client.dart.twig index 231e80fdc4..4176700350 100644 --- a/templates/dart/lib/src/client.dart.twig +++ b/templates/dart/lib/src/client.dart.twig @@ -3,6 +3,7 @@ import 'client_stub.dart' if (dart.library.html) 'client_browser.dart' if (dart.library.io) 'client_io.dart'; import 'response.dart'; +import 'upload_progress.dart'; abstract class Client { static const int CHUNK_SIZE = 5*1024*1024; @@ -29,6 +30,15 @@ abstract class Client { Client addHeader(String key, String value); + Future chunkedUpload({ + required String path, + required Map params, + required String paramName, + required String idParamName, + required Map headers, + Function(UploadProgress)? onProgress, + }); + Future call(HttpMethod method, { String path = '', Map headers = const {}, diff --git a/templates/dart/lib/src/client_browser.dart.twig b/templates/dart/lib/src/client_browser.dart.twig index 5590d0c204..ada3ece4e4 100644 --- a/templates/dart/lib/src/client_browser.dart.twig +++ b/templates/dart/lib/src/client_browser.dart.twig @@ -1,3 +1,4 @@ +import 'dart:math'; import 'package:http/http.dart' as http; import 'package:http/browser_client.dart'; import 'client_mixin.dart'; @@ -5,6 +6,8 @@ import 'enums.dart'; import 'exception.dart'; import 'client_base.dart'; import 'response.dart'; +import 'input_file.dart'; +import 'upload_progress.dart'; ClientBase createClient({ required String endPoint, @@ -13,6 +16,7 @@ ClientBase createClient({ ClientBrowser(endPoint: endPoint, selfSigned: selfSigned); class ClientBrowser extends ClientBase with ClientMixin { + static const int CHUNK_SIZE = 5*1024*1024; String _endPoint; Map? _headers; @override @@ -26,7 +30,10 @@ class ClientBrowser extends ClientBase with ClientMixin { _httpClient = BrowserClient(); _headers = { 'content-type': 'application/json', - 'x-sdk-version': '{{spec.title | caseDash}}:{{ language.name | caseLower }}:{{ sdk.version }}', + 'x-sdk-name': '{{ sdk.name }}', + 'x-sdk-platform': '{{ sdk.platform }}', + 'x-sdk-language': '{{ language.name | caseLower }}', + 'x-sdk-version': '{{ sdk.version }}', {% for key,header in spec.global.defaultHeaders %} '{{key}}' : '{{header}}', {% endfor %} @@ -70,6 +77,73 @@ class ClientBrowser extends ClientBase with ClientMixin { return this; } + @override + Future chunkedUpload({ + required String path, + required Map params, + required String paramName, + required String idParamName, + required Map headers, + Function(UploadProgress)? onProgress, + }) async { + InputFile file = params[paramName]; + if (file.bytes == null) { + throw {{spec.title | caseUcfirst}}Exception("File bytes must be provided for Flutter web"); + } + + int size = file.bytes!.length; + + late Response res; + if (size <= CHUNK_SIZE) { + params[paramName] = http.MultipartFile.fromBytes(paramName, file.bytes!, filename: file.filename); + return call( + HttpMethod.post, + path: path, + params: params, + headers: headers, + ); + } + + var offset = 0; + if (idParamName.isNotEmpty && params[idParamName] != 'unique()') { + //make a request to check if a file already exists + try { + res = await call( + HttpMethod.get, + path: path + '/' + params[idParamName], + headers: headers, + ); + final int chunksUploaded = res.data['chunksUploaded'] as int; + offset = min(size, chunksUploaded * CHUNK_SIZE); + } on {{spec.title | caseUcfirst}}Exception catch (_) {} + } + + while (offset < size) { + var chunk; + final end = min(offset + CHUNK_SIZE, size); + chunk = file.bytes!.getRange(offset, end).toList(); + params[paramName] = + http.MultipartFile.fromBytes(paramName, chunk, filename: file.filename); + headers['content-range'] = + 'bytes $offset-${min(((offset + CHUNK_SIZE) - 1), size)}/$size'; + res = await call(HttpMethod.post, + path: path, headers: headers, params: params); + offset += CHUNK_SIZE; + if (offset < size) { + headers['x-{{spec.title | caseLower }}-id'] = res.data['\$id']; + } + final progress = UploadProgress( + $id: res.data['\$id'] ?? '', + progress: min(offset - 1, size) / size * 100, + sizeUploaded: min(offset - 1, size), + chunksTotal: res.data['chunksTotal'] ?? 0, + chunksUploaded: res.data['chunksUploaded'] ?? 0, + ); + onProgress?.call(progress); + } + return res; + } + @override Future call( HttpMethod method, { diff --git a/templates/dart/lib/src/client_io.dart.twig b/templates/dart/lib/src/client_io.dart.twig index 47ef2c9605..5b7e291c83 100644 --- a/templates/dart/lib/src/client_io.dart.twig +++ b/templates/dart/lib/src/client_io.dart.twig @@ -1,4 +1,5 @@ import 'dart:io'; +import 'dart:math'; import 'package:http/http.dart' as http; import 'package:http/io_client.dart'; import 'client_mixin.dart'; @@ -6,6 +7,8 @@ import 'client_base.dart'; import 'enums.dart'; import 'exception.dart'; import 'response.dart'; +import 'input_file.dart'; +import 'upload_progress.dart'; ClientBase createClient({ required String endPoint, @@ -17,6 +20,7 @@ ClientBase createClient({ ); class ClientIO extends ClientBase with ClientMixin { + static const int CHUNK_SIZE = 5*1024*1024; String _endPoint; Map? _headers; @override @@ -35,7 +39,10 @@ class ClientIO extends ClientBase with ClientMixin { _endPoint = endPoint; _headers = { 'content-type': 'application/json', - 'x-sdk-version': '{{spec.title | caseDash}}:{{ language.name | caseLower }}:{{ sdk.version }}', + 'x-sdk-name': '{{ sdk.name }}', + 'x-sdk-platform': '{{ sdk.platform }}', + 'x-sdk-language': '{{ language.name | caseLower }}', + 'x-sdk-version': '{{ sdk.version }}', {% for key,header in spec.global.defaultHeaders %} '{{key}}' : '{{header}}', {% endfor %} @@ -81,6 +88,102 @@ class ClientIO extends ClientBase with ClientMixin { return this; } + @override + Future chunkedUpload({ + required String path, + required Map params, + required String paramName, + required String idParamName, + required Map headers, + Function(UploadProgress)? onProgress, + }) async { + InputFile file = params[paramName]; + if (file.path == null && file.bytes == null) { + throw {{spec.title | caseUcfirst}}Exception("File path or bytes must be provided"); + } + + int size = 0; + if (file.bytes != null) { + size = file.bytes!.length; + } + + File? iofile; + + if (file.path != null) { + iofile = File(file.path!); + size = await iofile.length(); + } + + late Response res; + if (size <= CHUNK_SIZE) { + if (file.path != null) { + params[paramName] = await http.MultipartFile.fromPath( + paramName, file.path!, + filename: file.filename); + } else { + params[paramName] = http.MultipartFile.fromBytes(paramName, file.bytes!, + filename: file.filename); + } + return call( + HttpMethod.post, + path: path, + params: params, + headers: headers, + ); + } + + var offset = 0; + if (idParamName.isNotEmpty && params[idParamName] != 'unique()') { + //make a request to check if a file already exists + try { + res = await call( + HttpMethod.get, + path: path + '/' + params[idParamName], + headers: headers, + ); + final int chunksUploaded = res.data['chunksUploaded'] as int; + offset = min(size, chunksUploaded * CHUNK_SIZE); + } on {{spec.title | caseUcfirst}}Exception catch (_) {} + } + + RandomAccessFile? raf; + // read chunk and upload each chunk + if (iofile != null) { + raf = await iofile.open(mode: FileMode.read); + } + + while (offset < size) { + var chunk; + if (file.bytes != null) { + final end = min(offset + CHUNK_SIZE-1, size-1); + chunk = file.bytes!.getRange(offset, end).toList(); + } else { + raf!.setPositionSync(offset); + chunk = raf.readSync(CHUNK_SIZE); + } + params[paramName] = + http.MultipartFile.fromBytes(paramName, chunk, filename: file.filename); + headers['content-range'] = + 'bytes $offset-${min(((offset + CHUNK_SIZE) - 1), size)}/$size'; + res = await call(HttpMethod.post, + path: path, headers: headers, params: params); + offset += CHUNK_SIZE; + if (offset < size) { + headers['x-{{spec.title | caseLower }}-id'] = res.data['\$id']; + } + final progress = UploadProgress( + $id: res.data['\$id'] ?? '', + progress: min(offset - 1, size) / size * 100, + sizeUploaded: min(offset - 1, size), + chunksTotal: res.data['chunksTotal'] ?? 0, + chunksUploaded: res.data['chunksUploaded'] ?? 0, + ); + onProgress?.call(progress); + } + raf?.close(); + return res; + } + @override Future call( HttpMethod method, { diff --git a/templates/dart/lib/src/input_file.dart.twig b/templates/dart/lib/src/input_file.dart.twig index 1b85e4ba84..84af234f8c 100644 --- a/templates/dart/lib/src/input_file.dart.twig +++ b/templates/dart/lib/src/input_file.dart.twig @@ -1,9 +1,16 @@ -import 'package:http/http.dart' show MultipartFile; +import 'exception.dart'; class InputFile { - final MultipartFile? file; - final String? path; + late final String? path; + late final List? bytes; final String? filename; + final String? contentType; - InputFile({this.file, this.path, this.filename}); + /// Provide a file, use `path` for IO platforms + /// and provide `bytes` for web platform + InputFile({this.path, this.filename, this.contentType, this.bytes}) { + if (path == null && bytes == null) { + throw {{ spec.title | caseUcfirst }}Exception('One of `path` or `bytes` is required'); + } + } } diff --git a/templates/dart/lib/src/models/model.dart.twig b/templates/dart/lib/src/models/model.dart.twig index 10101967ba..dfe1991187 100644 --- a/templates/dart/lib/src/models/model.dart.twig +++ b/templates/dart/lib/src/models/model.dart.twig @@ -1,8 +1,8 @@ -{% macro sub_schema(property) %}{% if property.sub_schema %}{% if property.type == 'array' %}List<{{property.sub_schema | caseUcfirst | overrideIdentifier}}>{% else %}{{property.sub_schema | caseUcfirst | overrideIdentifier }}{% endif %}{% else %}{% if property.type == 'object' and property.additionalProperties %}Map{% else %}{{property.type | typeName}}{% endif %}{% endif %}{% endmacro %} +{% macro sub_schema(property) %}{% if property.sub_schema %}{% if property.type == 'array' %}List<{{property.sub_schema | caseUcfirst | overrideIdentifier}}>{% else %}{{property.sub_schema | caseUcfirst | overrideIdentifier }}{% endif %}{% else %}{% if property.type == 'object' and property.additionalProperties %}Map{% else %}{{property | typeName}}{% endif %}{% endif %}{% endmacro %} part of {{ language.params.packageName }}.models; /// {{ definition.description }} -class {{ definition.name | caseUcfirst | overrideIdentifier }} { +class {{ definition.name | caseUcfirst | overrideIdentifier }} implements Model { {% for property in definition.properties %} /// {{ property.description }} final {% if not property.required %}{{_self.sub_schema(property)}}? {{ property.name | escapeKeyword }}{% else %}{{_self.sub_schema(property)}} {{ property.name | escapeKeyword }}{% endif %}; @@ -11,14 +11,15 @@ class {{ definition.name | caseUcfirst | overrideIdentifier }} { final Map data; {% endif %} - {{ definition.name | caseUcfirst | overrideIdentifier}}({ -{% for property in definition.properties %}{% if property.required %} - required {% endif %}this.{{ property.name | escapeKeyword }}, + {{ definition.name | caseUcfirst | overrideIdentifier}}({% if definition.properties | length or definition.additionalProperties %}{{ '{' }}{% endif %} + +{% for property in definition.properties %} + {% if property.required %}required {% endif %}this.{{ property.name | escapeKeyword }}, {% endfor %} {% if definition.additionalProperties %} required this.data, {% endif %} - }); + {% if definition.properties | length or definition.additionalProperties %}{{ '}' }}{% endif %}); factory {{ definition.name | caseUcfirst | overrideIdentifier}}.fromMap(Map map) { return {{ definition.name | caseUcfirst | overrideIdentifier }}( @@ -34,7 +35,7 @@ class {{ definition.name | caseUcfirst | overrideIdentifier }} { Map toMap() { return { {% for property in definition.properties %} - "{{ property.name | escapeDollarSign }}": {% if property.sub_schema %}{% if property.type == 'array' %}{{property.name | escapeKeyword}}.map((p) => p.toMap()){% else %}{{property.name | escapeKeyword}}.toMap(){% endif %}{% else %}{{property.name | escapeKeyword }}{% endif %}, + "{{ property.name | escapeDollarSign }}": {% if property.sub_schema %}{% if property.type == 'array' %}{{property.name | escapeKeyword}}.map((p) => p.toMap()).toList(){% else %}{{property.name | escapeKeyword}}.toMap(){% endif %}{% else %}{{property.name | escapeKeyword }}{% endif %}, {% endfor %} {% if definition.additionalProperties %} "data": data, diff --git a/templates/flutter/lib/src/models/model_base.dart.twig b/templates/dart/lib/src/models/model_base.dart.twig similarity index 100% rename from templates/flutter/lib/src/models/model_base.dart.twig rename to templates/dart/lib/src/models/model_base.dart.twig diff --git a/templates/dart/pubspec.yaml.twig b/templates/dart/pubspec.yaml.twig index 1c37b4f7e4..72948b6031 100644 --- a/templates/dart/pubspec.yaml.twig +++ b/templates/dart/pubspec.yaml.twig @@ -6,10 +6,10 @@ repository: https://github.com/{{sdk.gitUserName}}/{{sdk.gitRepoName}} issue_tracker: https://github.com/appwrite/sdk-generator/issues documentation: {{ spec.contactURL }} environment: - sdk: '>=2.14.0 <3.0.0' + sdk: '>=2.17.0 <3.0.0' dependencies: - http: ^0.13.4 + http: ^0.13.5 dev_dependencies: - test: ^1.16.8 - lints: ^1.0.1 \ No newline at end of file + lints: ^2.0.1 + test: ^1.22.0 diff --git a/templates/deno/LICENSE.twig b/templates/deno/LICENSE.twig index 0e8c361b49..854eb19494 100644 --- a/templates/deno/LICENSE.twig +++ b/templates/deno/LICENSE.twig @@ -1 +1 @@ -{{sdk.licenseContent}} \ No newline at end of file +{{sdk.licenseContent | raw}} \ No newline at end of file diff --git a/templates/deno/docs/example.md.twig b/templates/deno/docs/example.md.twig index 8f3ea098ca..bda79d1100 100644 --- a/templates/deno/docs/example.md.twig +++ b/templates/deno/docs/example.md.twig @@ -6,12 +6,12 @@ const fs = require('fs'); // Init SDK let client = new sdk.Client(); -let {{ service.name | caseCamel }} = new sdk.{{service.name | caseUcfirst}}(client); +let {{ service.name | caseCamel }} = new sdk.{{service.name | caseUcfirst}}(client{% if service.globalParams | length %}{% for parameter in service.globalParams %}, {{ parameter | paramExample }}{% endfor %}{% endif %}); -{% if method.security|length > 0 %} +{% if method.auth|length > 0 %} client .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint -{% for node in method.security %} +{% for node in method.auth %} {% for key,header in node|keys %} .set{{header}}('{{node[header]['x-appwrite']['demo']}}') // {{node[header].description}} {% endfor %} diff --git a/templates/deno/mod.ts.twig b/templates/deno/mod.ts.twig index 9cc9d84d9f..2878b63607 100644 --- a/templates/deno/mod.ts.twig +++ b/templates/deno/mod.ts.twig @@ -1,5 +1,9 @@ import { Client } from "./src/client.ts"; import { Query } from "./src/query.ts"; +import { Permission } from "./src/permission.ts"; +import { Role } from "./src/role.ts"; +import { ID } from "./src/id.ts"; +import { InputFile } from "./src/inputFile.ts"; import { {{spec.title | caseUcfirst}}Exception } from "./src/exception.ts"; {% for service in spec.services %} import { {{service.name | caseUcfirst}} } from "./src/services/{{service.name | caseDash}}.ts"; @@ -8,6 +12,10 @@ import { {{service.name | caseUcfirst}} } from "./src/services/{{service.name | export { Client, Query, + Permission, + Role, + ID, + InputFile, {{spec.title | caseUcfirst}}Exception, {% for service in spec.services %} {{service.name | caseUcfirst}}, diff --git a/templates/deno/src/client.ts.twig b/templates/deno/src/client.ts.twig index 7c448ce990..fe75b4bb4c 100644 --- a/templates/deno/src/client.ts.twig +++ b/templates/deno/src/client.ts.twig @@ -8,10 +8,13 @@ export class Client { static CHUNK_SIZE = 5*1024*1024; // 5MB static DENO_READ_CHUNK_SIZE = 16384; // 16kb; refference: https://github.com/denoland/deno/discussions/9906 - endpoint: string = 'https://appwrite.io/v1'; + endpoint: string = '{{spec.endpoint}}'; headers: Payload = { 'content-type': '', - 'x-sdk-version': '{{spec.title | caseDash}}:{{ language.name | caseLower }}:{{ sdk.version }}', + 'x-sdk-name': '{{ sdk.name }}', + 'x-sdk-platform': '{{ sdk.platform }}', + 'x-sdk-language': '{{ language.name | caseLower }}', + 'x-sdk-version': '{{ sdk.version }}', {% for key,header in spec.global.defaultHeaders %} '{{key}}':'{{header}}', {% endfor %} @@ -78,7 +81,13 @@ export class Client { const formData = new FormData(); const flatParams = this.flatten(params); for (const key in flatParams) { - formData.append(key, flatParams[key]); + const value = flatParams[key]; + + if(value && value.type && value.type === 'file') { + formData.append(key, value.file, value.filename); + } else { + formData.append(key, flatParams[key]); + } } body = formData; } else { diff --git a/templates/deno/src/id.ts.twig b/templates/deno/src/id.ts.twig new file mode 100644 index 0000000000..9577e4b179 --- /dev/null +++ b/templates/deno/src/id.ts.twig @@ -0,0 +1,9 @@ +export class ID { + public static custom(id: string): string { + return id + } + + public static unique(): string { + return 'unique()' + } +} \ No newline at end of file diff --git a/templates/deno/src/inputFile.ts.twig b/templates/deno/src/inputFile.ts.twig new file mode 100644 index 0000000000..7863a5a558 --- /dev/null +++ b/templates/deno/src/inputFile.ts.twig @@ -0,0 +1,42 @@ +import { readableStreamFromReader } from "https://deno.land/std/streams/conversion.ts"; + +const _bufferToString = (buffer: Uint8Array): ReadableStream => { + return new ReadableStream({ + start(controller) { + controller.enqueue(buffer); + controller.close(); + } + }); +}; + +export class InputFile { + stream: ReadableStream; // Content of file as a stream + size: number; // Total final size of the file content + filename: string; // File name + + static fromPath = (filePath: string, filename: string): InputFile => { + const file = Deno.openSync(filePath); + const stream = readableStreamFromReader(file); + const size = Deno.statSync(filePath).size; + return new InputFile(stream, filename, size); + }; + + static fromBuffer = (buffer: Uint8Array, filename: string): InputFile => { + const stream = _bufferToString(buffer); + const size = buffer.byteLength; + return new InputFile(stream, filename, size); + }; + + static fromPlainText = (content: string, filename: string): InputFile => { + const buffer = new TextEncoder().encode(content); + const stream = _bufferToString(buffer); + const size = buffer.byteLength; + return new InputFile(stream, filename, size); + }; + + constructor(stream: ReadableStream, filename: string, size: number) { + this.stream = stream; + this.filename = filename; + this.size = size; + } +} \ No newline at end of file diff --git a/templates/deno/src/models.d.ts.twig b/templates/deno/src/models.d.ts.twig index 7bd417cfb2..acbe5834d8 100644 --- a/templates/deno/src/models.d.ts.twig +++ b/templates/deno/src/models.d.ts.twig @@ -9,7 +9,7 @@ {% elseif property.sub_schemas %} ({% for subProperty in property.sub_schemas %}{{subProperty | caseUcfirst}}{% if loop.last == false %} | {% endif %}{% endfor %}){% if property.type == 'array' %}[]{% endif %} {% else %} - {{property.type | typeName}} + {{property | typeName}} {% endif %} {% endapply %} {% endmacro %} diff --git a/templates/deno/src/permission.ts.twig b/templates/deno/src/permission.ts.twig new file mode 100644 index 0000000000..bfc330a166 --- /dev/null +++ b/templates/deno/src/permission.ts.twig @@ -0,0 +1,22 @@ +export class Permission { + + static read = (role: string): string => { + return `read("${role}")` + } + + static write = (role: string): string => { + return `write("${role}")` + } + + static create = (role: string): string => { + return `create("${role}")` + } + + static update = (role: string): string => { + return `update("${role}")` + } + + static delete = (role: string): string => { + return `delete("${role}")` + } +} diff --git a/templates/deno/src/query.ts.twig b/templates/deno/src/query.ts.twig index f4e81fd5ca..962a6c8f7e 100644 --- a/templates/deno/src/query.ts.twig +++ b/templates/deno/src/query.ts.twig @@ -9,30 +9,48 @@ export class Query { static notEqual = (attribute: string, value: QueryTypes): string => Query.addQuery(attribute, "notEqual", value); - static lesser = (attribute: string, value: QueryTypes): string => - Query.addQuery(attribute, "lesser", value); + static lessThan = (attribute: string, value: QueryTypes): string => + Query.addQuery(attribute, "lessThan", value); - static lesserEqual = (attribute: string, value: QueryTypes): string => - Query.addQuery(attribute, "lesserEqual", value); + static lessThanEqual = (attribute: string, value: QueryTypes): string => + Query.addQuery(attribute, "lessThanEqual", value); - static greater = (attribute: string, value: QueryTypes): string => - Query.addQuery(attribute, "greater", value); + static greaterThan = (attribute: string, value: QueryTypes): string => + Query.addQuery(attribute, "greaterThan", value); - static greaterEqual = (attribute: string, value: QueryTypes): string => - Query.addQuery(attribute, "greaterEqual", value); + static greaterThanEqual = (attribute: string, value: QueryTypes): string => + Query.addQuery(attribute, "greaterThanEqual", value); static search = (attribute: string, value: string): string => Query.addQuery(attribute, "search", value); - private static addQuery = (attribute: string, oper: string, value: QueryTypes): string => + static orderDesc = (attribute: string): string => + `orderDesc("${attribute}")`; + + static orderAsc = (attribute: string): string => + `orderAsc("${attribute}")`; + + static cursorAfter = (documentId: string): string => + `cursorAfter("${documentId}")`; + + static cursorBefore = (documentId: string): string => + `cursorBefore("${documentId}")`; + + static limit = (limit: number): string => + `limit(${limit})`; + + static offset = (offset: number): string => + `offset(${offset})`; + + private static addQuery = (attribute: string, method: string, value: QueryTypes): string => value instanceof Array - ? `${attribute}.${oper}(${value + ? `${method}("${attribute}", [${value .map((v: QueryTypesSingle) => Query.parseValues(v)) - .join(",")})` - : `${attribute}.${oper}(${Query.parseValues(value)})`; + .join(",")}])` + : `${method}("${attribute}", [${Query.parseValues(value)}])`; private static parseValues = (value: QueryTypes): string => typeof value === "string" || value instanceof String ? `"${value}"` : `${value}`; -} +} \ No newline at end of file diff --git a/templates/deno/src/role.ts.twig b/templates/deno/src/role.ts.twig new file mode 100644 index 0000000000..d94e398c67 --- /dev/null +++ b/templates/deno/src/role.ts.twig @@ -0,0 +1,34 @@ +export class Role { + public static any(): string { + return 'any' + } + + public static user(id: string, status: string = ''): string { + if(status === '') { + return `user:${id}` + } + return `user:${id}/${status}` + } + + public static users(status: string = ''): string { + if(status === '') { + return 'users' + } + return `users/${status}` + } + + public static guests(): string { + return 'guests' + } + + public static team(id: string, role: string = ''): string { + if(role === '') { + return `team:${id}` + } + return `team:${id}/${role}` + } + + public static member(id: string): string { + return `member:${id}` + } +} \ No newline at end of file diff --git a/templates/deno/src/services/service.ts.twig b/templates/deno/src/services/service.ts.twig index 56c8ddbff3..90090ca99f 100644 --- a/templates/deno/src/services/service.ts.twig +++ b/templates/deno/src/services/service.ts.twig @@ -28,6 +28,7 @@ import { basename } from "https://deno.land/std@0.122.0/path/mod.ts"; import { Service } from '../service.ts'; import { Payload, Client } from '../client.ts'; +import { InputFile } from '../inputFile.ts'; import { AppwriteException } from '../exception.ts'; import type { Models } from '../models.d.ts'; @@ -40,6 +41,12 @@ export type UploadProgress = { } export class {{ service.name | caseUcfirst }} extends Service { + + constructor(client: Client) + { + super(client); + } + {% for method in service.methods %} {% set generics = _self.get_generics(spec.definitions[method.responseModel], spec, true, true) %} {% set generics_return = _self.get_generics_return(spec.definitions[method.responseModel], spec) %} @@ -50,13 +57,13 @@ export class {{ service.name | caseUcfirst }} extends Service { {{ method.description|comment1 }} * {% endif %} -{% for parameter in method.parameters.all %} - * @param {{ '{' }}{{ parameter.type | typeName }}{{ '}' }} {{ parameter.name | caseCamel | escapeKeyword }} +{% for parameter in method.parameters.all%} + * @param {{ '{' }}{{ parameter | typeName }}{{ '}' }} {{ parameter.name | caseCamel | escapeKeyword }} {% endfor %} * @throws {AppwriteException} * @returns {Promise} */ - async {{ method.name | caseCamel }}{% if generics %}<{{generics}}>{% endif %}({% for parameter in method.parameters.all %}{{ parameter.name | caseCamel | escapeKeyword }}{% if not parameter.required %}?{% endif %}: {{ parameter.type | typeName }}{% if not loop.last %}, {% endif %}{% endfor %}{% if 'multipart/form-data' in method.consumes %}, onProgress = (progress: UploadProgress) => {}{% endif %}): Promise<{% if method.type == 'webAuth' %}Response{% elseif method.type == 'location' %}Response{% else %}{% if method.responseModel and method.responseModel != 'any' %}{% if not spec.definitions[method.responseModel].additionalProperties %}Models.{% endif %}{{method.responseModel | caseUcfirst}}{% if generics_return %}<{{generics_return}}>{% endif %}{% else %}Response{% endif %}{% endif %}> { + async {{ method.name | caseCamel }}{% if generics %}<{{generics}}>{% endif %}({% for parameter in method.parameters.all %}{{ parameter.name | caseCamel | escapeKeyword }}{% if not parameter.required %}?{% endif %}: {{ parameter | typeName }}{% if not loop.last %}, {% endif %}{% endfor %}{% if 'multipart/form-data' in method.consumes %}, onProgress = (progress: UploadProgress) => {}{% endif %}): Promise<{% if method.type == 'webAuth' %}Response{% elseif method.type == 'location' %}Response{% else %}{% if method.responseModel and method.responseModel != 'any' %}{% if not spec.definitions[method.responseModel].additionalProperties %}Models.{% endif %}{{method.responseModel | caseUcfirst}}{% if generics_return %}<{{generics_return}}>{% endif %}{% else %}Response{% endif %}{% endif %}> { {% for parameter in method.parameters.all %} {% if parameter.required %} if (typeof {{ parameter.name | caseCamel | escapeKeyword }} === 'undefined') { @@ -70,122 +77,119 @@ export class {{ service.name | caseUcfirst }} extends Service { {% for parameter in method.parameters.query %} if (typeof {{ parameter.name | caseCamel | escapeKeyword }} !== 'undefined') { - payload['{{ parameter.name }}'] = {{ parameter.name | caseCamel | escapeKeyword }}{% if method.consumes[0] == "multipart/form-data" and ( parameter.type != "string" and parameter.type != "array" ) %}.toString(){% endif %}; + payload['{{ parameter.name }}'] = {{ parameter.name | caseCamel | escapeKeyword }}{% if method.consumes[0] == "multipart/form-data" and ( parameter.type != "string" and parameter.type != "array" and parameter.type != "file" ) %}.toString(){% endif %}; } {% endfor %} {% for parameter in method.parameters.body %} if (typeof {{ parameter.name | caseCamel | escapeKeyword }} !== 'undefined') { - payload['{{ parameter.name }}'] = {{ parameter.name | caseCamel | escapeKeyword }}{% if method.consumes[0] == "multipart/form-data" and ( parameter.type != "string" and parameter.type != "array" ) %}.toString(){% endif %}; + payload['{{ parameter.name }}'] = {{ parameter.name | caseCamel | escapeKeyword }}{% if method.consumes[0] == "multipart/form-data" and ( parameter.type != "string" and parameter.type != "array" and parameter.type != "file" ) %}.toString(){% endif %}; } {% endfor %} {% if 'multipart/form-data' in method.consumes %} {% for parameter in method.parameters.all %} {% if parameter.type == 'file' %} - const {size: size} = await Deno.stat({{ parameter.name | caseCamel | escapeKeyword }}); - if (size <= Client.CHUNK_SIZE) { - payload['{{ parameter.name }}'] = new File([await Deno.readFile({{ parameter.name | caseCamel | escapeKeyword }})], basename({{ parameter.name | caseCamel | escapeKeyword }})); - - return await this.client.call('{{ method.method | caseLower }}', path, { + const size = {{ parameter.name | caseCamel | escapeKeyword }}.size; + + const headers: { [header: string]: string } = { {% for parameter in method.parameters.header %} - '{{ parameter.name }}': ${{ parameter.name | caseCamel | escapeKeyword }}, + '{{ parameter.name }}': ${{ parameter.name | caseCamel | escapeKeyword }}, {% endfor %} {% for key, header in method.headers %} - '{{ key }}': '{{ header }}', + '{{ key }}': '{{ header }}', {% endfor %} - }, payload); - } else { - const stream = await Deno.open({{ parameter.name | caseCamel | escapeKeyword }}, { read: true }); + }; - let id = undefined; - let response = undefined; + let id: string | undefined = undefined; + let response: any = undefined; - let counter = 0; - const totalCounters = Math.ceil(size / Client.CHUNK_SIZE); - - const headers: { [header: string]: string } = { -{% for parameter in method.parameters.header %} - '{{ parameter.name }}': ${{ parameter.name | caseCamel | escapeKeyword }}, -{% endfor %} -{% for key, header in method.headers %} - '{{ key }}': '{{ header }}', -{% endfor %} - }; + let chunksUploaded = 0; {% for parameter in method.parameters.all %} {% if parameter.isUploadID %} - if({{ parameter.name | caseCamel | escapeKeyword }} != 'unique()') { - try { - response = await this.client.call('get', path + '/' + {{ parameter.name }}, headers); - counter = response.chunksUploaded; - } catch(e) { - } + if({{ parameter.name | caseCamel | escapeKeyword }} != 'unique()') { + try { + response = await this.client.call('get', path + '/' + {{ parameter.name }}, headers); + chunksUploaded = response.chunksUploaded; + } catch(e) { } + } {% endif %} {% endfor %} - for (counter; counter < totalCounters; counter++) { - const start = (counter * Client.CHUNK_SIZE); - const end = Math.min((((counter * Client.CHUNK_SIZE) + Client.CHUNK_SIZE) - 1), size); - - headers['content-range'] = 'bytes ' + start + '-' + end + '/' + size + let currentChunk = 1; + let currentPosition = 0; + let uploadableChunk = new Uint8Array(Client.CHUNK_SIZE); - if (id) { - headers['x-{{spec.title | caseLower }}-id'] = id; - } - - let totalBuffer = new Uint8Array(Client.CHUNK_SIZE); - let lastBufferIndex = -1; - - for (let blockIndex = 0; blockIndex < Client.CHUNK_SIZE / Client.DENO_READ_CHUNK_SIZE; blockIndex++) { - const buf = new Uint8Array(Client.DENO_READ_CHUNK_SIZE); - const cursorPosition = await Deno.seek(stream.rid, start + (blockIndex * 16384), Deno.SeekMode.Start); - const numberOfBytesRead = await Deno.read(stream.rid, buf); - - if (!numberOfBytesRead) { - break; - } - - for (let byteIndex = 0; byteIndex < Client.DENO_READ_CHUNK_SIZE; byteIndex++) { - totalBuffer[(blockIndex * Client.DENO_READ_CHUNK_SIZE) + byteIndex] = buf[byteIndex]; - - if(buf[byteIndex] !== 0) { - lastBufferIndex = (blockIndex * Client.DENO_READ_CHUNK_SIZE) + byteIndex; - } - } - } + const uploadChunk = async (lastUpload = false) => { + if(currentChunk <= chunksUploaded) { + return; + } - // Shrink empty bytes - if(lastBufferIndex !== -1) { - const newTotalBuffer = new Uint8Array(lastBufferIndex + 1); - for(let index = 0; index <= lastBufferIndex; index++) { - newTotalBuffer[index] = totalBuffer[index]; - } - totalBuffer = newTotalBuffer; - } - - payload['{{ parameter.name }}'] = new File([totalBuffer], basename({{ parameter.name | caseCamel | escapeKeyword }})); + const start = ((currentChunk - 1) * Client.CHUNK_SIZE); + const end = start + currentPosition; - response = await this.client.call('{{ method.method | caseLower }}', path, headers, payload{% if method.type == 'location' %}, 'arraybuffer'{% endif %}); + if(!lastUpload || currentChunk !== 1) { + headers['content-range'] = 'bytes ' + start + '-' + end + '/' + size; + } - if (!id) { - id = response['$id']; + let uploadableChunkTrimmed: Uint8Array; + + if(currentPosition + 1 >= Client.CHUNK_SIZE) { + uploadableChunkTrimmed = uploadableChunk; + } else { + uploadableChunkTrimmed = new Uint8Array(currentPosition); + for(let i = 0; i <= currentPosition; i++) { + uploadableChunkTrimmed[i] = uploadableChunk[i]; } + } - if (onProgress !== null) { - onProgress({ - $id: response['$id'], - progress: Math.min((counter+1) * Client.CHUNK_SIZE, size) / size * 100, - sizeUploaded: end+1, - chunksTotal: response['chunksTotal'], - chunksUploaded: response['chunksUploaded'] - }); - } + if (id) { + headers['x-{{spec.title | caseLower }}-id'] = id; + } + + payload['{{ parameter.name }}'] = { type: 'file', file: new File([uploadableChunkTrimmed], {{ parameter.name | caseCamel | escapeKeyword }}.filename), filename: {{ parameter.name | caseCamel | escapeKeyword }}.filename }; + + response = await this.client.call('{{ method.method | caseLower }}', path, headers, payload{% if method.type == 'location' %}, 'arraybuffer'{% endif %}); + + if (!id) { + id = response['$id']; + } + + if (onProgress !== null) { + onProgress({ + $id: response['$id'], + progress: Math.min((currentChunk) * Client.CHUNK_SIZE, size) / size * 100, + sizeUploaded: end+1, + chunksTotal: response['chunksTotal'], + chunksUploaded: response['chunksUploaded'] + }); } - return response; + uploadableChunk = new Uint8Array(Client.CHUNK_SIZE); + currentPosition = 0; + currentChunk++; } + + for await (const chunk of {{ parameter.name | caseCamel | escapeKeyword }}.stream) { + let i = 0; + for(const b of chunk) { + uploadableChunk[currentPosition] = chunk[i]; + + if(currentPosition + 1 >= Client.CHUNK_SIZE) { + await uploadChunk(); + currentPosition--; + } + + i++; + currentPosition++; + } + } + + await uploadChunk(true); + + return response; {% endif %} {% endfor %} {% else %} diff --git a/templates/dotnet/LICENSE.twig b/templates/dotnet/LICENSE.twig index 0e8c361b49..854eb19494 100644 --- a/templates/dotnet/LICENSE.twig +++ b/templates/dotnet/LICENSE.twig @@ -1 +1 @@ -{{sdk.licenseContent}} \ No newline at end of file +{{sdk.licenseContent | raw}} \ No newline at end of file diff --git a/templates/dotnet/docs/example.md.twig b/templates/dotnet/docs/example.md.twig index a02ce88778..a121a7eabc 100644 --- a/templates/dotnet/docs/example.md.twig +++ b/templates/dotnet/docs/example.md.twig @@ -2,16 +2,16 @@ using {{ spec.title | caseUcfirst }}; Client client = new Client(); -{% if method.security|length > 0 %} +{% if method.auth|length > 0 %} client .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint -{% for node in method.security %} +{% for node in method.auth %} {% for key,header in node|keys %} .Set{{header | caseUcfirst}}("{{node[header]["x-appwrite"]["demo"]}}") // {{node[header].description}} {% endfor %} {% endfor %}; {% endif %} -{{ service.name | caseUcfirst }} {{ service.name | caseCamel }} = new {{ service.name | caseUcfirst }}(client); +{{ service.name | caseUcfirst }} {{ service.name | caseCamel }} = new {{ service.name | caseUcfirst }}(client{% if service.globalParams | length %}{% for parameter in service.globalParams %}, {{ parameter | paramExample }}{% endfor %}{% endif %}); {% if method.type == 'location' %}string{% else %}HttpResponseMessage{% endif %} result = await {{ service.name | caseCamel }}.{{ method.name | caseUcfirst }}({% for parameter in method.parameters.all %}{% if parameter.required %}{% if not loop.first %}, {% endif %}{{ parameter | paramExample }}{% endif %}{% endfor %}); diff --git a/templates/dotnet/src/Appwrite/Client.cs.twig b/templates/dotnet/src/Appwrite/Client.cs.twig index e34f399c71..906012d673 100644 --- a/templates/dotnet/src/Appwrite/Client.cs.twig +++ b/templates/dotnet/src/Appwrite/Client.cs.twig @@ -30,7 +30,10 @@ namespace {{ spec.title | caseUcfirst }} this.headers = new Dictionary() { { "content-type", "application/json" }, - { "x-sdk-version", "{{spec.title | caseDash}}:{{ language.name | caseLower }}:{{sdk.version}}" }{% if spec.global.defaultHeaders | length > 0 %},{% endif %} + { "x-sdk-name", "{{ sdk.name }}" }, + { "x-sdk-platform", "{{ sdk.platform }}" }, + { "x-sdk-language", "{{ language.name | caseLower }}" }, + { "x-sdk-version", "{{ sdk.version }}"}{% if spec.global.defaultHeaders | length > 0 %},{% endif %} {% for key,header in spec.global.defaultHeaders %} { "{{key}}", "{{header}}" }{% if not loop.last %},{% endif %} diff --git a/templates/dotnet/src/Appwrite/Services/ServiceTemplate.cs.twig b/templates/dotnet/src/Appwrite/Services/ServiceTemplate.cs.twig index 023be1d3ea..95ff6dcd24 100644 --- a/templates/dotnet/src/Appwrite/Services/ServiceTemplate.cs.twig +++ b/templates/dotnet/src/Appwrite/Services/ServiceTemplate.cs.twig @@ -1,6 +1,6 @@ {% macro parameter(parameter) %} {% if parameter.name == 'orderType' %}{{ 'OrderType orderType = OrderType.ASC' }}{% else %} -{{ parameter.type | typeName }}{% if not parameter.required and (parameter.type == 'boolean' or parameter.type == 'integer') %}?{% endif %} {{ parameter.name | caseCamel | escapeKeyword }}{{ parameter | paramDefault }}{% endif %} +{{ parameter | typeName }}{% if not parameter.required and (parameter.type == 'boolean' or parameter.type == 'integer') %}?{% endif %} {{ parameter.name | caseCamel | escapeKeyword }}{{ parameter | paramDefault }}{% endif %} {% endmacro %} {% macro method_parameters(parameters) %} {% if parameters.all|length > 0 %}{% for parameter in parameters.all %}{{ _self.parameter(parameter) }}{% if not loop.last %}{{ ', ' }}{% endif %}{% endfor %}{% endif %} @@ -10,7 +10,7 @@ {{ parameter.name | caseCamel | escapeKeyword }}{% endif %} {% endmacro %} {% macro methodNeedsSecurityParameters(method) %} -{% if (method.type == "webAuth" or method.type == "location") and method.security|length > 0 %}{{ true }}{% else %}{{false}}{% endif %} +{% if (method.type == "webAuth" or method.type == "location") and method.auth|length > 0 %}{{ true }}{% else %}{{false}}{% endif %} {% endmacro %} using System.Collections.Generic; @@ -46,7 +46,7 @@ namespace {{ spec.title | caseUcfirst }} {% endfor %} }; -{% if _self.methodNeedsSecurityParameters(method) %}{% for node in method.security %} +{% if _self.methodNeedsSecurityParameters(method) %}{% for node in method.auth %} {% for key,header in node|keys %} // { "{{header|caseLower}}", _client.GetConfig().get("{{header|caseLower}}") }{% if not loop.last %},{% endif %} diff --git a/templates/flutter/LICENSE.twig b/templates/flutter/LICENSE.twig index 0e8c361b49..854eb19494 100644 --- a/templates/flutter/LICENSE.twig +++ b/templates/flutter/LICENSE.twig @@ -1 +1 @@ -{{sdk.licenseContent}} \ No newline at end of file +{{sdk.licenseContent | raw}} \ No newline at end of file diff --git a/templates/flutter/base/requests/api.twig b/templates/flutter/base/requests/api.twig new file mode 100644 index 0000000000..233b53490a --- /dev/null +++ b/templates/flutter/base/requests/api.twig @@ -0,0 +1,13 @@ +{% import 'flutter/base/utils.twig' as utils %} + final Map params = { + {{- utils.map_parameter(method.parameters.query) -}} + {{~ utils.map_parameter(method.parameters.body) }} + }; + + final Map headers = { + {{~ utils.map_headers(method.headers) }} + }; + + final res = await client.call(HttpMethod.{{ method.method | caseLower }}, path: path, params: params, headers: headers); + + return {% if method.responseModel and method.responseModel != 'any' %}models.{{method.responseModel | caseUcfirst | overrideIdentifier}}.fromMap(res.data){% else %} res.data{% endif %}; diff --git a/templates/flutter/base/requests/file.twig b/templates/flutter/base/requests/file.twig new file mode 100644 index 0000000000..7a5777115e --- /dev/null +++ b/templates/flutter/base/requests/file.twig @@ -0,0 +1,31 @@ +{% import 'flutter/base/utils.twig' as utils %} + final Map params = { + {{~ utils.map_parameter(method.parameters.query) }} + {{~ utils.map_parameter(method.parameters.body) }} + }; + + final Map headers = { + {{~ utils.map_headers(method.headers) }} + }; + +{% if 'multipart/form-data' in method.consumes %} + String idParamName = ''; +{% for parameter in method.parameters.all %} +{% if parameter.type == 'file' %} + final paramName = '{{ parameter.name }}'; +{% endif %} +{% if parameter.isUploadID %} + idParamName = '{{ parameter.name }}'; +{% endif %} +{% endfor %} + final res = await client.chunkedUpload( + path: path, + params: params, + paramName: paramName, + idParamName: idParamName, + headers: headers, + onProgress: onProgress, + ); + + return {% if method.responseModel and method.responseModel != 'any' %}models.{{method.responseModel | caseUcfirst | overrideIdentifier}}.fromMap(res.data){% else %} res.data{% endif %}; +{% endif %} diff --git a/templates/flutter/base/requests/location.twig b/templates/flutter/base/requests/location.twig new file mode 100644 index 0000000000..76be6e723b --- /dev/null +++ b/templates/flutter/base/requests/location.twig @@ -0,0 +1,14 @@ +{% import 'flutter/base/utils.twig' as utils %} + final Map params = { + {{ utils.map_parameter(method.parameters.query) }} + {{ utils.map_parameter(method.parameters.body) }} +{% if method.auth|length > 0 %}{% for node in method.auth %} +{% for key,header in node|keys %} + '{{header|caseLower}}': client.config['{{header|caseLower}}'], +{% endfor %} +{% endfor %} +{% endif %} + }; + + final res = await client.call(HttpMethod.{{ method.method | caseLower }}, path: path, params: params, responseType: ResponseType.bytes); + return res.data; \ No newline at end of file diff --git a/templates/flutter/base/requests/oauth.twig b/templates/flutter/base/requests/oauth.twig new file mode 100644 index 0000000000..36538cd3dc --- /dev/null +++ b/templates/flutter/base/requests/oauth.twig @@ -0,0 +1,34 @@ +{% import 'flutter/base/utils.twig' as utils %} + final Map params = { + {{ utils.map_parameter(method.parameters.query) }} + {{ utils.map_parameter(method.parameters.body) }} +{% if method.auth|length > 0 %} +{% for node in method.auth %} +{% for key,header in node|keys %} + '{{header|caseLower}}': client.config['{{header|caseLower}}'], +{% endfor %} +{% endfor %} +{% endif %} + }; + + final List query = []; + + params.forEach((key, value) { + if (value is List) { + for (var item in value) { + query.add(Uri.encodeComponent(key + '[]') + '=' + Uri.encodeComponent(item)); + } + } else if(value != null) { + query.add(Uri.encodeComponent(key) + '=' + Uri.encodeComponent(value)); + } + }); + + Uri endpoint = Uri.parse(client.endPoint); + Uri url = Uri(scheme: endpoint.scheme, + host: endpoint.host, + port: endpoint.port, + path: endpoint.path + path, + query: query.join('&') + ); + + return client.webAuth(url, callbackUrlScheme: success); \ No newline at end of file diff --git a/templates/flutter/base/utils.twig b/templates/flutter/base/utils.twig new file mode 100644 index 0000000000..73a0fe950b --- /dev/null +++ b/templates/flutter/base/utils.twig @@ -0,0 +1,11 @@ +{%- macro map_parameter(parameters) -%} +{%- for parameter in parameters ~%} + '{{ parameter.name }}': {{ parameter.name | caseCamel | overrideIdentifier }}, +{%- endfor ~%} +{%- endmacro ~%} + +{% macro map_headers(headers) -%} +{%- for key, header in headers %} + '{{ key }}': '{{ header }}', +{%- endfor -%} +{%- endmacro -%} \ No newline at end of file diff --git a/templates/flutter/docs/example.md.twig b/templates/flutter/docs/example.md.twig index 67c886c5d6..a47393aa0a 100644 --- a/templates/flutter/docs/example.md.twig +++ b/templates/flutter/docs/example.md.twig @@ -5,12 +5,12 @@ import 'package:{{ language.params.packageName }}/{{ language.params.packageName void main() { // Init SDK Client client = Client(); - {{ service.name | caseUcfirst }} {{ service.name | caseCamel }} = {{service.name | caseUcfirst}}(client); + {{ service.name | caseUcfirst }} {{ service.name | caseCamel }} = {{service.name | caseUcfirst}}(client{% if service.globalParams | length %}{% for parameter in service.globalParams %}, {{ parameter.name | caseCamel | overrideIdentifier }}: {{ parameter | paramExample }}{% endfor %}{% endif %}); -{% if method.security|length > 0 %} +{% if method.auth|length > 0 %} client .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint -{% for node in method.security %} +{% for node in method.auth %} {% for key,header in node|keys %} .set{{header}}('{{node[header]['x-appwrite']['demo']}}') // {{node[header].description}} {% endfor %} @@ -25,7 +25,7 @@ void main() { // Init SDK {% if parameter.required %} {{ parameter.name | caseCamel }}: {{ parameter | paramExample }}, {% endif %} -{% endfor %}{% if method.parameters.all|length > 0 %} {% endif %}).then((bytes) { +{% endfor %}{% if method.parameters.all | length > 0 %} {% endif %}).then((bytes) { final file = File('path_to_file/filename.ext'); file.writeAsBytesSync(bytes) }).catchError((error) { @@ -40,9 +40,9 @@ FutureBuilder( {% endif %} {% if parameter.required %} - {{ parameter.name | caseCamel }}: {{ parameter | paramExample }}, + {{ parameter.name | caseCamel | overrideIdentifier }}: {{ parameter | paramExample }}, {% endif %} -{% endfor %}{% if method.parameters.all|length > 0 %} {% endif %} +{% endfor %}{% if method.parameters.all | length > 0 %} {% endif %} ), //works for both public file and private file, for private files you need to be logged in builder: (context, snapshot) { return snapshot.hasData && snapshot.data != null @@ -60,7 +60,7 @@ FutureBuilder( {% if parameter.required %} {{ parameter.name | caseCamel }}: {{ parameter | paramExample }}, {% endif %} -{% endfor %}{% if method.parameters.all|length > 0 %} {% endif %}); +{% endfor %}{% if method.parameters.all | length > 0 %} {% endif %}); result .then((response) { diff --git a/templates/flutter/lib/models.dart.twig b/templates/flutter/lib/models.dart.twig deleted file mode 100644 index da68b7f326..0000000000 --- a/templates/flutter/lib/models.dart.twig +++ /dev/null @@ -1,6 +0,0 @@ -library {{ language.params.packageName }}.models; - -part 'src/models/model.dart'; -{% for definition in spec.definitions %} -part 'src/models/{{definition.name | caseSnake}}.dart'; -{% endfor %} \ No newline at end of file diff --git a/templates/flutter/lib/package.dart.twig b/templates/flutter/lib/package.dart.twig index 3828d22586..90711b99a9 100644 --- a/templates/flutter/lib/package.dart.twig +++ b/templates/flutter/lib/package.dart.twig @@ -2,11 +2,7 @@ library {{ language.params.packageName }}; import 'dart:async'; import 'dart:typed_data'; -import 'package:flutter/foundation.dart'; -import 'src/chunked_upload_stub.dart' - if (dart.library.io) 'src/chunked_upload_io.dart'; import 'src/enums.dart'; -import 'src/client.dart'; import 'src/service.dart'; import 'src/input_file.dart'; import 'models.dart' as models; @@ -20,9 +16,11 @@ export 'src/upload_progress.dart'; export 'src/realtime_subscription.dart'; export 'src/realtime_message.dart'; export 'src/input_file.dart'; -export 'package:http/http.dart' show MultipartFile; part 'query.dart'; +part 'permission.dart'; +part 'role.dart'; +part 'id.dart'; {% for service in spec.services %} part 'services/{{service.name | caseDash}}.dart'; {% endfor %} \ No newline at end of file diff --git a/templates/flutter/lib/query.dart.twig b/templates/flutter/lib/query.dart.twig deleted file mode 100644 index d1b95e2cdf..0000000000 --- a/templates/flutter/lib/query.dart.twig +++ /dev/null @@ -1,32 +0,0 @@ -part of {{ language.params.packageName }}; - -class Query { - static equal(String attribute, dynamic value) => - _addQuery(attribute, 'equal', value); - - static notEqual(String attribute, dynamic value) => - _addQuery(attribute, 'notEqual', value); - - static lesser(String attribute, dynamic value) => - _addQuery(attribute, 'lesser', value); - - static lesserEqual(String attribute, dynamic value) => - _addQuery(attribute, 'lesserEqual', value); - - static greater(String attribute, dynamic value) => - _addQuery(attribute, 'greater', value); - - static greaterEqual(String attribute, dynamic value) => - _addQuery(attribute, 'greaterEqual', value); - - static search(String attribute, String value) => - _addQuery(attribute, 'search', value); - - static String _addQuery(String attribute, String oper, dynamic value) => (value - is List) - ? '$attribute.$oper(${value.map((item) => parseValues(item)).join(",")})' - : '$attribute.$oper(${parseValues(value)})'; - - static String parseValues(dynamic value) => - (value is String) ? '"$value"' : '$value'; -} diff --git a/templates/flutter/lib/services/service.dart.twig b/templates/flutter/lib/services/service.dart.twig index 23cc10289a..7c649609c5 100644 --- a/templates/flutter/lib/services/service.dart.twig +++ b/templates/flutter/lib/services/service.dart.twig @@ -1,112 +1,36 @@ part of {{ language.params.packageName }}; - -{% macro parameter(parameter) %}{% if parameter.required %}required {{ parameter.type | typeName }}{% else %}{{ parameter.type | typeName }}?{% endif %} {{ parameter.name | caseCamel | escapeKeyword }}{% endmacro %} +{% macro parameter(parameter) %}{% if parameter.required %}required {{ parameter | typeName }}{% else %}{{ parameter | typeName }}?{% endif %} {{ parameter.name | caseCamel | overrideIdentifier }}{% endmacro %} {% macro method_parameters(parameters, consumes) %} -{% if parameters.all|length > 0 %}{{ '{' }}{% for parameter in parameters.all %}{{ _self.parameter(parameter) }}{% if not loop.last %}, {% endif %}{% endfor %}{% if 'multipart/form-data' in consumes %}, Function(UploadProgress)? onProgress{% endif %}{{ '}' }}{% endif %} +{% if parameters|length > 0 %}{{ '{' }}{% for parameter in parameters %}{{ _self.parameter(parameter) }}{% if not loop.last %}, {% endif %}{% endfor %}{% if 'multipart/form-data' in consumes %}, Function(UploadProgress)? onProgress{% endif %}{{ '}' }}{% endif %} +{% endmacro %} +{% macro service_params(parameters) %} +{% if parameters|length > 0 %}{{ ', {' }}{% for parameter in parameters %}{% if parameter.required %}required {% endif %}this.{{ parameter.name | caseCamel | overrideIdentifier }}{% if not loop.last %}, {% endif %}{% endfor %}{{ '}' }}{% endif %} {% endmacro %} -{% macro map_parameter(parameter) %}'{{ parameter.name }}': {{ parameter.name | caseCamel | escapeKeyword }},{% endmacro %} {%if service.description %} -{{ service.description|dartComment}} +{{- service.description|dartComment}} {% endif %} class {{ service.name | caseUcfirst }} extends Service { - {{ service.name | caseUcfirst }}(Client client): super(client); + {{ service.name | caseUcfirst }}(super.client); {% for method in service.methods %} - /// {{ method.title }} -{% if method.description %} - /// + /// {{ method.title }} +{%~ if method.description %} + /// {{ method.description|dartComment }} - /// + /// {% endif %} - {% if method.type == 'webAuth' %}Future{% elseif method.type == 'location' %} Future {% else %} {% if method.responseModel and method.responseModel != 'any' %}Future{% else %}Future{% endif %}{% endif %} {{ method.name | caseCamel }}({{ _self.method_parameters(method.parameters, method.consumes) }}) async { - {% if method.parameters.path | length > 0 %}final{% else %}const{% endif %} String path = '{{ method.path }}'{% for parameter in method.parameters.path %}.replaceAll('{{ '{' }}{{ parameter.name | caseCamel }}{{ '}' }}', {{ parameter.name | caseCamel | escapeKeyword }}){% endfor %}; - - final Map params = { -{% for parameter in method.parameters.query %} - {{ _self.map_parameter(parameter) }} -{% endfor %} -{% for parameter in method.parameters.body %} - {{ _self.map_parameter(parameter) }} -{% endfor %} -{% if method.type == 'webAuth' or method.type == 'location' %} -{% if method.security|length > 0 %} -{% for node in method.security %} -{% for key,header in node|keys %} - '{{header|caseLower}}': client.config['{{header|caseLower}}'], -{% endfor %} -{% endfor %} -{% endif %} -{% endif %} - }; - -{% if method.type == 'webAuth' %} - - final List query = []; - - params.forEach((key, value) { - if (value is List) { - for (var item in value) { - query.add(Uri.encodeComponent(key + '[]') + '=' + Uri.encodeComponent(item)); - } - } else if(value != null) { - query.add(Uri.encodeComponent(key) + '=' + Uri.encodeComponent(value)); - } - }); - - Uri endpoint = Uri.parse(client.endPoint); - Uri url = Uri(scheme: endpoint.scheme, - host: endpoint.host, - port: endpoint.port, - path: endpoint.path + path, - query: query.join('&') - ); - - return client.webAuth(url); - -{% elseif method.type == 'location' %} - final res = await client.call(HttpMethod.{{ method.method | caseLower }}, path: path, params: params, responseType: ResponseType.bytes); - return res.data; -{% else %} - final Map headers = { -{% for key, header in method.headers %} - '{{ key }}': '{{ header }}', -{% endfor %} - }; + {% if method.type == 'webAuth' %}Future{% elseif method.type == 'location' %}Future{% else %}{% if method.responseModel and method.responseModel != 'any' %}Future{% else %}Future{% endif %}{% endif %} {{ method.name | caseCamel }}({{ _self.method_parameters(method.parameters.all, method.consumes) }}) async { + {% if method.parameters.path | length > 0 %}final{% else %}const{% endif %} String path = '{{ method.path }}'{% for parameter in method.parameters.path %}.replaceAll('{{ '{' }}{{ parameter.name | caseCamel }}{{ '}' }}', {{ parameter.name | caseCamel | overrideIdentifier }}){% endfor %}; {% if 'multipart/form-data' in method.consumes %} - dynamic res; - if(kIsWeb) { -{% for parameter in method.parameters.all %} -{% if parameter.type == 'file' %} - params['{{ parameter.name }}'] = {{ parameter.name }}.file; -{% endif %} -{% endfor %} - res = await client.call(HttpMethod.{{ method.method | caseLower }}, path: path, params: params, headers: headers); - } else { - String idParamName = ''; -{% for parameter in method.parameters.all %} -{% if parameter.type == 'file' %} - final paramName = '{{ parameter.name }}'; -{% endif %} -{% if parameter.isUploadID %} - idParamName = '{{ parameter.name }}'; -{% endif %} -{% endfor %} - res = await chunkedUpload( - client: client, - path: path, - params: params, - paramName: paramName, - idParamName: idParamName, - headers: headers, - onProgress: onProgress, - ); - } +{{ include('flutter/base/requests/file.twig') }} +{% elseif method.type == 'webAuth' %} +{{ include('flutter/base/requests/oauth.twig') }} +{% elseif method.type == 'location' %} +{{ include('flutter/base/requests/location.twig') }} {% else %} - final res = await client.call(HttpMethod.{{ method.method | caseLower }}, path: path, params: params, headers: headers); -{% endif %} - return {% if method.responseModel and method.responseModel != 'any' %}models.{{method.responseModel | caseUcfirst}}.fromMap(res.data){% else %} res.data{% endif %}; +{{ include('flutter/base/requests/api.twig') }} {% endif %} } {% endfor %} diff --git a/templates/flutter/lib/src/chunked_upload_io.dart.twig b/templates/flutter/lib/src/chunked_upload_io.dart.twig deleted file mode 100644 index 710b07c35a..0000000000 --- a/templates/flutter/lib/src/chunked_upload_io.dart.twig +++ /dev/null @@ -1,78 +0,0 @@ -import 'client.dart'; -import 'dart:io' as io; -import 'enums.dart'; -import 'package:http/http.dart' as http; -import 'response.dart'; -import 'dart:math'; -import 'input_file.dart'; -import 'exception.dart'; -import 'upload_progress.dart'; - -Future chunkedUpload({ - required Client client, - required String path, - required Map params, - required String paramName, - required String idParamName, - required Map headers, - Function(UploadProgress)? onProgress, -}) async { - InputFile file = params[paramName]; - if (file.path == null) { - throw AppwriteException("File path must be provided for dart:io"); - } - io.File iofile = io.File(file.path!); - final size = await iofile.length(); - - late Response res; - if (size <= Client.CHUNK_SIZE) { - params[paramName] = await http.MultipartFile.fromPath(paramName, file.path!, filename: file.filename); - return client.call( - HttpMethod.post, - path: path, - params: params, - headers: headers, - ); - } - - var offset = 0; - if(idParamName.isNotEmpty && params[idParamName] != 'unique()') { - //make a request to check if a file already exists - try { - res = await client.call( - HttpMethod.get, - path: path + '/' + params[idParamName], - headers: headers, - ); - final int chunksUploaded = res.data['chunksUploaded'] as int; - offset = min(size, chunksUploaded * Client.CHUNK_SIZE); - } on {{spec.title | caseUcfirst}}Exception catch (_) {} - } - // read chunk and upload each chunk - final raf = iofile.openSync(mode: io.FileMode.read); - - while (offset < size) { - raf.setPositionSync(offset); - final chunk = raf.readSync(Client.CHUNK_SIZE); - params[paramName] = - http.MultipartFile.fromBytes(paramName, chunk, filename: file.filename); - headers['content-range'] = - 'bytes $offset-${min(((offset + Client.CHUNK_SIZE) - 1), size)}/$size'; - res = await client.call(HttpMethod.post, - path: path, headers: headers, params: params); - offset += Client.CHUNK_SIZE; - if(offset < size) { - headers['x-{{spec.title | caseLower }}-id'] = res.data['\$id']; - } - final progress = UploadProgress( - $id: res.data['\$id'] ?? '', - progress: min(offset-1,size)/size * 100, - sizeUploaded: min(offset-1,size), - chunksTotal: res.data['chunksTotal'] ?? 0, - chunksUploaded: res.data['chunksUploaded'] ?? 0, - ); - onProgress?.call(progress); - } - raf.close(); - return res; -} diff --git a/templates/flutter/lib/src/chunked_upload_stub.dart.twig b/templates/flutter/lib/src/chunked_upload_stub.dart.twig deleted file mode 100644 index 79ff481edb..0000000000 --- a/templates/flutter/lib/src/chunked_upload_stub.dart.twig +++ /dev/null @@ -1,14 +0,0 @@ -import 'response.dart'; -import 'client.dart'; -import 'upload_progress.dart'; - -Future chunkedUpload({ - required Client client, - required String path, - required Map params, - required String paramName, - required String idParamName, - required Map headers, - Function(UploadProgress)? onProgress, -}) => - throw UnsupportedError('Cannot redirect to url without dart:html'); diff --git a/templates/flutter/lib/src/client.dart.twig b/templates/flutter/lib/src/client.dart.twig index 75bbfbcfc0..c910de109f 100644 --- a/templates/flutter/lib/src/client.dart.twig +++ b/templates/flutter/lib/src/client.dart.twig @@ -3,6 +3,7 @@ import 'client_stub.dart' if (dart.library.html) 'client_browser.dart' if (dart.library.io) 'client_io.dart'; import 'response.dart'; +import 'upload_progress.dart'; abstract class Client { static const int CHUNK_SIZE = 5*1024*1024; @@ -18,7 +19,16 @@ abstract class Client { bool selfSigned = false}) => createClient(endPoint: endPoint, selfSigned: selfSigned); - Future webAuth(Uri url); + Future webAuth(Uri url, {String? callbackUrlScheme}); + + Future chunkedUpload({ + required String path, + required Map params, + required String paramName, + required String idParamName, + required Map headers, + Function(UploadProgress)? onProgress, + }); Client setSelfSigned({bool status = true}); diff --git a/templates/flutter/lib/src/client_browser.dart.twig b/templates/flutter/lib/src/client_browser.dart.twig index 91f3ae1303..4f3fd0d739 100644 --- a/templates/flutter/lib/src/client_browser.dart.twig +++ b/templates/flutter/lib/src/client_browser.dart.twig @@ -1,13 +1,15 @@ -import 'dart:html' as html; +import 'dart:math'; import 'package:flutter/foundation.dart'; -import 'package:flutter_web_auth/flutter_web_auth.dart'; +import 'package:flutter_web_auth_2/flutter_web_auth_2.dart'; import 'package:http/http.dart' as http; import 'package:http/browser_client.dart'; +import 'package:universal_html/html.dart' as html; import 'client_mixin.dart'; import 'enums.dart'; import 'exception.dart'; import 'client_base.dart'; - +import 'input_file.dart'; +import 'upload_progress.dart'; import 'response.dart'; ClientBase createClient({ @@ -17,6 +19,7 @@ ClientBase createClient({ ClientBrowser(endPoint: endPoint, selfSigned: selfSigned); class ClientBrowser extends ClientBase with ClientMixin { + static const int CHUNK_SIZE = 5*1024*1024; String _endPoint; Map? _headers; @override @@ -37,7 +40,10 @@ class ClientBrowser extends ClientBase with ClientMixin { .replaceFirst('http://', 'ws://'); _headers = { 'content-type': 'application/json', - 'x-sdk-version': '{{spec.title | caseDash}}:{{ language.name | caseLower }}:{{ sdk.version }}', + 'x-sdk-name': '{{ sdk.name }}', + 'x-sdk-platform': '{{ sdk.platform }}', + 'x-sdk-language': '{{ language.name | caseLower }}', + 'x-sdk-version': '{{ sdk.version }}', {% for key,header in spec.global.defaultHeaders %} '{{key}}' : '{{header}}', {% endfor %} @@ -100,6 +106,73 @@ class ClientBrowser extends ClientBase with ClientMixin { _httpClient.withCredentials = true; } + @override + Future chunkedUpload({ + required String path, + required Map params, + required String paramName, + required String idParamName, + required Map headers, + Function(UploadProgress)? onProgress, + }) async { + InputFile file = params[paramName]; + if (file.bytes == null) { + throw {{spec.title | caseUcfirst}}Exception("File bytes must be provided for Flutter web"); + } + + int size = file.bytes!.length; + + late Response res; + if (size <= CHUNK_SIZE) { + params[paramName] = http.MultipartFile.fromBytes(paramName, file.bytes!, filename: file.filename); + return call( + HttpMethod.post, + path: path, + params: params, + headers: headers, + ); + } + + var offset = 0; + if (idParamName.isNotEmpty && params[idParamName] != 'unique()') { + //make a request to check if a file already exists + try { + res = await call( + HttpMethod.get, + path: path + '/' + params[idParamName], + headers: headers, + ); + final int chunksUploaded = res.data['chunksUploaded'] as int; + offset = min(size, chunksUploaded * CHUNK_SIZE); + } on {{spec.title | caseUcfirst}}Exception catch (_) {} + } + + while (offset < size) { + var chunk; + final end = min(offset + CHUNK_SIZE, size); + chunk = file.bytes!.getRange(offset, end).toList(); + params[paramName] = + http.MultipartFile.fromBytes(paramName, chunk, filename: file.filename); + headers['content-range'] = + 'bytes $offset-${min(((offset + CHUNK_SIZE) - 1), size)}/$size'; + res = await call(HttpMethod.post, + path: path, headers: headers, params: params); + offset += CHUNK_SIZE; + if (offset < size) { + headers['x-{{spec.title | caseLower }}-id'] = res.data['\$id']; + } + final progress = UploadProgress( + $id: res.data['\$id'] ?? '', + progress: min(offset - 1, size) / size * 100, + sizeUploaded: min(offset - 1, size), + chunksTotal: res.data['chunksTotal'] ?? 0, + chunksUploaded: res.data['chunksUploaded'] ?? 0, + ); + onProgress?.call(progress); + } + return res; + } + @override Future call( HttpMethod method, { @@ -138,8 +211,8 @@ class ClientBrowser extends ClientBase with ClientMixin { } @override - Future webAuth(Uri url) { - return FlutterWebAuth.authenticate( + Future webAuth(Uri url, {String? callbackUrlScheme}) { + return FlutterWebAuth2.authenticate( url: url.toString(), callbackUrlScheme: "appwrite-callback-" + config['project']!, ); diff --git a/templates/flutter/lib/src/client_io.dart.twig b/templates/flutter/lib/src/client_io.dart.twig index 78496d5e1f..ebba2cab4a 100644 --- a/templates/flutter/lib/src/client_io.dart.twig +++ b/templates/flutter/lib/src/client_io.dart.twig @@ -1,11 +1,12 @@ import 'dart:io'; +import 'dart:math'; import 'package:cookie_jar/cookie_jar.dart'; import 'package:device_info_plus/device_info_plus.dart'; import 'package:http/http.dart' as http; import 'package:http/io_client.dart'; import 'package:package_info_plus/package_info_plus.dart'; import 'package:path_provider/path_provider.dart'; -import 'package:flutter_web_auth/flutter_web_auth.dart'; +import 'package:flutter_web_auth_2/flutter_web_auth_2.dart'; import 'client_mixin.dart'; import 'client_base.dart'; import 'cookie_manager.dart'; @@ -14,6 +15,8 @@ import 'exception.dart'; import 'interceptor.dart'; import 'response.dart'; import 'package:flutter/foundation.dart'; +import 'input_file.dart'; +import 'upload_progress.dart'; ClientBase createClient({ required String endPoint, @@ -25,11 +28,13 @@ ClientBase createClient({ ); class ClientIO extends ClientBase with ClientMixin { + static const int CHUNK_SIZE = 5*1024*1024; String _endPoint; Map? _headers; @override late Map config; bool selfSigned; + bool _initProgress = false; bool _initialized = false; String? _endPointRealtime; late http.Client _httpClient; @@ -37,13 +42,14 @@ class ClientIO extends ClientBase with ClientMixin { late CookieJar _cookieJar; final List _interceptors = []; + bool get initProgress => _initProgress; bool get initialized => _initialized; CookieJar get cookieJar => _cookieJar; @override String? get endPointRealtime => _endPointRealtime; ClientIO({ - String endPoint = 'https://appwrite.io/v1', + String endPoint = '{{spec.endpoint}}', this.selfSigned = false, }) : _endPoint = endPoint { _nativeClient = HttpClient() @@ -55,7 +61,10 @@ class ClientIO extends ClientBase with ClientMixin { .replaceFirst('http://', 'ws://'); _headers = { 'content-type': 'application/json', - 'x-sdk-version': '{{spec.title | caseDash}}:{{ language.name | caseLower }}:{{ sdk.version }}', + 'x-sdk-name': '{{ sdk.name }}', + 'x-sdk-platform': '{{ sdk.platform }}', + 'x-sdk-language': '{{ language.name | caseLower }}', + 'x-sdk-version': '{{ sdk.version }}', {% for key,header in spec.global.defaultHeaders %} '{{key}}' : '{{header}}', {% endfor %} @@ -122,6 +131,8 @@ class ClientIO extends ClientBase with ClientMixin { } Future init() async { + if(_initProgress) return; + _initProgress = true; // if web skip cookie implementation and origin header as those are automatically handled by browsers final Directory cookieDir = await _getCookiePath(); _cookieJar = PersistCookieJar(storage: FileStorage(cookieDir.path)); @@ -164,6 +175,7 @@ class ClientIO extends ClientBase with ClientMixin { 'user-agent', '${packageInfo.packageName}/${packageInfo.version} $device'); _initialized = true; + _initProgress = false; } Future _interceptRequest(http.BaseRequest request) async { @@ -196,10 +208,106 @@ class ClientIO extends ClientBase with ClientMixin { } @override - Future webAuth(Uri url) { - return FlutterWebAuth.authenticate( + Future chunkedUpload({ + required String path, + required Map params, + required String paramName, + required String idParamName, + required Map headers, + Function(UploadProgress)? onProgress, + }) async { + InputFile file = params[paramName]; + if (file.path == null && file.bytes == null) { + throw {{spec.title | caseUcfirst}}Exception("File path or bytes must be provided"); + } + + int size = 0; + if (file.bytes != null) { + size = file.bytes!.length; + } + + File? iofile; + + if (file.path != null) { + iofile = File(file.path!); + size = await iofile.length(); + } + + late Response res; + if (size <= CHUNK_SIZE) { + if (file.path != null) { + params[paramName] = await http.MultipartFile.fromPath( + paramName, file.path!, + filename: file.filename); + } else { + params[paramName] = http.MultipartFile.fromBytes(paramName, file.bytes!, + filename: file.filename); + } + return call( + HttpMethod.post, + path: path, + params: params, + headers: headers, + ); + } + + var offset = 0; + if (idParamName.isNotEmpty && params[idParamName] != 'unique()') { + //make a request to check if a file already exists + try { + res = await call( + HttpMethod.get, + path: path + '/' + params[idParamName], + headers: headers, + ); + final int chunksUploaded = res.data['chunksUploaded'] as int; + offset = min(size, chunksUploaded * CHUNK_SIZE); + } on {{spec.title | caseUcfirst}}Exception catch (_) {} + } + + RandomAccessFile? raf; + // read chunk and upload each chunk + if (iofile != null) { + raf = await iofile.open(mode: FileMode.read); + } + + while (offset < size) { + var chunk; + if (file.bytes != null) { + final end = min(offset + CHUNK_SIZE-1, size-1); + chunk = file.bytes!.getRange(offset, end).toList(); + } else { + raf!.setPositionSync(offset); + chunk = raf.readSync(CHUNK_SIZE); + } + params[paramName] = + http.MultipartFile.fromBytes(paramName, chunk, filename: file.filename); + headers['content-range'] = + 'bytes $offset-${min(((offset + CHUNK_SIZE) - 1), size)}/$size'; + res = await call(HttpMethod.post, + path: path, headers: headers, params: params); + offset += CHUNK_SIZE; + if (offset < size) { + headers['x-{{spec.title | caseLower }}-id'] = res.data['\$id']; + } + final progress = UploadProgress( + $id: res.data['\$id'] ?? '', + progress: min(offset - 1, size) / size * 100, + sizeUploaded: min(offset - 1, size), + chunksTotal: res.data['chunksTotal'] ?? 0, + chunksUploaded: res.data['chunksUploaded'] ?? 0, + ); + onProgress?.call(progress); + } + raf?.close(); + return res; + } + + @override + Future webAuth(Uri url, {String? callbackUrlScheme}) { + return FlutterWebAuth2.authenticate( url: url.toString(), - callbackUrlScheme: "appwrite-callback-" + config['project']!, + callbackUrlScheme: callbackUrlScheme != null && Platform.isWindows ? callbackUrlScheme : "appwrite-callback-" + config['project']!, ).then((value) async { Uri url = Uri.parse(value); final key = url.queryParameters['key']; @@ -226,6 +334,9 @@ class ClientIO extends ClientBase with ClientMixin { Map params = const {}, ResponseType? responseType, }) async { + while (!_initialized && _initProgress) { + await Future.delayed(Duration(milliseconds: 10)); + } if (!_initialized) { await init(); } diff --git a/templates/flutter/lib/src/enums.dart.twig b/templates/flutter/lib/src/enums.dart.twig deleted file mode 100644 index 9f84bd9392..0000000000 --- a/templates/flutter/lib/src/enums.dart.twig +++ /dev/null @@ -1,19 +0,0 @@ -enum HttpMethod { get, post, put, delete, patch } - -extension HttpMethodString on HttpMethod { - String name() { - return toString().split('.').last.toUpperCase(); - } -} - -enum ResponseType { - /// Transform the response data to JSON object only when the - /// content-type of response is "application/json" . - json, - - /// Transform the response data to a String encoded with UTF8. - plain, - - /// Get original bytes, the type of response will be List - bytes -} diff --git a/templates/flutter/lib/src/exception.dart.twig b/templates/flutter/lib/src/exception.dart.twig deleted file mode 100644 index 2ff0c07b85..0000000000 --- a/templates/flutter/lib/src/exception.dart.twig +++ /dev/null @@ -1,14 +0,0 @@ -class {{spec.title | caseUcfirst}}Exception implements Exception { - final String? message; - final int? code; - final String? type; - final dynamic response; - - {{spec.title | caseUcfirst}}Exception([this.message = "", this.code, this.type, this.response]); - - @override - String toString() { - if (message == null) return "{{spec.title | caseUcfirst}}Exception"; - return "{{spec.title | caseUcfirst}}Exception: $type, $message (${code ?? 0})"; - } -} diff --git a/templates/flutter/lib/src/input_file.dart.twig b/templates/flutter/lib/src/input_file.dart.twig deleted file mode 100644 index 1b85e4ba84..0000000000 --- a/templates/flutter/lib/src/input_file.dart.twig +++ /dev/null @@ -1,9 +0,0 @@ -import 'package:http/http.dart' show MultipartFile; - -class InputFile { - final MultipartFile? file; - final String? path; - final String? filename; - - InputFile({this.file, this.path, this.filename}); -} diff --git a/templates/flutter/lib/src/models/model.dart.twig b/templates/flutter/lib/src/models/model.dart.twig deleted file mode 100644 index 56e2799f4b..0000000000 --- a/templates/flutter/lib/src/models/model.dart.twig +++ /dev/null @@ -1,60 +0,0 @@ -{% macro sub_schema(property) %}{% if property.sub_schema %}{% if property.type == 'array' %}List<{{property.sub_schema | caseUcfirst}}>{% else %}{{property.sub_schema | caseUcfirst}}{% endif %}{% else %}{% if property.type == 'object' and property.additionalProperties %}Map{% else %}{{property.type | typeName}}{% endif %}{% endif %}{% endmacro %} -part of {{ language.params.packageName }}.models; - -/// {{ definition.description }} -class {{ definition.name | caseUcfirst }} implements Model { -{% for property in definition.properties %} - /// {{ property.description }} - final {% if not property.required %}{{_self.sub_schema(property)}}? {{ property.name | escapeKeyword }}{% else %}{{_self.sub_schema(property)}} {{ property.name | escapeKeyword }}{% endif %}; -{% endfor %} -{% if definition.additionalProperties %} - final Map data; -{% endif %} - - {{ definition.name | caseUcfirst}}({ -{% for property in definition.properties %}{% if property.required %} - required {% endif %}this.{{ property.name | escapeKeyword }}, -{% endfor %} -{% if definition.additionalProperties %} - required this.data, -{% endif %} - }); - - factory {{ definition.name | caseUcfirst}}.fromMap(Map map) { - return {{ definition.name | caseUcfirst }}( -{% for property in definition.properties %} - {{ property.name | escapeKeyword }}: {% if property.sub_schema %}{% if property.type == 'array' %}List<{{property.sub_schema | caseUcfirst}}>.from(map['{{property.name | escapeDollarSign }}'].map((p) => {{property.sub_schema | caseUcfirst}}.fromMap(p))){% else %}{{property.sub_schema | caseUcfirst}}.fromMap(map['{{property.name | escapeDollarSign }}']){% endif %}{% else %}map['{{property.name | escapeDollarSign }}']{% if property.type == "number" %}{% if not property.required %}?{% endif %}.toDouble(){% endif %}{% if property.type == "string" %}{% if not property.required %}?{% endif %}.toString(){% endif %}{% endif %}, -{% endfor %} -{% if definition.additionalProperties %} - data: map, -{% endif %} - ); - } - - @override - Map toMap() { - return { -{% for property in definition.properties %} - "{{ property.name | escapeDollarSign }}": {% if property.sub_schema %}{% if property.type == 'array' %}{{property.name | escapeKeyword}}.map((p) => p.toMap()){% else %}{{property.name | escapeKeyword}}.toMap(){% endif %}{% else %}{{property.name | escapeKeyword }}{% endif %}, -{% endfor %} -{% if definition.additionalProperties %} - "data": data, -{% endif %} - }; - } -{% if definition.additionalProperties %} - - T convertTo(T Function(Map) fromJson) => fromJson(data); -{% endif %} -{% for property in definition.properties %} -{% if property.sub_schema %} -{% for def in spec.definitions %} -{% if def.name == property.sub_schema and def.additionalProperties and property.type == 'array' %} - - List convertTo(T Function(Map) fromJson) => - {{property.name}}.map((d) => d.convertTo(fromJson)).toList(); -{% endif %} -{% endfor %} -{% endif %} -{% endfor %} -} diff --git a/templates/flutter/lib/src/realtime_browser.dart.twig b/templates/flutter/lib/src/realtime_browser.dart.twig index d5599233ee..1567f64f9c 100644 --- a/templates/flutter/lib/src/realtime_browser.dart.twig +++ b/templates/flutter/lib/src/realtime_browser.dart.twig @@ -1,6 +1,6 @@ import 'dart:convert'; -import 'dart:html' as html; import 'dart:async'; +import 'package:universal_html/html.dart' as html; import 'package:web_socket_channel/html.dart'; import 'package:web_socket_channel/web_socket_channel.dart'; import 'realtime_subscription.dart'; diff --git a/templates/flutter/lib/src/realtime_io.dart.twig b/templates/flutter/lib/src/realtime_io.dart.twig index c82d7dcdae..819e938f0a 100644 --- a/templates/flutter/lib/src/realtime_io.dart.twig +++ b/templates/flutter/lib/src/realtime_io.dart.twig @@ -23,6 +23,9 @@ class RealtimeIO extends RealtimeBase with RealtimeMixin { Future _getWebSocket(Uri uri) async { Map? headers; + while (!(client as ClientIO).initialized && (client as ClientIO).initProgress) { + await Future.delayed(Duration(milliseconds: 10)); + } if (!(client as ClientIO).initialized) { await (client as ClientIO).init(); } diff --git a/templates/flutter/lib/src/realtime_message.dart.twig b/templates/flutter/lib/src/realtime_message.dart.twig index 1460fe461d..9e7b8793c9 100644 --- a/templates/flutter/lib/src/realtime_message.dart.twig +++ b/templates/flutter/lib/src/realtime_message.dart.twig @@ -5,7 +5,7 @@ class RealtimeMessage { final List events; final Map payload; final List channels; - final int timestamp; + final String timestamp; RealtimeMessage({ required this.events, required this.payload, @@ -17,7 +17,7 @@ class RealtimeMessage { List? events, Map? payload, List? channels, - int? timestamp, + String? timestamp, }) { return RealtimeMessage( events: events ?? this.events, diff --git a/templates/flutter/lib/src/response.dart.twig b/templates/flutter/lib/src/response.dart.twig deleted file mode 100644 index bf4eea3f1b..0000000000 --- a/templates/flutter/lib/src/response.dart.twig +++ /dev/null @@ -1,15 +0,0 @@ -import 'dart:convert'; - -class Response { - Response({this.data}); - - T? data; - - @override - String toString() { - if (data is Map) { - return json.encode(data); - } - return data.toString(); - } -} diff --git a/templates/flutter/lib/src/service.dart.twig b/templates/flutter/lib/src/service.dart.twig deleted file mode 100644 index 1ae319b705..0000000000 --- a/templates/flutter/lib/src/service.dart.twig +++ /dev/null @@ -1,7 +0,0 @@ -import 'client.dart'; - -class Service { - final Client client; - - const Service(this.client); -} diff --git a/templates/flutter/lib/src/upload_progress.dart.twig b/templates/flutter/lib/src/upload_progress.dart.twig deleted file mode 100644 index 4ed965d2dc..0000000000 --- a/templates/flutter/lib/src/upload_progress.dart.twig +++ /dev/null @@ -1,67 +0,0 @@ -import 'dart:convert'; - -class UploadProgress { - final String $id; - final double progress; - final int sizeUploaded; - final int chunksTotal; - final int chunksUploaded; - UploadProgress({ - required this.$id, - required this.progress, - required this.sizeUploaded, - required this.chunksTotal, - required this.chunksUploaded, - }); - - factory UploadProgress.fromMap(Map map) { - return UploadProgress( - $id: map['\$id'] ?? '', - progress: map['progress']?.toDouble() ?? 0.0, - sizeUploaded: map['sizeUploaded']?.toInt() ?? 0, - chunksTotal: map['chunksTotal']?.toInt() ?? 0, - chunksUploaded: map['chunksUploaded']?.toInt() ?? 0, - ); - } - - Map toMap() { - return { - "\$id": $id, - "progress": progress, - "sizeUploaded": sizeUploaded, - "chunksTotal": chunksTotal, - "chunksUploaded": chunksUploaded - }; - } - - String toJson() => json.encode(toMap()); - - factory UploadProgress.fromJson(String source) => - UploadProgress.fromMap(json.decode(source)); - - @override - String toString() { - return 'UploadProgress(\$id: ${$id}, progress: $progress, sizeUploaded: $sizeUploaded, chunksTotal: $chunksTotal, chunksUploaded: $chunksUploaded)'; - } - - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - - return other is UploadProgress && - other.$id == $id && - other.progress == progress && - other.sizeUploaded == sizeUploaded && - other.chunksTotal == chunksTotal && - other.chunksUploaded == chunksUploaded; - } - - @override - int get hashCode { - return $id.hashCode ^ - progress.hashCode ^ - sizeUploaded.hashCode ^ - chunksTotal.hashCode ^ - chunksUploaded.hashCode; - } -} diff --git a/templates/flutter/pubspec.yaml.twig b/templates/flutter/pubspec.yaml.twig index 8eca71c61a..5662e22d09 100644 --- a/templates/flutter/pubspec.yaml.twig +++ b/templates/flutter/pubspec.yaml.twig @@ -6,19 +6,21 @@ repository: https://github.com/{{sdk.gitUserName}}/{{sdk.gitRepoName}} issue_tracker: https://github.com/appwrite/sdk-generator/issues documentation: {{ spec.contactURL }} environment: - sdk: '>=2.14.0 <3.0.0' + sdk: '>=2.17.0 <3.0.0' + dependencies: flutter: sdk: flutter cookie_jar: ^3.0.1 - device_info_plus: ^3.2.2 - flutter_web_auth: ^0.4.1 - http: ^0.13.4 - package_info_plus: 1.4.2 - path_provider: ^2.0.9 + device_info_plus: ^8.0.0 + flutter_web_auth_2: ^2.0.2 + http: ^0.13.5 + package_info_plus: ^3.0.2 + path_provider: ^2.0.11 web_socket_channel: ^2.2.0 + universal_html: ^2.0.8 dev_dependencies: - flutter_lints: ^1.0.4 + flutter_lints: ^2.0.1 flutter_test: sdk: flutter diff --git a/templates/go/LICENSE.twig b/templates/go/LICENSE.twig index 0e8c361b49..854eb19494 100644 --- a/templates/go/LICENSE.twig +++ b/templates/go/LICENSE.twig @@ -1 +1 @@ -{{sdk.licenseContent}} \ No newline at end of file +{{sdk.licenseContent | raw}} \ No newline at end of file diff --git a/templates/go/base/params.twig b/templates/go/base/params.twig new file mode 100644 index 0000000000..cc62c584b4 --- /dev/null +++ b/templates/go/base/params.twig @@ -0,0 +1,14 @@ + params := map[string]interface{}{ +{% for parameter in method.parameters.query %} + "{{ parameter.name }}": {{ parameter.name | caseUcfirst }}, +{% endfor %} +{% for parameter in method.parameters.body %} + "{{ parameter.name }}": {{ parameter.name | caseUcfirst }}, +{% endfor %} + } + + headers := map[string]interface{}{ +{% for key, header in method.headers %} + "{{ key }}": "{{ header }}", +{% endfor %} + } \ No newline at end of file diff --git a/templates/go/base/requests/api.twig b/templates/go/base/requests/api.twig new file mode 100644 index 0000000000..034a836805 --- /dev/null +++ b/templates/go/base/requests/api.twig @@ -0,0 +1 @@ + return srv.client.Call("{{ method.method | caseUpper }}", path, headers, params) \ No newline at end of file diff --git a/templates/go/client.go.twig b/templates/go/client.go.twig index 12a286103d..9c9d5a9fd8 100644 --- a/templates/go/client.go.twig +++ b/templates/go/client.go.twig @@ -65,13 +65,16 @@ func NewClient() Client { headers := map[string]string{ {% for key,header in spec.global.defaultHeaders %} "{{key}}" : "{{header}}", - "x-sdk-version": "{{ sdk.gitUserName|url_encode }}:go:{{sdk.version}}", + "x-sdk-name": "{{ sdk.name }}", + "x-sdk-platform": "{{ sdk.platform }}", + "x-sdk-language": "{{ language.name | caseLower }}", + "x-sdk-version": "{{ sdk.version }}", {% endfor %} } httpClient, err := getDefaultClient(defaultTimeout) if err != nil { panic(err) } return Client { - endpoint: "https://{{ sdk.gitUserName|url_encode }}.io/v1", + endpoint: "{{spec.endpoint}}", client: httpClient, timeout: defaultTimeout, headers: headers, diff --git a/templates/go/docs/example.md.twig b/templates/go/docs/example.md.twig index 27597a0c5a..6894e830dc 100644 --- a/templates/go/docs/example.md.twig +++ b/templates/go/docs/example.md.twig @@ -9,9 +9,9 @@ import ( func main() { client := {{ spec.title | caseLower }}.NewClient() -{% if method.security|length > 0 %} +{% if method.auth|length > 0 %} client.SetEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint -{% for node in method.security %} +{% for node in method.auth %} {% for key,header in node|keys %} client.Set{{header}}("{{node[header]['x-{{ spec.title | caseLower }}']['demo']}}") // {{node[header].description}} {% endfor %} diff --git a/templates/go/services/service.go.twig b/templates/go/services/service.go.twig index ced53f707c..2ee676ef05 100644 --- a/templates/go/services/service.go.twig +++ b/templates/go/services/service.go.twig @@ -26,28 +26,16 @@ func New{{ service.name | caseUcfirst }}(clt Client) *{{ service.name | caseUcfi {% if method.description %}{{ ((method.name | caseUcfirst) ~ ' ' ~ method.description | caseLcfirst) | godocComment }}{% else %}// {{ method.name | caseUcfirst }}{% endif %} -func (srv *{{ service.name | caseUcfirst }}) {{ method.name | caseUcfirst }}({% if method.parameters.all|length > 0 %}{% for parameter in method.parameters.all %}{{ parameter.name | caseUcfirst }} {{ parameter.type | typeName }}{% if not loop.last %}, {% endif %}{% endfor %}{% endif %}) (*ClientResponse, error) { +func (srv *{{ service.name | caseUcfirst }}) {{ method.name | caseUcfirst }}({% if method.parameters.all|length > 0 %}{% for parameter in method.parameters.all %}{{ parameter.name | caseUcfirst }} {{ parameter | typeName }}{% if not loop.last %}, {% endif %}{% endfor %}{% endif %}) (*ClientResponse, error) { {% if method.parameters.path|length > 0 %} r := strings.NewReplacer({% for parameter in method.parameters.path %}"{{ '{' }}{{ parameter.name | caseCamel }}{{ '}' }}", {{ parameter.name | caseUcfirst }}{% if not loop.last %}, {% endif %}{% endfor %}) path := r.Replace("{{ method.path }}") + {% else %} path := "{{ method.path }}" + {% endif %} - - params := map[string]interface{}{ -{% for parameter in method.parameters.query %} - "{{ parameter.name }}": {{ parameter.name | caseUcfirst }}, -{% endfor %} -{% for parameter in method.parameters.body %} - "{{ parameter.name }}": {{ parameter.name | caseUcfirst }}, -{% endfor %} - } - - headers := map[string]interface{}{ -{% for key, header in method.headers %} - "{{ key }}": "{{ header }}", -{% endfor %} - } - return srv.client.Call("{{ method.method | caseUpper }}", path, headers, params) +{{include('go/base/params.twig')}} +{{include('go/base/requests/api.twig')}} } {% endfor %} \ No newline at end of file diff --git a/templates/graphql/docs/example.md.twig b/templates/graphql/docs/example.md.twig new file mode 100644 index 0000000000..7d6bcd51bb --- /dev/null +++ b/templates/graphql/docs/example.md.twig @@ -0,0 +1,81 @@ +{% macro getProperty(definitions, responseModel, depth) %} + {%~ for definition in definitions %} + {%~ if definition.name == responseModel %} + {%~ for property in definition.properties | filter(p => p.required) %} + {{ ("% " ~ depth * 4 ~ "s") |format("") }}{{ property.name | replace({'$': '_'}) }}{%~ if property.sub_schema %} {{ '{' }} + {{- '\n' -}} + {{- _self.getProperty(definitions, property.sub_schema, depth + 1) -}} + {{ ("% " ~ depth * 4 ~ "s") |format("") }}{{ ' }' }} + {%~ else %} + {{- '\n' -}} + {%~ endif %} + {%~ endfor %} + {%~ if definition.additionalProperties %} + {{ ("% " ~ depth * 4 ~ "s") |format("") }}data + {%~ endif %} + {%~ endif %} + {%~ endfor %} +{% endmacro %} +{% for key,header in method.headers %} +{% if header == 'multipart/form-data' %} +{% set boundary = 'cec8e8123c05ba25' %} +{{ method.method | caseUpper }} {{spec.basePath}}{{ method.path }} HTTP/1.1 +Host: {{ spec.host }} +{% for key, header in method.headers %} +{{ key | caseUcwords }}: {{ header }}{% if header == 'multipart/form-data' %}; boundary="{{boundary}}"{% endif ~%} +{% endfor %} +{% for key,header in spec.global.defaultHeaders %} +{{ key }}: {{ header }} +{% endfor %} +{% for node in method.security %} +{% for key,header in node | keys %} +{{ node[header]['name'] }}: {{ node[header]['x-appwrite']['demo'] }} +{% endfor %} +{% endfor %} +Content-Length: *Length of your entity body in bytes* + +--{{boundary}} +Content-Disposition: form-data; name="operations" + +{ "query": "mutation { {{ service.name | caseCamel }}{{ method.name | caseCamel | caseUcfirst }}({% for parameter in method.parameters.all | filter(p => p.required) %}{{ parameter.name | caseCamel }}: ${{ parameter.name | caseCamel }}{% if not loop.last %}, {% endif %}{% endfor %}) { id }" }, "variables": { {% for parameter in method.parameters.all | filter(p => p.required) %}"{{ parameter.name | caseCamel }}": {{ parameter | paramExample }}{% if not loop.last %}, {% endif %}{% endfor %} } } + +--{{boundary}} +Content-Disposition: form-data; name="map" + +{% set counter = 0 %} +{ {% for parameter in method.parameters.all | filter(p => p.required) %}{% if parameter.type == 'file' %}"{{ counter }}": ["variables.{{ parameter.name | caseCamel }}"]{% if not loop.last %}, {% endif %}{% set counter = counter + 1 %}{% endif %}{% endfor %} } + +{% set counter = 0 %} +{% for parameter in method.parameters.all | filter(p => p.required) %} +{% if parameter.type == 'file' %} +--{{ boundary }} +Content-Disposition: form-data; name="{{ counter }}"; filename="{{ parameter.name }}.ext" + +File contents + +{% set counter = counter + 1 %} +{% endif %} +{% endfor %} +--{{boundary}}-- +{% else %} +{%~ if method.method == 'get' %} +query { +{%~ else %} +mutation { +{%~ endif %} + {{ service.name | caseCamel }}{{ method.name | caseCamel | caseUcfirst }}{% if method.parameters.all | filter(p => p.required) | length == 0 %} {{ '{' }}{% else %}( + {%~ for parameter in method.parameters.all | filter(p => p.required) %} + {{ parameter.name | caseCamel }}: {{ parameter | paramExample }}{% if not loop.last %},{% endif %} + + {%~ endfor %} + ) {{ '{' }}{%~ endif %} + + {%~ if method.responseModel == 'none' or method.responseModel == '' %} + status + {%~ else %} + {{- _self.getProperty(spec.definitions, method.responseModel, 0) -}} + {%~ endif %} + } +} +{% endif %} +{% endfor %} \ No newline at end of file diff --git a/templates/kotlin/LICENSE.md.twig b/templates/kotlin/LICENSE.md.twig index 0e8c361b49..854eb19494 100644 --- a/templates/kotlin/LICENSE.md.twig +++ b/templates/kotlin/LICENSE.md.twig @@ -1 +1 @@ -{{sdk.licenseContent}} \ No newline at end of file +{{sdk.licenseContent | raw}} \ No newline at end of file diff --git a/templates/kotlin/base/requests/api.twig b/templates/kotlin/base/requests/api.twig new file mode 100644 index 0000000000..a823ba5069 --- /dev/null +++ b/templates/kotlin/base/requests/api.twig @@ -0,0 +1,14 @@ + return client.call( + "{{ method.method | caseUpper }}", + path, + headers, + params, + {%~ if method.responseModel | hasGenericType(spec) %} + responseType = classOf(), + {%~ else %} + responseType = {{ method | returnType(spec, sdk.namespace | caseDot) | raw }}::class.java, + {%~ endif %} + {%~ if method.responseModel %} + converter, + {%~ endif %} + ) \ No newline at end of file diff --git a/templates/kotlin/base/requests/file.twig b/templates/kotlin/base/requests/file.twig new file mode 100644 index 0000000000..4da9ef84dd --- /dev/null +++ b/templates/kotlin/base/requests/file.twig @@ -0,0 +1,19 @@ + val idParamName: String? = {% if method.parameters.all | filter(p => p.isUploadID) | length > 0 %}{% for parameter in method.parameters.all | filter(parameter => parameter.isUploadID) %}"{{ parameter.name }}"{% endfor %}{% else %}null{% endif %} + + {%~ for parameter in method.parameters.all %} + {%~ if parameter.type == 'file' %} + val paramName = "{{ parameter.name }}" + {%~ endif %} + {%~ endfor %} + return client.chunkedUpload( + path, + headers, + params, + responseType = {{ method | returnType(spec, sdk.namespace | caseDot) | raw }}::class.java, + {%~ if method.responseModel %} + converter, + {%~ endif %} + paramName, + idParamName, + onProgress, + ) \ No newline at end of file diff --git a/templates/kotlin/base/requests/location.twig b/templates/kotlin/base/requests/location.twig new file mode 100644 index 0000000000..df3f671719 --- /dev/null +++ b/templates/kotlin/base/requests/location.twig @@ -0,0 +1,6 @@ + return client.call( + "{{ method.method | caseUpper }}", + path, + params = params, + responseType = {{ method | returnType(spec, sdk.namespace | caseDot) | raw }}::class.java + ) \ No newline at end of file diff --git a/templates/kotlin/docs/java/example.md.twig b/templates/kotlin/docs/java/example.md.twig index 62d3daaa72..0e70d06879 100644 --- a/templates/kotlin/docs/java/example.md.twig +++ b/templates/kotlin/docs/java/example.md.twig @@ -1,68 +1,43 @@ -import {{ sdk.namespace | caseDot }}.Client -import {{ sdk.namespace | caseDot }}.services.{{ service.name | caseUcfirst }} +import {{ sdk.namespace | caseDot }}.Client; +import {{ sdk.namespace | caseDot }}.coroutines.CoroutineCallback; +{% if method.parameters.all | filter((param) => param.type == 'file') | length > 0 %} +import {{ sdk.namespace | caseDot }}.models.InputFile; +{% endif %} +import {{ sdk.namespace | caseDot }}.services.{{ service.name | caseUcfirst }}; -public void main() { - Client client = Client(context) -{% if method.security|length > 0 %} - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint -{% for node in method.security %} +Client client = new Client() +{% if method.auth|length > 0 %} + .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint +{% for node in method.auth %} {% for key,header in node|keys %} - .set{{header | caseUcfirst}}("{{node[header]['x-appwrite']['demo']}}"){% if loop.last %};{% endif %} // {{node[header].description}} + .set{{header | caseUcfirst}}("{{node[header]['x-appwrite']['demo']}}"){% if loop.last %};{% endif %} // {{node[header].description}} {% endfor %}{% endfor %}{% endif %} - {{ service.name | caseUcfirst }} {{ service.name | caseCamel }} = new {{ service.name | caseUcfirst }}(client); - {{ service.name | caseCamel }}.{{ method.name | caseCamel }}({% if method.parameters.all | length == 0 %}new Continuation() { - @NotNull - @Override - public CoroutineContext getContext() { - return EmptyCoroutineContext.INSTANCE; - } +{{ service.name | caseUcfirst }} {{ service.name | caseCamel }} = new {{ service.name | caseUcfirst }}(client); - @Override - public void resumeWith(@NotNull Object o) { - String json = ""; - try { - if (o instanceof Result.Failure) { - Result.Failure failure = (Result.Failure) o; - throw failure.exception; - } else { - Response response = (Response) o; - } - } catch (Throwable th) { - Log.e("ERROR", th.toString()); - } - } - });{% endif %} +{{ service.name | caseCamel }}.{{ method.name | caseCamel }}({% if method.parameters.all | length == 0 %}new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); +}));{% endif %} {% for parameter in method.parameters.all %} {% if parameter.required %} - {{parameter.name}} = {{ parameter | paramExample }}{% if not loop.last %},{% endif %} + {{ parameter | paramExample }}{% if not loop.last %},{% endif %} {% endif %} {% if loop.last %} - new Continuation() { - @NotNull - @Override - public CoroutineContext getContext() { - return EmptyCoroutineContext.INSTANCE; - } - - @Override - public void resumeWith(@NotNull Object o) { - String json = ""; - try { - if (o instanceof Result.Failure) { - Result.Failure failure = (Result.Failure) o; - throw failure.exception; - } else { - Response response = (Response) o; - } - } catch (Throwable th) { - Log.e("ERROR", th.toString()); - } - } + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; } - ); + + System.out.println(result); + }) +); {% endif %} -{% endfor %} -} \ No newline at end of file +{% endfor %} \ No newline at end of file diff --git a/templates/kotlin/docs/kotlin/example.md.twig b/templates/kotlin/docs/kotlin/example.md.twig index cc22e912a6..9176c6a142 100644 --- a/templates/kotlin/docs/kotlin/example.md.twig +++ b/templates/kotlin/docs/kotlin/example.md.twig @@ -1,27 +1,27 @@ import {{ sdk.namespace | caseDot }}.Client +{% if method.parameters.all | filter((param) => param.type == 'file') | length > 0 %} +import {{ sdk.namespace | caseDot }}.models.InputFile +{% endif %} import {{ sdk.namespace | caseDot }}.services.{{ service.name | caseUcfirst }} -suspend fun main() { - val client = Client(context) -{% if method.security|length > 0 %} - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint -{% for node in method.security %} +val client = Client(context) +{% if method.auth|length > 0 %} + .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint +{% for node in method.auth %} {% for key,header in node|keys %} - .set{{header | caseUcfirst}}("{{node[header]['x-appwrite']['demo']}}") // {{node[header].description}} + .set{{header | caseUcfirst}}("{{node[header]['x-appwrite']['demo']}}") // {{node[header].description}} {% endfor %}{% endfor %}{% endif %} - val {{ service.name | caseCamel }} = {{ service.name | caseUcfirst }}(client) -{% if method.type == 'webAuth' %} {% elseif method.type == 'location' %} val result = {% else %} val response = {% endif %}{{ service.name | caseCamel }}.{{ method.name | caseCamel }}({% if method.parameters.all | length == 0 %}){% endif %} +val {{ service.name | caseCamel }} = {{ service.name | caseUcfirst }}(client) + +{% if method.type == 'webAuth' %}{% elseif method.type == 'location' %}val result = {% else %}val response = {% endif %}{{ service.name | caseCamel }}.{{ method.name | caseCamel }}({% if method.parameters.all | length == 0 %}){% endif %} {% for parameter in method.parameters.all %} {% if parameter.required %} - {{parameter.name}} = {{ parameter | paramExample }}{% if not loop.last %},{% endif %} + {{parameter.name}} = {{ parameter | paramExample }}{% if not loop.last %},{% endif %} {% endif %} {% if loop.last %} - ) +) {% endif %} -{% endfor %} -{% if method.type == 'webAuth' %}{% elseif method.type == 'location' %} println(result); // Resource URL{% else %} val json = response.body?.string(){% endif %} - -} \ No newline at end of file +{% endfor %} \ No newline at end of file diff --git a/templates/kotlin/src/main/kotlin/io/appwrite/Client.kt.twig b/templates/kotlin/src/main/kotlin/io/appwrite/Client.kt.twig index 672ac26d01..280c7407e4 100644 --- a/templates/kotlin/src/main/kotlin/io/appwrite/Client.kt.twig +++ b/templates/kotlin/src/main/kotlin/io/appwrite/Client.kt.twig @@ -5,6 +5,7 @@ import com.google.gson.reflect.TypeToken import {{ sdk.namespace | caseDot }}.exceptions.{{ spec.title | caseUcfirst }}Exception import {{ sdk.namespace | caseDot }}.extensions.fromJson import {{ sdk.namespace | caseDot }}.json.PreciseNumberAdapter +import {{ sdk.namespace | caseDot }}.models.InputFile import {{ sdk.namespace | caseDot }}.models.UploadProgress import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers @@ -33,7 +34,7 @@ import kotlin.coroutines.CoroutineContext import kotlin.coroutines.resume class Client @JvmOverloads constructor( - var endPoint: String = "https://appwrite.io/v1", + var endPoint: String = "{{spec.endpoint}}", private var selfSigned: Boolean = false ) : CoroutineScope { @@ -61,7 +62,10 @@ class Client @JvmOverloads constructor( init { headers = mutableMapOf( "content-type" to "application/json", - "x-sdk-version" to "{{spec.title | caseDash}}:{{ language.name | caseLower }}:${BuildConfig.SDK_VERSION}"{% if spec.global.defaultHeaders | length > 0 %},{% endif %} + "x-sdk-name" to "{{ sdk.name }}", + "x-sdk-platform" to "{{ sdk.platform }}", + "x-sdk-language" to "{{ language.name | caseLower }}", + "x-sdk-version" to "{{ sdk.version }}"{% if spec.global.defaultHeaders | length > 0 %},{% endif %} {% for key,header in spec.global.defaultHeaders %} "{{ key | caseLower }}" to "{{ header }}"{% if not loop.last %},{% endif %} @@ -185,7 +189,7 @@ class Client @JvmOverloads constructor( headers: Map = mapOf(), params: Map = mapOf(), responseType: Class, - converter: ((Map) -> T)? = null + converter: ((Any) -> T)? = null ): T { val filteredParams = params.filterValues { it != null } @@ -276,19 +280,34 @@ class Client @JvmOverloads constructor( headers: MutableMap, params: MutableMap, responseType: Class, - converter: ((Map) -> T), + converter: ((Any) -> T), paramName: String, idParamName: String? = null, onProgress: ((UploadProgress) -> Unit)? = null, ): T { - val file = params[paramName] as File - val size = file.length() + var file: RandomAccessFile? = null + val input = params[paramName] as InputFile + val size: Long = when(input.sourceType) { + "path", "file" -> { + file = RandomAccessFile(input.path, "r") + file.length() + } + "bytes" -> { + (input.data as ByteArray).size.toLong() + } + else -> throw UnsupportedOperationException() + } if (size < CHUNK_SIZE) { + val data = when(input.sourceType) { + "file", "path" -> File(input.path).asRequestBody() + "bytes" -> (input.data as ByteArray).toRequestBody(input.mimeType.toMediaType()) + else -> throw UnsupportedOperationException() + } params[paramName] = MultipartBody.Part.createFormData( paramName, - file.name, - file.asRequestBody() + input.filename, + data ) return call( method = "POST", @@ -300,7 +319,6 @@ class Client @JvmOverloads constructor( ) } - val input = RandomAccessFile(file, "r") val buffer = ByteArray(CHUNK_SIZE) var offset = 0L var result: Map<*, *>? = null @@ -319,12 +337,29 @@ class Client @JvmOverloads constructor( } while (offset < size) { - input.seek(offset) - input.read(buffer) + when(input.sourceType) { + "file", "path" -> { + file!!.seek(offset) + file!!.read(buffer) + } + "bytes" -> { + val end = if (offset + CHUNK_SIZE < size) { + offset + CHUNK_SIZE + } else { + size - 1 + } + (input.data as ByteArray).copyInto( + buffer, + startIndex = offset.toInt(), + endIndex = end.toInt() + ) + } + else -> throw UnsupportedOperationException() + } params[paramName] = MultipartBody.Part.createFormData( paramName, - file.name, + input.filename, buffer.toRequestBody() ) @@ -368,7 +403,7 @@ class Client @JvmOverloads constructor( private suspend fun awaitResponse( request: Request, responseType: Class, - converter: ((Map) -> T)? = null + converter: ((Any) -> T)? = null ) = suspendCancellableCoroutine { http.newCall(request).enqueue(object : Callback { override fun onFailure(call: Call, e: IOException) { diff --git a/templates/kotlin/src/main/kotlin/io/appwrite/ID.kt.twig b/templates/kotlin/src/main/kotlin/io/appwrite/ID.kt.twig new file mode 100644 index 0000000000..3ac3c98b04 --- /dev/null +++ b/templates/kotlin/src/main/kotlin/io/appwrite/ID.kt.twig @@ -0,0 +1,10 @@ +package {{ sdk.namespace | caseDot }} + +class ID { + companion object { + fun custom(id: String): String + = id + fun unique(): String + = "unique()" + } +} \ No newline at end of file diff --git a/templates/kotlin/src/main/kotlin/io/appwrite/Permission.kt.twig b/templates/kotlin/src/main/kotlin/io/appwrite/Permission.kt.twig new file mode 100644 index 0000000000..33e5b741c9 --- /dev/null +++ b/templates/kotlin/src/main/kotlin/io/appwrite/Permission.kt.twig @@ -0,0 +1,21 @@ +package {{ sdk.namespace | caseDot }} + +class Permission { + companion object { + fun read(role: String): String { + return "read(\"${role}\")" + } + fun write(role: String): String { + return "write(\"${role}\")" + } + fun create(role: String): String { + return "create(\"${role}\")" + } + fun update(role: String): String { + return "update(\"${role}\")" + } + fun delete(role: String): String { + return "delete(\"${role}\")" + } + } +} \ No newline at end of file diff --git a/templates/kotlin/src/main/kotlin/io/appwrite/Query.kt.twig b/templates/kotlin/src/main/kotlin/io/appwrite/Query.kt.twig index 9a0c2f3bb1..7103c1bc2a 100644 --- a/templates/kotlin/src/main/kotlin/io/appwrite/Query.kt.twig +++ b/templates/kotlin/src/main/kotlin/io/appwrite/Query.kt.twig @@ -6,20 +6,32 @@ class Query { fun notEqual(attribute: String, value: Any) = Query.addQuery(attribute, "notEqual", value) - fun lesser(attribute: String, value: Any) = Query.addQuery(attribute, "lesser", value) + fun lessThan(attribute: String, value: Any) = Query.addQuery(attribute, "lessThan", value) - fun lesserEqual(attribute: String, value: Any) = Query.addQuery(attribute, "lesserEqual", value) + fun lessThanEqual(attribute: String, value: Any) = Query.addQuery(attribute, "lessThanEqual", value) - fun greater(attribute: String, value: Any) = Query.addQuery(attribute, "greater", value) - - fun greaterEqual(attribute: String, value: Any) = Query.addQuery(attribute, "greaterEqual", value) + fun greaterThan(attribute: String, value: Any) = Query.addQuery(attribute, "greaterThan", value) + fun greaterThanEqual(attribute: String, value: Any) = Query.addQuery(attribute, "greaterThanEqual", value) + fun search(attribute: String, value: String) = Query.addQuery(attribute, "search", value) - private fun addQuery(attribute: String, oper: String, value: Any): String { + fun orderAsc(attribute: String) = "orderAsc(\"${attribute}\")" + + fun orderDesc(attribute: String) = "orderDesc(\"${attribute}\")" + + fun cursorBefore(documentId: String) = "cursorBefore(\"${documentId}\")" + + fun cursorAfter(documentId: String) = "cursorAfter(\"${documentId}\")" + + fun limit(limit: Int) = "limit(${limit})" + + fun offset(offset: Int) = "offset(${offset})" + + private fun addQuery(attribute: String, method: String, value: Any): String { return when (value) { - is List<*> -> "${attribute}.${oper}(${value.map{it -> parseValues(it!!)}.joinToString(",")})" - else -> "${attribute}.${oper}(${Query.parseValues(value)})" + is List<*> -> "${method}(\"${attribute}\", [${value.map{it -> parseValues(it!!)}.joinToString(",")}])" + else -> "${method}(\"${attribute}\", [${Query.parseValues(value)}])" } } private fun parseValues(value: Any): String { diff --git a/templates/kotlin/src/main/kotlin/io/appwrite/Role.kt.twig b/templates/kotlin/src/main/kotlin/io/appwrite/Role.kt.twig new file mode 100644 index 0000000000..d5f59c3a64 --- /dev/null +++ b/templates/kotlin/src/main/kotlin/io/appwrite/Role.kt.twig @@ -0,0 +1,29 @@ +package {{ sdk.namespace | caseDot }} + +class Role { + companion object { + fun any(): String = "any" + + fun user(id: String, status: String = ""): String = if(status.isEmpty()) { + "user:$id" + } else { + "user:$id/$status" + } + + fun users(status: String = ""): String = if(status.isEmpty()) { + "users" + } else { + "users/$status" + } + + fun guests(): String = "guests" + + fun team(id: String, role: String = ""): String = if(role.isEmpty()) { + "team:$id" + } else { + "team:$id/$role" + } + + fun member(id: String): String = "member:$id" + } +} \ No newline at end of file diff --git a/templates/kotlin/src/main/kotlin/io/appwrite/coroutines/Callback.kt.twig b/templates/kotlin/src/main/kotlin/io/appwrite/coroutines/Callback.kt.twig new file mode 100644 index 0000000000..279be06c39 --- /dev/null +++ b/templates/kotlin/src/main/kotlin/io/appwrite/coroutines/Callback.kt.twig @@ -0,0 +1,18 @@ +package {{ sdk.namespace | caseDot }}.coroutines + +import kotlinx.coroutines.Dispatchers +import kotlin.coroutines.Continuation +import kotlin.coroutines.CoroutineContext + +interface Callback { + fun onComplete(result: T?, error: Throwable?) +} + +class CoroutineCallback @JvmOverloads constructor( + private val callback: Callback, + override val context: CoroutineContext = Dispatchers.Default +) : Continuation { + override fun resumeWith(result: Result) { + callback.onComplete(result.getOrNull(), result.exceptionOrNull()) + } +} \ No newline at end of file diff --git a/templates/kotlin/src/main/kotlin/io/appwrite/extensions/TypeExtensions.kt.twig b/templates/kotlin/src/main/kotlin/io/appwrite/extensions/TypeExtensions.kt.twig new file mode 100644 index 0000000000..60ae417882 --- /dev/null +++ b/templates/kotlin/src/main/kotlin/io/appwrite/extensions/TypeExtensions.kt.twig @@ -0,0 +1,8 @@ +package {{ sdk.namespace | caseDot }}.extensions + +import kotlin.reflect.KClass +import kotlin.reflect.typeOf + +inline fun classOf(): Class { + return (typeOf().classifier!! as KClass).java +} \ No newline at end of file diff --git a/templates/kotlin/src/main/kotlin/io/appwrite/models/InputFile.kt.twig b/templates/kotlin/src/main/kotlin/io/appwrite/models/InputFile.kt.twig new file mode 100644 index 0000000000..382267a0d0 --- /dev/null +++ b/templates/kotlin/src/main/kotlin/io/appwrite/models/InputFile.kt.twig @@ -0,0 +1,37 @@ +package {{ sdk.namespace | caseDot }}.models + +import java.io.File +import java.net.URLConnection +import java.nio.file.Files +import java.nio.file.Paths + +class InputFile private constructor() { + + lateinit var path: String + lateinit var filename: String + lateinit var mimeType: String + lateinit var sourceType: String + lateinit var data: Any + + companion object { + fun fromFile(file: File) = InputFile().apply { + path = file.canonicalPath + filename = file.name + mimeType = Files.probeContentType(Paths.get(file.canonicalPath)) + ?: URLConnection.guessContentTypeFromName(filename) + ?: "" + sourceType = "file" + } + + fun fromPath(path: String): InputFile = fromFile(File(path)).apply { + sourceType = "path" + } + + fun fromBytes(bytes: ByteArray, filename: String = "", mimeType: String = "") = InputFile().apply { + this.filename = filename + this.mimeType = mimeType + data = bytes + sourceType = "bytes" + } + } +} \ No newline at end of file diff --git a/templates/kotlin/src/main/kotlin/io/appwrite/models/Model.kt.twig b/templates/kotlin/src/main/kotlin/io/appwrite/models/Model.kt.twig index 90775de2cf..6b049555cb 100644 --- a/templates/kotlin/src/main/kotlin/io/appwrite/models/Model.kt.twig +++ b/templates/kotlin/src/main/kotlin/io/appwrite/models/Model.kt.twig @@ -1,62 +1,71 @@ -{% macro sub_schema(property) %}{% if property.sub_schema %}{% if property.type == 'array' %}List<{{property.sub_schema | caseUcfirst}}>{% else %}{{property.sub_schema | caseUcfirst}}{% endif %}{% else %}{% if property.type == 'object' and property.additionalProperties %}Map{% else %}{{property.type | typeName}}{% endif %}{% endif %}{% endmacro %} package {{ sdk.namespace | caseDot }}.models import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast /** * {{ definition.description }} */ -data class {{ definition.name | caseUcfirst }}( -{% for property in definition.properties %} +{% if definition.properties | length != 0 or definition.additionalProperties %}data {% endif %}class {{ definition | modelType(spec) | raw }}( + {%~ for property in definition.properties %} /** * {{ property.description }} - * */ @SerializedName("{{ property.name | escapeKeyword | escapeDollarSign}}") - {% if property.required %}val{% else%}var{% endif %} {{ property.name | escapeKeyword | removeDollarSign }}: {{_self.sub_schema(property)}}{% if not property.required %}?{% endif %}{% if not loop.last or (loop.last and definition.additionalProperties) %},{{ "\n" }}{% endif %} + {% if property.required -%} val + {%- else -%} var + {%- endif %} {{ property.name | escapeKeyword | removeDollarSign }}: {{ property | propertyType(spec) | raw }}, -{% endfor %} -{% if definition.additionalProperties %} - val data: Map -{% endif %} + {%~ endfor %} + {%~ if definition.additionalProperties %} + /** + * Additional properties + */ + @SerializedName("data") + val data: T + {%~ endif %} ) { - companion object { - @Suppress("UNCHECKED_CAST") - fun from(map: Map) = {{ definition.name | caseUcfirst }}( -{% for property in definition.properties %} - {{ property.name | escapeKeyword | removeDollarSign }} = {% if property.sub_schema %}{% if property.type == 'array' %}(map["{{ property.name | escapeDollarSign }}"] as List>).map { {{property.sub_schema | caseUcfirst}}.from(map = it) }{% else %}{{property.sub_schema | caseUcfirst}}.from(map = map["{{property.name | escapeDollarSign }}"] as Map){% endif %}{% else %}{% if property.type == "integer" or property.type == "number" %}({% endif %}map["{{ property.name | escapeDollarSign }}"]{% if property.type == "integer" or property.type == "number" %} as{% if not property.required %}?{% endif %} Number){% endif %}{% if property.type == "integer" %}{% if not property.required %}?{% endif %}.toLong(){% elseif property.type == "number" %}{% if not property.required %}?{% endif %}.toDouble(){% else %} as{% if not property.required %}?{% endif %} {{ _self.sub_schema(property) }}{% endif %}{% endif %}{% if not loop.last or (loop.last and definition.additionalProperties) %},{% endif %} - -{% endfor %} -{% if definition.additionalProperties %} - data = map -{% endif %} - ) - } - fun toMap(): Map = mapOf( -{% for property in definition.properties %} - "{{ property.name | escapeDollarSign }}" to {% if property.sub_schema %}{% if property.type == 'array' %}{{property.name | escapeKeyword | removeDollarSign}}.map { it.toMap() }{% else %}{{property.name | escapeKeyword | removeDollarSign}}.toMap(){% endif %}{% else %}{{property.name | escapeKeyword | removeDollarSign}}{% endif %} as Any{% if not loop.last or (loop.last and definition.additionalProperties) %},{% endif %} - -{% endfor %} -{% if definition.additionalProperties %} - "data" to data -{% endif %} + {%~ for property in definition.properties %} + "{{ property.name | escapeDollarSign }}" to {% if property.sub_schema %}{% if property.type == 'array' %}{{property.name | escapeKeyword | removeDollarSign}}.map { it.toMap() }{% else %}{{property.name | escapeKeyword | removeDollarSign}}.toMap(){% endif %}{% else %}{{property.name | escapeKeyword | removeDollarSign}}{% endif %} as Any, + {%~ endfor %} + {%~ if definition.additionalProperties %} + "data" to data!!.jsonCast(to = Map::class.java) + {%~ endif %} ) -{% if definition.additionalProperties %} - fun convertTo(fromJson: (Map) -> T): T { - return fromJson(data) - } -{% endif %} -{% for property in definition.properties %} -{% if property.sub_schema %} -{% for def in spec.definitions %} -{% if def.name == property.sub_schema and def.additionalProperties and property.type == 'array' %} + companion object { + {%~ if definition.name | hasGenericType(spec) %} + operator fun invoke( + {%~ for property in definition.properties %} + {{ property.name | escapeKeyword | removeDollarSign }}: {{ property | propertyType(spec, 'Map') | raw }}, + {%~ endfor %} + {%~ if definition.additionalProperties %} + data: Map + {%~ endif %} + ) = {{ definition | modelType(spec, 'Map') | raw }}( + {%~ for property in definition.properties %} + {{ property.name | escapeKeyword | removeDollarSign }}, + {%~ endfor %} + {%~ if definition.additionalProperties %} + data + {%~ endif %} + ) + {%~ endif %} - fun convertTo(fromJson: (Map) -> T) = - {{property.name | removeDollarSign}}.map { it.convertTo(fromJson = fromJson) } -{% endif %} -{% endfor %} -{% endif %} -{% endfor %} + @Suppress("UNCHECKED_CAST") + fun {% if definition.name | hasGenericType(spec) %} {% endif %}from( + map: Map, + {%~ if definition.name | hasGenericType(spec) %} + nestedType: Class + {%~ endif %} + ) = {{ definition | modelType(spec) | raw }}( + {%~ for property in definition.properties %} + {{ property.name | escapeKeyword | removeDollarSign }} = {% if property.sub_schema %}{% if property.type == 'array' %}(map["{{ property.name | escapeDollarSign }}"] as List>).map { {{ property.sub_schema | caseUcfirst }}.from(map = it{% if definition.name | hasGenericType(spec) %}, nestedType{% endif %}) }{% else %}{{ property.sub_schema | caseUcfirst }}.from(map = map["{{property.name | escapeDollarSign }}"] as Map{% if definition.name | hasGenericType(spec) %}, nestedType{% endif %}){% endif %}{% else %}{% if property.type == "integer" or property.type == "number" %}({% endif %}map["{{ property.name | escapeDollarSign }}"]{% if property.type == "integer" or property.type == "number" %} as{% if not property.required %}?{% endif %} Number){% endif %}{% if property.type == "integer" %}{% if not property.required %}?{% endif %}.toLong(){% elseif property.type == "number" %}{% if not property.required %}?{% endif %}.toDouble(){% else %} as{% if not property.required %}?{% endif %} {{ property | propertyType(spec) | raw }}{% endif %}{% endif %}, + {%~ endfor %} + {%~ if definition.additionalProperties %} + data = map.jsonCast(to = nestedType) + {%~ endif %} + ) + } } \ No newline at end of file diff --git a/templates/kotlin/src/main/kotlin/io/appwrite/services/ServiceTemplate.kt.twig b/templates/kotlin/src/main/kotlin/io/appwrite/services/ServiceTemplate.kt.twig index d8d9662344..00ce691ab2 100644 --- a/templates/kotlin/src/main/kotlin/io/appwrite/services/ServiceTemplate.kt.twig +++ b/templates/kotlin/src/main/kotlin/io/appwrite/services/ServiceTemplate.kt.twig @@ -1,159 +1,126 @@ -{% macro parameter(parameter) %}{{ parameter.name | caseCamel }}: {{ parameter.type | typeName }}{% if not parameter.required %}? = null{% endif %}{% endmacro %} -{% macro method_parameters(parameters, consumes) %} -{% if parameters.all|length > 0 %}{% for parameter in parameters.all %}{{ '\n\t\t' }}{{ _self.parameter(parameter) }}{% if not loop.last %}{{ ',' }}{% endif %}{% endfor %}{% if 'multipart/form-data' in consumes %}, onProgress: ((UploadProgress) -> Unit)? = null{% endif %}{% endif %} -{% endmacro %} -{% macro methodNeedsSecurityParameters(method) %} -{% if (method.type == "webAuth" or method.type == "location") and method.security|length > 0 %}{{ true }}{% else %}{{false}}{% endif %} -{% endmacro %} -{% macro resultType(namespace, method) %} -{% if method.type == "webAuth" %}Bool{% elseif method.type == "location" %}ByteArray{% elseif not method.responseModel or method.responseModel == 'any' %}Any{% else %}{{ namespace | caseDot}}.models.{{method.responseModel | caseUcfirst}}{% endif %} -{% endmacro %} package {{ sdk.namespace | caseDot }}.services + import {{ sdk.namespace | caseDot }}.Client import {{ sdk.namespace | caseDot }}.models.* -{% if service.features.webAuth %} -import {{ sdk.namespace | caseDot }}.WebAuthComponent -import androidx.activity.ComponentActivity -{% endif %} import {{ sdk.namespace | caseDot }}.exceptions.{{ spec.title | caseUcfirst }}Exception +import {{ sdk.namespace | caseDot }}.extensions.classOf import okhttp3.Cookie -import okhttp3.Response -{% if (service.features.webAuth or service.features.location) %} +{% if service.features.location %} import okhttp3.HttpUrl import okhttp3.HttpUrl.Companion.toHttpUrl {% endif %} import java.io.File -class {{ service.name | caseUcfirst }}(client: Client) : Service(client) { +/** + * {{ service.description | raw | replace({"\n": "", "\r": ""}) }} +**/ +class {{ service.name | caseUcfirst }} : Service { + + public constructor (client: Client) : super(client) { } {% for method in service.methods %} /** * {{ method.title }} * -{% if method.description %} -{{ method.description|comment1 }} + * {{ method.description | raw | replace({"\n": "", "\r": ""}) }} * -{% endif %} -{% for parameter in method.parameters.all %} - * @param {{ parameter.name | caseCamel }} {{ parameter.description }} -{% endfor %} - * {% if method.type != "webAuth" %}@return [{{ _self.resultType(sdk.namespace, method) }}]{% endif %} - + {%~ for parameter in method.parameters.all %} + * @param {{ parameter.name | caseCamel }} {{ parameter.description | raw }} + {%~ endfor %} + {%~ if method.type != "webAuth" %} + * @return [{{ method | returnType(spec, sdk.namespace | caseDot) | raw }}] + {%~ endif %} */ + {%~ if method.parameters.all | reduce((carry, param) => carry or not param.required) %} @JvmOverloads + {%~ endif %} @Throws({{ spec.title | caseUcfirst }}Exception::class) - suspend fun {{ method.name | caseCamel }}({% if method.type == "webAuth" %}{{ '\n\t\t' }}activity: ComponentActivity{% if method.parameters.all | length > 0 %}, {% endif %}{% endif %}{{ _self.method_parameters(method.parameters, method.consumes) }}{% if method.parameters.all|length > 0 %}{{ '\n\t' }}{% endif %}){% if method.type != "webAuth" %}: {{ _self.resultType(sdk.namespace, method) }}{% endif %} { - val path = "{{ method.path }}"{% for parameter in method.parameters.path %}.replace("{{ '{' ~ parameter.name | caseCamel ~ '}' }}", {{ parameter.name | caseCamel }}){% endfor %} + suspend fun {% if method.responseModel | hasGenericType(spec) %}{{ '' | raw }} {% endif %}{{ method.name | caseCamel }}( + {%~ if method.type == "webAuth" %} + activity: ComponentActivity, + {%~ endif %} + {%~ for parameter in method.parameters.all %} + {{ parameter.name | caseCamel }}: {{ parameter | typeName }}{%~ if not parameter.required %}? = null{% endif %}, + {%~ endfor %} + {%~ if method.responseModel | hasGenericType(spec) %} + nestedType: Class, + {%~ endif %} + {%~ if 'multipart/form-data' in method.consumes %} + onProgress: ((UploadProgress) -> Unit)? = null + {%~ endif %} + ): {{ method | returnType(spec, sdk.namespace | caseDot) | raw }} { + val path = "{{ method.path }}" + {%~ for parameter in method.parameters.path %} + .replace("{{ '{' ~ parameter.name | caseCamel ~ '}' }}", {{ parameter.name | caseCamel }}) + {%~ endfor %} val params = mutableMapOf( -{% for parameter in method.parameters.query | merge(method.parameters.body) %} - "{{ parameter.name }}" to {{ parameter.name | caseCamel }}{% if not loop.last or _self.methodNeedsSecurityParameters(method) %},{% endif %} - -{% endfor %} -{% if _self.methodNeedsSecurityParameters(method) %} -{% for node in method.security %} -{% for key,header in node|keys %} - "{{header|caseLower}}" to client.config["{{header|caseLower}}"]{% if not loop.last %},{% endif %} - -{% endfor %}{% endfor %}{% endif %} - ) -{% if method.type == 'webAuth' %} - val query = mutableListOf() - params.forEach { - when (it.value) { - null -> { - return@forEach - } - is List<*> -> { - query.add("${it.key}[]=${it.value.toString()}") - } - else -> { - query.add("${it.key}=${it.value.toString()}") - } - } - } - - val url = Uri.parse("${client.endPoint}${path}?${query.joinToString("&")}") - val callbackUrlScheme = "{{ spec.title | caseLower }}-callback-${client.config["project"]}" - - WebAuthComponent.authenticate(activity, url, callbackUrlScheme) { - if (it.isFailure) { - throw it.exceptionOrNull()!! - } - - val resultUrl = it.getOrNull()!! - val uri = Uri.parse(resultUrl) - val key = uri.getQueryParameter("key") - val secret = uri.getQueryParameter("secret") - if (key == null || secret == null) { - throw {{ spec.title | caseUcfirst }}Exception("Authentication cookie missing!") - } - val cookie = Cookie.Builder() - .name(key) - .value(secret) - .domain(Uri.parse(client.endPoint).host!!) - .httpOnly() - .build() - - client.http.cookieJar.saveFromResponse( - client.endPoint.toHttpUrl(), - listOf(cookie) - ) - } -{% elseif method.type == 'location' %} - return client.call( - "{{ method.method | caseUpper }}", - path, - params = params, - responseType = {{ _self.resultType(sdk.namespace, method) }}::class.java + {%~ for parameter in method.parameters.query | merge(method.parameters.body) %} + "{{ parameter.name }}" to {{ parameter.name | caseCamel }}, + {%~ endfor %} ) -{% else %} + {%~ if method.type == 'location' %} + {{~ include('kotlin/base/requests/location.twig') }} + {%~ else %} val headers = mutableMapOf( -{{ method.headers|map((header, key) => " \"#{key}\" to \"#{header}\"")|join(',\n')|raw }} + {%~ for key, header in method.headers %} + "{{ key }}" to "{{ header }}", + {%~ endfor %} ) -{% if method.responseModel %} - val converter: (Map) -> {{ _self.resultType(sdk.namespace, method) }} = { -{% if method.responseModel == 'any' %} + {%~ if method.responseModel %} + val converter: (Any) -> {{ method | returnType(spec, sdk.namespace | caseDot) | raw }} = { + {% if method.responseModel == 'any' %} it -{% else %} - {{ _self.resultType(sdk.namespace, method) }}.from(map = it) -{% endif %} + {% else %} + {{sdk.namespace | caseDot}}.models.{{ method.responseModel | caseUcfirst }}.from(map = it as Map{% if method.responseModel | hasGenericType(spec) %}, nestedType{% endif %}) + {% endif %} } -{% endif %} -{% if 'multipart/form-data' in method.consumes %} - val idParamName: String? = {% if method.parameters.all | filter(p => p.isUploadID) | length > 0 %}{% for parameter in method.parameters.all | filter(parameter => parameter.isUploadID) %}"{{ parameter.name }}"{% endfor %}{% else %}null{% endif %} - -{% for parameter in method.parameters.all %} -{% if parameter.type == 'file' %} - val paramName = "{{ parameter.name }}" -{% endif %} -{% endfor %} - return client.chunkedUpload( - path, - headers, - params, - responseType = {{ _self.resultType(sdk.namespace, method) }}::class.java, -{% if method.responseModel %} - converter, -{% endif %} - paramName, - idParamName, - onProgress, - ) -{% else %} - return client.call( - "{{ method.method | caseUpper }}", - path, - headers, - params, - responseType = {{ _self.resultType(sdk.namespace, method) }}::class.java, -{% if method.responseModel %} - converter, -{% endif %} - ) -{% endif %} -{% endif %} + {%~ endif %} + {%~ if 'multipart/form-data' in method.consumes %} + {{~ include('kotlin/base/requests/file.twig') }} + {%~ else %} + {{~ include('kotlin/base/requests/api.twig') }} + {%~ endif %} + {%~ endif %} } - -{% endfor %} + {%~ if method.responseModel | hasGenericType(spec) %} + + /** + * {{ method.title }} + * + * {{ method.description | raw | replace({"\n": "", "\r": ""}) }} + * + {%~ for parameter in method.parameters.all %} + * @param {{ parameter.name | caseCamel }} {{ parameter.description | raw }} + {%~ endfor %} + * @return [{{ method | returnType(spec, sdk.namespace | caseDot) | raw }}] + */ + {%~ if method.parameters.all | reduce((carry, param) => carry or not param.required) %} + @JvmOverloads + {%~ endif %} + @Throws({{ spec.title | caseUcfirst }}Exception::class) + suspend fun {{ method.name | caseCamel }}( + {%~ for parameter in method.parameters.all %} + {{ parameter.name | caseCamel }}: {{ parameter | typeName }}{%~ if not parameter.required %}? = null{% endif %}, + {%~ endfor %} + {%~ if 'multipart/form-data' in method.consumes %} + onProgress: ((UploadProgress) -> Unit)? = null + {%~ endif %} + ) = {{ method.name | caseCamel }}( + {%~ if method.type == "webAuth" %} + activity, + {%~ endif %} + {%~ for parameter in method.parameters.all %} + {{ parameter.name | caseCamel }}, + {%~ endfor %} + {%~ if method.responseModel | hasGenericType(spec) %} + nestedType = classOf(), + {%~ endif %} + {%~ if 'multipart/form-data' in method.consumes %} + onProgress = onProgress + {%~ endif %} + ) + {%~ endif %} + + {%~ endfor %} } \ No newline at end of file diff --git a/templates/node/.travis.yml.twig b/templates/node/.travis.yml.twig index ebf76bfa5f..b8f9cf81ce 100644 --- a/templates/node/.travis.yml.twig +++ b/templates/node/.travis.yml.twig @@ -1,13 +1,22 @@ - language: node_js node_js: - "14.16" jobs: include: - - stage: npm release + - stage: NPM RC Release + if: tag == *-RC* node_js: "14.16" - script: echo "Deploying to npm ..." + script: echo "Deploying RC to NPM..." + deploy: + provider: npm + email: $NPM_EMAIL + api_key: $NPM_API_KEY + tag: next + - stage: NPM Release + if: tag != *-RC* + node_js: "14.16" + script: echo "Deploying to NPM..." deploy: provider: npm email: $NPM_EMAIL diff --git a/templates/node/LICENSE.twig b/templates/node/LICENSE.twig index 0e8c361b49..854eb19494 100644 --- a/templates/node/LICENSE.twig +++ b/templates/node/LICENSE.twig @@ -1 +1 @@ -{{sdk.licenseContent}} \ No newline at end of file +{{sdk.licenseContent | raw}} \ No newline at end of file diff --git a/templates/node/base/params.twig b/templates/node/base/params.twig new file mode 100644 index 0000000000..7ccadfa538 --- /dev/null +++ b/templates/node/base/params.twig @@ -0,0 +1,23 @@ + let payload = {}; +{% if method.parameters.all | length %} +{% for parameter in method.parameters.all %} +{% if parameter.required %} + if (typeof {{ parameter.name | caseCamel | escapeKeyword }} === 'undefined') { + throw new {{spec.title | caseUcfirst}}Exception('Missing required parameter: "{{ parameter.name | caseCamel | escapeKeyword }}"'); + } + +{% endif %} +{% endfor %} +{% for parameter in method.parameters.query %} + + if (typeof {{ parameter.name | caseCamel | escapeKeyword }} !== 'undefined') { + payload['{{ parameter.name }}'] = {{ parameter.name | caseCamel | escapeKeyword }}{% if method.consumes[0] == "multipart/form-data" and ( parameter.type != "string" and parameter.type != "array" and parameter.type != "file" ) %}.toString(){% endif %}; + } +{% endfor %} +{% for parameter in method.parameters.body %} + + if (typeof {{ parameter.name | caseCamel | escapeKeyword }} !== 'undefined') { + payload['{{ parameter.name }}'] = {{ parameter.name | caseCamel | escapeKeyword}}{% if method.consumes[0] == "multipart/form-data" and ( parameter.type != "string" and parameter.type != "array" and parameter.type != "file" ) %}.toString(){% endif %}; + } +{% endfor %} +{% endif %} diff --git a/templates/node/base/requests/api.twig b/templates/node/base/requests/api.twig new file mode 100644 index 0000000000..37ece04715 --- /dev/null +++ b/templates/node/base/requests/api.twig @@ -0,0 +1,8 @@ + return await this.client.call('{{ method.method | caseLower }}', path, { +{% for parameter in method.parameters.header %} + '{{ parameter.name }}': ${{ parameter.name | caseCamel | escapeKeyword }}, +{% endfor %} +{% for key, header in method.headers %} + '{{ key }}': '{{ header }}', +{% endfor %} + }, payload{% if method.type == 'location' %}, 'arraybuffer'{% endif %}); \ No newline at end of file diff --git a/templates/node/base/requests/file.twig b/templates/node/base/requests/file.twig new file mode 100644 index 0000000000..533dc5d5b4 --- /dev/null +++ b/templates/node/base/requests/file.twig @@ -0,0 +1,139 @@ +{% for parameter in method.parameters.all %} +{% if parameter.type == 'file' %} + const size = {{ parameter.name | caseCamel | escapeKeyword }}.size; + + const headers = { +{% for parameter in method.parameters.header %} + '{{ parameter.name }}': ${{ parameter.name | caseCamel | escapeKeyword }}, +{% endfor %} +{% for key, header in method.headers %} + '{{ key }}': '{{ header }}', +{% endfor %} + }; + + let id = undefined; + let response = undefined; + + let chunksUploaded = 0; + +{% for parameter in method.parameters.all %} +{% if parameter.isUploadID %} + if({{ parameter.name | caseCamel | escapeKeyword }} != 'unique()') { + try { + response = await this.client.call('get', path + '/' + {{ parameter.name }}, headers); + chunksUploaded = response.chunksUploaded; + } catch(e) { + } + } +{% endif %} +{% endfor %} + + let currentChunk = Buffer.from(''); + let currentChunkSize = 0; + let currentChunkStart = 0; + + const selfClient = this.client; + + async function uploadChunk(lastUpload = false) { + if(chunksUploaded - 1 >= currentChunkStart / client.CHUNK_SIZE) { + return; + } + + const start = currentChunkStart; + const end = Math.min(((start + client.CHUNK_SIZE) - 1), size); + + if(!lastUpload || currentChunkStart !== 0) { + headers['content-range'] = 'bytes ' + start + '-' + end + '/' + size; + } + + if (id) { + headers['x-{{spec.title | caseLower }}-id'] = id; + } + + const stream = Stream.Readable.from(currentChunk); + payload['{{ parameter.name }}'] = { type: 'file', file: stream, filename: {{ parameter.name }}.filename }; + + response = await selfClient.call('{{ method.method | caseLower }}', path, headers, payload{% if method.type == 'location' %}, 'arraybuffer'{% endif %}); + + if (!id) { + id = response['$id']; + } + + if (onProgress !== null) { + onProgress({ + $id: response['$id'], + progress: Math.min((start+client.CHUNK_SIZE) * client.CHUNK_SIZE, size) / size * 100, + sizeUploaded: end+1, + chunksTotal: response['chunksTotal'], + chunksUploaded: response['chunksUploaded'] + }); + } + + currentChunkStart += client.CHUNK_SIZE; + } + + return await new Promise((resolve, reject) => { + const writeStream = new Stream.Writable(); + writeStream._write = async (mainChunk, encoding, callback) => { + try { + // Segment incoming chunk into up to 5MB chunks + const mainChunkSize = Buffer.byteLength(mainChunk); + const chunksCount = Math.ceil(mainChunkSize / client.CHUNK_SIZE); + const chunks = []; + + for(let i = 0; i < chunksCount; i++) { + const chunk = mainChunk.slice(i * client.CHUNK_SIZE, (i + 1) * client.CHUNK_SIZE); + chunks.push(chunk); + } + + for (const chunk of chunks) { + const chunkSize = Buffer.byteLength(chunk); + + if(chunkSize + currentChunkSize == client.CHUNK_SIZE) { + // Upload chunk + currentChunk = Buffer.concat([currentChunk, chunk]); + await uploadChunk(); + currentChunk = Buffer.from(''); + currentChunkSize = 0; + } else if(chunkSize + currentChunkSize > client.CHUNK_SIZE) { + // Upload chunk, put rest into next chunk + const bytesToUpload = client.CHUNK_SIZE - currentChunkSize; + const newChunkSection = chunk.slice(0, bytesToUpload); + currentChunk = Buffer.concat([currentChunk, newChunkSection]); + currentChunkSize = Buffer.byteLength(currentChunk); + await uploadChunk(); + currentChunk = chunk.slice(bytesToUpload, undefined); + currentChunkSize = chunkSize - bytesToUpload; + } else { + // Append into current chunk + currentChunk = Buffer.concat([currentChunk, chunk]); + currentChunkSize = chunkSize + currentChunkSize; + } + } + + callback(); + } catch (e) { + callback(e); + } + } + + writeStream.on("finish", async () => { + if(currentChunkSize > 0) { + try { + await uploadChunk(true); + } catch (e) { + reject(e); + } + } + + resolve(response); + }); + + writeStream.on("error", (err) => { + reject(err); + }); + + {{ parameter.name | caseCamel | escapeKeyword }}.stream.pipe(writeStream); + }); +{% endif %} +{% endfor %} diff --git a/templates/node/docs/example.md.twig b/templates/node/docs/example.md.twig index 495517ac2f..83192ff4ba 100644 --- a/templates/node/docs/example.md.twig +++ b/templates/node/docs/example.md.twig @@ -4,21 +4,21 @@ const fs = require('fs'); {% endif %} // Init SDK -let client = new sdk.Client(); +const client = new sdk.Client(); -let {{ service.name | caseCamel }} = new sdk.{{service.name | caseUcfirst}}(client); +const {{ service.name | caseCamel }} = new sdk.{{service.name | caseUcfirst}}(client{% if service.globalParams | length %}{% for parameter in service.globalParams %}, {{ parameter | paramExample }}{% endfor %}{% endif %}); -{% if method.security|length > 0 %} +{% if method.auth|length > 0 %} client .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint -{% for node in method.security %} +{% for node in method.auth %} {% for key,header in node|keys %} .set{{header}}('{{node[header]['x-appwrite']['demo']}}') // {{node[header].description}} {% endfor %} {% endfor %}; {% endif %} -let promise = {{ service.name | caseCamel }}.{{ method.name | caseCamel }}({% for parameter in method.parameters.all %}{% if parameter.required %}{% if not loop.first %}, {% endif %}{{ parameter | paramExample }}{% endif %}{% endfor %}); +const promise = {{ service.name | caseCamel }}.{{ method.name | caseCamel }}({% for parameter in method.parameters.all %}{% if parameter.required %}{% if not loop.first %}, {% endif %}{{ parameter | paramExample }}{% endif %}{% endfor %}); promise.then(function (response) { console.log(response); diff --git a/templates/node/index.d.ts.twig b/templates/node/index.d.ts.twig index d98603cf6c..99809fa057 100644 --- a/templates/node/index.d.ts.twig +++ b/templates/node/index.d.ts.twig @@ -7,7 +7,7 @@ {{property.sub_schema | caseUcfirst}}{% if property.type == 'array' %}[]{% endif %} {% endif %} {% else %} - {{property.type | typeName}} + {{property | typeName}} {% endif %} {% endapply %} {% endmacro %} @@ -126,6 +126,20 @@ declare module "{{ language.params.npmPackage|caseDash }}" { constructor(client: Client); } + export class InputFile { + static fromPath(filePath: string, filename: string): InputFile; + + static fromBuffer(buffer: Buffer, filename: string): InputFile; + + static fromBlob(blob: buffer.Blob, filename: string): Promise; + + static fromStream(stream: NodeJS.ReadableStream, filename: string, size: number): InputFile; + + static fromPlainText(content: string, filename: string): InputFile; + + constructor(stream: NodeJS.ReadableStream, filename: string, size: number); + } + type QueryTypesSingle = string | number | boolean; type QueryTypesList = string[] | number[] | boolean[]; type QueryTypes = QueryTypesSingle | QueryTypesList; @@ -135,23 +149,78 @@ declare module "{{ language.params.npmPackage|caseDash }}" { static notEqual(attribute: string, value: QueryTypes): string; - static lesser(attribute: string, value: QueryTypes): string; + static lessThan(attribute: string, value: QueryTypes): string; - static lesserEqual(attribute: string, value: QueryTypes): string; + static lessThanEqual(attribute: string, value: QueryTypes): string; - static greater(attribute: string, value: QueryTypes): string; + static greaterThan(attribute: string, value: QueryTypes): string; - static greaterEqual(attribute: string, value: QueryTypes): string; + static greaterThanEqual(attribute: string, value: QueryTypes): string; static search(attribute: string, value: string): string; - private static addQuery(attribute: string, oper: string, value: QueryTypes): string; + static orderDesc(attribute: string): string; + + static orderAsc(attribute: string): string; + + static cursorAfter(documentId: string): string; + + static cursorBefore(documentId: string): string; + + static limit(value: number): string; + + static offset(value: number): string; + + private static addQuery(attribute: string, method: string, value: QueryTypes): string; private static parseValues(value: QueryTypes): string; } + export class ID { + static unique(): string; + static custom(id: string): string; + } + + export class Permission { + static read(role: string): string; + static write(role: string): string; + static create(role: string): string; + static update(role: string): string; + static delete(role: string): string; + } + + export class Role { + static any(): string; + static user(id: string, status?: string): string; + static users(status?: string): string; + static guests(): string; + static team(id: string, role?: string): string; + static member(id: string): string; + } + {% for service in spec.services %} export class {{ service.name | caseUcfirst }} extends Service { + constructor(client: Client{% for parameter in service.globalParams %}, {{ parameter.name | caseCamel | escapeKeyword }}: {{ parameter | typeName }}{% if not parameter.required %}|null{% endif %}{% endfor %}); + +{% if service.globalParams | length %} +{% for parameter in service.globalParams %} + /** + * Get {{ parameter.name }}. + * + * @returns {{ '{' }}{{ parameter | typeName }}{{ '}' }} + */ + get{{ parameter.name | caseUcfirst | escapeKeyword }}(): {{ parameter | typeName }}; + + /** + * Set {{ parameter.name }}. + * + * @param {{ '{' }}{{ parameter | typeName }}{{ '}' }} {{ parameter.name | caseCamel | escapeKeyword }} + * @returns {void} + */ + set{{ parameter.name | caseUcfirst | escapeKeyword }}({{ parameter.name | caseCamel | escapeKeyword }}: {{ parameter | typeName }}): void; + +{% endfor %} +{% endif %} {% for method in service.methods %} {% set generics = _self.get_generics_method(spec.definitions[method.responseModel], spec, true, true) %} {% set generics_return = _self.get_generics_method_return(spec.definitions[method.responseModel], spec) %} @@ -163,12 +232,12 @@ declare module "{{ language.params.npmPackage|caseDash }}" { * {% endif %} {% for parameter in method.parameters.all %} - * @param {{ '{' }}{{ parameter.type | typeName }}{{ '}' }} {{ parameter.name | caseCamel }} + * @param {{ '{' }}{{ parameter | typeName }}{{ '}' }} {{ parameter.name | caseCamel }} {% endfor %} * @throws {{ '{' }}{{ spec.title | caseUcfirst}}Exception} * @returns {Promise} */ - {{ method.name | caseCamel }}{% if generics %}<{{generics}}>{% endif %}({% for parameter in method.parameters.all %}{{ parameter.name | caseCamel | escapeKeyword }}{% if not parameter.required %}?{% endif %}: {{ parameter.type | typeName }}{% if not loop.last %}, {% endif %}{% endfor %}): Promise<{% if method.type == 'location' %}Buffer{% else %}{% if method.responseModel and method.responseModel != 'any' %}{% if not spec.definitions[method.responseModel].additionalProperties %}Models.{% endif %}{{method.responseModel | caseUcfirst}}{% if generics_return %}<{{generics_return}}>{% endif %}{% else %}Response{% endif %}{% endif %}>; + {{ method.name | caseCamel }}{% if generics %}<{{generics}}>{% endif %}({% for parameter in method.parameters.all %}{{ parameter.name | caseCamel | escapeKeyword }}{% if not parameter.required %}?{% endif %}: {{ parameter | typeName }}{% if not loop.last %}, {% endif %}{% endfor %}): Promise<{% if method.type == 'location' %}Buffer{% else %}{% if method.responseModel and method.responseModel != 'any' %}{% if not spec.definitions[method.responseModel].additionalProperties %}Models.{% endif %}{{method.responseModel | caseUcfirst}}{% if generics_return %}<{{generics_return}}>{% endif %}{% else %}string{% endif %}{% endif %}>; {% endfor %} } {% endfor %} diff --git a/templates/node/index.js.twig b/templates/node/index.js.twig index f6aa0040ef..b82be23234 100644 --- a/templates/node/index.js.twig +++ b/templates/node/index.js.twig @@ -1,5 +1,9 @@ const Client = require('./lib/client.js'); const Query = require('./lib/query.js'); +const Permission = require('./lib/permission.js'); +const Role = require('./lib/role.js'); +const ID = require('./lib/id.js'); +const InputFile = require('./lib/inputFile.js'); const {{spec.title | caseUcfirst}}Exception = require('./lib/exception.js'); {% for service in spec.services %} const {{service.name | caseUcfirst}} = require('./lib/services/{{service.name | caseDash}}.js'); @@ -8,6 +12,10 @@ const {{service.name | caseUcfirst}} = require('./lib/services/{{service.name | module.exports = { Client, Query, + Permission, + Role, + ID, + InputFile, {{spec.title | caseUcfirst}}Exception, {% for service in spec.services %} {{service.name | caseUcfirst}}, diff --git a/templates/node/lib/client.js.twig b/templates/node/lib/client.js.twig index 0786a290e6..1be2e1869c 100644 --- a/templates/node/lib/client.js.twig +++ b/templates/node/lib/client.js.twig @@ -9,8 +9,12 @@ class Client { constructor() { this.endpoint = '{{spec.endpoint}}'; this.headers = { + 'accept-encoding': '*', 'content-type': '', - 'x-sdk-version': '{{spec.title | caseDash}}:{{ language.name | caseLower }}:{{ sdk.version }}', + 'x-sdk-name': '{{ sdk.name }}', + 'x-sdk-platform': '{{ sdk.platform }}', + 'x-sdk-language': '{{ language.name | caseLower }}', + 'x-sdk-version': '{{ sdk.version }}', {% for key,header in spec.global.defaultHeaders %} '{{key}}' : '{{header}}', {% endfor %} @@ -93,7 +97,13 @@ class Client { let flatParams = Client.flatten(params); for (const key in flatParams) { - form.append(key, flatParams[key]) + const value = flatParams[key]; + + if(value && value.type && value.type === 'file') { + form.append(key, value.file, { filename: value.filename }); + } else { + form.append(key, flatParams[key]); + } } headers = { diff --git a/templates/node/lib/id.js.twig b/templates/node/lib/id.js.twig new file mode 100644 index 0000000000..d168caf6bb --- /dev/null +++ b/templates/node/lib/id.js.twig @@ -0,0 +1,12 @@ +class ID { + + static unique = () => { + return 'unique()' + } + + static custom = (id) => { + return id + } +} + +module.exports = ID; diff --git a/templates/node/lib/inputFile.js.twig b/templates/node/lib/inputFile.js.twig new file mode 100644 index 0000000000..de7f0d9c7b --- /dev/null +++ b/templates/node/lib/inputFile.js.twig @@ -0,0 +1,45 @@ +const { Readable } = require('stream'); +const fs = require('fs'); + +class InputFile { + stream; // Content of file, readable stream + size; // Total final size of the file content + filename; // File name + + static fromPath = (filePath, filename) => { + const stream = fs.createReadStream(filePath); + const { size } = fs.statSync(filePath); + return new InputFile(stream, filename, size); + }; + + static fromBuffer = (buffer, filename) => { + const stream = Readable.from(buffer); + const size = Buffer.byteLength(buffer); + return new InputFile(stream, filename, size); + }; + + static fromBlob = async (blob, filename) => { + const arrayBuffer = await blob.arrayBuffer(); + const buffer = Buffer.from(arrayBuffer); + return InputFile.fromBuffer(buffer, filename); + }; + + static fromStream = (stream, filename, size) => { + return new InputFile(stream, filename, size); + }; + + static fromPlainText = (content, filename) => { + const buffer = Buffer.from(content, "utf-8"); + const stream = Readable.from(buffer); + const size = Buffer.byteLength(buffer); + return new InputFile(stream, filename, size); + }; + + constructor(stream, filename, size) { + this.stream = stream; + this.filename = filename; + this.size = size; + } +} + +module.exports = InputFile; diff --git a/templates/node/lib/permission.js.twig b/templates/node/lib/permission.js.twig new file mode 100644 index 0000000000..67a7003508 --- /dev/null +++ b/templates/node/lib/permission.js.twig @@ -0,0 +1,24 @@ +class Permission { + + static read = (role) => { + return `read("${role}")` + } + + static write = (role) => { + return `write("${role}")` + } + + static create = (role) => { + return `create("${role}")` + } + + static update = (role) => { + return `update("${role}")` + } + + static delete = (role) => { + return `delete("${role}")` + } +} + +module.exports = Permission; diff --git a/templates/node/lib/query.js.twig b/templates/node/lib/query.js.twig index 1014131774..253468649a 100644 --- a/templates/node/lib/query.js.twig +++ b/templates/node/lib/query.js.twig @@ -5,27 +5,45 @@ class Query { static notEqual = (attribute, value) => Query.addQuery(attribute, "notEqual", value); - static lesser = (attribute, value) => - Query.addQuery(attribute, "lesser", value); + static lessThan = (attribute, value) => + Query.addQuery(attribute, "lessThan", value); - static lesserEqual = (attribute, value) => - Query.addQuery(attribute, "lesserEqual", value); + static lessThanEqual = (attribute, value) => + Query.addQuery(attribute, "lessThanEqual", value); - static greater = (attribute, value) => - Query.addQuery(attribute, "greater", value); + static greaterThan = (attribute, value) => + Query.addQuery(attribute, "greaterThan", value); - static greaterEqual = (attribute, value) => - Query.addQuery(attribute, "greaterEqual", value); + static greaterThanEqual = (attribute, value) => + Query.addQuery(attribute, "greaterThanEqual", value); static search = (attribute, value) => Query.addQuery(attribute, "search", value); - static addQuery = (attribute, oper, value) => + static orderDesc = (attribute) => + `orderDesc("${attribute}")`; + + static orderAsc = (attribute) => + `orderAsc("${attribute}")`; + + static cursorAfter = (documentId) => + `cursorAfter("${documentId}")`; + + static cursorBefore = (documentId) => + `cursorBefore("${documentId}")`; + + static limit = (limit) => + `limit(${limit})`; + + static offset = (offset) => + `offset(${offset})`; + + static addQuery = (attribute, method, value) => value instanceof Array - ? `${attribute}.${oper}(${value + ? `${method}("${attribute}", [${value .map((v) => Query.parseValues(v)) - .join(",")})` - : `${attribute}.${oper}(${Query.parseValues(value)})`; + .join(",")}])` + : `${method}("${attribute}", [${Query.parseValues(value)}])`; static parseValues = (value) => typeof value === "string" || value instanceof String diff --git a/templates/node/lib/role.js.twig b/templates/node/lib/role.js.twig new file mode 100644 index 0000000000..5c168c2399 --- /dev/null +++ b/templates/node/lib/role.js.twig @@ -0,0 +1,31 @@ +class Role { + static any = () => { + return 'any' + } + static user = (id, status = '') => { + if(status === '') { + return `user:${id}` + } + return `user:${id}/${status}` + } + static users = (status = '') => { + if(status === '') { + return 'users' + } + return `users/${status}` + } + static guests = () => { + return 'guests' + } + static team = (id, role = '') => { + if(role === '') { + return 'team:' + id + } + return 'team:' + id + '/' + role + } + static member = (id) => { + return 'member:' + id + } +} + +module.exports = Role; \ No newline at end of file diff --git a/templates/node/lib/services/service.js.twig b/templates/node/lib/services/service.js.twig index 5190ed83c9..5cc919ab33 100644 --- a/templates/node/lib/services/service.js.twig +++ b/templates/node/lib/services/service.js.twig @@ -1,10 +1,18 @@ const Service = require('../service.js'); const {{spec.title | caseUcfirst}}Exception = require('../exception.js'); +const InputFile = require('../inputFile.js'); const client = require('../client.js'); +const Stream = require('stream'); const { promisify } = require('util'); const fs = require('fs'); class {{ service.name | caseUcfirst }} extends Service { + + constructor(client) + { + super(client); + } + {% for method in service.methods %} /** @@ -15,128 +23,21 @@ class {{ service.name | caseUcfirst }} extends Service { * {% endif %} {% for parameter in method.parameters.all %} - * @param {{ '{' }}{{ parameter.type | typeName }}{{ '}' }} {{ parameter.name | caseCamel | escapeKeyword }} + * @param {{ '{' }}{{ parameter | typeName }}{{ '}' }} {{ parameter.name | caseCamel | escapeKeyword }} {% endfor %} * @throws {{ '{' }}{{ spec.title | caseUcfirst}}Exception} * @returns {Promise} */ async {{ method.name | caseCamel }}({% for parameter in method.parameters.all %}{{ parameter.name | caseCamel | escapeKeyword }}{% if not loop.last %}, {% endif %}{% endfor %}{% if 'multipart/form-data' in method.consumes %}, onProgress = () => {}{% endif %}) { -{% for parameter in method.parameters.all %} -{% if parameter.required %} - if (typeof {{ parameter.name | caseCamel | escapeKeyword }} === 'undefined') { - throw new {{spec.title | caseUcfirst}}Exception('Missing required parameter: "{{ parameter.name | caseCamel | escapeKeyword }}"'); - } - -{% endif %} -{% endfor %} let path = '{{ method.path }}'{% for parameter in method.parameters.path %}.replace('{{ '{' }}{{ parameter.name | caseCamel }}{{ '}' }}', {{ parameter.name | caseCamel | escapeKeyword }}){% endfor %}; - let payload = {}; -{% for parameter in method.parameters.query %} - - if (typeof {{ parameter.name | caseCamel | escapeKeyword }} !== 'undefined') { - payload['{{ parameter.name }}'] = {{ parameter.name | caseCamel | escapeKeyword }}{% if method.consumes[0] == "multipart/form-data" and ( parameter.type != "string" and parameter.type != "array" ) %}.toString(){% endif %}; - } -{% endfor %} -{% for parameter in method.parameters.body %} - - if (typeof {{ parameter.name | caseCamel | escapeKeyword }} !== 'undefined') { - payload['{{ parameter.name }}'] = {{ parameter.name | caseCamel | escapeKeyword}}{% if method.consumes[0] == "multipart/form-data" and ( parameter.type != "string" and parameter.type != "array" ) %}.toString(){% endif %}; - } -{% endfor %} - +{{ include ('node/base/params.twig')}} {% if 'multipart/form-data' in method.consumes %} -{% for parameter in method.parameters.all %} -{% if parameter.type == 'file' %} - const { size: size } = await promisify(fs.stat)({{ parameter.name | caseCamel | escapeKeyword }}); - - if (size <= client.CHUNK_SIZE) { - payload['{{ parameter.name }}'] = fs.createReadStream({{ parameter.name | caseCamel | escapeKeyword }}); - - return await this.client.call('{{ method.method | caseLower }}', path, { -{% for parameter in method.parameters.header %} - '{{ parameter.name }}': ${{ parameter.name | caseCamel | escapeKeyword }}, -{% endfor %} -{% for key, header in method.headers %} - '{{ key }}': '{{ header }}', -{% endfor %} - }, payload{% if method.type == 'location' %}, 'arraybuffer'{% endif %}); - } else { - let id = undefined; - let response = undefined; - - let counter = 0; - const totalCounters = Math.ceil(size / client.CHUNK_SIZE); - - const headers = { -{% for parameter in method.parameters.header %} - '{{ parameter.name }}': ${{ parameter.name | caseCamel | escapeKeyword }}, -{% endfor %} -{% for key, header in method.headers %} - '{{ key }}': '{{ header }}', -{% endfor %} - }; - -{% for parameter in method.parameters.all %} -{% if parameter.isUploadID %} - if({{ parameter.name | caseCamel | escapeKeyword }} != 'unique()') { - try { - response = await this.client.call('get', path + '/' + {{ parameter.name }}, headers); - counter = response.chunksUploaded; - } catch(e) { - } - } -{% endif %} -{% endfor %} - - for (counter; counter < totalCounters; counter++) { - const start = (counter * client.CHUNK_SIZE); - const end = Math.min((((counter * client.CHUNK_SIZE) + client.CHUNK_SIZE) - 1), size); - - headers['content-range'] = 'bytes ' + start + '-' + end + '/' + size; - - if (id) { - headers['x-{{spec.title | caseLower }}-id'] = id; - } - - const stream = fs.createReadStream({{ parameter.name | caseCamel | escapeKeyword }}, { - start, - end - }); - payload['{{ parameter.name }}'] = stream; - - response = await this.client.call('{{ method.method | caseLower }}', path, headers, payload{% if method.type == 'location' %}, 'arraybuffer'{% endif %}); - - if (!id) { - id = response['$id']; - } - - if (onProgress !== null) { - onProgress({ - $id: response['$id'], - progress: Math.min((counter+1) * client.CHUNK_SIZE, size) / size * 100, - sizeUploaded: end+1, - chunksTotal: response['chunksTotal'], - chunksUploaded: response['chunksUploaded'] - }); - } - } - - return response; - } -{% endif %} -{% endfor %} +{{ include ('node/base/requests/file.twig')}} {% else %} - return await this.client.call('{{ method.method | caseLower }}', path, { -{% for parameter in method.parameters.header %} - '{{ parameter.name }}': ${{ parameter.name | caseCamel | escapeKeyword }}, -{% endfor %} -{% for key, header in method.headers %} - '{{ key }}': '{{ header }}', -{% endfor %} - }, payload{% if method.type == 'location' %}, 'arraybuffer'{% endif %}); +{{ include('node/base/requests/api.twig') }} {% endif %} } {% endfor %} } -module.exports = {{ service.name | caseUcfirst }}; \ No newline at end of file +module.exports = {{ service.name | caseUcfirst }}; diff --git a/templates/node/package.json.twig b/templates/node/package.json.twig index a55f3af2f2..314c3ad083 100644 --- a/templates/node/package.json.twig +++ b/templates/node/package.json.twig @@ -12,7 +12,7 @@ }, "devDependencies": {}, "dependencies": { - "axios": "^0.27.2", + "axios": "^1.1.2", "form-data": "^4.0.0" } } \ No newline at end of file diff --git a/templates/php/LICENSE.twig b/templates/php/LICENSE.twig index 0e8c361b49..854eb19494 100644 --- a/templates/php/LICENSE.twig +++ b/templates/php/LICENSE.twig @@ -1 +1 @@ -{{sdk.licenseContent}} \ No newline at end of file +{{sdk.licenseContent | raw}} \ No newline at end of file diff --git a/templates/php/base/params.twig b/templates/php/base/params.twig new file mode 100644 index 0000000000..04813d936f --- /dev/null +++ b/templates/php/base/params.twig @@ -0,0 +1,27 @@ + $params = []; +{% if method.parameters.all | length %} +{% for parameter in method.parameters.all %} +{% if parameter.required %} + if (!isset(${{ parameter.name | caseCamel | escapeKeyword }})) { + throw new {{spec.title | caseUcfirst}}Exception('Missing required parameter: "{{ parameter.name | caseCamel | escapeKeyword }}"'); + } +{% endif %} +{% endfor %} +{% for parameter in method.parameters.query %} + if (!is_null(${{ parameter.name | caseCamel | escapeKeyword }})) { + $params['{{ parameter.name }}'] = ${{ parameter.name | caseCamel | escapeKeyword }}; + } + +{% endfor %} +{% for parameter in method.parameters.body %} + if (!is_null(${{ parameter.name | caseCamel | escapeKeyword }})) { + $params['{{ parameter.name }}'] = ${{ parameter.name | caseCamel | escapeKeyword }}; + } + +{% endfor %} +{% for parameter in method.parameters.formData %} + if (!is_null(${{ parameter.name | caseCamel | escapeKeyword }})) { + $params['{{ parameter.name }}'] = ${{ parameter.name | caseCamel | escapeKeyword }}; + } +{% endfor %} +{% endif %} \ No newline at end of file diff --git a/templates/php/base/requests/api.twig b/templates/php/base/requests/api.twig new file mode 100644 index 0000000000..72aee3648a --- /dev/null +++ b/templates/php/base/requests/api.twig @@ -0,0 +1,8 @@ + return $this->client->call(Client::METHOD_{{ method.method | caseUpper }}, $path, [ +{% for parameter in method.parameters.header %} + '{{ parameter.name }}' => ${{ parameter.name | caseCamel | escapeKeyword }}, +{% endfor %} +{% for key, header in method.headers %} + '{{ key }}' => '{{ header }}', +{% endfor %} + ], $params); \ No newline at end of file diff --git a/templates/php/base/requests/file.twig b/templates/php/base/requests/file.twig new file mode 100644 index 0000000000..7f9b2d5dce --- /dev/null +++ b/templates/php/base/requests/file.twig @@ -0,0 +1,96 @@ +{% for parameter in method.parameters.all %} +{% if parameter.type == 'file' %} + $size = 0; + $mimeType = null; + $postedName = null; + if(empty(${{ parameter.name | caseCamel }}->getPath() ?? null)) { + $size = strlen(${{ parameter.name | caseCamel }}->getData()); + $mimeType = ${{ parameter.name | caseCamel }}->getMimeType(); + $postedName = ${{ parameter.name | caseCamel }}->getFilename(); + if ($size <= Client::CHUNK_SIZE) { + $params['{{ parameter.name | caseCamel }}'] = new \CURLFile('data://' . $mimeType . ';base64,' . base64_encode(${{ parameter.name | caseCamel }}->getData()), $mimeType, $postedName); + return $this->client->call(Client::METHOD_POST, $path, [ + {% for param in method.parameters.header %} + '{{ param.name }}' => ${{ param.name | caseCamel }}, + {% endfor %} + {% for key, header in method.headers %} + '{{ key }}' => '{{ header }}', + {% endfor %} + ], $params); + } + } else { + $size = filesize(${{ parameter.name | caseCamel }}->getPath()); + $mimeType = ${{ parameter.name | caseCamel }}->getMimeType() ?? mime_content_type(${{ parameter.name | caseCamel }}->getPath()); + $postedName = ${{ parameter.name | caseCamel }}->getFilename() ?? basename(${{ parameter.name | caseCamel }}->getPath()); + //send single file if size is less than or equal to 5MB + if ($size <= Client::CHUNK_SIZE) { + $params['{{ parameter.name }}'] = new \CURLFile(${{ parameter.name | caseCamel }}->getPath(), $mimeType, $postedName); + return $this->client->call(Client::METHOD_{{ method.method | caseUpper }}, $path, [ + {% for param in method.parameters.header %} + '{{ param.name }}' => ${{ param.name | caseCamel }}, + {% endfor %} + {% for key, header in method.headers %} + '{{ key }}' => '{{ header }}', + {% endfor %} + ], $params); + } + } + + $id = ''; + $counter = 0; + +{% for parameter in method.parameters.all %} +{% if parameter.isUploadID %} + if(${{ parameter.name | caseCamel | escapeKeyword }} != 'unique()') { + try { + $response = $this->client->call(Client::METHOD_GET, $path . '/' . ${{ parameter.name }}); + $counter = $response['chunksUploaded'] ?? 0; + } catch(\Exception $e) { + } + } +{% endif %} +{% endfor %} + + $headers = ['content-type' => 'multipart/form-data']; + $handle = null; + + if(!empty(${{parameter.name}}->getPath())) { + $handle = @fopen(${{parameter.name}}->getPath(), "rb"); + } + + $start = $counter * Client::CHUNK_SIZE; + while ($start < $size) { + $chunk = ''; + if(!empty($handle)) { + fseek($handle, $start); + $chunk = @fread($handle, Client::CHUNK_SIZE); + } else { + $chunk = substr($file->getData(), $start, Client::CHUNK_SIZE); + } + $params['{{ parameter.name }}'] = new \CURLFile('data://' . $mimeType . ';base64,' . base64_encode($chunk), $mimeType, $postedName); + $headers['content-range'] = 'bytes ' . ($counter * Client::CHUNK_SIZE) . '-' . min(((($counter * Client::CHUNK_SIZE) + Client::CHUNK_SIZE) - 1), $size) . '/' . $size; + if(!empty($id)) { + $headers['x-{{spec.title | caseLower }}-id'] = $id; + } + $response = $this->client->call(Client::METHOD_POST, $path, $headers, $params); + $counter++; + $start += Client::CHUNK_SIZE; + if(empty($id)) { + $id = $response['$id']; + } + if($onProgress !== null) { + $onProgress([ + '$id' => $response['$id'], + 'progress' => min(((($counter * Client::CHUNK_SIZE) + Client::CHUNK_SIZE) - 1), $size) / $size * 100, + 'sizeUploaded' => min($counter * Client::CHUNK_SIZE), + 'chunksTotal' => $response['chunksTotal'], + 'chunksUploaded' => $response['chunksUploaded'], + ]); + } + } + if(!empty($handle)) { + @fclose($handle); + } + return $response; +{% endif %} +{% endfor %} \ No newline at end of file diff --git a/templates/php/docs/example.md.twig b/templates/php/docs/example.md.twig index 8328d150a0..205055d65d 100644 --- a/templates/php/docs/example.md.twig +++ b/templates/php/docs/example.md.twig @@ -1,20 +1,23 @@ param.type == 'file') | length > 0 %} +use {{ spec.title | caseUcfirst }}\InputFile; +{% endif %} use {{ spec.title | caseUcfirst }}\Services\{{ service.name | caseUcfirst }}; $client = new Client(); -{% if method.security|length > 0 %} +{% if method.auth|length > 0 %} $client ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint -{% for node in method.security %} +{% for node in method.auth %} {% for key,header in node|keys %} ->set{{header}}('{{node[header]['x-appwrite']['demo']}}') // {{node[header].description}} {% endfor %} {% endfor %}; {% endif %} -${{ service.name | caseCamel }} = new {{ service.name | caseUcfirst }}($client); +${{ service.name | caseCamel }} = new {{ service.name | caseUcfirst }}($client{% if service.globalParams | length %}{% for parameter in service.globalParams %}, {{ parameter | paramExample }}{% endfor %}{% endif %}); $result = ${{ service.name | caseCamel }}->{{ method.name | caseCamel }}({% for parameter in method.parameters.all %}{% if parameter.required %}{% if not loop.first %}, {% endif %}{{ parameter | paramExample }}{% endif %}{% endfor %}); \ No newline at end of file diff --git a/templates/php/docs/service.md.twig b/templates/php/docs/service.md.twig index 3e923c53a8..7839627103 100644 --- a/templates/php/docs/service.md.twig +++ b/templates/php/docs/service.md.twig @@ -16,18 +16,26 @@ | Field Name | Type | Description | Default | | --- | --- | --- | --- | +{% if method.parameters.path | length > 0 %} {% for parameter in method.parameters.path %} -| {{ parameter.name }} | {{ parameter.type }} | {% if parameter.required == 1 %}**Required** {% endif %}{{ parameter.description }} | {{ parameter.default }} | +| {{ parameter.name }} | {{ parameter.type }} | {% if parameter.required == 1 %}**Required** {% endif %}{{ parameter.description | raw }} | {{ parameter.default }} | {% endfor %} +{% endif %} +{% if method.parameters.query | length > 0 %} {% for parameter in method.parameters.query %} -| {{ parameter.name }} | {{ parameter.type }} | {% if parameter.required == 1 %}**Required** {% endif %}{{ parameter.description }} | {{ parameter.default }} | +| {{ parameter.name }} | {{ parameter.type }} | {% if parameter.required == 1 %}**Required** {% endif %}{{ parameter.description | raw }} | {{ parameter.default }} | {% endfor %} +{% endif %} +{% if method.parameters.body | length > 0 %} {% for parameter in method.parameters.body %} -| {{ parameter.name }} | {{ parameter.type }} | {{ parameter.description }} | {{ parameter.default }} | +| {{ parameter.name }} | {{ parameter.type }} | {{ parameter.description | raw }} | {{ parameter.default }} | {% endfor %} +{% endif %} +{% if method.parameters.formData | length > 0 %} {% for parameter in method.parameters.formData %} -| {{ parameter.name }} | {{ parameter.type }} | {{ parameter.description }} | {{ parameter.default }} | +| {{ parameter.name }} | {{ parameter.type }} | {{ parameter.description | raw }} | {{ parameter.default }} | {% endfor %} +{% endif %} {% endif %} {% endfor %} \ No newline at end of file diff --git a/templates/php/src/Client.php.twig b/templates/php/src/Client.php.twig index 76bafa344d..040b13aa7a 100644 --- a/templates/php/src/Client.php.twig +++ b/templates/php/src/Client.php.twig @@ -37,7 +37,10 @@ class Client */ protected $headers = [ 'content-type' => '', - 'x-sdk-version' => '{{spec.title | caseDash}}:{{ language.name | caseLower }}:{{ sdk.version }}', + 'x-sdk-name'=> '{{ sdk.name }}', + 'x-sdk-platform'=> '{{ sdk.platform }}', + 'x-sdk-language'=> '{{ language.name | caseLower }}', + 'x-sdk-version'=> '{{ sdk.version }}', ]; /** diff --git a/templates/php/src/ID.php.twig b/templates/php/src/ID.php.twig new file mode 100644 index 0000000000..48514d84cc --- /dev/null +++ b/templates/php/src/ID.php.twig @@ -0,0 +1,15 @@ +data; + } + + public function getPath(): ?string + { + return $this->path; + } + + public function getMimeType(): ?string + { + return $this->mimeType; + } + + public function getFilename(): ?string + { + return $this->filename; + } + + public static function withPath(string $path, ?string $mimeType = null, ?string $filename = null) + { + $instance = new InputFile(); + $instance->path = $path; + $instance->data = null; + $instance->mimeType = $mimeType; + $instance->filename = $filename; + return $instance; + } + + public static function withData(string $data, ?string $mimeType = null, ?string $filename = null) + { + $instance = new InputFile(); + $instance->path = null; + $instance->data = $data; + $instance->mimeType = $mimeType; + $instance->filename = $filename; + return $instance; + } +} \ No newline at end of file diff --git a/templates/php/src/Permission.php.twig b/templates/php/src/Permission.php.twig new file mode 100644 index 0000000000..941565e7c4 --- /dev/null +++ b/templates/php/src/Permission.php.twig @@ -0,0 +1,27 @@ +client = $client; + } + {% for method in service.methods %} /** * {{ method.title }} @@ -17,117 +23,21 @@ class {{ service.name | caseUcfirst }} extends Service * {% endif %} {% for parameter in method.parameters.all %} - * @param {{ parameter.type | typeName }}${{ parameter.name | caseCamel | escapeKeyword }} + * @param {{ parameter | typeName }}${{ parameter.name | caseCamel | escapeKeyword }} {% endfor %} * @throws {{spec.title | caseUcfirst}}Exception - * @return {% if (method.type == 'location') %}string{% else %}array{% endif %} + * @return {{ method | getReturn }} */ - public function {{ method.name | caseCamel }}({% for parameter in method.parameters.all %}{{ parameter.type | typeName }}${{ parameter.name | caseCamel | escapeKeyword }}{% if not parameter.required %} = null{% endif %}{% if not loop.last %}, {% endif %}{% endfor %}{% if 'multipart/form-data' in method.consumes %}, callable $onProgress = null{% endif %}): {% if (method.type == 'location') %}string{% else %}array{% endif %} - + public function {{ method.name | caseCamel }}({% for parameter in method.parameters.all %}{{ parameter | typeName }}${{ parameter.name | caseCamel | escapeKeyword }}{% if not parameter.required %} = null{% endif %}{% if not loop.last %}, {% endif %}{% endfor %}{% if 'multipart/form-data' in method.consumes %}, callable $onProgress = null{% endif %}): {{ method | getReturn }} { -{% for parameter in method.parameters.all %} -{% if parameter.required %} - if (!isset(${{ parameter.name | caseCamel | escapeKeyword }})) { - throw new {{spec.title | caseUcfirst}}Exception('Missing required parameter: "{{ parameter.name | caseCamel | escapeKeyword }}"'); - } - -{% endif %} -{% endfor %} $path = str_replace([{% for parameter in method.parameters.path %}'{{ '{' }}{{ parameter.name | caseCamel }}{{ '}' }}'{% if not loop.last %}, {% endif %}{% endfor %}], [{% for parameter in method.parameters.path %}${{ parameter.name | caseCamel | escapeKeyword }}{% if not loop.last %}, {% endif %}{% endfor %}], '{{ method.path }}'); - $params = []; - -{% for parameter in method.parameters.query %} - if (!is_null(${{ parameter.name | caseCamel | escapeKeyword }})) { - $params['{{ parameter.name }}'] = ${{ parameter.name | caseCamel | escapeKeyword }}; - } -{% endfor %} -{% for parameter in method.parameters.body %} - if (!is_null(${{ parameter.name | caseCamel | escapeKeyword }})) { - $params['{{ parameter.name }}'] = ${{ parameter.name | caseCamel | escapeKeyword }}; - } - -{% endfor %} -{% for parameter in method.parameters.formData %} - if (!is_null(${{ parameter.name | caseCamel | escapeKeyword }})) { - $params['{{ parameter.name }}'] = ${{ parameter.name | caseCamel | escapeKeyword }}; - } - -{% endfor %} +{{ include('php/base/params.twig') }} {% if 'multipart/form-data' in method.consumes %} -{% for parameter in method.parameters.all %} -{% if parameter.type == 'file' %} - $size = filesize(${{ parameter.name | caseCamel }}); - $mimeType = mime_content_type(${{ parameter.name | caseCamel }}); - $postedName = basename(${{ parameter.name | caseCamel }}); - //send single file if size is less than or equal to 5MB - if ($size <= Client::CHUNK_SIZE) { - $params['{{ parameter.name }}'] = new \CURLFile(${{ parameter.name | caseCamel }}, $mimeType, $postedName); - return $this->client->call(Client::METHOD_{{ method.method | caseUpper }}, $path, [ -{% for param in method.parameters.header %} - '{{ param.name }}' => ${{ param.name | caseCamel }}, -{% endfor %} -{% for key, header in method.headers %} - '{{ key }}' => '{{ header }}', -{% endfor %} - ], $params); - } - - $id = ''; - $counter = 0; - -{% for parameter in method.parameters.all %} -{% if parameter.isUploadID %} - if(${{ parameter.name | caseCamel | escapeKeyword }} != 'unique()') { - try { - $response = $this->client->call(Client::METHOD_GET, new URL($path . '/' . {{ parameter.name }}), headers); - $counter = $response['chunksUploaded'] ?? 0; - } catch(\Exception $e) { - } - } -{% endif %} -{% endfor %} - - $headers = ['content-type' => 'multipart/form-data']; - $handle = @fopen(${{ parameter.name | caseCamel }}, "rb"); - $start = $counter * Client::CHUNK_SIZE; - while ($start < $size) { - fseek($handle, $start); - $params['{{ parameter.name }}'] = new \CURLFile('data://' . $mimeType . ';base64,' . base64_encode(@fread($handle, Client::CHUNK_SIZE)), $mimeType, $postedName); - $headers['content-range'] = 'bytes ' . ($counter * Client::CHUNK_SIZE) . '-' . min(((($counter * Client::CHUNK_SIZE) + Client::CHUNK_SIZE) - 1), $size) . '/' . $size; - if(!empty($id)) { - $headers['x-{{spec.title | caseLower }}-id'] = $id; - } - $response = $this->client->call(Client::METHOD_POST, $path, $headers, $params); - $counter++; - $start += Client::CHUNK_SIZE; - if(empty($id)) { - $id = $response['$id']; - } - if($onProgress !== null) { - $onProgress([ - '$id' => $response['$id'], - 'progress' => min(((($counter * Client::CHUNK_SIZE) + Client::CHUNK_SIZE) - 1), $size) / $size * 100, - 'sizeUploaded' => min($counter * Client::CHUNK_SIZE), - 'chunksTotal' => $response['chunksTotal'], - 'chunksUploaded' => $response['chunksUploaded'], - ]); - } - } - @fclose($handle); - return $response; -{% endif %} -{% endfor %} +{{ include('php/base/requests/file.twig') }} {% else %} - return $this->client->call(Client::METHOD_{{ method.method | caseUpper }}, $path, [ -{% for parameter in method.parameters.header %} - '{{ parameter.name }}' => ${{ parameter.name | caseCamel | escapeKeyword }}, -{% endfor %} -{% for key, header in method.headers %} - '{{ key }}' => '{{ header }}', -{% endfor %} - ], $params); +{{ include('php/base/requests/api.twig') }} {% endif %} } {% if not loop.last %} diff --git a/templates/python/LICENSE.twig b/templates/python/LICENSE.twig index 0e8c361b49..854eb19494 100644 --- a/templates/python/LICENSE.twig +++ b/templates/python/LICENSE.twig @@ -1 +1 @@ -{{sdk.licenseContent}} \ No newline at end of file +{{sdk.licenseContent | raw}} \ No newline at end of file diff --git a/templates/python/base/params.twig b/templates/python/base/params.twig new file mode 100644 index 0000000000..faf595f080 --- /dev/null +++ b/templates/python/base/params.twig @@ -0,0 +1,31 @@ + params = {} +{% if method.parameters.all | length %} +{% for parameter in method.parameters.all %} +{% if parameter.required %} + if {{ parameter.name | escapeKeyword | caseSnake }} is None: + raise {{spec.title | caseUcfirst}}Exception('Missing required parameter: "{{ parameter.name | escapeKeyword | caseSnake }}"') + +{% endif %} +{% endfor %} +{% for parameter in method.parameters.path %} + path = path.replace('{{ '{' }}{{ parameter.name | caseCamel }}{{ '}' }}', {{ parameter.name | escapeKeyword | caseSnake }}) +{% endfor %} + +{% for parameter in method.parameters.query %} + params['{{ parameter.name }}'] = {{ parameter.name | escapeKeyword | caseSnake }} +{% endfor %} +{% for parameter in method.parameters.body %} +{% if method.consumes[0] == "multipart/form-data" and ( parameter.type != "string" and parameter.type != "array" ) %} + params['{{ parameter.name }}'] = str({{ parameter.name | escapeKeyword | caseSnake }}).lower() if type({{ parameter.name | escapeKeyword | caseSnake }}) is bool else {{ parameter.name | escapeKeyword | caseSnake }} +{% else %} + params['{{ parameter.name }}'] = {{ parameter.name | escapeKeyword | caseSnake }} +{% endif %} +{% endfor %} +{% for parameter in method.parameters.formData %} +{% if method.consumes[0] == "multipart/form-data" and ( parameter.type != "string" and parameter.type != "array" ) %} + params['{{ parameter.name }}'] = str({{ parameter.name | escapeKeyword | caseSnake }}).lower() if type({{ parameter.name | escapeKeyword | caseSnake }}) is bool else {{ parameter.name | escapeKeyword | caseSnake }} +{% else %} + params['{{ parameter.name }}'] = {{ parameter.name | escapeKeyword | caseSnake }} +{% endif %} +{% endfor %} +{% endif %} \ No newline at end of file diff --git a/templates/python/base/requests/api.twig b/templates/python/base/requests/api.twig new file mode 100644 index 0000000000..defae28198 --- /dev/null +++ b/templates/python/base/requests/api.twig @@ -0,0 +1,8 @@ + return self.client.call('{{ method.method | caseLower }}', path, { +{% for parameter in method.parameters.header %} + '{{ parameter.name }}': {{ parameter.name | escapeKeyword | caseSnake }}, +{% endfor %} +{% for key, header in method.headers %} + '{{ key }}': '{{ header }}', +{% endfor %} + }, params) \ No newline at end of file diff --git a/templates/python/base/requests/file.twig b/templates/python/base/requests/file.twig new file mode 100644 index 0000000000..8a8d223ffd --- /dev/null +++ b/templates/python/base/requests/file.twig @@ -0,0 +1,22 @@ +{% for parameter in method.parameters.all %} +{% if parameter.type == 'file' %} + param_name = '{{ parameter.name }}' + +{% endif %} +{% endfor %} + + upload_id = '' +{% for parameter in method.parameters.all %} +{% if parameter.isUploadID %} + upload_id = {{ parameter.name | escapeKeyword | caseSnake }} +{% endif %} +{% endfor %} + + return self.client.chunked_upload(path, { +{% for parameter in method.parameters.header %} + '{{ parameter.name }}': {{ parameter.name | escapeKeyword | caseSnake }}, +{% endfor %} +{% for key, header in method.headers %} + '{{ key }}': '{{ header }}', +{% endfor %} + }, params, param_name, on_progress, upload_id) \ No newline at end of file diff --git a/templates/python/docs/example.md.twig b/templates/python/docs/example.md.twig index 0326405e7c..7beffa9783 100644 --- a/templates/python/docs/example.md.twig +++ b/templates/python/docs/example.md.twig @@ -1,18 +1,21 @@ from {{ spec.title | caseSnake }}.client import Client +{% if method.parameters.all | filter((param) => param.type == 'file') | length > 0 %} +from {{ spec.title | caseSnake }}.input_file import InputFile +{% endif %} from {{ spec.title | caseSnake }}.services.{{ service.name | caseSnake }} import {{ service.name | caseUcfirst }} client = Client() -{% if method.security|length > 0 %} +{% if method.auth|length > 0 %} (client .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint -{% for node in method.security %} +{% for node in method.auth %} {% for key,header in node|keys %} .set_{{header | caseSnake}}('{{node[header]['x-appwrite']['demo']}}') # {{node[header].description}} {% endfor %} {% endfor %}) {% endif %} -{{ service.name | caseSnake }} = {{ service.name | caseUcfirst }}(client) +{{ service.name | caseSnake }} = {{ service.name | caseUcfirst }}(client{% if service.globalParams | length %}{% for parameter in service.globalParams %}, {{ parameter | paramExample }}{% endfor %}{% endif %}) result = {{ service.name | caseSnake }}.{{ method.name | caseSnake }}({% for parameter in method.parameters.all %}{% if parameter.required %}{% if not loop.first %}, {% endif %}{{ parameter | paramExample }}{% endif %}{% endfor %}) diff --git a/templates/python/package/client.py.twig b/templates/python/package/client.py.twig index 181f3dca22..0d5b2fbb9f 100644 --- a/templates/python/package/client.py.twig +++ b/templates/python/package/client.py.twig @@ -11,7 +11,10 @@ class Client: self._endpoint = '{{spec.endpoint}}' self._global_headers = { 'content-type': '', - 'x-sdk-version': '{{spec.title | caseDash}}:{{ language.name | caseLower }}:{{ sdk.version }}', + 'x-sdk-name': '{{ sdk.name }}', + 'x-sdk-platform': '{{ sdk.platform }}', + 'x-sdk-language': '{{ language.name | caseLower }}', + 'x-sdk-version': '{{ sdk.version }}', {% for key,header in spec.global.defaultHeaders %} '{{key}}' : '{{header}}', {% endfor %} @@ -66,7 +69,7 @@ class Client: stringify = True for key in data.copy(): if isinstance(data[key], InputFile): - files[key] = (data[key].name, data[key].file) + files[key] = (data[key].filename, data[key].data) del data[key] response = None try: @@ -108,13 +111,20 @@ class Client: on_progress = None, upload_id = '' ): - file_path = str(params[param_name]) - file_name = os.path.basename(file_path) - size = os.stat(file_path).st_size + input_file = params[param_name] + + if input_file.source_type == 'path': + size = os.stat(input_file.path).st_size + input = open(input_file.path, 'rb') + elif input_file.source_type == 'bytes': + size = len(input_file.data) + input = input_file.data if size < self._chunk_size: - slice = open(file_path, 'rb').read() - params[param_name] = InputFile(file_path, file_name, slice) + if input_file.source_type == 'path': + input_file.data = input.read() + + params[param_name] = input_file return self.call( 'post', path, @@ -122,7 +132,6 @@ class Client: params ) - input = open(file_path, 'rb') offset = 0 counter = 0 @@ -138,9 +147,16 @@ class Client: input.seek(offset) while offset < size: - slice = input.read(self._chunk_size) or input.read(size - offset) + if input_file.source_type == 'path': + input_file.data = input.read(self._chunk_size) or input.read(size - offset) + elif input_file.source_type == 'bytes': + if offset + self._chunk_size < size: + end = offset + self._chunk_size + else: + end = size - offset + input_file.data = input[offset:end] - params[param_name] = InputFile(file_path, file_name, slice) + params[param_name] = input_file headers["content-range"] = f'bytes {offset}-{min((offset + self._chunk_size) - 1, size)}/{size}' result = self.call( diff --git a/templates/python/package/id.py.twig b/templates/python/package/id.py.twig new file mode 100644 index 0000000000..a9ed5f3264 --- /dev/null +++ b/templates/python/package/id.py.twig @@ -0,0 +1,8 @@ +class ID: + @staticmethod + def custom(id): + return id + + @staticmethod + def unique(): + return 'unique()' \ No newline at end of file diff --git a/templates/python/package/input_file.py.twig b/templates/python/package/input_file.py.twig index 4351d071a6..9f11b0c2a8 100644 --- a/templates/python/package/input_file.py.twig +++ b/templates/python/package/input_file.py.twig @@ -1,5 +1,21 @@ +import os +import mimetypes + class InputFile: - def __init__(self, path, name, file): - self.path = path - self.name = name - self.file = file \ No newline at end of file + @classmethod + def from_path(cls, path): + instance = cls() + instance.path = path + instance.filename = os.path.basename(path) + instance.mime_type = mimetypes.guess_type(path) + instance.source_type = 'path' + return instance + + @classmethod + def from_bytes(cls, bytes, filename = None, mime_type = None): + instance = cls() + instance.data = bytes + instance.filename = filename + instance.mime_type = mime_type + instance.source_type = 'bytes' + return instance \ No newline at end of file diff --git a/templates/python/package/permission.py.twig b/templates/python/package/permission.py.twig new file mode 100644 index 0000000000..7178b8c429 --- /dev/null +++ b/templates/python/package/permission.py.twig @@ -0,0 +1,21 @@ +class Permission: + + @staticmethod + def read(role): + return f'read("{role}")' + + @staticmethod + def write(role): + return f'write("{role}")' + + @staticmethod + def create(role): + return f'create("{role}")' + + @staticmethod + def update(role): + return f'update("{role}")' + + @staticmethod + def delete(role): + return f'delete("{role}")' diff --git a/templates/python/package/query.py.twig b/templates/python/package/query.py.twig index 3a6179df32..7896958367 100644 --- a/templates/python/package/query.py.twig +++ b/templates/python/package/query.py.twig @@ -8,35 +8,61 @@ class Query: return Query.addQuery(attribute, "notEqual", value) @staticmethod - def lesser(attribute, value): - return Query.addQuery(attribute, "lesser", value) + def lessThan(attribute, value): + return Query.addQuery(attribute, "lessThan", value) @staticmethod - def lesserEqual(attribute, value): - return Query.addQuery(attribute, "lesserEqual", value) + def lessThanEqual(attribute, value): + return Query.addQuery(attribute, "lessThanEqual", value) @staticmethod - def greater(attribute, value): - return Query.addQuery(attribute, "greater", value) + def greaterThan(attribute, value): + return Query.addQuery(attribute, "greaterThan", value) @staticmethod - def greaterEqual(attribute, value): - return Query.addQuery(attribute, "greaterEqual", value) + def greaterThanEqual(attribute, value): + return Query.addQuery(attribute, "greaterThanEqual", value) @staticmethod def search(attribute, value): return Query.addQuery(attribute, "search", value) @staticmethod - def addQuery(attribute, oper, value): + def orderAsc(attribute): + return f'orderAsc("{attribute}")' + + @staticmethod + def orderDesc(attribute): + return f'orderDesc("{attribute}")' + + @staticmethod + def cursorBefore(id): + return f'cursorBefore("{id}")' + + @staticmethod + def cursorAfter(id): + return f'cursorAfter("{id}")' + + @staticmethod + def limit(limit): + return f'limit({limit})' + + @staticmethod + def offset(offset): + return f'offset({offset})' + + @staticmethod + def addQuery(attribute, method, value): if type(value) == list: - return '{}.{}({})'.format(attribute,oper, ','.join(map(Query.parseValues, value))) + return f'{method}("{attribute}", [{",".join(map(Query.parseValues, value))}])' else: - return '{}.{}({})'.format(attribute,oper, Query.parseValues(value)) + return f'{method}("{attribute}", [{Query.parseValues(value)}])' @staticmethod def parseValues(value): if type(value) == str: - return '"{}"'.format(value) + return f'"{value}"' + elif type(value) == bool: + return str(value).lower() else: - return value \ No newline at end of file + return str(value) \ No newline at end of file diff --git a/templates/python/package/role.py.twig b/templates/python/package/role.py.twig new file mode 100644 index 0000000000..c794826708 --- /dev/null +++ b/templates/python/package/role.py.twig @@ -0,0 +1,30 @@ +class Role: + @staticmethod + def any(): + return 'any' + + @staticmethod + def user(id, status = ""): + if status: + return f'user:{id}/{status}' + return f'user:{id}' + + @staticmethod + def users(status = ""): + if status: + return f'users/{status}' + return 'users' + + @staticmethod + def guests(): + return 'guests' + + @staticmethod + def team(id, role = ""): + if role: + return f'team:{id}/{role}' + return f'team:{id}' + + @staticmethod + def member(id): + return f'member:{id}' \ No newline at end of file diff --git a/templates/python/package/services/service.py.twig b/templates/python/package/services/service.py.twig index 1035c4ba31..df665f003b 100644 --- a/templates/python/package/services/service.py.twig +++ b/templates/python/package/services/service.py.twig @@ -11,73 +11,12 @@ class {{ service.name | caseUcfirst }}(Service): {% if method.title %} """{{ method.title }}""" -{% endif %} -{% for parameter in method.parameters.all %} -{% if parameter.required %} - if {{ parameter.name | escapeKeyword | caseSnake }} is None: - raise {{spec.title | caseUcfirst}}Exception('Missing required parameter: "{{ parameter.name | escapeKeyword | caseSnake }}"') - -{% endif %} -{% endfor %} - params = {} +{% endif %} path = '{{ method.path }}' -{% for parameter in method.parameters.path %} - path = path.replace('{{ '{' }}{{ parameter.name | caseCamel }}{{ '}' }}', {{ parameter.name | escapeKeyword | caseSnake }}) -{% endfor %} - -{% for parameter in method.parameters.query %} - if {{ parameter.name | escapeKeyword | caseSnake }} is not None: - params['{{ parameter.name }}'] = {{ parameter.name | escapeKeyword | caseSnake }} - -{% endfor %} -{% for parameter in method.parameters.body %} - if {{ parameter.name | escapeKeyword | caseSnake }} is not None: -{% if method.consumes[0] == "multipart/form-data" and ( parameter.type != "string" and parameter.type != "array" ) %} - params['{{ parameter.name }}'] = str({{ parameter.name | escapeKeyword | caseSnake }}).lower() if type({{ parameter.name | escapeKeyword | caseSnake }}) is bool else {{ parameter.name | escapeKeyword | caseSnake }} -{% else %} - params['{{ parameter.name }}'] = {{ parameter.name | escapeKeyword | caseSnake }} -{% endif %} -{% endfor %} -{% for parameter in method.parameters.formData %} - if {{ parameter.name | escapeKeyword | caseSnake }} is not None: -{% if method.consumes[0] == "multipart/form-data" and ( parameter.type != "string" and parameter.type != "array" ) %} - params['{{ parameter.name }}'] = str({{ parameter.name | escapeKeyword | caseSnake }}).lower() if type({{ parameter.name | escapeKeyword | caseSnake }}) is bool else {{ parameter.name | escapeKeyword | caseSnake }} -{% else %} - params['{{ parameter.name }}'] = {{ parameter.name | escapeKeyword | caseSnake }} -{% endif %} - -{% endfor %} +{{ include('python/base/params.twig') }} {% if 'multipart/form-data' in method.consumes %} -{% for parameter in method.parameters.all %} -{% if parameter.type == 'file' %} - param_name = '{{ parameter.name }}' - -{% endif %} -{% endfor %} - - upload_id = '' -{% for parameter in method.parameters.all %} -{% if parameter.isUploadID %} - upload_id = {{ parameter.name | escapeKeyword | caseSnake }} -{% endif %} -{% endfor %} - - return self.client.chunked_upload(path, { -{% for parameter in method.parameters.header %} - '{{ parameter.name }}': {{ parameter.name | escapeKeyword | caseSnake }}, -{% endfor %} -{% for key, header in method.headers %} - '{{ key }}': '{{ header }}', -{% endfor %} - }, params, param_name, on_progress, upload_id) +{{ include('python/base/requests/file.twig') }} {% else %} - return self.client.call('{{ method.method | caseLower }}', path, { -{% for parameter in method.parameters.header %} - '{{ parameter.name }}': {{ parameter.name | escapeKeyword | caseSnake }}, -{% endfor %} -{% for key, header in method.headers %} - '{{ key }}': '{{ header }}', -{% endfor %} - }, params) +{{ include('python/base/requests/api.twig') }} {% endif %} {% endfor %} diff --git a/templates/python/requirements.txt.twig b/templates/python/requirements.txt.twig index 9cdfca0c2e..5e77405687 100644 --- a/templates/python/requirements.txt.twig +++ b/templates/python/requirements.txt.twig @@ -1 +1 @@ -requests==2.27.1 \ No newline at end of file +requests==2.28.1 \ No newline at end of file diff --git a/templates/python/setup.py.twig b/templates/python/setup.py.twig index 82867e2fe1..12eee5774b 100644 --- a/templates/python/setup.py.twig +++ b/templates/python/setup.py.twig @@ -1,11 +1,18 @@ import setuptools +long_description: str + +with open("README.md", "r", encoding="utf-8") as readme_file_desc: + long_description = readme_file_desc.read() + setuptools.setup( name = '{{spec.title | caseSnake}}', packages = ['{{spec.title | caseSnake}}', '{{spec.title | caseSnake}}/services'], version = '{{sdk.version}}', license='{{spec.licenseName}}', description = '{{sdk.shortDescription}}', + long_description = long_description, + long_description_content_type = 'text/markdown', author = '{{spec.contactName}}', author_email = '{{spec.contactEmail}}', maintainer = '{{spec.contactName}}', diff --git a/templates/http/docs/example.md.twig b/templates/rest/docs/example.md.twig similarity index 62% rename from templates/http/docs/example.md.twig rename to templates/rest/docs/example.md.twig index 594be49b7c..80e71e1201 100644 --- a/templates/http/docs/example.md.twig +++ b/templates/rest/docs/example.md.twig @@ -1,33 +1,31 @@ +{% set boundary = 'cec8e8123c05ba25' %} {{ method.method | caseUpper }} {{spec.basePath}}{{ method.path }} HTTP/1.1 -Host: {{spec.host}} +Host: {{ spec.host }} {% for key, header in method.headers %} -{{ key }}: {{ header }} +{{ key | caseUcwords }}: {{ header }}{% if header == 'multipart/form-data' %}; boundary="{{boundary}}"{% endif ~%} {% endfor %} {% for key,header in spec.global.defaultHeaders %} -{{key}}: {{header}} +{{ key }}: {{ header }} +{% endfor %} +{% for node in method.security %} +{% for key,header in node | keys %} +{{ node[header]['name'] }}: {{ node[header]['x-appwrite']['demo'] }} {% endfor %} -{% for header in spec.global.headers %} -{% if header.key != 'Mode' and header.key != 'Locale' %} -{{header.name}}: {% for node in method.security %}{% for key,x in node|keys %}{% if x == header.key %}{{node[x]['x-appwrite']['demo']}}{% endif %}{% endfor %}{% endfor %} - -{% endif %} {% endfor %} - {% for key, header in method.headers %} {% if header == 'application/json' %} + {% if method.parameters.body %} { {% for parameter in method.parameters.body %} - "{{ parameter.name }}": "{{ parameter | paramExample }}"{% if not loop.last %},{% endif %} - + "{{ parameter.name }}": {{ parameter | paramExample }}{% if not loop.last %},{% endif ~%} {% endfor %} } {% endif %} {% endif %} {% if header == 'multipart/form-data' %} -{% set boundary = random() %} -boundary={{boundary}} Content-Length: *Length of your entity body in bytes* + {% for parameter in method.parameters.body %} --{{boundary}} Content-Disposition: form-data; name="{{parameter.name}}{% if parameter.type == "array" %}[]{% endif %}" diff --git a/templates/ruby/LICENSE.twig b/templates/ruby/LICENSE.twig index 0e8c361b49..854eb19494 100644 --- a/templates/ruby/LICENSE.twig +++ b/templates/ruby/LICENSE.twig @@ -1 +1 @@ -{{sdk.licenseContent}} \ No newline at end of file +{{sdk.licenseContent | raw}} \ No newline at end of file diff --git a/templates/ruby/base/params.twig b/templates/ruby/base/params.twig new file mode 100644 index 0000000000..8483a2bf4c --- /dev/null +++ b/templates/ruby/base/params.twig @@ -0,0 +1,27 @@ + path = '{{ method.path }}' +{% for parameter in method.parameters.path %} + .gsub('{{ '{' }}{{ parameter.name }}{{ '}' }}', {{ parameter.name | caseSnake | escapeKeyword }}) +{% endfor %} + +{% for parameter in method.parameters.all %} +{% if parameter.required %} + if {{ parameter.name | caseSnake | escapeKeyword }}.nil? + raise {{spec.title | caseUcfirst}}::Exception.new('Missing required parameter: "{{ parameter.name | caseCamel | escapeKeyword }}"') + end + +{% endif %} +{% endfor %} + params = { +{% for parameter in method.parameters.query | merge(method.parameters.body) %} + {{ parameter.name }}: {{ parameter.name | caseSnake | escapeKeyword }}, +{% endfor %} + } + + headers = { +{% for parameter in method.parameters.header %} + "{{ parameter.name }}": {{ parameter.name | caseCamel | escapeKeyword }}, +{% endfor %} +{% for key, header in method.headers %} + "{{ key }}": '{{ header }}', +{% endfor %} + } diff --git a/templates/ruby/base/requests/api.twig b/templates/ruby/base/requests/api.twig new file mode 100644 index 0000000000..0ac82da49d --- /dev/null +++ b/templates/ruby/base/requests/api.twig @@ -0,0 +1,9 @@ + @client.call( + method: '{{ method.method | caseUpper }}', + path: path, + headers: headers, + params: params, +{% if method.responseModel and method.responseModel != 'any' %} + response_type: Models::{{method.responseModel | caseUcfirst}} +{% endif %} + ) \ No newline at end of file diff --git a/templates/ruby/base/requests/file.twig b/templates/ruby/base/requests/file.twig new file mode 100644 index 0000000000..f7dcb443e6 --- /dev/null +++ b/templates/ruby/base/requests/file.twig @@ -0,0 +1,19 @@ + id_param_name = {% if method.parameters.all | filter(p => p.isUploadID) | length > 0 %}{% for parameter in method.parameters.all | filter(parameter => parameter.isUploadID) %}"{{ parameter.name }}"{% endfor %}{% else %}nil{% endif %} + +{% for parameter in method.parameters.all %} +{% if parameter.type == 'file' %} + param_name = '{{ parameter.name }}' + +{% endif %} +{% endfor %} + @client.chunked_upload( + path: path, + headers: headers, + params: params, + param_name: param_name, + id_param_name: id_param_name, + on_progress: on_progress, +{% if method.responseModel and method.responseModel != 'any' %} + response_type: Models::{{method.responseModel | caseUcfirst}} +{% endif %} + ) \ No newline at end of file diff --git a/templates/ruby/docs/example.md.twig b/templates/ruby/docs/example.md.twig index 3faecfa6f9..41fc53d422 100644 --- a/templates/ruby/docs/example.md.twig +++ b/templates/ruby/docs/example.md.twig @@ -1,17 +1,17 @@ -require 'appwrite' +require '{{ spec.title }}' -client = Appwrite::Client.new +include {{ spec.title | caseUcfirst }} -client +client = Client.new .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint -{% for node in method.security %} +{% for node in method.auth %} {% for key,header in node|keys %} .set_{{header|caseSnake}}('{{node[header]['x-appwrite']['demo']}}') # {{node[header].description}} {% endfor %} {% endfor %} -{{ service.name | caseSnake }} = {{spec.title | caseUcfirst}}::{{ service.name | caseUcfirst }}.new(client) +{{ service.name | caseSnake }} = {{ service.name | caseUcfirst }}.new(client{% if service.globalParams | length %}{% for parameter in service.globalParams %}, {{parameter.name | caseSnake}}:{{ parameter | paramExample }}{% endfor %}{% endif %}) -response = {{ service.name | caseSnake }}.{{ method.name | caseSnake }}({% for parameter in method.parameters.all %}{% if parameter.required %}{% if not loop.first %}, {% endif %}{{parameter.name|caseSnake}}: {% if parameter | paramExample == "File.new" %}{{spec.title | caseUcfirst}}::{{ parameter | paramExample }}{% else %}{{ parameter | paramExample }}{% endif %}{% endif %}{% endfor %}) +response = {{ service.name | caseSnake }}.{{ method.name | caseSnake }}({% for parameter in method.parameters.all %}{% if parameter.required %}{% if not loop.first %}, {% endif %}{{parameter.name|caseSnake}}: {% if parameter.type == 'file' %}{{ parameter | paramExample }}{% else %}{{ parameter | paramExample }}{% endif %}{% endif %}{% endfor %}) puts response.inspect \ No newline at end of file diff --git a/templates/ruby/lib/container.rb.twig b/templates/ruby/lib/container.rb.twig index 34433f3024..688d54357b 100644 --- a/templates/ruby/lib/container.rb.twig +++ b/templates/ruby/lib/container.rb.twig @@ -6,7 +6,11 @@ require 'mime/types' require_relative '{{ spec.title | caseSnake }}/client' require_relative '{{ spec.title | caseSnake }}/service' require_relative '{{ spec.title | caseSnake }}/exception' -require_relative '{{ spec.title | caseSnake }}/file' +require_relative '{{ spec.title | caseSnake }}/input_file' +require_relative '{{ spec.title | caseSnake }}/query' +require_relative '{{ spec.title | caseSnake }}/permission' +require_relative '{{ spec.title | caseSnake }}/role' +require_relative '{{ spec.title | caseSnake }}/id' {% for defintion in spec.definitions %} require_relative '{{ spec.title | caseSnake }}/models/{{ defintion.name | caseSnake }}' diff --git a/templates/ruby/lib/container/client.rb.twig b/templates/ruby/lib/container/client.rb.twig index a2de462b74..fc0762dc97 100644 --- a/templates/ruby/lib/container/client.rb.twig +++ b/templates/ruby/lib/container/client.rb.twig @@ -12,7 +12,10 @@ module {{ spec.title | caseUcfirst }} @chunk_size = 5*1024*1024 @headers = { 'user-agent' => RUBY_PLATFORM + ':{{ language.name | caseLower }}-' + RUBY_VERSION, - 'x-sdk-version' => '{{ spec.title | caseDash }}:{{ language.name | caseLower }}:{{ sdk.version }}'{% if spec.global.defaultHeaders | length > 0 %},{% endif %} + 'x-sdk-name'=> '{{ sdk.name }}', + 'x-sdk-platform'=> '{{ sdk.platform }}', + 'x-sdk-language'=> '{{ language.name | caseLower }}', + 'x-sdk-version'=> '{{ sdk.version }}'{% if spec.global.defaultHeaders | length > 0 %},{% endif %} {% for key,header in spec.global.defaultHeaders %} '{{key}}' => '{{header}}'{% if not loop.last %},{% endif %} @@ -104,12 +107,20 @@ module {{ spec.title | caseUcfirst }} on_progress: nil, response_type: nil ) - file_path = params[param_name.to_sym] - size = ::File.size(file_path) + input_file = params[param_name.to_sym] + + case input_file.source_type + when 'path' + size = ::File.size(input_file.path) + when 'string' + size = input_file.data.bytesize + end if size < @chunk_size - slice = ::File.read(file_path) - params[param_name] = File.new(file_path, slice) + if input_file.source_type == 'path' + input_file.data = IO.read(input_file.path) + end + params[param_name.to_sym] = input_file return call( method: 'POST', path: path, @@ -134,9 +145,19 @@ module {{ spec.title | caseUcfirst }} end while offset < size - slice = IO.read(file_path, @chunk_size, offset) + case input_file.source_type + when 'path' + string = IO.read(input_file.path, @chunk_size, offset) + when 'string' + string = input_file.data.byteslice(offset, [@chunk_size, size - offset].min) + end + + params[param_name.to_sym] = InputFile::from_string( + string, + filename: input_file.filename, + mime_type: input_file.mime_type + ) - params[param_name] = File.new(file_path, slice) headers['content-range'] = "bytes #{offset}-#{[offset + @chunk_size - 1, size].min}/#{size}" result = call( @@ -250,10 +271,10 @@ module {{ spec.title | caseUcfirst }} '' else post_body = [] - if value.instance_of? File - post_body << "Content-Disposition: form-data; name=\"#{key}\"; filename=\"#{value.name}\"\r\n" + if value.instance_of? InputFile + post_body << "Content-Disposition: form-data; name=\"#{key}\"; filename=\"#{value.filename}\"\r\n" post_body << "Content-Type: #{value.mime_type}\r\n\r\n" - post_body << value.content + post_body << value.data post_body << "\r\n--#{@boundary}--\r\n" else post_body << "Content-Disposition: form-data; name=\"#{key}\"\r\n\r\n" diff --git a/templates/ruby/lib/container/file.rb.twig b/templates/ruby/lib/container/file.rb.twig deleted file mode 100644 index 1ad7d2fa1d..0000000000 --- a/templates/ruby/lib/container/file.rb.twig +++ /dev/null @@ -1,17 +0,0 @@ -require 'mime/types' - -module {{spec.title | caseUcfirst}} - class File - attr_reader :path - attr_reader :name - attr_reader :content - attr_reader :mime_type - - def initialize(path, content) - @path = path - @content = content - @name = ::File.basename(path) - @mime_type = MIME::Types.type_for(path) - end - end -end \ No newline at end of file diff --git a/templates/ruby/lib/container/id.rb.twig b/templates/ruby/lib/container/id.rb.twig new file mode 100644 index 0000000000..29ed99b0df --- /dev/null +++ b/templates/ruby/lib/container/id.rb.twig @@ -0,0 +1,11 @@ +module {{spec.title | caseUcfirst}} + class ID + def self.custom(id) + id + end + + def self.unique + 'unique()' + end + end +end \ No newline at end of file diff --git a/templates/ruby/lib/container/input_file.rb.twig b/templates/ruby/lib/container/input_file.rb.twig new file mode 100644 index 0000000000..2d8afe8022 --- /dev/null +++ b/templates/ruby/lib/container/input_file.rb.twig @@ -0,0 +1,33 @@ +require 'mime/types' + +module {{spec.title | caseUcfirst}} + class InputFile + attr_accessor :path + attr_accessor :filename + attr_accessor :mime_type + attr_accessor :source_type + attr_accessor :data + + def self.from_path(path) + instance = InputFile.new + instance.path = path + instance.filename = ::File.basename(path) + instance.mime_type = MIME::Types.type_for(path).first.content_type + instance.source_type = 'path' + instance + end + + def self.from_string(string, filename: nil, mime_type: nil) + instance = InputFile.new + instance.data = string + instance.filename = filename + instance.mime_type = mime_type + instance.source_type = 'string' + instance + end + + def self.from_bytes(bytes, filename: nil, mime_type: nil) + self.from_string(bytes.pack('C*'), filename: filename, mime_type: mime_type) + end + end +end \ No newline at end of file diff --git a/templates/ruby/lib/container/models/model.rb.twig b/templates/ruby/lib/container/models/model.rb.twig index 6cfe64b17f..a60c19df3e 100644 --- a/templates/ruby/lib/container/models/model.rb.twig +++ b/templates/ruby/lib/container/models/model.rb.twig @@ -1,4 +1,4 @@ -{% macro sub_schema(property) %}{% if property.sub_schema %}{% if property.type == 'array' %}List<{{property.sub_schema | caseUcfirst}}>{% else %}{{property.sub_schema | caseUcfirst}}{% endif %}{% else %}{{property.type | typeName}}{% endif %}{% endmacro %} +{% macro sub_schema(property) %}{% if property.sub_schema %}{% if property.type == 'array' %}List<{{property.sub_schema | caseUcfirst}}>{% else %}{{property.sub_schema | caseUcfirst}}{% endif %}{% else %}{{property | typeName}}{% endif %}{% endmacro %} #frozen_string_literal: true module {{ spec.title | caseUcfirst }} diff --git a/templates/ruby/lib/container/permission.rb.twig b/templates/ruby/lib/container/permission.rb.twig new file mode 100644 index 0000000000..01cb4ca4a7 --- /dev/null +++ b/templates/ruby/lib/container/permission.rb.twig @@ -0,0 +1,21 @@ +module {{spec.title | caseUcfirst}} + class Permission + class << Permission + def read(role) + return "read(\"#{role}\")" + end + def write(role) + return "write(\"#{role}\")" + end + def create(role) + return "create(\"#{role}\")" + end + def update(role) + return "update(\"#{role}\")" + end + def delete(role) + return "delete(\"#{role}\")" + end + end + end +end diff --git a/templates/ruby/lib/container/query.rb.twig b/templates/ruby/lib/container/query.rb.twig index 0ab49c1cb8..3a833b5b3f 100644 --- a/templates/ruby/lib/container/query.rb.twig +++ b/templates/ruby/lib/container/query.rb.twig @@ -6,31 +6,60 @@ module {{spec.title | caseUcfirst}} end def notEqual(attribute, value) - return Query.addQuery(attribute, "notEqual", value) + return addQuery(attribute, "notEqual", value) end - def lesser(attribute, value) - return Query.addQuery(attribute, "lesser", value) + + def lessThan(attribute, value) + return addQuery(attribute, "lessThan", value) end - def lesserEqual(attribute, value) - return Query.addQuery(attribute, "lesserEqual", value) + + def lessThanEqual(attribute, value) + return addQuery(attribute, "lessThanEqual", value) end - def greater(attribute, value) - return Query.addQuery(attribute, "greater", value) + + def greaterThan(attribute, value) + return addQuery(attribute, "greaterThan", value) end - def greaterEqual(attribute, value) - return Query.addQuery(attribute, "equal", value) + + def greaterThanEqual(attribute, value) + return addQuery(attribute, "greaterThanEqual", value) end + def search(attribute, value) - return Query.addQuery(attribute, "search", value) + return addQuery(attribute, "search", value) + end + + def orderAsc(attribute) + return "orderAsc(\"#{attribute}\")" + end + + def orderDesc(attribute) + return "orderDesc(\"#{attribute}\")" + end + + def cursorBefore(id) + return "cursorBefore(\"#{id}\")" + end + + def cursorAfter(id) + return "cursorAfter(\"#{id}\")" + end + + def limit(limit) + return "limit(#{limit})" + end + + def offset(offset) + return "offset(#{offset})" end private - def addQuery(attribute, oper, value) + def addQuery(attribute, method, value) if value.is_a?(Array) - "#{attribute}.#{oper}.(#{value.map {|item| parseValues(item)}.join(',')})" + "#{method}(\"#{attribute}\", [#{value.map {|item| parseValues(item)}.join(',')}])" else - return "#{attribute}.#{oper}.(#{parseValues(value)})" + return "#{method}(\"#{attribute}\", [#{parseValues(value)}])" end end @@ -39,4 +68,4 @@ module {{spec.title | caseUcfirst}} end end end -end +end \ No newline at end of file diff --git a/templates/ruby/lib/container/role.rb.twig b/templates/ruby/lib/container/role.rb.twig new file mode 100644 index 0000000000..6333fbd64d --- /dev/null +++ b/templates/ruby/lib/container/role.rb.twig @@ -0,0 +1,39 @@ +module {{spec.title | caseUcfirst}} + class Role + def self.any + 'any' + end + + def self.user(id, status = "") + if(status.empty?) + "user:#{id}" + else + "user:#{id}/#{status}" + end + end + + def self.users(status = "") + if(status.empty?) + 'users' + else + "users/#{status}" + end + end + + def self.guests + 'guests' + end + + def self.team(id, role = "") + if(role.empty?) + "team:#{id}" + else + "team:#{id}/#{role}" + end + end + + def self.member(id) + "member:#{id}" + end + end +end \ No newline at end of file diff --git a/templates/ruby/lib/container/services/service.rb.twig b/templates/ruby/lib/container/services/service.rb.twig index a796fcb90d..dbfc91d678 100644 --- a/templates/ruby/lib/container/services/service.rb.twig +++ b/templates/ruby/lib/container/services/service.rb.twig @@ -3,76 +3,28 @@ module {{spec.title | caseUcfirst}} class {{ service.name | caseUcfirst }} < Service + def initialize(client) + @client = client + end + {% for method in service.methods %} {{ method.description | rubyComment }} # {% for parameter in method.parameters.all %} - # @param [{{ parameter.type | typeName }}] {{ parameter.name | caseSnake | escapeKeyword }} {{ parameter.description }} + # @param [{{ parameter | typeName }}] {{ parameter.name | caseSnake | escapeKeyword }} {{ parameter.description | raw }} {% endfor %} # # @return [{{ method.responseModel | caseUcfirst }}] def {{ method.name | caseSnake }}({% for parameter in method.parameters.all %}{{ parameter.name | caseSnake | escapeKeyword }}:{% if not parameter.required %} nil{% endif %}{% if not loop.last %}, {% endif %}{% endfor %}{% if 'multipart/form-data' in method.consumes %}, on_progress: nil{% endif %}) -{% for parameter in method.parameters.all %} -{% if parameter.required %} - if {{ parameter.name | caseSnake | escapeKeyword }}.nil? - raise {{spec.title | caseUcfirst}}::Exception.new('Missing required parameter: "{{ parameter.name | caseCamel | escapeKeyword }}"') - end - -{% endif %} -{% endfor %} - path = '{{ method.path }}' -{% for parameter in method.parameters.path %} - .gsub('{{ '{' }}{{ parameter.name }}{{ '}' }}', {{ parameter.name | caseSnake | escapeKeyword }}) -{% endfor %} - - params = { -{% for parameter in method.parameters.query | merge(method.parameters.body) %} - {{ parameter.name }}: {{ parameter.name | caseSnake | escapeKeyword }}, -{% endfor %} - } - - headers = { -{% for parameter in method.parameters.header %} - "{{ parameter.name }}": {{ parameter.name | caseCamel | escapeKeyword }}, -{% endfor %} -{% for key, header in method.headers %} - "{{ key }}": '{{ header }}', -{% endfor %} - } - +{{ include('ruby/base/params.twig')}} {% if 'multipart/form-data' in method.consumes %} - id_param_name = {% if method.parameters.all | filter(p => p.isUploadID) | length > 0 %}{% for parameter in method.parameters.all | filter(parameter => parameter.isUploadID) %}"{{ parameter.name }}"{% endfor %}{% else %}nil{% endif %} - -{% for parameter in method.parameters.all %} -{% if parameter.type == 'file' %} - param_name = '{{ parameter.name }}' - -{% endif %} -{% endfor %} - @client.chunked_upload( - path: path, - headers: headers, - params: params, - param_name: param_name, - id_param_name: id_param_name, - on_progress: on_progress, -{% if method.responseModel and method.responseModel != 'any' %} - response_type: Models::{{method.responseModel | caseUcfirst}} -{% endif %} - ) +{{ include('ruby/base/requests/file.twig')}} {% else %} - @client.call( - method: '{{ method.method | caseUpper }}', - path: path, - headers: headers, - params: params, -{% if method.responseModel and method.responseModel != 'any' %} - response_type: Models::{{method.responseModel | caseUcfirst}} -{% endif %} - ) +{{ include('ruby/base/requests/api.twig')}} {% endif %} end + {% endfor %} end end \ No newline at end of file diff --git a/templates/swift/LICENSE.twig b/templates/swift/LICENSE.twig index 0e8c361b49..854eb19494 100644 --- a/templates/swift/LICENSE.twig +++ b/templates/swift/LICENSE.twig @@ -1 +1 @@ -{{sdk.licenseContent}} \ No newline at end of file +{{sdk.licenseContent | raw}} \ No newline at end of file diff --git a/templates/swift/Sources/Client.swift.twig b/templates/swift/Sources/Client.swift.twig index be0bf8a42e..00beb34f46 100644 --- a/templates/swift/Sources/Client.swift.twig +++ b/templates/swift/Sources/Client.swift.twig @@ -20,7 +20,10 @@ open class Client { open var headers: [String: String] = [ "content-type": "", - "x-sdk-version": "{{spec.title | caseDash}}:{{ language.name | caseLower }}:{{ sdk.version }}"{% if spec.global.defaultHeaders | length > 0 %},{% endif %} + "x-sdk-name": "{{ sdk.name }}", + "x-sdk-platform": "{{ sdk.platform }}", + "x-sdk-language": "{{ language.name | caseLower }}", + "x-sdk-version": "{{ sdk.version }}"{% if spec.global.defaultHeaders | length > 0 %},{% endif %} {% for key,header in spec.global.defaultHeaders %} "{{key}}": "{{header}}"{% if not loop.last %},{% endif %} @@ -229,7 +232,7 @@ open class Client { headers: [String: String] = [:], params: [String: Any?] = [:], sink: ((ByteBuffer) -> Void)? = nil, - converter: (([String: Any]) -> T)? = nil + converter: ((Any) -> T)? = nil ) async throws -> T { let validParams = params.filter { $0.value != nil } @@ -270,7 +273,7 @@ open class Client { private func execute( _ request: HTTPClientRequest, withSink bufferSink: ((ByteBuffer) -> Void)? = nil, - converter: (([String: Any]) -> T)? = nil + converter: ((Any) -> T)? = nil ) async throws -> T { func complete(with response: HTTPClientResponse) async throws -> T { switch response.status.code { @@ -285,7 +288,7 @@ open class Client { case is Bool.Type: return true as! T case is ByteBuffer.Type: - return response.body as! T + return try await response.body.collect(upTo: Int.max) as! T default: let data = try await response.body.collect(upTo: Int.max) if data.readableBytes == 0 { @@ -335,13 +338,24 @@ open class Client { params: inout [String: Any?], paramName: String, idParamName: String? = nil, - converter: (([String: Any]) -> T)? = nil, + converter: ((Any) -> T)? = nil, onProgress: ((UploadProgress) -> Void)? = nil ) async throws -> T { - let file = params[paramName] as! File - let size = file.buffer.readableBytes + let input = params[paramName] as! InputFile + + switch(input.sourceType) { + case "path": + input.data = ByteBuffer(data: try! Data(contentsOf: URL(fileURLWithPath: input.path))) + case "data": + input.data = ByteBuffer(data: input.data as! Data) + default: + break + } + + let size = (input.data as! ByteBuffer).readableBytes if size < Client.chunkSize { + params[paramName] = input return try await call( method: "POST", path: path, @@ -351,32 +365,31 @@ open class Client { ) } - let input = file.buffer var offset = 0 var result = [String:Any]() if idParamName != nil && params[idParamName!] as! String != "unique()" { // Make a request to check if a file already exists - let map = try! await call( - method: "GET", - path: path + "/" + (params[idParamName!] as! String), - headers: headers, - params: [:], - converter: { return $0 } - ) - let chunksUploaded = map["chunksUploaded"] as! Int - offset = min(size, (chunksUploaded * Client.chunkSize)) + do { + let map = try await call( + method: "GET", + path: path + "/" + (params[idParamName!] as! String), + headers: headers, + params: [:], + converter: { return $0 as! [String: Any] } + ) + let chunksUploaded = map["chunksUploaded"] as! Int + offset = min(size, (chunksUploaded * Client.chunkSize)) + } catch { + // File does not exist yet, swallow exception + } } while offset < size { - let slice = input.getSlice(at: offset, length: Client.chunkSize) - ?? input.getSlice(at: offset, length: Int(size - offset)) + let slice = (input.data as! ByteBuffer).getSlice(at: offset, length: Client.chunkSize) + ?? (input.data as! ByteBuffer).getSlice(at: offset, length: Int(size - offset)) - params[paramName] = File( - name: file.name, - buffer: slice! - ) - + params[paramName] = InputFile.fromBuffer(slice!, filename: input.filename, mimeType: input.mimeType) headers["content-range"] = "bytes \(offset)-\(min((offset + Client.chunkSize) - 1, size))/\(size)" result = try await call( @@ -384,7 +397,7 @@ open class Client { path: path, headers: headers, params: params, - converter: { return $0 } + converter: { return $0 as! [String: Any] } ) offset += Client.chunkSize @@ -413,7 +426,28 @@ open class Client { _ request: inout HTTPClientRequest, with params: [String: Any?] = [:] ) throws { - let json = try JSONSerialization.data(withJSONObject: params, options: []) + var encodedParams = [String:Any]() + + for (key, param) in params { + if param is String + || param is Int + || param is Float + || param is Bool + || param is [String] + || param is [Int] + || param is [Float] + || param is [Bool] + || param is [String: Any] + || param is [Int: Any] + || param is [Float: Any] + || param is [Bool: Any] { + encodedParams[key] = param + } else { + encodedParams[key] = try! (param as! Encodable).toJson() + } + } + + let json = try JSONSerialization.data(withJSONObject: encodedParams, options: []) request.body = .bytes(json) } @@ -429,12 +463,15 @@ open class Client { bodyBuffer.writeString(CRLF) bodyBuffer.writeString("Content-Disposition: form-data; name=\"\(name)\"") - if let file = value as? File { - bodyBuffer.writeString("; filename=\"\(file.name)\"") + if let file = value as? InputFile { + bodyBuffer.writeString("; filename=\"\(file.filename)\"") bodyBuffer.writeString(CRLF) bodyBuffer.writeString("Content-Length: \(bodyBuffer.readableBytes)") bodyBuffer.writeString(CRLF+CRLF) - bodyBuffer.writeBuffer(&file.buffer) + + var buffer = file.data! as! ByteBuffer + + bodyBuffer.writeBuffer(&buffer) bodyBuffer.writeString(CRLF) return } diff --git a/templates/swift/Sources/Extensions/Codable+JSON.swift.twig b/templates/swift/Sources/Extensions/Codable+JSON.swift.twig index 523eb83555..d9fcd0477e 100644 --- a/templates/swift/Sources/Extensions/Codable+JSON.swift.twig +++ b/templates/swift/Sources/Extensions/Codable+JSON.swift.twig @@ -3,6 +3,8 @@ import Foundation let jsonEncoder = JSONEncoder() let jsonDecoder = JSONDecoder() +// MARK: - Conversions + extension Encodable { func toJson() throws -> String { return String(data: try jsonEncoder.encode(self), encoding: .utf8)! @@ -24,4 +26,560 @@ extension JsonConvert { let string = try (self as Encodable).toJson() return try string.fromJson(to: model) } -} \ No newline at end of file +} + +// MARK: - Codable + +@frozen public struct AnyCodable: Codable { + public let value: Any + + public init(_ value: T?) { + self.value = value ?? () + } +} + +extension AnyCodable: _AnyEncodable, _AnyDecodable {} + +extension AnyCodable: Equatable { + public static func == (lhs: AnyCodable, rhs: AnyCodable) -> Bool { + switch (lhs.value, rhs.value) { + case is (Void, Void): + return true + case let (lhs as Bool, rhs as Bool): + return lhs == rhs + case let (lhs as Int, rhs as Int): + return lhs == rhs + case let (lhs as Int8, rhs as Int8): + return lhs == rhs + case let (lhs as Int16, rhs as Int16): + return lhs == rhs + case let (lhs as Int32, rhs as Int32): + return lhs == rhs + case let (lhs as Int64, rhs as Int64): + return lhs == rhs + case let (lhs as UInt, rhs as UInt): + return lhs == rhs + case let (lhs as UInt8, rhs as UInt8): + return lhs == rhs + case let (lhs as UInt16, rhs as UInt16): + return lhs == rhs + case let (lhs as UInt32, rhs as UInt32): + return lhs == rhs + case let (lhs as UInt64, rhs as UInt64): + return lhs == rhs + case let (lhs as Float, rhs as Float): + return lhs == rhs + case let (lhs as Double, rhs as Double): + return lhs == rhs + case let (lhs as String, rhs as String): + return lhs == rhs + case let (lhs as [String: AnyCodable], rhs as [String: AnyCodable]): + return lhs == rhs + case let (lhs as [AnyCodable], rhs as [AnyCodable]): + return lhs == rhs + case let (lhs as [String: Any], rhs as [String: Any]): + return NSDictionary(dictionary: lhs) == NSDictionary(dictionary: rhs) + case let (lhs as [Any], rhs as [Any]): + return NSArray(array: lhs) == NSArray(array: rhs) + case is (NSNull, NSNull): + return true + default: + return false + } + } +} + +extension AnyCodable: CustomStringConvertible { + public var description: String { + switch value { + case is Void: + return String(describing: nil as Any?) + case let value as CustomStringConvertible: + return value.description + default: + return String(describing: value) + } + } +} + +extension AnyCodable: CustomDebugStringConvertible { + public var debugDescription: String { + switch value { + case let value as CustomDebugStringConvertible: + return "AnyCodable(\(value.debugDescription))" + default: + return "AnyCodable(\(description))" + } + } +} + +extension AnyCodable: ExpressibleByNilLiteral {} +extension AnyCodable: ExpressibleByBooleanLiteral {} +extension AnyCodable: ExpressibleByIntegerLiteral {} +extension AnyCodable: ExpressibleByFloatLiteral {} +extension AnyCodable: ExpressibleByStringLiteral {} +extension AnyCodable: ExpressibleByArrayLiteral {} +extension AnyCodable: ExpressibleByDictionaryLiteral {} + + +extension AnyCodable: Hashable { + public func hash(into hasher: inout Hasher) { + switch value { + case let value as Bool: + hasher.combine(value) + case let value as Int: + hasher.combine(value) + case let value as Int8: + hasher.combine(value) + case let value as Int16: + hasher.combine(value) + case let value as Int32: + hasher.combine(value) + case let value as Int64: + hasher.combine(value) + case let value as UInt: + hasher.combine(value) + case let value as UInt8: + hasher.combine(value) + case let value as UInt16: + hasher.combine(value) + case let value as UInt32: + hasher.combine(value) + case let value as UInt64: + hasher.combine(value) + case let value as Float: + hasher.combine(value) + case let value as Double: + hasher.combine(value) + case let value as String: + hasher.combine(value) + case let value as [String: AnyCodable]: + hasher.combine(value) + case let value as [AnyCodable]: + hasher.combine(value) + default: + break + } + } +} + +// MARK: - Decodable + +@frozen public struct AnyDecodable: Decodable { + public let value: Any + + public init(_ value: T?) { + self.value = value ?? () + } +} + +@usableFromInline +protocol _AnyDecodable { + var value: Any { get } + init(_ value: T?) +} + +extension AnyDecodable: _AnyDecodable {} + +extension _AnyDecodable { + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + + if container.decodeNil() { + #if canImport(Foundation) + self.init(NSNull()) + #else + self.init(Optional.none) + #endif + } else if let bool = try? container.decode(Bool.self) { + self.init(bool) + } else if let int = try? container.decode(Int.self) { + self.init(int) + } else if let uint = try? container.decode(UInt.self) { + self.init(uint) + } else if let double = try? container.decode(Double.self) { + self.init(double) + } else if let string = try? container.decode(String.self) { + self.init(string) + } else if let array = try? container.decode([AnyDecodable].self) { + self.init(array.map { $0.value }) + } else if let dictionary = try? container.decode([String: AnyDecodable].self) { + self.init(dictionary.mapValues { $0.value }) + } else { + throw DecodingError.dataCorruptedError(in: container, debugDescription: "AnyDecodable value cannot be decoded") + } + } +} + +extension AnyDecodable: Equatable { + public static func == (lhs: AnyDecodable, rhs: AnyDecodable) -> Bool { + switch (lhs.value, rhs.value) { +#if canImport(Foundation) + case is (NSNull, NSNull), is (Void, Void): + return true +#endif + case let (lhs as Bool, rhs as Bool): + return lhs == rhs + case let (lhs as Int, rhs as Int): + return lhs == rhs + case let (lhs as Int8, rhs as Int8): + return lhs == rhs + case let (lhs as Int16, rhs as Int16): + return lhs == rhs + case let (lhs as Int32, rhs as Int32): + return lhs == rhs + case let (lhs as Int64, rhs as Int64): + return lhs == rhs + case let (lhs as UInt, rhs as UInt): + return lhs == rhs + case let (lhs as UInt8, rhs as UInt8): + return lhs == rhs + case let (lhs as UInt16, rhs as UInt16): + return lhs == rhs + case let (lhs as UInt32, rhs as UInt32): + return lhs == rhs + case let (lhs as UInt64, rhs as UInt64): + return lhs == rhs + case let (lhs as Float, rhs as Float): + return lhs == rhs + case let (lhs as Double, rhs as Double): + return lhs == rhs + case let (lhs as String, rhs as String): + return lhs == rhs + case let (lhs as [String: AnyDecodable], rhs as [String: AnyDecodable]): + return lhs == rhs + case let (lhs as [AnyDecodable], rhs as [AnyDecodable]): + return lhs == rhs + default: + return false + } + } +} + +extension AnyDecodable: CustomStringConvertible { + public var description: String { + switch value { + case is Void: + return String(describing: nil as Any?) + case let value as CustomStringConvertible: + return value.description + default: + return String(describing: value) + } + } +} + +extension AnyDecodable: CustomDebugStringConvertible { + public var debugDescription: String { + switch value { + case let value as CustomDebugStringConvertible: + return "AnyDecodable(\(value.debugDescription))" + default: + return "AnyDecodable(\(description))" + } + } +} + +extension AnyDecodable: Hashable { + public func hash(into hasher: inout Hasher) { + switch value { + case let value as Bool: + hasher.combine(value) + case let value as Int: + hasher.combine(value) + case let value as Int8: + hasher.combine(value) + case let value as Int16: + hasher.combine(value) + case let value as Int32: + hasher.combine(value) + case let value as Int64: + hasher.combine(value) + case let value as UInt: + hasher.combine(value) + case let value as UInt8: + hasher.combine(value) + case let value as UInt16: + hasher.combine(value) + case let value as UInt32: + hasher.combine(value) + case let value as UInt64: + hasher.combine(value) + case let value as Float: + hasher.combine(value) + case let value as Double: + hasher.combine(value) + case let value as String: + hasher.combine(value) + case let value as [String: AnyDecodable]: + hasher.combine(value) + case let value as [AnyDecodable]: + hasher.combine(value) + default: + break + } + } +} + +// MARK: - Encodable + +@frozen public struct AnyEncodable: Encodable { + public let value: Any + + public init(_ value: T?) { + self.value = value ?? () + } +} + +@usableFromInline +protocol _AnyEncodable { + var value: Any { get } + init(_ value: T?) +} + +extension AnyEncodable: _AnyEncodable {} + +// MARK: - Encodable + +extension _AnyEncodable { + public func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + + switch value { + #if canImport(Foundation) + case is NSNull: + try container.encodeNil() + #endif + case is Void: + try container.encodeNil() + case let bool as Bool: + try container.encode(bool) + case let int as Int: + try container.encode(int) + case let int8 as Int8: + try container.encode(int8) + case let int16 as Int16: + try container.encode(int16) + case let int32 as Int32: + try container.encode(int32) + case let int64 as Int64: + try container.encode(int64) + case let uint as UInt: + try container.encode(uint) + case let uint8 as UInt8: + try container.encode(uint8) + case let uint16 as UInt16: + try container.encode(uint16) + case let uint32 as UInt32: + try container.encode(uint32) + case let uint64 as UInt64: + try container.encode(uint64) + case let float as Float: + try container.encode(float) + case let double as Double: + try container.encode(double) + case let string as String: + try container.encode(string) + #if canImport(Foundation) + case let number as NSNumber: + try encode(nsnumber: number, into: &container) + case let date as Date: + try container.encode(date) + case let url as URL: + try container.encode(url) + #endif + case let array as [Any?]: + try container.encode(array.map { AnyEncodable($0) }) + case let dictionary as [String: Any?]: + try container.encode(dictionary.mapValues { AnyEncodable($0) }) + case let encodable as Encodable: + try encodable.encode(to: encoder) + default: + let context = EncodingError.Context(codingPath: container.codingPath, debugDescription: "AnyEncodable value cannot be encoded") + throw EncodingError.invalidValue(value, context) + } + } + + #if canImport(Foundation) + private func encode(nsnumber: NSNumber, into container: inout SingleValueEncodingContainer) throws { + switch Character(Unicode.Scalar(UInt8(nsnumber.objCType.pointee))) { + case "B": + try container.encode(nsnumber.boolValue) + case "c": + try container.encode(nsnumber.int8Value) + case "s": + try container.encode(nsnumber.int16Value) + case "i", "l": + try container.encode(nsnumber.int32Value) + case "q": + try container.encode(nsnumber.int64Value) + case "C": + try container.encode(nsnumber.uint8Value) + case "S": + try container.encode(nsnumber.uint16Value) + case "I", "L": + try container.encode(nsnumber.uint32Value) + case "Q": + try container.encode(nsnumber.uint64Value) + case "f": + try container.encode(nsnumber.floatValue) + case "d": + try container.encode(nsnumber.doubleValue) + default: + let context = EncodingError.Context(codingPath: container.codingPath, debugDescription: "NSNumber cannot be encoded because its type is not handled") + throw EncodingError.invalidValue(nsnumber, context) + } + } + #endif +} + +extension AnyEncodable: Equatable { + public static func == (lhs: AnyEncodable, rhs: AnyEncodable) -> Bool { + switch (lhs.value, rhs.value) { + case is (Void, Void): + return true + case let (lhs as Bool, rhs as Bool): + return lhs == rhs + case let (lhs as Int, rhs as Int): + return lhs == rhs + case let (lhs as Int8, rhs as Int8): + return lhs == rhs + case let (lhs as Int16, rhs as Int16): + return lhs == rhs + case let (lhs as Int32, rhs as Int32): + return lhs == rhs + case let (lhs as Int64, rhs as Int64): + return lhs == rhs + case let (lhs as UInt, rhs as UInt): + return lhs == rhs + case let (lhs as UInt8, rhs as UInt8): + return lhs == rhs + case let (lhs as UInt16, rhs as UInt16): + return lhs == rhs + case let (lhs as UInt32, rhs as UInt32): + return lhs == rhs + case let (lhs as UInt64, rhs as UInt64): + return lhs == rhs + case let (lhs as Float, rhs as Float): + return lhs == rhs + case let (lhs as Double, rhs as Double): + return lhs == rhs + case let (lhs as String, rhs as String): + return lhs == rhs + case let (lhs as [String: AnyEncodable], rhs as [String: AnyEncodable]): + return lhs == rhs + case let (lhs as [AnyEncodable], rhs as [AnyEncodable]): + return lhs == rhs + default: + return false + } + } +} + +extension AnyEncodable: CustomStringConvertible { + public var description: String { + switch value { + case is Void: + return String(describing: nil as Any?) + case let value as CustomStringConvertible: + return value.description + default: + return String(describing: value) + } + } +} + +extension AnyEncodable: CustomDebugStringConvertible { + public var debugDescription: String { + switch value { + case let value as CustomDebugStringConvertible: + return "AnyEncodable(\(value.debugDescription))" + default: + return "AnyEncodable(\(description))" + } + } +} + +extension AnyEncodable: ExpressibleByNilLiteral {} +extension AnyEncodable: ExpressibleByBooleanLiteral {} +extension AnyEncodable: ExpressibleByIntegerLiteral {} +extension AnyEncodable: ExpressibleByFloatLiteral {} +extension AnyEncodable: ExpressibleByStringLiteral {} +extension AnyEncodable: ExpressibleByStringInterpolation {} +extension AnyEncodable: ExpressibleByArrayLiteral {} +extension AnyEncodable: ExpressibleByDictionaryLiteral {} + +extension _AnyEncodable { + public init(nilLiteral _: ()) { + self.init(nil as Any?) + } + + public init(booleanLiteral value: Bool) { + self.init(value) + } + + public init(integerLiteral value: Int) { + self.init(value) + } + + public init(floatLiteral value: Double) { + self.init(value) + } + + public init(extendedGraphemeClusterLiteral value: String) { + self.init(value) + } + + public init(stringLiteral value: String) { + self.init(value) + } + + public init(arrayLiteral elements: Any...) { + self.init(elements) + } + + public init(dictionaryLiteral elements: (AnyHashable, Any)...) { + self.init([AnyHashable: Any](elements, uniquingKeysWith: { first, _ in first })) + } +} + +extension AnyEncodable: Hashable { + public func hash(into hasher: inout Hasher) { + switch value { + case let value as Bool: + hasher.combine(value) + case let value as Int: + hasher.combine(value) + case let value as Int8: + hasher.combine(value) + case let value as Int16: + hasher.combine(value) + case let value as Int32: + hasher.combine(value) + case let value as Int64: + hasher.combine(value) + case let value as UInt: + hasher.combine(value) + case let value as UInt8: + hasher.combine(value) + case let value as UInt16: + hasher.combine(value) + case let value as UInt32: + hasher.combine(value) + case let value as UInt64: + hasher.combine(value) + case let value as Float: + hasher.combine(value) + case let value as Double: + hasher.combine(value) + case let value as String: + hasher.combine(value) + case let value as [String: AnyEncodable]: + hasher.combine(value) + case let value as [AnyEncodable]: + hasher.combine(value) + default: + break + } + } +} diff --git a/templates/swift/Sources/Extensions/String+MimeTypes.swift.twig b/templates/swift/Sources/Extensions/String+MimeTypes.swift.twig new file mode 100644 index 0000000000..4cd2811d9b --- /dev/null +++ b/templates/swift/Sources/Extensions/String+MimeTypes.swift.twig @@ -0,0 +1,130 @@ +import Foundation + +fileprivate let DEFAULT_MIME_TYPE = "application/octet-stream" + +fileprivate let mimeTypes = [ + "md": "text/markdown", + "html": "text/html", + "htm": "text/html", + "shtml": "text/html", + "css": "text/css", + "xml": "text/xml", + "gif": "image/gif", + "jpeg": "image/jpeg", + "jpg": "image/jpeg", + "js": "application/javascript", + "atom": "application/atom+xml", + "rss": "application/rss+xml", + "mml": "text/mathml", + "txt": "text/plain", + "jad": "text/vnd.sun.j2me.app-descriptor", + "wml": "text/vnd.wap.wml", + "htc": "text/x-component", + "png": "image/png", + "tif": "image/tiff", + "tiff": "image/tiff", + "wbmp": "image/vnd.wap.wbmp", + "ico": "image/x-icon", + "jng": "image/x-jng", + "bmp": "image/x-ms-bmp", + "svg": "image/svg+xml", + "svgz": "image/svg+xml", + "webp": "image/webp", + "woff": "application/font-woff", + "jar": "application/java-archive", + "war": "application/java-archive", + "ear": "application/java-archive", + "json": "application/json", + "hqx": "application/mac-binhex40", + "doc": "application/msword", + "pdf": "application/pdf", + "ps": "application/postscript", + "eps": "application/postscript", + "ai": "application/postscript", + "rtf": "application/rtf", + "m3u8": "application/vnd.apple.mpegurl", + "xls": "application/vnd.ms-excel", + "eot": "application/vnd.ms-fontobject", + "ppt": "application/vnd.ms-powerpoint", + "wmlc": "application/vnd.wap.wmlc", + "kml": "application/vnd.google-earth.kml+xml", + "kmz": "application/vnd.google-earth.kmz", + "7z": "application/x-7z-compressed", + "cco": "application/x-cocoa", + "jardiff": "application/x-java-archive-diff", + "jnlp": "application/x-java-jnlp-file", + "run": "application/x-makeself", + "pl": "application/x-perl", + "pm": "application/x-perl", + "prc": "application/x-pilot", + "pdb": "application/x-pilot", + "rar": "application/x-rar-compressed", + "rpm": "application/x-redhat-package-manager", + "sea": "application/x-sea", + "swf": "application/x-shockwave-flash", + "sit": "application/x-stuffit", + "tcl": "application/x-tcl", + "tk": "application/x-tcl", + "der": "application/x-x509-ca-cert", + "pem": "application/x-x509-ca-cert", + "crt": "application/x-x509-ca-cert", + "xpi": "application/x-xpinstall", + "xhtml": "application/xhtml+xml", + "xspf": "application/xspf+xml", + "zip": "application/zip", + "bin": "application/octet-stream", + "exe": "application/octet-stream", + "dll": "application/octet-stream", + "deb": "application/octet-stream", + "dmg": "application/octet-stream", + "iso": "application/octet-stream", + "img": "application/octet-stream", + "msi": "application/octet-stream", + "msp": "application/octet-stream", + "msm": "application/octet-stream", + "docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document", + "xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", + "pptx": "application/vnd.openxmlformats-officedocument.presentationml.presentation", + "mid": "audio/midi", + "midi": "audio/midi", + "kar": "audio/midi", + "mp3": "audio/mpeg", + "ogg": "audio/ogg", + "m4a": "audio/x-m4a", + "ra": "audio/x-realaudio", + "3gpp": "video/3gpp", + "3gp": "video/3gpp", + "ts": "video/mp2t", + "mp4": "video/mp4", + "mpeg": "video/mpeg", + "mpg": "video/mpeg", + "mov": "video/quicktime", + "webm": "video/webm", + "flv": "video/x-flv", + "m4v": "video/x-m4v", + "mng": "video/x-mng", + "asx": "video/x-ms-asf", + "asf": "video/x-ms-asf", + "wmv": "video/x-ms-wmv", + "avi": "video/x-msvideo" +] + +fileprivate func mimeFromExt(ext: String?) -> String { + let lower: String = ext!.lowercased() + if ext != nil && mimeTypes.contains(where: { $0.0 == lower }) { + return mimeTypes[lower]! + } + return DEFAULT_MIME_TYPE +} + +extension NSString { + public func mimeType() -> String { + return mimeFromExt(ext: self.pathExtension) + } +} + +extension String { + public func mimeType() -> String { + return (self as NSString).mimeType() + } +} \ No newline at end of file diff --git a/templates/swift/Sources/ID.swift.twig b/templates/swift/Sources/ID.swift.twig new file mode 100644 index 0000000000..4641f2b895 --- /dev/null +++ b/templates/swift/Sources/ID.swift.twig @@ -0,0 +1,9 @@ +public class ID { + public static func custom(_ id: String) -> String { + return id + } + + public static func unique() -> String { + return "unique()" + } +} \ No newline at end of file diff --git a/templates/swift/Sources/Models/File.swift.twig b/templates/swift/Sources/Models/File.swift.twig deleted file mode 100644 index 46c355d1d0..0000000000 --- a/templates/swift/Sources/Models/File.swift.twig +++ /dev/null @@ -1,13 +0,0 @@ -import Foundation -import NIO - -open class File { - - public let name: String - public var buffer: ByteBuffer - - public init(name: String, buffer: ByteBuffer) { - self.name = name - self.buffer = buffer - } -} diff --git a/templates/swift/Sources/Models/InputFile.swift.twig b/templates/swift/Sources/Models/InputFile.swift.twig new file mode 100644 index 0000000000..cb9a491c9c --- /dev/null +++ b/templates/swift/Sources/Models/InputFile.swift.twig @@ -0,0 +1,41 @@ +import Foundation +import NIO + +open class InputFile { + + public var path: String = "" + public var filename: String = "" + public var mimeType: String = "" + public var sourceType: String = "" + public var data: Any? = nil + + internal init() { + } + + public static func fromPath(_ path: String) -> InputFile { + let instance = InputFile() + instance.path = path + instance.filename = URL(fileURLWithPath: path, isDirectory: false).lastPathComponent + instance.mimeType = path.mimeType() + instance.sourceType = "path" + return instance + } + + public static func fromData(_ data: Data, filename: String, mimeType: String) -> InputFile { + let instance = InputFile() + instance.filename = filename + instance.mimeType = mimeType + instance.sourceType = "data" + instance.data = data + return instance + } + + public static func fromBuffer(_ buffer: ByteBuffer, filename: String, mimeType: String) -> InputFile { + let instance = InputFile() + instance.filename = filename + instance.mimeType = mimeType + instance.sourceType = "buffer" + instance.data = buffer + return instance + } +} diff --git a/templates/swift/Sources/Models/Model.swift.twig b/templates/swift/Sources/Models/Model.swift.twig index 74ccc31d44..31029c5e1c 100644 --- a/templates/swift/Sources/Models/Model.swift.twig +++ b/templates/swift/Sources/Models/Model.swift.twig @@ -1,75 +1,61 @@ -{% macro sub_schema(property) %}{% if property.sub_schema %}{% if property.type == 'array' %}[{{property.sub_schema | caseUcfirst}}]{% else %}{{property.sub_schema | caseUcfirst}}{% endif %}{% else %}{% if property.type == 'object' and property.additionalProperties %}[String : Any]{% else %}{{property.type | typeName}}{% endif %}{% endif %}{% endmacro %} +import Foundation /// {{ definition.description }} -public class {{ definition.name | caseUcfirst }} { +{% if definition.properties | length == 0 and not definition.additionalProperties %} +public class {{ definition | modelType(spec) | raw }} {} +{% else %} +public class {{ definition | modelType(spec) | raw }} { -{% for property in definition.properties %} + {%~ for property in definition.properties %} /// {{ property.description }} - public let {{ property.name | escapeKeyword | removeDollarSign }}: {{_self.sub_schema(property)}}{% if not property.required %}?{% endif %} + public let {{ property.name | escapeKeyword | removeDollarSign }}: {{ property | propertyType(spec) | raw }}{% if not property.required %}?{% endif %} -{% endfor %} -{% if definition.additionalProperties %} - let data: [String: Any] + {%~ endfor %} + {%~ if definition.additionalProperties %} + /// Additional properties + public let data: T + {%~ endif %} -{% endif %} init( -{% for property in definition.properties %} - {{ property.name | escapeKeyword | removeDollarSign }}: {{_self.sub_schema(property)}}{% if not property.required %}?{% endif %}{% if not loop.last or (loop.last and definition.additionalProperties) %},{% endif %} + {%~ for property in definition.properties %} + {{ property.name | escapeKeyword | removeDollarSign }}: {{ property | propertyType(spec) | raw }}{% if not property.required %}?{% endif %}{% if not loop.last or (loop.last and definition.additionalProperties) %},{% endif %} -{% endfor %} -{% if definition.additionalProperties %} - data: [String: Any] -{% endif %} + {%~ endfor %} + {%~ if definition.additionalProperties %} + data: T + {%~ endif %} ) { -{% for property in definition.properties %} + {%~ for property in definition.properties %} self.{{ property.name | escapeKeyword | removeDollarSign }} = {{ property.name | escapeKeyword | removeDollarSign }} -{% endfor %} -{% if definition.additionalProperties %} + {%~ endfor %} + {%~ if definition.additionalProperties %} self.data = data -{% endif %} - } - - public static func from(map: [String: Any]) -> {{ definition.name | caseUcfirst }} { - return {{ definition.name | caseUcfirst }}( -{% for property in definition.properties %} - {{ property.name | escapeKeyword | removeDollarSign }}: {% if property.sub_schema %}{% if property.type == 'array' %}(map["{{property.name }}"] as! [[String: Any]]).map { {{property.sub_schema | caseUcfirst}}.from(map: $0) }{% else %}{{property.sub_schema | caseUcfirst}}.from(map: map["{{property.name }}"] as! [String: Any]){% endif %}{% else %}map["{{property.name }}"] as{% if property.required %}!{% else %}?{% endif %} {{ _self.sub_schema(property) }}{% endif %}{% if not loop.last or (loop.last and definition.additionalProperties) %},{% endif %} - -{% endfor %} -{% if definition.additionalProperties %} - data: map -{% endif %} - ) + {%~ endif %} } public func toMap() -> [String: Any] { return [ -{% for property in definition.properties %} + {%~ for property in definition.properties %} "{{ property.name | escapeKeyword }}": {% if property.sub_schema %}{% if property.type == 'array' %}{{property.name | escapeKeyword | removeDollarSign}}.map { $0.toMap() }{% else %}{{property.name | escapeKeyword | removeDollarSign}}.toMap(){% endif %}{% else %}{{property.name | escapeKeyword | removeDollarSign}}{% endif %} as Any{% if not loop.last or (loop.last and definition.additionalProperties) %},{% endif %} -{% endfor %} -{% if definition.additionalProperties %} - "data": data -{% endif %} + {%~ endfor %} + {%~ if definition.additionalProperties %} + "data": try! JSONEncoder().encode(data) + {%~ endif %} ] } -{% if definition.additionalProperties %} - public func convertTo(fromJson: ([String: Any]) -> T) -> T { - return fromJson(data) - } - {% endif %} - {% for property in definition.properties %} - {% if property.sub_schema %} - {% for def in spec.definitions %} - {% if def.name == property.sub_schema and def.additionalProperties and property.type == 'array' %} + public static func from(map: [String: Any] ) -> {{ definition.name | caseUcfirst }} { + return {{ definition.name | caseUcfirst }}( + {%~ for property in definition.properties %} + {{ property.name | escapeKeyword | removeDollarSign }}: {% if property.sub_schema %}{% if property.type == 'array' %}(map["{{property.name }}"] as! [[String: Any]]).map { {{property.sub_schema | caseUcfirst}}.from(map: $0) }{% else %}{{property.sub_schema | caseUcfirst}}.from(map: map["{{property.name }}"] as! [String: Any]){% endif %}{% else %}map["{{property.name }}"] as{% if property.required %}!{% else %}?{% endif %} {{ property | propertyType(spec) | raw }}{% endif %}{% if not loop.last or (loop.last and definition.additionalProperties) %},{% endif %} - public func convertTo(fromJson: ([String: Any]) -> T) -> [T] { - {{property.name | removeDollarSign}}.map { d in d.convertTo(fromJson: fromJson) } + {%~ endfor %} + {%~ if definition.additionalProperties %} + data: try! JSONDecoder().decode(T.self, from: JSONSerialization.data(withJSONObject: map, options: [])) + {%~ endif %} + ) } -{% endif %} -{% endfor %} -{% endif %} -{% endfor %} - -} \ No newline at end of file +} +{% endif %} \ No newline at end of file diff --git a/templates/swift/Sources/Models/Query.swift.twig b/templates/swift/Sources/Models/Query.swift.twig deleted file mode 100644 index 26f733bd48..0000000000 --- a/templates/swift/Sources/Models/Query.swift.twig +++ /dev/null @@ -1,48 +0,0 @@ -public class Query { - - public static func equal(_ attribute: String, value: Any) -> String { - buildQueryWhere(attribute, is: "equal", to: value) - } - - public static func notEqual(_ attribute: String, value: Any) -> String { - buildQueryWhere(attribute, is: "notEqual", to: value) - } - - public static func lesser(_ attribute: String, value: Any) -> String { - buildQueryWhere(attribute, is: "lesser", to: value) - } - - public static func lesserEqual(attribute: String, value: Any) -> String { - buildQueryWhere(attribute, is: "lesserEqual", to: value) - } - - public static func greater(_ attribute: String, value: Any) -> String { - buildQueryWhere(attribute, is: "greater", to: value) - } - - public static func greaterEqual(_ attribute: String, value: Any) -> String { - buildQueryWhere(attribute, is: "greaterEqual", to: value) - } - - public static func search(_ attribute: String, value: String) -> String { - buildQueryWhere(attribute, is: "search", to: value) - } - - public static func buildQueryWhere(_ attribute: String, is oper: String, to value: Any) -> String { - switch value { - case let value as Array: - return "\(attribute).\(oper)(\(value.map { parseValues($0) }.joined(separator: ",") ))" - default: - return "\(attribute).\(oper)(\(parseValues(value)))" - } - } - - private static func parseValues(_ value: Any) -> String { - switch value { - case let value as String: - return "\"\(value)\"" - default: - return "\(value)" - } - } -} \ No newline at end of file diff --git a/templates/swift/Sources/Models/RealtimeModels.swift.twig b/templates/swift/Sources/Models/RealtimeModels.swift.twig index d50d1d415f..3a9c3e298b 100644 --- a/templates/swift/Sources/Models/RealtimeModels.swift.twig +++ b/templates/swift/Sources/Models/RealtimeModels.swift.twig @@ -24,13 +24,13 @@ public class RealtimeCallback { public class RealtimeResponseEvent { public let events: [String]? public let channels: [String]? - public let timestamp: Int64? + public let timestamp: String? public var payload: [String: Any]? init( events: [String], channels: [String], - timestamp: Int64, + timestamp: String, payload: [String: Any] ) { self.events = events diff --git a/templates/swift/Sources/OAuth/WebAuthComponent.swift.twig b/templates/swift/Sources/OAuth/WebAuthComponent.swift.twig index 6667557676..1e35d7acfb 100644 --- a/templates/swift/Sources/OAuth/WebAuthComponent.swift.twig +++ b/templates/swift/Sources/OAuth/WebAuthComponent.swift.twig @@ -23,7 +23,7 @@ public class WebAuthComponent { /// /// Authenticate Session with OAuth2 /// - /// Launches a chrome custom tab from the given activity and directs to the given url, + /// Launches a browser window from your app and directs to the given url, /// suspending until the user returns to the app, at which point the given [onComplete] callback /// will run, passing the callback url from the intent used to launch the [CallbackActivity], /// or an [IllegalStateException] in the case the user closed the window or returned to the @@ -62,12 +62,37 @@ public class WebAuthComponent { var domain = cookieParts["domain"]! domain.remove(at: domain.startIndex) - let cookie = HTTPClient.Cookie( - name: cookieParts["key"]!, - value: cookieParts["secret"]! - ) - let cookieJson = try! cookie.toJson() - UserDefaults.standard.set(cookieJson, forKey: "\(domain)-cookies") + let key: String = cookieParts["key"]! + let secret: String = cookieParts["secret"]! + let path: String? = cookieParts["path"] + let expires: String? = cookieParts["expires"] + let maxAge: String? = cookieParts["maxAge"] + let sameSite: String? = cookieParts["sameSite"] + let httpOnly: Bool? = cookieParts.keys.contains("httpOnly") + let secure: Bool? = cookieParts.keys.contains("secure") + + var cookie = "\(key)=\(secret)" + + if let path = path { + cookie += "; path=\(path)" + } + if let expires = expires { + cookie += "; expires=\(expires)" + } + if let maxAge = maxAge { + cookie += "; max-age=\(maxAge)" + } + if let sameSite = sameSite { + cookie += "; sameSite=\(sameSite)" + } + if let httpOnly = httpOnly, httpOnly { + cookie += "; httpOnly" + } + if let secure = secure, secure { + cookie += "; secure" + } + + UserDefaults.standard.set([cookie], forKey: "\(domain)-cookies") WebAuthComponent.onCallback( scheme: components.scheme!, diff --git a/templates/swift/Sources/Permission.swift.twig b/templates/swift/Sources/Permission.swift.twig new file mode 100644 index 0000000000..4e053dba83 --- /dev/null +++ b/templates/swift/Sources/Permission.swift.twig @@ -0,0 +1,21 @@ +public class Permission { + public static func read(_ role: String) -> String { + return "read(\"\(role)\")" + } + + public static func write(_ role: String) -> String { + return "write(\"\(role)\")" + } + + public static func create(_ role: String) -> String { + return "create(\"\(role)\")" + } + + public static func update(_ role: String) -> String { + return "update(\"\(role)\")" + } + + public static func delete(_ role: String) -> String { + return "delete(\"\(role)\")" + } +} \ No newline at end of file diff --git a/templates/swift/Sources/Query.swift.twig b/templates/swift/Sources/Query.swift.twig new file mode 100644 index 0000000000..ba023a4fb9 --- /dev/null +++ b/templates/swift/Sources/Query.swift.twig @@ -0,0 +1,72 @@ +public class Query { + + public static func equal(_ attribute: String, value: Any) -> String { + buildQueryWhere(attribute, is: "equal", to: value) + } + + public static func notEqual(_ attribute: String, value: Any) -> String { + buildQueryWhere(attribute, is: "notEqual", to: value) + } + + public static func lessThan(_ attribute: String, value: Any) -> String { + buildQueryWhere(attribute, is: "lessThan", to: value) + } + + public static func lessThanEqual(attribute: String, value: Any) -> String { + buildQueryWhere(attribute, is: "lessThanEqual", to: value) + } + + public static func greaterThan(_ attribute: String, value: Any) -> String { + buildQueryWhere(attribute, is: "greaterThan", to: value) + } + + public static func greaterThanEqual(_ attribute: String, value: Any) -> String { + buildQueryWhere(attribute, is: "greaterThanEqual", to: value) + } + + public static func search(_ attribute: String, value: String) -> String { + buildQueryWhere(attribute, is: "search", to: value) + } + + public static func orderAsc(_ attribute: String) -> String { + "orderAsc(\"\(attribute)\")" + } + + public static func orderDesc(_ attribute: String) -> String { + "orderDesc(\"\(attribute)\")" + } + + public static func cursorBefore(_ id: String) -> String { + "cursorBefore(\"\(id)\")" + } + + public static func cursorAfter(_ id: String) -> String { + "cursorAfter(\"\(id)\")" + } + + public static func limit(_ limit: Int) -> String { + "limit(\(limit))" + } + + public static func offset(_ offset: Int) -> String { + "offset(\(offset))" + } + + public static func buildQueryWhere(_ attribute: String, is method: String, to value: Any) -> String { + switch value { + case let value as Array: + return "\(method)(\"\(attribute)\", [\(value.map { parseValues($0) }.joined(separator: ",") )])" + default: + return "\(method)(\"\(attribute)\", [\(parseValues(value))])" + } + } + + private static func parseValues(_ value: Any) -> String { + switch value { + case let value as String: + return "\"\(value)\"" + default: + return "\(value)" + } + } +} \ No newline at end of file diff --git a/templates/swift/Sources/Role.swift.twig b/templates/swift/Sources/Role.swift.twig new file mode 100644 index 0000000000..b8acdbb32c --- /dev/null +++ b/templates/swift/Sources/Role.swift.twig @@ -0,0 +1,34 @@ +public class Role { + public static func any() -> String { + return "any" + } + + public static func user(_ id: String, _ status: String = "") -> String { + if(status.isEmpty) { + return "user:\(id)" + } + return "user:\(id)/\(status)" + } + + public static func users(_ status: String = "") -> String { + if(status.isEmpty) { + return "users" + } + return "users/\(status)" + } + + public static func guests() -> String { + return "guests" + } + + public static func team(_ id: String, _ role: String = "") -> String { + if(role.isEmpty) { + return "team:\(id)" + } + return "team:\(id)/\(role)" + } + + public static func member(_ id: String) -> String { + return "member:\(id)" + } +} \ No newline at end of file diff --git a/templates/swift/Sources/Services/Realtime.swift.twig b/templates/swift/Sources/Services/Realtime.swift.twig index 486b490e00..407c5ec093 100644 --- a/templates/swift/Sources/Services/Realtime.swift.twig +++ b/templates/swift/Sources/Services/Realtime.swift.twig @@ -209,7 +209,7 @@ extension Realtime: WebSocketClientDelegate { let response = RealtimeResponseEvent( events: events, channels: channels, - timestamp: data["timestamp"] as! Int64, + timestamp: data["timestamp"] as! String, payload: payload ) subscription.value.callback(response) diff --git a/templates/swift/Sources/Services/Service.swift.twig b/templates/swift/Sources/Services/Service.swift.twig index 65f467c738..2c9282d6d1 100644 --- a/templates/swift/Sources/Services/Service.swift.twig +++ b/templates/swift/Sources/Services/Service.swift.twig @@ -1,179 +1,116 @@ -{% macro methodNeedsSecurityParameters(method) %} -{% if (method.type == "webAuth" or method.type == "location") and method.security|length > 0 %}{{ true }}{% else %}{{false}}{% endif %} -{% endmacro %} -{% macro resultType(spec, method) %} -{% if method.type == "webAuth" %}Bool{% elseif method.type == "location" %}ByteBuffer{% elseif not method.responseModel or method.responseModel == 'any' %}Any{% else %}{{spec.title | caseUcfirst}}Models.{{method.responseModel | caseUcfirst}}{% endif %} -{% endmacro %} import AsyncHTTPClient import Foundation import NIO import {{spec.title | caseUcfirst}}Models +/// {{ service.description }} open class {{ service.name | caseUcfirst }}: Service { -{% for method in service.methods %} + + {%~ for method in service.methods %} /// /// {{ method.title }} /// -{% if method.description %} -{{ method.description | swiftComment }} + {%~ if method.description %} + {{~ method.description | swiftComment }} /// -{% endif %} -{% for parameter in method.parameters.all %} - /// @param {{ parameter.type | typeName | raw}} {{ parameter.name | caseCamel }} -{% endfor %} + {%~ endif %} + {%~ for parameter in method.parameters.all %} + /// @param {{ parameter | typeName | raw}} {{ parameter.name | caseCamel }} + {%~ endfor %} /// @throws Exception /// @return array /// -{% if method.type == "webAuth" %} + {%~ if method.type == "webAuth" %} @available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *) -{% endif %} - open func {{ method.name | caseCamel }}( -{% for parameter in method.parameters.all %} - {{ parameter.name | caseCamel | escapeKeyword }}: {{ parameter.type | typeName | raw }}{% if not parameter.required %}? = nil{% endif %}{% if not loop.last or 'multipart/form-data' in method.consumes %},{% endif %} + {%~ endif %} + open func {{ method.name | caseCamel }}{% if method.responseModel | hasGenericType(spec) %}{% endif %}( + {%~ for parameter in method.parameters.all %} + {{ parameter.name | caseCamel | escapeKeyword }}: {% if parameter.type == "object" %}T{% else %}{{ parameter | typeName | raw }}{% endif %}{% if not parameter.required %}? = nil{% endif %}{% if not loop.last or 'multipart/form-data' in method.consumes or method.responseModel | hasGenericType(spec) %},{% endif %} -{% endfor %} -{% if 'multipart/form-data' in method.consumes %} + {%~ endfor %} + {%~ if method.responseModel | hasGenericType(spec) %} + nestedType: T.Type + {%~ endif %} + {%~ if 'multipart/form-data' in method.consumes %} onProgress: ((UploadProgress) -> Void)? = nil -{% endif %} - ) async throws -> {{ _self.resultType(spec, method) }} { -{% if method.parameters.path %} var{% else %} let{% endif %} path: String = "{{ method.path }}" -{% for parameter in method.parameters.path %} - path = path.replacingOccurrences( - of: "{{ '{' }}{{ parameter.name | caseCamel }}{{ '}' }}", - with: {% if method.parameters.path %}{{ parameter.name | caseCamel | escapeKeyword }}{% else %}""{% endif %} + {%~ endif %} + ){%~ if method.type != "webAuth" %} async{% endif %} throws -> {{ method | returnType(spec) | raw }} { + {{~ include('swift/base/params.twig') }} + {%~ if method.type == 'webAuth' %} + {{~ include('swift/base/requests/OAuth.twig') }} + {%~ elseif method.type == 'location' %} + {{~ include('swift/base/requests/location.twig')}} + {%~ else %} + {%~ if method.headers | length <= 0 %} + let headers: [String: String] = [:] + {%~ else %} + {% if 'multipart/form-data' in method.consumes -%} var + {%- else -%} let + {%- endif %} headers: [String: String] = [ + {%~ for key, header in method.headers %} + "{{ key }}": "{{ header }}"{% if not loop.last %},{% endif %} - ) -{% endfor %} -{% if method.parameters.query or method.parameters.body or method.parameters.formData or _self.methodNeedsSecurityParameters(method) %} - {% if 'multipart/form-data' in method.consumes %}var{% else %}let{% endif %} params: [String: Any?] = [ -{% else %} - let params: [String: Any?] = [:] -{% endif %} -{% for parameter in method.parameters.query | merge(method.parameters.body) %} - "{{ parameter.name }}": {{ parameter.name | caseCamel | escapeKeyword }}{% if not loop.last or _self.methodNeedsSecurityParameters(method) %},{% endif %} - -{% endfor %} -{% if _self.methodNeedsSecurityParameters(method) %} -{% for node in method.security %} -{% for key,header in node|keys %} - "{{header|caseLower}}": client.config["{{header|caseLower}}"]{% if not loop.last %},{% endif %} - -{% endfor %} -{% endfor %} -{% endif %} -{% if method.parameters.query or method.parameters.body or method.parameters.formData or _self.methodNeedsSecurityParameters(method) %} + {%~ endfor %} ] -{% endif %} -{% if method.type == 'webAuth' %} - let query = "?\(client.parametersToQueryString(params: params))" - let url = URL(string: client.endPoint + path + query)! - let callbackScheme = "appwrite-callback-\(client.config["project"] ?? "")" - let group = DispatchGroup() + {%~ endif %} - group.enter() - WebAuthComponent.authenticate(url: url, callbackScheme: callbackScheme) { result in - group.leave() + {%~ if method.responseModel %} + let converter: (Any) -> {{ method | returnType(spec) | raw }} = { response in + {%~ if method.responseModel == 'any' %} + return response + {%~ else %} + return {{ spec.title | caseUcfirst}}Models.{{method.responseModel | caseUcfirst}}.from(map: response as! [String: Any]) + {%~ endif %} } - group.wait() - - return true -{% elseif method.type == 'location' %} - return try await client.call( - method: "{{ method.method | caseUpper }}", - path: path, - params: params - ) -{% else %} - {% if 'multipart/form-data' in method.consumes %}var{% else %}let{% endif %} headers: [String: String] = [ -{{ method.headers|map((header, key) => " \"#{key}\": \"#{header}\"")|join(',\n')|raw }} - ] -{% if method.responseModel %} - let converter: ([String: Any]) -> {{ _self.resultType(spec, method) }} = { dict in -{% if method.responseModel == 'any' %} - return dict -{% else %} - return {{ spec.title | caseUcfirst}}Models.{{method.responseModel | caseUcfirst}}.from(map: dict) -{% endif %} - } -{% endif %} -{% if 'multipart/form-data' in method.consumes %} - let idParamName: String? = {% if method.parameters.all | filter(p => p.isUploadID) | length > 0 %}{% for parameter in method.parameters.all | filter(parameter => parameter.isUploadID) %}"{{ parameter.name }}"{% endfor %}{% else %}nil{% endif %} -{% for parameter in method.parameters.all %} -{% if parameter.type == 'file' %} - let paramName = "{{ parameter.name }}" -{% endif %} -{% endfor %} - return try await client.chunkedUpload( - path: path, - headers: &headers, - params: ¶ms, - paramName: paramName, - idParamName: idParamName, -{% if method.responseModel %} - converter: converter, -{% endif %} - onProgress: onProgress - ) -{% else %} - return try await client.call( - method: "{{ method.method | caseUpper }}", - path: path, - headers: headers, - params: params{% if method.responseModel %}, - converter: converter -{% endif %} - ) -{% endif %} -{% endif %} + {%~ endif %} + {%~ if 'multipart/form-data' in method.consumes %} + {{~ include('swift/base/requests/file.twig') }} + {%~ else %} + {{~ include('swift/base/requests/api.twig') }} + {%~ endif %} + {%~ endif %} } + {%~ if method.responseModel | hasGenericType(spec) %} -{% endfor %} - -{% for method in service.methods %} /// /// {{ method.title }} /// -{% if method.description %} -{{ method.description | swiftComment }} + {%~ if method.description %} + {{~ method.description | swiftComment }} /// -{% endif %} -{% for parameter in method.parameters.all %} - /// @param {{ parameter.type | typeName | raw}} {{ parameter.name | caseCamel }} -{% endfor %} + {%~ endif %} + {%~ for parameter in method.parameters.all %} + /// @param {{ parameter | typeName | raw}} {{ parameter.name | caseCamel }} + {%~ endfor %} /// @throws Exception /// @return array /// - @available(*, deprecated, message: "Use the async overload instead") -{% if method.type == "webAuth" %} + {%~ if method.type == "webAuth" %} @available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *) -{% endif %} + {%~ endif %} open func {{ method.name | caseCamel }}( -{% for parameter in method.parameters.all %} - {{ parameter.name | caseCamel | escapeKeyword }}: {{ parameter.type | typeName | raw }}{% if not parameter.required %}? = nil{% endif %}, -{% endfor %} -{% if 'multipart/form-data' in method.consumes %} - onProgress: ((UploadProgress) -> Void)? = nil, -{% endif %} - completion: ((Result<{{ _self.resultType(spec, method) }}, {{ spec.title | caseUcfirst}}Error>) -> Void)? = nil - ) { - Task { - do { - let result = try await {{ method.name | caseCamel }}( -{% for parameter in method.parameters.all %} - {{ parameter.name | caseCamel | escapeKeyword }}: {{ parameter.name | caseCamel | escapeKeyword }}{% if not loop.last or 'multipart/form-data' in method.consumes %},{% endif %} + {%~ for parameter in method.parameters.all %} + {{ parameter.name | caseCamel | escapeKeyword }}: {{ parameter | typeName | raw }}{% if not parameter.required %}? = nil{% endif %}{% if not loop.last or 'multipart/form-data' in method.consumes %},{% endif %} -{% endfor %} -{% if 'multipart/form-data' in method.consumes %} - onProgress: onProgress -{% endif %} - ) - completion?(.success(result)) - } catch { - completion?(.failure(error as! {{ spec.title | caseUcfirst}}Error)) - } - } + {%~ endfor %} + {%~ if 'multipart/form-data' in method.consumes %} + onProgress: ((UploadProgress) -> Void)? = nil + {%~ endif %} + ) async throws -> {{ method | returnType(spec, '[String: AnyCodable]') | raw }} { + return try await {{ method.name | caseCamel }}( + {%~ for parameter in method.parameters.all %} + {{ parameter.name | caseCamel | escapeKeyword }}: {{ parameter.name | caseCamel | escapeKeyword }}{% if not loop.last %},{% endif %} + + {%~ endfor %} + nestedType: [String: AnyCodable].self + {%~ if 'multipart/form-data' in method.consumes %} + onProgress: onProgress + {%~ endif %} + ) } + {%~ endif %} {% endfor %} -} + +} \ No newline at end of file diff --git a/templates/swift/Sources/WebSockets/WebSocketClient.swift.twig b/templates/swift/Sources/WebSockets/WebSocketClient.swift.twig index d67ec5d714..6426fcb78b 100644 --- a/templates/swift/Sources/WebSockets/WebSocketClient.swift.twig +++ b/templates/swift/Sources/WebSockets/WebSocketClient.swift.twig @@ -26,10 +26,10 @@ public class WebSocketClient { var channel: Channel? = nil var tlsEnabled: Bool = false var closeSent: Bool = false - - let upgradedSignalled = DispatchSemaphore(value: 0) - let locker = DispatchQueue(label: WEBSOCKET_LOCKER_QUEUE) - let threadGroup = MultiThreadedEventLoopGroup(numberOfThreads: 1) + + let locker = DispatchQueue(label: WEBSOCKET_LOCKER_QUEUE, qos: .background) + + var threadGroup: MultiThreadedEventLoopGroup? = nil weak var delegate: WebSocketClientDelegate? = nil @@ -184,6 +184,10 @@ public class WebSocketClient { self.maxFrameSize = maxFrameSize self.tlsEnabled = tlsEnabled self.delegate = delegate + + DispatchQueue.global(qos: .background).async { + self.threadGroup = MultiThreadedEventLoopGroup(numberOfThreads: 1) + } } /// Create a new `WebSocketClient`. @@ -207,10 +211,14 @@ public class WebSocketClient { self.maxFrameSize = 24 self.tlsEnabled = tlsEnabled self.delegate = delegate + + DispatchQueue.global(qos: .background).async { + self.threadGroup = MultiThreadedEventLoopGroup(numberOfThreads: 1) + } } deinit { - try! threadGroup.syncShutdownGracefully() + try! threadGroup!.syncShutdownGracefully() } // MARK: - Open connection @@ -221,16 +229,16 @@ public class WebSocketClient { SocketOptionLevel(SOL_SOCKET), SO_REUSEPORT ) + + while(threadGroup == nil) {} - let bootstrap = ClientBootstrap(group: threadGroup) + let bootstrap = ClientBootstrap(group: threadGroup!) .channelOption(socketOptions, value: 1) .channelInitializer(self.openChannel) _ = try bootstrap .connect(host: self.host, port: self.port) .wait() - - self.upgradedSignalled.wait() } private func openChannel(channel: Channel) -> EventLoopFuture { @@ -260,13 +268,10 @@ public class WebSocketClient { } private func upgradePipelineHandler(channel: Channel, response: HTTPResponseHead) -> EventLoopFuture { - self.onOpen(channel) - let handler = MessageHandler(client: self) if response.status == .switchingProtocols { self.channel = channel - self.upgradedSignalled.signal() } return channel.pipeline.addHandler(handler) diff --git a/templates/swift/base/params.twig b/templates/swift/base/params.twig new file mode 100644 index 0000000000..989586db3d --- /dev/null +++ b/templates/swift/base/params.twig @@ -0,0 +1,17 @@ + let path: String = "{{ method.path }}" + {%~ for parameter in method.parameters.path %} + .replacingOccurrences(of: "{{ '{' }}{{ parameter.name | caseCamel }}{{ '}' }}", with: {{ parameter.name | caseCamel | escapeKeyword }}) + {%~ endfor %} + + {%~ if method.parameters.query | merge(method.parameters.body) | length <= 0 %} + let params: [String: Any] = [:] + {%~ else %} + {% if 'multipart/form-data' in method.consumes -%} var + {%- else -%} let + {%- endif %} params: [String: Any?] = [ + {%~ for parameter in method.parameters.query | merge(method.parameters.body) %} + "{{ parameter.name }}": {{ parameter.name | caseCamel | escapeKeyword }}{% if not loop.last %},{% endif %} + + {%~ endfor %} + ] + {%~ endif %} diff --git a/templates/swift/base/requests/OAuth.twig b/templates/swift/base/requests/OAuth.twig new file mode 100644 index 0000000000..a0d0b5c7a7 --- /dev/null +++ b/templates/swift/base/requests/OAuth.twig @@ -0,0 +1,12 @@ + let query = "?\(client.parametersToQueryString(params: params))" + let url = URL(string: client.endPoint + path + query)! + let callbackScheme = "appwrite-callback-\(client.config["project"] ?? "")" + let group = DispatchGroup() + + group.enter() + WebAuthComponent.authenticate(url: url, callbackScheme: callbackScheme) { result in + group.leave() + } + group.wait() + + return true diff --git a/templates/swift/base/requests/api.twig b/templates/swift/base/requests/api.twig new file mode 100644 index 0000000000..1798b60bc2 --- /dev/null +++ b/templates/swift/base/requests/api.twig @@ -0,0 +1,8 @@ + return try await client.call( + method: "{{ method.method | caseUpper }}", + path: path, + headers: headers, + params: params{% if method.responseModel %}, + converter: converter +{% endif %} + ) \ No newline at end of file diff --git a/templates/swift/base/requests/file.twig b/templates/swift/base/requests/file.twig new file mode 100644 index 0000000000..594bbe38b0 --- /dev/null +++ b/templates/swift/base/requests/file.twig @@ -0,0 +1,18 @@ + let idParamName: String? = {% if method.parameters.all | filter(p => p.isUploadID) | length > 0 %}{% for parameter in method.parameters.all | filter(parameter => parameter.isUploadID) %}"{{ parameter.name }}"{% endfor %}{% else %}nil{% endif %} + +{% for parameter in method.parameters.all %} +{% if parameter.type == 'file' %} + let paramName = "{{ parameter.name }}" +{% endif %} +{% endfor %} + return try await client.chunkedUpload( + path: path, + headers: &headers, + params: ¶ms, + paramName: paramName, + idParamName: idParamName, +{% if method.responseModel %} + converter: converter, +{% endif %} + onProgress: onProgress + ) \ No newline at end of file diff --git a/templates/swift/base/requests/location.twig b/templates/swift/base/requests/location.twig new file mode 100644 index 0000000000..a115d056da --- /dev/null +++ b/templates/swift/base/requests/location.twig @@ -0,0 +1,5 @@ + return try await client.call( + method: "{{ method.method | caseUpper }}", + path: path, + params: params + ) \ No newline at end of file diff --git a/templates/swift/docs/example.md.twig b/templates/swift/docs/example.md.twig index 20a8aae37f..1f4f2c16f6 100644 --- a/templates/swift/docs/example.md.twig +++ b/templates/swift/docs/example.md.twig @@ -1,25 +1,24 @@ import Appwrite -func main() async throws { - let client = Client() -{% if method.security|length > 0 %} - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint -{% for node in method.security %} +let client = Client() +{% if method.auth|length > 0 %} + .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint +{% for node in method.auth %} {% for key,header in node|keys %} - .set{{header | caseUcfirst}}("{{node[header]['x-appwrite']['demo']}}") // {{node[header].description}} + .set{{header | caseUcfirst}}("{{node[header]['x-appwrite']['demo']}}") // {{node[header].description}} {% endfor %} {% endfor %} {% endif %} - let {{ service.name | caseCamel }} = {{ service.name | caseUcfirst }}(client) - let {% if method.type == 'webAuth' %}success{% elseif method.type == 'location' %}byteBuffer{% elseif method.responseModel | length == 0 %}result{% else %}{{ method.responseModel | caseCamel | escapeKeyword }}{% endif %} = try await {{ service.name | caseCamel }}.{{ method.name | caseCamel }}({% if method.parameters.all | filter((param) => param.required) | length == 0 %}){{ '\n' }}{% endif %} + +let {{ service.name | caseCamel }} = {{ service.name | caseUcfirst }}(client{% if service.globalParams | length %}{% for parameter in service.globalParams %}, {{ parameter | paramExample }}{% endfor %}{% endif %}) + +let {% if method.type == 'webAuth' %}success{% elseif method.type == 'location' %}byteBuffer{% elseif method.responseModel | length == 0 %}result{% else %}{{ method.responseModel | caseCamel | escapeKeyword }}{% endif %} = try await {{ service.name | caseCamel }}.{{ method.name | caseCamel }}({% if method.parameters.all | filter((param) => param.required) | length == 0 %}){{ '\n' }}{% endif %} {% for parameter in method.parameters.all | filter((parameter) => parameter.required) %} - {{parameter.name}}: {{ parameter | paramExample | escapeKeyword }}{% if not loop.last %},{% endif %} + {{parameter.name}}: {{ parameter | paramExample | escapeKeyword }}{% if not loop.last %},{% endif %} {% if loop.last %} - ) +) {% endif %} -{% endfor %} - print(String(describing: {% if method.type == 'webAuth' %}success{% elseif method.type == 'location' %}byteBuffer{% elseif method.responseModel | length == 0 %}result{% else %}{{ method.responseModel | caseCamel | escapeKeyword }}{% endif %}) -} +{% endfor %} \ No newline at end of file diff --git a/templates/swift/example-swiftui/Example.xcodeproj/project.pbxproj b/templates/swift/example-swiftui/Example.xcodeproj/project.pbxproj index f293df92df..d951b81fa7 100644 --- a/templates/swift/example-swiftui/Example.xcodeproj/project.pbxproj +++ b/templates/swift/example-swiftui/Example.xcodeproj/project.pbxproj @@ -50,7 +50,7 @@ 1D34C2522702E4A000D1DA8D /* ExampleViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExampleViewModel.swift; sourceTree = ""; }; 1D34C2542702E4B500D1DA8D /* ExampleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExampleView.swift; sourceTree = ""; }; 1D43900726FC8B2500C71E3E /* ImagePicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImagePicker.swift; sourceTree = ""; }; - 1DBB414627E87BDB00ECF86F /* swift-client */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = "swift-client"; path = "../../../examples/swift-client"; sourceTree = ""; }; + 1DBB414627E87BDB00ECF86F /* apple */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = "apple"; path = "../../../examples/apple"; sourceTree = ""; }; 23DDF5922709A457006EFAFA /* ImagePicker+iOS.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ImagePicker+iOS.swift"; sourceTree = ""; }; 23DDF5942709A46A006EFAFA /* ImagePicker+macOS.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ImagePicker+macOS.swift"; sourceTree = ""; }; 23DDF597270AC2DA006EFAFA /* OSImage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSImage.swift; sourceTree = ""; }; @@ -106,7 +106,7 @@ 1DBB414527E87BDB00ECF86F /* Packages */ = { isa = PBXGroup; children = ( - 1DBB414627E87BDB00ECF86F /* swift-client */, + 1DBB414627E87BDB00ECF86F /* apple */, ); name = Packages; sourceTree = ""; diff --git a/templates/swift/example-swiftui/Shared/ExampleViewModel.swift b/templates/swift/example-swiftui/Shared/ExampleViewModel.swift index af8f495c4d..1349380544 100644 --- a/templates/swift/example-swiftui/Shared/ExampleViewModel.swift +++ b/templates/swift/example-swiftui/Shared/ExampleViewModel.swift @@ -31,79 +31,76 @@ extension ExampleView { func register() async { do { - let response = try await account.create( + let user = try await account.create( userId: userId, email: username, password: password ) - self.userId = response.id - self.response = String(describing: response.toMap()) + self.userId = user.id + self.response = String(describing: user.toMap()) } catch { - self.response = String(describing: error) + self.response = error.localizedDescription } } func login() async { do { - let response = try await account.createSession( + let session = try await account.createEmailSession( email: username, password: password ) - self.response = String(describing: response.toMap()) + self.response = String(describing: session.toMap()) } catch { - self.response = String(describing: error) + self.response = error.localizedDescription } } func loginWithFacebook() async { do { - let response = try await account.createOAuth2Session( - provider: "facebook", - success: "\(host)/auth/oauth2/success", - failure: "\(host)/auth/oauth2/failure" - ) - self.response = String(describing: response) + _ = try await account.createOAuth2Session(provider: "facebook") + + self.response = "Success!" } catch { - self.response = String(describing: error) + self.response = error.localizedDescription } } func download() async { do { - let response = try await storage.getFileDownload( + let data = try await storage.getFileDownload( bucketId: bucketId, fileId: fileId ) - self.downloadedImage = Image(data: Data(buffer: response)) + self.downloadedImage = Image(data: Data(buffer: data)) } catch { - self.response = String(describing: error) + self.response = error.localizedDescription } } func upload(image: OSImage) async { - let imageBuffer = ByteBufferAllocator() - .buffer(data: image.data) - #if os(macOS) let fileName = "file.tiff" + let mime = "image/tiff" #else let fileName = "file.png" + let mime = "image/png" #endif - let file = File( - name: fileName, - buffer: imageBuffer + let file = InputFile.fromData( + image.data, + filename: fileName, + mimeType: mime ) do { - let response = try await storage.createFile( + let file = try await storage.createFile( bucketId: bucketId, fileId: fileId, file: file ) - self.response = String(describing: response.toMap()) + self.response = String(describing: file.toMap()) } catch { - self.response = String(describing: error) + self.response = error.localizedDescription } } diff --git a/templates/swift/example-uikit/UIKitExample.xcodeproj/project.pbxproj b/templates/swift/example-uikit/UIKitExample.xcodeproj/project.pbxproj index 9f5496d050..955f6b28fe 100644 --- a/templates/swift/example-uikit/UIKitExample.xcodeproj/project.pbxproj +++ b/templates/swift/example-uikit/UIKitExample.xcodeproj/project.pbxproj @@ -37,7 +37,7 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 1D53246626CA414A00D5382C /* swift-client */ = {isa = PBXFileReference; lastKnownFileType = folder; name = "swift-client"; path = "../../../examples/swift-client"; sourceTree = ""; }; + 1D53246626CA414A00D5382C /* apple */ = {isa = PBXFileReference; lastKnownFileType = folder; name = "apple"; path = "../../../examples/apple"; sourceTree = ""; }; 1D8C054626E603A200646CFC /* ImagePicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImagePicker.swift; sourceTree = ""; }; 4B1151B0FC3E5D1AD1405D6D /* UIKitExampleUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = UIKitExampleUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 4B115317377938CDB4FF518B /* UIKitExampleTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIKitExampleTests.swift; sourceTree = ""; }; @@ -91,7 +91,7 @@ 4B11584FFD11E0EC8AE1D05E = { isa = PBXGroup; children = ( - 1D53246626CA414A00D5382C /* swift-client */, + 1D53246626CA414A00D5382C /* apple */, 4B115EA639EF1F575013EFA6 /* Products */, 4B115E17FC70E956925F85AF /* UIKitExample */, 4B115A1762CECE9495C57394 /* UIKitExampleTests */, diff --git a/templates/swift/example-uikit/UIKitExample/ViewController.swift b/templates/swift/example-uikit/UIKitExample/ViewController.swift index 4126cbbd85..b1d2f14974 100644 --- a/templates/swift/example-uikit/UIKitExample/ViewController.swift +++ b/templates/swift/example-uikit/UIKitExample/ViewController.swift @@ -58,7 +58,7 @@ class ViewController: UIViewController { @IBAction func loginClick(_ sender: Any) async { do { - let response = try await account.createSession( + let response = try await account.createEmailSession( email: "jake@appwrite.io", password: "password" ) diff --git a/templates/web/.travis.yml.twig b/templates/web/.travis.yml.twig index 34295c8a82..5a81edf613 100644 --- a/templates/web/.travis.yml.twig +++ b/templates/web/.travis.yml.twig @@ -1,22 +1,32 @@ - language: node_js node_js: - "14.16" jobs: include: - - stage: npm release + - stage: NPM RC Release + if: tag == *-RC* node_js: "14.16" - script: - - echo "Installing dependencies ..." - - npm i - - echo "Building library ..." + script: + - npm install - npm run build - - echo "Deploying to npm ..." + - echo "Deploying RC to NPM..." + deploy: + provider: npm + email: $NPM_EMAIL + api_key: $NPM_API_KEY + tag: next + - stage: NPM Release + if: tag != *-RC* + node_js: "14.16" + script: + - npm install + - npm run build + - echo "Deploying to NPM..." deploy: provider: npm email: $NPM_EMAIL api_key: $NPM_API_KEY skip_cleanup: true on: - tags: true + tags: true \ No newline at end of file diff --git a/templates/web/LICENSE.twig b/templates/web/LICENSE.twig index 0e8c361b49..854eb19494 100644 --- a/templates/web/LICENSE.twig +++ b/templates/web/LICENSE.twig @@ -1 +1 @@ -{{sdk.licenseContent}} \ No newline at end of file +{{sdk.licenseContent | raw}} \ No newline at end of file diff --git a/templates/web/README.md.twig b/templates/web/README.md.twig index 6d22ebaa23..667e4df7b5 100644 --- a/templates/web/README.md.twig +++ b/templates/web/README.md.twig @@ -33,7 +33,7 @@ npm install {{ language.params.npmPackage }} --save If you're using a bundler (like [Rollup](https://rollupjs.org/) or [webpack](https://webpack.js.org/)), you can import the {{ spec.title }} module when you need it: ```js -import {{ '{' }} {{ language.params.npmPackage|caseUcfirst }} {{ '}' }} from "{{ language.params.npmPackage }}"; +import {{ '{' }} Client, Account {{ '}' }} from "{{ language.params.npmPackage }}"; ``` ### CDN diff --git a/templates/web/docs/example.md.twig b/templates/web/docs/example.md.twig index 89be198c1b..42c242545b 100644 --- a/templates/web/docs/example.md.twig +++ b/templates/web/docs/example.md.twig @@ -1,9 +1,13 @@ -const sdk = new {{ spec.title | caseUcfirst }}(); +import {{ '{' }} Client, {{service.name | caseUcfirst}} {{ '}' }} from "{{ language.params.npmPackage }}"; -{% if method.security|length > 0 %} -sdk +const client = new Client(); + +const {{ service.name | caseCamel }} = new {{service.name | caseUcfirst}}(client{% if service.globalParams | length %}{% for parameter in service.globalParams %}, {{ parameter | paramExample }}{% endfor %}{% endif %}); + +{% if method.auth|length > 0 %} +client .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint -{% for node in method.security %} +{% for node in method.auth %} {% for key,header in node|keys %} .set{{header}}('{{node[header]['x-appwrite']['demo']}}') // {{node[header].description}} {% endfor %} @@ -12,7 +16,7 @@ sdk {% endif %} {% if method.type == 'webAuth' %}// Go to OAuth provider login page {% endif %} -{% if method.type == 'webAuth' %}{% elseif method.type == 'location' %}let result = {% else %}let promise = {% endif %}sdk.{{ service.name | caseLower }}.{{ method.name | caseCamel }}({% for parameter in method.parameters.all %}{% if parameter.required %}{% if not loop.first %}, {% endif %}{{ parameter | paramExample }}{% endif %}{% endfor %}); +{% if method.type == 'webAuth' %}{% elseif method.type == 'location' %}const result = {% else %}const promise = {% endif %}{{ service.name | caseCamel }}.{{ method.name | caseCamel }}({% for parameter in method.parameters.all %}{% if parameter.required %}{% if not loop.first %}, {% endif %}{{ parameter | paramExample }}{% endif %}{% endfor %}); {% if method.type == 'webAuth' %}{% elseif method.type == 'location' %}console.log(result); // Resource URL{% else %}promise.then(function (response) { console.log(response); // Success diff --git a/templates/web/package.json.twig b/templates/web/package.json.twig index 5b91c8c865..b184c59f88 100644 --- a/templates/web/package.json.twig +++ b/templates/web/package.json.twig @@ -13,7 +13,7 @@ "./package.json": "./package.json" }, "module": "dist/esm/sdk.js", - "types": "types/sdk.d.ts", + "types": "types/index.d.ts", "repository": { "type": "git", "url": "{{ sdk.gitURL }}" @@ -24,12 +24,12 @@ "build:libs": "rollup -c" }, "devDependencies": { - "@rollup/plugin-typescript": "8.2.5", + "@rollup/plugin-typescript": "8.3.2", "playwright": "1.15.0", - "rollup": "2.56.3", - "serve-handler": "6.1.3", - "tslib": "2.3.1", - "typescript": "4.2.3" + "rollup": "2.75.4", + "serve-handler": "6.1.0", + "tslib": "2.4.0", + "typescript": "4.7.2" }, "dependencies": { "cross-fetch": "3.1.5", diff --git a/templates/web/rollup.config.js.twig b/templates/web/rollup.config.js.twig index 883245e6a7..a9c3354118 100644 --- a/templates/web/rollup.config.js.twig +++ b/templates/web/rollup.config.js.twig @@ -3,7 +3,7 @@ import typescript from "@rollup/plugin-typescript"; export default { external: Object.keys(pkg.dependencies), - input: "src/sdk.ts", + input: "src/index.ts", plugins: [typescript()], output: [ { @@ -20,7 +20,7 @@ export default { { format: "iife", file: pkg.jsdelivr, - name: "window", + name: "Appwrite", extend: true, globals: { "cross-fetch": "window", diff --git a/templates/web/src/sdk.ts.twig b/templates/web/src/client.ts.twig similarity index 53% rename from templates/web/src/sdk.ts.twig rename to templates/web/src/client.ts.twig index 6844f1e0ea..f952c31c25 100644 --- a/templates/web/src/sdk.ts.twig +++ b/templates/web/src/client.ts.twig @@ -1,22 +1,7 @@ -{% macro sub_schema(property) %}{% if property.sub_schema %}{% if property.type == 'array' %}{{property.sub_schema | caseUcfirst}}[]{% else %}{{property.sub_schema | caseUcfirst}}{% endif %}{% else %}{{property.type | typeName}}{% endif %}{% endmacro %} import 'isomorphic-form-data'; import { fetch } from 'cross-fetch'; - -namespace Models { -{% for definition in spec.definitions %} - /** - * {{ definition.description }} - */ - export type {{ definition.name | caseUcfirst }}<{% for property in definition.properties %}{% if spec.definitions[property.sub_schema].additionalProperties %}{{property.sub_schema | caseUcfirst}} extends Models.{{property.sub_schema | caseUcfirst}}{% endif %}{% endfor %}> = { -{% for property in definition.properties %} - /** - * {{ property.description }} - */ - {{ property.name | escapeKeyword }}{% if not property.required %}?{% endif %}: {{_self.sub_schema(property)}}; -{% endfor %} - } -{% endfor %} -} +import { Models } from './models'; +import { Service } from './service'; type Payload = { [key: string]: any; @@ -27,8 +12,8 @@ type Headers = { } type RealtimeResponse = { - type: 'error'|'event'|'connected'|'response'; - data: RealtimeResponseAuthenticated|RealtimeResponseConnected|RealtimeResponseError|RealtimeResponseEvent; + type: 'error' | 'event' | 'connected' | 'response'; + data: RealtimeResponseAuthenticated | RealtimeResponseConnected | RealtimeResponseError | RealtimeResponseEvent; } type RealtimeRequest = { @@ -105,9 +90,7 @@ class {{spec.title | caseUcfirst}}Exception extends Error { } } -class {{ spec.title | caseUcfirst }} { - static CHUNK_SIZE = 5*1024*1024; // 5MB - +class Client { config = { endpoint: '{{ spec.endpoint }}', endpointRealtime: '', @@ -116,7 +99,10 @@ class {{ spec.title | caseUcfirst }} { {% endfor %} }; headers: Headers = { - 'x-sdk-version': '{{spec.title | caseDash}}:{{ language.name | caseLower }}:{{ sdk.version }}', + 'x-sdk-name': '{{ sdk.name }}', + 'x-sdk-platform': '{{ sdk.platform }}', + 'x-sdk-language': '{{ language.name | caseLower }}', + 'x-sdk-version': '{{ sdk.version }}', {% for key,header in spec.global.defaultHeaders %} '{{key}}': '{{header}}', {% endfor %} @@ -350,12 +336,12 @@ class {{ spec.title | caseUcfirst }} { } } - private async call(method: string, url: URL, headers: Headers = {}, params: Payload = {}): Promise { + async call(method: string, url: URL, headers: Headers = {}, params: Payload = {}): Promise { method = method.toUpperCase(); headers = Object.assign({}, this.headers, headers); - + let options: RequestInit = { method, headers, @@ -367,7 +353,7 @@ class {{ spec.title | caseUcfirst }} { } if (method === 'GET') { - for (const [key, value] of Object.entries(this.flatten(params))) { + for (const [key, value] of Object.entries(Service.flatten(params))) { url.searchParams.append(key, value); } } else { @@ -426,229 +412,9 @@ class {{ spec.title | caseUcfirst }} { throw new {{spec.title | caseUcfirst}}Exception((e).message); } } - - private flatten(data: Payload, prefix = ''): Payload { - let output: Payload = {}; - - for (const key in data) { - let value = data[key]; - let finalKey = prefix ? `${prefix}[${key}]` : key; - - if (Array.isArray(value)) { - output = Object.assign(output, this.flatten(value, finalKey)); - } - else { - output[finalKey] = value; - } - } - - return output; - } - -{% for service in spec.services %} - {{service.name | caseCamel}} = { -{% for method in service.methods %} - - /** - * {{ method.title }} - * -{% if method.description %} -{{ method.description|comment3 }} -{% endif %} - * -{% for parameter in method.parameters.all %} - * @param {{ '{' }}{{ parameter.type | typeName }}{{ '}' }} {{ parameter.name | caseCamel | escapeKeyword }} -{% endfor %} - * @throws {{ '{' }}{{ spec.title | caseUcfirst}}Exception} - * @returns {% if method.type == 'webAuth' %}{void|string}{% elseif method.type == 'location' %}{URL}{% else %}{Promise}{% endif %} - - */ - {{ method.name | caseCamel }}: {% if method.type != 'location' and method.type != 'webAuth'%}async {% if spec.definitions[method.responseModel].additionalProperties %}<{{method.responseModel | caseUcfirst}} extends Models.{{method.responseModel | caseUcfirst}}>{% endif %}{% for property in spec.definitions[method.responseModel].properties %}{% if spec.definitions[property.sub_schema].additionalProperties %}<{{property.sub_schema | caseUcfirst}} extends Models.{{property.sub_schema | caseUcfirst}}>{% endif %}{% endfor %}{% endif %}({% for parameter in method.parameters.all %}{{ parameter.name | caseCamel | escapeKeyword }}{% if not parameter.required %}?{% endif %}: {{ parameter.type | typeName }}{% if not loop.last %}, {% endif %}{% endfor %}{% if 'multipart/form-data' in method.consumes %}, onProgress = (progress: UploadProgress) => {}{% endif %}): {% if method.type == 'webAuth' %}void | URL{% elseif method.type == 'location' %}URL{% else %}Promise<{% if method.responseModel and method.responseModel != 'any' %}{% if not spec.definitions[method.responseModel].additionalProperties %}Models.{% endif %}{{method.responseModel | caseUcfirst}}{% for property in spec.definitions[method.responseModel].properties %}{% if spec.definitions[property.sub_schema].additionalProperties %}<{{property.sub_schema | caseUcfirst}}>{% endif %}{% endfor %}{% else %}{}{% endif %}>{% endif %} => { -{% for parameter in method.parameters.all %} -{% if parameter.required %} - if (typeof {{ parameter.name | caseCamel | escapeKeyword }} === 'undefined') { - throw new {{spec.title | caseUcfirst}}Exception('Missing required parameter: "{{ parameter.name | caseCamel | escapeKeyword }}"'); - } - -{% endif %} -{% endfor %} - let path = '{{ method.path }}'{% for parameter in method.parameters.path %}.replace('{{ '{' }}{{ parameter.name | caseCamel | escapeKeyword }}{{ '}' }}', {{ parameter.name | caseCamel | escapeKeyword }}){% endfor %}; - let payload: Payload = {}; - -{% for parameter in method.parameters.query %} - if (typeof {{ parameter.name | caseCamel | escapeKeyword }} !== 'undefined') { - payload['{{ parameter.name }}'] = {{ parameter.name | caseCamel | escapeKeyword }}; - } - -{% endfor %} -{% for parameter in method.parameters.body %} - if (typeof {{ parameter.name | caseCamel | escapeKeyword }} !== 'undefined') { - payload['{{ parameter.name }}'] = {{ parameter.name | caseCamel | escapeKeyword }}; - } - -{% endfor %} - const uri = new URL(this.config.endpoint + path); -{% if method.type == 'location' or method.type == 'webAuth' %} -{% if method.security|length > 0 %} -{% for node in method.security %} -{% for key,header in node|keys %} - payload['{{header|caseLower}}'] = this.config.{{header|caseLower}}; - -{% endfor %} -{% endfor %} -{% endif %} - - for (const [key, value] of Object.entries(this.flatten(payload))) { - uri.searchParams.append(key, value); - } -{% endif %} -{% if method.type == 'webAuth' %} - if (typeof window !== 'undefined' && window?.location) { - window.location.href = uri.toString(); - } else { - return uri; - } -{% elseif method.type == 'location' %} - return uri; -{% else %} -{% if 'multipart/form-data' in method.consumes %} -{% for parameter in method.parameters.all %} -{% if parameter.type == 'file' %} - - if(!({{ parameter.name | caseCamel | escapeKeyword }} instanceof File)) { - throw new {{spec.title | caseUcfirst}}Exception('Parameter "{{ parameter.name | caseCamel | escapeKeyword }}" has to be a File.'); - } - - const size = {{ parameter.name | caseCamel | escapeKeyword }}.size; - - if (size <= {{ spec.title | caseUcfirst }}.CHUNK_SIZE) { - return await this.call('{{ method.method | caseLower }}', uri, { - -{% for parameter in method.parameters.header %} - '{{ parameter.name | caseCamel | escapeKeyword }}': this.${{ parameter.name | caseCamel | escapeKeyword }}, -{% endfor %} -{% for key, header in method.headers %} - '{{ key }}': '{{ header }}', -{% endfor %} - }, payload); - } - let id = undefined; - let response = undefined; - - const headers: { [header: string]: string } = { -{% for parameter in method.parameters.header %} - '{{ parameter.name | caseCamel | escapeKeyword }}': this.${{ parameter.name | caseCamel | escapeKeyword }}, -{% endfor %} -{% for key, header in method.headers %} - '{{ key }}': '{{ header }}', -{% endfor %} - } - - let counter = 0; - const totalCounters = Math.ceil(size / {{ spec.title | caseUcfirst }}.CHUNK_SIZE); -{% for parameter in method.parameters.all %} -{% if parameter.isUploadID %} - if({{ parameter.name | caseCamel | escapeKeyword }} != 'unique()') { - try { - response = await this.call('GET', new URL(this.config.endpoint + path + '/' + {{ parameter.name }}), headers); - counter = response.chunksUploaded; - } catch(e) { - } - } -{% endif %} -{% endfor %} - - for (counter; counter < totalCounters; counter++) { - const start = (counter * {{ spec.title | caseUcfirst }}.CHUNK_SIZE); - const end = Math.min((((counter * {{ spec.title | caseUcfirst }}.CHUNK_SIZE) + {{ spec.title | caseUcfirst }}.CHUNK_SIZE) - 1), size); - - headers['content-range'] = 'bytes ' + start + '-' + end + '/' + size - - if (id) { - headers['x-{{spec.title | caseLower }}-id'] = id; - } - - const stream = {{ parameter.name | caseCamel | escapeKeyword }}.slice(start, end + 1); - payload['{{ parameter.name }}'] = new File([stream], {{ parameter.name | caseCamel | escapeKeyword }}.name); - - response = await this.call('{{ method.method | caseLower }}', uri, headers, payload); - - if (!id) { - id = response['$id']; - } - - if (onProgress) { - onProgress({ - $id: response.$id, - progress: Math.min((counter + 1) * {{ spec.title | caseUcfirst }}.CHUNK_SIZE - 1, size) / size * 100, - sizeUploaded: end, - chunksTotal: response.chunksTotal, - chunksUploaded: response.chunksUploaded - }); - } - } - - return response; -{% endif %} -{% endfor %} -{% else %} - return await this.call('{{ method.method | caseLower }}', uri, { -{% for parameter in method.parameters.header %} - '{{ parameter.name | caseCamel | escapeKeyword }}': this.${{ parameter.name | caseCamel | escapeKeyword }}, -{% endfor %} -{% for key, header in method.headers %} - '{{ key }}': '{{ header }}', -{% endfor %} - }, payload); -{% endif %} -{% endif %} - }{% if not loop.last %}, -{% endif %} -{% endfor %} - - }; - -{% endfor %} -}; - -type QueryTypesSingle = string | number | boolean; -type QueryTypesList = string[] | number[] | boolean[]; -type QueryTypes = QueryTypesSingle | QueryTypesList; - -class Query { - static equal = (attribute: string, value: QueryTypes): string => - Query.addQuery(attribute, "equal", value); - - static notEqual = (attribute: string, value: QueryTypes): string => - Query.addQuery(attribute, "notEqual", value); - - static lesser = (attribute: string, value: QueryTypes): string => - Query.addQuery(attribute, "lesser", value); - - static lesserEqual = (attribute: string, value: QueryTypes): string => - Query.addQuery(attribute, "lesserEqual", value); - - static greater = (attribute: string, value: QueryTypes): string => - Query.addQuery(attribute, "greater", value); - - static greaterEqual = (attribute: string, value: QueryTypes): string => - Query.addQuery(attribute, "greaterEqual", value); - - static search = (attribute: string, value: string): string => - Query.addQuery(attribute, "search", value); - - private static addQuery = (attribute: string, oper: string, value: QueryTypes): string => - value instanceof Array - ? `${attribute}.${oper}(${value - .map((v: QueryTypesSingle) => Query.parseValues(v)) - .join(",")})` - : `${attribute}.${oper}(${Query.parseValues(value)})`; - - private static parseValues = (value: QueryTypes): string => - typeof value === "string" || value instanceof String - ? `"${value}"` - : `${value}`; } -export { {{spec.title | caseUcfirst}}, Query } -export type { {{spec.title | caseUcfirst}}Exception, Models, QueryTypes, QueryTypesList } +export { Client, {{spec.title | caseUcfirst}}Exception }; +export { Query } from './query'; +export type { Models, Payload }; +export type { QueryTypes, QueryTypesList } from './query'; diff --git a/templates/web/src/id.ts.twig b/templates/web/src/id.ts.twig new file mode 100644 index 0000000000..9577e4b179 --- /dev/null +++ b/templates/web/src/id.ts.twig @@ -0,0 +1,9 @@ +export class ID { + public static custom(id: string): string { + return id + } + + public static unique(): string { + return 'unique()' + } +} \ No newline at end of file diff --git a/templates/web/src/index.ts.twig b/templates/web/src/index.ts.twig new file mode 100644 index 0000000000..75ecd534da --- /dev/null +++ b/templates/web/src/index.ts.twig @@ -0,0 +1,9 @@ +export { Client, Query, {{spec.title | caseUcfirst}}Exception } from './client'; +{% for service in spec.services %} +export { {{service.name | caseUcfirst}} } from './services/{{service.name | caseDash}}'; +{% endfor %} +export type { Models, Payload, RealtimeResponseEvent, UploadProgress } from './client'; +export type { QueryTypes, QueryTypesList } from './query'; +export { Permission } from './permission'; +export { Role } from './role'; +export { ID } from './id'; \ No newline at end of file diff --git a/templates/web/src/models.ts.twig b/templates/web/src/models.ts.twig new file mode 100644 index 0000000000..4b0f63f8bd --- /dev/null +++ b/templates/web/src/models.ts.twig @@ -0,0 +1,17 @@ +export namespace Models { +{% for definition in spec.definitions %} + /** + * {{ definition.description }} + */ + export type {{ definition.name | caseUcfirst }}{{ definition.name | getGenerics(spec, true) | raw }} = { +{% for property in definition.properties %} + /** + * {{ property.description }} + */ + {{ property.name }}{% if not property.required %}?{% endif %}: {{ property | getSubSchema(spec) | raw }}; +{% endfor %} +{% if definition.additionalProperties %} [key: string]: any; +{% endif %} + } +{% endfor %} +} diff --git a/templates/web/src/permission.ts.twig b/templates/web/src/permission.ts.twig new file mode 100644 index 0000000000..bfc330a166 --- /dev/null +++ b/templates/web/src/permission.ts.twig @@ -0,0 +1,22 @@ +export class Permission { + + static read = (role: string): string => { + return `read("${role}")` + } + + static write = (role: string): string => { + return `write("${role}")` + } + + static create = (role: string): string => { + return `create("${role}")` + } + + static update = (role: string): string => { + return `update("${role}")` + } + + static delete = (role: string): string => { + return `delete("${role}")` + } +} diff --git a/templates/web/src/query.ts.twig b/templates/web/src/query.ts.twig new file mode 100644 index 0000000000..962a6c8f7e --- /dev/null +++ b/templates/web/src/query.ts.twig @@ -0,0 +1,56 @@ +type QueryTypesSingle = string | number | boolean; +export type QueryTypesList = string[] | number[] | boolean[]; +export type QueryTypes = QueryTypesSingle | QueryTypesList; + +export class Query { + static equal = (attribute: string, value: QueryTypes): string => + Query.addQuery(attribute, "equal", value); + + static notEqual = (attribute: string, value: QueryTypes): string => + Query.addQuery(attribute, "notEqual", value); + + static lessThan = (attribute: string, value: QueryTypes): string => + Query.addQuery(attribute, "lessThan", value); + + static lessThanEqual = (attribute: string, value: QueryTypes): string => + Query.addQuery(attribute, "lessThanEqual", value); + + static greaterThan = (attribute: string, value: QueryTypes): string => + Query.addQuery(attribute, "greaterThan", value); + + static greaterThanEqual = (attribute: string, value: QueryTypes): string => + Query.addQuery(attribute, "greaterThanEqual", value); + + static search = (attribute: string, value: string): string => + Query.addQuery(attribute, "search", value); + + static orderDesc = (attribute: string): string => + `orderDesc("${attribute}")`; + + static orderAsc = (attribute: string): string => + `orderAsc("${attribute}")`; + + static cursorAfter = (documentId: string): string => + `cursorAfter("${documentId}")`; + + static cursorBefore = (documentId: string): string => + `cursorBefore("${documentId}")`; + + static limit = (limit: number): string => + `limit(${limit})`; + + static offset = (offset: number): string => + `offset(${offset})`; + + private static addQuery = (attribute: string, method: string, value: QueryTypes): string => + value instanceof Array + ? `${method}("${attribute}", [${value + .map((v: QueryTypesSingle) => Query.parseValues(v)) + .join(",")}])` + : `${method}("${attribute}", [${Query.parseValues(value)}])`; + + private static parseValues = (value: QueryTypes): string => + typeof value === "string" || value instanceof String + ? `"${value}"` + : `${value}`; +} \ No newline at end of file diff --git a/templates/web/src/role.ts.twig b/templates/web/src/role.ts.twig new file mode 100644 index 0000000000..d94e398c67 --- /dev/null +++ b/templates/web/src/role.ts.twig @@ -0,0 +1,34 @@ +export class Role { + public static any(): string { + return 'any' + } + + public static user(id: string, status: string = ''): string { + if(status === '') { + return `user:${id}` + } + return `user:${id}/${status}` + } + + public static users(status: string = ''): string { + if(status === '') { + return 'users' + } + return `users/${status}` + } + + public static guests(): string { + return 'guests' + } + + public static team(id: string, role: string = ''): string { + if(role === '') { + return `team:${id}` + } + return `team:${id}/${role}` + } + + public static member(id: string): string { + return `member:${id}` + } +} \ No newline at end of file diff --git a/templates/web/src/service.ts.twig b/templates/web/src/service.ts.twig new file mode 100644 index 0000000000..0c9662be37 --- /dev/null +++ b/templates/web/src/service.ts.twig @@ -0,0 +1,30 @@ +import { Client } from './client'; +import type { Payload } from './client'; + +export class Service { + static CHUNK_SIZE = 5*1024*1024; // 5MB + + client: Client; + + constructor(client: Client) { + this.client = client; + } + + static flatten(data: Payload, prefix = ''): Payload { + let output: Payload = {}; + + for (const key in data) { + let value = data[key]; + let finalKey = prefix ? `${prefix}[${key}]` : key; + + if (Array.isArray(value)) { + output = Object.assign(output, this.flatten(value, finalKey)); + } + else { + output[finalKey] = value; + } + } + + return output; + } +} \ No newline at end of file diff --git a/templates/web/src/services/template.ts.twig b/templates/web/src/services/template.ts.twig new file mode 100644 index 0000000000..f1345d1e1a --- /dev/null +++ b/templates/web/src/services/template.ts.twig @@ -0,0 +1,169 @@ +import { Service } from '../service'; +import { {{ spec.title | caseUcfirst}}Exception, Client } from '../client'; +import type { Models } from '../models'; +import type { UploadProgress, Payload } from '../client'; + +export class {{ service.name | caseUcfirst }} extends Service { + + constructor(client: Client) + { + super(client); + } +{% for method in service.methods %} + + /** + * {{ method.title }} + * +{% if method.description %} +{{ method.description|comment3 }} +{% endif %} + * +{% for parameter in method.parameters.all %} + * @param {{ '{' }}{{ parameter | getPropertyType(method) | raw }}{{ '}' }} {{ parameter.name | caseCamel | escapeKeyword }} +{% endfor %} + * @throws {{ '{' }}{{ spec.title | caseUcfirst}}Exception} + * @returns {% if method.type == 'webAuth' %}{void|string}{% elseif method.type == 'location' %}{URL}{% else %}{Promise}{% endif %} + + */ + {% if method.type != 'location' and method.type != 'webAuth'%}async {% endif %}{{ method.name | caseCamel }}{{ method.responseModel | getGenerics(spec) | raw }}({% for parameter in method.parameters.all %}{{ parameter.name | caseCamel | escapeKeyword }}{% if not parameter.required %}?{% endif %}: {{ parameter | getPropertyType(method) | raw }}{% if not loop.last %}, {% endif %}{% endfor %}{% if 'multipart/form-data' in method.consumes %}, onProgress = (progress: UploadProgress) => {}{% endif %}): {{ method | getReturn(spec) | raw }} { +{% for parameter in method.parameters.all %} +{% if parameter.required %} + if (typeof {{ parameter.name | caseCamel | escapeKeyword }} === 'undefined') { + throw new {{spec.title | caseUcfirst}}Exception('Missing required parameter: "{{ parameter.name | caseCamel | escapeKeyword }}"'); + } + +{% endif %} +{% endfor %} + let path = '{{ method.path }}'{% for parameter in method.parameters.path %}.replace('{{ '{' }}{{ parameter.name | caseCamel | escapeKeyword }}{{ '}' }}', {{ parameter.name | caseCamel | escapeKeyword }}){% endfor %}; + let payload: Payload = {}; + +{% for parameter in method.parameters.query %} + if (typeof {{ parameter.name | caseCamel | escapeKeyword }} !== 'undefined') { + payload['{{ parameter.name }}'] = {{ parameter.name | caseCamel | escapeKeyword }}; + } + +{% endfor %} +{% for parameter in method.parameters.body %} + if (typeof {{ parameter.name | caseCamel | escapeKeyword }} !== 'undefined') { + payload['{{ parameter.name }}'] = {{ parameter.name | caseCamel | escapeKeyword }}; + } + +{% endfor %} + const uri = new URL(this.client.config.endpoint + path); +{% if method.type == 'location' or method.type == 'webAuth' %} +{% if method.auth|length > 0 %} +{% for node in method.auth %} +{% for key,header in node|keys %} + payload['{{header|caseLower}}'] = this.client.config.{{header|caseLower}}; + +{% endfor %} +{% endfor %} +{% endif %} + + for (const [key, value] of Object.entries(Service.flatten(payload))) { + uri.searchParams.append(key, value); + } +{% endif %} +{% if method.type == 'webAuth' %} + if (typeof window !== 'undefined' && window?.location) { + window.location.href = uri.toString(); + } else { + return uri; + } +{% elseif method.type == 'location' %} + return uri; +{% else %} +{% if 'multipart/form-data' in method.consumes %} +{% for parameter in method.parameters.all %} +{% if parameter.type == 'file' %} + + if(!({{ parameter.name | caseCamel | escapeKeyword }} instanceof File)) { + throw new {{spec.title | caseUcfirst}}Exception('Parameter "{{ parameter.name | caseCamel | escapeKeyword }}" has to be a File.'); + } + + const size = {{ parameter.name | caseCamel | escapeKeyword }}.size; + + if (size <= Service.CHUNK_SIZE) { + return await this.client.call('{{ method.method | caseLower }}', uri, { + +{% for parameter in method.parameters.header %} + '{{ parameter.name | caseCamel | escapeKeyword }}': this.client.${{ parameter.name | caseCamel | escapeKeyword }}, +{% endfor %} +{% for key, header in method.headers %} + '{{ key }}': '{{ header }}', +{% endfor %} + }, payload); + } + let id = undefined; + let response = undefined; + + const headers: { [header: string]: string } = { +{% for parameter in method.parameters.header %} + '{{ parameter.name | caseCamel | escapeKeyword }}': this.client.${{ parameter.name | caseCamel | escapeKeyword }}, +{% endfor %} +{% for key, header in method.headers %} + '{{ key }}': '{{ header }}', +{% endfor %} + } + + let counter = 0; + const totalCounters = Math.ceil(size / Service.CHUNK_SIZE); +{% for parameter in method.parameters.all %} +{% if parameter.isUploadID %} + if({{ parameter.name | caseCamel | escapeKeyword }} != 'unique()') { + try { + response = await this.client.call('GET', new URL(this.client.config.endpoint + path + '/' + {{ parameter.name }}), headers); + counter = response.chunksUploaded; + } catch(e) { + } + } +{% endif %} +{% endfor %} + + for (counter; counter < totalCounters; counter++) { + const start = (counter * Service.CHUNK_SIZE); + const end = Math.min((((counter * Service.CHUNK_SIZE) + Service.CHUNK_SIZE) - 1), size); + + headers['content-range'] = 'bytes ' + start + '-' + end + '/' + size + + if (id) { + headers['x-{{spec.title | caseLower }}-id'] = id; + } + + const stream = {{ parameter.name | caseCamel | escapeKeyword }}.slice(start, end + 1); + payload['{{ parameter.name }}'] = new File([stream], {{ parameter.name | caseCamel | escapeKeyword }}.name); + + response = await this.client.call('{{ method.method | caseLower }}', uri, headers, payload); + + if (!id) { + id = response['$id']; + } + + if (onProgress) { + onProgress({ + $id: response.$id, + progress: Math.min((counter + 1) * Service.CHUNK_SIZE - 1, size) / size * 100, + sizeUploaded: end, + chunksTotal: response.chunksTotal, + chunksUploaded: response.chunksUploaded + }); + } + } + + return response; +{% endif %} +{% endfor %} +{% else %} + return await this.client.call('{{ method.method | caseLower }}', uri, { +{% for parameter in method.parameters.header %} + '{{ parameter.name | caseCamel | escapeKeyword }}': this.client.${{ parameter.name | caseCamel | escapeKeyword }}, +{% endfor %} +{% for key, header in method.headers %} + '{{ key }}': '{{ header }}', +{% endfor %} + }, payload); +{% endif %} +{% endif %} + } +{% endfor %} +}; diff --git a/tests/Android11Java11Test.php b/tests/Android11Java11Test.php index 467bea95f5..3985cd3f2a 100644 --- a/tests/Android11Java11Test.php +++ b/tests/Android11Java11Test.php @@ -4,11 +4,16 @@ class Android11Java11Test extends Base { + protected string $sdkName = 'android'; + protected string $sdkPlatform = 'client'; + protected string $sdkLanguage = 'android'; + protected string $version = '0.0.1'; + protected string $language = 'android'; protected string $class = 'Appwrite\SDK\Language\Android'; protected array $build = [ 'mkdir -p tests/sdks/android/library/src/test/java', - 'cp tests/languages/android/ServiceTest.kt tests/sdks/android/library/src/test/java/ServiceTest.kt', + 'cp tests/languages/android/Tests.kt tests/sdks/android/library/src/test/java/Tests.kt', 'chmod +x tests/sdks/android/gradlew', ]; protected string $command = @@ -19,8 +24,13 @@ class Android11Java11Test extends Base ...Base::BAR_RESPONSES, ...Base::GENERAL_RESPONSES, ...Base::LARGE_FILE_RESPONSES, + ...Base::LARGE_FILE_RESPONSES, + ...Base::LARGE_FILE_RESPONSES, ...Base::EXCEPTION_RESPONSES, ...Base::REALTIME_RESPONSES, ...Base::COOKIE_RESPONSES, + ...Base::QUERY_HELPER_RESPONSES, + ...Base::PERMISSION_HELPER_RESPONSES, + ...Base::ID_HELPER_RESPONSES ]; } diff --git a/tests/Android11Java8Test.php b/tests/Android11Java8Test.php index f11a605d83..a73b040ada 100644 --- a/tests/Android11Java8Test.php +++ b/tests/Android11Java8Test.php @@ -4,11 +4,16 @@ class Android11Java8Test extends Base { + protected string $sdkName = 'android'; + protected string $sdkPlatform = 'client'; + protected string $sdkLanguage = 'android'; + protected string $version = '0.0.1'; + protected string $language = 'android'; protected string $class = 'Appwrite\SDK\Language\Android'; protected array $build = [ 'mkdir -p tests/sdks/android/library/src/test/java', - 'cp tests/languages/android/ServiceTest.kt tests/sdks/android/library/src/test/java/ServiceTest.kt', + 'cp tests/languages/android/Tests.kt tests/sdks/android/library/src/test/java/Tests.kt', 'chmod +x tests/sdks/android/gradlew', ]; protected string $command = @@ -19,8 +24,13 @@ class Android11Java8Test extends Base ...Base::BAR_RESPONSES, ...Base::GENERAL_RESPONSES, ...Base::LARGE_FILE_RESPONSES, + ...Base::LARGE_FILE_RESPONSES, + ...Base::LARGE_FILE_RESPONSES, ...Base::EXCEPTION_RESPONSES, ...Base::REALTIME_RESPONSES, ...Base::COOKIE_RESPONSES, + ...Base::QUERY_HELPER_RESPONSES, + ...Base::PERMISSION_HELPER_RESPONSES, + ...Base::ID_HELPER_RESPONSES ]; } diff --git a/tests/Android12Java11Test.php b/tests/Android12Java11Test.php index 6a98a1ba9d..23eec2fbba 100644 --- a/tests/Android12Java11Test.php +++ b/tests/Android12Java11Test.php @@ -4,11 +4,16 @@ class Android12Java11Test extends Base { + protected string $sdkName = 'android'; + protected string $sdkPlatform = 'client'; + protected string $sdkLanguage = 'android'; + protected string $version = '0.0.1'; + protected string $language = 'android'; protected string $class = 'Appwrite\SDK\Language\Android'; protected array $build = [ 'mkdir -p tests/sdks/android/library/src/test/java', - 'cp tests/languages/android/ServiceTest.kt tests/sdks/android/library/src/test/java/ServiceTest.kt', + 'cp tests/languages/android/Tests.kt tests/sdks/android/library/src/test/java/Tests.kt', 'chmod +x tests/sdks/android/gradlew', ]; protected string $command = @@ -19,8 +24,13 @@ class Android12Java11Test extends Base ...Base::BAR_RESPONSES, ...Base::GENERAL_RESPONSES, ...Base::LARGE_FILE_RESPONSES, + ...Base::LARGE_FILE_RESPONSES, + ...Base::LARGE_FILE_RESPONSES, ...Base::EXCEPTION_RESPONSES, ...Base::REALTIME_RESPONSES, ...Base::COOKIE_RESPONSES, + ...Base::QUERY_HELPER_RESPONSES, + ...Base::PERMISSION_HELPER_RESPONSES, + ...Base::ID_HELPER_RESPONSES ]; } diff --git a/tests/Android12Java8Test.php b/tests/Android12Java8Test.php index c701349e7a..8718b25b46 100644 --- a/tests/Android12Java8Test.php +++ b/tests/Android12Java8Test.php @@ -4,11 +4,16 @@ class Android12Java8Test extends Base { + protected string $sdkName = 'android'; + protected string $sdkPlatform = 'client'; + protected string $sdkLanguage = 'android'; + protected string $version = '0.0.1'; + protected string $language = 'android'; protected string $class = 'Appwrite\SDK\Language\Android'; protected array $build = [ 'mkdir -p tests/sdks/android/library/src/test/java', - 'cp tests/languages/android/ServiceTest.kt tests/sdks/android/library/src/test/java/ServiceTest.kt', + 'cp tests/languages/android/Tests.kt tests/sdks/android/library/src/test/java/Tests.kt', 'chmod +x tests/sdks/android/gradlew', ]; protected string $command = @@ -19,8 +24,13 @@ class Android12Java8Test extends Base ...Base::BAR_RESPONSES, ...Base::GENERAL_RESPONSES, ...Base::LARGE_FILE_RESPONSES, + ...Base::LARGE_FILE_RESPONSES, + ...Base::LARGE_FILE_RESPONSES, ...Base::EXCEPTION_RESPONSES, ...Base::REALTIME_RESPONSES, ...Base::COOKIE_RESPONSES, + ...Base::QUERY_HELPER_RESPONSES, + ...Base::PERMISSION_HELPER_RESPONSES, + ...Base::ID_HELPER_RESPONSES ]; } diff --git a/tests/Android5Java11Test.php b/tests/Android5Java11Test.php index e717558e00..0b29aff87e 100644 --- a/tests/Android5Java11Test.php +++ b/tests/Android5Java11Test.php @@ -4,11 +4,16 @@ class Android5Java11Test extends Base { + protected string $sdkName = 'android'; + protected string $sdkPlatform = 'client'; + protected string $sdkLanguage = 'android'; + protected string $version = '0.0.1'; + protected string $language = 'android'; protected string $class = 'Appwrite\SDK\Language\Android'; protected array $build = [ 'mkdir -p tests/sdks/android/library/src/test/java', - 'cp tests/languages/android/ServiceTest.kt tests/sdks/android/library/src/test/java/ServiceTest.kt', + 'cp tests/languages/android/Tests.kt tests/sdks/android/library/src/test/java/Tests.kt', 'chmod +x tests/sdks/android/gradlew', ]; protected string $command = @@ -19,8 +24,13 @@ class Android5Java11Test extends Base ...Base::BAR_RESPONSES, ...Base::GENERAL_RESPONSES, ...Base::LARGE_FILE_RESPONSES, + ...Base::LARGE_FILE_RESPONSES, + ...Base::LARGE_FILE_RESPONSES, ...Base::EXCEPTION_RESPONSES, ...Base::REALTIME_RESPONSES, ...Base::COOKIE_RESPONSES, + ...Base::QUERY_HELPER_RESPONSES, + ...Base::PERMISSION_HELPER_RESPONSES, + ...Base::ID_HELPER_RESPONSES ]; } diff --git a/tests/Android5Java8Test.php b/tests/Android5Java8Test.php index beda628792..6332f10403 100644 --- a/tests/Android5Java8Test.php +++ b/tests/Android5Java8Test.php @@ -4,11 +4,16 @@ class Android5Java8Test extends Base { + protected string $sdkName = 'android'; + protected string $sdkPlatform = 'client'; + protected string $sdkLanguage = 'android'; + protected string $version = '0.0.1'; + protected string $language = 'android'; protected string $class = 'Appwrite\SDK\Language\Android'; protected array $build = [ 'mkdir -p tests/sdks/android/library/src/test/java', - 'cp tests/languages/android/ServiceTest.kt tests/sdks/android/library/src/test/java/ServiceTest.kt', + 'cp tests/languages/android/Tests.kt tests/sdks/android/library/src/test/java/Tests.kt', 'chmod +x tests/sdks/android/gradlew', ]; protected string $command = @@ -19,8 +24,13 @@ class Android5Java8Test extends Base ...Base::BAR_RESPONSES, ...Base::GENERAL_RESPONSES, ...Base::LARGE_FILE_RESPONSES, + ...Base::LARGE_FILE_RESPONSES, + ...Base::LARGE_FILE_RESPONSES, ...Base::EXCEPTION_RESPONSES, ...Base::REALTIME_RESPONSES, ...Base::COOKIE_RESPONSES, + ...Base::QUERY_HELPER_RESPONSES, + ...Base::PERMISSION_HELPER_RESPONSES, + ...Base::ID_HELPER_RESPONSES ]; } diff --git a/tests/AppleSwift55Test.php b/tests/AppleSwift55Test.php new file mode 100644 index 0000000000..b9b2e88426 --- /dev/null +++ b/tests/AppleSwift55Test.php @@ -0,0 +1,35 @@ +sdkName}; x-sdk-platform: {$this->sdkPlatform}; x-sdk-language: {$this->sdkLanguage}; x-sdk-version: {$this->version}"; + array_push($this->expectedOutput, $headers); } public function tearDown(): void { } + /** + * @throws SyntaxError + * @throws \Throwable + * @throws RuntimeError + * @throws LoaderError + */ public function testHTTPSuccess(): void { $spec = file_get_contents(realpath(__DIR__ . '/resources/spec.json')); @@ -83,11 +125,13 @@ public function testHTTPSuccess(): void $sdk = new SDK($this->getLanguage(), new Swagger2($spec)); $sdk + ->setName($this->sdkName) + ->setVersion($this->version) + ->setPlatform($this->sdkPlatform) ->setDescription('Repo description goes here') ->setShortDescription('Repo short description goes here') ->setLogo('https://appwrite.io/v1/images/console.png') ->setWarning('**WORK IN PROGRESS - THIS IS JUST A TEST SDK**') - ->setVersion('0.0.1') ->setExamples('**EXAMPLES** ') ->setNamespace("io appwrite") ->setGitUserName('repoowner') @@ -102,7 +146,7 @@ public function testHTTPSuccess(): void $dir = __DIR__ . '/sdks/' . $this->language; - $this->rmdir_recursive($dir); + $this->rmdirRecursive($dir); $sdk->generate(__DIR__ . '/sdks/' . $this->language); @@ -151,19 +195,25 @@ public function testHTTPSuccess(): void } } - private function rmdir_recursive($dir) { + private function rmdirRecursive($dir) + { if (!\is_dir($dir)) { return; } - foreach(\scandir($dir) as $file) { - if ('.' === $file || '..' === $file) continue; - if (\is_dir("$dir/$file")) $this->rmdir_recursive("$dir/$file"); - else \unlink("$dir/$file"); + foreach (\scandir($dir) as $file) { + if ('.' === $file || '..' === $file) { + continue; + } + if (\is_dir("$dir/$file")) { + $this->rmdirRecursive("$dir/$file"); + } else { + \unlink("$dir/$file"); + } } rmdir($dir); } - public function getLanguage(): Language + public function getLanguage(): Language { return new $this->class(); } diff --git a/tests/CLINode14Test.php b/tests/CLINode14Test.php index 934718fbbc..9986758d14 100644 --- a/tests/CLINode14Test.php +++ b/tests/CLINode14Test.php @@ -7,6 +7,11 @@ class CLINode14Test extends Base { + protected string $sdkName = 'cli'; + protected string $sdkPlatform = 'server'; + protected string $sdkLanguage = 'cli'; + protected string $version = '0.0.1'; + protected string $language = 'cli'; protected string $class = 'Appwrite\SDK\Language\CLI'; protected array $build = [ @@ -47,4 +52,4 @@ public function getLanguage(): Language return $language; } -} \ No newline at end of file +} diff --git a/tests/CLINode16Test.php b/tests/CLINode16Test.php index e495247599..c6ed8549c2 100644 --- a/tests/CLINode16Test.php +++ b/tests/CLINode16Test.php @@ -7,6 +7,11 @@ class CLINode16Test extends Base { + protected string $sdkName = 'cli'; + protected string $sdkPlatform = 'server'; + protected string $sdkLanguage = 'cli'; + protected string $version = '0.0.1'; + protected string $language = 'cli'; protected string $class = 'Appwrite\SDK\Language\CLI'; protected array $build = [ @@ -47,4 +52,4 @@ public function getLanguage(): Language return $language; } -} \ No newline at end of file +} diff --git a/tests/DartBetaTest.php b/tests/DartBetaTest.php index 173b146e27..f6dec74eef 100644 --- a/tests/DartBetaTest.php +++ b/tests/DartBetaTest.php @@ -4,6 +4,11 @@ class DartBetaTest extends Base { + protected string $sdkName = 'dart'; + protected string $sdkPlatform = 'server'; + protected string $sdkLanguage = 'dart'; + protected string $version = '0.0.1'; + protected string $language = 'dart'; protected string $class = 'Appwrite\SDK\Language\Dart'; protected array $build = [ @@ -19,5 +24,8 @@ class DartBetaTest extends Base ...Base::GENERAL_RESPONSES, ...Base::LARGE_FILE_RESPONSES, ...Base::EXCEPTION_RESPONSES, + ...Base::QUERY_HELPER_RESPONSES, + ...Base::PERMISSION_HELPER_RESPONSES, + ...Base::ID_HELPER_RESPONSES ]; } diff --git a/tests/DartStableTest.php b/tests/DartStableTest.php index 4d4cf453a4..1c586ab28c 100644 --- a/tests/DartStableTest.php +++ b/tests/DartStableTest.php @@ -4,6 +4,11 @@ class DartStableTest extends Base { + protected string $sdkName = 'dart'; + protected string $sdkPlatform = 'server'; + protected string $sdkLanguage = 'dart'; + protected string $version = '0.0.1'; + protected string $language = 'dart'; protected string $class = 'Appwrite\SDK\Language\Dart'; protected array $build = [ @@ -19,5 +24,8 @@ class DartStableTest extends Base ...Base::GENERAL_RESPONSES, ...Base::LARGE_FILE_RESPONSES, ...Base::EXCEPTION_RESPONSES, + ...Base::QUERY_HELPER_RESPONSES, + ...Base::PERMISSION_HELPER_RESPONSES, + ...Base::ID_HELPER_RESPONSES ]; } diff --git a/tests/Deno1171Test.php b/tests/Deno1171Test.php index e237b5f430..d482a7de6f 100644 --- a/tests/Deno1171Test.php +++ b/tests/Deno1171Test.php @@ -4,6 +4,11 @@ class Deno1171Test extends Base { + protected string $sdkName = 'deno'; + protected string $sdkPlatform = 'server'; + protected string $sdkLanguage = 'deno'; + protected string $version = '0.0.1'; + protected string $language = 'deno'; protected string $class = 'Appwrite\SDK\Language\Deno'; protected array $build = []; @@ -16,5 +21,8 @@ class Deno1171Test extends Base ...Base::GENERAL_RESPONSES, ...Base::LARGE_FILE_RESPONSES, ...Base::EXCEPTION_RESPONSES, + ...Base::QUERY_HELPER_RESPONSES, + ...Base::PERMISSION_HELPER_RESPONSES, + ...Base::ID_HELPER_RESPONSES ]; } diff --git a/tests/FlutterBetaTest.php b/tests/FlutterBetaTest.php index 98d6d718d8..bbb1ff2bf5 100644 --- a/tests/FlutterBetaTest.php +++ b/tests/FlutterBetaTest.php @@ -4,6 +4,11 @@ class FlutterBetaTest extends Base { + protected string $sdkName = 'flutter'; + protected string $sdkPlatform = 'client'; + protected string $sdkLanguage = 'flutter'; + protected string $version = '0.0.1'; + protected string $language = 'flutter'; protected string $class = 'Appwrite\SDK\Language\Flutter'; protected array $build = [ @@ -19,7 +24,10 @@ class FlutterBetaTest extends Base ...Base::GENERAL_RESPONSES, ...Base::LARGE_FILE_RESPONSES, ...Base::EXCEPTION_RESPONSES, - ...Base::REALTIME_RESPONSES, + //...Base::REALTIME_RESPONSES, ...Base::COOKIE_RESPONSES, + ...Base::QUERY_HELPER_RESPONSES, + ...Base::PERMISSION_HELPER_RESPONSES, + ...Base::ID_HELPER_RESPONSES ]; } diff --git a/tests/FlutterStableTest.php b/tests/FlutterStableTest.php index f93811d1ac..342820ddd4 100644 --- a/tests/FlutterStableTest.php +++ b/tests/FlutterStableTest.php @@ -4,6 +4,11 @@ class FlutterStableTest extends Base { + protected string $sdkName = 'flutter'; + protected string $sdkPlatform = 'client'; + protected string $sdkLanguage = 'flutter'; + protected string $version = '0.0.1'; + protected string $language = 'flutter'; protected string $class = 'Appwrite\SDK\Language\Flutter'; protected array $build = [ @@ -19,7 +24,10 @@ class FlutterStableTest extends Base ...Base::GENERAL_RESPONSES, ...Base::LARGE_FILE_RESPONSES, ...Base::EXCEPTION_RESPONSES, - ...Base::REALTIME_RESPONSES, + //...Base::REALTIME_RESPONSES, ...Base::COOKIE_RESPONSES, + ...Base::QUERY_HELPER_RESPONSES, + ...Base::PERMISSION_HELPER_RESPONSES, + ...Base::ID_HELPER_RESPONSES ]; } diff --git a/tests/Go112Test.php b/tests/Go112Test.php index 3c440a87a7..c845e202f3 100644 --- a/tests/Go112Test.php +++ b/tests/Go112Test.php @@ -4,6 +4,11 @@ class Go112Test extends Base { + protected string $sdkName = 'go'; + protected string $sdkPlatform = 'server'; + protected string $sdkLanguage = 'go'; + protected string $version = '0.0.1'; + protected string $language = 'go'; protected string $class = 'Appwrite\SDK\Language\Go'; protected array $build = [ diff --git a/tests/Go118Test.php b/tests/Go118Test.php index 7aed71fd15..d05acf7ac1 100644 --- a/tests/Go118Test.php +++ b/tests/Go118Test.php @@ -4,6 +4,11 @@ class Go118Test extends Base { + protected string $sdkName = 'go'; + protected string $sdkPlatform = 'server'; + protected string $sdkLanguage = 'go'; + protected string $version = '0.0.1'; + protected string $language = 'go'; protected string $class = 'Appwrite\SDK\Language\Go'; protected array $build = [ diff --git a/tests/KotlinJava11Test.php b/tests/KotlinJava11Test.php index 04e9347b6a..0522fc7ccf 100644 --- a/tests/KotlinJava11Test.php +++ b/tests/KotlinJava11Test.php @@ -4,11 +4,16 @@ class KotlinJava11Test extends Base { + protected string $sdkName = 'kotlin'; + protected string $sdkPlatform = 'server'; + protected string $sdkLanguage = 'kotlin'; + protected string $version = '0.0.1'; + protected string $language = 'kotlin'; protected string $class = 'Appwrite\SDK\Language\Kotlin'; protected array $build = [ 'mkdir -p tests/sdks/kotlin/src/test/kotlin', - 'cp tests/languages/kotlin/ServiceTest.kt tests/sdks/kotlin/src/test/kotlin/ServiceTest.kt', + 'cp tests/languages/kotlin/Tests.kt tests/sdks/kotlin/src/test/kotlin/Tests.kt', 'chmod +x tests/sdks/kotlin/gradlew', ]; protected string $command = @@ -19,6 +24,11 @@ class KotlinJava11Test extends Base ...Base::BAR_RESPONSES, ...Base::GENERAL_RESPONSES, ...Base::LARGE_FILE_RESPONSES, - ...Base::EXCEPTION_RESPONSES + ...Base::LARGE_FILE_RESPONSES, + ...Base::LARGE_FILE_RESPONSES, + ...Base::EXCEPTION_RESPONSES, + ...Base::QUERY_HELPER_RESPONSES, + ...Base::PERMISSION_HELPER_RESPONSES, + ...Base::ID_HELPER_RESPONSES ]; } diff --git a/tests/KotlinJava17Test.php b/tests/KotlinJava17Test.php index 332d6068b9..df1110f8b6 100644 --- a/tests/KotlinJava17Test.php +++ b/tests/KotlinJava17Test.php @@ -4,11 +4,16 @@ class KotlinJava17Test extends Base { + protected string $sdkName = 'kotlin'; + protected string $sdkPlatform = 'server'; + protected string $sdkLanguage = 'kotlin'; + protected string $version = '0.0.1'; + protected string $language = 'kotlin'; protected string $class = 'Appwrite\SDK\Language\Kotlin'; protected array $build = [ 'mkdir -p tests/sdks/kotlin/src/test/kotlin', - 'cp tests/languages/kotlin/ServiceTest.kt tests/sdks/kotlin/src/test/kotlin/ServiceTest.kt', + 'cp tests/languages/kotlin/Tests.kt tests/sdks/kotlin/src/test/kotlin/Tests.kt', 'chmod +x tests/sdks/kotlin/gradlew', ]; protected string $command = @@ -19,6 +24,11 @@ class KotlinJava17Test extends Base ...Base::BAR_RESPONSES, ...Base::GENERAL_RESPONSES, ...Base::LARGE_FILE_RESPONSES, - ...Base::EXCEPTION_RESPONSES + ...Base::LARGE_FILE_RESPONSES, + ...Base::LARGE_FILE_RESPONSES, + ...Base::EXCEPTION_RESPONSES, + ...Base::QUERY_HELPER_RESPONSES, + ...Base::PERMISSION_HELPER_RESPONSES, + ...Base::ID_HELPER_RESPONSES ]; } diff --git a/tests/KotlinJava8Test.php b/tests/KotlinJava8Test.php index 7379fd01cc..c5ded35ffa 100644 --- a/tests/KotlinJava8Test.php +++ b/tests/KotlinJava8Test.php @@ -4,11 +4,16 @@ class KotlinJava8Test extends Base { + protected string $sdkName = 'kotlin'; + protected string $sdkPlatform = 'server'; + protected string $sdkLanguage = 'kotlin'; + protected string $version = '0.0.1'; + protected string $language = 'kotlin'; protected string $class = 'Appwrite\SDK\Language\Kotlin'; protected array $build = [ 'mkdir -p tests/sdks/kotlin/src/test/kotlin', - 'cp tests/languages/kotlin/ServiceTest.kt tests/sdks/kotlin/src/test/kotlin/ServiceTest.kt', + 'cp tests/languages/kotlin/Tests.kt tests/sdks/kotlin/src/test/kotlin/Tests.kt', 'chmod +x tests/sdks/kotlin/gradlew', ]; protected string $command = @@ -19,6 +24,11 @@ class KotlinJava8Test extends Base ...Base::BAR_RESPONSES, ...Base::GENERAL_RESPONSES, ...Base::LARGE_FILE_RESPONSES, - ...Base::EXCEPTION_RESPONSES + ...Base::LARGE_FILE_RESPONSES, + ...Base::LARGE_FILE_RESPONSES, + ...Base::EXCEPTION_RESPONSES, + ...Base::QUERY_HELPER_RESPONSES, + ...Base::PERMISSION_HELPER_RESPONSES, + ...Base::ID_HELPER_RESPONSES ]; } diff --git a/tests/Node12Test.php b/tests/Node12Test.php index d7d72158bb..d60777322a 100644 --- a/tests/Node12Test.php +++ b/tests/Node12Test.php @@ -4,7 +4,13 @@ class Node12Test extends Base { + protected string $sdkName = 'node.js'; + protected string $sdkPlatform = 'server'; + protected string $sdkLanguage = 'nodejs'; + protected string $version = '0.0.1'; + protected string $language = 'node'; + protected string $class = 'Appwrite\SDK\Language\Node'; protected array $build = [ 'docker run --rm -v $(pwd):/app -w /app/tests/sdks/node node:12-alpine npm install', @@ -18,5 +24,8 @@ class Node12Test extends Base ...Base::GENERAL_RESPONSES, ...Base::LARGE_FILE_RESPONSES, ...Base::EXCEPTION_RESPONSES, + ...Base::QUERY_HELPER_RESPONSES, + ...Base::PERMISSION_HELPER_RESPONSES, + ...Base::ID_HELPER_RESPONSES ]; } diff --git a/tests/Node14Test.php b/tests/Node14Test.php index 80b6ce7eb6..fdacb50af2 100644 --- a/tests/Node14Test.php +++ b/tests/Node14Test.php @@ -4,6 +4,11 @@ class Node14Test extends Base { + protected string $sdkName = 'node.js'; + protected string $sdkPlatform = 'server'; + protected string $sdkLanguage = 'nodejs'; + protected string $version = '0.0.1'; + protected string $language = 'node'; protected string $class = 'Appwrite\SDK\Language\Node'; protected array $build = [ @@ -18,5 +23,8 @@ class Node14Test extends Base ...Base::GENERAL_RESPONSES, ...Base::LARGE_FILE_RESPONSES, ...Base::EXCEPTION_RESPONSES, + ...Base::QUERY_HELPER_RESPONSES, + ...Base::PERMISSION_HELPER_RESPONSES, + ...Base::ID_HELPER_RESPONSES ]; } diff --git a/tests/Node16Test.php b/tests/Node16Test.php index 7edda1f12c..c05cd72496 100644 --- a/tests/Node16Test.php +++ b/tests/Node16Test.php @@ -4,6 +4,11 @@ class Node16Test extends Base { + protected string $sdkName = 'node.js'; + protected string $sdkPlatform = 'server'; + protected string $sdkLanguage = 'nodejs'; + protected string $version = '0.0.1'; + protected string $language = 'node'; protected string $class = 'Appwrite\SDK\Language\Node'; protected array $build = [ @@ -18,5 +23,8 @@ class Node16Test extends Base ...Base::GENERAL_RESPONSES, ...Base::LARGE_FILE_RESPONSES, ...Base::EXCEPTION_RESPONSES, + ...Base::QUERY_HELPER_RESPONSES, + ...Base::PERMISSION_HELPER_RESPONSES, + ...Base::ID_HELPER_RESPONSES ]; } diff --git a/tests/PHP74Test.php b/tests/PHP74Test.php index 9b1946f650..bbd296b429 100644 --- a/tests/PHP74Test.php +++ b/tests/PHP74Test.php @@ -4,6 +4,11 @@ class PHP74Test extends Base { + protected string $sdkName = 'php'; + protected string $sdkPlatform = 'server'; + protected string $sdkLanguage = 'php'; + protected string $version = '0.0.1'; + protected string $language = 'php'; protected string $class = 'Appwrite\SDK\Language\PHP'; protected array $build = []; @@ -15,6 +20,11 @@ class PHP74Test extends Base ...Base::BAR_RESPONSES, ...Base::GENERAL_RESPONSES, ...Base::LARGE_FILE_RESPONSES, + ...Base::LARGE_FILE_RESPONSES, + ...Base::LARGE_FILE_RESPONSES, ...Base::EXCEPTION_RESPONSES, + ...Base::QUERY_HELPER_RESPONSES, + ...Base::PERMISSION_HELPER_RESPONSES, + ...Base::ID_HELPER_RESPONSES ]; } diff --git a/tests/PHP80Test.php b/tests/PHP80Test.php index bbdf09e4e6..32a0a1c765 100644 --- a/tests/PHP80Test.php +++ b/tests/PHP80Test.php @@ -4,6 +4,11 @@ class PHP80Test extends Base { + protected string $sdkName = 'php'; + protected string $sdkPlatform = 'server'; + protected string $sdkLanguage = 'php'; + protected string $version = '0.0.1'; + protected string $language = 'php'; protected string $class = 'Appwrite\SDK\Language\PHP'; protected array $build = []; @@ -15,6 +20,11 @@ class PHP80Test extends Base ...Base::BAR_RESPONSES, ...Base::GENERAL_RESPONSES, ...Base::LARGE_FILE_RESPONSES, + ...Base::LARGE_FILE_RESPONSES, + ...Base::LARGE_FILE_RESPONSES, ...Base::EXCEPTION_RESPONSES, + ...Base::QUERY_HELPER_RESPONSES, + ...Base::PERMISSION_HELPER_RESPONSES, + ...Base::ID_HELPER_RESPONSES ]; } diff --git a/tests/Python310Test.php b/tests/Python310Test.php index e0dd6f4388..a8c5f2cef9 100644 --- a/tests/Python310Test.php +++ b/tests/Python310Test.php @@ -4,6 +4,11 @@ class Python310Test extends Base { + protected string $sdkName = 'python'; + protected string $sdkPlatform = 'server'; + protected string $sdkLanguage = 'python'; + protected string $version = '0.0.1'; + protected string $language = 'python'; protected string $class = 'Appwrite\SDK\Language\Python'; protected array $build = [ @@ -19,6 +24,11 @@ class Python310Test extends Base ...Base::BAR_RESPONSES, ...Base::GENERAL_RESPONSES, ...Base::LARGE_FILE_RESPONSES, + ...Base::LARGE_FILE_RESPONSES, + ...Base::LARGE_FILE_RESPONSES, ...Base::EXCEPTION_RESPONSES, + ...Base::QUERY_HELPER_RESPONSES, + ...Base::PERMISSION_HELPER_RESPONSES, + ...Base::ID_HELPER_RESPONSES ]; } diff --git a/tests/Python38Test.php b/tests/Python38Test.php index 65a1ba1260..0fc8362243 100644 --- a/tests/Python38Test.php +++ b/tests/Python38Test.php @@ -4,6 +4,11 @@ class Python38Test extends Base { + protected string $sdkName = 'python'; + protected string $sdkPlatform = 'server'; + protected string $sdkLanguage = 'python'; + protected string $version = '0.0.1'; + protected string $language = 'python'; protected string $class = 'Appwrite\SDK\Language\Python'; protected array $build = [ @@ -19,6 +24,11 @@ class Python38Test extends Base ...Base::BAR_RESPONSES, ...Base::GENERAL_RESPONSES, ...Base::LARGE_FILE_RESPONSES, + ...Base::LARGE_FILE_RESPONSES, + ...Base::LARGE_FILE_RESPONSES, ...Base::EXCEPTION_RESPONSES, + ...Base::QUERY_HELPER_RESPONSES, + ...Base::PERMISSION_HELPER_RESPONSES, + ...Base::ID_HELPER_RESPONSES ]; } diff --git a/tests/Python39Test.php b/tests/Python39Test.php index 7cf520b05d..5dbfe4fcf8 100644 --- a/tests/Python39Test.php +++ b/tests/Python39Test.php @@ -4,6 +4,11 @@ class Python39Test extends Base { + protected string $sdkName = 'python'; + protected string $sdkPlatform = 'server'; + protected string $sdkLanguage = 'python'; + protected string $version = '0.0.1'; + protected string $language = 'python'; protected string $class = 'Appwrite\SDK\Language\Python'; protected array $build = [ @@ -19,6 +24,11 @@ class Python39Test extends Base ...Base::BAR_RESPONSES, ...Base::GENERAL_RESPONSES, ...Base::LARGE_FILE_RESPONSES, + ...Base::LARGE_FILE_RESPONSES, + ...Base::LARGE_FILE_RESPONSES, ...Base::EXCEPTION_RESPONSES, + ...Base::QUERY_HELPER_RESPONSES, + ...Base::PERMISSION_HELPER_RESPONSES, + ...Base::ID_HELPER_RESPONSES ]; } diff --git a/tests/Ruby27Test.php b/tests/Ruby27Test.php index a23a27e5ad..2d5af6d0d3 100644 --- a/tests/Ruby27Test.php +++ b/tests/Ruby27Test.php @@ -4,6 +4,11 @@ class Ruby27Test extends Base { + protected string $sdkName = 'ruby'; + protected string $sdkPlatform = 'server'; + protected string $sdkLanguage = 'ruby'; + protected string $version = '0.0.1'; + protected string $language = 'ruby'; protected string $class = 'Appwrite\SDK\Language\Ruby'; protected array $build = [ @@ -17,6 +22,11 @@ class Ruby27Test extends Base ...Base::BAR_RESPONSES, ...Base::GENERAL_RESPONSES, ...Base::LARGE_FILE_RESPONSES, - ...Base::EXCEPTION_RESPONSES + ...Base::LARGE_FILE_RESPONSES, + ...Base::LARGE_FILE_RESPONSES, + ...Base::EXCEPTION_RESPONSES, + ...Base::QUERY_HELPER_RESPONSES, + ...Base::PERMISSION_HELPER_RESPONSES, + ...Base::ID_HELPER_RESPONSES ]; } diff --git a/tests/Ruby30Test.php b/tests/Ruby30Test.php index bb0c6eb8f7..1d2d4c1026 100644 --- a/tests/Ruby30Test.php +++ b/tests/Ruby30Test.php @@ -4,6 +4,11 @@ class Ruby30Test extends Base { + protected string $sdkName = 'ruby'; + protected string $sdkPlatform = 'server'; + protected string $sdkLanguage = 'ruby'; + protected string $version = '0.0.1'; + protected string $language = 'ruby'; protected string $class = 'Appwrite\SDK\Language\Ruby'; protected array $build = [ @@ -17,6 +22,11 @@ class Ruby30Test extends Base ...Base::BAR_RESPONSES, ...Base::GENERAL_RESPONSES, ...Base::LARGE_FILE_RESPONSES, - ...Base::EXCEPTION_RESPONSES + ...Base::LARGE_FILE_RESPONSES, + ...Base::LARGE_FILE_RESPONSES, + ...Base::EXCEPTION_RESPONSES, + ...Base::QUERY_HELPER_RESPONSES, + ...Base::PERMISSION_HELPER_RESPONSES, + ...Base::ID_HELPER_RESPONSES ]; } diff --git a/tests/Ruby31Test.php b/tests/Ruby31Test.php index 17c12bbf22..97039da868 100644 --- a/tests/Ruby31Test.php +++ b/tests/Ruby31Test.php @@ -4,6 +4,11 @@ class Ruby31Test extends Base { + protected string $sdkName = 'ruby'; + protected string $sdkPlatform = 'server'; + protected string $sdkLanguage = 'ruby'; + protected string $version = '0.0.1'; + protected string $language = 'ruby'; protected string $class = 'Appwrite\SDK\Language\Ruby'; protected array $build = [ @@ -17,6 +22,11 @@ class Ruby31Test extends Base ...Base::BAR_RESPONSES, ...Base::GENERAL_RESPONSES, ...Base::LARGE_FILE_RESPONSES, - ...Base::EXCEPTION_RESPONSES + ...Base::LARGE_FILE_RESPONSES, + ...Base::LARGE_FILE_RESPONSES, + ...Base::EXCEPTION_RESPONSES, + ...Base::QUERY_HELPER_RESPONSES, + ...Base::PERMISSION_HELPER_RESPONSES, + ...Base::ID_HELPER_RESPONSES ]; } diff --git a/tests/Swift55Test.php b/tests/Swift55Test.php new file mode 100644 index 0000000000..568de657aa --- /dev/null +++ b/tests/Swift55Test.php @@ -0,0 +1,33 @@ +)["result"] as String) - mock = general.upload("string", 123, listOf("string in array"), File("../../../resources/file.png")) - writeToFile(mock.result) - - mock = general.upload("string", 123, listOf("string in array"), File("../../../resources/large_file.mp4")) - writeToFile(mock.result) + try { + mock = general.upload("string", 123, listOf("string in array"), InputFile.fromPath("../../../resources/file.png")) + writeToFile(mock.result) + } catch (ex: Exception) { + writeToFile(ex.toString()) + } + try { + mock = general.upload("string", 123, listOf("string in array"), InputFile.fromPath("../../../resources/large_file.mp4")) + writeToFile(mock.result) + } catch (ex: Exception) { + writeToFile(ex.toString()) + } + try { + var bytes = File("../../../resources/file.png").readBytes() + mock = general.upload("string", 123, listOf("string in array"), InputFile.fromBytes(bytes, "file.png", "image/png")) + writeToFile(mock.result) + } catch (ex: Exception) { + writeToFile(ex.toString()) + } + try { + var bytes = File("../../../resources/large_file.mp4").readBytes() + mock = general.upload("string", 123, listOf("string in array"), InputFile.fromBytes(bytes, "large_file.mp4", "video/mp4")) + writeToFile(mock.result) + } catch (ex: Exception) { + writeToFile(ex.toString()) + } try { general.error400() @@ -133,6 +159,38 @@ class ServiceTest { writeToFile(mock.result) general.empty() + + // Query helper tests + writeToFile(Query.equal("released", listOf(true))) + writeToFile(Query.equal("title", listOf("Spiderman", "Dr. Strange"))) + writeToFile(Query.notEqual("title", "Spiderman")) + writeToFile(Query.lessThan("releasedYear", 1990)) + writeToFile(Query.greaterThan("releasedYear", 1990)) + writeToFile(Query.search("name", "john")) + writeToFile(Query.orderAsc("title")) + writeToFile(Query.orderDesc("title")) + writeToFile(Query.cursorAfter("my_movie_id")) + writeToFile(Query.cursorBefore("my_movie_id")) + writeToFile(Query.limit(50)) + writeToFile(Query.offset(20)) + + // Permission & Roles helper tests + writeToFile(Permission.read(Role.any())) + writeToFile(Permission.write(Role.user(ID.custom("userid")))) + writeToFile(Permission.create(Role.users())) + writeToFile(Permission.update(Role.guests())) + writeToFile(Permission.delete(Role.team("teamId", "owner"))) + writeToFile(Permission.delete(Role.team("teamId"))) + writeToFile(Permission.create(Role.member("memberId"))) + writeToFile(Permission.update(Role.users("verified"))) + writeToFile(Permission.update(Role.user(ID.custom("userid"), "unverified"))) + + // ID helper tests + writeToFile(ID.unique()) + writeToFile(ID.custom("custom_id")) + + mock = general.headers() + writeToFile(mock.result) } } diff --git a/tests/languages/apple/Tests.swift b/tests/languages/apple/Tests.swift new file mode 100644 index 0000000000..e15195b2f3 --- /dev/null +++ b/tests/languages/apple/Tests.swift @@ -0,0 +1,178 @@ +import XCTest +import Foundation +#if canImport(FoundationNetworking) +import FoundationNetworking +#endif +import Appwrite +import AsyncHTTPClient +import NIO + +class Tests: XCTestCase { + + override func setUp() { + super.setUp() + print("Test Started") + } + + override func tearDown() { + super.tearDown() + } + + func test() async throws { + let client = Client() + .setEndpointRealtime("ws://demo.appwrite.io/v1") + .setProject("console") + .addHeader(key: "Origin", value: "http://localhost") + .setSelfSigned() + + let foo = Foo(client) + let bar = Bar(client) + let general = General(client) + let realtime = Realtime(client) + var realtimeResponse = "Realtime failed!" + + let expectation = XCTestExpectation(description: "realtime server") + + realtime.subscribe(channels: ["tests"]) { message in + realtimeResponse = message.payload!["response"] as! String + expectation.fulfill() + } + + var mock: Mock + + // Foo Tests + mock = try await foo.get(x: "string", y: 123, z: ["string in array"]) + print(mock.result) + + mock = try await foo.post(x: "string", y: 123, z: ["string in array"]) + print(mock.result) + + mock = try await foo.put(x: "string", y: 123, z: ["string in array"]) + print(mock.result) + + mock = try await foo.patch(x: "string", y: 123, z: ["string in array"]) + print(mock.result) + + mock = try await foo.delete(x: "string", y: 123, z: ["string in array"]) + print(mock.result) + + + // Bar Tests + mock = try await bar.get(xrequired: "string", xdefault: 123, z: ["string in array"]) + print(mock.result) + + mock = try await bar.post(xrequired: "string", xdefault: 123, z: ["string in array"]) + print(mock.result) + + mock = try await bar.put(xrequired: "string", xdefault: 123, z: ["string in array"]) + print(mock.result) + + mock = try await bar.patch(xrequired: "string", xdefault: 123, z: ["string in array"]) + print(mock.result) + + mock = try await bar.delete(xrequired: "string", xdefault: 123, z: ["string in array"]) + print(mock.result) + + + // General Tests + let result = try await general.redirect() + print((result as! [String: Any])["result"] as! String) + + do { + var file = InputFile.fromPath("\(FileManager.default.currentDirectoryPath)/../../resources/file.png") + mock = try await general.upload(x: "string", y: 123, z: ["string in array"], file: file, onProgress: nil) + print(mock.result) + } catch { + print(error.localizedDescription) + } + + do { + var file = InputFile.fromPath("\(FileManager.default.currentDirectoryPath)/../../resources/large_file.mp4") + mock = try await general.upload(x: "string", y: 123, z: ["string in array"], file: file, onProgress: nil) + print(mock.result) + } catch { + print(error.localizedDescription) + } + + do { + var url = URL(fileURLWithPath: "\(FileManager.default.currentDirectoryPath)/../../resources/file.png") + var buffer = ByteBuffer(data: try! Data(contentsOf: url)) + var file = InputFile.fromBuffer(buffer, filename: "file.png", mimeType: "image/png") + mock = try await general.upload(x: "string", y: 123, z: ["string in array"], file: file, onProgress: nil) + print(mock.result) + } catch { + print(error.localizedDescription) + } + + do { + var url = URL(fileURLWithPath: "\(FileManager.default.currentDirectoryPath)/../../resources/large_file.mp4") + var buffer = ByteBuffer(data: try! Data(contentsOf: url)) + var file = InputFile.fromBuffer(buffer, filename: "large_file.mp4", mimeType: "video/mp4") + mock = try await general.upload(x: "string", y: 123, z: ["string in array"], file: file, onProgress: nil) + print(mock.result) + } catch { + print(error.localizedDescription) + } + + do { + try await general.error400() + } catch { + print(error.localizedDescription) + } + + do { + try await general.error500() + } catch { + print(error.localizedDescription) + } + + do { + try await general.error502() + } catch { + print(error.localizedDescription) + } + + wait(for: [expectation], timeout: 10.0) + print(realtimeResponse) + + mock = try await general.setCookie() + print(mock.result) + + mock = try await general.getCookie() + print(mock.result) + + try! await general.empty() + + // Query helper tests + print(Query.equal("released", value: [true])) + print(Query.equal("title", value: ["Spiderman", "Dr. Strange"])) + print(Query.notEqual("title", value: "Spiderman")) + print(Query.lessThan("releasedYear", value: 1990)) + print(Query.greaterThan("releasedYear", value: 1990)) + print(Query.search("name", value: "john")) + print(Query.orderAsc("title")) + print(Query.orderDesc("title")) + print(Query.cursorAfter("my_movie_id")) + print(Query.cursorBefore("my_movie_id")) + print(Query.limit(50)) + print(Query.offset(20)) + + // Permission & Role helper tests + print(Permission.read(Role.any())) + print(Permission.write(Role.user(ID.custom("userid")))) + print(Permission.create(Role.users())) + print(Permission.update(Role.guests())) + print(Permission.delete(Role.team("teamId", "owner"))) + print(Permission.delete(Role.team("teamId"))) + print(Permission.create(Role.member("memberId"))) + print(Permission.update(Role.users("verified"))) + print(Permission.update(Role.user(ID.custom("userid"), "unverified"))) + + // ID helper tests + print(ID.unique()) + print(ID.custom("custom_id")) + + mock = try await general.headers() + print(mock.result) + } +} diff --git a/tests/languages/cli/test.js b/tests/languages/cli/test.js index aa8fed9dba..6c814738e8 100644 --- a/tests/languages/cli/test.js +++ b/tests/languages/cli/test.js @@ -1,6 +1,6 @@ const { exec, execSync } = require('child_process'); -execSync("node index client --endpoint 'https://appwrite.io/v1' --projectId 6013fbefdfa41 --key=35y3h5h345 --selfSigned true", { stdio: 'inherit' }); +execSync("node index client --endpoint 'https://stage.appwrite.io/v1' --projectId console --key=35y3h5h345 --selfSigned true", { stdio: 'inherit' }); var output; console.log('\nTest Started'); @@ -47,4 +47,7 @@ console.log(output.split('\n')[0].split(" : ")[1]); output = execSync("node index general upload --x string --y 123 --z string in array --file ../../resources/large_file.mp4", { stdio: 'pipe'}).toString(); console.log(output.split('\n')[0].split(" : ")[1]); -execSync("node index general empty", { stdio: 'pipe'}); \ No newline at end of file +execSync("node index general empty", { stdio: 'pipe'}); + +output = execSync("node index general headers", { stdio: 'pipe'}).toString(); +console.log(output.split('\n')[0].split(" : ")[1]); \ No newline at end of file diff --git a/tests/languages/dart/tests.dart b/tests/languages/dart/tests.dart index 7aff91edbe..bdcdd2fd96 100644 --- a/tests/languages/dart/tests.dart +++ b/tests/languages/dart/tests.dart @@ -87,4 +87,36 @@ void main() async { // print(response.result); await general.empty(); + + // Query helper tests + print(Query.equal('released', [true])); + print(Query.equal('title', ['Spiderman', 'Dr. Strange'])); + print(Query.notEqual('title', 'Spiderman')); + print(Query.lessThan('releasedYear', 1990)); + print(Query.greaterThan('releasedYear', 1990)); + print(Query.search('name', 'john')); + print(Query.orderAsc("title")); + print(Query.orderDesc("title")); + print(Query.cursorAfter("my_movie_id")); + print(Query.cursorBefore("my_movie_id")); + print(Query.limit(50)); + print(Query.offset(20)); + + // Permission & Role helper tests + print(Permission.read(Role.any())); + print(Permission.write(Role.user(ID.custom('userid')))); + print(Permission.create(Role.users())); + print(Permission.update(Role.guests())); + print(Permission.delete(Role.team('teamId', 'owner'))); + print(Permission.delete(Role.team('teamId'))); + print(Permission.create(Role.member('memberId'))); + print(Permission.update(Role.users('verified'))); + print(Permission.update(Role.user(ID.custom('userid'), 'unverified'))); + + // ID helper tests + print(ID.unique()); + print(ID.custom('custom_id')); + + response = await general.headers(); + print(response.result); } diff --git a/tests/languages/deno/tests.ts b/tests/languages/deno/tests.ts index a9411ca8d7..6ee92085c3 100644 --- a/tests/languages/deno/tests.ts +++ b/tests/languages/deno/tests.ts @@ -5,6 +5,11 @@ import * as appwrite from '../../sdks/deno/mod.ts' async function start() { var response + let Permission = appwrite.Permission + let Role = appwrite.Role + let ID = appwrite.ID + let Query = appwrite.Query + // Init SDK let client = new appwrite.Client() @@ -64,11 +69,11 @@ async function start() { // @ts-ignore console.log(response.result) - response = await general.upload('string', 123, ['string in array'], './tests/resources/file.png') + response = await general.upload('string', 123, ['string in array'], appwrite.InputFile.fromPath('./tests/resources/file.png', 'file.png')) // @ts-ignore console.log(response.result) - response = await general.upload('string', 123, ['string in array'], './tests/resources/large_file.mp4') + response = await general.upload('string', 123, ['string in array'], appwrite.InputFile.fromPath('./tests/resources/file.png', 'file.png')) // @ts-ignore console.log(response.result) @@ -91,6 +96,41 @@ async function start() { } await general.empty(); + + // Query helper tests + console.log(Query.equal('released', [true])); + console.log(Query.equal('title', ['Spiderman', 'Dr. Strange'])); + console.log(Query.notEqual('title', 'Spiderman')); + console.log(Query.lessThan('releasedYear', 1990)); + console.log(Query.greaterThan('releasedYear', 1990)); + console.log(Query.search('name', "john")); + console.log(Query.orderAsc("title")); + console.log(Query.orderDesc("title")); + console.log(Query.cursorAfter("my_movie_id")); + console.log(Query.cursorBefore("my_movie_id")); + console.log(Query.limit(50)); + console.log(Query.offset(20)); + + // Permission & Role helper tests + console.log(Permission.read(Role.any())); + console.log(Permission.write(Role.user(ID.custom('userid')))); + console.log(Permission.create(Role.users())); + console.log(Permission.update(Role.guests())); + console.log(Permission.delete(Role.team('teamId', 'owner'))); + console.log(Permission.delete(Role.team('teamId'))); + console.log(Permission.create(Role.member('memberId'))); + console.log(Permission.update(Role.users('verified'))); + console.log(Permission.update(Role.user(ID.custom('userid'), 'unverified'))); + + // ID helper tests + console.log(ID.unique()); + console.log(ID.custom('custom_id')); + + response = await general.headers() + // @ts-ignore + console.log(response.result) } -start() +start().catch((err) => { + console.error(err); +}); diff --git a/tests/languages/dotnet/tests.ps1 b/tests/languages/dotnet/tests.ps1 index bc4dc70560..bf8b5c8089 100644 --- a/tests/languages/dotnet/tests.ps1 +++ b/tests/languages/dotnet/tests.ps1 @@ -90,4 +90,7 @@ try { $response.GetResult() } catch [Appwrite.AppwriteException] { Write-Host $_.Exception.Message -} \ No newline at end of file +} + +$response = $general.headers() | Await-Task +Print-Response $response.GetResult() \ No newline at end of file diff --git a/tests/languages/flutter/tests.dart b/tests/languages/flutter/tests.dart index b03b3bc585..224c963b51 100644 --- a/tests/languages/flutter/tests.dart +++ b/tests/languages/flutter/tests.dart @@ -15,7 +15,7 @@ void main() async { "wss://demo.appwrite.io/v1"); // change this later to appwrite.io Realtime realtime = Realtime(client); - final rtsub = realtime.subscribe(["tests"]); + // final rtsub = realtime.subscribe(["tests"]); await Future.delayed(Duration(seconds: 5)); client.addHeader('Origin', 'http://localhost'); @@ -93,10 +93,10 @@ void main() async { print(e.message); } - rtsub.stream.listen((message) { - print(message.payload["response"]); - rtsub.close(); - }); + // rtsub.stream.listen((message) { + // print(message.payload["response"]); + // rtsub.close(); + // }); await Future.delayed(Duration(seconds: 5)); @@ -107,4 +107,36 @@ void main() async { print(response.result); await general.empty(); + + // Query helper tests + print(Query.equal('released', [true])); + print(Query.equal('title', ['Spiderman', 'Dr. Strange'])); + print(Query.notEqual('title', 'Spiderman')); + print(Query.lessThan('releasedYear', 1990)); + print(Query.greaterThan('releasedYear', 1990)); + print(Query.search('name', 'john')); + print(Query.orderAsc("title")); + print(Query.orderDesc("title")); + print(Query.cursorAfter("my_movie_id")); + print(Query.cursorBefore("my_movie_id")); + print(Query.limit(50)); + print(Query.offset(20)); + + // Permission & Role helper tests + print(Permission.read(Role.any())); + print(Permission.write(Role.user(ID.custom('userid')))); + print(Permission.create(Role.users())); + print(Permission.update(Role.guests())); + print(Permission.delete(Role.team('teamId', 'owner'))); + print(Permission.delete(Role.team('teamId'))); + print(Permission.create(Role.member('memberId'))); + print(Permission.update(Role.users('verified'))); + print(Permission.update(Role.user(ID.custom('userid'), 'unverified'))); + + // ID helper tests + print(ID.unique()); + print(ID.custom('custom_id')); + + response = await general.headers(); + print(response.result); } diff --git a/tests/languages/go/tests.go b/tests/languages/go/tests.go index d283485426..ecf818614c 100644 --- a/tests/languages/go/tests.go +++ b/tests/languages/go/tests.go @@ -16,7 +16,6 @@ func main() { if err != nil { panic(err) } - client.SetEndpoint("https://appwrite.io/v1") client.AddHeader("Origin", "http://localhost") fmt.Print("\n\nTest Started\n") testFooService(client, stringInArray) @@ -120,6 +119,12 @@ func testGeneralService(client appwrite.Client, stringInArray []interface{}) { } general.Empty() + + response, err = general.Headers() + if err != nil { + fmt.Printf("general.Headers => error %v", err) + } + fmt.Printf("%s\n", response.Result) } func testGeneralUpload(client appwrite.Client, stringInArray []interface{}) { diff --git a/tests/languages/kotlin/ServiceTest.kt b/tests/languages/kotlin/Tests.kt similarity index 50% rename from tests/languages/kotlin/ServiceTest.kt rename to tests/languages/kotlin/Tests.kt index dd39b397fa..132cb77c1c 100644 --- a/tests/languages/kotlin/ServiceTest.kt +++ b/tests/languages/kotlin/Tests.kt @@ -1,11 +1,16 @@ package io.appwrite import com.google.gson.Gson +import io.appwrite.Permission +import io.appwrite.Role +import io.appwrite.ID +import io.appwrite.Query import io.appwrite.exceptions.AppwriteException import io.appwrite.extensions.fromJson import io.appwrite.extensions.toJson -import io.appwrite.models.Mock import io.appwrite.models.Error +import io.appwrite.models.InputFile +import io.appwrite.models.Mock import io.appwrite.services.Bar import io.appwrite.services.Foo import io.appwrite.services.General @@ -68,11 +73,32 @@ class ServiceTest { val result = general.redirect() writeToFile((result as Map)["result"] as String) - mock = general.upload("string", 123, listOf("string in array"), File("../../resources/file.png")) - writeToFile(mock.result) - - mock = general.upload("string", 123, listOf("string in array"), File("../../resources/large_file.mp4")) - writeToFile(mock.result) + try { + mock = general.upload("string", 123, listOf("string in array"), InputFile.fromPath("../../resources/file.png")) + writeToFile(mock.result) + } catch (ex: Exception) { + writeToFile(ex.toString()) + } + try { + mock = general.upload("string", 123, listOf("string in array"), InputFile.fromPath("../../resources/large_file.mp4")) + writeToFile(mock.result) + } catch (ex: Exception) { + writeToFile(ex.toString()) + } + try { + var bytes = File("../../resources/file.png").readBytes() + mock = general.upload("string", 123, listOf("string in array"), InputFile.fromBytes(bytes, "file.png", "image/png")) + writeToFile(mock.result) + } catch (ex: Exception) { + writeToFile(ex.toString()) + } + try { + var bytes = File("../../resources/large_file.mp4").readBytes() + mock = general.upload("string", 123, listOf("string in array"), InputFile.fromBytes(bytes, "large_file.mp4", "video/mp4")) + writeToFile(mock.result) + } catch (ex: Exception) { + writeToFile(ex.toString()) + } try { general.error400() @@ -93,6 +119,38 @@ class ServiceTest { } general.empty() + + // Query helper tests + writeToFile(Query.equal("released", listOf(true))) + writeToFile(Query.equal("title", listOf("Spiderman", "Dr. Strange"))) + writeToFile(Query.notEqual("title", "Spiderman")) + writeToFile(Query.lessThan("releasedYear", 1990)) + writeToFile(Query.greaterThan("releasedYear", 1990)) + writeToFile(Query.search("name", "john")) + writeToFile(Query.orderAsc("title")) + writeToFile(Query.orderDesc("title")) + writeToFile(Query.cursorAfter("my_movie_id")) + writeToFile(Query.cursorBefore("my_movie_id")) + writeToFile(Query.limit(50)) + writeToFile(Query.offset(20)) + + // Permission & Roles helper tests + writeToFile(Permission.read(Role.any())) + writeToFile(Permission.write(Role.user(ID.custom("userid")))) + writeToFile(Permission.create(Role.users())) + writeToFile(Permission.update(Role.guests())) + writeToFile(Permission.delete(Role.team("teamId", "owner"))) + writeToFile(Permission.delete(Role.team("teamId"))) + writeToFile(Permission.create(Role.member("memberId"))) + writeToFile(Permission.update(Role.users("verified"))); + writeToFile(Permission.update(Role.user(ID.custom("userid"), "unverified"))); + + // ID helper tests + writeToFile(ID.unique()) + writeToFile(ID.custom("custom_id")) + + mock = general.headers() + writeToFile(mock.result) } } diff --git a/tests/languages/node/test.js b/tests/languages/node/test.js index 623882a364..523a42fa45 100644 --- a/tests/languages/node/test.js +++ b/tests/languages/node/test.js @@ -1,10 +1,16 @@ const appwrite = require('../../sdks/node/index'); +const InputFile = require('../../sdks/node/lib/inputFile'); const fs = require('fs'); async function start() { var response; + let Permission = appwrite.Permission; + let Query = appwrite.Query; + let Role = appwrite.Role; + let ID = appwrite.ID; + // Init SDK let client = new appwrite.Client(); @@ -53,10 +59,10 @@ async function start() { response = await general.redirect(); console.log(response.result); - response = await general.upload('string', 123, ['string in array'], __dirname + '/../../resources/file.png'); + response = await general.upload('string', 123, ['string in array'], InputFile.fromPath(__dirname + '/../../resources/file.png', 'file.png')); console.log(response.result); - response = await general.upload('string', 123, ['string in array'], __dirname + '/../../resources/large_file.mp4'); + response = await general.upload('string', 123, ['string in array'], InputFile.fromPath(__dirname + '/../../resources/large_file.mp4', 'large_file.mp4')); console.log(response.result); try { @@ -78,6 +84,40 @@ async function start() { } await general.empty(); + + // Query helper tests + console.log(Query.equal('released', [true])); + console.log(Query.equal('title', ['Spiderman', 'Dr. Strange'])); + console.log(Query.notEqual('title', 'Spiderman')); + console.log(Query.lessThan('releasedYear', 1990)); + console.log(Query.greaterThan('releasedYear', 1990)); + console.log(Query.search('name', "john")); + console.log(Query.orderAsc("title")); + console.log(Query.orderDesc("title")); + console.log(Query.cursorAfter("my_movie_id")); + console.log(Query.cursorBefore("my_movie_id")); + console.log(Query.limit(50)); + console.log(Query.offset(20)); + + // Permission & Role helper tests + console.log(Permission.read(Role.any())); + console.log(Permission.write(Role.user(ID.custom('userid')))); + console.log(Permission.create(Role.users())); + console.log(Permission.update(Role.guests())); + console.log(Permission.delete(Role.team('teamId', 'owner'))); + console.log(Permission.delete(Role.team('teamId'))); + console.log(Permission.create(Role.member('memberId'))); + console.log(Permission.update(Role.users('verified'))); + console.log(Permission.update(Role.user(ID.custom('userid'), 'unverified'))); + + // ID helper tests + console.log(ID.unique()); + console.log(ID.custom('custom_id')); + + response = await general.headers(); + console.log(response.result); } -start(); \ No newline at end of file +start().catch((err) => { + console.log(err); +}); \ No newline at end of file diff --git a/tests/languages/php/test.php b/tests/languages/php/test.php index f0dea23ba4..f19a302ab3 100644 --- a/tests/languages/php/test.php +++ b/tests/languages/php/test.php @@ -2,6 +2,11 @@ include __DIR__ . '/../../sdks/php/src/Appwrite/Client.php'; include __DIR__ . '/../../sdks/php/src/Appwrite/Service.php'; +include __DIR__ . '/../../sdks/php/src/Appwrite/InputFile.php'; +include __DIR__ . '/../../sdks/php/src/Appwrite/Query.php'; +include __DIR__ . '/../../sdks/php/src/Appwrite/Permission.php'; +include __DIR__ . '/../../sdks/php/src/Appwrite/Role.php'; +include __DIR__ . '/../../sdks/php/src/Appwrite/ID.php'; include __DIR__ . '/../../sdks/php/src/Appwrite/AppwriteException.php'; include __DIR__ . '/../../sdks/php/src/Appwrite/Services/Foo.php'; include __DIR__ . '/../../sdks/php/src/Appwrite/Services/Bar.php'; @@ -9,6 +14,11 @@ use Appwrite\AppwriteException; use Appwrite\Client; +use Appwrite\InputFile; +use Appwrite\Query; +use Appwrite\Permission; +use Appwrite\Role; +use Appwrite\ID; use Appwrite\Services\Bar; use Appwrite\Services\Foo; use Appwrite\Services\General; @@ -59,10 +69,18 @@ $response = $general->redirect(); echo "{$response['result']}\n"; -$response = $general->upload('string', 123, ['string in array'], __DIR__ . '/../../resources/file.png'); +$data = file_get_contents(__DIR__ . '/../../resources/file.png'); +$response = $general->upload('string', 123, ['string in array'], InputFile::withData($data, 'image/png', 'file.png')); echo "{$response['result']}\n"; -$response = $general->upload('string', 123, ['string in array'], __DIR__ . '/../../resources/large_file.mp4'); +$data = file_get_contents(__DIR__ . '/../../resources/large_file.mp4'); +$response = $general->upload('string', 123, ['string in array'], InputFile::withData($data, 'video/mp4', 'large_file.mp4')); +echo "{$response['result']}\n"; + +$response = $general->upload('string', 123, ['string in array'], InputFile::withPath(__DIR__ .'/../../resources/file.png')); +echo "{$response['result']}\n"; + +$response = $general->upload('string', 123, ['string in array'], InputFile::withPath(__DIR__ .'/../../resources/large_file.mp4')); echo "{$response['result']}\n"; try { @@ -84,3 +102,35 @@ } $general->empty(); + +// Query helper tests +echo Query::equal('released', [true]) . "\n"; +echo Query::equal('title', ['Spiderman', 'Dr. Strange']) . "\n"; +echo Query::notEqual('title', 'Spiderman') . "\n"; +echo Query::lessThan('releasedYear', 1990) . "\n"; +echo Query::greaterThan('releasedYear', 1990) . "\n"; +echo Query::search('name', "john") . "\n"; +echo Query::orderAsc("title") . "\n"; +echo Query::orderDesc("title") . "\n"; +echo Query::cursorAfter("my_movie_id") . "\n"; +echo Query::cursorBefore("my_movie_id") . "\n"; +echo Query::limit(50) . "\n"; +echo Query::offset(20) . "\n"; + +// Permission & Role helper tests +echo Permission::read(Role::any()) . "\n"; +echo Permission::write(Role::user(ID::custom('userid'))) . "\n"; +echo Permission::create(Role::users()) . "\n"; +echo Permission::update(Role::guests()) . "\n"; +echo Permission::delete(Role::team('teamId', 'owner')) . "\n"; +echo Permission::delete(Role::team('teamId')) . "\n"; +echo Permission::create(Role::member('memberId')) . "\n"; +echo Permission::update(Role::users('verified')) . "\n"; +echo Permission::update(Role::user(ID::custom('userid'), 'unverified')) . "\n"; + +// ID helper tests +echo ID::unique() . "\n"; +echo ID::custom('custom_id') . "\n"; + +$response = $general->headers(); +echo "{$response['result']}\n"; diff --git a/tests/languages/python/tests.py b/tests/languages/python/tests.py index d42a9f2f61..8dbb6c8751 100644 --- a/tests/languages/python/tests.py +++ b/tests/languages/python/tests.py @@ -3,6 +3,12 @@ from appwrite.services.bar import Bar from appwrite.services.general import General from appwrite.exception import AppwriteException +from appwrite.input_file import InputFile +from appwrite.query import Query +from appwrite.permission import Permission +from appwrite.role import Role +from appwrite.id import ID + import os.path @@ -18,7 +24,7 @@ # Foo Tests -response = foo.get('string',123, ['string in array']) +response = foo.get('string', 123, ['string in array']) print(response['result']) response = foo.post('string', 123, ['string in array']) @@ -55,10 +61,18 @@ response = general.redirect() print(response['result']) -response = general.upload('string', 123, ['string in array'], './tests/resources/file.png') +response = general.upload('string', 123, ['string in array'], InputFile.from_path('./tests/resources/file.png')) +print(response['result']) + +response = general.upload('string', 123, ['string in array'], InputFile.from_path('./tests/resources/large_file.mp4')) +print(response['result']) + +data = open('./tests/resources/file.png', 'rb').read() +response = general.upload('string', 123, ['string in array'], InputFile.from_bytes(data, 'file.png', 'image/png')) print(response['result']) -response = general.upload('string', 123, ['string in array'], './tests/resources/large_file.mp4') +data = open('./tests/resources/large_file.mp4', 'rb').read() +response = general.upload('string', 123, ['string in array'], InputFile.from_bytes(data, 'large_file.mp4','video/mp4')) print(response['result']) try: @@ -76,4 +90,36 @@ except AppwriteException as e: print(e.message) -general.empty() \ No newline at end of file +general.empty() + +# Query helper tests +print(Query.equal('released', [True])) +print(Query.equal('title', ['Spiderman', 'Dr. Strange'])) +print(Query.notEqual('title', 'Spiderman')) +print(Query.lessThan('releasedYear', 1990)) +print(Query.greaterThan('releasedYear', 1990)) +print(Query.search('name', 'john')) +print(Query.orderAsc("title")) +print(Query.orderDesc("title")) +print(Query.cursorAfter("my_movie_id")) +print(Query.cursorBefore("my_movie_id")) +print(Query.limit(50)) +print(Query.offset(20)) + +# Permission & Role helper tests +print(Permission.read(Role.any())) +print(Permission.write(Role.user(ID.custom('userid')))) +print(Permission.create(Role.users())) +print(Permission.update(Role.guests())) +print(Permission.delete(Role.team('teamId', 'owner'))) +print(Permission.delete(Role.team('teamId'))) +print(Permission.create(Role.member('memberId'))) +print(Permission.update(Role.users('verified'))) +print(Permission.update(Role.user(ID.custom('userid'), 'unverified'))) + +# ID helper tests +print(ID.unique()) +print(ID.custom('custom_id')) + +response = general.headers() +print(response['result']) \ No newline at end of file diff --git a/tests/languages/ruby/tests.rb b/tests/languages/ruby/tests.rb index 4ce61537c7..f65ec7c389 100644 --- a/tests/languages/ruby/tests.rb +++ b/tests/languages/ruby/tests.rb @@ -1,11 +1,13 @@ require_relative '../../sdks/ruby/lib/appwrite' -client = Appwrite::Client.new +include Appwrite + +client = Client.new client.add_header('Origin', 'http://localhost') -foo = Appwrite::Foo.new(client) -bar = Appwrite::Bar.new(client) -general = Appwrite::General.new(client) +foo = Foo.new(client) +bar = Bar.new(client) +general = General.new(client) puts '' puts 'Test Started' @@ -49,28 +51,84 @@ response = general.redirect() puts response["result"] -response = general.upload(x: 'string', y: 123, z:['string in array'], file: './tests/resources/file.png') -puts response.result +begin + response = general.upload(x: 'string', y: 123, z:['string in array'], file: InputFile.from_path('./tests/resources/file.png')) + puts response.result +rescue => e + puts e +end -response = general.upload(x: 'string', y: 123, z:['string in array'], file: './tests/resources/large_file.mp4') -puts response.result +begin + response = general.upload(x: 'string', y: 123, z:['string in array'], file: InputFile.from_path('./tests/resources/large_file.mp4')) + puts response.result +rescue => e + puts e +end + +begin + string = IO.read('./tests/resources/file.png') + response = general.upload(x: 'string', y: 123, z:['string in array'], file: InputFile.from_string(string, filename:'file.png', mime_type: 'image/png')) + puts response.result +rescue => e + puts e +end + +begin + string = IO.read('./tests/resources/large_file.mp4') + response = general.upload(x: 'string', y: 123, z:['string in array'], file: InputFile.from_string(string, filename:'large_file.mp4', mime_type: 'video/mp4')) + puts response.result +rescue => e + puts e +end begin general.error400() -rescue Appwrite::Exception => error +rescue Exception => error puts error.message end begin general.error500() -rescue Appwrite::Exception => error +rescue Exception => error puts error.message end begin general.error502() -rescue Appwrite::Exception => error +rescue Exception => error puts error.message end -general.empty() \ No newline at end of file +general.empty() + +# Query helper tests +puts Query.equal('released', [true]) +puts Query.equal('title', ['Spiderman', 'Dr. Strange']) +puts Query.notEqual('title', 'Spiderman') +puts Query.lessThan('releasedYear', 1990) +puts Query.greaterThan('releasedYear', 1990) +puts Query.search('name', 'john') +puts Query.orderAsc("title") +puts Query.orderDesc("title") +puts Query.cursorAfter("my_movie_id") +puts Query.cursorBefore("my_movie_id") +puts Query.limit(50) +puts Query.offset(20) + +# Permission & Role helper tests +puts Permission.read(Role.any()) +puts Permission.write(Role.user(ID.custom('userid'))) +puts Permission.create(Role.users()) +puts Permission.update(Role.guests()) +puts Permission.delete(Role.team('teamId', 'owner')) +puts Permission.delete(Role.team('teamId')) +puts Permission.create(Role.member('memberId')) +puts Permission.update(Role.users('verified')) +puts Permission.update(Role.user(ID.custom('userid'), 'unverified')) + +# ID helper tests +puts ID.unique() +puts ID.custom('custom_id') + +response = general.headers() +puts response.result \ No newline at end of file diff --git a/tests/languages/swift-client/Tests.swift b/tests/languages/swift-client/Tests.swift deleted file mode 100644 index 807bc09d41..0000000000 --- a/tests/languages/swift-client/Tests.swift +++ /dev/null @@ -1,122 +0,0 @@ -import XCTest -import Foundation -#if canImport(FoundationNetworking) -import FoundationNetworking -#endif -import Appwrite -import AsyncHTTPClient -import NIO - -class Tests: XCTestCase { - - override func setUp() { - super.setUp() - print("Test Started") - } - - override func tearDown() { - super.tearDown() - } - - func test() async throws { - let client = Client() - .setEndpointRealtime("ws://demo.appwrite.io/v1") - .setProject("console") - .addHeader(key: "Origin", value: "http://localhost") - .setSelfSigned() - - let foo = Foo(client) - let bar = Bar(client) - let general = General(client) - let realtime = Realtime(client) - var realtimeResponse = "Realtime failed!" - - let expectation = XCTestExpectation(description: "realtime server") - - realtime.subscribe(channels: ["tests"]) { message in - realtimeResponse = message.payload!["response"] as! String - expectation.fulfill() - } - - var mock: Mock - - // Foo Tests - mock = try await foo.get(x: "string", y: 123, z: ["string in array"]) - print(mock.result) - - mock = try await foo.post(x: "string", y: 123, z: ["string in array"]) - print(mock.result) - - mock = try await foo.put(x: "string", y: 123, z: ["string in array"]) - print(mock.result) - - mock = try await foo.patch(x: "string", y: 123, z: ["string in array"]) - print(mock.result) - - mock = try await foo.delete(x: "string", y: 123, z: ["string in array"]) - print(mock.result) - - - // Bar Tests - mock = try await bar.get(xrequired: "string", xdefault: 123, z: ["string in array"]) - print(mock.result) - - mock = try await bar.post(xrequired: "string", xdefault: 123, z: ["string in array"]) - print(mock.result) - - mock = try await bar.put(xrequired: "string", xdefault: 123, z: ["string in array"]) - print(mock.result) - - mock = try await bar.patch(xrequired: "string", xdefault: 123, z: ["string in array"]) - print(mock.result) - - mock = try await bar.delete(xrequired: "string", xdefault: 123, z: ["string in array"]) - print(mock.result) - - - // General Tests - let result = try await general.redirect() - print((result as! [String: Any])["result"] as! String) - - var url = URL(fileURLWithPath: "\(FileManager.default.currentDirectoryPath)/../../resources/file.png") - var buffer = ByteBuffer(data: try! Data(contentsOf: url)) - var file = File(name: "file.png", buffer: buffer) - mock = try await general.upload(x: "string", y: 123, z: ["string in array"], file: file, onProgress: nil) - print(mock.result) - - url = URL(fileURLWithPath: "\(FileManager.default.currentDirectoryPath)/../../resources/large_file.mp4") - buffer = ByteBuffer(data: try! Data(contentsOf: url)) - file = File(name: "large_file.mp4", buffer: buffer) - mock = try await general.upload(x: "string", y: 123, z: ["string in array"], file: file, onProgress: nil) - print(mock.result) - - do { - try await general.error400() - } catch let error as AppwriteError { - print(error.message) - } - - do { - try await general.error500() - } catch { - print(error.localizedDescription) - } - - do { - try await general.error502() - } catch { - print(String(describing: error)) - } - - wait(for: [expectation], timeout: 10.0) - print(realtimeResponse) - - mock = try await general.setCookie() - print(mock.result) - - mock = try await general.getCookie() - print(mock.result) - - try! await general.empty() - } -} diff --git a/tests/languages/swift-server/Tests.swift b/tests/languages/swift-server/Tests.swift deleted file mode 100644 index 4b03b95ec6..0000000000 --- a/tests/languages/swift-server/Tests.swift +++ /dev/null @@ -1,103 +0,0 @@ -import XCTest -import Foundation -#if canImport(FoundationNetworking) -import FoundationNetworking -#endif -import Appwrite -import AsyncHTTPClient -import NIO - -class Tests: XCTestCase { - - override func setUp() { - super.setUp() - print("Test Started") - } - - override func tearDown() { - super.tearDown() - } - - func test() async throws { - let client = Client() - .setProject("console") - .addHeader(key: "Origin", value: "http://localhost") - .setSelfSigned() - - let foo = Foo(client) - let bar = Bar(client) - let general = General(client) - - var mock: Mock - - // Foo Tests - mock = try await foo.get(x: "string", y: 123, z: ["string in array"]) - print(mock.result) - - mock = try await foo.post(x: "string", y: 123, z: ["string in array"]) - print(mock.result) - - mock = try await foo.put(x: "string", y: 123, z: ["string in array"]) - print(mock.result) - - mock = try await foo.patch(x: "string", y: 123, z: ["string in array"]) - print(mock.result) - - mock = try await foo.delete(x: "string", y: 123, z: ["string in array"]) - print(mock.result) - - - // Bar Tests - mock = try await bar.get(xrequired: "string", xdefault: 123, z: ["string in array"]) - print(mock.result) - - mock = try await bar.post(xrequired: "string", xdefault: 123, z: ["string in array"]) - print(mock.result) - - mock = try await bar.put(xrequired: "string", xdefault: 123, z: ["string in array"]) - print(mock.result) - - mock = try await bar.patch(xrequired: "string", xdefault: 123, z: ["string in array"]) - print(mock.result) - - mock = try await bar.delete(xrequired: "string", xdefault: 123, z: ["string in array"]) - print(mock.result) - - - // General Tests - let result = try await general.redirect() - print((result as! [String: Any])["result"] as! String) - - var url = URL(fileURLWithPath: "\(FileManager.default.currentDirectoryPath)/../../resources/file.png") - var buffer = ByteBuffer(data: try! Data(contentsOf: url)) - var file = File(name: "file.png", buffer: buffer) - mock = try await general.upload(x: "string", y: 123, z: ["string in array"], file: file, onProgress: nil) - print(mock.result) - - url = URL(fileURLWithPath: "\(FileManager.default.currentDirectoryPath)/../../resources/large_file.mp4") - buffer = ByteBuffer(data: try! Data(contentsOf: url)) - file = File(name: "large_file.mp4", buffer: buffer) - mock = try await general.upload(x: "string", y: 123, z: ["string in array"], file: file, onProgress: nil) - print(mock.result) - - do { - try await general.error400() - } catch let error as AppwriteError { - print(error.message) - } - - do { - try await general.error500() - } catch { - print(error.localizedDescription) - } - - do { - try await general.error502() - } catch { - print(String(describing: error)) - } - - try! await general.empty() - } -} diff --git a/tests/languages/swift/Tests.swift b/tests/languages/swift/Tests.swift new file mode 100644 index 0000000000..226b5e3cb9 --- /dev/null +++ b/tests/languages/swift/Tests.swift @@ -0,0 +1,159 @@ +import XCTest +import Foundation +#if canImport(FoundationNetworking) +import FoundationNetworking +#endif +import Appwrite +import AsyncHTTPClient +import NIO + +class Tests: XCTestCase { + + override func setUp() { + super.setUp() + print("Test Started") + } + + override func tearDown() { + super.tearDown() + } + + func test() async throws { + let client = Client() + .setProject("console") + .addHeader(key: "Origin", value: "http://localhost") + .setSelfSigned() + + let foo = Foo(client) + let bar = Bar(client) + let general = General(client) + + var mock: Mock + + // Foo Tests + mock = try await foo.get(x: "string", y: 123, z: ["string in array"]) + print(mock.result) + + mock = try await foo.post(x: "string", y: 123, z: ["string in array"]) + print(mock.result) + + mock = try await foo.put(x: "string", y: 123, z: ["string in array"]) + print(mock.result) + + mock = try await foo.patch(x: "string", y: 123, z: ["string in array"]) + print(mock.result) + + mock = try await foo.delete(x: "string", y: 123, z: ["string in array"]) + print(mock.result) + + + // Bar Tests + mock = try await bar.get(xrequired: "string", xdefault: 123, z: ["string in array"]) + print(mock.result) + + mock = try await bar.post(xrequired: "string", xdefault: 123, z: ["string in array"]) + print(mock.result) + + mock = try await bar.put(xrequired: "string", xdefault: 123, z: ["string in array"]) + print(mock.result) + + mock = try await bar.patch(xrequired: "string", xdefault: 123, z: ["string in array"]) + print(mock.result) + + mock = try await bar.delete(xrequired: "string", xdefault: 123, z: ["string in array"]) + print(mock.result) + + + // General Tests + let result = try await general.redirect() + print((result as! [String: Any])["result"] as! String) + + do { + var file = InputFile.fromPath("\(FileManager.default.currentDirectoryPath)/../../resources/file.png") + mock = try await general.upload(x: "string", y: 123, z: ["string in array"], file: file, onProgress: nil) + print(mock.result) + } catch { + print(error.localizedDescription) + } + + do { + var file = InputFile.fromPath("\(FileManager.default.currentDirectoryPath)/../../resources/large_file.mp4") + mock = try await general.upload(x: "string", y: 123, z: ["string in array"], file: file, onProgress: nil) + print(mock.result) + } catch { + print(error.localizedDescription) + } + + do { + var url = URL(fileURLWithPath: "\(FileManager.default.currentDirectoryPath)/../../resources/file.png") + var buffer = ByteBuffer(data: try! Data(contentsOf: url)) + var file = InputFile.fromBuffer(buffer, filename: "file.png", mimeType: "image/png") + mock = try await general.upload(x: "string", y: 123, z: ["string in array"], file: file, onProgress: nil) + print(mock.result) + } catch { + print(error.localizedDescription) + } + + do { + var url = URL(fileURLWithPath: "\(FileManager.default.currentDirectoryPath)/../../resources/large_file.mp4") + var buffer = ByteBuffer(data: try! Data(contentsOf: url)) + var file = InputFile.fromBuffer(buffer, filename: "large_file.mp4", mimeType: "video/mp4") + mock = try await general.upload(x: "string", y: 123, z: ["string in array"], file: file, onProgress: nil) + print(mock.result) + } catch { + print(error.localizedDescription) + } + + do { + try await general.error400() + } catch { + print(error.localizedDescription) + } + + do { + try await general.error500() + } catch { + print(error.localizedDescription) + } + + do { + try await general.error502() + } catch { + print(error.localizedDescription) + } + + try! await general.empty() + + // Query helper tests + print(Query.equal("released", value: [true])) + print(Query.equal("title", value: ["Spiderman", "Dr. Strange"])) + print(Query.notEqual("title", value: "Spiderman")) + print(Query.lessThan("releasedYear", value: 1990)) + print(Query.greaterThan("releasedYear", value: 1990)) + print(Query.search("name", value: "john")) + print(Query.orderAsc("title")) + print(Query.orderDesc("title")) + print(Query.cursorAfter("my_movie_id")) + print(Query.cursorBefore("my_movie_id")) + print(Query.limit(50)) + print(Query.offset(20)) + + // Permission & Role helper tests + print(Permission.read(Role.any())) + print(Permission.write(Role.user(ID.custom("userid")))) + print(Permission.create(Role.users())) + print(Permission.update(Role.guests())) + print(Permission.delete(Role.team("teamId", "owner"))) + print(Permission.delete(Role.team("teamId"))) + print(Permission.create(Role.member("memberId"))) + print(Permission.update(Role.users("verified"))) + print(Permission.update(Role.user(ID.custom("userid"), "unverified"))) + + // ID helper tests + print(ID.unique()) + print(ID.custom("custom_id")) + + mock = try await general.headers() + print(mock.result) + } +} diff --git a/tests/languages/web/index.html b/tests/languages/web/index.html index f28f751aac..3d54e7f9f4 100644 --- a/tests/languages/web/index.html +++ b/tests/languages/web/index.html @@ -20,52 +20,56 @@ let response; let responseRealtime = 'Realtime failed!'; // Init SDK - let sdk = new Appwrite(); + const { Client, Foo, Bar, General, Query, Permission, Role, ID } = Appwrite; + const client = new Client(); + const foo = new Foo(client); + const bar = new Bar(client); + const general = new General(client); - sdk.setProject('console'); - sdk.setEndpointRealtime('ws://demo.appwrite.io/v1'); + client.setProject('console'); + client.setEndpointRealtime('ws://demo.appwrite.io/v1'); - sdk.subscribe('tests', event => { + client.subscribe('tests', event => { responseRealtime = event.payload.response; }); // Foo - response = await sdk.foo.get("string", 123, ["string in array"]); + response = await foo.get('string', 123, ["string in array"]); console.log(response.result); - response = await sdk.foo.post("string", 123, ["string in array"]); + response = await foo.post('string', 123, ["string in array"]); console.log(response.result); - response = await sdk.foo.put("string", 123, ["string in array"]); + response = await foo.put('string', 123, ["string in array"]); console.log(response.result); - response = await sdk.foo.patch("string", 123, ["string in array"]); + response = await foo.patch('string', 123, ["string in array"]); console.log(response.result); - response = await sdk.foo.delete("string", 123, ["string in array"]); + response = await foo.delete('string', 123, ["string in array"]); console.log(response.result); // Bar - response = await sdk.bar.get("string", 123, ["string in array"]); + response = await bar.get("string", 123, ["string in array"]); console.log(response.result); - response = await sdk.bar.post("string", 123, ["string in array"]); + response = await bar.post("string", 123, ["string in array"]); console.log(response.result); - response = await sdk.bar.put("string", 123, ["string in array"]); + response = await bar.put("string", 123, ["string in array"]); console.log(response.result); - response = await sdk.bar.patch("string", 123, ["string in array"]); + response = await bar.patch("string", 123, ["string in array"]); console.log(response.result); - response = await sdk.bar.delete("string", 123, ["string in array"]); + response = await bar.delete("string", 123, ["string in array"]); console.log(response.result); // General - response = await sdk.general.redirect(); + response = await general.redirect(); console.log(response.result); - response = await sdk.general.upload( + response = await general.upload( "string", 123, ["string in array"], @@ -73,7 +77,7 @@ ); console.log(response.result); - response = await sdk.general.upload( + response = await general.upload( "string", 123, ["string in array"], @@ -82,32 +86,66 @@ console.log(response.result); try { - response = await sdk.general.empty(); + response = await general.empty(); } catch (error) { console.log(error); } try { - response = await sdk.general.error400(); + response = await general.error400(); } catch (error) { console.log(error.message); } try { - response = await sdk.general.error500(); + response = await general.error500(); } catch (error) { console.log(error.message); } try { - response = await sdk.general.error502(); + response = await general.error502(); } catch (error) { console.log(error.message); } - await Promise.resolve(resolve=>setTimeout(() => resolve, 5000)); + const delay = ms => new Promise(res => setTimeout(res, ms)); + await delay(5000); console.log(responseRealtime) + // Query helper tests + console.log(Query.equal('released', [true])); + console.log(Query.equal('title', ['Spiderman', 'Dr. Strange'])); + console.log(Query.notEqual('title', 'Spiderman')); + console.log(Query.lessThan('releasedYear', 1990)); + console.log(Query.greaterThan('releasedYear', 1990)); + console.log(Query.search('name', "john")); + console.log(Query.orderAsc("title")); + console.log(Query.orderDesc("title")); + console.log(Query.cursorAfter("my_movie_id")); + console.log(Query.cursorBefore("my_movie_id")); + console.log(Query.limit(50)); + console.log(Query.offset(20)); + + // Permission & Role helper tests + console.log(Permission.read(Role.any())); + console.log(Permission.write(Role.user(ID.custom('userid')))); + console.log(Permission.create(Role.users())); + console.log(Permission.update(Role.guests())); + console.log(Permission.delete(Role.team('teamId', 'owner'))); + console.log(Permission.delete(Role.team('teamId'))); + console.log(Permission.create(Role.member('memberId'))); + console.log(Permission.update(Role.users('verified'))); + console.log(Permission.update(Role.user(ID.custom('userid'), 'unverified'))); + + + // ID helper tests + console.log(ID.unique()); + console.log(ID.custom('custom_id')); + + response = await general.headers(); + console.log(response.result); + }); diff --git a/tests/languages/web/node.js b/tests/languages/web/node.js index d7fe294657..d464315a60 100644 --- a/tests/languages/web/node.js +++ b/tests/languages/web/node.js @@ -1,74 +1,107 @@ -const requireAppwrite = require('./dist/cjs/sdk.js'); -const fs = require('fs'); +const { Client, Foo, Bar, General, Query, Permission, Role, ID } = require('./dist/cjs/sdk.js'); async function start() { let response; console.log('\nTest Started'); - const { Appwrite } = requireAppwrite; - const sdk = new Appwrite(); - + const client = new Client(); + const foo = new Foo(client); + const bar = new Bar(client); + const general = new General(client); // Foo - response = await sdk.foo.get('string', 123, ['string in array']); + response = await foo.get('string', 123, ['string in array']); console.log(response.result); - response = await sdk.foo.post('string', 123, ['string in array']); + response = await foo.post('string', 123, ['string in array']); console.log(response.result); - response = await sdk.foo.put('string', 123, ['string in array']); + response = await foo.put('string', 123, ['string in array']); console.log(response.result); - response = await sdk.foo.patch('string', 123, ['string in array']); + response = await foo.patch('string', 123, ['string in array']); console.log(response.result); - response = await sdk.foo.delete('string', 123, ['string in array']); + response = await foo.delete('string', 123, ['string in array']); console.log(response.result); // Bar - response = await sdk.bar.get('string', 123, ['string in array']); + response = await bar.get('string', 123, ['string in array']); console.log(response.result); - response = await sdk.bar.post('string', 123, ['string in array']); + response = await bar.post('string', 123, ['string in array']); console.log(response.result); - response = await sdk.bar.put('string', 123, ['string in array']); + response = await bar.put('string', 123, ['string in array']); console.log(response.result); - response = await sdk.bar.patch('string', 123, ['string in array']); + response = await bar.patch('string', 123, ['string in array']); console.log(response.result); - response = await sdk.bar.delete('string', 123, ['string in array']); + response = await bar.delete('string', 123, ['string in array']); console.log(response.result); // General - response = await sdk.general.redirect(); + response = await general.redirect(); console.log(response.result); console.log('POST:/v1/mock/tests/general/upload:passed'); // Skip file upload test on Node.js console.log('POST:/v1/mock/tests/general/upload:passed'); // Skip big file upload test on Node.js try { - response = await sdk.general.empty(); + response = await general.empty(); } catch (error) { console.log(error); } try { - response = await sdk.general.error400(); + response = await general.error400(); } catch(error) { console.log(error.message); } try { - response = await sdk.general.error500(); + response = await general.error500(); } catch(error) { console.log(error.message); } try { - response = await sdk.general.error502(); + response = await general.error502(); } catch (error) { console.log(error.message); } console.log('WS:/v1/realtime:passed'); // Skip realtime test on Node.js + + // Query helper tests + console.log(Query.equal('released', [true])); + console.log(Query.equal('title', ['Spiderman', 'Dr. Strange'])); + console.log(Query.notEqual('title', 'Spiderman')); + console.log(Query.lessThan('releasedYear', 1990)); + console.log(Query.greaterThan('releasedYear', 1990)); + console.log(Query.search('name', "john")); + console.log(Query.orderAsc("title")); + console.log(Query.orderDesc("title")); + console.log(Query.cursorAfter("my_movie_id")); + console.log(Query.cursorBefore("my_movie_id")); + console.log(Query.limit(50)); + console.log(Query.offset(20)); + + // Permission & Role helper tests + console.log(Permission.read(Role.any())); + console.log(Permission.write(Role.user(ID.custom('userid')))); + console.log(Permission.create(Role.users())); + console.log(Permission.update(Role.guests())); + console.log(Permission.delete(Role.team('teamId', 'owner'))); + console.log(Permission.delete(Role.team('teamId'))); + console.log(Permission.create(Role.member('memberId'))); + console.log(Permission.update(Role.users('verified'))); + console.log(Permission.update(Role.user(ID.custom('userid'), 'unverified'))); + + + // ID helper tests + console.log(ID.unique()); + console.log(ID.custom('custom_id')); + + response = await general.headers(); + console.log(response.result); } start(); \ No newline at end of file diff --git a/tests/resources/spec.json b/tests/resources/spec.json index e0ec51431b..fae575b37a 100644 --- a/tests/resources/spec.json +++ b/tests/resources/spec.json @@ -1,7 +1,7 @@ { "swagger": "2.0", "info": { - "version": "0.10.4", + "version": "0.15.3", "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", @@ -15,7 +15,7 @@ "url": "https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE" } }, - "host": "appwrite.io", + "host": "stage.appwrite.io", "basePath": "/v1", "schemes": ["https"], "consumes": ["application/json", "multipart/form-data"], @@ -28,6 +28,13 @@ "in": "header", "x-appwrite": { "demo": "5df5acd0d48c2" } }, + "Key": { + "type": "apiKey", + "name": "X-Appwrite-Key", + "description": "Your secret API key", + "in": "header", + "x-appwrite": { "demo": "919c2d18fb5d4...a2ae413da83346ad2" } + }, "JWT": { "type": "apiKey", "name": "X-Appwrite-JWT", @@ -41,6 +48,13 @@ "description": "", "in": "header", "x-appwrite": { "demo": "en" } + }, + "Mode": { + "type": "apiKey", + "name": "X-Appwrite-Mode", + "description": "", + "in": "header", + "x-appwrite": { "demo": "" } } }, "paths": { @@ -60,7 +74,7 @@ }, "x-appwrite": { "method": "get", - "weight": 187, + "weight": 232, "cookies": false, "type": "", "demo": "bar/get.md", @@ -73,7 +87,7 @@ "packaging": false, "auth": { "Project": [] } }, - "security": [{ "Project": [], "JWT": [] }], + "security": [{ "Project": [], "Key": [], "JWT": [] }], "parameters": [ { "name": "required", @@ -117,7 +131,7 @@ }, "x-appwrite": { "method": "post", - "weight": 188, + "weight": 233, "cookies": false, "type": "", "demo": "bar/post.md", @@ -130,7 +144,7 @@ "packaging": false, "auth": { "Project": [] } }, - "security": [{ "Project": [], "JWT": [] }], + "security": [{ "Project": [], "Key": [], "JWT": [] }], "parameters": [ { "name": "payload", @@ -178,7 +192,7 @@ }, "x-appwrite": { "method": "put", - "weight": 190, + "weight": 235, "cookies": false, "type": "", "demo": "bar/put.md", @@ -191,7 +205,7 @@ "packaging": false, "auth": { "Project": [] } }, - "security": [{ "Project": [], "JWT": [] }], + "security": [{ "Project": [], "Key": [], "JWT": [] }], "parameters": [ { "name": "payload", @@ -239,7 +253,7 @@ }, "x-appwrite": { "method": "patch", - "weight": 189, + "weight": 234, "cookies": false, "type": "", "demo": "bar/patch.md", @@ -252,7 +266,7 @@ "packaging": false, "auth": { "Project": [] } }, - "security": [{ "Project": [], "JWT": [] }], + "security": [{ "Project": [], "Key": [], "JWT": [] }], "parameters": [ { "name": "payload", @@ -300,7 +314,7 @@ }, "x-appwrite": { "method": "delete", - "weight": 191, + "weight": 236, "cookies": false, "type": "", "demo": "bar/delete.md", @@ -313,7 +327,7 @@ "packaging": false, "auth": { "Project": [] } }, - "security": [{ "Project": [], "JWT": [] }], + "security": [{ "Project": [], "Key": [], "JWT": [] }], "parameters": [ { "name": "payload", @@ -363,7 +377,7 @@ }, "x-appwrite": { "method": "get", - "weight": 182, + "weight": 227, "cookies": false, "type": "", "demo": "foo/get.md", @@ -376,7 +390,7 @@ "packaging": false, "auth": { "Project": [] } }, - "security": [{ "Project": [], "JWT": [] }], + "security": [{ "Project": [], "Key": [], "JWT": [] }], "parameters": [ { "name": "x", @@ -420,7 +434,7 @@ }, "x-appwrite": { "method": "post", - "weight": 183, + "weight": 228, "cookies": false, "type": "", "demo": "foo/post.md", @@ -433,7 +447,7 @@ "packaging": false, "auth": { "Project": [] } }, - "security": [{ "Project": [], "JWT": [] }], + "security": [{ "Project": [], "Key": [], "JWT": [] }], "parameters": [ { "name": "payload", @@ -481,7 +495,7 @@ }, "x-appwrite": { "method": "put", - "weight": 185, + "weight": 230, "cookies": false, "type": "", "demo": "foo/put.md", @@ -494,7 +508,7 @@ "packaging": false, "auth": { "Project": [] } }, - "security": [{ "Project": [], "JWT": [] }], + "security": [{ "Project": [], "Key": [], "JWT": [] }], "parameters": [ { "name": "payload", @@ -542,7 +556,7 @@ }, "x-appwrite": { "method": "patch", - "weight": 184, + "weight": 229, "cookies": false, "type": "", "demo": "foo/patch.md", @@ -555,7 +569,7 @@ "packaging": false, "auth": { "Project": [] } }, - "security": [{ "Project": [], "JWT": [] }], + "security": [{ "Project": [], "Key": [], "JWT": [] }], "parameters": [ { "name": "payload", @@ -603,7 +617,7 @@ }, "x-appwrite": { "method": "delete", - "weight": 186, + "weight": 231, "cookies": false, "type": "", "demo": "foo/delete.md", @@ -616,7 +630,7 @@ "packaging": false, "auth": { "Project": [] } }, - "security": [{ "Project": [], "JWT": [] }], + "security": [{ "Project": [], "Key": [], "JWT": [] }], "parameters": [ { "name": "payload", @@ -666,7 +680,7 @@ }, "x-appwrite": { "method": "error400", - "weight": 199, + "weight": 245, "cookies": false, "type": "", "demo": "general/error400.md", @@ -679,7 +693,7 @@ "packaging": false, "auth": { "Project": [] } }, - "security": [{ "Project": [], "JWT": [] }] + "security": [{ "Project": [], "Key": [], "JWT": [] }] } }, "/mock/tests/general/500-error": { @@ -698,7 +712,7 @@ }, "x-appwrite": { "method": "error500", - "weight": 200, + "weight": 246, "cookies": false, "type": "", "demo": "general/error500.md", @@ -711,7 +725,7 @@ "packaging": false, "auth": { "Project": [] } }, - "security": [{ "Project": [], "JWT": [] }] + "security": [{ "Project": [], "Key": [], "JWT": [] }] } }, "/mock/tests/general/502-error": { @@ -730,7 +744,7 @@ }, "x-appwrite": { "method": "error502", - "weight": 201, + "weight": 247, "cookies": false, "type": "", "demo": "general/error502.md", @@ -759,7 +773,7 @@ }, "x-appwrite": { "method": "download", - "weight": 192, + "weight": 237, "cookies": false, "type": "location", "demo": "general/download.md", @@ -772,7 +786,7 @@ "packaging": false, "auth": { "Project": [] } }, - "security": [{ "Project": [], "JWT": [] }] + "security": [{ "Project": [], "Key": [], "JWT": [] }] } }, "/mock/tests/general/empty": { @@ -786,7 +800,7 @@ "responses": { "204": { "description": "No content" } }, "x-appwrite": { "method": "empty", - "weight": 198, + "weight": 243, "cookies": false, "type": "", "demo": "general/empty.md", @@ -799,7 +813,7 @@ "packaging": false, "auth": { "Project": [] } }, - "security": [{ "Project": [], "JWT": [] }] + "security": [{ "Project": [], "Key": [], "JWT": [] }] } }, "/mock/tests/general/get-cookie": { @@ -818,7 +832,7 @@ }, "x-appwrite": { "method": "getCookie", - "weight": 197, + "weight": 242, "cookies": false, "type": "", "demo": "general/get-cookie.md", @@ -831,7 +845,39 @@ "packaging": false, "auth": { "Project": [] } }, - "security": [{ "Project": [], "JWT": [] }] + "security": [{ "Project": [], "Key": [], "JWT": [] }] + } + }, + "/mock/tests/general/headers": { + "get": { + "summary": "Get headers", + "operationId": "generalHeaders", + "consumes": ["application/json"], + "produces": [], + "tags": ["general"], + "description": "", + "responses": { + "200": { + "description": "Mock", + "schema": { "$ref": "#/definitions/mock" } + } + }, + "x-appwrite": { + "method": "headers", + "weight": 244, + "cookies": false, + "type": "", + "demo": "general/headers.md", + "edit": "https://github.com/appwrite/appwrite/edit/masterReturn headers from the request", + "rate-limit": 0, + "rate-time": 3600, + "rate-key": "url:{url},ip:{ip}", + "scope": "public", + "platforms": ["client", "server", "server"], + "packaging": false, + "auth": { "Project": [] } + }, + "security": [{ "Project": [], "Key": [], "JWT": [] }] } }, "/mock/tests/general/redirect": { @@ -845,7 +891,7 @@ "responses": { "301": { "description": "No content" } }, "x-appwrite": { "method": "redirect", - "weight": 194, + "weight": 239, "cookies": false, "type": "", "demo": "general/redirect.md", @@ -858,7 +904,7 @@ "packaging": false, "auth": { "Project": [] } }, - "security": [{ "Project": [], "JWT": [] }] + "security": [{ "Project": [], "Key": [], "JWT": [] }] } }, "/mock/tests/general/redirect/done": { @@ -877,7 +923,7 @@ }, "x-appwrite": { "method": "redirected", - "weight": 195, + "weight": 240, "cookies": false, "type": "", "demo": "general/redirected.md", @@ -890,7 +936,7 @@ "packaging": false, "auth": { "Project": [] } }, - "security": [{ "Project": [], "JWT": [] }] + "security": [{ "Project": [], "Key": [], "JWT": [] }] } }, "/mock/tests/general/set-cookie": { @@ -909,7 +955,7 @@ }, "x-appwrite": { "method": "setCookie", - "weight": 196, + "weight": 241, "cookies": false, "type": "", "demo": "general/set-cookie.md", @@ -922,7 +968,7 @@ "packaging": false, "auth": { "Project": [] } }, - "security": [{ "Project": [], "JWT": [] }] + "security": [{ "Project": [], "Key": [], "JWT": [] }] } }, "/mock/tests/general/upload": { @@ -941,7 +987,7 @@ }, "x-appwrite": { "method": "upload", - "weight": 193, + "weight": 238, "cookies": false, "type": "", "demo": "general/upload.md", @@ -954,7 +1000,7 @@ "packaging": false, "auth": { "Project": [] } }, - "security": [{ "Project": [], "JWT": [] }], + "security": [{ "Project": [], "Key": [], "JWT": [] }], "parameters": [ { "name": "x", @@ -995,43 +1041,53 @@ "tags": [ { "name": "account", - "description": "The Account service allows you to authenticate and manage a user account." + "description": "The Account service allows you to authenticate and manage a user account.", + "x-globalAttributes": [] }, { "name": "avatars", - "description": "The Avatars service aims to help you complete everyday tasks related to your app image, icons, and avatars." + "description": "The Avatars service aims to help you complete everyday tasks related to your app image, icons, and avatars.", + "x-globalAttributes": [] }, { - "name": "database", - "description": "The Database service allows you to create structured collections of documents, query and filter lists of documents" + "name": "databases", + "description": "The Databases service allows you to create structured collections of documents, query and filter lists of documents", + "x-globalAttributes": ["databaseId"] }, { "name": "locale", - "description": "The Locale service allows you to customize your app based on your users' location." + "description": "The Locale service allows you to customize your app based on your users' location.", + "x-globalAttributes": [] }, { "name": "health", - "description": "The Health service allows you to both validate and monitor your Appwrite server's health." + "description": "The Health service allows you to both validate and monitor your Appwrite server's health.", + "x-globalAttributes": [] }, { "name": "projects", - "description": "The Project service allows you to manage all the projects in your Appwrite server." + "description": "The Project service allows you to manage all the projects in your Appwrite server.", + "x-globalAttributes": [] }, { "name": "storage", - "description": "The Storage service allows you to manage your project files." + "description": "The Storage service allows you to manage your project files.", + "x-globalAttributes": [] }, { "name": "teams", - "description": "The Teams service allows you to group users of your project and to enable them to share read and write access to your project resources" + "description": "The Teams service allows you to group users of your project and to enable them to share read and write access to your project resources", + "x-globalAttributes": [] }, { "name": "users", - "description": "The Users service allows you to manage your project users." + "description": "The Users service allows you to manage your project users.", + "x-globalAttributes": [] }, { "name": "functions", - "description": "The Functions Service allows you view, create and manage your Cloud Functions." + "description": "The Functions Service allows you view, create and manage your Cloud Functions.", + "x-globalAttributes": [] } ], "definitions": { @@ -1054,13 +1110,18 @@ "description": "Error code.", "x-example": "404" }, + "type": { + "type": "string", + "description": "Error type. You can learn more about all the error types at https://appwrite.io/docs/error-codes#errorTypes", + "x-example": "not_found" + }, "version": { "type": "string", "description": "Server version number.", "x-example": "1.0" } }, - "required": ["message", "code", "version"] + "required": ["message", "code", "type", "version"] }, "mock": { "description": "Mock", @@ -1079,4 +1140,4 @@ "description": "Full API docs, specs and tutorials", "url": "https://appwrite.io/docs" } -} +} \ No newline at end of file