From 79c0368b58d56bdb2c8b802f305f023d41c2237e Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sat, 17 Oct 2020 20:49:09 +0300 Subject: [PATCH 001/230] First commit --- app/controllers/api/account.php | 30 +++++ composer.json | 3 +- composer.lock | 215 ++++++++++++++++++++------------ 3 files changed, 166 insertions(+), 82 deletions(-) diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index f80c09c6b9..9eaa82d5aa 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -1,5 +1,6 @@ desc('Create Account JWT') + ->groups(['api', 'account']) + ->label('scope', 'account') + ->label('sdk.platform', [APP_PLATFORM_CLIENT]) + ->label('sdk.namespace', 'account') + ->label('sdk.method', 'createJWT') + ->label('sdk.description', '/docs/references/account/create-jwt.md') + ->label('abuse-limit', 10) + ->label('abuse-key', 'url:{url},userId:{param-userId}') + ->action(function ($request, $response, $projectDB) { + /** @var Appwrite\Swoole\Request $request */ + /** @var Appwrite\Utopia\Response $response */ + /** @var Appwrite\Database\Database $projectDB */ + + // Instantiate with key, algo, maxAge and leeway. + $jwt = new JWT('secret', 'HS256', 3600, 10); + + $response->setStatusCode(Response::STATUS_CODE_CREATED); + + // $response->dynamic(new Document(['jwt' => $jwt]), Response::MODEL_SESSION); + $response->json(['jwt' => $jwt->encode([ + 'uid' => 1, + 'aud' => 'http://site.com', + 'scopes' => ['user'], + 'iss' => 'http://api.mysite.com', + ])]); + }, ['request', 'response', 'projectDB', 'webhooks', 'audits']); + App::get('/v1/account') ->desc('Get Account') ->groups(['api', 'account']) diff --git a/composer.json b/composer.json index f0ce2624cb..822258dcb3 100644 --- a/composer.json +++ b/composer.json @@ -50,7 +50,8 @@ "domnikl/statsd": "3.0.*", "influxdb/influxdb-php": "1.15.*", "bacon/bacon-qr-code": "2.0.2", - "phpmailer/phpmailer": "6.1.7" + "phpmailer/phpmailer": "6.1.7", + "adhocore/jwt": "1.1.0" }, "require-dev": { "swoole/ide-helper": "4.5.4", diff --git a/composer.lock b/composer.lock index 297b144e81..31c4df00c6 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,61 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "07a5b2d2e742e8651d58889c3253c3b5", + "content-hash": "20586cad26950d57c6fe42295d145904", "packages": [ + { + "name": "adhocore/jwt", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/adhocore/php-jwt.git", + "reference": "424a1d66b729a316dd074e6382167765b810cd3d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/adhocore/php-jwt/zipball/424a1d66b729a316dd074e6382167765b810cd3d", + "reference": "424a1d66b729a316dd074e6382167765b810cd3d", + "shasum": "" + }, + "require": { + "php": ">=7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.5 || ^7.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Ahc\\Jwt\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jitendra Adhikari", + "email": "jiten.adhikary@gmail.com" + } + ], + "description": "Ultra lightweight JSON web token (JWT) library for PHP5.5+.", + "keywords": [ + "auth", + "json-web-token", + "jwt", + "jwt-auth", + "jwt-php", + "token" + ], + "funding": [ + { + "url": "https://paypal.me/ji10", + "type": "custom" + } + ], + "time": "2020-10-09T00:34:35+00:00" + }, { "name": "appwrite/php-clamav", "version": "v1.0.1", @@ -2300,12 +2353,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "ece0c3ceee73810bd95226401bbfaea9e0f64de7" + "reference": "e33667ac376b7f4dbe97ab556f8e7c8daee383d3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ece0c3ceee73810bd95226401bbfaea9e0f64de7", - "reference": "ece0c3ceee73810bd95226401bbfaea9e0f64de7", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/e33667ac376b7f4dbe97ab556f8e7c8daee383d3", + "reference": "e33667ac376b7f4dbe97ab556f8e7c8daee383d3", "shasum": "" }, "require": { @@ -2365,7 +2418,7 @@ "type": "github" } ], - "time": "2020-10-09T14:34:55+00:00" + "time": "2020-10-15T05:14:52+00:00" }, { "name": "phpunit/php-file-iterator", @@ -2373,12 +2426,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "aa4be8575f26070b100fccb67faabb28f21f66f8" + "reference": "8a1b0bfa74eba894f241e23261febb84c7ffbd8d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/aa4be8575f26070b100fccb67faabb28f21f66f8", - "reference": "aa4be8575f26070b100fccb67faabb28f21f66f8", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/8a1b0bfa74eba894f241e23261febb84c7ffbd8d", + "reference": "8a1b0bfa74eba894f241e23261febb84c7ffbd8d", "shasum": "" }, "require": { @@ -2421,7 +2474,7 @@ "type": "github" } ], - "time": "2020-09-28T05:57:25+00:00" + "time": "2020-10-15T05:05:12+00:00" }, { "name": "phpunit/php-invoker", @@ -2429,12 +2482,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-invoker.git", - "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" + "reference": "dcc4b2e39d6cb5ba5435a0177ebe947c0c0d05ff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", - "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/dcc4b2e39d6cb5ba5435a0177ebe947c0c0d05ff", + "reference": "dcc4b2e39d6cb5ba5435a0177ebe947c0c0d05ff", "shasum": "" }, "require": { @@ -2480,7 +2533,7 @@ "type": "github" } ], - "time": "2020-09-28T05:58:55+00:00" + "time": "2020-10-15T05:05:21+00:00" }, { "name": "phpunit/php-text-template", @@ -2488,12 +2541,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "18c887016e60e52477e54534956d7b47bc52cd84" + "reference": "0b11f04dcd54d149c3904cda577ea8ef8735e377" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/18c887016e60e52477e54534956d7b47bc52cd84", - "reference": "18c887016e60e52477e54534956d7b47bc52cd84", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/0b11f04dcd54d149c3904cda577ea8ef8735e377", + "reference": "0b11f04dcd54d149c3904cda577ea8ef8735e377", "shasum": "" }, "require": { @@ -2535,7 +2588,7 @@ "type": "github" } ], - "time": "2020-09-28T06:03:05+00:00" + "time": "2020-10-15T05:06:00+00:00" }, { "name": "phpunit/php-timer", @@ -2543,12 +2596,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "c9ff14f493699e2f6adee9fd06a0245b276643b7" + "reference": "7fe57355ba7462b1cd940d93aa003660b4e6db20" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/c9ff14f493699e2f6adee9fd06a0245b276643b7", - "reference": "c9ff14f493699e2f6adee9fd06a0245b276643b7", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/7fe57355ba7462b1cd940d93aa003660b4e6db20", + "reference": "7fe57355ba7462b1cd940d93aa003660b4e6db20", "shasum": "" }, "require": { @@ -2590,7 +2643,7 @@ "type": "github" } ], - "time": "2020-09-28T06:00:25+00:00" + "time": "2020-10-15T05:05:31+00:00" }, { "name": "phpunit/phpunit", @@ -2598,12 +2651,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "8b79c2a70ae855e582cef1ca63a849fe07bdb01d" + "reference": "b5c7b8a5d87f4e8947cdaee629a4a9a93e71faf4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/8b79c2a70ae855e582cef1ca63a849fe07bdb01d", - "reference": "8b79c2a70ae855e582cef1ca63a849fe07bdb01d", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b5c7b8a5d87f4e8947cdaee629a4a9a93e71faf4", + "reference": "b5c7b8a5d87f4e8947cdaee629a4a9a93e71faf4", "shasum": "" }, "require": { @@ -2689,7 +2742,7 @@ "type": "github" } ], - "time": "2020-10-11T07:43:20+00:00" + "time": "2020-10-16T07:52:13+00:00" }, { "name": "sebastian/cli-parser", @@ -2697,12 +2750,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" + "reference": "bb13fcea306b784ef38fc1cda21c1395c233f4bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/bb13fcea306b784ef38fc1cda21c1395c233f4bc", + "reference": "bb13fcea306b784ef38fc1cda21c1395c233f4bc", "shasum": "" }, "require": { @@ -2741,7 +2794,7 @@ "type": "github" } ], - "time": "2020-09-28T06:08:49+00:00" + "time": "2020-10-15T05:19:54+00:00" }, { "name": "sebastian/code-unit", @@ -2749,12 +2802,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit.git", - "reference": "59236be62b1bb9919e6d7f60b0b832dc05cef9ab" + "reference": "46a6ff3fabc0449fa17ca3ec485c44ab792f65c1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/59236be62b1bb9919e6d7f60b0b832dc05cef9ab", - "reference": "59236be62b1bb9919e6d7f60b0b832dc05cef9ab", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/46a6ff3fabc0449fa17ca3ec485c44ab792f65c1", + "reference": "46a6ff3fabc0449fa17ca3ec485c44ab792f65c1", "shasum": "" }, "require": { @@ -2793,7 +2846,7 @@ "type": "github" } ], - "time": "2020-10-02T14:47:54+00:00" + "time": "2020-10-15T05:03:44+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -2801,12 +2854,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" + "reference": "a801a24d7681090e8334c631b99181df063ea457" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", - "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/a801a24d7681090e8334c631b99181df063ea457", + "reference": "a801a24d7681090e8334c631b99181df063ea457", "shasum": "" }, "require": { @@ -2844,7 +2897,7 @@ "type": "github" } ], - "time": "2020-09-28T05:30:19+00:00" + "time": "2020-10-15T05:03:53+00:00" }, { "name": "sebastian/comparator", @@ -2852,12 +2905,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "7a8ff306445707539c1a6397372a982a1ec55120" + "reference": "d43148f588efca5b5dd0c3d98da467f5aafdac6b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/7a8ff306445707539c1a6397372a982a1ec55120", - "reference": "7a8ff306445707539c1a6397372a982a1ec55120", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/d43148f588efca5b5dd0c3d98da467f5aafdac6b", + "reference": "d43148f588efca5b5dd0c3d98da467f5aafdac6b", "shasum": "" }, "require": { @@ -2914,7 +2967,7 @@ "type": "github" } ], - "time": "2020-09-30T06:47:25+00:00" + "time": "2020-10-15T05:04:03+00:00" }, { "name": "sebastian/complexity", @@ -2922,12 +2975,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "ba8cc2da0c0bfbc813d03b56406734030c7f1eff" + "reference": "6d4cf3e8224f1e8527ab434b4ba902978af523db" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/ba8cc2da0c0bfbc813d03b56406734030c7f1eff", - "reference": "ba8cc2da0c0bfbc813d03b56406734030c7f1eff", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/6d4cf3e8224f1e8527ab434b4ba902978af523db", + "reference": "6d4cf3e8224f1e8527ab434b4ba902978af523db", "shasum": "" }, "require": { @@ -2967,7 +3020,7 @@ "type": "github" } ], - "time": "2020-09-28T06:05:03+00:00" + "time": "2020-10-15T05:06:11+00:00" }, { "name": "sebastian/diff", @@ -2975,12 +3028,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "e3ec6059b3fe483d42fbaf1fe6eefa201f7b4a6d" + "reference": "c25d82b5b776a3ba4e3b232a8688e969477444e0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/e3ec6059b3fe483d42fbaf1fe6eefa201f7b4a6d", - "reference": "e3ec6059b3fe483d42fbaf1fe6eefa201f7b4a6d", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/c25d82b5b776a3ba4e3b232a8688e969477444e0", + "reference": "c25d82b5b776a3ba4e3b232a8688e969477444e0", "shasum": "" }, "require": { @@ -3029,7 +3082,7 @@ "type": "github" } ], - "time": "2020-10-13T11:48:30+00:00" + "time": "2020-10-15T05:04:12+00:00" }, { "name": "sebastian/environment", @@ -3037,12 +3090,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "388b6ced16caa751030f6a69e588299fa09200ac" + "reference": "40fcf803a36737ce1d2c46c489fb5d1ec2db45d4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/388b6ced16caa751030f6a69e588299fa09200ac", - "reference": "388b6ced16caa751030f6a69e588299fa09200ac", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/40fcf803a36737ce1d2c46c489fb5d1ec2db45d4", + "reference": "40fcf803a36737ce1d2c46c489fb5d1ec2db45d4", "shasum": "" }, "require": { @@ -3088,7 +3141,7 @@ "type": "github" } ], - "time": "2020-09-28T05:52:38+00:00" + "time": "2020-10-15T05:04:22+00:00" }, { "name": "sebastian/exporter", @@ -3096,12 +3149,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "d89cc98761b8cb5a1a235a6b703ae50d34080e65" + "reference": "dbdc89af25883b35be6ddd4b88a8bc5d22bb819d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/d89cc98761b8cb5a1a235a6b703ae50d34080e65", - "reference": "d89cc98761b8cb5a1a235a6b703ae50d34080e65", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/dbdc89af25883b35be6ddd4b88a8bc5d22bb819d", + "reference": "dbdc89af25883b35be6ddd4b88a8bc5d22bb819d", "shasum": "" }, "require": { @@ -3161,7 +3214,7 @@ "type": "github" } ], - "time": "2020-09-28T05:24:23+00:00" + "time": "2020-10-15T05:04:32+00:00" }, { "name": "sebastian/global-state", @@ -3169,12 +3222,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "ea779cb749a478b22a2564ac41cd7bda79c78dc7" + "reference": "3a606041b47fb201c1d62ae03078d0e8a62569a6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/ea779cb749a478b22a2564ac41cd7bda79c78dc7", - "reference": "ea779cb749a478b22a2564ac41cd7bda79c78dc7", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/3a606041b47fb201c1d62ae03078d0e8a62569a6", + "reference": "3a606041b47fb201c1d62ae03078d0e8a62569a6", "shasum": "" }, "require": { @@ -3221,7 +3274,7 @@ "type": "github" } ], - "time": "2020-09-28T05:54:06+00:00" + "time": "2020-10-15T05:04:42+00:00" }, { "name": "sebastian/lines-of-code", @@ -3229,12 +3282,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "6514b8f21906b8b46f520d1fbd17a4523fa59a54" + "reference": "5835b6f4707e022ae53a2a67420a3388b318715a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/6514b8f21906b8b46f520d1fbd17a4523fa59a54", - "reference": "6514b8f21906b8b46f520d1fbd17a4523fa59a54", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/5835b6f4707e022ae53a2a67420a3388b318715a", + "reference": "5835b6f4707e022ae53a2a67420a3388b318715a", "shasum": "" }, "require": { @@ -3274,7 +3327,7 @@ "type": "github" } ], - "time": "2020-09-28T06:07:27+00:00" + "time": "2020-10-15T05:06:21+00:00" }, { "name": "sebastian/object-enumerator", @@ -3282,12 +3335,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "f6f5957013d84725427d361507e13513702888a4" + "reference": "192362c78b33b0231e1e8841678be93ce6f31830" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/f6f5957013d84725427d361507e13513702888a4", - "reference": "f6f5957013d84725427d361507e13513702888a4", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/192362c78b33b0231e1e8841678be93ce6f31830", + "reference": "192362c78b33b0231e1e8841678be93ce6f31830", "shasum": "" }, "require": { @@ -3327,7 +3380,7 @@ "type": "github" } ], - "time": "2020-09-28T05:55:06+00:00" + "time": "2020-10-15T05:04:51+00:00" }, { "name": "sebastian/object-reflector", @@ -3335,12 +3388,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "d9d0ab3b12acb1768bc1e0a89b23c90d2043cbe5" + "reference": "da3d1ade6fef132f2486d297c35cf61e45930a0b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/d9d0ab3b12acb1768bc1e0a89b23c90d2043cbe5", - "reference": "d9d0ab3b12acb1768bc1e0a89b23c90d2043cbe5", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/da3d1ade6fef132f2486d297c35cf61e45930a0b", + "reference": "da3d1ade6fef132f2486d297c35cf61e45930a0b", "shasum": "" }, "require": { @@ -3378,7 +3431,7 @@ "type": "github" } ], - "time": "2020-09-28T05:56:16+00:00" + "time": "2020-10-15T05:05:01+00:00" }, { "name": "sebastian/recursion-context", @@ -3386,12 +3439,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "7e70f3d32a3058d4ad5226c1371f2dd4677dc073" + "reference": "3767a68ada0fc1d50b22db067cd2256b1b722faa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/7e70f3d32a3058d4ad5226c1371f2dd4677dc073", - "reference": "7e70f3d32a3058d4ad5226c1371f2dd4677dc073", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/3767a68ada0fc1d50b22db067cd2256b1b722faa", + "reference": "3767a68ada0fc1d50b22db067cd2256b1b722faa", "shasum": "" }, "require": { @@ -3437,7 +3490,7 @@ "type": "github" } ], - "time": "2020-09-28T05:27:00+00:00" + "time": "2020-10-15T05:05:41+00:00" }, { "name": "sebastian/resource-operations", @@ -3496,12 +3549,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "fa592377f3923946cb90bf1f6a71ba2e5f229909" + "reference": "5eb6a85e349cab8a411886cb52c070393d71bc7e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/fa592377f3923946cb90bf1f6a71ba2e5f229909", - "reference": "fa592377f3923946cb90bf1f6a71ba2e5f229909", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/5eb6a85e349cab8a411886cb52c070393d71bc7e", + "reference": "5eb6a85e349cab8a411886cb52c070393d71bc7e", "shasum": "" }, "require": { @@ -3540,7 +3593,7 @@ "type": "github" } ], - "time": "2020-10-06T08:41:03+00:00" + "time": "2020-10-15T05:05:50+00:00" }, { "name": "sebastian/version", From 898d89f3221899e3439074c527f32beb89935f2f Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Tue, 22 Dec 2020 20:54:30 +0530 Subject: [PATCH 002/230] feat: starter code for Response Filters --- src/Appwrite/Utopia/Response.php | 40 ++++++++++++++++++++ src/Appwrite/Utopia/Response/Filter.php | 16 ++++++++ src/Appwrite/Utopia/Response/Filters/V06.php | 14 +++++++ 3 files changed, 70 insertions(+) create mode 100644 src/Appwrite/Utopia/Response/Filter.php create mode 100644 src/Appwrite/Utopia/Response/Filters/V06.php diff --git a/src/Appwrite/Utopia/Response.php b/src/Appwrite/Utopia/Response.php index a854416c3f..70e8e46d91 100644 --- a/src/Appwrite/Utopia/Response.php +++ b/src/Appwrite/Utopia/Response.php @@ -6,6 +6,8 @@ use Exception; use Utopia\Swoole\Response as SwooleResponse; use Swoole\Http\Response as SwooleHTTPResponse; use Appwrite\Database\Document; +use Appwrite\Utopia\Response\Filter; +use Appwrite\Utopia\Response\Filter\V06; use Appwrite\Utopia\Response\Model; use Appwrite\Utopia\Response\Model\None; use Appwrite\Utopia\Response\Model\Any; @@ -112,6 +114,11 @@ class Response extends SwooleResponse const MODEL_DOMAIN = 'domain'; const MODEL_DOMAIN_LIST = 'domainList'; + /** + * @var Filter + */ + private static $filter = null; + /** * @var array */ @@ -329,4 +336,37 @@ class Response extends SwooleResponse { return $this->payload; } + + + /** + * Function to set a response filter + * + * @param $filter the response filter to set + * + * @return void + */ + public static function setFilter(Filter $filter) + { + self::$filter = $filter; + } + + /** + * Return the currently set filter + * + * @return Filter + */ + public static function getFilter(): Filter + { + return self::$filter; + } + + /** + * Check if a filter has been set + * + * @return bool + */ + public static function isFilter(): bool + { + return self::$filter != null; + } } diff --git a/src/Appwrite/Utopia/Response/Filter.php b/src/Appwrite/Utopia/Response/Filter.php new file mode 100644 index 0000000000..9391624d6e --- /dev/null +++ b/src/Appwrite/Utopia/Response/Filter.php @@ -0,0 +1,16 @@ + Date: Sat, 26 Dec 2020 16:46:43 +0530 Subject: [PATCH 003/230] feat: added function to parse user object --- src/Appwrite/Utopia/Response/Filter.php | 3 +- src/Appwrite/Utopia/Response/Filters/V06.php | 51 ++++++++++++++++++-- src/Appwrite/Utopia/Response/Model/User.php | 2 +- 3 files changed, 51 insertions(+), 5 deletions(-) diff --git a/src/Appwrite/Utopia/Response/Filter.php b/src/Appwrite/Utopia/Response/Filter.php index 9391624d6e..6974c4ba89 100644 --- a/src/Appwrite/Utopia/Response/Filter.php +++ b/src/Appwrite/Utopia/Response/Filter.php @@ -8,9 +8,10 @@ abstract class Filter { * Parse the content to another format. * * @param array $content + * @param string $model * * @return array */ - abstract function parse(array $content): array; + abstract function parse(array $content, string $model): array; } \ No newline at end of file diff --git a/src/Appwrite/Utopia/Response/Filters/V06.php b/src/Appwrite/Utopia/Response/Filters/V06.php index 389cbb3d26..5d66ad2055 100644 --- a/src/Appwrite/Utopia/Response/Filters/V06.php +++ b/src/Appwrite/Utopia/Response/Filters/V06.php @@ -2,13 +2,58 @@ namespace Appwrite\Utopia\Response\Filter; +use Appwrite\Database\Validator\Authorization; +use Appwrite\Utopia\Response; use Appwrite\Utopia\Response\Filter; +use Exception; +use Utopia\Config\Config; class V06 extends Filter { - // Convert 0.7 Data format to 0.6 format - public function parse(array $content): array { - return array(); + public function parse(array $content, string $model): array { + + $parsedResponse = array(); + + switch($model) { + case Response::MODEL_PROJECT : + $parsedResponse = $this->parseProject($content); + break; + + case Response::MODEL_USER : + $parsedResponse = $this->parseUser($content); + break; + + default: + throw new Exception('Recevied invlaid model : '.$model); + } + + return $parsedResponse; + } + + private function parseProject(array $content) + { + + } + + private function parseUser(array $content){ + $parsedContent = []; + + $parsedContent['$id'] = $content['$id']; + $parsedContent['registration'] = $content['registration']; + $parsedContent['name'] = $content['name']; + $parsedContent['email'] = $content['email']; + + foreach (Config::getParam('providers') as $key => $provider) { + if (!$provider['enabled']) { + continue; + } + $parsedContent['oauth2'.ucfirst($key)] = ''; + $parsedContent['oauth2'.ucfirst($key).'AccessToken'] = ''; + } + + $parsedContent['roles'] = Authorization::getRoles(); + + return $parsedContent; } } \ No newline at end of file diff --git a/src/Appwrite/Utopia/Response/Model/User.php b/src/Appwrite/Utopia/Response/Model/User.php index 79c34db5ef..e11d49ed8f 100644 --- a/src/Appwrite/Utopia/Response/Model/User.php +++ b/src/Appwrite/Utopia/Response/Model/User.php @@ -27,7 +27,7 @@ class User extends Model ]) ->addRule('status', [ 'type' => self::TYPE_INTEGER, - 'description' => 'User status. 0 for Unavtivated, 1 for active and 2 is blocked.', + 'description' => 'User status. 0 for Unactivated, 1 for active and 2 is blocked.', 'example' => 0, ]) ->addRule('email', [ From d78e9566124a5bad9c9da82b4f9ef74a2f8cadac Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Sat, 26 Dec 2020 16:47:33 +0530 Subject: [PATCH 004/230] feat: added function to parse user object --- src/Appwrite/Utopia/Response/Filters/V06.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Appwrite/Utopia/Response/Filters/V06.php b/src/Appwrite/Utopia/Response/Filters/V06.php index 5d66ad2055..7e2f0f579e 100644 --- a/src/Appwrite/Utopia/Response/Filters/V06.php +++ b/src/Appwrite/Utopia/Response/Filters/V06.php @@ -39,15 +39,16 @@ class V06 extends Filter { private function parseUser(array $content){ $parsedContent = []; - $parsedContent['$id'] = $content['$id']; - $parsedContent['registration'] = $content['registration']; - $parsedContent['name'] = $content['name']; - $parsedContent['email'] = $content['email']; + $parsedContent['$id'] = $content['$id'] ?? ''; + $parsedContent['registration'] = $content['registration'] ?? ''; + $parsedContent['name'] = $content['name'] ?? ''; + $parsedContent['email'] = $content['email'] ?? ''; foreach (Config::getParam('providers') as $key => $provider) { if (!$provider['enabled']) { continue; } + $parsedContent['oauth2'.ucfirst($key)] = ''; $parsedContent['oauth2'.ucfirst($key).'AccessToken'] = ''; } From a8c07c3381b89b17e91ccaf9b71d5a6010816f88 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Sat, 26 Dec 2020 16:48:00 +0530 Subject: [PATCH 005/230] feat: added function to parse user object --- src/Appwrite/Utopia/Response/Filters/V06.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Appwrite/Utopia/Response/Filters/V06.php b/src/Appwrite/Utopia/Response/Filters/V06.php index 7e2f0f579e..5166c9e6c5 100644 --- a/src/Appwrite/Utopia/Response/Filters/V06.php +++ b/src/Appwrite/Utopia/Response/Filters/V06.php @@ -38,7 +38,6 @@ class V06 extends Filter { private function parseUser(array $content){ $parsedContent = []; - $parsedContent['$id'] = $content['$id'] ?? ''; $parsedContent['registration'] = $content['registration'] ?? ''; $parsedContent['name'] = $content['name'] ?? ''; @@ -48,13 +47,12 @@ class V06 extends Filter { if (!$provider['enabled']) { continue; } - + $parsedContent['oauth2'.ucfirst($key)] = ''; $parsedContent['oauth2'.ucfirst($key).'AccessToken'] = ''; } $parsedContent['roles'] = Authorization::getRoles(); - return $parsedContent; } } \ No newline at end of file From 09f42797e32e3fb7dcc1ced469284a2a62df7545 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Sat, 26 Dec 2020 16:48:16 +0530 Subject: [PATCH 006/230] feat: added parse method for user object --- src/Appwrite/Utopia/Response/Filters/V06.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Appwrite/Utopia/Response/Filters/V06.php b/src/Appwrite/Utopia/Response/Filters/V06.php index 5166c9e6c5..e4a9d0adf5 100644 --- a/src/Appwrite/Utopia/Response/Filters/V06.php +++ b/src/Appwrite/Utopia/Response/Filters/V06.php @@ -52,7 +52,7 @@ class V06 extends Filter { $parsedContent['oauth2'.ucfirst($key).'AccessToken'] = ''; } - $parsedContent['roles'] = Authorization::getRoles(); + $parsedContent['roles'] = Authorization::getRoles() ?? []; return $parsedContent; } } \ No newline at end of file From 89f35d733fa6bfa526ab07c8b16e78f9be33196a Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Sat, 26 Dec 2020 16:56:13 +0530 Subject: [PATCH 007/230] feat: parse session object --- src/Appwrite/Utopia/Response/Filters/V06.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Appwrite/Utopia/Response/Filters/V06.php b/src/Appwrite/Utopia/Response/Filters/V06.php index e4a9d0adf5..4a6e3783fd 100644 --- a/src/Appwrite/Utopia/Response/Filters/V06.php +++ b/src/Appwrite/Utopia/Response/Filters/V06.php @@ -2,6 +2,7 @@ namespace Appwrite\Utopia\Response\Filter; +use Appwrite\Auth\Auth; use Appwrite\Database\Validator\Authorization; use Appwrite\Utopia\Response; use Appwrite\Utopia\Response\Filter; @@ -24,6 +25,10 @@ class V06 extends Filter { $parsedResponse = $this->parseUser($content); break; + case Response::MODEL_SESSION : + $parsedResponse = $this->parseSession($content); + break; + default: throw new Exception('Recevied invlaid model : '.$model); } @@ -36,6 +41,15 @@ class V06 extends Filter { } + private function parseSession(array $content) + { + $parsedContent = []; + $parsedContent['$id'] = $content['$id']; + $parsedContent['type'] = Auth::TOKEN_TYPE_LOGIN; + $parsedContent['expire'] = $content['exprire']; + return $parsedContent; + } + private function parseUser(array $content){ $parsedContent = []; $parsedContent['$id'] = $content['$id'] ?? ''; From 3a7dda5e102f390aef4753660f70ae35e071e1c1 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Sat, 26 Dec 2020 17:47:43 +0530 Subject: [PATCH 008/230] feat: parse session object --- src/Appwrite/Utopia/Response/Filters/V06.php | 55 ++++++++++++++------ 1 file changed, 38 insertions(+), 17 deletions(-) diff --git a/src/Appwrite/Utopia/Response/Filters/V06.php b/src/Appwrite/Utopia/Response/Filters/V06.php index 4a6e3783fd..019b523d9b 100644 --- a/src/Appwrite/Utopia/Response/Filters/V06.php +++ b/src/Appwrite/Utopia/Response/Filters/V06.php @@ -28,6 +28,10 @@ class V06 extends Filter { case Response::MODEL_SESSION : $parsedResponse = $this->parseSession($content); break; + + case Response::MODEL_ANY : + $parsedResponse = $content; + break; default: throw new Exception('Recevied invlaid model : '.$model); @@ -43,30 +47,47 @@ class V06 extends Filter { private function parseSession(array $content) { - $parsedContent = []; - $parsedContent['$id'] = $content['$id']; - $parsedContent['type'] = Auth::TOKEN_TYPE_LOGIN; - $parsedContent['expire'] = $content['exprire']; - return $parsedContent; + // Handle list of sessions + if (isset($content['sum'])) { + $sessions = $content['sessions']; + + $parsedResponse = []; + foreach($sessions as $session) { + + // WIP + // $parsedResponse['$id'] = $token->getId(); + // $parsedResponse['OS'] = $dd->getOs(); + // $parsedResponse['client'] = $dd->getClient(); + // $parsedResponse['device'] = $dd->getDevice(); + // $parsedResponse['brand'] = $dd->getBrand(); + // $parsedResponse['model'] = $dd->getModel(); + // $parsedResponse['ip'] = $token->getAttribute('ip', ''); + // $parsedResponse['geo'] = []; + // $parsedResponse['current'] = ($current == $token->getId()) ? true : false; + // $parsedResponse[$index]['geo']['isoCode'] = '--'; + // $parsedResponse[$index]['geo']['country'] = Locale::getText('locale.country.unknown'); + + $parsedResponse[] = $session; + } + return $parsedResponse; + } else { + // Handle single session + $content['type'] = Auth::TOKEN_TYPE_LOGIN; + return $content; + } } - private function parseUser(array $content){ - $parsedContent = []; - $parsedContent['$id'] = $content['$id'] ?? ''; - $parsedContent['registration'] = $content['registration'] ?? ''; - $parsedContent['name'] = $content['name'] ?? ''; - $parsedContent['email'] = $content['email'] ?? ''; - + private function parseUser(array $content) + { foreach (Config::getParam('providers') as $key => $provider) { if (!$provider['enabled']) { continue; } - - $parsedContent['oauth2'.ucfirst($key)] = ''; - $parsedContent['oauth2'.ucfirst($key).'AccessToken'] = ''; + $content['oauth2'.ucfirst($key)] = ''; + $content['oauth2'.ucfirst($key).'AccessToken'] = ''; } - $parsedContent['roles'] = Authorization::getRoles() ?? []; - return $parsedContent; + $content['roles'] = Authorization::getRoles() ?? []; + return $content; } } \ No newline at end of file From bed4dcddef8d3df8c4979a8d0947ee54c426f657 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Sun, 27 Dec 2020 22:01:18 +0530 Subject: [PATCH 009/230] feat: parse session object --- src/Appwrite/Utopia/Response/Filters/V06.php | 32 ++++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/Appwrite/Utopia/Response/Filters/V06.php b/src/Appwrite/Utopia/Response/Filters/V06.php index 019b523d9b..212e83c3f8 100644 --- a/src/Appwrite/Utopia/Response/Filters/V06.php +++ b/src/Appwrite/Utopia/Response/Filters/V06.php @@ -8,6 +8,7 @@ use Appwrite\Utopia\Response; use Appwrite\Utopia\Response\Filter; use Exception; use Utopia\Config\Config; +use Utopia\Locale\Locale as Locale; class V06 extends Filter { @@ -50,24 +51,23 @@ class V06 extends Filter { // Handle list of sessions if (isset($content['sum'])) { $sessions = $content['sessions']; - $parsedResponse = []; + $index = 0; foreach($sessions as $session) { - - // WIP - // $parsedResponse['$id'] = $token->getId(); - // $parsedResponse['OS'] = $dd->getOs(); - // $parsedResponse['client'] = $dd->getClient(); - // $parsedResponse['device'] = $dd->getDevice(); - // $parsedResponse['brand'] = $dd->getBrand(); - // $parsedResponse['model'] = $dd->getModel(); - // $parsedResponse['ip'] = $token->getAttribute('ip', ''); - // $parsedResponse['geo'] = []; - // $parsedResponse['current'] = ($current == $token->getId()) ? true : false; - // $parsedResponse[$index]['geo']['isoCode'] = '--'; - // $parsedResponse[$index]['geo']['country'] = Locale::getText('locale.country.unknown'); - - $parsedResponse[] = $session; + $parsedResponse[$index++] = [ + '$id' => $session['$id'], + 'OS' => $session['osName'].' '.$session['osVersion'], + 'client' => $session['clientName'].' '.$session['clientVersion'], + 'device' => $session['deviceName'], + 'brand' => $session['deviceBrand'], + 'model' => $session['deviceModel'], + 'ip' => $session['ip'], + 'current' => $session['current'], + 'geo' => [ + 'isoCode' => empty($session['countryCode']) ? '---' : $session['countryCode'] , + 'country' => empty($session['countryName'] ) ? Locale::getText('locale.country.unknown') : $session['countryName'] + ], + ]; } return $parsedResponse; } else { From 9690ce879404ecf60a3eeb2b098a7da64f3ef522 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Sun, 27 Dec 2020 23:47:26 +0530 Subject: [PATCH 010/230] feat: parse log list --- src/Appwrite/Utopia/Response/Filters/V06.php | 85 +++++++++++++------- 1 file changed, 58 insertions(+), 27 deletions(-) diff --git a/src/Appwrite/Utopia/Response/Filters/V06.php b/src/Appwrite/Utopia/Response/Filters/V06.php index 212e83c3f8..638e49948d 100644 --- a/src/Appwrite/Utopia/Response/Filters/V06.php +++ b/src/Appwrite/Utopia/Response/Filters/V06.php @@ -29,6 +29,14 @@ class V06 extends Filter { case Response::MODEL_SESSION : $parsedResponse = $this->parseSession($content); break; + + case Response::MODEL_SESSION_LIST : + $parsedResponse = $this->parseSessionList($content); + break; + + case Response::MODEL_LOG_LIST : + $parsedResponse = $this->parseLogList($content); + break; case Response::MODEL_ANY : $parsedResponse = $content; @@ -46,35 +54,58 @@ class V06 extends Filter { } - private function parseSession(array $content) + private function parseLogList(array $content) { - // Handle list of sessions - if (isset($content['sum'])) { - $sessions = $content['sessions']; - $parsedResponse = []; - $index = 0; - foreach($sessions as $session) { - $parsedResponse[$index++] = [ - '$id' => $session['$id'], - 'OS' => $session['osName'].' '.$session['osVersion'], - 'client' => $session['clientName'].' '.$session['clientVersion'], - 'device' => $session['deviceName'], - 'brand' => $session['deviceBrand'], - 'model' => $session['deviceModel'], - 'ip' => $session['ip'], - 'current' => $session['current'], - 'geo' => [ - 'isoCode' => empty($session['countryCode']) ? '---' : $session['countryCode'] , - 'country' => empty($session['countryName'] ) ? Locale::getText('locale.country.unknown') : $session['countryName'] - ], - ]; - } - return $parsedResponse; - } else { - // Handle single session - $content['type'] = Auth::TOKEN_TYPE_LOGIN; - return $content; + $logs = $content['logs']; + $parsedResponse = []; + $index = 0; + foreach($logs as $log) { + $parsedResponse[$index++] = [ + 'event' => $log['event'], + 'ip' => $log['ip'], + 'time' => strtotime($log['time']), + 'OS' => $log['osName'].' '.$log['osVersion'], + 'client' => $log['clientName'].' '.$log['clientVersion'], + 'device' => $log['deviceName'], + 'brand' => $log['deviceBrand'], + 'model' => $log['deviceModel'], + 'geo' => [ + 'isoCode' => empty($log['countryCode']) ? '---' : $log['countryCode'] , + 'country' => empty($log['countryName'] ) ? Locale::getText('locale.country.unknown') : $log['countryName'] + ] + ]; } + return $parsedResponse; + } + + private function parseSessionList(array $content) + { + $sessions = $content['sessions']; + $parsedResponse = []; + $index = 0; + foreach($sessions as $session) { + $parsedResponse[$index++] = [ + '$id' => $session['$id'], + 'OS' => $session['osName'].' '.$session['osVersion'], + 'client' => $session['clientName'].' '.$session['clientVersion'], + 'device' => $session['deviceName'], + 'brand' => $session['deviceBrand'], + 'model' => $session['deviceModel'], + 'ip' => $session['ip'], + 'current' => $session['current'], + 'geo' => [ + 'isoCode' => empty($session['countryCode']) ? '---' : $session['countryCode'] , + 'country' => empty($session['countryName'] ) ? Locale::getText('locale.country.unknown') : $session['countryName'] + ], + ]; + } + return $parsedResponse; + } + + private function parseSession(array $content) + { + $content['type'] = Auth::TOKEN_TYPE_LOGIN; + return $content; } private function parseUser(array $content) From fde5183594b46214e71a832545234878d2c6784b Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Sun, 27 Dec 2020 23:52:05 +0530 Subject: [PATCH 011/230] feat: parse token --- src/Appwrite/Utopia/Response/Filters/V06.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Appwrite/Utopia/Response/Filters/V06.php b/src/Appwrite/Utopia/Response/Filters/V06.php index 638e49948d..c1b138abe1 100644 --- a/src/Appwrite/Utopia/Response/Filters/V06.php +++ b/src/Appwrite/Utopia/Response/Filters/V06.php @@ -38,6 +38,9 @@ class V06 extends Filter { $parsedResponse = $this->parseLogList($content); break; + case Response::MODEL_TOKEN: + $parsedResponse = $this->parseToken($content); + break; case Response::MODEL_ANY : $parsedResponse = $content; break; @@ -54,6 +57,12 @@ class V06 extends Filter { } + private function parseToken(array $content) + { + $content['type'] = Auth::TOKEN_TYPE_RECOVERY; + return $content; + } + private function parseLogList(array $content) { $logs = $content['logs']; From 9177d659a1ff631a1d0f5106eac0c9f3f4f37a4b Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Mon, 28 Dec 2020 00:32:15 +0530 Subject: [PATCH 012/230] feat: parse locale --- src/Appwrite/Utopia/Response/Filters/V06.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/Appwrite/Utopia/Response/Filters/V06.php b/src/Appwrite/Utopia/Response/Filters/V06.php index c1b138abe1..f83007d9d0 100644 --- a/src/Appwrite/Utopia/Response/Filters/V06.php +++ b/src/Appwrite/Utopia/Response/Filters/V06.php @@ -41,12 +41,18 @@ class V06 extends Filter { case Response::MODEL_TOKEN: $parsedResponse = $this->parseToken($content); break; + + case Response::MODEL_LOCALE: + $parsedResponse = $this->parseLocale($content); + break; + + case Response::MODEL_ANY : $parsedResponse = $content; break; default: - throw new Exception('Recevied invlaid model : '.$model); + throw new Exception('Recevied invalid model : '.$model); } return $parsedResponse; @@ -57,6 +63,18 @@ class V06 extends Filter { } + private function parseLocale(array $content) + { + $content['ip'] = empty($content['ip']) ? '' : $content['ip']; + $content['countryCode'] = empty($content['countryCode']) ? '--' : $content['countryCode']; + $content['country'] = empty($content['country']) ? Locale::getText('locale.country.unknown') : $content['country']; + $content['continent'] = empty($content['continent']) ? Locale::getText('locale.country.unknown') : $content['continent']; + $content['continentCode'] = empty($content['continentCode']) ? '--' : $content['continentCode']; + $content['eu'] = empty($content['eu']) ? false : $content['eu']; + $content['currency'] = empty($content['currency']) ? null : $content['currency']; + return $content; + } + private function parseToken(array $content) { $content['type'] = Auth::TOKEN_TYPE_RECOVERY; From b57a2de8ee28327baf47807b029822a3b866543a Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Mon, 28 Dec 2020 12:34:33 +0530 Subject: [PATCH 013/230] feat: parse country list --- src/Appwrite/Utopia/Response/Filters/V06.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Appwrite/Utopia/Response/Filters/V06.php b/src/Appwrite/Utopia/Response/Filters/V06.php index f83007d9d0..c1641089f5 100644 --- a/src/Appwrite/Utopia/Response/Filters/V06.php +++ b/src/Appwrite/Utopia/Response/Filters/V06.php @@ -46,6 +46,9 @@ class V06 extends Filter { $parsedResponse = $this->parseLocale($content); break; + case Response::MODEL_COUNTRY_LIST: + $parsedResponse = $this->parseCountryList($content); + break; case Response::MODEL_ANY : $parsedResponse = $content; @@ -63,6 +66,17 @@ class V06 extends Filter { } + private function parseCountryList(array $content) + { + $countries = $content['country']; + $parsedResponse = []; + foreach($countries as $country) { + $parsedResponse['code'] = $country['name']; + } + + return $parsedResponse; + } + private function parseLocale(array $content) { $content['ip'] = empty($content['ip']) ? '' : $content['ip']; From d0296db6e5133bc62656090cc1ee495cf1e7305f Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Mon, 28 Dec 2020 12:41:30 +0530 Subject: [PATCH 014/230] feat: parse phone list --- src/Appwrite/Utopia/Response/Filters/V06.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/Appwrite/Utopia/Response/Filters/V06.php b/src/Appwrite/Utopia/Response/Filters/V06.php index c1641089f5..8339c8d4a6 100644 --- a/src/Appwrite/Utopia/Response/Filters/V06.php +++ b/src/Appwrite/Utopia/Response/Filters/V06.php @@ -50,6 +50,10 @@ class V06 extends Filter { $parsedResponse = $this->parseCountryList($content); break; + case Response::MODEL_PHONE_LIST: + $parsedResponse = $this->parsePhoneList($content); + break; + case Response::MODEL_ANY : $parsedResponse = $content; break; @@ -66,14 +70,25 @@ class V06 extends Filter { } + private function parsePhoneList(array $content) + { + $phones = $content['phones']; + $parsedResponse = []; + foreach($phones as $phone) { + $parsedResponse['countryCode'] = $phone['code']; + } + + return $parsedResponse; + } + private function parseCountryList(array $content) { - $countries = $content['country']; + $countries = $content['countries']; $parsedResponse = []; foreach($countries as $country) { $parsedResponse['code'] = $country['name']; } - + return $parsedResponse; } From d5c7445c8868d6aa10702930775c6f218dd2b0f0 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Mon, 28 Dec 2020 13:42:15 +0530 Subject: [PATCH 015/230] feat: parse continentlist --- src/Appwrite/Utopia/Response/Filters/V06.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/Appwrite/Utopia/Response/Filters/V06.php b/src/Appwrite/Utopia/Response/Filters/V06.php index 8339c8d4a6..7abfc9dc54 100644 --- a/src/Appwrite/Utopia/Response/Filters/V06.php +++ b/src/Appwrite/Utopia/Response/Filters/V06.php @@ -54,6 +54,10 @@ class V06 extends Filter { $parsedResponse = $this->parsePhoneList($content); break; + case Response::MODEL_CONTINENT_LIST: + $parsedResponse = $this->parseContinentList($content); + break; + case Response::MODEL_ANY : $parsedResponse = $content; break; @@ -70,6 +74,17 @@ class V06 extends Filter { } + private function parseContinentList(array $content) + { + $continents = $content['continents']; + $parsedResponse = []; + foreach($continents as $continent) { + $parsedResponse['code'] = $continent['name']; + } + + return $parsedResponse; + } + private function parsePhoneList(array $content) { $phones = $content['phones']; From 811fbd96bbc4d6bf44dea87d5b8f3be9c41aaf23 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Mon, 28 Dec 2020 13:51:58 +0530 Subject: [PATCH 016/230] feat: parse currency list --- src/Appwrite/Utopia/Response/Filters/V06.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Appwrite/Utopia/Response/Filters/V06.php b/src/Appwrite/Utopia/Response/Filters/V06.php index 7abfc9dc54..1c11393008 100644 --- a/src/Appwrite/Utopia/Response/Filters/V06.php +++ b/src/Appwrite/Utopia/Response/Filters/V06.php @@ -58,6 +58,10 @@ class V06 extends Filter { $parsedResponse = $this->parseContinentList($content); break; + case Response::MODEL_CURRENCY_LIST: + $parsedResponse = $this->parseCurrencyList($content); + break; + case Response::MODEL_ANY : $parsedResponse = $content; break; @@ -74,6 +78,12 @@ class V06 extends Filter { } + private function parseCurrencyList(array $content) + { + $content['locations'] = []; + return $content; + } + private function parseContinentList(array $content) { $continents = $content['continents']; From af774acf92d03b771fa84f116c93a486faa6d41e Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Mon, 28 Dec 2020 15:03:38 +0530 Subject: [PATCH 017/230] feat: parse users list --- src/Appwrite/Utopia/Response/Filters/V06.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Appwrite/Utopia/Response/Filters/V06.php b/src/Appwrite/Utopia/Response/Filters/V06.php index 1c11393008..e2c89c9e8a 100644 --- a/src/Appwrite/Utopia/Response/Filters/V06.php +++ b/src/Appwrite/Utopia/Response/Filters/V06.php @@ -26,6 +26,10 @@ class V06 extends Filter { $parsedResponse = $this->parseUser($content); break; + case Response::MODEL_USER_LIST: + $parsedResponse = $this->parseUserList($content); + break; + case Response::MODEL_SESSION : $parsedResponse = $this->parseSession($content); break; @@ -189,6 +193,16 @@ class V06 extends Filter { return $content; } + private function parseUserList(array $content) + { + $users = $content['users']; + $parsedResponse = []; + foreach($users as $user) { + $parsedResponse[] = $this->parseUser($user); + } + return $parsedResponse; + } + private function parseUser(array $content) { foreach (Config::getParam('providers') as $key => $provider) { From f6c140d84a126e425697548d50acbce1638862ce Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Mon, 28 Dec 2020 15:12:54 +0530 Subject: [PATCH 018/230] feat: add status field to users response --- src/Appwrite/Utopia/Response/Filters/V06.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Appwrite/Utopia/Response/Filters/V06.php b/src/Appwrite/Utopia/Response/Filters/V06.php index e2c89c9e8a..77e0bd2582 100644 --- a/src/Appwrite/Utopia/Response/Filters/V06.php +++ b/src/Appwrite/Utopia/Response/Filters/V06.php @@ -212,7 +212,7 @@ class V06 extends Filter { $content['oauth2'.ucfirst($key)] = ''; $content['oauth2'.ucfirst($key).'AccessToken'] = ''; } - + $content['status'] = empty($content['status']) ? 0 : $content['status']; $content['roles'] = Authorization::getRoles() ?? []; return $content; } From ef0f886ce6b1f05c2f8a17b1a335bdac6f49d640 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Mon, 28 Dec 2020 15:21:45 +0530 Subject: [PATCH 019/230] feat: added todos for some /users endpoints --- app/controllers/api/users.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/controllers/api/users.php b/app/controllers/api/users.php index 3b1b8bcef5..dd49e52f88 100644 --- a/app/controllers/api/users.php +++ b/app/controllers/api/users.php @@ -425,6 +425,7 @@ App::delete('/v1/users/:userId/sessions/:sessionId') } } + // TODO : Response filter implementation $response->noContent(); }, ['response', 'projectDB', 'events']); @@ -465,6 +466,7 @@ App::delete('/v1/users/:userId/sessions') ->setParam('payload', $response->output($user, Response::MODEL_USER)) ; + // TODO : Response filter implementation $response->noContent(); }, ['response', 'projectDB', 'events']); @@ -521,5 +523,6 @@ App::delete('/v1/users/:userId') ->setParam('payload', $response->output($user, Response::MODEL_USER)) ; + // TODO : Response filter implementation $response->noContent(); }, ['response', 'projectDB', 'events', 'deletes']); From 018a1e8bf54c619068b1f4845a22f144166711ca Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Mon, 28 Dec 2020 16:34:08 +0530 Subject: [PATCH 020/230] feat: parse membership --- src/Appwrite/Utopia/Response/Filters/V06.php | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/Appwrite/Utopia/Response/Filters/V06.php b/src/Appwrite/Utopia/Response/Filters/V06.php index 77e0bd2582..1396fb6c2a 100644 --- a/src/Appwrite/Utopia/Response/Filters/V06.php +++ b/src/Appwrite/Utopia/Response/Filters/V06.php @@ -18,9 +18,6 @@ class V06 extends Filter { $parsedResponse = array(); switch($model) { - case Response::MODEL_PROJECT : - $parsedResponse = $this->parseProject($content); - break; case Response::MODEL_USER : $parsedResponse = $this->parseUser($content); @@ -29,6 +26,18 @@ class V06 extends Filter { case Response::MODEL_USER_LIST: $parsedResponse = $this->parseUserList($content); break; + + case Response::MODEL_TEAM: + $parsedResponse = $content; + break; + + case Response::MODEL_TEAM_LIST: + $parsedResponse = $content['teams']; + break; + + case Response::MODEL_MEMBERSHIP: + $parsedResponse = $content; + break; case Response::MODEL_SESSION : $parsedResponse = $this->parseSession($content); @@ -77,11 +86,6 @@ class V06 extends Filter { return $parsedResponse; } - private function parseProject(array $content) - { - - } - private function parseCurrencyList(array $content) { $content['locations'] = []; From 8c4f3f7f9d092a2c4c78560c18b266ed2b843d72 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Mon, 28 Dec 2020 18:41:03 +0200 Subject: [PATCH 021/230] New JWT model --- src/Appwrite/Utopia/Response/Model/JWT.php | 45 ++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 src/Appwrite/Utopia/Response/Model/JWT.php diff --git a/src/Appwrite/Utopia/Response/Model/JWT.php b/src/Appwrite/Utopia/Response/Model/JWT.php new file mode 100644 index 0000000000..490506ff94 --- /dev/null +++ b/src/Appwrite/Utopia/Response/Model/JWT.php @@ -0,0 +1,45 @@ +addRule('$id', [ + 'type' => self::TYPE_STRING, + 'description' => 'User ID.', + 'example' => '5e5ea5c16897e', + ]) + ->addRule('name', [ + 'type' => self::TYPE_STRING, + 'description' => 'User name.', + 'example' => 'John Doe', + ]) + ; + } + + /** + * Get Name + * + * @return string + */ + public function getName():string + { + return 'JWT'; + } + + /** + * Get Collection + * + * @return string + */ + public function getType():string + { + return Response::MODEL_JWT; + } +} \ No newline at end of file From 98a7f6a1050bdb37473722b478e2300d5fd0b28a Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Mon, 28 Dec 2020 18:41:32 +0200 Subject: [PATCH 022/230] Added JWT library --- composer.json | 3 +- composer.lock | 88 +++++++++++++++++++++++++++++++-------------------- 2 files changed, 55 insertions(+), 36 deletions(-) diff --git a/composer.json b/composer.json index afefca980b..fa5b69af0a 100644 --- a/composer.json +++ b/composer.json @@ -52,7 +52,8 @@ "domnikl/statsd": "3.0.2", "influxdb/influxdb-php": "1.15.1", "phpmailer/phpmailer": "6.1.7", - "chillerlan/php-qrcode": "4.2.0" + "chillerlan/php-qrcode": "4.2.0", + "adhocore/jwt": "1.1.0" }, "require-dev": { "swoole/ide-helper": "4.5.5", diff --git a/composer.lock b/composer.lock index 73123ca30d..671c357e53 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "aa1bf812ee6a45af12cdfbbfb7229471", + "content-hash": "518aa516713cbed3cad684907d50aea1", "packages": [ { "name": "adhocore/jwt", @@ -51,6 +51,10 @@ "jwt-php", "token" ], + "support": { + "issues": "https://github.com/adhocore/php-jwt/issues", + "source": "https://github.com/adhocore/php-jwt/tree/1.1.0" + }, "funding": [ { "url": "https://paypal.me/ji10", @@ -1953,12 +1957,12 @@ "source": { "type": "git", "url": "https://github.com/composer/package-versions-deprecated.git", - "reference": "64291c788b9a18272346decf566931e33a317399" + "reference": "f921205948ab93bb19f86327c793a81edb62f236" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/64291c788b9a18272346decf566931e33a317399", - "reference": "64291c788b9a18272346decf566931e33a317399", + "url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/f921205948ab93bb19f86327c793a81edb62f236", + "reference": "f921205948ab93bb19f86327c793a81edb62f236", "shasum": "" }, "require": { @@ -2019,7 +2023,7 @@ "type": "tidelift" } ], - "time": "2020-11-12T09:39:33+00:00" + "time": "2020-12-27T20:11:05+00:00" }, { "name": "composer/semver", @@ -2376,16 +2380,16 @@ }, { "name": "matthiasmullie/minify", - "version": "1.3.64", + "version": "1.3.65", "source": { "type": "git", "url": "https://github.com/matthiasmullie/minify.git", - "reference": "38f9d58c739687e269f46c6dff4647de9e2eb855" + "reference": "227f19062451c55a797e0cc667ef983834e6580c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/matthiasmullie/minify/zipball/38f9d58c739687e269f46c6dff4647de9e2eb855", - "reference": "38f9d58c739687e269f46c6dff4647de9e2eb855", + "url": "https://api.github.com/repos/matthiasmullie/minify/zipball/227f19062451c55a797e0cc667ef983834e6580c", + "reference": "227f19062451c55a797e0cc667ef983834e6580c", "shasum": "" }, "require": { @@ -2434,9 +2438,23 @@ ], "support": { "issues": "https://github.com/matthiasmullie/minify/issues", - "source": "https://github.com/matthiasmullie/minify/tree/1.3.64" + "source": "https://github.com/matthiasmullie/minify/tree/1.3.65" }, - "time": "2020-12-23T13:37:53+00:00" + "funding": [ + { + "url": "https://github.com/[user1", + "type": "github" + }, + { + "url": "https://github.com/matthiasmullie] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g.", + "type": "github" + }, + { + "url": "https://github.com/user2", + "type": "github" + } + ], + "time": "2020-12-27T21:43:29+00:00" }, { "name": "matthiasmullie/path-converter", @@ -4552,12 +4570,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "15c96194f32e1b1aa30d1b302c71c5f83fd4dea9" + "reference": "c249efc71000d42c86d9a7558b55f409f06d93da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/15c96194f32e1b1aa30d1b302c71c5f83fd4dea9", - "reference": "15c96194f32e1b1aa30d1b302c71c5f83fd4dea9", + "url": "https://api.github.com/repos/symfony/console/zipball/c249efc71000d42c86d9a7558b55f409f06d93da", + "reference": "c249efc71000d42c86d9a7558b55f409f06d93da", "shasum": "" }, "require": { @@ -4642,7 +4660,7 @@ "type": "tidelift" } ], - "time": "2020-12-18T08:03:24+00:00" + "time": "2020-12-27T13:21:48+00:00" }, { "name": "symfony/polyfill-ctype", @@ -4650,12 +4668,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "fade6deebd931cfd7a544f68479405a6a08979a3" + "reference": "7130f348df2f842044038aaae9d6653dc9d67649" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/fade6deebd931cfd7a544f68479405a6a08979a3", - "reference": "fade6deebd931cfd7a544f68479405a6a08979a3", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/7130f348df2f842044038aaae9d6653dc9d67649", + "reference": "7130f348df2f842044038aaae9d6653dc9d67649", "shasum": "" }, "require": { @@ -4722,7 +4740,7 @@ "type": "tidelift" } ], - "time": "2020-10-26T13:35:45+00:00" + "time": "2020-12-27T09:28:48+00:00" }, { "name": "symfony/polyfill-intl-grapheme", @@ -4730,12 +4748,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "be092746c3ab9f9c62608c82e0f04687f8a879f9" + "reference": "e314d4992832c3a0a68ca731fadd959917320fda" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/be092746c3ab9f9c62608c82e0f04687f8a879f9", - "reference": "be092746c3ab9f9c62608c82e0f04687f8a879f9", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/e314d4992832c3a0a68ca731fadd959917320fda", + "reference": "e314d4992832c3a0a68ca731fadd959917320fda", "shasum": "" }, "require": { @@ -4804,7 +4822,7 @@ "type": "tidelift" } ], - "time": "2020-11-13T15:40:22+00:00" + "time": "2020-12-27T09:28:48+00:00" }, { "name": "symfony/polyfill-intl-normalizer", @@ -4812,12 +4830,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "69609f9f06790591b4b13a45ee117e7bab6395aa" + "reference": "3a79a2226897adae0cab81688fbc5144e2fc53f6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/69609f9f06790591b4b13a45ee117e7bab6395aa", - "reference": "69609f9f06790591b4b13a45ee117e7bab6395aa", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/3a79a2226897adae0cab81688fbc5144e2fc53f6", + "reference": "3a79a2226897adae0cab81688fbc5144e2fc53f6", "shasum": "" }, "require": { @@ -4889,7 +4907,7 @@ "type": "tidelift" } ], - "time": "2020-10-26T13:35:45+00:00" + "time": "2020-12-27T22:11:44+00:00" }, { "name": "symfony/polyfill-mbstring", @@ -4897,12 +4915,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "401c9d9d3400c53a8f1a39425f0543406c137a43" + "reference": "de14691dc88bbbc5535de7f0e32080977dc1d23f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/401c9d9d3400c53a8f1a39425f0543406c137a43", - "reference": "401c9d9d3400c53a8f1a39425f0543406c137a43", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/de14691dc88bbbc5535de7f0e32080977dc1d23f", + "reference": "de14691dc88bbbc5535de7f0e32080977dc1d23f", "shasum": "" }, "require": { @@ -4970,7 +4988,7 @@ "type": "tidelift" } ], - "time": "2020-10-26T13:35:45+00:00" + "time": "2020-12-27T09:28:48+00:00" }, { "name": "symfony/polyfill-php73", @@ -5058,12 +5076,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "3a11f3dfb34ad50f978cb2b8cf936933b87739aa" + "reference": "54cc82c30ba7ed02bc64f5d010488c159b5f1706" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/3a11f3dfb34ad50f978cb2b8cf936933b87739aa", - "reference": "3a11f3dfb34ad50f978cb2b8cf936933b87739aa", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/54cc82c30ba7ed02bc64f5d010488c159b5f1706", + "reference": "54cc82c30ba7ed02bc64f5d010488c159b5f1706", "shasum": "" }, "require": { @@ -5134,7 +5152,7 @@ "type": "tidelift" } ], - "time": "2020-10-26T13:35:45+00:00" + "time": "2020-12-27T09:28:48+00:00" }, { "name": "symfony/service-contracts", From 3caea2a62ca81284c90ef9b920d97dfde431e8f3 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Mon, 28 Dec 2020 18:41:38 +0200 Subject: [PATCH 023/230] New JWT model --- src/Appwrite/Utopia/Response.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Appwrite/Utopia/Response.php b/src/Appwrite/Utopia/Response.php index a854416c3f..0db6990c88 100644 --- a/src/Appwrite/Utopia/Response.php +++ b/src/Appwrite/Utopia/Response.php @@ -20,6 +20,7 @@ use Appwrite\Utopia\Response\Model\ErrorDev; use Appwrite\Utopia\Response\Model\Execution; use Appwrite\Utopia\Response\Model\File; use Appwrite\Utopia\Response\Model\Func; +use Appwrite\Utopia\Response\Model\JWT; use Appwrite\Utopia\Response\Model\Key; use Appwrite\Utopia\Response\Model\Language; use Appwrite\Utopia\Response\Model\User; @@ -64,7 +65,8 @@ class Response extends SwooleResponse const MODEL_USER_LIST = 'userList'; const MODEL_SESSION = 'session'; const MODEL_SESSION_LIST = 'sessionList'; - const MODEL_TOKEN = 'token'; // - Missing + const MODEL_TOKEN = 'token'; + const MODEL_JWT = 'jwt'; // Storage const MODEL_FILE = 'file'; @@ -161,6 +163,7 @@ class Response extends SwooleResponse ->setModel(new User()) ->setModel(new Session()) ->setModel(new Token()) + ->setModel(new JWT()) ->setModel(new Locale()) ->setModel(new File()) ->setModel(new Team()) From f1887d2d9b42cadfd5b73f7ef2e866e9deb9d295 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Mon, 28 Dec 2020 22:12:13 +0530 Subject: [PATCH 024/230] feat: parse membership list --- src/Appwrite/Utopia/Response/Filters/V06.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Appwrite/Utopia/Response/Filters/V06.php b/src/Appwrite/Utopia/Response/Filters/V06.php index 1396fb6c2a..79f1ef92fc 100644 --- a/src/Appwrite/Utopia/Response/Filters/V06.php +++ b/src/Appwrite/Utopia/Response/Filters/V06.php @@ -38,6 +38,10 @@ class V06 extends Filter { case Response::MODEL_MEMBERSHIP: $parsedResponse = $content; break; + + case Response::MODEL_MEMBERSHIP_LIST: + $parsedResponse = $content['memberships']; + break; case Response::MODEL_SESSION : $parsedResponse = $this->parseSession($content); From f6d30fa1fb793b91ebfc1b40a33d619a884b5b4c Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Mon, 28 Dec 2020 19:03:27 +0200 Subject: [PATCH 025/230] Added a new JWT endpoint --- app/controllers/api/account.php | 44 ++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index 93ba7b397b..2b36908ed9 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -648,24 +648,38 @@ App::get('/v1/account/jwt') ->label('sdk.description', '/docs/references/account/create-jwt.md') ->label('abuse-limit', 10) ->label('abuse-key', 'url:{url},userId:{param-userId}') - ->action(function ($request, $response, $projectDB) { - /** @var Appwrite\Swoole\Request $request */ + ->inject('response') + ->inject('user') + ->action(function ($response, $user) { /** @var Appwrite\Utopia\Response $response */ - /** @var Appwrite\Database\Database $projectDB */ - - // Instantiate with key, algo, maxAge and leeway. - $jwt = new JWT('secret', 'HS256', 3600, 10); + /** @var Appwrite\Database\Document $user */ + + $tokens = $user->getAttribute('tokens', []); + $session = new Document(); - $response->setStatusCode(Response::STATUS_CODE_CREATED); + foreach ($tokens as $token) { /** @var Appwrite\Database\Document $token */ + if ($token->getAttribute('secret') == Auth::hash(Auth::$secret)) { // If current session delete the cookies too + $session = $token; + } + } + + if($session->isEmpty()) { + throw new Exception('No valid session found', 401); + } - // $response->dynamic(new Document(['jwt' => $jwt]), Response::MODEL_SESSION); - $response->json(['jwt' => $jwt->encode([ - 'uid' => 1, - 'aud' => 'http://site.com', - 'scopes' => ['user'], - 'iss' => 'http://api.mysite.com', - ])]); - }, ['request', 'response', 'projectDB', 'webhooks', 'audits']); + $jwt = new JWT(App::getEnv('_APP_OPENSSL_KEY_V1'), 'HS256', 3600, 10); // Instantiate with key, algo, maxAge and leeway. + + $response + ->setStatusCode(Response::STATUS_CODE_CREATED) + ->dynamic(new Document(['jwt' => $jwt->encode([ + // 'uid' => 1, + // 'aud' => 'http://site.com', + // 'scopes' => ['user'], + // 'iss' => 'http://api.mysite.com', + 'userId' => $user->getId(), + 'sessionId' => $session->getId(), + ])]), Response::MODEL_JWT); + }); App::get('/v1/account') ->desc('Get Account') From 40d735881c8f134fa22a7fa675dc635e1dbda9b1 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Mon, 28 Dec 2020 19:03:47 +0200 Subject: [PATCH 026/230] JWT auth - work in progress --- app/controllers/general.php | 48 +++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index ce1d6cfbe2..31e39712f7 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -2,6 +2,7 @@ require_once __DIR__.'/../init.php'; +use Ahc\Jwt\JWT; use Utopia\App; use Utopia\Swoole\Request; use Appwrite\Utopia\Response; @@ -34,7 +35,6 @@ App::init(function ($utopia, $request, $response, $console, $project, $user, $lo /** @var Appwrite\Event\Event $usage */ /** @var Appwrite\Event\Event $deletes */ /** @var Appwrite\Event\Event $functions */ - /** @var bool $mode */ /** @var array $clients */ @@ -111,7 +111,6 @@ App::init(function ($utopia, $request, $response, $console, $project, $user, $lo $response ->addHeader('Server', 'Appwrite') ->addHeader('X-XSS-Protection', '1; mode=block; report=/v1/xss?url='.\urlencode($request->getURI())) - //->addHeader('X-Frame-Options', ($refDomain == 'http://localhost') ? 'SAMEORIGIN' : 'ALLOW-FROM ' . $refDomain) ->addHeader('X-Content-Type-Options', 'nosniff') ->addHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, PATCH, DELETE') ->addHeader('Access-Control-Allow-Headers', 'Origin, Cookie, Set-Cookie, X-Requested-With, Content-Type, Access-Control-Allow-Origin, Access-Control-Request-Headers, Accept, X-Appwrite-Project, X-Appwrite-Key, X-Appwrite-Locale, X-Appwrite-Mode, X-SDK-Version, Cache-Control, Expires, Pragma') @@ -162,29 +161,38 @@ App::init(function ($utopia, $request, $response, $console, $project, $user, $lo $roles = Config::getParam('roles', []); $scope = $route->getLabel('scope', 'none'); // Allowed scope for chosen route $scopes = $roles[$role]['scopes']; // Allowed scopes for user role + $authKey = $request->getHeader('x-appwrite-key', ''); + $authJWT = $request->getHeader('x-appwrite-jwt', ''); - // Check if given key match project API keys - $key = $project->search('secret', $request->getHeader('x-appwrite-key', ''), $project->getAttribute('keys', [])); - - /* - * Try app auth when we have project key and no user - * Mock user to app and grant API key scopes in addition to default app scopes - */ - if (null !== $key && $user->isEmpty()) { - $user = new Document([ - '$id' => '', - 'status' => Auth::USER_STATUS_ACTIVATED, - 'email' => 'app.'.$project->getId().'@service.'.$request->getHostname(), - 'password' => '', - 'name' => $project->getAttribute('name', 'Untitled'), - ]); + if (!empty($authKey)) { // API Key authentication + // Check if given key match project API keys + $key = $project->search('secret', $authKey, $project->getAttribute('keys', [])); + + /* + * Try app auth when we have project key and no user + * Mock user to app and grant API key scopes in addition to default app scopes + */ + if (null !== $key && $user->isEmpty()) { + $user = new Document([ + '$id' => '', + 'status' => Auth::USER_STATUS_ACTIVATED, + 'email' => 'app.'.$project->getId().'@service.'.$request->getHostname(), + 'password' => '', + 'name' => $project->getAttribute('name', 'Untitled'), + ]); - $role = Auth::USER_ROLE_APP; - $scopes = \array_merge($roles[$role]['scopes'], $key->getAttribute('scopes', [])); + $role = Auth::USER_ROLE_APP; + $scopes = \array_merge($roles[$role]['scopes'], $key->getAttribute('scopes', [])); - Authorization::setDefaultStatus(false); // Cancel security segmentation for API keys. + Authorization::setDefaultStatus(false); // Cancel security segmentation for API keys. + } } + if (!empty($authJWT)) { // JWT authentication + $jwt = new JWT(App::getEnv('_APP_OPENSSL_KEY_V1'), 'HS256', 3600, 10); // Instantiate with key, algo, maxAge and leeway. + $payload = $jwt->decode($authJWT); + } + if ($user->getId()) { Authorization::setRole('user:'.$user->getId()); } From 54f40c8ce2d0fd1764e3a55c917fda53b211811f Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Tue, 29 Dec 2020 01:01:26 +0530 Subject: [PATCH 027/230] feat: parse file --- src/Appwrite/Utopia/Response/Filters/V06.php | 22 ++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/Appwrite/Utopia/Response/Filters/V06.php b/src/Appwrite/Utopia/Response/Filters/V06.php index 79f1ef92fc..9d8d00a94b 100644 --- a/src/Appwrite/Utopia/Response/Filters/V06.php +++ b/src/Appwrite/Utopia/Response/Filters/V06.php @@ -3,7 +3,9 @@ namespace Appwrite\Utopia\Response\Filter; use Appwrite\Auth\Auth; +use Appwrite\Database\Database; use Appwrite\Database\Validator\Authorization; +use Appwrite\OpenSSL\OpenSSL; use Appwrite\Utopia\Response; use Appwrite\Utopia\Response\Filter; use Exception; @@ -19,6 +21,10 @@ class V06 extends Filter { switch($model) { + case Response::MODEL_FILE : + $parsedResponse = $this->parseFile($content); + break; + case Response::MODEL_USER : $parsedResponse = $this->parseUser($content); break; @@ -90,6 +96,22 @@ class V06 extends Filter { return $parsedResponse; } + private function parseFile(array $content) + { + $content['$collection'] = Database::SYSTEM_COLLECTION_FILES; + $content['algorithm'] = 'gzip'; + $content['comment'] = ''; + $content['fileOpenSSLCipher'] = OpenSSL::CIPHER_AES_128_GCM; + $content['fileOpenSSLIV'] = ''; + $content['fileOpenSSLTag'] = ''; + $content['fileOpenSSLVersion'] = ''; + $content['folderId'] = ''; + $content['path'] = ''; + $content['sizeActual'] = $content['sizeOriginal']; + $content['token'] = ''; + return $content; + } + private function parseCurrencyList(array $content) { $content['locations'] = []; From 450c3e6f88fc9acc2786900b2ab42e61dbd76cbb Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Tue, 29 Dec 2020 01:09:22 +0530 Subject: [PATCH 028/230] feat: parse file list --- src/Appwrite/Utopia/Response/Filters/V06.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Appwrite/Utopia/Response/Filters/V06.php b/src/Appwrite/Utopia/Response/Filters/V06.php index 9d8d00a94b..4627157fcc 100644 --- a/src/Appwrite/Utopia/Response/Filters/V06.php +++ b/src/Appwrite/Utopia/Response/Filters/V06.php @@ -25,6 +25,10 @@ class V06 extends Filter { $parsedResponse = $this->parseFile($content); break; + case Response::MODEL_FILE_LIST : + $parsedResponse = $content; + break; + case Response::MODEL_USER : $parsedResponse = $this->parseUser($content); break; From 002361c3b8db617247fef15cbf960649733f3154 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Mon, 28 Dec 2020 22:18:07 +0200 Subject: [PATCH 029/230] Updated model structure --- src/Appwrite/Utopia/Response/Model/JWT.php | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/Appwrite/Utopia/Response/Model/JWT.php b/src/Appwrite/Utopia/Response/Model/JWT.php index 490506ff94..67aa0f4d36 100644 --- a/src/Appwrite/Utopia/Response/Model/JWT.php +++ b/src/Appwrite/Utopia/Response/Model/JWT.php @@ -10,15 +10,10 @@ class JWT extends Model public function __construct() { $this - ->addRule('$id', [ + ->addRule('jwt', [ 'type' => self::TYPE_STRING, - 'description' => 'User ID.', - 'example' => '5e5ea5c16897e', - ]) - ->addRule('name', [ - 'type' => self::TYPE_STRING, - 'description' => 'User name.', - 'example' => 'John Doe', + 'description' => 'JWT encoded string.', + 'example' => 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c', ]) ; } From 5e4619b6e0bdcf58f5db4ae83b1377c009afc6fa Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Mon, 28 Dec 2020 22:31:42 +0200 Subject: [PATCH 030/230] Updated auth check --- app/controllers/general.php | 10 ++-------- app/init.php | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index 31e39712f7..5f9301aec1 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -2,7 +2,6 @@ require_once __DIR__.'/../init.php'; -use Ahc\Jwt\JWT; use Utopia\App; use Utopia\Swoole\Request; use Appwrite\Utopia\Response; @@ -161,9 +160,9 @@ App::init(function ($utopia, $request, $response, $console, $project, $user, $lo $roles = Config::getParam('roles', []); $scope = $route->getLabel('scope', 'none'); // Allowed scope for chosen route $scopes = $roles[$role]['scopes']; // Allowed scopes for user role + $authKey = $request->getHeader('x-appwrite-key', ''); - $authJWT = $request->getHeader('x-appwrite-jwt', ''); - + if (!empty($authKey)) { // API Key authentication // Check if given key match project API keys $key = $project->search('secret', $authKey, $project->getAttribute('keys', [])); @@ -188,11 +187,6 @@ App::init(function ($utopia, $request, $response, $console, $project, $user, $lo } } - if (!empty($authJWT)) { // JWT authentication - $jwt = new JWT(App::getEnv('_APP_OPENSSL_KEY_V1'), 'HS256', 3600, 10); // Instantiate with key, algo, maxAge and leeway. - $payload = $jwt->decode($authJWT); - } - if ($user->getId()) { Authorization::setRole('user:'.$user->getId()); } diff --git a/app/init.php b/app/init.php index 34ef3a5823..ad50ce17b5 100644 --- a/app/init.php +++ b/app/init.php @@ -11,6 +11,8 @@ if (\file_exists(__DIR__.'/../vendor/autoload.php')) { require_once __DIR__.'/../vendor/autoload.php'; } +use Ahc\Jwt\JWT; +use Ahc\Jwt\JWTException; use Appwrite\Auth\Auth; use Appwrite\Database\Database; use Appwrite\Database\Adapter\MySQL as MySQLAdapter; @@ -400,6 +402,29 @@ App::setResource('user', function($mode, $project, $console, $request, $response } } + $authJWT = $request->getHeader('x-appwrite-jwt', ''); + + if (!empty($authJWT)) { // JWT authentication + $jwt = new JWT(App::getEnv('_APP_OPENSSL_KEY_V1'), 'HS256', 3600, 10); // Instantiate with key, algo, maxAge and leeway. + + try { + $payload = $jwt->decode($authJWT); + } catch (JWTException $error) { + throw new Exception('Failed to verify JWT. '.$error->getMessage(), 401); + } + + $jwtUserId = $payload['userId'] ?? ''; + $jwtSessionId = $payload['sessionId'] ?? ''; + + if($jwtUserId && $jwtSessionId) { + $user = $projectDB->getDocument($jwtUserId); + } + + if (empty($user->search('$id', $jwtSessionId, $user->getAttribute('tokens')))) { // Match JWT to active token + $user = new Document(['$id' => '', '$collection' => Database::SYSTEM_COLLECTION_USERS]); + } + } + return $user; }, ['mode', 'project', 'console', 'request', 'response', 'projectDB', 'consoleDB']); From e4e0c23968cc3c98c89c27723407afcd15e02d85 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Mon, 28 Dec 2020 22:31:55 +0200 Subject: [PATCH 031/230] Added tests --- app/controllers/api/account.php | 2 +- .../Account/AccountCustomClientTest.php | 98 +++++++++++++++++++ 2 files changed, 99 insertions(+), 1 deletion(-) diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index 2b36908ed9..35d41530e1 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -638,7 +638,7 @@ App::get('/v1/account/sessions/oauth2/:provider/redirect') ; }); -App::get('/v1/account/jwt') +App::post('/v1/account/jwt') ->desc('Create Account JWT') ->groups(['api', 'account']) ->label('scope', 'account') diff --git a/tests/e2e/Services/Account/AccountCustomClientTest.php b/tests/e2e/Services/Account/AccountCustomClientTest.php index 0e17d8fcc9..a111655307 100644 --- a/tests/e2e/Services/Account/AccountCustomClientTest.php +++ b/tests/e2e/Services/Account/AccountCustomClientTest.php @@ -128,4 +128,102 @@ class AccountCustomClientTest extends Scope return []; } + + public function testCreateJWT():array + { + $email = uniqid().'user@localhost.test'; + $password = 'password'; + $name = 'User Name (JWT)'; + + /** + * Test for SUCCESS + */ + $response = $this->client->call(Client::METHOD_POST, '/account', array_merge([ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ]), [ + 'email' => $email, + 'password' => $password, + 'name' => $name, + ]); + + $id = $response['body']['$id']; + + $this->assertEquals($response['headers']['status-code'], 201); + + $response = $this->client->call(Client::METHOD_POST, '/account/sessions', array_merge([ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ]), [ + 'email' => $email, + 'password' => $password, + ]); + + $this->assertEquals($response['headers']['status-code'], 201); + + $sessionId = $response['body']['$id']; + $session = $this->client->parseCookie((string)$response['headers']['set-cookie'])['a_session_'.$this->getProject()['$id']]; + + $response = $this->client->call(Client::METHOD_GET, '/account', array_merge([ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'cookie' => 'a_session_'.$this->getProject()['$id'].'=' . $session, + ])); + + $this->assertEquals($response['headers']['status-code'], 200); + + $response = $this->client->call(Client::METHOD_POST, '/account/jwt', array_merge([ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'cookie' => 'a_session_'.$this->getProject()['$id'].'=' . $session, + ])); + + $this->assertEquals($response['headers']['status-code'], 201); + $this->assertNotEmpty($response['body']['jwt']); + $this->assertIsString($response['body']['jwt']); + + $jwt = $response['body']['jwt']; + + $response = $this->client->call(Client::METHOD_GET, '/account', array_merge([ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-jwt' => 'wrong-token', + ])); + + $this->assertEquals($response['headers']['status-code'], 401); + + $response = $this->client->call(Client::METHOD_GET, '/account', array_merge([ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-jwt' => $jwt, + ])); + + $this->assertEquals($response['headers']['status-code'], 200); + + $response = $this->client->call(Client::METHOD_DELETE, '/account/sessions/'.$sessionId, array_merge([ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'cookie' => 'a_session_'.$this->getProject()['$id'].'=' . $session, + ])); + + $this->assertEquals($response['headers']['status-code'], 204); + + $response = $this->client->call(Client::METHOD_GET, '/account', array_merge([ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-jwt' => $jwt, + ])); + + $this->assertEquals($response['headers']['status-code'], 401); + + return []; + } } \ No newline at end of file From bb52478bc3d2411c20306ef025694a1b65c914d2 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Mon, 28 Dec 2020 23:23:09 +0200 Subject: [PATCH 032/230] Changed JWT expiry to max 15 minutes --- app/controllers/api/account.php | 2 +- app/init.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index 35d41530e1..559024ba33 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -667,7 +667,7 @@ App::post('/v1/account/jwt') throw new Exception('No valid session found', 401); } - $jwt = new JWT(App::getEnv('_APP_OPENSSL_KEY_V1'), 'HS256', 3600, 10); // Instantiate with key, algo, maxAge and leeway. + $jwt = new JWT(App::getEnv('_APP_OPENSSL_KEY_V1'), 'HS256', 900, 10); // Instantiate with key, algo, maxAge and leeway. $response ->setStatusCode(Response::STATUS_CODE_CREATED) diff --git a/app/init.php b/app/init.php index ad50ce17b5..795e6c6664 100644 --- a/app/init.php +++ b/app/init.php @@ -405,8 +405,8 @@ App::setResource('user', function($mode, $project, $console, $request, $response $authJWT = $request->getHeader('x-appwrite-jwt', ''); if (!empty($authJWT)) { // JWT authentication - $jwt = new JWT(App::getEnv('_APP_OPENSSL_KEY_V1'), 'HS256', 3600, 10); // Instantiate with key, algo, maxAge and leeway. - + $jwt = new JWT(App::getEnv('_APP_OPENSSL_KEY_V1'), 'HS256', 900, 10); // Instantiate with key, algo, maxAge and leeway. + try { $payload = $jwt->decode($authJWT); } catch (JWTException $error) { From 94c23cd0532776fd2b09d3e4cf201f29c4204539 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Mon, 28 Dec 2020 23:23:18 +0200 Subject: [PATCH 033/230] Added docs --- docs/references/account/create-jwt.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 docs/references/account/create-jwt.md diff --git a/docs/references/account/create-jwt.md b/docs/references/account/create-jwt.md new file mode 100644 index 0000000000..c606222eb5 --- /dev/null +++ b/docs/references/account/create-jwt.md @@ -0,0 +1 @@ +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. \ No newline at end of file From 328d3bcfd474452b2f2a42d7d3e6785be7bb2f1c Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Tue, 29 Dec 2020 12:45:44 +0200 Subject: [PATCH 034/230] Comments review --- app/controllers/general.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index 5f9301aec1..10681d33bb 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -171,7 +171,7 @@ App::init(function ($utopia, $request, $response, $console, $project, $user, $lo * Try app auth when we have project key and no user * Mock user to app and grant API key scopes in addition to default app scopes */ - if (null !== $key && $user->isEmpty()) { + if ($key && $user->isEmpty()) { $user = new Document([ '$id' => '', 'status' => Auth::USER_STATUS_ACTIVATED, From 9c01fb1ff60ddbeab887f0178b7693a8ad8622d9 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Tue, 29 Dec 2020 22:21:51 +0530 Subject: [PATCH 035/230] feat: parse collection --- src/Appwrite/Utopia/Response/Filters/V06.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Appwrite/Utopia/Response/Filters/V06.php b/src/Appwrite/Utopia/Response/Filters/V06.php index 4627157fcc..4f90e33174 100644 --- a/src/Appwrite/Utopia/Response/Filters/V06.php +++ b/src/Appwrite/Utopia/Response/Filters/V06.php @@ -21,6 +21,10 @@ class V06 extends Filter { switch($model) { + case Response::MODEL_COLLECTION: + $parsedResponse = $this->parseCollection($content); + break; + case Response::MODEL_FILE : $parsedResponse = $this->parseFile($content); break; @@ -100,6 +104,13 @@ class V06 extends Filter { return $parsedResponse; } + private function parseCollection(array $content) + { + $content['$collection'] = Database::SYSTEM_COLLECTION_COLLECTIONS; + $content['structure'] = true; + return $content; + } + private function parseFile(array $content) { $content['$collection'] = Database::SYSTEM_COLLECTION_FILES; From fa748b62306ece06279c7b62a50807eba0eb158a Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Tue, 29 Dec 2020 22:28:54 +0530 Subject: [PATCH 036/230] feat: parse collection list --- src/Appwrite/Utopia/Response/Filters/V06.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Appwrite/Utopia/Response/Filters/V06.php b/src/Appwrite/Utopia/Response/Filters/V06.php index 4f90e33174..40cede4f73 100644 --- a/src/Appwrite/Utopia/Response/Filters/V06.php +++ b/src/Appwrite/Utopia/Response/Filters/V06.php @@ -25,6 +25,10 @@ class V06 extends Filter { $parsedResponse = $this->parseCollection($content); break; + case Response::MODEL_COLLECTION_LIST: + $parsedResponse = $this->parseCollectionList($content); + break; + case Response::MODEL_FILE : $parsedResponse = $this->parseFile($content); break; @@ -104,6 +108,14 @@ class V06 extends Filter { return $parsedResponse; } + private function parseCollectionList(array $content) + { + foreach($content['collections'] as $key => $collection){ + $content['collections'][$key] = $this->parseCollection($collection); + } + return $content; + } + private function parseCollection(array $content) { $content['$collection'] = Database::SYSTEM_COLLECTION_COLLECTIONS; From d67bcec7b9b876a7d2d3ec2ee0f3743b9d94b712 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Tue, 29 Dec 2020 23:55:34 +0530 Subject: [PATCH 037/230] feat: parse document list --- src/Appwrite/Utopia/Response/Filters/V06.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Appwrite/Utopia/Response/Filters/V06.php b/src/Appwrite/Utopia/Response/Filters/V06.php index 40cede4f73..17c6d19932 100644 --- a/src/Appwrite/Utopia/Response/Filters/V06.php +++ b/src/Appwrite/Utopia/Response/Filters/V06.php @@ -21,6 +21,10 @@ class V06 extends Filter { switch($model) { + case Response::MODEL_DOCUMENT_LIST: + $parsedResponse = $content; + break; + case Response::MODEL_COLLECTION: $parsedResponse = $this->parseCollection($content); break; From 2ffb34fab14e26d99b7ddf2e1c6e379b702965e6 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Wed, 30 Dec 2020 00:12:03 +0530 Subject: [PATCH 038/230] feat: added check for env variable on startup --- .env | 1 + Dockerfile | 3 ++- app/http.php | 7 +++++++ docker-compose.yml | 1 + 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.env b/.env index 9764cfe894..e3c45cbbb5 100644 --- a/.env +++ b/.env @@ -27,3 +27,4 @@ _APP_SMTP_PASSWORD= _APP_STORAGE_LIMIT=10000000 _APP_FUNCTIONS_TIMEOUT=900 _APP_FUNCTIONS_CONTAINERS=10 +_APP_SYSTEM_RESPONSE_FORMAT=0.6 diff --git a/Dockerfile b/Dockerfile index d41dbc50fd..0eba6f5624 100755 --- a/Dockerfile +++ b/Dockerfile @@ -93,7 +93,8 @@ ENV _APP_SERVER=swoole \ _APP_FUNCTIONS_TIMEOUT=900 \ _APP_FUNCTIONS_CONTAINERS=10 \ _APP_SETUP=self-hosted \ - _APP_VERSION=$VERSION + _APP_VERSION=$VERSION \ + _APP_SYSTEM_RESPONSE_FORMAT=0.6 #ENV _APP_SMTP_SECURE '' #ENV _APP_SMTP_USERNAME '' #ENV _APP_SMTP_PASSWORD '' diff --git a/app/http.php b/app/http.php index afb9411ec5..2f7859f110 100644 --- a/app/http.php +++ b/app/http.php @@ -23,6 +23,7 @@ error_reporting(E_ALL); $http = new Server("0.0.0.0", 80); $payloadSize = max(4000000 /* 4mb */, App::getEnv('_APP_STORAGE_LIMIT', 10000000 /* 10mb */)); +$responseFormat = App::getEnv('_APP_SYSTEM_RESPONSE_FORMAT', null); $http ->set([ @@ -48,6 +49,12 @@ $http->on('AfterReload', function($serv, $workerId) { }); $http->on('start', function (Server $http) use ($payloadSize) { + + if(empty($responseFormat)) { + Console::error('Missing value for environment variable _APP_SYSTEM_RESPONSE_FORMAT. Exiting ...'); + exit(1); + } + Console::success('Server started succefully (max payload is '.number_format($payloadSize).' bytes)'); Console::info("Master pid {$http->master_pid}, manager pid {$http->manager_pid}"); diff --git a/docker-compose.yml b/docker-compose.yml index a6bf759f56..f0f54f9939 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -102,6 +102,7 @@ services: - _APP_STORAGE_LIMIT - _APP_FUNCTIONS_TIMEOUT - _APP_FUNCTIONS_CONTAINERS + - _APP_SYSTEM_RESPONSE_FORMAT appwrite-worker-usage: entrypoint: worker-usage From 51600bc1d916bd37465d8f3419aa6430da18e24e Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Wed, 30 Dec 2020 00:37:33 +0530 Subject: [PATCH 039/230] feat: added check for header on api init --- app/controllers/general.php | 23 +++++++++++++++++++++++ app/http.php | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index 972cbf4110..85b8adce70 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -16,12 +16,23 @@ use Appwrite\Database\Validator\Authorization; use Appwrite\Network\Validator\Origin; use Appwrite\Storage\Device\Local; use Appwrite\Storage\Storage; +use Appwrite\Utopia\Response\Filter; +use Appwrite\Utopia\Response\Filter\V06; use Utopia\CLI\Console; Config::setParam('domainVerification', false); Config::setParam('cookieDomain', 'localhost'); Config::setParam('cookieSamesite', Response::COOKIE_SAMESITE_NONE); +function mapResponseFormatToClass(string $responseFormat): Filter { + switch($responseFormat) { + case preg_match($responseFormat, "/0\.[0-6]\.\d/"): + return new V06(); + default: + return null; + } +} + App::init(function ($utopia, $request, $response, $console, $project, $user, $locale, $events, $audits, $usage, $deletes, $clients) { /** @var Utopia\Swoole\Request $request */ /** @var Appwrite\Utopia\Response $response */ @@ -92,6 +103,18 @@ App::init(function ($utopia, $request, $response, $console, $project, $user, $lo Storage::setDevice('files', new Local(APP_STORAGE_UPLOADS.'/app-'.$project->getId())); Storage::setDevice('functions', new Local(APP_STORAGE_FUNCTIONS.'/app-'.$project->getId())); + /* + * Response format + */ + $responseFormatEnvVar = App::getEnv('_APP_SYSTEM_RESPONSE_FORMAT', ''); + $responseFormatHeader = $request->getHeader('x-appwrite-response-format', ''); + $responseFormat = empty($responseFormatHeader) ? $responseFormatEnvVar : $responseFormatHeader; + if (empty($responseFormat) || ($filter = mapResponseFormatToClass($responseFormat)) == null) { + throw new Exception('No filter available for response format : '.$responseFormat, 404); + } else { + Response::setFilter($filter); + } + /* * Security Headers * diff --git a/app/http.php b/app/http.php index 2f7859f110..a28af328fe 100644 --- a/app/http.php +++ b/app/http.php @@ -23,7 +23,7 @@ error_reporting(E_ALL); $http = new Server("0.0.0.0", 80); $payloadSize = max(4000000 /* 4mb */, App::getEnv('_APP_STORAGE_LIMIT', 10000000 /* 10mb */)); -$responseFormat = App::getEnv('_APP_SYSTEM_RESPONSE_FORMAT', null); +$responseFormat = App::getEnv('_APP_SYSTEM_RESPONSE_FORMAT', ''); $http ->set([ From cebd016282c9f1db3f5bda38fa6cf8c563e98680 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Wed, 30 Dec 2020 00:38:48 +0530 Subject: [PATCH 040/230] feat: modified the regex --- app/controllers/general.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index 85b8adce70..8c0404ce5f 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -26,7 +26,7 @@ Config::setParam('cookieSamesite', Response::COOKIE_SAMESITE_NONE); function mapResponseFormatToClass(string $responseFormat): Filter { switch($responseFormat) { - case preg_match($responseFormat, "/0\.[0-6]\.\d/"): + case preg_match($responseFormat, "/0\.[0-6]\.\d?/"): return new V06(); default: return null; From c508657a50fcd9d3f9300e614ea6b9594e0249b5 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Wed, 30 Dec 2020 00:42:32 +0530 Subject: [PATCH 041/230] feat: apply parse method if filter is present --- src/Appwrite/Utopia/Response.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Appwrite/Utopia/Response.php b/src/Appwrite/Utopia/Response.php index 70e8e46d91..16fedaf8e1 100644 --- a/src/Appwrite/Utopia/Response.php +++ b/src/Appwrite/Utopia/Response.php @@ -293,6 +293,10 @@ class Response extends SwooleResponse } $item = $this->output($item, $rule['type']); + // If filter is set, parse the item + if(self::isFilter()){ + $item = self::getFilter()->parse($item, $rule['type']); + } } } } From a37a28fdc9ca6e6e9bccf04971c1bff2c81c1a71 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Wed, 30 Dec 2020 16:24:11 +0530 Subject: [PATCH 042/230] feat: added unit test for setFilter --- src/Appwrite/Utopia/Response/Filters/V06.php | 4 +-- tests/unit/Utopia/ResponseTest.php | 34 ++++++++++++++++++++ 2 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 tests/unit/Utopia/ResponseTest.php diff --git a/src/Appwrite/Utopia/Response/Filters/V06.php b/src/Appwrite/Utopia/Response/Filters/V06.php index 17c6d19932..4e15862108 100644 --- a/src/Appwrite/Utopia/Response/Filters/V06.php +++ b/src/Appwrite/Utopia/Response/Filters/V06.php @@ -16,8 +16,8 @@ class V06 extends Filter { // Convert 0.7 Data format to 0.6 format public function parse(array $content, string $model): array { - - $parsedResponse = array(); + + $parsedResponse = []; switch($model) { diff --git a/tests/unit/Utopia/ResponseTest.php b/tests/unit/Utopia/ResponseTest.php new file mode 100644 index 0000000000..20df14058a --- /dev/null +++ b/tests/unit/Utopia/ResponseTest.php @@ -0,0 +1,34 @@ +object = new Response(new SwooleResponse()); + } + + public function testSetFilter() + { + $this->assertEquals($this->object->isFilter(), false); + $this->assertEquals($this->object->getFilter(), null); + + $filter = new V06(); + $this->object->setFilter($filter); + + $this->assertEquals($this->object->isFilter(), true); + $this->assertEquals($this->object->getFilter(), $filter); + } +} \ No newline at end of file From 61700395866cdcb13f60842480c20066dd192698 Mon Sep 17 00:00:00 2001 From: "Eldad A. Fux" Date: Wed, 30 Dec 2020 17:53:46 +0200 Subject: [PATCH 043/230] Update README.md --- README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 7fa85dc181..4f6e598c76 100644 --- a/README.md +++ b/README.md @@ -114,17 +114,17 @@ For the complete API documentation, visit [https://appwrite.io/docs](https://app Below is a list of currently supported platforms and languages. If you wish to help us add support to your platform of choice, you can go over to our [SDK Generator](https://github.com/appwrite/sdk-generator) project and view our [contribution guide](https://github.com/appwrite/sdk-generator/blob/master/CONTRIBUTING.md). #### Client -* ✅ [Web](https://github.com/appwrite/sdk-for-js) (Maintained by the Appwrite Team) -* ✅ [Flutter](https://github.com/appwrite/sdk-for-flutter) (Maintained by the Appwrite Team) +* ✅ [Web](https://github.com/appwrite/sdk-for-js) (Maintained by the Appwrite Team) +* ✅ [Flutter](https://github.com/appwrite/sdk-for-flutter) (Maintained by the Appwrite Team) #### Server -* ✅ [NodeJS](https://github.com/appwrite/sdk-for-node) (Maintained by the Appwrite Team) -* ✅ [PHP](https://github.com/appwrite/sdk-for-php) (Maintained by the Appwrite Team) -* ✅ [Deno](https://github.com/appwrite/sdk-for-deno) - **Beta** (Maintained by the Appwrite Team) -* ✅ [Ruby](https://github.com/appwrite/sdk-for-ruby) - **Beta** (Maintained by the Appwrite Team) -* ✅ [Python](https://github.com/appwrite/sdk-for-python) - **Beta** (Maintained by the Appwrite Team) -* ✅ [Go](https://github.com/appwrite/sdk-for-go) **Work in progress** (Maintained by the Appwrite Team) -* ✅ [Dart](https://github.com/appwrite/sdk-for-dart) **Work in progress** (Maintained by the Appwrite Team) +* ✅ [NodeJS](https://github.com/appwrite/sdk-for-node) (Maintained by the Appwrite Team) +* ✅ [PHP](https://github.com/appwrite/sdk-for-php) (Maintained by the Appwrite Team) +* ✅ [Deno](https://github.com/appwrite/sdk-for-deno) - **Beta** (Maintained by the Appwrite Team) +* ✅ [Ruby](https://github.com/appwrite/sdk-for-ruby) - **Beta** (Maintained by the Appwrite Team) +* ✅ [Python](https://github.com/appwrite/sdk-for-python) - **Beta** (Maintained by the Appwrite Team) +* ✅ [Go](https://github.com/appwrite/sdk-for-go) **Work in progress** (Maintained by the Appwrite Team) +* ✅ [Dart](https://github.com/appwrite/sdk-for-dart) **Work in progress** (Maintained by the Appwrite Team) Looking for more SDKs? - Help us by contributing a pull request to our [SDK Generator](https://github.com/appwrite/sdk-generator)! From 7d4262f623926409c2f862de8e17a6d46f433168 Mon Sep 17 00:00:00 2001 From: "Eldad A. Fux" Date: Wed, 30 Dec 2020 17:55:05 +0200 Subject: [PATCH 044/230] Update README.md --- README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 4f6e598c76..d8d35f97d0 100644 --- a/README.md +++ b/README.md @@ -114,17 +114,17 @@ For the complete API documentation, visit [https://appwrite.io/docs](https://app Below is a list of currently supported platforms and languages. If you wish to help us add support to your platform of choice, you can go over to our [SDK Generator](https://github.com/appwrite/sdk-generator) project and view our [contribution guide](https://github.com/appwrite/sdk-generator/blob/master/CONTRIBUTING.md). #### Client -* ✅ [Web](https://github.com/appwrite/sdk-for-js) (Maintained by the Appwrite Team) -* ✅ [Flutter](https://github.com/appwrite/sdk-for-flutter) (Maintained by the Appwrite Team) +* ✅   [Web](https://github.com/appwrite/sdk-for-js) (Maintained by the Appwrite Team) +* ✅   [Flutter](https://github.com/appwrite/sdk-for-flutter) (Maintained by the Appwrite Team) #### Server -* ✅ [NodeJS](https://github.com/appwrite/sdk-for-node) (Maintained by the Appwrite Team) -* ✅ [PHP](https://github.com/appwrite/sdk-for-php) (Maintained by the Appwrite Team) -* ✅ [Deno](https://github.com/appwrite/sdk-for-deno) - **Beta** (Maintained by the Appwrite Team) -* ✅ [Ruby](https://github.com/appwrite/sdk-for-ruby) - **Beta** (Maintained by the Appwrite Team) -* ✅ [Python](https://github.com/appwrite/sdk-for-python) - **Beta** (Maintained by the Appwrite Team) -* ✅ [Go](https://github.com/appwrite/sdk-for-go) **Work in progress** (Maintained by the Appwrite Team) -* ✅ [Dart](https://github.com/appwrite/sdk-for-dart) **Work in progress** (Maintained by the Appwrite Team) +* ✅   [NodeJS](https://github.com/appwrite/sdk-for-node) (Maintained by the Appwrite Team) +* ✅   [PHP](https://github.com/appwrite/sdk-for-php) (Maintained by the Appwrite Team) +* ✅   [Deno](https://github.com/appwrite/sdk-for-deno) - **Beta** (Maintained by the Appwrite Team) +* ✅   [Ruby](https://github.com/appwrite/sdk-for-ruby) - **Beta** (Maintained by the Appwrite Team) +* ✅   [Python](https://github.com/appwrite/sdk-for-python) - **Beta** (Maintained by the Appwrite Team) +* ✅   [Go](https://github.com/appwrite/sdk-for-go) **Work in progress** (Maintained by the Appwrite Team) +* ✅   [Dart](https://github.com/appwrite/sdk-for-dart) **Work in progress** (Maintained by the Appwrite Team) Looking for more SDKs? - Help us by contributing a pull request to our [SDK Generator](https://github.com/appwrite/sdk-generator)! From 28f003e5bed03d420fe04a3925737e1badfd9c77 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Thu, 31 Dec 2020 01:07:30 +0530 Subject: [PATCH 045/230] feat: unit tests for response filters --- tests/unit/Utopia/Filters/V06Test.php | 237 ++++++++++++++++++++++++++ 1 file changed, 237 insertions(+) create mode 100644 tests/unit/Utopia/Filters/V06Test.php diff --git a/tests/unit/Utopia/Filters/V06Test.php b/tests/unit/Utopia/Filters/V06Test.php new file mode 100644 index 0000000000..a5d2bfaa85 --- /dev/null +++ b/tests/unit/Utopia/Filters/V06Test.php @@ -0,0 +1,237 @@ +filter = new V06(); + } + + public function testParseUser() + { + $content = [ + '$id' => '5e5ea5c16897e', + 'name' => 'John Doe', + 'registration' => 1592981250, + 'status' => 0, + 'email' => 'john@appwrite.io', + 'emailVerification' => false, + 'prefs' => [ + 'theme' => 'pink', + 'timezone' => 'UTC' + ] + ]; + + $model = Response::MODEL_USER; + $parsedResponse = $this->filter->parse($content, $model); + + $this->assertEquals($parsedResponse['$id'], '5e5ea5c16897e'); + $this->assertEquals($parsedResponse['name'], 'John Doe'); + $this->assertEquals($parsedResponse['registration'], 1592981250); + $this->assertEquals($parsedResponse['status'], 0); + $this->assertEquals($parsedResponse['email'], 'john@appwrite.io'); + $this->assertEquals($parsedResponse['emailVerification'], false); + $this->assertEquals($parsedResponse['prefs'], ['theme' => 'pink', 'timezone' => 'UTC']); + $this->assertEquals($parsedResponse['status'], 0); + $this->assertEquals($parsedResponse['roles'], Authorization::getRoles() ?? []); + } + + public function testParseUserList() + { + $content = [ + 'sum' => 1, + 'users' => [ + 0 => [ + '$id' => '5e5ea5c16897e', + 'name' => 'John Doe', + 'registration' => 1592981250, + 'status' => 0, + 'email' => 'john@appwrite.io', + 'emailVerification' => false, + 'prefs' => [ + 'theme' => 'pink', + 'timezone' => 'UTC' + ] + ] + ] + ]; + + $model = Response::MODEL_USER_LIST; + $parsedResponse = $this->filter->parse($content, $model); + + $this->assertEquals($parsedResponse['sum'], 1); + $this->assertEquals($parsedResponse['users'][0]['$id'], '5e5ea5c16897e'); + $this->assertEquals($parsedResponse['users'][0]['name'], 'John Doe'); + $this->assertEquals($parsedResponse['users'][0]['registration'], 1592981250); + $this->assertEquals($parsedResponse['users'][0]['status'], 0); + $this->assertEquals($parsedResponse['users'][0]['email'], 'john@appwrite.io'); + $this->assertEquals($parsedResponse['users'][0]['emailVerification'], false); + $this->assertEquals($parsedResponse['users'][0]['prefs'], ['theme' => 'pink', 'timezone' => 'UTC']); + $this->assertEquals($parsedResponse['users'][0]['status'], 0); + $this->assertEquals($parsedResponse['users'][0]['roles'], Authorization::getRoles() ?? []); + } + + public function testParseSession() + { + $content = [ + '$id' => '5e5ea5c16897e', + 'userId' => '5e5bb8c16897e', + 'expire' => 1592981250, + 'ip' => '127.0.0.1', + 'osCode' => 'Mac', + 'osName' => 'Mac', + 'osVersion' => 'Mac', + 'clientType' => 'browser', + 'clientCode' => 'CM', + 'clientName' => 'Chrome Mobile iOS', + 'clientVersion' => '84.0', + 'clientEngine' => 'WebKit', + 'clientEngineVersion' => '605.1.15', + 'deviceName' => 'smartphone', + 'deviceBrand' => 'Google', + 'deviceModel' => 'Nexus 5', + 'countryCode' => 'US', + 'countryName' => 'United States', + 'current' => true + ]; + + $model = Response::MODEL_SESSION; + $parsedResponse = $this->filter->parse($content, $model); + + $this->assertEquals($parsedResponse['$id'], '5e5ea5c16897e'); + $this->assertEquals($parsedResponse['userId'], '5e5bb8c16897e'); + $this->assertEquals($parsedResponse['expire'], 1592981250); + $this->assertEquals($parsedResponse['ip'], '127.0.0.1'); + $this->assertEquals($parsedResponse['osCode'], 'Mac'); + $this->assertEquals($parsedResponse['osName'], 'Mac'); + $this->assertEquals($parsedResponse['osVersion'], 'Mac'); + $this->assertEquals($parsedResponse['clientType'], 'browser'); + $this->assertEquals($parsedResponse['clientCode'], 'CM'); + $this->assertEquals($parsedResponse['clientName'], 'Chrome Mobile iOS'); + $this->assertEquals($parsedResponse['clientVersion'], '84.0'); + $this->assertEquals($parsedResponse['clientEngine'], 'WebKit'); + $this->assertEquals($parsedResponse['clientEngineVersion'], '605.1.15'); + $this->assertEquals($parsedResponse['deviceName'], 'smartphone'); + $this->assertEquals($parsedResponse['deviceBrand'], 'Google'); + $this->assertEquals($parsedResponse['deviceModel'], 'Nexus 5'); + $this->assertEquals($parsedResponse['countryCode'], 'US'); + $this->assertEquals($parsedResponse['countryName'], 'United States'); + $this->assertEquals($parsedResponse['current'], true); + $this->assertEquals($parsedResponse['type'], Auth::TOKEN_TYPE_LOGIN); + } + + public function testParseSessionList() + { + $content = [ + 'sum' => 1, + 'sessions' => [ + 0 => [ + '$id' => '5e5ea5c16897e', + 'userId' => '5e5bb8c16897e', + 'expire' => 1592981250, + 'ip' => '127.0.0.1', + 'osCode' => 'Mac', + 'osName' => 'Mac', + 'osVersion' => 'Mac', + 'clientType' => 'browser', + 'clientCode' => 'CM', + 'clientName' => 'Chrome Mobile iOS', + 'clientVersion' => '84.0', + 'clientEngine' => 'WebKit', + 'clientEngineVersion' => '605.1.15', + 'deviceName' => 'smartphone', + 'deviceBrand' => 'Google', + 'deviceModel' => 'Nexus 5', + 'countryCode' => 'US', + 'countryName' => 'United States', + 'current' => true + ] + ] + ]; + + $model = Response::MODEL_SESSION_LIST; + $parsedResponse = $this->filter->parse($content, $model); + + $this->assertEquals($parsedResponse['sum'], 1); + $this->assertEquals($parsedResponse['sessions'][0]['$id'], '5e5ea5c16897e'); + $this->assertEquals($parsedResponse['sessions'][0]['OS'], 'Mac Mac'); + $this->assertEquals($parsedResponse['sessions'][0]['client'], 'Chrome Mobile iOS 84.0'); + $this->assertEquals($parsedResponse['sessions'][0]['device'], 'smartphone'); + $this->assertEquals($parsedResponse['sessions'][0]['brand'], 'Google'); + $this->assertEquals($parsedResponse['sessions'][0]['model'], 'Nexus 5'); + $this->assertEquals($parsedResponse['sessions'][0]['ip'], '127.0.0.1'); + $this->assertEquals($parsedResponse['sessions'][0]['current'], true); + $this->assertEquals($parsedResponse['sessions'][0]['geo']['isoCode'], 'US'); + $this->assertEquals($parsedResponse['sessions'][0]['geo']['country'], 'United States'); + } + + public function testParseLogList() + { + $content = [ + 'sum' => 1, + 'logs' => [ + 0 => [ + 'event' => 'account.sessions.create', + 'ip' => '127.0.0.1', + 'time' => 1592981250, + 'osCode' => 'Mac', + 'osName' => 'Mac', + 'osVersion' => 'Mac', + 'clientType' => 'browser', + 'clientCode' => 'CM', + 'clientName' => 'Chrome Mobile iOS', + 'clientVersion' => '84.0', + 'clientEngine' => 'WebKit', + 'clientEngineVersion' => '605.1.15', + 'deviceName' => 'smartphone', + 'deviceBrand' => 'Google', + 'deviceModel' => 'Nexus 5', + 'countryCode' => 'US', + 'countryName' => 'United States' + ] + ] + ]; + + $model = Response::MODEL_LOG_LIST; + $parsedResponse = $this->filter->parse($content, $model); + + $this->assertEquals($parsedResponse['sum'], 1); + $this->assertEquals($parsedResponse['logs'][0]['event'], 'account.sessions.create'); + $this->assertEquals($parsedResponse['logs'][0]['ip'], '127.0.0.1'); + $this->assertEquals($parsedResponse['logs'][0]['time'], 1592981250); + $this->assertEquals($parsedResponse['logs'][0]['OS'], 'Mac Mac'); + $this->assertEquals($parsedResponse['logs'][0]['client'], 'Chrome Mobile iOS 84.0'); + $this->assertEquals($parsedResponse['logs'][0]['device'], 'smartphone'); + $this->assertEquals($parsedResponse['logs'][0]['brand'], 'Google'); + $this->assertEquals($parsedResponse['logs'][0]['model'], 'Nexus 5'); + $this->assertEquals($parsedResponse['logs'][0]['geo']['isoCode'], 'US'); + $this->assertEquals($parsedResponse['logs'][0]['geo']['country'], 'United States'); + } + + public function testParseToken() + { + $content = [ + '$id' => 'bb8ea5c16897e', + 'userId' => '5e5ea5c168bb8', + 'secret' => '', + 'expire' => 1592981250 + ]; + + $model = Response::MODEL_TOKEN; + $parsedResponse = $this->filter->parse($content, $model); + } +} \ No newline at end of file From 8cc10c683abb85bbf24da5635734a25471763fa9 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Thu, 31 Dec 2020 12:42:23 +0530 Subject: [PATCH 046/230] feat: unit tests for response filters --- src/Appwrite/Utopia/Response/Filters/V06.php | 2 +- tests/unit/Utopia/Filters/V06Test.php | 49 ++++++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/src/Appwrite/Utopia/Response/Filters/V06.php b/src/Appwrite/Utopia/Response/Filters/V06.php index 4e15862108..401bfd1a64 100644 --- a/src/Appwrite/Utopia/Response/Filters/V06.php +++ b/src/Appwrite/Utopia/Response/Filters/V06.php @@ -176,7 +176,7 @@ class V06 extends Filter { $countries = $content['countries']; $parsedResponse = []; foreach($countries as $country) { - $parsedResponse['code'] = $country['name']; + $parsedResponse[$country['code']] = $country['name']; } return $parsedResponse; diff --git a/tests/unit/Utopia/Filters/V06Test.php b/tests/unit/Utopia/Filters/V06Test.php index a5d2bfaa85..0c5935793c 100644 --- a/tests/unit/Utopia/Filters/V06Test.php +++ b/tests/unit/Utopia/Filters/V06Test.php @@ -233,5 +233,54 @@ class V06Test extends TestCase $model = Response::MODEL_TOKEN; $parsedResponse = $this->filter->parse($content, $model); + + $this->assertEquals($parsedResponse['$id'], 'bb8ea5c16897e'); + $this->assertEquals($parsedResponse['userId'], '5e5ea5c168bb8'); + $this->assertEquals($parsedResponse['expire'], 1592981250); + $this->assertEquals($parsedResponse['secret'], ''); + $this->assertEquals($parsedResponse['type'], Auth::TOKEN_TYPE_RECOVERY); + } + + public function testParseLocale() + { + $content = [ + 'ip' => '127.0.0.1', + 'countryCode' => 'US', + 'country' => 'United States', + 'continentCode' => 'NA', + 'continent' => 'North America', + 'eu' => false, + 'currency' => 'USD' + ]; + + $model = Response::MODEL_LOCALE; + $parsedResponse = $this->filter->parse($content, $model); + + $this->assertEquals($parsedResponse['ip'], '127.0.0.1'); + $this->assertEquals($parsedResponse['contryCode'], 'US'); + $this->assertEquals($parsedResponse['country'], 'United States'); + $this->assertEquals($parsedResponse['continentCode'], 'NA'); + $this->assertEquals($parsedResponse['continent'], 'North America'); + $this->assertEquals($parsedResponse['eu'], false); + $this->assertEquals($parsedResponse['currency'], 'USD'); + } + + public function testParseCountryList() + { + $content = [ + 'sum' => 1, + 'countries' => [ + 0 => [ + 'name' => 'United States', + 'code' => 'US' + ] + ] + ]; + + $model = Response::MODEL_COUNTRY_LIST; + $parsedResponse = $this->filter->parse($content, $model); + + $this->assertEquals($parsedResponse['sum'], 1); + $this->assertEquals($parsedResponse['countries']['US'], 'United States'); } } \ No newline at end of file From 4fc40a387af65ebcb389a20ef9b9de5242ff2df0 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Thu, 31 Dec 2020 13:25:25 +0530 Subject: [PATCH 047/230] feat: unit tests for response filters --- src/Appwrite/Utopia/Response/Filters/V06.php | 20 ++- tests/unit/Utopia/Filters/V06Test.php | 136 +++++++++++++++++++ 2 files changed, 149 insertions(+), 7 deletions(-) diff --git a/src/Appwrite/Utopia/Response/Filters/V06.php b/src/Appwrite/Utopia/Response/Filters/V06.php index 401bfd1a64..bed31b48bc 100644 --- a/src/Appwrite/Utopia/Response/Filters/V06.php +++ b/src/Appwrite/Utopia/Response/Filters/V06.php @@ -146,7 +146,15 @@ class V06 extends Filter { private function parseCurrencyList(array $content) { $content['locations'] = []; - return $content; + + $currencies = $content['currencies']; + $parsedResponse = []; + foreach($currencies as $currency) { + $currency['locations'] = []; + $parsedResponse[] = $currency; + } + + return $parsedResponse; } private function parseContinentList(array $content) @@ -154,7 +162,7 @@ class V06 extends Filter { $continents = $content['continents']; $parsedResponse = []; foreach($continents as $continent) { - $parsedResponse['code'] = $continent['name']; + $parsedResponse[$continent['code']] = $continent['name']; } return $parsedResponse; @@ -165,7 +173,7 @@ class V06 extends Filter { $phones = $content['phones']; $parsedResponse = []; foreach($phones as $phone) { - $parsedResponse['countryCode'] = $phone['code']; + $parsedResponse[$phone['countryCode']] = $phone['code']; } return $parsedResponse; @@ -204,9 +212,8 @@ class V06 extends Filter { { $logs = $content['logs']; $parsedResponse = []; - $index = 0; foreach($logs as $log) { - $parsedResponse[$index++] = [ + $parsedResponse[] = [ 'event' => $log['event'], 'ip' => $log['ip'], 'time' => strtotime($log['time']), @@ -228,9 +235,8 @@ class V06 extends Filter { { $sessions = $content['sessions']; $parsedResponse = []; - $index = 0; foreach($sessions as $session) { - $parsedResponse[$index++] = [ + $parsedResponse[] = [ '$id' => $session['$id'], 'OS' => $session['osName'].' '.$session['osVersion'], 'client' => $session['clientName'].' '.$session['clientVersion'], diff --git a/tests/unit/Utopia/Filters/V06Test.php b/tests/unit/Utopia/Filters/V06Test.php index 0c5935793c..3c98fc192b 100644 --- a/tests/unit/Utopia/Filters/V06Test.php +++ b/tests/unit/Utopia/Filters/V06Test.php @@ -3,7 +3,9 @@ namespace Appwrite\Tests; use Appwrite\Auth\Auth; +use Appwrite\Database\Database; use Appwrite\Database\Validator\Authorization; +use Appwrite\OpenSSL\OpenSSL; use Appwrite\Utopia\Response; use Appwrite\Utopia\Response\Filter\V06; use PHPUnit\Framework\TestCase; @@ -283,4 +285,138 @@ class V06Test extends TestCase $this->assertEquals($parsedResponse['sum'], 1); $this->assertEquals($parsedResponse['countries']['US'], 'United States'); } + + public function testParsePhoneList() + { + $content = [ + 'sum' => 1, + 'phones' => [ + 0 => [ + 'code' => '+1', + 'countryCode' => 'US', + 'countryName' => 'United States' + ] + ] + ]; + + $model = Response::MODEL_PHONE_LIST; + $parsedResponse = $this->filter->parse($content, $model); + + $this->assertEquals($parsedResponse['sum'], 1); + $this->assertEquals($parsedResponse['phones']['US'], '+1'); + } + + public function testParseContinentList() + { + $content = [ + 'sum' => 1, + 'continents' => [ + 0 => [ + 'name' => 'Europe', + 'code' => 'EU', + ] + ] + ]; + + $model = Response::MODEL_CONTINENT_LIST; + $parsedResponse = $this->filter->parse($content, $model); + + $this->assertEquals($parsedResponse['sum'], 1); + $this->assertEquals($parsedResponse['continents']['EU'], 'Europe'); + } + + public function testParseCurrencyList() + { + $content = [ + 'sum' => 1, + 'currencies' => [ + 0 => [ + 'symbol' => '$', + 'name' => 'US dollar', + 'symbolNative' => '$', + 'decimalDigits' => 2, + 'rounding' => 0, + 'code' => 'USD', + 'namePlural' => 'US Dollars' + ] + ] + ]; + + $model = Response::MODEL_CURRENCY_LIST; + $parsedResponse = $this->filter->parse($content, $model); + + $this->assertEquals($parsedResponse['sum'], 1); + $this->assertEquals($parsedResponse['currencies'][0]['symbol'], '$'); + $this->assertEquals($parsedResponse['currencies'][0]['name'], 'US dollar'); + $this->assertEquals($parsedResponse['currencies'][0]['symbolNative'], '$'); + $this->assertEquals($parsedResponse['currencies'][0]['decimalDigits'], 2); + $this->assertEquals($parsedResponse['currencies'][0]['rounding'], 0); + $this->assertEquals($parsedResponse['currencies'][0]['code'], 'USD'); + $this->assertEquals($parsedResponse['currencies'][0]['namePlural'], 'US Dollars'); + $this->assertEquals($parsedResponse['currencies'][0]['locations'], []); + } + + public function testParseFile() + { + $content = [ + '$id' => '5e5ea5c16897e', + '$permissions' => ['read' => ['*'], 'write' => ['*']], + 'name' => 'Pink.png', + 'dateCreated' => 1592981250, + 'signature' => '5d529fd02b544198ae075bd57c1762bb', + 'mimeType' => 'image/png', + 'sizeOriginal' => 17890 + ]; + + $model = Response::MODEL_FILE; + $parsedResponse = $this->filter->parse($content, $model); + + $this->assertEquals($parsedResponse['$id'], '5e5ea5c16897e'); + $this->assertEquals($parsedResponse['$permissions'], ['read' => ['*'], 'write' => ['*']]); + $this->assertEquals($parsedResponse['name'], 'Pink.png'); + $this->assertEquals($parsedResponse['dateCreated'], 1592981250); + $this->assertEquals($parsedResponse['signature'], '5d529fd02b544198ae075bd57c1762bb'); + $this->assertEquals($parsedResponse['mimeType'], 'image/png'); + $this->assertEquals($parsedResponse['sizeOriginal'], 17890); + $this->assertEquals($parsedResponse['$collection'], Database::SYSTEM_COLLECTION_FILES); + $this->assertEquals($parsedResponse['algorithm'], 'gzip'); + $this->assertEquals($parsedResponse['comment'], ''); + $this->assertEquals($parsedResponse['fileOpenSSLCipher'], OpenSSL::CIPHER_AES_128_GCM); + $this->assertEquals($parsedResponse['fileOpenSSLIV'], ''); + $this->assertEquals($parsedResponse['fileOpenSSLTag'], ''); + $this->assertEquals($parsedResponse['fileOpenSSLVersion'], ''); + $this->assertEquals($parsedResponse['folderId'], ''); + $this->assertEquals($parsedResponse['path'], ''); + $this->assertEquals($parsedResponse['sizeActual'], $content['sizeOriginal']); + $this->assertEquals($parsedResponse['token'], ''); + } + + public function testParseCollection() + { + $content = [ + '$id' => '5e5ea5c16897e', + '$permissions' => ['read' => ['*'], 'write' => ['*']], + 'name' => 'Movies', + 'dateCreated' => 1592981250, + 'dateUpdated' => '5d529fd02b544198ae075bd57c1762bb', + 'rules' => [] + ]; + + $model = Response::MODEL_COLLECTION; + $parsedResponse = $this->filter->parse($content, $model); + + $this->assertEquals($parsedResponse['$id'], '5e5ea5c16897e'); + $this->assertEquals($parsedResponse['$permissions'], ['read' => ['*'], 'write' => ['*']]); + $this->assertEquals($parsedResponse['name'], 'Movies'); + $this->assertEquals($parsedResponse['dateCreated'], 1592981250); + $this->assertEquals($parsedResponse['dateUpdated'], '5d529fd02b544198ae075bd57c1762bb'); + $this->assertEquals($parsedResponse['rules'], []); + $this->assertEquals($parsedResponse['$collection'], Database::SYSTEM_COLLECTION_COLLECTIONS); + $this->assertEquals($parsedResponse['structure'], true); + } + + public function testParseCollectionList() + { + + } } \ No newline at end of file From 734e0c3a818c84be4fa5295af929949ca3c658eb Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Thu, 31 Dec 2020 13:42:01 +0530 Subject: [PATCH 048/230] feat: unit tests for response filters --- tests/unit/Utopia/Filters/V06Test.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/unit/Utopia/Filters/V06Test.php b/tests/unit/Utopia/Filters/V06Test.php index 3c98fc192b..2db87c8eb7 100644 --- a/tests/unit/Utopia/Filters/V06Test.php +++ b/tests/unit/Utopia/Filters/V06Test.php @@ -418,5 +418,31 @@ class V06Test extends TestCase public function testParseCollectionList() { + $content = [ + 'sum' => 1, + 'collections' => [ + 0 => [ + '$id' => '5e5ea5c16897e', + '$permissions' => ['read' => ['*'], 'write' => ['*']], + 'name' => 'Movies', + 'dateCreated' => 1592981250, + 'dateUpdated' => '5d529fd02b544198ae075bd57c1762bb', + 'rules' => [] + ] + ] + ]; + + $model = Response::MODEL_COLLECTION_LIST; + $parsedResponse = $this->filter->parse($content, $model); + + $this->assertEquals($parsedResponse['sum'], 1); + $this->assertEquals($parsedResponse['collections'][0]['$id'], '5e5ea5c16897e'); + $this->assertEquals($parsedResponse['collections'][0]['$permissions'], ['read' => ['*'], 'write' => ['*']]); + $this->assertEquals($parsedResponse['collections'][0]['name'], 'Movies'); + $this->assertEquals($parsedResponse['collections'][0]['dateCreated'], 1592981250); + $this->assertEquals($parsedResponse['collections'][0]['dateUpdated'], '5d529fd02b544198ae075bd57c1762bb'); + $this->assertEquals($parsedResponse['collections'][0]['rules'], []); + $this->assertEquals($parsedResponse['collections'][0]['$collection'], Database::SYSTEM_COLLECTION_COLLECTIONS); + $this->assertEquals($parsedResponse['collections'][0]['structure'], true); } } \ No newline at end of file From 7cf84828083c4919fb08138f2a90f68f1b67968b Mon Sep 17 00:00:00 2001 From: "Eldad A. Fux" Date: Thu, 31 Dec 2020 11:37:39 +0200 Subject: [PATCH 049/230] Update README.md --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index d8d35f97d0..1398b9513e 100644 --- a/README.md +++ b/README.md @@ -8,11 +8,11 @@

-[![Discord](https://img.shields.io/discord/564160730845151244?label=discord)](https://appwrite.io/discord) -[![Docker Pulls](https://badgen.net/docker/pulls/appwrite/appwrite)](https://hub.docker.com/r/appwrite/appwrite) -[![Build Status](https://travis-ci.com/appwrite/appwrite.svg?branch=master)](https://travis-ci.com/appwrite/appwrite) -[![Twitter Account](https://badgen.net/twitter/follow/appwrite_io?label=twitter)](https://twitter.com/appwrite_io) -[![Follow Appwrite on StackShare](https://badgen.net/badge/follow%20on/stackshare/blue)](https://stackshare.io/appwrite) +[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) +[![Docker Pulls](https://img.shields.io/docker/pulls/appwrite/appwrite?color=f02e65&style=flat-square)](https://hub.docker.com/r/appwrite/appwrite) +[![Build Status](https://img.shields.io/travis/com/appwrite/appwrite?style=flat-square)](https://travis-ci.com/appwrite/appwrite) +[![Twitter Account](https://img.shields.io/twitter/follow/appwrite_io?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite_io) +[![Follow Appwrite on StackShare](https://img.shields.io/badge/follow%20on-stackshare-blue?style=flat-square)](https://stackshare.io/appwrite) Appwrite is an end-to-end backend server for Web, Mobile, Native, or Backend apps packaged as a set of Docker microservices. Appwrite abstracts the complexity and repetitiveness required to build a modern backend API from scratch and allows you to build secure apps faster. From d191a71593661fcfdf4cfb11dbb11f415a6f147a Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Fri, 1 Jan 2021 01:26:39 +0530 Subject: [PATCH 050/230] feat: review comments --- app/controllers/general.php | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index 62ca0be580..316fb85e0c 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -24,15 +24,6 @@ Config::setParam('domainVerification', false); Config::setParam('cookieDomain', 'localhost'); Config::setParam('cookieSamesite', Response::COOKIE_SAMESITE_NONE); -function mapResponseFormatToClass(string $responseFormat): Filter { - switch($responseFormat) { - case preg_match($responseFormat, "/0\.[0-6]\.\d?/"): - return new V06(); - default: - return null; - } -} - App::init(function ($utopia, $request, $response, $console, $project, $user, $locale, $events, $audits, $usage, $deletes, $clients) { /** @var Utopia\Swoole\Request $request */ /** @var Appwrite\Utopia\Response $response */ @@ -108,14 +99,15 @@ App::init(function ($utopia, $request, $response, $console, $project, $user, $lo /* * Response format */ - $responseFormatEnvVar = App::getEnv('_APP_SYSTEM_RESPONSE_FORMAT', ''); - $responseFormatHeader = $request->getHeader('x-appwrite-response-format', ''); - $responseFormat = empty($responseFormatHeader) ? $responseFormatEnvVar : $responseFormatHeader; - if (empty($responseFormat) || ($filter = mapResponseFormatToClass($responseFormat)) == null) { - throw new Exception('No filter available for response format : '.$responseFormat, 404); - } else { - Response::setFilter($filter); + $responseFormat = $request->getHeader('x-appwrite-response-format', App::getEnv('_APP_SYSTEM_RESPONSE_FORMAT', '')); + switch($responseFormat) { + case version_compare ($responseFormat , '0.6.2', '=<') : + Response::setFilter(new V06()); + break; + default: + throw new Exception('No filter available for response format : '.$responseFormat, 404); } + /* * Security Headers From f2e98d3e8a2ab314f34e36a774cd11ee54d740c7 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Fri, 1 Jan 2021 09:57:13 +0200 Subject: [PATCH 051/230] Reduce travis wait time --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ea3d9573ba..3e729a988a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,7 +32,7 @@ before_install: install: - docker --version - docker-compose up -d -- sleep 90 +- sleep 10 script: - docker ps From 9a1a88d9165582c151a2fbde5820c8dc930b1e74 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Fri, 1 Jan 2021 10:34:34 +0200 Subject: [PATCH 052/230] Added debug for waiting function --- tests/e2e/Services/Functions/FunctionsCustomServerTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php index f44f121a01..f5ca6b2e60 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php @@ -598,7 +598,7 @@ class FunctionsCustomServerTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders())); - if($executions['body']['executions'][0]['status'] === 'failed') { + if($executions['body']['executions'][0]['status'] !== 'completed') { var_dump($executions['body']['executions'][0]); } From 0e10137101c1a297a450b62e14001151f49ddb37 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Fri, 1 Jan 2021 10:34:44 +0200 Subject: [PATCH 053/230] Reduce mail wait time --- tests/e2e/Scopes/Scope.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/Scopes/Scope.php b/tests/e2e/Scopes/Scope.php index fae34a87fb..9de1f19417 100644 --- a/tests/e2e/Scopes/Scope.php +++ b/tests/e2e/Scopes/Scope.php @@ -33,7 +33,7 @@ abstract class Scope extends TestCase protected function getLastEmail():array { - sleep(10); + sleep(5); $emails = json_decode(file_get_contents('http://maildev/email'), true); From 40c7910dd8fbd7cec3ad108d8e666a2899ad2a78 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Fri, 1 Jan 2021 10:52:08 +0200 Subject: [PATCH 054/230] Debug failed functions --- tests/e2e/Services/Functions/FunctionsCustomServerTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php index f5ca6b2e60..2fe2e7d58d 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php @@ -599,6 +599,7 @@ class FunctionsCustomServerTest extends Scope ], $this->getHeaders())); if($executions['body']['executions'][0]['status'] !== 'completed') { + var_dump($env); var_dump($executions['body']['executions'][0]); } From c83efa9db808ebb89c9648856b88349e34d1515e Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Fri, 1 Jan 2021 10:57:38 +0200 Subject: [PATCH 055/230] Updated timeout test --- .../Functions/FunctionsCustomServerTest.php | 2 +- tests/resources/functions/timeout.tar.gz | Bin 168 -> 166 bytes tests/resources/functions/timeout/index.php | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php index 2fe2e7d58d..a319f6ae27 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php @@ -683,7 +683,7 @@ class FunctionsCustomServerTest extends Scope $executionId = $execution['body']['$id'] ?? ''; $this->assertEquals(201, $execution['headers']['status-code']); - sleep(15); + sleep(7); $executions = $this->client->call(Client::METHOD_GET, '/functions/'.$functionId.'/executions', array_merge([ 'content-type' => 'application/json', diff --git a/tests/resources/functions/timeout.tar.gz b/tests/resources/functions/timeout.tar.gz index 16a2bec08bd936e2d6e0f9a864f409252763dcf5..d1c7c03b9e59c8043f7455f94d39f15e7266f935 100644 GIT binary patch literal 166 zcmb2|=3oE;Cg!&nPjekI5NLh4=C?@XE4AENx1A2A3-V}m@aD40-`{e&X}Yh-$Ny%+ zX-twuA-Y}Jn;zVW*_=A}{H>ORIoI#`{1u4OUZTB!mcaGIJKux4_Psuq{ypw&{ghSy z)1CLMEb%#dZwAx1Yj)@M$39uV)!6d?Ghz7;&wu8ZTmD=nb6z!TagP ziE0xR<0EID+^Mso&vf_t$C0lttO&k%;Yl6GR^zbc@n>fQ+viwi`(EF6cysmoXZEYs zd^?_NGd**Y8g2#U!{}C^my}zT%@LKI7=6^Q-uUe_ci~LnQW+H4JUstUNb_|Tj P-_3B%bUrtO1_J{C`sPY2 diff --git a/tests/resources/functions/timeout/index.php b/tests/resources/functions/timeout/index.php index 83cb8e1b56..8dfa09e88b 100644 --- a/tests/resources/functions/timeout/index.php +++ b/tests/resources/functions/timeout/index.php @@ -1,3 +1,3 @@ Date: Fri, 1 Jan 2021 11:01:18 +0200 Subject: [PATCH 056/230] Removed unrequired sleeps --- tests/e2e/Services/Account/AccountBase.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/e2e/Services/Account/AccountBase.php b/tests/e2e/Services/Account/AccountBase.php index 7bd96682d4..16c8926a7a 100644 --- a/tests/e2e/Services/Account/AccountBase.php +++ b/tests/e2e/Services/Account/AccountBase.php @@ -49,8 +49,6 @@ trait AccountBase $this->assertEquals($response['headers']['status-code'], 409); - sleep(5); - return [ 'id' => $id, 'email' => $email, @@ -64,7 +62,6 @@ trait AccountBase */ public function testCreateAccountSession($data):array { - sleep(10); $email = $data['email'] ?? ''; $password = $data['password'] ?? ''; From 8017cfbd53d8750f3064369179b2e45e705ee83d Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Fri, 1 Jan 2021 11:04:30 +0200 Subject: [PATCH 057/230] removed docker cache comments --- .travis.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3e729a988a..1eb92182f8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,16 +19,6 @@ before_install: - echo '{"experimental":"enabled"}' | sudo tee $HOME/.docker/config.json - sudo service docker start -# cache: -# directories: -# - docker_images - -# before_install: -# - docker load -i docker_images/images.tar || true - -# before_cache: -# - docker save -o docker_images/images.tar appwrite_appwrite - install: - docker --version - docker-compose up -d From 0947490cddcd73e32721796a825ebedc5494597c Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Fri, 1 Jan 2021 11:56:53 +0200 Subject: [PATCH 058/230] Updated functions waiting times --- tests/e2e/Services/Functions/FunctionsCustomServerTest.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php index a319f6ae27..5a8c1c89bc 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php @@ -455,6 +455,8 @@ class FunctionsCustomServerTest extends Scope public function testENVS():array { + sleep(20); + /** * Test for SUCCESS */ @@ -591,7 +593,7 @@ class FunctionsCustomServerTest extends Scope $executionId = $execution['body']['$id'] ?? ''; $this->assertEquals(201, $execution['headers']['status-code']); - sleep(15); + sleep(5); $executions = $this->client->call(Client::METHOD_GET, '/functions/'.$functionId.'/executions', array_merge([ 'content-type' => 'application/json', From 5ec8bcff4c578e8ab2c84bee2f09dbbe2b54cb60 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Fri, 1 Jan 2021 12:03:18 +0200 Subject: [PATCH 059/230] Fixed audit logs test --- tests/e2e/Services/Account/AccountBase.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/e2e/Services/Account/AccountBase.php b/tests/e2e/Services/Account/AccountBase.php index 16c8926a7a..5476e04552 100644 --- a/tests/e2e/Services/Account/AccountBase.php +++ b/tests/e2e/Services/Account/AccountBase.php @@ -288,7 +288,7 @@ trait AccountBase $this->assertNotEmpty($response['body']['logs']); $this->assertCount(2, $response['body']['logs']); - $this->assertEquals('account.sessions.create', $response['body']['logs'][0]['event']); + $this->assertContains($response['body']['logs'][0]['event'], ['account.create', 'account.sessions.create']); $this->assertEquals($response['body']['logs'][0]['ip'], filter_var($response['body']['logs'][0]['ip'], FILTER_VALIDATE_IP)); $this->assertIsNumeric($response['body']['logs'][0]['time']); @@ -298,7 +298,7 @@ trait AccountBase $this->assertEquals('browser', $response['body']['logs'][0]['clientType']); $this->assertEquals('Chrome', $response['body']['logs'][0]['clientName']); - $this->assertEquals('CH', $response['body']['logs'][0]['clientCode']); // FIXME (v1) key name should be camelcase + $this->assertEquals('CH', $response['body']['logs'][0]['clientCode']); $this->assertEquals('70.0', $response['body']['logs'][0]['clientVersion']); $this->assertEquals('Blink', $response['body']['logs'][0]['clientEngine']); @@ -310,7 +310,7 @@ trait AccountBase $this->assertEquals('--', $response['body']['logs'][0]['countryCode']); $this->assertEquals('Unknown', $response['body']['logs'][0]['countryName']); - $this->assertEquals('account.create', $response['body']['logs'][1]['event']); + $this->assertContains($response['body']['logs'][1]['event'], ['account.create', 'account.sessions.create']); $this->assertEquals($response['body']['logs'][1]['ip'], filter_var($response['body']['logs'][1]['ip'], FILTER_VALIDATE_IP)); $this->assertIsNumeric($response['body']['logs'][1]['time']); @@ -320,7 +320,7 @@ trait AccountBase $this->assertEquals('browser', $response['body']['logs'][1]['clientType']); $this->assertEquals('Chrome', $response['body']['logs'][1]['clientName']); - $this->assertEquals('CH', $response['body']['logs'][1]['clientCode']); // FIXME (v1) key name should be camelcase + $this->assertEquals('CH', $response['body']['logs'][1]['clientCode']); $this->assertEquals('70.0', $response['body']['logs'][1]['clientVersion']); $this->assertEquals('Blink', $response['body']['logs'][1]['clientEngine']); From bc3ffd9df80e9e5f54b45d97d0747197be623b34 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Fri, 1 Jan 2021 16:09:04 +0200 Subject: [PATCH 060/230] Updated sleep time --- tests/e2e/Scopes/Scope.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/Scopes/Scope.php b/tests/e2e/Scopes/Scope.php index 9de1f19417..fae34a87fb 100644 --- a/tests/e2e/Scopes/Scope.php +++ b/tests/e2e/Scopes/Scope.php @@ -33,7 +33,7 @@ abstract class Scope extends TestCase protected function getLastEmail():array { - sleep(5); + sleep(10); $emails = json_decode(file_get_contents('http://maildev/email'), true); From 48534943669d06f4c3aceee59d5c4abd5d3a7281 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Fri, 1 Jan 2021 16:36:34 +0200 Subject: [PATCH 061/230] Debug docker status --- .../Functions/FunctionsCustomServerTest.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php index 5a8c1c89bc..1e61a40a97 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php @@ -455,8 +455,25 @@ class FunctionsCustomServerTest extends Scope public function testENVS():array { + + $stdout = ''; + $stderr = ''; + + $exitCode = Console::execute('docker ps --all' + , '', $stdout, $stderr, 30); + + var_dump($stdout); + sleep(20); + $stdout = ''; + $stderr = ''; + + $exitCode = Console::execute('docker ps --all' + , '', $stdout, $stderr, 30); + + var_dump($stdout); + /** * Test for SUCCESS */ From 3d61ea3a04e360c9fce0cb0c55b2262351164b3d Mon Sep 17 00:00:00 2001 From: kodumbeats Date: Thu, 31 Dec 2020 16:30:14 -0500 Subject: [PATCH 062/230] add component to toggle visibility of secrets --- gulpfile.js | 1 + public/dist/scripts/app-all.js | 2 +- public/dist/scripts/app.js | 2 +- public/scripts/views/forms/show-secret.js | 32 +++++++++++++++++++++++ 4 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 public/scripts/views/forms/show-secret.js diff --git a/gulpfile.js b/gulpfile.js index 04196ccf11..7e8ae0d02c 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -56,6 +56,7 @@ const configApp = { 'public/scripts/views/forms/remove.js', 'public/scripts/views/forms/run.js', 'public/scripts/views/forms/select-all.js', + 'public/scripts/views/forms/show-secret.js', 'public/scripts/views/forms/switch.js', 'public/scripts/views/forms/tags.js', 'public/scripts/views/forms/text-count.js', diff --git a/public/dist/scripts/app-all.js b/public/dist/scripts/app-all.js index 2bca538f4b..c11800c03a 100644 --- a/public/dist/scripts/app-all.js +++ b/public/dist/scripts/app-all.js @@ -2331,7 +2331,7 @@ score+=(variationCount-1)*10;return parseInt(score);};var callback=function(){va if(rtl.isRTL(content)){paragraph.style.direction='rtl';paragraph.style.textAlign='right';} else{paragraph.style.direction='ltr';paragraph.style.textAlign='left';} last=paragraph;}};var santize=function(e){clean(e);alignText(e);};element.addEventListener("change",function(){editor.content.innerHTML=markdown.render(element.value);alignText();});editor.content.setAttribute("placeholder",element.placeholder);editor.content.innerHTML=markdown.render(element.value);editor.content.tabIndex=0;alignText();editor.content.onkeydown=function preventTab(event){if(event.which===9){event.preventDefault();if(document.activeElement){var focussable=Array.prototype.filter.call(document.querySelectorAll('a:not([disabled]), button:not([disabled]), select:not([disabled]), input[type=text]:not([disabled]), input[type=checkbox]:not([disabled]), [tabindex]:not([disabled]):not([tabindex="-1"])'),function(element){return(element.offsetWidth>0||element.offsetHeight>0||element===document.activeElement);});var index=focussable.indexOf(document.activeElement);if(index>-1){if(event.shiftKey){var prevElement=focussable[index-1]||focussable[focussable.length-1];prevElement.focus();}else{var nextElement=focussable[index+1]||focussable[0];nextElement.focus();}}}}};div.addEventListener("paste",santize);div.addEventListener("drop",santize);}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-forms-remove",controller:function(element){Array.prototype.slice.call(element.querySelectorAll("[data-remove]")).map(function(obj){obj.addEventListener("click",function(){element.parentNode.removeChild(element);});});}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-forms-run",repeat:false,controller:function(element,expression,container){let action=expression.parse(element.dataset["formsRun"]||'');element.addEventListener('click',function(){return container.path(action)();});}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-forms-select-all",controller:function(element){let select=document.createElement("button");let unselect=document.createElement("button");select.textContent='Select All';unselect.textContent='Unselect All';select.classList.add('link');select.classList.add('margin-top-tiny');select.classList.add('margin-start-small');select.classList.add('text-size-small');select.classList.add('pull-end');unselect.classList.add('link');unselect.classList.add('margin-top-tiny');unselect.classList.add('margin-start-small');unselect.classList.add('text-size-small');unselect.classList.add('pull-end');select.type='button';unselect.type='button';element.parentNode.insertBefore(select,element);element.parentNode.insertBefore(unselect,element);select.addEventListener('click',function(){let checkboxes=document.querySelectorAll("input[type='checkbox']");for(var i=0;i0){array.push(add.value);add.value="";element.value=JSON.stringify(array);check();if(event.key!=="Tab"){event.preventDefault();}} if((event.key==="Backspace"||event.key==="Delete")&&add.value===""){array.splice(-1,1);element.value=JSON.stringify(array);check();} return false;};let check=function(){try{array=JSON.parse(element.value)||[];}catch(error){array=[];} diff --git a/public/dist/scripts/app.js b/public/dist/scripts/app.js index 63fed54b1b..756463ccd0 100644 --- a/public/dist/scripts/app.js +++ b/public/dist/scripts/app.js @@ -376,7 +376,7 @@ score+=(variationCount-1)*10;return parseInt(score);};var callback=function(){va if(rtl.isRTL(content)){paragraph.style.direction='rtl';paragraph.style.textAlign='right';} else{paragraph.style.direction='ltr';paragraph.style.textAlign='left';} last=paragraph;}};var santize=function(e){clean(e);alignText(e);};element.addEventListener("change",function(){editor.content.innerHTML=markdown.render(element.value);alignText();});editor.content.setAttribute("placeholder",element.placeholder);editor.content.innerHTML=markdown.render(element.value);editor.content.tabIndex=0;alignText();editor.content.onkeydown=function preventTab(event){if(event.which===9){event.preventDefault();if(document.activeElement){var focussable=Array.prototype.filter.call(document.querySelectorAll('a:not([disabled]), button:not([disabled]), select:not([disabled]), input[type=text]:not([disabled]), input[type=checkbox]:not([disabled]), [tabindex]:not([disabled]):not([tabindex="-1"])'),function(element){return(element.offsetWidth>0||element.offsetHeight>0||element===document.activeElement);});var index=focussable.indexOf(document.activeElement);if(index>-1){if(event.shiftKey){var prevElement=focussable[index-1]||focussable[focussable.length-1];prevElement.focus();}else{var nextElement=focussable[index+1]||focussable[0];nextElement.focus();}}}}};div.addEventListener("paste",santize);div.addEventListener("drop",santize);}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-forms-remove",controller:function(element){Array.prototype.slice.call(element.querySelectorAll("[data-remove]")).map(function(obj){obj.addEventListener("click",function(){element.parentNode.removeChild(element);});});}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-forms-run",repeat:false,controller:function(element,expression,container){let action=expression.parse(element.dataset["formsRun"]||'');element.addEventListener('click',function(){return container.path(action)();});}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-forms-select-all",controller:function(element){let select=document.createElement("button");let unselect=document.createElement("button");select.textContent='Select All';unselect.textContent='Unselect All';select.classList.add('link');select.classList.add('margin-top-tiny');select.classList.add('margin-start-small');select.classList.add('text-size-small');select.classList.add('pull-end');unselect.classList.add('link');unselect.classList.add('margin-top-tiny');unselect.classList.add('margin-start-small');unselect.classList.add('text-size-small');unselect.classList.add('pull-end');select.type='button';unselect.type='button';element.parentNode.insertBefore(select,element);element.parentNode.insertBefore(unselect,element);select.addEventListener('click',function(){let checkboxes=document.querySelectorAll("input[type='checkbox']");for(var i=0;i0){array.push(add.value);add.value="";element.value=JSON.stringify(array);check();if(event.key!=="Tab"){event.preventDefault();}} if((event.key==="Backspace"||event.key==="Delete")&&add.value===""){array.splice(-1,1);element.value=JSON.stringify(array);check();} return false;};let check=function(){try{array=JSON.parse(element.value)||[];}catch(error){array=[];} diff --git a/public/scripts/views/forms/show-secret.js b/public/scripts/views/forms/show-secret.js new file mode 100644 index 0000000000..6a870979ce --- /dev/null +++ b/public/scripts/views/forms/show-secret.js @@ -0,0 +1,32 @@ +(function(window) { + "use strict"; + + window.ls.container.get("view").add({ + selector: "data-forms-show-secret", + controller: function(element, document) { + let button = document.createElement("a"); + button.type = "button"; + button.className = "icon-eye"; + button.innerHTML = "show/hide"; + button.style.cursor = "pointer"; + button.style.fontSize = "10px"; + + element.insertAdjacentElement("beforebegin", button); + + const toggle = function(event) { + switch (element.type) { //TODO@kodumbeats: add closed-eye icon to public/styles/icons.less and toggle onClick + case "password": + element.type = "text"; + break; + case "text": + element.type = "password"; + break; + default: + console.warn("data-forms-show-secret: element.type NOT text NOR password") + }; + }; + + button.addEventListener("click", toggle); + } + }); + })(window); From 5573613bacd7433ae857b1cbb06c4bc8f74c49a6 Mon Sep 17 00:00:00 2001 From: kodumbeats Date: Thu, 31 Dec 2020 16:30:53 -0500 Subject: [PATCH 063/230] hide oAuth keys by default --- app/views/console/users/index.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/console/users/index.phtml b/app/views/console/users/index.phtml index 4874083288..90b8f54007 100644 --- a/app/views/console/users/index.phtml +++ b/app/views/console/users/index.phtml @@ -339,7 +339,7 @@ $providers = $this->getParam('providers', []); - + From 5d920963a4e912cabe8c8c377e53f06728981d37 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Fri, 1 Jan 2021 17:01:09 +0200 Subject: [PATCH 064/230] Debug tests --- docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.yml b/docker-compose.yml index 701d1e240c..d3d021fd7e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -55,6 +55,7 @@ services: - traefik.http.routers.appwrite-secure.rule=PathPrefix(`/`) - traefik.http.routers.appwrite-secure.tls=true volumes: + - /var/run/docker.sock:/var/run/docker.sock - appwrite-uploads:/storage/uploads:rw - appwrite-cache:/storage/cache:rw - appwrite-config:/storage/config:rw From 5d45eebf221047207fb66f6baa4ef921ab69bb4d Mon Sep 17 00:00:00 2001 From: kodumbeats Date: Fri, 1 Jan 2021 12:54:59 -0500 Subject: [PATCH 065/230] allow toggle for secret placed above/below input --- public/dist/scripts/app-all.js | 3 +- public/dist/scripts/app.js | 3 +- public/scripts/views/forms/show-secret.js | 64 +++++++++++++---------- 3 files changed, 39 insertions(+), 31 deletions(-) diff --git a/public/dist/scripts/app-all.js b/public/dist/scripts/app-all.js index c11800c03a..7f9841bb91 100644 --- a/public/dist/scripts/app-all.js +++ b/public/dist/scripts/app-all.js @@ -2331,7 +2331,8 @@ score+=(variationCount-1)*10;return parseInt(score);};var callback=function(){va if(rtl.isRTL(content)){paragraph.style.direction='rtl';paragraph.style.textAlign='right';} else{paragraph.style.direction='ltr';paragraph.style.textAlign='left';} last=paragraph;}};var santize=function(e){clean(e);alignText(e);};element.addEventListener("change",function(){editor.content.innerHTML=markdown.render(element.value);alignText();});editor.content.setAttribute("placeholder",element.placeholder);editor.content.innerHTML=markdown.render(element.value);editor.content.tabIndex=0;alignText();editor.content.onkeydown=function preventTab(event){if(event.which===9){event.preventDefault();if(document.activeElement){var focussable=Array.prototype.filter.call(document.querySelectorAll('a:not([disabled]), button:not([disabled]), select:not([disabled]), input[type=text]:not([disabled]), input[type=checkbox]:not([disabled]), [tabindex]:not([disabled]):not([tabindex="-1"])'),function(element){return(element.offsetWidth>0||element.offsetHeight>0||element===document.activeElement);});var index=focussable.indexOf(document.activeElement);if(index>-1){if(event.shiftKey){var prevElement=focussable[index-1]||focussable[focussable.length-1];prevElement.focus();}else{var nextElement=focussable[index+1]||focussable[0];nextElement.focus();}}}}};div.addEventListener("paste",santize);div.addEventListener("drop",santize);}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-forms-remove",controller:function(element){Array.prototype.slice.call(element.querySelectorAll("[data-remove]")).map(function(obj){obj.addEventListener("click",function(){element.parentNode.removeChild(element);});});}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-forms-run",repeat:false,controller:function(element,expression,container){let action=expression.parse(element.dataset["formsRun"]||'');element.addEventListener('click',function(){return container.path(action)();});}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-forms-select-all",controller:function(element){let select=document.createElement("button");let unselect=document.createElement("button");select.textContent='Select All';unselect.textContent='Unselect All';select.classList.add('link');select.classList.add('margin-top-tiny');select.classList.add('margin-start-small');select.classList.add('text-size-small');select.classList.add('pull-end');unselect.classList.add('link');unselect.classList.add('margin-top-tiny');unselect.classList.add('margin-start-small');unselect.classList.add('text-size-small');unselect.classList.add('pull-end');select.type='button';unselect.type='button';element.parentNode.insertBefore(select,element);element.parentNode.insertBefore(unselect,element);select.addEventListener('click',function(){let checkboxes=document.querySelectorAll("input[type='checkbox']");for(var i=0;i0){array.push(add.value);add.value="";element.value=JSON.stringify(array);check();if(event.key!=="Tab"){event.preventDefault();}} if((event.key==="Backspace"||event.key==="Delete")&&add.value===""){array.splice(-1,1);element.value=JSON.stringify(array);check();} return false;};let check=function(){try{array=JSON.parse(element.value)||[];}catch(error){array=[];} diff --git a/public/dist/scripts/app.js b/public/dist/scripts/app.js index 756463ccd0..aaf4d119b9 100644 --- a/public/dist/scripts/app.js +++ b/public/dist/scripts/app.js @@ -376,7 +376,8 @@ score+=(variationCount-1)*10;return parseInt(score);};var callback=function(){va if(rtl.isRTL(content)){paragraph.style.direction='rtl';paragraph.style.textAlign='right';} else{paragraph.style.direction='ltr';paragraph.style.textAlign='left';} last=paragraph;}};var santize=function(e){clean(e);alignText(e);};element.addEventListener("change",function(){editor.content.innerHTML=markdown.render(element.value);alignText();});editor.content.setAttribute("placeholder",element.placeholder);editor.content.innerHTML=markdown.render(element.value);editor.content.tabIndex=0;alignText();editor.content.onkeydown=function preventTab(event){if(event.which===9){event.preventDefault();if(document.activeElement){var focussable=Array.prototype.filter.call(document.querySelectorAll('a:not([disabled]), button:not([disabled]), select:not([disabled]), input[type=text]:not([disabled]), input[type=checkbox]:not([disabled]), [tabindex]:not([disabled]):not([tabindex="-1"])'),function(element){return(element.offsetWidth>0||element.offsetHeight>0||element===document.activeElement);});var index=focussable.indexOf(document.activeElement);if(index>-1){if(event.shiftKey){var prevElement=focussable[index-1]||focussable[focussable.length-1];prevElement.focus();}else{var nextElement=focussable[index+1]||focussable[0];nextElement.focus();}}}}};div.addEventListener("paste",santize);div.addEventListener("drop",santize);}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-forms-remove",controller:function(element){Array.prototype.slice.call(element.querySelectorAll("[data-remove]")).map(function(obj){obj.addEventListener("click",function(){element.parentNode.removeChild(element);});});}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-forms-run",repeat:false,controller:function(element,expression,container){let action=expression.parse(element.dataset["formsRun"]||'');element.addEventListener('click',function(){return container.path(action)();});}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-forms-select-all",controller:function(element){let select=document.createElement("button");let unselect=document.createElement("button");select.textContent='Select All';unselect.textContent='Unselect All';select.classList.add('link');select.classList.add('margin-top-tiny');select.classList.add('margin-start-small');select.classList.add('text-size-small');select.classList.add('pull-end');unselect.classList.add('link');unselect.classList.add('margin-top-tiny');unselect.classList.add('margin-start-small');unselect.classList.add('text-size-small');unselect.classList.add('pull-end');select.type='button';unselect.type='button';element.parentNode.insertBefore(select,element);element.parentNode.insertBefore(unselect,element);select.addEventListener('click',function(){let checkboxes=document.querySelectorAll("input[type='checkbox']");for(var i=0;i0){array.push(add.value);add.value="";element.value=JSON.stringify(array);check();if(event.key!=="Tab"){event.preventDefault();}} if((event.key==="Backspace"||event.key==="Delete")&&add.value===""){array.splice(-1,1);element.value=JSON.stringify(array);check();} return false;};let check=function(){try{array=JSON.parse(element.value)||[];}catch(error){array=[];} diff --git a/public/scripts/views/forms/show-secret.js b/public/scripts/views/forms/show-secret.js index 6a870979ce..41c0952830 100644 --- a/public/scripts/views/forms/show-secret.js +++ b/public/scripts/views/forms/show-secret.js @@ -1,32 +1,38 @@ -(function(window) { - "use strict"; +(function (window) { + "use strict"; - window.ls.container.get("view").add({ - selector: "data-forms-show-secret", - controller: function(element, document) { - let button = document.createElement("a"); - button.type = "button"; - button.className = "icon-eye"; - button.innerHTML = "show/hide"; - button.style.cursor = "pointer"; - button.style.fontSize = "10px"; - + window.ls.container.get("view").add({ + selector: "data-forms-show-secret", + controller: function (element, document) { + let button = document.createElement("a"); + button.type = "button"; + button.className = "icon-eye"; + button.innerHTML = "show/hide"; + button.style.cursor = "pointer"; + button.style.fontSize = "10px"; + + if (element.attributes.getNamedItem("data-forms-show-secret-above")) { element.insertAdjacentElement("beforebegin", button); - - const toggle = function(event) { - switch (element.type) { //TODO@kodumbeats: add closed-eye icon to public/styles/icons.less and toggle onClick - case "password": - element.type = "text"; - break; - case "text": - element.type = "password"; - break; - default: - console.warn("data-forms-show-secret: element.type NOT text NOR password") - }; - }; - - button.addEventListener("click", toggle); + } else { + element.parentNode.insertBefore(button, element.nextSibling); } - }); - })(window); + + const toggle = function (event) { + switch (element.type) { + case "password": + element.type = "text"; + break; + case "text": + element.type = "password"; + break; + default: + console.warn( + "data-forms-show-secret: element.type NOT text NOR password" + ); + } + }; + + button.addEventListener("click", toggle); + }, + }); +})(window); From 27706aa8c827d9f046c9233b53dbf69f798ee226 Mon Sep 17 00:00:00 2001 From: kodumbeats Date: Fri, 1 Jan 2021 12:55:49 -0500 Subject: [PATCH 066/230] add toggle to reveal http auth password --- app/views/console/tasks/index.phtml | 4 ++-- app/views/console/webhooks/index.phtml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/console/tasks/index.phtml b/app/views/console/tasks/index.phtml index b03e0200f9..3d27971d45 100644 --- a/app/views/console/tasks/index.phtml +++ b/app/views/console/tasks/index.phtml @@ -189,7 +189,7 @@
- +
@@ -335,7 +335,7 @@
- +
diff --git a/app/views/console/webhooks/index.phtml b/app/views/console/webhooks/index.phtml index 47c7d30f01..6625bf7a45 100644 --- a/app/views/console/webhooks/index.phtml +++ b/app/views/console/webhooks/index.phtml @@ -104,7 +104,7 @@ $events = array_keys($this->getParam('events', []));
- +
@@ -220,7 +220,7 @@ $events = array_keys($this->getParam('events', []));
- +
From 04f4f934aa1777a43c6526b892f9c208271ea975 Mon Sep 17 00:00:00 2001 From: kodumbeats Date: Fri, 1 Jan 2021 12:55:57 -0500 Subject: [PATCH 067/230] move toggle above input --- app/views/console/users/index.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/console/users/index.phtml b/app/views/console/users/index.phtml index 90b8f54007..9d97b05037 100644 --- a/app/views/console/users/index.phtml +++ b/app/views/console/users/index.phtml @@ -339,7 +339,7 @@ $providers = $this->getParam('providers', []); - + From 94adabe828f9e9f3e06fa4830f01ec9e61f8f791 Mon Sep 17 00:00:00 2001 From: kodumbeats Date: Fri, 1 Jan 2021 13:02:54 -0500 Subject: [PATCH 068/230] toggle visibility of secrets --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index 6185144417..cf584ab2a1 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -51,6 +51,7 @@ - Upgraded Influxdb Docker image to version 1.8 (alpine) - Added option to disable mail sending by setting empty SMTP host - Upgraded installation script ([#490](https://github.com/appwrite/appwrite/issues/490)) +- Added toggle to hide/show secret keys and passwords inside the dashboard (@kodumbeats, [#535](https://github.com/appwrite/appwrite/issues/535)) ## Breaking Changes (Read before upgrading!) - **Deprecated** `first` and `last` query params for documents list route in the database API From 3d412640c60610a550d4f059f8af245e6ab6abab Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Fri, 1 Jan 2021 21:35:10 +0200 Subject: [PATCH 069/230] Updated logs --- .../e2e/Services/Functions/FunctionsCustomServerTest.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php index 1e61a40a97..8c88ccdec5 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php @@ -459,18 +459,16 @@ class FunctionsCustomServerTest extends Scope $stdout = ''; $stderr = ''; - $exitCode = Console::execute('docker ps --all' - , '', $stdout, $stderr, 30); + $exitCode = Console::execute('docker-compose logs appwrite-worker-functions', '', $stdout, $stderr, 30); var_dump($stdout); - + sleep(20); $stdout = ''; $stderr = ''; - $exitCode = Console::execute('docker ps --all' - , '', $stdout, $stderr, 30); + $exitCode = Console::execute('docker-compose logs appwrite-worker-functions', '', $stdout, $stderr, 30); var_dump($stdout); From 29b7d0c23d7b9be5673a14e08ad3a40457886244 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sat, 2 Jan 2021 00:34:31 +0200 Subject: [PATCH 070/230] Updated logs --- tests/e2e/Services/Functions/FunctionsCustomServerTest.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php index 8c88ccdec5..a9961b4455 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php @@ -459,18 +459,20 @@ class FunctionsCustomServerTest extends Scope $stdout = ''; $stderr = ''; - $exitCode = Console::execute('docker-compose logs appwrite-worker-functions', '', $stdout, $stderr, 30); + $exitCode = Console::execute('docker logs appwrite-worker-functions', '', $stdout, $stderr, 30); var_dump($stdout); + var_dump($stderr); sleep(20); $stdout = ''; $stderr = ''; - $exitCode = Console::execute('docker-compose logs appwrite-worker-functions', '', $stdout, $stderr, 30); + $exitCode = Console::execute('docker logs appwrite-worker-functions', '', $stdout, $stderr, 30); var_dump($stdout); + var_dump($stderr); /** * Test for SUCCESS From 81d4c12688cecc05afe9ec2bf433252864e407c9 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sat, 2 Jan 2021 01:11:58 +0200 Subject: [PATCH 071/230] Updated logs --- tests/e2e/Services/Functions/FunctionsCustomServerTest.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php index a9961b4455..5dff06c9cc 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php @@ -461,16 +461,18 @@ class FunctionsCustomServerTest extends Scope $exitCode = Console::execute('docker logs appwrite-worker-functions', '', $stdout, $stderr, 30); + var_dump('-------------------------'); var_dump($stdout); var_dump($stderr); - sleep(20); + sleep(60); $stdout = ''; $stderr = ''; $exitCode = Console::execute('docker logs appwrite-worker-functions', '', $stdout, $stderr, 30); + var_dump('-------------------------'); var_dump($stdout); var_dump($stderr); From 73e08974e48b5b8d276300cba2d0340f861240a0 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sat, 2 Jan 2021 01:48:10 +0200 Subject: [PATCH 072/230] Build function locally on dev mode --- app/config/environments.php | 8 ++++++++ app/workers/functions.php | 7 ++++++- docker-compose.yml | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/app/config/environments.php b/app/config/environments.php index 11773eed4f..9119bee335 100644 --- a/app/config/environments.php +++ b/app/config/environments.php @@ -6,6 +6,7 @@ return [ 'version' => '14.5', 'base' => 'node:14.5-alpine', 'image' => 'appwrite/env-node-14.5:1.0.0', + 'build' => '/usr/src/code/docker/environments/node-14.5', 'logo' => 'node.png', ], 'php-7.4' => [ @@ -13,6 +14,7 @@ return [ 'version' => '7.4', 'base' => 'php:7.4-cli-alpine', 'image' => 'appwrite/env-php-7.4:1.0.0', + 'build' => '/usr/src/code/docker/environments/php-7.4', 'logo' => 'php.png', ], 'php-8.0' => [ @@ -20,6 +22,7 @@ return [ 'version' => '8.0', 'base' => 'php:8.0-cli-alpine', 'image' => 'appwrite/env-php-8.0:1.0.0', + 'build' => '/usr/src/code/docker/environments/php-8.0', 'logo' => 'php.png', ], 'ruby-2.7' => [ @@ -27,6 +30,7 @@ return [ 'version' => '2.7', 'base' => 'ruby:2.7-alpine', 'image' => 'appwrite/env-ruby-2.7:1.0.2', + 'build' => '/usr/src/code/docker/environments/ruby-2.7', 'logo' => 'ruby.png', ], 'python-3.8' => [ @@ -34,6 +38,7 @@ return [ 'version' => '3.8', 'base' => 'python:3.8-alpine', 'image' => 'appwrite/env-python-3.8:1.0.0', + 'build' => '/usr/src/code/docker/environments/python-3.8', 'logo' => 'python.png', ], 'deno-1.2' => [ @@ -41,6 +46,7 @@ return [ 'version' => '1.2', 'base' => 'hayd/deno:alpine-1.2.0', 'image' => 'appwrite/env-deno-1.2:1.0.0', + 'build' => '/usr/src/code/docker/environments/deno-1.2', 'logo' => 'deno.png', ], 'deno-1.5' => [ @@ -48,6 +54,7 @@ return [ 'version' => '1.5', 'base' => 'hayd/deno:alpine-1.5.0', 'image' => 'appwrite/env-deno-1.5:1.0.0', + 'build' => '/usr/src/code/docker/environments/deno-1.5', 'logo' => 'deno.png', ], // 'dart-2.8' => [ @@ -55,6 +62,7 @@ return [ // 'version' => '2.8', // 'base' => 'google/dart:2.8', // 'image' => 'appwrite/env-dart:2.8', + // 'build' => '/usr/src/code/docker/environments/dart-2.8', // 'logo' => 'dart.png', // ], ]; \ No newline at end of file diff --git a/app/workers/functions.php b/app/workers/functions.php index 510aed0922..37bf303d80 100644 --- a/app/workers/functions.php +++ b/app/workers/functions.php @@ -39,7 +39,12 @@ Co\run(function() use ($environments) { // Warmup: make sure images are ready t Console::info('Warming up '.$environment['name'].' environment...'); - Console::execute('docker pull '.$environment['image'], '', $stdout, $stderr); + if(App::isDevelopment()) { + Console::execute('docker build '.$environment['build'].' -t '.$environment['image'], '', $stdout, $stderr); + } + else { + Console::execute('docker pull '.$environment['image'], '', $stdout, $stderr); + } if(!empty($stdout)) { Console::log($stdout); diff --git a/docker-compose.yml b/docker-compose.yml index d3d021fd7e..f80768dd7c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -269,6 +269,7 @@ services: - appwrite-functions:/storage/functions:rw - /tmp:/tmp:rw - ./app:/usr/src/code/app + - ./docker:/usr/src/code/docker - ./src:/usr/src/code/src depends_on: - redis From c9cd5b848a7f2de04af43b445c0dd5714d63ac7d Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sat, 2 Jan 2021 02:10:13 +0200 Subject: [PATCH 073/230] Updated sleep --- .../Functions/FunctionsCustomServerTest.php | 23 +------------------ 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php index 5dff06c9cc..247b42cf63 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php @@ -455,27 +455,6 @@ class FunctionsCustomServerTest extends Scope public function testENVS():array { - - $stdout = ''; - $stderr = ''; - - $exitCode = Console::execute('docker logs appwrite-worker-functions', '', $stdout, $stderr, 30); - - var_dump('-------------------------'); - var_dump($stdout); - var_dump($stderr); - - sleep(60); - - $stdout = ''; - $stderr = ''; - - $exitCode = Console::execute('docker logs appwrite-worker-functions', '', $stdout, $stderr, 30); - - var_dump('-------------------------'); - var_dump($stdout); - var_dump($stderr); - /** * Test for SUCCESS */ @@ -612,7 +591,7 @@ class FunctionsCustomServerTest extends Scope $executionId = $execution['body']['$id'] ?? ''; $this->assertEquals(201, $execution['headers']['status-code']); - sleep(5); + sleep(20); $executions = $this->client->call(Client::METHOD_GET, '/functions/'.$functionId.'/executions', array_merge([ 'content-type' => 'application/json', From 01b0fcf99ce45543c11fcf7624e1b75b08cff63a Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sat, 2 Jan 2021 08:49:20 +0200 Subject: [PATCH 074/230] updated timeout --- tests/e2e/Services/Functions/FunctionsCustomServerTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php index 247b42cf63..d794cbdd64 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php @@ -683,7 +683,7 @@ class FunctionsCustomServerTest extends Scope $executionId = $execution['body']['$id'] ?? ''; $this->assertEquals(201, $execution['headers']['status-code']); - sleep(7); + sleep(15); $executions = $this->client->call(Client::METHOD_GET, '/functions/'.$functionId.'/executions', array_merge([ 'content-type' => 'application/json', From ad34b275dd7418ebabcaaf7887ef216d5d03cc7f Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Sat, 2 Jan 2021 21:05:21 +0530 Subject: [PATCH 075/230] feat: review comments --- app/controllers/general.php | 15 ++++++++------- app/http.php | 5 ----- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index 316fb85e0c..c56b312357 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -100,14 +100,15 @@ App::init(function ($utopia, $request, $response, $console, $project, $user, $lo * Response format */ $responseFormat = $request->getHeader('x-appwrite-response-format', App::getEnv('_APP_SYSTEM_RESPONSE_FORMAT', '')); - switch($responseFormat) { - case version_compare ($responseFormat , '0.6.2', '=<') : - Response::setFilter(new V06()); - break; - default: - throw new Exception('No filter available for response format : '.$responseFormat, 404); + if (!empty($responseFormat)) { + switch($responseFormat) { + case version_compare ($responseFormat , '0.6.2', '=<') : + Response::setFilter(new V06()); + break; + default: + throw new Exception('No filter available for response format : '.$responseFormat, 400); + } } - /* * Security Headers diff --git a/app/http.php b/app/http.php index c409230418..9e27f21375 100644 --- a/app/http.php +++ b/app/http.php @@ -50,11 +50,6 @@ $http->on('AfterReload', function($serv, $workerId) { $http->on('start', function (Server $http) use ($payloadSize) { - if(empty($responseFormat)) { - Console::error('Missing value for environment variable _APP_SYSTEM_RESPONSE_FORMAT. Exiting ...'); - exit(1); - } - Console::success('Server started succefully (max payload is '.number_format($payloadSize).' bytes)'); Console::info("Master pid {$http->master_pid}, manager pid {$http->manager_pid}"); From d8561d030a3442e5d427fa7aa1b22d2da355928d Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Sat, 2 Jan 2021 21:10:00 +0530 Subject: [PATCH 076/230] feat: added env varible --- .env | 2 +- Dockerfile | 2 +- app/config/variables.php | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.env b/.env index 5484ea858b..ef84b538c0 100644 --- a/.env +++ b/.env @@ -31,4 +31,4 @@ _APP_FUNCTIONS_CPUS=1 _APP_FUNCTIONS_MEMORY=128 _APP_FUNCTIONS_MEMORY_SWAP=128 _APP_MAINTENANCE_INTERVAL=86400 -_APP_SYSTEM_RESPONSE_FORMAT=0.6 \ No newline at end of file +_APP_SYSTEM_RESPONSE_FORMAT=0.7 \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index cc72b5b776..7adeb42a18 100755 --- a/Dockerfile +++ b/Dockerfile @@ -97,7 +97,7 @@ ENV _APP_SERVER=swoole \ _APP_FUNCTIONS_MEMORY_SWAP=128 \ _APP_SETUP=self-hosted \ _APP_VERSION=$VERSION \ - _APP_SYSTEM_RESPONSE_FORMAT=0.6 \ + _APP_SYSTEM_RESPONSE_FORMAT=0.7 \ # 1 Day = 86400 s _APP_MAINTENANCE_INTERVAL=86400 #ENV _APP_SMTP_SECURE '' diff --git a/app/config/variables.php b/app/config/variables.php index 0893dfd252..a0d4ba96c5 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -175,4 +175,10 @@ return [ 'required' => false, 'question' => '', ], + [ + 'name' => '_APP_SYSTEM_RESPONSE_FORMAT', + 'default' => '0.7', + 'required' => false, + 'question' => '', + ], ]; \ No newline at end of file From 92339fe66898e8c7908292d913093c556621f5bf Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Sat, 2 Jan 2021 21:45:14 +0530 Subject: [PATCH 077/230] fix: fix failing tests --- src/Appwrite/Utopia/Response.php | 2 +- tests/unit/Utopia/Filters/V06Test.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Appwrite/Utopia/Response.php b/src/Appwrite/Utopia/Response.php index 16fedaf8e1..9d1773a226 100644 --- a/src/Appwrite/Utopia/Response.php +++ b/src/Appwrite/Utopia/Response.php @@ -359,7 +359,7 @@ class Response extends SwooleResponse * * @return Filter */ - public static function getFilter(): Filter + public static function getFilter(): ?Filter { return self::$filter; } diff --git a/tests/unit/Utopia/Filters/V06Test.php b/tests/unit/Utopia/Filters/V06Test.php index 2db87c8eb7..42b1bba3f2 100644 --- a/tests/unit/Utopia/Filters/V06Test.php +++ b/tests/unit/Utopia/Filters/V06Test.php @@ -9,6 +9,7 @@ use Appwrite\OpenSSL\OpenSSL; use Appwrite\Utopia\Response; use Appwrite\Utopia\Response\Filter\V06; use PHPUnit\Framework\TestCase; +use Utopia\Config\Config; class V06Test extends TestCase { From e499db64eab3a279505ee8114bce63ff5a67a912 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Sat, 2 Jan 2021 21:58:09 +0530 Subject: [PATCH 078/230] fix: fix failing tests --- .env | 2 +- Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.env b/.env index ef84b538c0..5484ea858b 100644 --- a/.env +++ b/.env @@ -31,4 +31,4 @@ _APP_FUNCTIONS_CPUS=1 _APP_FUNCTIONS_MEMORY=128 _APP_FUNCTIONS_MEMORY_SWAP=128 _APP_MAINTENANCE_INTERVAL=86400 -_APP_SYSTEM_RESPONSE_FORMAT=0.7 \ No newline at end of file +_APP_SYSTEM_RESPONSE_FORMAT=0.6 \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 7adeb42a18..cc72b5b776 100755 --- a/Dockerfile +++ b/Dockerfile @@ -97,7 +97,7 @@ ENV _APP_SERVER=swoole \ _APP_FUNCTIONS_MEMORY_SWAP=128 \ _APP_SETUP=self-hosted \ _APP_VERSION=$VERSION \ - _APP_SYSTEM_RESPONSE_FORMAT=0.7 \ + _APP_SYSTEM_RESPONSE_FORMAT=0.6 \ # 1 Day = 86400 s _APP_MAINTENANCE_INTERVAL=86400 #ENV _APP_SMTP_SECURE '' From 83477651e60baa36a9c61efbd8a163cbc9086fcb Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Sat, 2 Jan 2021 22:23:31 +0530 Subject: [PATCH 079/230] fix: fix failing tests --- .env | 2 +- Dockerfile | 2 +- app/controllers/general.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.env b/.env index 5484ea858b..bf61b2fd6d 100644 --- a/.env +++ b/.env @@ -31,4 +31,4 @@ _APP_FUNCTIONS_CPUS=1 _APP_FUNCTIONS_MEMORY=128 _APP_FUNCTIONS_MEMORY_SWAP=128 _APP_MAINTENANCE_INTERVAL=86400 -_APP_SYSTEM_RESPONSE_FORMAT=0.6 \ No newline at end of file +_APP_SYSTEM_RESPONSE_FORMAT=0.6.2 \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index cc72b5b776..f591751706 100755 --- a/Dockerfile +++ b/Dockerfile @@ -97,7 +97,7 @@ ENV _APP_SERVER=swoole \ _APP_FUNCTIONS_MEMORY_SWAP=128 \ _APP_SETUP=self-hosted \ _APP_VERSION=$VERSION \ - _APP_SYSTEM_RESPONSE_FORMAT=0.6 \ + _APP_SYSTEM_RESPONSE_FORMAT=0.6.2 \ # 1 Day = 86400 s _APP_MAINTENANCE_INTERVAL=86400 #ENV _APP_SMTP_SECURE '' diff --git a/app/controllers/general.php b/app/controllers/general.php index c56b312357..ba0a64eb1e 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -102,7 +102,7 @@ App::init(function ($utopia, $request, $response, $console, $project, $user, $lo $responseFormat = $request->getHeader('x-appwrite-response-format', App::getEnv('_APP_SYSTEM_RESPONSE_FORMAT', '')); if (!empty($responseFormat)) { switch($responseFormat) { - case version_compare ($responseFormat , '0.6.2', '=<') : + case version_compare ($responseFormat , '0.6.2', '<=') : Response::setFilter(new V06()); break; default: From 7ed759ba0ee6035362c474aae15aecd04a867377 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sat, 2 Jan 2021 21:45:59 +0200 Subject: [PATCH 080/230] First commit --- .env | 3 +++ Dockerfile | 2 ++ app/config/variables.php | 18 ++++++++++++++++++ app/controllers/api/health.php | 3 ++- app/controllers/api/storage.php | 3 ++- app/tasks/doctor.php | 3 ++- docker-compose.yml | 3 +++ 7 files changed, 32 insertions(+), 3 deletions(-) diff --git a/.env b/.env index f881ca35d3..1277c28eff 100644 --- a/.env +++ b/.env @@ -15,6 +15,9 @@ _APP_DB_PORT=3306 _APP_DB_SCHEMA=appwrite _APP_DB_USER=user _APP_DB_PASS=password +_APP_STORAGE_ANTIVIRUS=enabled +_APP_STORAGE_ANTIVIRUS_HOST=clamav +_APP_STORAGE_ANTIVIRUS_PORT=3310 _APP_INFLUXDB_HOST=influxdb _APP_INFLUXDB_PORT=8086 _APP_STATSD_HOST=telegraf diff --git a/Dockerfile b/Dockerfile index fc7a03f936..9c48f9a4fc 100755 --- a/Dockerfile +++ b/Dockerfile @@ -77,6 +77,8 @@ ENV _APP_SERVER=swoole \ _APP_OPENSSL_KEY_V1=your-secret-key \ _APP_STORAGE_LIMIT=10000000 \ _APP_STORAGE_ANTIVIRUS=enabled \ + _APP_STORAGE_ANTIVIRUS_HOST=clamav \ + _APP_STORAGE_ANTIVIRUS_PORT=3310 \ _APP_REDIS_HOST=redis \ _APP_REDIS_PORT=6379 \ _APP_DB_HOST=mariadb \ diff --git a/app/config/variables.php b/app/config/variables.php index f752e90201..fb32000762 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -139,6 +139,24 @@ return [ 'required' => false, 'question' => '', ], + [ + 'name' => '_APP_STORAGE_ANTIVIRUS', + 'default' => 'enabled', + 'required' => false, + 'question' => '', + ], + [ + 'name' => '_APP_STORAGE_ANTIVIRUS_HOST', + 'default' => 'clamav', + 'required' => false, + 'question' => '', + ], + [ + 'name' => '_APP_STORAGE_ANTIVIRUS_PORT', + 'default' => '3310', + 'required' => false, + 'question' => '', + ], [ 'name' => '_APP_FUNCTIONS_TIMEOUT', 'default' => '900', diff --git a/app/controllers/api/health.php b/app/controllers/api/health.php index c1c9de4755..370b2d0a17 100644 --- a/app/controllers/api/health.php +++ b/app/controllers/api/health.php @@ -256,7 +256,8 @@ App::get('/v1/health/anti-virus') throw new Exception('Anitvirus is disabled'); } - $antiVirus = new Network('clamav', 3310); + $antiVirus = new Network(App::getEnv('_APP_STORAGE_ANTIVIRUS_HOST', 'clamav'), + (int) App::getEnv('_APP_STORAGE_ANTIVIRUS_PORT', 3310)); $response->json([ 'status' => (@$antiVirus->ping()) ? 'online' : 'offline', diff --git a/app/controllers/api/storage.php b/app/controllers/api/storage.php index b7628e320b..b70fe9f950 100644 --- a/app/controllers/api/storage.php +++ b/app/controllers/api/storage.php @@ -96,7 +96,8 @@ App::post('/v1/storage/files') $mimeType = $device->getFileMimeType($path); // Get mime-type before compression and encryption if (App::getEnv('_APP_STORAGE_ANTIVIRUS') === 'enabled') { // Check if scans are enabled - $antiVirus = new Network('clamav', 3310); + $antiVirus = new Network(App::getEnv('_APP_STORAGE_ANTIVIRUS_HOST', 'clamav'), + (int) App::getEnv('_APP_STORAGE_ANTIVIRUS_PORT', 3310)); if (!$antiVirus->fileScan($path)) { $device->delete($path); diff --git a/app/tasks/doctor.php b/app/tasks/doctor.php index 70a7546b2a..e3985c8e75 100644 --- a/app/tasks/doctor.php +++ b/app/tasks/doctor.php @@ -113,7 +113,8 @@ $cli if(App::getEnv('_APP_STORAGE_ANTIVIRUS') === 'enabled') { // Check if scans are enabled try { - $antiVirus = new Network('clamav', 3310); + $antiVirus = new Network(App::getEnv('_APP_STORAGE_ANTIVIRUS_HOST', 'clamav'), + (int) App::getEnv('_APP_STORAGE_ANTIVIRUS_PORT', 3310)); if((@$antiVirus->ping())) { Console::success('AntiVirus...........connected 👍'); diff --git a/docker-compose.yml b/docker-compose.yml index 701d1e240c..b4fb435275 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -91,6 +91,9 @@ services: - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_STORAGE_ANTIVIRUS + - _APP_STORAGE_ANTIVIRUS_HOST + - _APP_STORAGE_ANTIVIRUS_PORT - _APP_SMTP_HOST - _APP_SMTP_PORT - _APP_SMTP_SECURE From 0812a6b82d9e6ec20fac2678cde9a4dafebfd3a6 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sat, 2 Jan 2021 21:47:23 +0200 Subject: [PATCH 081/230] Updated changelog --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index 6185144417..bb1fbf9c09 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -51,6 +51,7 @@ - Upgraded Influxdb Docker image to version 1.8 (alpine) - Added option to disable mail sending by setting empty SMTP host - Upgraded installation script ([#490](https://github.com/appwrite/appwrite/issues/490)) +- Added new environment variables for ClamAV hostname and port ([#780](https://github.com/appwrite/appwrite/pull/780)) ## Breaking Changes (Read before upgrading!) - **Deprecated** `first` and `last` query params for documents list route in the database API From 9b1b5d3a7ee305887a9557ebf1b84143bac6758d Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Sun, 3 Jan 2021 23:37:19 +0530 Subject: [PATCH 082/230] feat: review comments --- app/controllers/general.php | 2 ++ app/http.php | 1 - src/Appwrite/Utopia/Response.php | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index ba0a64eb1e..ed45f528dd 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -108,6 +108,8 @@ App::init(function ($utopia, $request, $response, $console, $project, $user, $lo default: throw new Exception('No filter available for response format : '.$responseFormat, 400); } + } else { + Response::setFilter(null); } /* diff --git a/app/http.php b/app/http.php index 9e27f21375..b3d7dcaac7 100644 --- a/app/http.php +++ b/app/http.php @@ -23,7 +23,6 @@ error_reporting(E_ALL); $http = new Server("0.0.0.0", 80); $payloadSize = max(4000000 /* 4mb */, App::getEnv('_APP_STORAGE_LIMIT', 10000000 /* 10mb */)); -$responseFormat = App::getEnv('_APP_SYSTEM_RESPONSE_FORMAT', ''); $http ->set([ diff --git a/src/Appwrite/Utopia/Response.php b/src/Appwrite/Utopia/Response.php index 9d1773a226..1fa4962bc7 100644 --- a/src/Appwrite/Utopia/Response.php +++ b/src/Appwrite/Utopia/Response.php @@ -349,7 +349,7 @@ class Response extends SwooleResponse * * @return void */ - public static function setFilter(Filter $filter) + public static function setFilter(?Filter $filter) { self::$filter = $filter; } From 50bca50d10e24674379b61b3f60d33c83d376594 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Sun, 3 Jan 2021 23:42:11 +0530 Subject: [PATCH 083/230] feat: review comments --- .env | 2 +- Dockerfile | 1 - app/config/variables.php | 2 +- src/Appwrite/Utopia/Response.php | 14 +++++++++----- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.env b/.env index bf61b2fd6d..c3a0d93d8c 100644 --- a/.env +++ b/.env @@ -31,4 +31,4 @@ _APP_FUNCTIONS_CPUS=1 _APP_FUNCTIONS_MEMORY=128 _APP_FUNCTIONS_MEMORY_SWAP=128 _APP_MAINTENANCE_INTERVAL=86400 -_APP_SYSTEM_RESPONSE_FORMAT=0.6.2 \ No newline at end of file +_APP_SYSTEM_RESPONSE_FORMAT= \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index f591751706..fb578a6f1a 100755 --- a/Dockerfile +++ b/Dockerfile @@ -97,7 +97,6 @@ ENV _APP_SERVER=swoole \ _APP_FUNCTIONS_MEMORY_SWAP=128 \ _APP_SETUP=self-hosted \ _APP_VERSION=$VERSION \ - _APP_SYSTEM_RESPONSE_FORMAT=0.6.2 \ # 1 Day = 86400 s _APP_MAINTENANCE_INTERVAL=86400 #ENV _APP_SMTP_SECURE '' diff --git a/app/config/variables.php b/app/config/variables.php index a0d4ba96c5..82670c23a0 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -177,7 +177,7 @@ return [ ], [ 'name' => '_APP_SYSTEM_RESPONSE_FORMAT', - 'default' => '0.7', + 'default' => '', 'required' => false, 'question' => '', ], diff --git a/src/Appwrite/Utopia/Response.php b/src/Appwrite/Utopia/Response.php index 1fa4962bc7..ce22df225e 100644 --- a/src/Appwrite/Utopia/Response.php +++ b/src/Appwrite/Utopia/Response.php @@ -250,7 +250,15 @@ class Response extends SwooleResponse */ public function dynamic(Document $document, string $model): void { - $this->json($this->output($document, $model)); + $output = $this->output($document, $model); + + // If filter is set, parse the item + if(self::isFilter()){ + $item = self::getFilter()->parse($output, $model); + } + + $this->json($output); + } /** @@ -293,10 +301,6 @@ class Response extends SwooleResponse } $item = $this->output($item, $rule['type']); - // If filter is set, parse the item - if(self::isFilter()){ - $item = self::getFilter()->parse($item, $rule['type']); - } } } } From 287bef7a6ce490ddfb8800d922cb659506c880df Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Mon, 4 Jan 2021 00:33:23 +0200 Subject: [PATCH 084/230] Init new SDK --- README.md | 1 + app/config/environments.php | 4 +- app/config/platforms.php | 29 ++-- composer.json | 2 +- composer.lock | 275 +++++++++++++++++++----------------- 5 files changed, 164 insertions(+), 147 deletions(-) diff --git a/README.md b/README.md index ea3ee938b9..f5dea89bf7 100644 --- a/README.md +++ b/README.md @@ -124,6 +124,7 @@ Below is a list of currently supported platforms and languages. If you wish to h * ✅   [Deno](https://github.com/appwrite/sdk-for-deno) - **Beta** (Maintained by the Appwrite Team) * ✅   [Ruby](https://github.com/appwrite/sdk-for-ruby) - **Beta** (Maintained by the Appwrite Team) * ✅   [Python](https://github.com/appwrite/sdk-for-python) - **Beta** (Maintained by the Appwrite Team) +* ✅   [C#](https://github.com/appwrite/sdk-for-csharp) - **Expiremental** (Maintained by the Appwrite Team) * ✅   [Go](https://github.com/appwrite/sdk-for-go) **Work in progress** (Maintained by the Appwrite Team) * ✅   [Dart](https://github.com/appwrite/sdk-for-dart) **Work in progress** (Maintained by the Appwrite Team) diff --git a/app/config/environments.php b/app/config/environments.php index 9119bee335..228e7e4608 100644 --- a/app/config/environments.php +++ b/app/config/environments.php @@ -1,5 +1,7 @@ [ 'name' => 'Node.js', diff --git a/app/config/platforms.php b/app/config/platforms.php index c9a3f25b59..8b751e436d 100644 --- a/app/config/platforms.php +++ b/app/config/platforms.php @@ -20,7 +20,6 @@ return [ 'package' => 'https://www.npmjs.com/package/appwrite', 'enabled' => true, 'beta' => false, - 'dev' => false, 'family' => APP_PLATFORM_CLIENT, 'prism' => 'javascript', 'source' => \realpath(__DIR__ . '/../sdks/client-web'), @@ -36,7 +35,6 @@ return [ 'package' => 'https://pub.dev/packages/appwrite', 'enabled' => true, 'beta' => true, - 'dev' => false, 'family' => APP_PLATFORM_CLIENT, 'prism' => 'dart', 'source' => \realpath(__DIR__ . '/../sdks/client-flutter'), @@ -51,7 +49,6 @@ return [ 'package' => '', 'enabled' => false, 'beta' => false, - 'dev' => false, 'family' => APP_PLATFORM_CLIENT, 'prism' => 'swift', 'source' => false, @@ -66,7 +63,6 @@ return [ 'package' => '', 'enabled' => false, 'beta' => false, - 'dev' => false, 'family' => APP_PLATFORM_CLIENT, 'prism' => '', 'source' => false, @@ -81,7 +77,6 @@ return [ 'package' => '', 'enabled' => false, 'beta' => false, - 'dev' => false, 'family' => APP_PLATFORM_CLIENT, 'prism' => 'kotlin', 'source' => false, @@ -120,7 +115,6 @@ return [ 'package' => '', 'enabled' => true, 'beta' => false, - 'dev' => false, 'family' => APP_PLATFORM_CONSOLE, 'prism' => 'console', 'source' => \realpath(__DIR__ . '/../sdks/console-web'), @@ -146,7 +140,6 @@ return [ 'package' => 'https://www.npmjs.com/package/node-appwrite', 'enabled' => true, 'beta' => false, - 'dev' => false, 'family' => APP_PLATFORM_SERVER, 'prism' => 'javascript', 'source' => \realpath(__DIR__ . '/../sdks/server-nodejs'), @@ -162,7 +155,6 @@ return [ 'package' => 'https://deno.land/x/appwrite', 'enabled' => true, 'beta' => true, - 'dev' => false, 'family' => APP_PLATFORM_SERVER, 'prism' => 'typescript', 'source' => \realpath(__DIR__ . '/../sdks/server-deno'), @@ -178,7 +170,6 @@ return [ 'package' => 'https://packagist.org/packages/appwrite/appwrite', 'enabled' => true, 'beta' => false, - 'dev' => false, 'family' => APP_PLATFORM_SERVER, 'prism' => 'php', 'source' => \realpath(__DIR__ . '/../sdks/server-php'), @@ -194,7 +185,6 @@ return [ 'package' => 'https://pypi.org/project/appwrite/', 'enabled' => true, 'beta' => true, - 'dev' => false, 'family' => APP_PLATFORM_SERVER, 'prism' => 'python', 'source' => \realpath(__DIR__ . '/../sdks/server-python'), @@ -210,7 +200,6 @@ return [ 'package' => 'https://rubygems.org/gems/appwrite', 'enabled' => true, 'beta' => true, - 'dev' => false, 'family' => APP_PLATFORM_SERVER, 'prism' => 'ruby', 'source' => \realpath(__DIR__ . '/../sdks/server-ruby'), @@ -226,7 +215,6 @@ return [ 'package' => '', 'enabled' => false, 'beta' => true, - 'dev' => false, 'family' => APP_PLATFORM_SERVER, 'prism' => 'go', 'source' => \realpath(__DIR__ . '/../sdks/server-go'), @@ -242,7 +230,6 @@ return [ 'package' => '', 'enabled' => false, 'beta' => true, - 'dev' => false, 'family' => APP_PLATFORM_SERVER, 'prism' => 'java', 'source' => \realpath(__DIR__ . '/../sdks/server-java'), @@ -250,6 +237,21 @@ return [ 'gitRepoName' => 'sdk-for-java', 'gitUserName' => 'appwrite', ], + [ + 'key' => 'csharp', + 'name' => 'CSharp', + 'version' => '0.0.1', + 'url' => 'https://github.com/appwrite/sdk-for-csharp', + 'package' => '', + 'enabled' => true, + 'beta' => true, + 'family' => APP_PLATFORM_SERVER, + 'prism' => 'csharp', + 'source' => \realpath(__DIR__ . '/../sdks/server-csharp'), + 'gitUrl' => 'git@github.com:appwrite/sdk-for-csharp.git', + 'gitRepoName' => 'sdk-for-csharp', + 'gitUserName' => 'appwrite', + ], [ 'key' => 'dart', 'name' => 'Dart', @@ -258,7 +260,6 @@ return [ 'package' => '', 'enabled' => false, 'beta' => true, - 'dev' => false, 'family' => APP_PLATFORM_SERVER, 'prism' => 'java', 'source' => \realpath(__DIR__ . '/../sdks/server-dart'), diff --git a/composer.json b/composer.json index bf9f354acc..97d2263952 100644 --- a/composer.json +++ b/composer.json @@ -56,7 +56,7 @@ }, "require-dev": { "swoole/ide-helper": "4.5.5", - "appwrite/sdk-generator": "0.2.3", + "appwrite/sdk-generator": "0.3.0", "phpunit/phpunit": "9.4.2", "vimeo/psalm": "4.1.1" }, diff --git a/composer.lock b/composer.lock index 500c67d954..606dd5fd67 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "aa1bf812ee6a45af12cdfbbfb7229471", + "content-hash": "57a43a1cab8459494f031551fe83ffb5", "packages": [ { "name": "appwrite/php-clamav", @@ -1158,9 +1158,9 @@ ], "support": { "issues": "https://github.com/utopia-php/abuse/issues", - "source": "https://github.com/utopia-php/abuse/tree/0.2.2" + "source": "https://github.com/utopia-php/abuse/tree/0.3.1" }, - "time": "2020-10-23T06:51:42+00:00" + "time": "2020-12-21T17:28:03+00:00" }, { "name": "utopia-php/audit", @@ -1210,9 +1210,9 @@ ], "support": { "issues": "https://github.com/utopia-php/audit/issues", - "source": "https://github.com/utopia-php/audit/tree/0.3.2" + "source": "https://github.com/utopia-php/audit/tree/0.5.1" }, - "time": "2020-10-23T08:09:44+00:00" + "time": "2020-12-21T17:28:53+00:00" }, { "name": "utopia-php/cache", @@ -1315,9 +1315,9 @@ ], "support": { "issues": "https://github.com/utopia-php/cli/issues", - "source": "https://github.com/utopia-php/cli/tree/0.7.3" + "source": "https://github.com/utopia-php/cli/tree/0.8" }, - "time": "2020-11-02T07:50:18+00:00" + "time": "2020-12-14T06:31:42+00:00" }, { "name": "utopia-php/config", @@ -1858,11 +1858,11 @@ }, { "name": "appwrite/sdk-generator", - "version": "0.2.3", + "version": "0.3.0", "source": { "type": "git", "url": "https://github.com/appwrite/sdk-generator", - "reference": "6b564fef01fd681023c1d465783931bade04468d" + "reference": "f0a6ecf92869012dd546ec503c69177dce0f9d90" }, "require": { "ext-curl": "*", @@ -1875,7 +1875,6 @@ "require-dev": { "phpunit/phpunit": "^7.0" }, - "default-branch": true, "type": "library", "autoload": { "psr-4": { @@ -1893,7 +1892,7 @@ } ], "description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms", - "time": "2020-12-23T21:58:58+00:00" + "time": "2021-01-03T21:23:24+00:00" }, { "name": "composer/package-versions-deprecated", @@ -1901,12 +1900,12 @@ "source": { "type": "git", "url": "https://github.com/composer/package-versions-deprecated.git", - "reference": "64291c788b9a18272346decf566931e33a317399" + "reference": "f921205948ab93bb19f86327c793a81edb62f236" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/64291c788b9a18272346decf566931e33a317399", - "reference": "64291c788b9a18272346decf566931e33a317399", + "url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/f921205948ab93bb19f86327c793a81edb62f236", + "reference": "f921205948ab93bb19f86327c793a81edb62f236", "shasum": "" }, "require": { @@ -1967,7 +1966,7 @@ "type": "tidelift" } ], - "time": "2020-11-12T09:39:33+00:00" + "time": "2020-12-27T20:11:05+00:00" }, { "name": "composer/semver", @@ -2324,16 +2323,16 @@ }, { "name": "matthiasmullie/minify", - "version": "1.3.64", + "version": "1.3.65", "source": { "type": "git", "url": "https://github.com/matthiasmullie/minify.git", - "reference": "38f9d58c739687e269f46c6dff4647de9e2eb855" + "reference": "227f19062451c55a797e0cc667ef983834e6580c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/matthiasmullie/minify/zipball/38f9d58c739687e269f46c6dff4647de9e2eb855", - "reference": "38f9d58c739687e269f46c6dff4647de9e2eb855", + "url": "https://api.github.com/repos/matthiasmullie/minify/zipball/227f19062451c55a797e0cc667ef983834e6580c", + "reference": "227f19062451c55a797e0cc667ef983834e6580c", "shasum": "" }, "require": { @@ -2382,9 +2381,23 @@ ], "support": { "issues": "https://github.com/matthiasmullie/minify/issues", - "source": "https://github.com/matthiasmullie/minify/tree/1.3.64" + "source": "https://github.com/matthiasmullie/minify/tree/1.3.65" }, - "time": "2020-12-23T13:37:53+00:00" + "funding": [ + { + "url": "https://github.com/[user1", + "type": "github" + }, + { + "url": "https://github.com/matthiasmullie] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g.", + "type": "github" + }, + { + "url": "https://github.com/user2", + "type": "github" + } + ], + "time": "2020-12-27T21:43:29+00:00" }, { "name": "matthiasmullie/path-converter", @@ -3004,12 +3017,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "ad44fae76b874e7d49afb6923a66591e0a94bef6" + "reference": "cbe315f4d3b653ac0310862697866ffddabc502f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ad44fae76b874e7d49afb6923a66591e0a94bef6", - "reference": "ad44fae76b874e7d49afb6923a66591e0a94bef6", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/cbe315f4d3b653ac0310862697866ffddabc502f", + "reference": "cbe315f4d3b653ac0310862697866ffddabc502f", "shasum": "" }, "require": { @@ -3065,7 +3078,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/master" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2" }, "funding": [ { @@ -3073,7 +3086,7 @@ "type": "github" } ], - "time": "2020-12-24T12:26:22+00:00" + "time": "2021-01-02T06:24:37+00:00" }, { "name": "phpunit/php-file-iterator", @@ -3081,12 +3094,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "544be757d192233486ad9119dcb297ebbf5f2dd4" + "reference": "cdb8225b328ef5e9647049954299211804000ce0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/544be757d192233486ad9119dcb297ebbf5f2dd4", - "reference": "544be757d192233486ad9119dcb297ebbf5f2dd4", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cdb8225b328ef5e9647049954299211804000ce0", + "reference": "cdb8225b328ef5e9647049954299211804000ce0", "shasum": "" }, "require": { @@ -3134,7 +3147,7 @@ "type": "github" } ], - "time": "2020-12-24T12:27:43+00:00" + "time": "2021-01-02T06:22:20+00:00" }, { "name": "phpunit/php-invoker", @@ -3142,12 +3155,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-invoker.git", - "reference": "05210af8d0ab68c811ae61a4bc42b066d62b88a0" + "reference": "6fdda2828180f7d86cf66d822e6ad4bc124baf5d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/05210af8d0ab68c811ae61a4bc42b066d62b88a0", - "reference": "05210af8d0ab68c811ae61a4bc42b066d62b88a0", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/6fdda2828180f7d86cf66d822e6ad4bc124baf5d", + "reference": "6fdda2828180f7d86cf66d822e6ad4bc124baf5d", "shasum": "" }, "require": { @@ -3198,7 +3211,7 @@ "type": "github" } ], - "time": "2020-12-24T12:27:51+00:00" + "time": "2021-01-02T06:22:25+00:00" }, { "name": "phpunit/php-text-template", @@ -3206,12 +3219,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "c1abda6e0590f8e7138eb48ade2f0b21a5c4257b" + "reference": "081fc9efc54b1b858b3497c142d82a0c36bc6755" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/c1abda6e0590f8e7138eb48ade2f0b21a5c4257b", - "reference": "c1abda6e0590f8e7138eb48ade2f0b21a5c4257b", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/081fc9efc54b1b858b3497c142d82a0c36bc6755", + "reference": "081fc9efc54b1b858b3497c142d82a0c36bc6755", "shasum": "" }, "require": { @@ -3258,7 +3271,7 @@ "type": "github" } ], - "time": "2020-12-24T12:28:23+00:00" + "time": "2021-01-02T06:22:47+00:00" }, { "name": "phpunit/php-timer", @@ -3266,12 +3279,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "59e401088c91efeb76150f0a301aa79e3ac95fd1" + "reference": "2194371fec37b03cfda3f8ab08aee33787350228" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/59e401088c91efeb76150f0a301aa79e3ac95fd1", - "reference": "59e401088c91efeb76150f0a301aa79e3ac95fd1", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/2194371fec37b03cfda3f8ab08aee33787350228", + "reference": "2194371fec37b03cfda3f8ab08aee33787350228", "shasum": "" }, "require": { @@ -3318,7 +3331,7 @@ "type": "github" } ], - "time": "2020-12-24T12:27:59+00:00" + "time": "2021-01-02T06:22:31+00:00" }, { "name": "phpunit/phpunit", @@ -3483,12 +3496,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "7605547e80bf845bc2c1b2cc3f8ac0f5574caa63" + "reference": "1012bd8df812778b8386c5e76cacd85b45cf329e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/7605547e80bf845bc2c1b2cc3f8ac0f5574caa63", - "reference": "7605547e80bf845bc2c1b2cc3f8ac0f5574caa63", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/1012bd8df812778b8386c5e76cacd85b45cf329e", + "reference": "1012bd8df812778b8386c5e76cacd85b45cf329e", "shasum": "" }, "require": { @@ -3532,7 +3545,7 @@ "type": "github" } ], - "time": "2020-12-24T12:28:52+00:00" + "time": "2021-01-02T06:23:03+00:00" }, { "name": "sebastian/code-unit", @@ -3596,12 +3609,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "f861b90785c30dc0743554f0e615d8f950dc8e9d" + "reference": "f0a408b6519db241e624a62576dc5871d4ac8c14" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/f861b90785c30dc0743554f0e615d8f950dc8e9d", - "reference": "f861b90785c30dc0743554f0e615d8f950dc8e9d", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/f0a408b6519db241e624a62576dc5871d4ac8c14", + "reference": "f0a408b6519db241e624a62576dc5871d4ac8c14", "shasum": "" }, "require": { @@ -3644,7 +3657,7 @@ "type": "github" } ], - "time": "2020-12-24T12:26:38+00:00" + "time": "2021-01-02T06:21:36+00:00" }, { "name": "sebastian/comparator", @@ -3652,12 +3665,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "1cfe9edf7ec9e4c18e54bb259110a053d09a899f" + "reference": "fe4c68c639d9e580ec31bfc88b32641dc80a08d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1cfe9edf7ec9e4c18e54bb259110a053d09a899f", - "reference": "1cfe9edf7ec9e4c18e54bb259110a053d09a899f", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fe4c68c639d9e580ec31bfc88b32641dc80a08d0", + "reference": "fe4c68c639d9e580ec31bfc88b32641dc80a08d0", "shasum": "" }, "require": { @@ -3719,7 +3732,7 @@ "type": "github" } ], - "time": "2020-12-24T12:38:43+00:00" + "time": "2021-01-02T06:21:42+00:00" }, { "name": "sebastian/complexity", @@ -3727,12 +3740,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "23030bf3d3722767fdc5f8f2d2d99b03f4e58122" + "reference": "c182133e92fc7a8b0a923b5d20f3a9fdfa534818" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/23030bf3d3722767fdc5f8f2d2d99b03f4e58122", - "reference": "23030bf3d3722767fdc5f8f2d2d99b03f4e58122", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/c182133e92fc7a8b0a923b5d20f3a9fdfa534818", + "reference": "c182133e92fc7a8b0a923b5d20f3a9fdfa534818", "shasum": "" }, "require": { @@ -3777,7 +3790,7 @@ "type": "github" } ], - "time": "2020-12-24T12:28:32+00:00" + "time": "2021-01-02T06:22:53+00:00" }, { "name": "sebastian/diff", @@ -3785,12 +3798,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "02178c586d5fbd59d348798d7122237a2907f8a4" + "reference": "33f7bf3c1741b2a10e16d5c41c369c402b933e4c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/02178c586d5fbd59d348798d7122237a2907f8a4", - "reference": "02178c586d5fbd59d348798d7122237a2907f8a4", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/33f7bf3c1741b2a10e16d5c41c369c402b933e4c", + "reference": "33f7bf3c1741b2a10e16d5c41c369c402b933e4c", "shasum": "" }, "require": { @@ -3844,7 +3857,7 @@ "type": "github" } ], - "time": "2020-12-24T12:26:54+00:00" + "time": "2021-01-02T06:21:47+00:00" }, { "name": "sebastian/environment", @@ -3852,12 +3865,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "7bb5a20ec06e366cb75b0e126169649c62b397b1" + "reference": "b885263b3601b7570ef386a468d6a827c95c8994" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/7bb5a20ec06e366cb75b0e126169649c62b397b1", - "reference": "7bb5a20ec06e366cb75b0e126169649c62b397b1", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/b885263b3601b7570ef386a468d6a827c95c8994", + "reference": "b885263b3601b7570ef386a468d6a827c95c8994", "shasum": "" }, "require": { @@ -3908,7 +3921,7 @@ "type": "github" } ], - "time": "2020-12-24T12:27:03+00:00" + "time": "2021-01-02T06:21:52+00:00" }, { "name": "sebastian/exporter", @@ -3916,12 +3929,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "91975a2dbcf4a89184d9e4143c06b88d89644b58" + "reference": "f670c4f17dffab83b44048f6fe6747a7c6097179" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/91975a2dbcf4a89184d9e4143c06b88d89644b58", - "reference": "91975a2dbcf4a89184d9e4143c06b88d89644b58", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/f670c4f17dffab83b44048f6fe6747a7c6097179", + "reference": "f670c4f17dffab83b44048f6fe6747a7c6097179", "shasum": "" }, "require": { @@ -3986,7 +3999,7 @@ "type": "github" } ], - "time": "2020-12-24T12:27:11+00:00" + "time": "2021-01-02T06:21:58+00:00" }, { "name": "sebastian/global-state", @@ -3994,12 +4007,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "0471b24bddeb05ffd0a5edc6837796f339068c25" + "reference": "a74d82a0654a7f685f80016cc3570d7a387f9da0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/0471b24bddeb05ffd0a5edc6837796f339068c25", - "reference": "0471b24bddeb05ffd0a5edc6837796f339068c25", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/a74d82a0654a7f685f80016cc3570d7a387f9da0", + "reference": "a74d82a0654a7f685f80016cc3570d7a387f9da0", "shasum": "" }, "require": { @@ -4051,7 +4064,7 @@ "type": "github" } ], - "time": "2020-12-24T12:27:19+00:00" + "time": "2021-01-02T06:22:03+00:00" }, { "name": "sebastian/lines-of-code", @@ -4059,12 +4072,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "219c932af1aeee0b4eccbc53af2181ff50e14b24" + "reference": "db62e01f14ea9485d5a52dfb5706061fd0f50425" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/219c932af1aeee0b4eccbc53af2181ff50e14b24", - "reference": "219c932af1aeee0b4eccbc53af2181ff50e14b24", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/db62e01f14ea9485d5a52dfb5706061fd0f50425", + "reference": "db62e01f14ea9485d5a52dfb5706061fd0f50425", "shasum": "" }, "require": { @@ -4109,7 +4122,7 @@ "type": "github" } ], - "time": "2020-12-24T12:28:42+00:00" + "time": "2021-01-02T06:22:58+00:00" }, { "name": "sebastian/object-enumerator", @@ -4117,12 +4130,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "da36684b10f17db8718e314fa8d84b2e0ed7132e" + "reference": "fccb61351e8a3a10ffacfad9544bb2905905b69c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/da36684b10f17db8718e314fa8d84b2e0ed7132e", - "reference": "da36684b10f17db8718e314fa8d84b2e0ed7132e", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/fccb61351e8a3a10ffacfad9544bb2905905b69c", + "reference": "fccb61351e8a3a10ffacfad9544bb2905905b69c", "shasum": "" }, "require": { @@ -4167,7 +4180,7 @@ "type": "github" } ], - "time": "2020-12-24T12:27:27+00:00" + "time": "2021-01-02T06:22:09+00:00" }, { "name": "sebastian/object-reflector", @@ -4175,12 +4188,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "6717d193da503616e69462cf98e2af3f4443335d" + "reference": "c0ad4ce74e040797d5f8abfc23ab79fd79b064c3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/6717d193da503616e69462cf98e2af3f4443335d", - "reference": "6717d193da503616e69462cf98e2af3f4443335d", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/c0ad4ce74e040797d5f8abfc23ab79fd79b064c3", + "reference": "c0ad4ce74e040797d5f8abfc23ab79fd79b064c3", "shasum": "" }, "require": { @@ -4223,7 +4236,7 @@ "type": "github" } ], - "time": "2020-12-24T12:27:35+00:00" + "time": "2021-01-02T06:22:14+00:00" }, { "name": "sebastian/recursion-context", @@ -4231,12 +4244,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "cee249a3e471aa870067fa6155991230c7507924" + "reference": "c5616ce32278e62c77066f72b1fe413a8c958cee" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/cee249a3e471aa870067fa6155991230c7507924", - "reference": "cee249a3e471aa870067fa6155991230c7507924", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/c5616ce32278e62c77066f72b1fe413a8c958cee", + "reference": "c5616ce32278e62c77066f72b1fe413a8c958cee", "shasum": "" }, "require": { @@ -4287,7 +4300,7 @@ "type": "github" } ], - "time": "2020-12-24T12:28:07+00:00" + "time": "2021-01-02T06:22:36+00:00" }, { "name": "sebastian/resource-operations", @@ -4351,12 +4364,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "67bfce3beb94968d175fdf117b80fc9a6b60bdd0" + "reference": "655e3b59cc2e508306dba9c3df08b774055548e7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/67bfce3beb94968d175fdf117b80fc9a6b60bdd0", - "reference": "67bfce3beb94968d175fdf117b80fc9a6b60bdd0", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/655e3b59cc2e508306dba9c3df08b774055548e7", + "reference": "655e3b59cc2e508306dba9c3df08b774055548e7", "shasum": "" }, "require": { @@ -4400,7 +4413,7 @@ "type": "github" } ], - "time": "2020-12-24T12:28:15+00:00" + "time": "2021-01-02T06:22:42+00:00" }, { "name": "sebastian/version", @@ -4500,12 +4513,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "15c96194f32e1b1aa30d1b302c71c5f83fd4dea9" + "reference": "5a8ebe413fbd4091d5b3c5b70e298141681c59c7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/15c96194f32e1b1aa30d1b302c71c5f83fd4dea9", - "reference": "15c96194f32e1b1aa30d1b302c71c5f83fd4dea9", + "url": "https://api.github.com/repos/symfony/console/zipball/5a8ebe413fbd4091d5b3c5b70e298141681c59c7", + "reference": "5a8ebe413fbd4091d5b3c5b70e298141681c59c7", "shasum": "" }, "require": { @@ -4590,7 +4603,7 @@ "type": "tidelift" } ], - "time": "2020-12-18T08:03:24+00:00" + "time": "2021-01-01T09:27:20+00:00" }, { "name": "symfony/polyfill-ctype", @@ -4598,12 +4611,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "fade6deebd931cfd7a544f68479405a6a08979a3" + "reference": "7130f348df2f842044038aaae9d6653dc9d67649" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/fade6deebd931cfd7a544f68479405a6a08979a3", - "reference": "fade6deebd931cfd7a544f68479405a6a08979a3", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/7130f348df2f842044038aaae9d6653dc9d67649", + "reference": "7130f348df2f842044038aaae9d6653dc9d67649", "shasum": "" }, "require": { @@ -4670,7 +4683,7 @@ "type": "tidelift" } ], - "time": "2020-10-26T13:35:45+00:00" + "time": "2020-12-27T09:28:48+00:00" }, { "name": "symfony/polyfill-intl-grapheme", @@ -4678,12 +4691,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "be092746c3ab9f9c62608c82e0f04687f8a879f9" + "reference": "e314d4992832c3a0a68ca731fadd959917320fda" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/be092746c3ab9f9c62608c82e0f04687f8a879f9", - "reference": "be092746c3ab9f9c62608c82e0f04687f8a879f9", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/e314d4992832c3a0a68ca731fadd959917320fda", + "reference": "e314d4992832c3a0a68ca731fadd959917320fda", "shasum": "" }, "require": { @@ -4752,7 +4765,7 @@ "type": "tidelift" } ], - "time": "2020-11-13T15:40:22+00:00" + "time": "2020-12-27T09:28:48+00:00" }, { "name": "symfony/polyfill-intl-normalizer", @@ -4760,12 +4773,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "69609f9f06790591b4b13a45ee117e7bab6395aa" + "reference": "3a79a2226897adae0cab81688fbc5144e2fc53f6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/69609f9f06790591b4b13a45ee117e7bab6395aa", - "reference": "69609f9f06790591b4b13a45ee117e7bab6395aa", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/3a79a2226897adae0cab81688fbc5144e2fc53f6", + "reference": "3a79a2226897adae0cab81688fbc5144e2fc53f6", "shasum": "" }, "require": { @@ -4837,7 +4850,7 @@ "type": "tidelift" } ], - "time": "2020-10-26T13:35:45+00:00" + "time": "2020-12-27T22:11:44+00:00" }, { "name": "symfony/polyfill-mbstring", @@ -4845,12 +4858,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "401c9d9d3400c53a8f1a39425f0543406c137a43" + "reference": "de14691dc88bbbc5535de7f0e32080977dc1d23f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/401c9d9d3400c53a8f1a39425f0543406c137a43", - "reference": "401c9d9d3400c53a8f1a39425f0543406c137a43", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/de14691dc88bbbc5535de7f0e32080977dc1d23f", + "reference": "de14691dc88bbbc5535de7f0e32080977dc1d23f", "shasum": "" }, "require": { @@ -4918,7 +4931,7 @@ "type": "tidelift" } ], - "time": "2020-10-26T13:35:45+00:00" + "time": "2020-12-27T09:28:48+00:00" }, { "name": "symfony/polyfill-php73", @@ -5006,12 +5019,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "3a11f3dfb34ad50f978cb2b8cf936933b87739aa" + "reference": "54cc82c30ba7ed02bc64f5d010488c159b5f1706" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/3a11f3dfb34ad50f978cb2b8cf936933b87739aa", - "reference": "3a11f3dfb34ad50f978cb2b8cf936933b87739aa", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/54cc82c30ba7ed02bc64f5d010488c159b5f1706", + "reference": "54cc82c30ba7ed02bc64f5d010488c159b5f1706", "shasum": "" }, "require": { @@ -5082,7 +5095,7 @@ "type": "tidelift" } ], - "time": "2020-10-26T13:35:45+00:00" + "time": "2020-12-27T09:28:48+00:00" }, { "name": "symfony/service-contracts", @@ -5090,12 +5103,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "5c448a39281b671be2cc8d208e6df75ac2d4b366" + "reference": "e0d43e6e2f909287d2e4e867ca5c131a661f08ef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/5c448a39281b671be2cc8d208e6df75ac2d4b366", - "reference": "5c448a39281b671be2cc8d208e6df75ac2d4b366", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/e0d43e6e2f909287d2e4e867ca5c131a661f08ef", + "reference": "e0d43e6e2f909287d2e4e867ca5c131a661f08ef", "shasum": "" }, "require": { @@ -5163,7 +5176,7 @@ "type": "tidelift" } ], - "time": "2020-12-23T15:38:30+00:00" + "time": "2021-01-01T09:26:45+00:00" }, { "name": "symfony/string", @@ -5171,12 +5184,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "5bd67751d2e3f7d6f770c9154b8fbcb2aa05f7ed" + "reference": "99f25957efe05db14a1aa6cff643eca0f83a952c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/5bd67751d2e3f7d6f770c9154b8fbcb2aa05f7ed", - "reference": "5bd67751d2e3f7d6f770c9154b8fbcb2aa05f7ed", + "url": "https://api.github.com/repos/symfony/string/zipball/99f25957efe05db14a1aa6cff643eca0f83a952c", + "reference": "99f25957efe05db14a1aa6cff643eca0f83a952c", "shasum": "" }, "require": { @@ -5231,7 +5244,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.2.1" + "source": "https://github.com/symfony/string/tree/5.x" }, "funding": [ { @@ -5247,7 +5260,7 @@ "type": "tidelift" } ], - "time": "2020-12-05T07:33:16+00:00" + "time": "2021-01-01T09:26:45+00:00" }, { "name": "theseer/tokenizer", @@ -5305,12 +5318,12 @@ "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "c5379903e5640e5f29024e71aa0817f7bd56102b" + "reference": "846ebbd7c8e780913fa5731d9c6139522111b56f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/c5379903e5640e5f29024e71aa0817f7bd56102b", - "reference": "c5379903e5640e5f29024e71aa0817f7bd56102b", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/846ebbd7c8e780913fa5731d9c6139522111b56f", + "reference": "846ebbd7c8e780913fa5731d9c6139522111b56f", "shasum": "" }, "require": { @@ -5376,7 +5389,7 @@ "type": "tidelift" } ], - "time": "2020-11-27T13:05:37+00:00" + "time": "2021-01-01T14:57:43+00:00" }, { "name": "vimeo/psalm", From 968c03fd010e89a2b4f0254119d0bf488fb702ee Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Mon, 4 Jan 2021 11:23:36 +0200 Subject: [PATCH 085/230] Changed name from CSharp to .NET --- README.md | 2 +- app/config/platforms.php | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index f5dea89bf7..7967b1b2ef 100644 --- a/README.md +++ b/README.md @@ -124,7 +124,7 @@ Below is a list of currently supported platforms and languages. If you wish to h * ✅   [Deno](https://github.com/appwrite/sdk-for-deno) - **Beta** (Maintained by the Appwrite Team) * ✅   [Ruby](https://github.com/appwrite/sdk-for-ruby) - **Beta** (Maintained by the Appwrite Team) * ✅   [Python](https://github.com/appwrite/sdk-for-python) - **Beta** (Maintained by the Appwrite Team) -* ✅   [C#](https://github.com/appwrite/sdk-for-csharp) - **Expiremental** (Maintained by the Appwrite Team) +* ✅   [.NET](https://github.com/appwrite/sdk-for-dotnet) - **Expiremental** (Maintained by the Appwrite Team) * ✅   [Go](https://github.com/appwrite/sdk-for-go) **Work in progress** (Maintained by the Appwrite Team) * ✅   [Dart](https://github.com/appwrite/sdk-for-dart) **Work in progress** (Maintained by the Appwrite Team) diff --git a/app/config/platforms.php b/app/config/platforms.php index 8b751e436d..13773b67eb 100644 --- a/app/config/platforms.php +++ b/app/config/platforms.php @@ -238,18 +238,18 @@ return [ 'gitUserName' => 'appwrite', ], [ - 'key' => 'csharp', - 'name' => 'CSharp', + 'key' => 'dotnet', + 'name' => '.NET', 'version' => '0.0.1', - 'url' => 'https://github.com/appwrite/sdk-for-csharp', + 'url' => 'https://github.com/appwrite/sdk-for-dotnet', 'package' => '', 'enabled' => true, 'beta' => true, 'family' => APP_PLATFORM_SERVER, 'prism' => 'csharp', - 'source' => \realpath(__DIR__ . '/../sdks/server-csharp'), - 'gitUrl' => 'git@github.com:appwrite/sdk-for-csharp.git', - 'gitRepoName' => 'sdk-for-csharp', + 'source' => \realpath(__DIR__ . '/../sdks/server-dotnet'), + 'gitUrl' => 'git@github.com:appwrite/sdk-for-dotnet.git', + 'gitRepoName' => 'sdk-for-dotnet', 'gitUserName' => 'appwrite', ], [ From 9428ad930862ff2d906e1bdad83b23b340083a8c Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Mon, 4 Jan 2021 17:20:41 +0200 Subject: [PATCH 086/230] Added dotNet SDK --- app/tasks/sdks.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/tasks/sdks.php b/app/tasks/sdks.php index 857b4de7b5..9b0798b179 100644 --- a/app/tasks/sdks.php +++ b/app/tasks/sdks.php @@ -11,6 +11,7 @@ use Appwrite\SDK\Language\Python; use Appwrite\SDK\Language\Ruby; use Appwrite\SDK\Language\Dart; use Appwrite\SDK\Language\Deno; +use Appwrite\SDK\Language\DotNet; use Appwrite\SDK\Language\Flutter; use Appwrite\SDK\Language\Go; use Appwrite\SDK\Language\Java; @@ -132,6 +133,9 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND case 'swift': $config = new Swift(); break; + case 'dotnet': + $config = new DotNet(); + break; default: throw new Exception('Language "'.$language['key'].'" not supported'); break; From 4a937659202aa60d739476fe09f70b97dbc8b4c3 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Mon, 4 Jan 2021 17:20:56 +0200 Subject: [PATCH 087/230] Updated docs --- .../server-dotnet/examples/avatars/get-browser.md | 13 +++++++++++++ .../examples/avatars/get-credit-card.md | 13 +++++++++++++ .../server-dotnet/examples/avatars/get-favicon.md | 13 +++++++++++++ .../server-dotnet/examples/avatars/get-flag.md | 13 +++++++++++++ .../server-dotnet/examples/avatars/get-image.md | 13 +++++++++++++ .../server-dotnet/examples/avatars/get-initials.md | 13 +++++++++++++ .../0.6.2/server-dotnet/examples/avatars/get-q-r.md | 13 +++++++++++++ .../examples/database/create-collection.md | 13 +++++++++++++ .../examples/database/create-document.md | 13 +++++++++++++ .../examples/database/delete-collection.md | 13 +++++++++++++ .../examples/database/delete-document.md | 13 +++++++++++++ .../examples/database/get-collection.md | 13 +++++++++++++ .../server-dotnet/examples/database/get-document.md | 13 +++++++++++++ .../examples/database/list-collections.md | 13 +++++++++++++ .../examples/database/list-documents.md | 13 +++++++++++++ .../examples/database/update-collection.md | 13 +++++++++++++ .../examples/database/update-document.md | 13 +++++++++++++ .../server-dotnet/examples/health/get-anti-virus.md | 13 +++++++++++++ .../server-dotnet/examples/health/get-cache.md | 13 +++++++++++++ .../0.6.2/server-dotnet/examples/health/get-d-b.md | 13 +++++++++++++ .../examples/health/get-queue-certificates.md | 13 +++++++++++++ .../examples/health/get-queue-functions.md | 13 +++++++++++++ .../server-dotnet/examples/health/get-queue-logs.md | 13 +++++++++++++ .../examples/health/get-queue-tasks.md | 13 +++++++++++++ .../examples/health/get-queue-usage.md | 13 +++++++++++++ .../examples/health/get-queue-webhooks.md | 13 +++++++++++++ .../examples/health/get-storage-local.md | 13 +++++++++++++ .../0.6.2/server-dotnet/examples/health/get-time.md | 13 +++++++++++++ .../0.6.2/server-dotnet/examples/health/get.md | 13 +++++++++++++ .../server-dotnet/examples/locale/get-continents.md | 13 +++++++++++++ .../examples/locale/get-countries-e-u.md | 13 +++++++++++++ .../examples/locale/get-countries-phones.md | 13 +++++++++++++ .../server-dotnet/examples/locale/get-countries.md | 13 +++++++++++++ .../server-dotnet/examples/locale/get-currencies.md | 13 +++++++++++++ .../server-dotnet/examples/locale/get-languages.md | 13 +++++++++++++ .../0.6.2/server-dotnet/examples/locale/get.md | 13 +++++++++++++ .../server-dotnet/examples/storage/create-file.md | 13 +++++++++++++ .../server-dotnet/examples/storage/delete-file.md | 13 +++++++++++++ .../examples/storage/get-file-download.md | 13 +++++++++++++ .../examples/storage/get-file-preview.md | 13 +++++++++++++ .../server-dotnet/examples/storage/get-file-view.md | 13 +++++++++++++ .../server-dotnet/examples/storage/get-file.md | 13 +++++++++++++ .../server-dotnet/examples/storage/list-files.md | 13 +++++++++++++ .../server-dotnet/examples/storage/update-file.md | 13 +++++++++++++ .../examples/teams/create-membership.md | 13 +++++++++++++ .../0.6.2/server-dotnet/examples/teams/create.md | 13 +++++++++++++ .../examples/teams/delete-membership.md | 13 +++++++++++++ .../0.6.2/server-dotnet/examples/teams/delete.md | 13 +++++++++++++ .../server-dotnet/examples/teams/get-memberships.md | 13 +++++++++++++ .../0.6.2/server-dotnet/examples/teams/get.md | 13 +++++++++++++ .../0.6.2/server-dotnet/examples/teams/list.md | 13 +++++++++++++ .../0.6.2/server-dotnet/examples/teams/update.md | 13 +++++++++++++ .../0.6.2/server-dotnet/examples/users/create.md | 13 +++++++++++++ .../server-dotnet/examples/users/delete-session.md | 13 +++++++++++++ .../server-dotnet/examples/users/delete-sessions.md | 13 +++++++++++++ .../0.6.2/server-dotnet/examples/users/get-logs.md | 13 +++++++++++++ .../0.6.2/server-dotnet/examples/users/get-prefs.md | 13 +++++++++++++ .../server-dotnet/examples/users/get-sessions.md | 13 +++++++++++++ .../0.6.2/server-dotnet/examples/users/get.md | 13 +++++++++++++ .../0.6.2/server-dotnet/examples/users/list.md | 13 +++++++++++++ .../server-dotnet/examples/users/update-prefs.md | 13 +++++++++++++ .../server-dotnet/examples/users/update-status.md | 13 +++++++++++++ 62 files changed, 806 insertions(+) create mode 100644 docs/examples/0.6.2/server-dotnet/examples/avatars/get-browser.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/avatars/get-credit-card.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/avatars/get-favicon.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/avatars/get-flag.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/avatars/get-image.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/avatars/get-initials.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/avatars/get-q-r.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/database/create-collection.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/database/create-document.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/database/delete-collection.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/database/delete-document.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/database/get-collection.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/database/get-document.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/database/list-collections.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/database/list-documents.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/database/update-collection.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/database/update-document.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/health/get-anti-virus.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/health/get-cache.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/health/get-d-b.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/health/get-queue-certificates.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/health/get-queue-functions.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/health/get-queue-logs.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/health/get-queue-tasks.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/health/get-queue-usage.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/health/get-queue-webhooks.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/health/get-storage-local.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/health/get-time.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/health/get.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/locale/get-continents.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/locale/get-countries-e-u.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/locale/get-countries-phones.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/locale/get-countries.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/locale/get-currencies.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/locale/get-languages.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/locale/get.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/storage/create-file.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/storage/delete-file.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/storage/get-file-download.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/storage/get-file-preview.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/storage/get-file-view.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/storage/get-file.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/storage/list-files.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/storage/update-file.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/teams/create-membership.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/teams/create.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/teams/delete-membership.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/teams/delete.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/teams/get-memberships.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/teams/get.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/teams/list.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/teams/update.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/users/create.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/users/delete-session.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/users/delete-sessions.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/users/get-logs.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/users/get-prefs.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/users/get-sessions.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/users/get.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/users/list.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/users/update-prefs.md create mode 100644 docs/examples/0.6.2/server-dotnet/examples/users/update-status.md diff --git a/docs/examples/0.6.2/server-dotnet/examples/avatars/get-browser.md b/docs/examples/0.6.2/server-dotnet/examples/avatars/get-browser.md new file mode 100644 index 0000000000..6d6a5b7f18 --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/avatars/get-browser.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Avatars avatars = new Avatars(client); + +result = avatars.getBrowser("aa"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/avatars/get-credit-card.md b/docs/examples/0.6.2/server-dotnet/examples/avatars/get-credit-card.md new file mode 100644 index 0000000000..8a89c04618 --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/avatars/get-credit-card.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Avatars avatars = new Avatars(client); + +result = avatars.getCreditCard("amex"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/avatars/get-favicon.md b/docs/examples/0.6.2/server-dotnet/examples/avatars/get-favicon.md new file mode 100644 index 0000000000..d51b02a7c3 --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/avatars/get-favicon.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Avatars avatars = new Avatars(client); + +result = avatars.getFavicon("https://example.com"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/avatars/get-flag.md b/docs/examples/0.6.2/server-dotnet/examples/avatars/get-flag.md new file mode 100644 index 0000000000..88a06d16ff --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/avatars/get-flag.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Avatars avatars = new Avatars(client); + +result = avatars.getFlag("af"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/avatars/get-image.md b/docs/examples/0.6.2/server-dotnet/examples/avatars/get-image.md new file mode 100644 index 0000000000..06d021dcf7 --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/avatars/get-image.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Avatars avatars = new Avatars(client); + +result = avatars.getImage("https://example.com"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/avatars/get-initials.md b/docs/examples/0.6.2/server-dotnet/examples/avatars/get-initials.md new file mode 100644 index 0000000000..09e91e0120 --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/avatars/get-initials.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Avatars avatars = new Avatars(client); + +result = avatars.getInitials(); diff --git a/docs/examples/0.6.2/server-dotnet/examples/avatars/get-q-r.md b/docs/examples/0.6.2/server-dotnet/examples/avatars/get-q-r.md new file mode 100644 index 0000000000..5f410cd4ae --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/avatars/get-q-r.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Avatars avatars = new Avatars(client); + +result = avatars.getQR("[TEXT]"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/database/create-collection.md b/docs/examples/0.6.2/server-dotnet/examples/database/create-collection.md new file mode 100644 index 0000000000..92a26b5559 --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/database/create-collection.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Database database = new Database(client); + +result = database.createCollection("[NAME]", {}, {}, {}); diff --git a/docs/examples/0.6.2/server-dotnet/examples/database/create-document.md b/docs/examples/0.6.2/server-dotnet/examples/database/create-document.md new file mode 100644 index 0000000000..70d00bac14 --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/database/create-document.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Database database = new Database(client); + +result = database.createDocument("[COLLECTION_ID]", {}, {}, {}); diff --git a/docs/examples/0.6.2/server-dotnet/examples/database/delete-collection.md b/docs/examples/0.6.2/server-dotnet/examples/database/delete-collection.md new file mode 100644 index 0000000000..7a611e4778 --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/database/delete-collection.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Database database = new Database(client); + +result = database.deleteCollection("[COLLECTION_ID]"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/database/delete-document.md b/docs/examples/0.6.2/server-dotnet/examples/database/delete-document.md new file mode 100644 index 0000000000..7af78fc558 --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/database/delete-document.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Database database = new Database(client); + +result = database.deleteDocument("[COLLECTION_ID]", "[DOCUMENT_ID]"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/database/get-collection.md b/docs/examples/0.6.2/server-dotnet/examples/database/get-collection.md new file mode 100644 index 0000000000..f2bc02fc97 --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/database/get-collection.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Database database = new Database(client); + +result = database.getCollection("[COLLECTION_ID]"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/database/get-document.md b/docs/examples/0.6.2/server-dotnet/examples/database/get-document.md new file mode 100644 index 0000000000..376057e59b --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/database/get-document.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Database database = new Database(client); + +result = database.getDocument("[COLLECTION_ID]", "[DOCUMENT_ID]"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/database/list-collections.md b/docs/examples/0.6.2/server-dotnet/examples/database/list-collections.md new file mode 100644 index 0000000000..b9af7abf1c --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/database/list-collections.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Database database = new Database(client); + +result = database.listCollections(); diff --git a/docs/examples/0.6.2/server-dotnet/examples/database/list-documents.md b/docs/examples/0.6.2/server-dotnet/examples/database/list-documents.md new file mode 100644 index 0000000000..355bc43476 --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/database/list-documents.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Database database = new Database(client); + +result = database.listDocuments("[COLLECTION_ID]"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/database/update-collection.md b/docs/examples/0.6.2/server-dotnet/examples/database/update-collection.md new file mode 100644 index 0000000000..33ae0d7d91 --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/database/update-collection.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Database database = new Database(client); + +result = database.updateCollection("[COLLECTION_ID]", "[NAME]", {}, {}); diff --git a/docs/examples/0.6.2/server-dotnet/examples/database/update-document.md b/docs/examples/0.6.2/server-dotnet/examples/database/update-document.md new file mode 100644 index 0000000000..719d9f5e2e --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/database/update-document.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Database database = new Database(client); + +result = database.updateDocument("[COLLECTION_ID]", "[DOCUMENT_ID]", {}, {}, {}); diff --git a/docs/examples/0.6.2/server-dotnet/examples/health/get-anti-virus.md b/docs/examples/0.6.2/server-dotnet/examples/health/get-anti-virus.md new file mode 100644 index 0000000000..3a2b920271 --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/health/get-anti-virus.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Health health = new Health(client); + +result = health.getAntiVirus(); diff --git a/docs/examples/0.6.2/server-dotnet/examples/health/get-cache.md b/docs/examples/0.6.2/server-dotnet/examples/health/get-cache.md new file mode 100644 index 0000000000..cba191b265 --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/health/get-cache.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Health health = new Health(client); + +result = health.getCache(); diff --git a/docs/examples/0.6.2/server-dotnet/examples/health/get-d-b.md b/docs/examples/0.6.2/server-dotnet/examples/health/get-d-b.md new file mode 100644 index 0000000000..27a46ffe7c --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/health/get-d-b.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Health health = new Health(client); + +result = health.getDB(); diff --git a/docs/examples/0.6.2/server-dotnet/examples/health/get-queue-certificates.md b/docs/examples/0.6.2/server-dotnet/examples/health/get-queue-certificates.md new file mode 100644 index 0000000000..895147525a --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/health/get-queue-certificates.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Health health = new Health(client); + +result = health.getQueueCertificates(); diff --git a/docs/examples/0.6.2/server-dotnet/examples/health/get-queue-functions.md b/docs/examples/0.6.2/server-dotnet/examples/health/get-queue-functions.md new file mode 100644 index 0000000000..1e6130ddbd --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/health/get-queue-functions.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Health health = new Health(client); + +result = health.getQueueFunctions(); diff --git a/docs/examples/0.6.2/server-dotnet/examples/health/get-queue-logs.md b/docs/examples/0.6.2/server-dotnet/examples/health/get-queue-logs.md new file mode 100644 index 0000000000..bf9dec6e7c --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/health/get-queue-logs.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Health health = new Health(client); + +result = health.getQueueLogs(); diff --git a/docs/examples/0.6.2/server-dotnet/examples/health/get-queue-tasks.md b/docs/examples/0.6.2/server-dotnet/examples/health/get-queue-tasks.md new file mode 100644 index 0000000000..0ca3a4b3f0 --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/health/get-queue-tasks.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Health health = new Health(client); + +result = health.getQueueTasks(); diff --git a/docs/examples/0.6.2/server-dotnet/examples/health/get-queue-usage.md b/docs/examples/0.6.2/server-dotnet/examples/health/get-queue-usage.md new file mode 100644 index 0000000000..74cedc0bca --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/health/get-queue-usage.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Health health = new Health(client); + +result = health.getQueueUsage(); diff --git a/docs/examples/0.6.2/server-dotnet/examples/health/get-queue-webhooks.md b/docs/examples/0.6.2/server-dotnet/examples/health/get-queue-webhooks.md new file mode 100644 index 0000000000..eb7f9071c1 --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/health/get-queue-webhooks.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Health health = new Health(client); + +result = health.getQueueWebhooks(); diff --git a/docs/examples/0.6.2/server-dotnet/examples/health/get-storage-local.md b/docs/examples/0.6.2/server-dotnet/examples/health/get-storage-local.md new file mode 100644 index 0000000000..0cfc305b63 --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/health/get-storage-local.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Health health = new Health(client); + +result = health.getStorageLocal(); diff --git a/docs/examples/0.6.2/server-dotnet/examples/health/get-time.md b/docs/examples/0.6.2/server-dotnet/examples/health/get-time.md new file mode 100644 index 0000000000..4887d4b20b --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/health/get-time.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Health health = new Health(client); + +result = health.getTime(); diff --git a/docs/examples/0.6.2/server-dotnet/examples/health/get.md b/docs/examples/0.6.2/server-dotnet/examples/health/get.md new file mode 100644 index 0000000000..1b7428a216 --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/health/get.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Health health = new Health(client); + +result = health.get(); diff --git a/docs/examples/0.6.2/server-dotnet/examples/locale/get-continents.md b/docs/examples/0.6.2/server-dotnet/examples/locale/get-continents.md new file mode 100644 index 0000000000..0f85130aa3 --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/locale/get-continents.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Locale locale = new Locale(client); + +result = locale.getContinents(); diff --git a/docs/examples/0.6.2/server-dotnet/examples/locale/get-countries-e-u.md b/docs/examples/0.6.2/server-dotnet/examples/locale/get-countries-e-u.md new file mode 100644 index 0000000000..8567e3ea4e --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/locale/get-countries-e-u.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Locale locale = new Locale(client); + +result = locale.getCountriesEU(); diff --git a/docs/examples/0.6.2/server-dotnet/examples/locale/get-countries-phones.md b/docs/examples/0.6.2/server-dotnet/examples/locale/get-countries-phones.md new file mode 100644 index 0000000000..a2c5e1a8ab --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/locale/get-countries-phones.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Locale locale = new Locale(client); + +result = locale.getCountriesPhones(); diff --git a/docs/examples/0.6.2/server-dotnet/examples/locale/get-countries.md b/docs/examples/0.6.2/server-dotnet/examples/locale/get-countries.md new file mode 100644 index 0000000000..724c019133 --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/locale/get-countries.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Locale locale = new Locale(client); + +result = locale.getCountries(); diff --git a/docs/examples/0.6.2/server-dotnet/examples/locale/get-currencies.md b/docs/examples/0.6.2/server-dotnet/examples/locale/get-currencies.md new file mode 100644 index 0000000000..44f4ba5924 --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/locale/get-currencies.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Locale locale = new Locale(client); + +result = locale.getCurrencies(); diff --git a/docs/examples/0.6.2/server-dotnet/examples/locale/get-languages.md b/docs/examples/0.6.2/server-dotnet/examples/locale/get-languages.md new file mode 100644 index 0000000000..8020c37230 --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/locale/get-languages.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Locale locale = new Locale(client); + +result = locale.getLanguages(); diff --git a/docs/examples/0.6.2/server-dotnet/examples/locale/get.md b/docs/examples/0.6.2/server-dotnet/examples/locale/get.md new file mode 100644 index 0000000000..ce9d4207b6 --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/locale/get.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Locale locale = new Locale(client); + +result = locale.get(); diff --git a/docs/examples/0.6.2/server-dotnet/examples/storage/create-file.md b/docs/examples/0.6.2/server-dotnet/examples/storage/create-file.md new file mode 100644 index 0000000000..f0ac77f9d8 --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/storage/create-file.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Storage storage = new Storage(client); + +result = storage.createFile(new File("./path-to-files/image.jpg"), {}, {}); diff --git a/docs/examples/0.6.2/server-dotnet/examples/storage/delete-file.md b/docs/examples/0.6.2/server-dotnet/examples/storage/delete-file.md new file mode 100644 index 0000000000..d478052b7c --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/storage/delete-file.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Storage storage = new Storage(client); + +result = storage.deleteFile("[FILE_ID]"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/storage/get-file-download.md b/docs/examples/0.6.2/server-dotnet/examples/storage/get-file-download.md new file mode 100644 index 0000000000..fc209435fe --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/storage/get-file-download.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Storage storage = new Storage(client); + +result = storage.getFileDownload("[FILE_ID]"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/storage/get-file-preview.md b/docs/examples/0.6.2/server-dotnet/examples/storage/get-file-preview.md new file mode 100644 index 0000000000..ba50cb911a --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/storage/get-file-preview.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Storage storage = new Storage(client); + +result = storage.getFilePreview("[FILE_ID]"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/storage/get-file-view.md b/docs/examples/0.6.2/server-dotnet/examples/storage/get-file-view.md new file mode 100644 index 0000000000..87226f1603 --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/storage/get-file-view.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Storage storage = new Storage(client); + +result = storage.getFileView("[FILE_ID]"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/storage/get-file.md b/docs/examples/0.6.2/server-dotnet/examples/storage/get-file.md new file mode 100644 index 0000000000..50553b6b0e --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/storage/get-file.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Storage storage = new Storage(client); + +result = storage.getFile("[FILE_ID]"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/storage/list-files.md b/docs/examples/0.6.2/server-dotnet/examples/storage/list-files.md new file mode 100644 index 0000000000..ba9bb077b8 --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/storage/list-files.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Storage storage = new Storage(client); + +result = storage.listFiles(); diff --git a/docs/examples/0.6.2/server-dotnet/examples/storage/update-file.md b/docs/examples/0.6.2/server-dotnet/examples/storage/update-file.md new file mode 100644 index 0000000000..1aa65653c2 --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/storage/update-file.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Storage storage = new Storage(client); + +result = storage.updateFile("[FILE_ID]", {}, {}); diff --git a/docs/examples/0.6.2/server-dotnet/examples/teams/create-membership.md b/docs/examples/0.6.2/server-dotnet/examples/teams/create-membership.md new file mode 100644 index 0000000000..66832b80f1 --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/teams/create-membership.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Teams teams = new Teams(client); + +result = teams.createMembership("[TEAM_ID]", "email@example.com", {}, "https://example.com"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/teams/create.md b/docs/examples/0.6.2/server-dotnet/examples/teams/create.md new file mode 100644 index 0000000000..ff5ee26138 --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/teams/create.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Teams teams = new Teams(client); + +result = teams.create("[NAME]"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/teams/delete-membership.md b/docs/examples/0.6.2/server-dotnet/examples/teams/delete-membership.md new file mode 100644 index 0000000000..7c1900621c --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/teams/delete-membership.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Teams teams = new Teams(client); + +result = teams.deleteMembership("[TEAM_ID]", "[INVITE_ID]"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/teams/delete.md b/docs/examples/0.6.2/server-dotnet/examples/teams/delete.md new file mode 100644 index 0000000000..ae0fda06ad --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/teams/delete.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Teams teams = new Teams(client); + +result = teams.delete("[TEAM_ID]"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/teams/get-memberships.md b/docs/examples/0.6.2/server-dotnet/examples/teams/get-memberships.md new file mode 100644 index 0000000000..1aac54c69d --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/teams/get-memberships.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Teams teams = new Teams(client); + +result = teams.getMemberships("[TEAM_ID]"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/teams/get.md b/docs/examples/0.6.2/server-dotnet/examples/teams/get.md new file mode 100644 index 0000000000..eb0bc28f73 --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/teams/get.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Teams teams = new Teams(client); + +result = teams.get("[TEAM_ID]"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/teams/list.md b/docs/examples/0.6.2/server-dotnet/examples/teams/list.md new file mode 100644 index 0000000000..bc60aa8a35 --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/teams/list.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Teams teams = new Teams(client); + +result = teams.list(); diff --git a/docs/examples/0.6.2/server-dotnet/examples/teams/update.md b/docs/examples/0.6.2/server-dotnet/examples/teams/update.md new file mode 100644 index 0000000000..3815283343 --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/teams/update.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Teams teams = new Teams(client); + +result = teams.update("[TEAM_ID]", "[NAME]"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/users/create.md b/docs/examples/0.6.2/server-dotnet/examples/users/create.md new file mode 100644 index 0000000000..536e995d0b --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/users/create.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Users users = new Users(client); + +result = users.create("email@example.com", "password"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/users/delete-session.md b/docs/examples/0.6.2/server-dotnet/examples/users/delete-session.md new file mode 100644 index 0000000000..eb455cb140 --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/users/delete-session.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Users users = new Users(client); + +result = users.deleteSession("[USER_ID]", "[SESSION_ID]"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/users/delete-sessions.md b/docs/examples/0.6.2/server-dotnet/examples/users/delete-sessions.md new file mode 100644 index 0000000000..5793fe5bc8 --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/users/delete-sessions.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Users users = new Users(client); + +result = users.deleteSessions("[USER_ID]"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/users/get-logs.md b/docs/examples/0.6.2/server-dotnet/examples/users/get-logs.md new file mode 100644 index 0000000000..0c68cad6c2 --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/users/get-logs.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Users users = new Users(client); + +result = users.getLogs("[USER_ID]"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/users/get-prefs.md b/docs/examples/0.6.2/server-dotnet/examples/users/get-prefs.md new file mode 100644 index 0000000000..b9165807bc --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/users/get-prefs.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Users users = new Users(client); + +result = users.getPrefs("[USER_ID]"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/users/get-sessions.md b/docs/examples/0.6.2/server-dotnet/examples/users/get-sessions.md new file mode 100644 index 0000000000..b1fff05940 --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/users/get-sessions.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Users users = new Users(client); + +result = users.getSessions("[USER_ID]"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/users/get.md b/docs/examples/0.6.2/server-dotnet/examples/users/get.md new file mode 100644 index 0000000000..fb5d4ceec5 --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/users/get.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Users users = new Users(client); + +result = users.get("[USER_ID]"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/users/list.md b/docs/examples/0.6.2/server-dotnet/examples/users/list.md new file mode 100644 index 0000000000..bbe25485a2 --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/users/list.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Users users = new Users(client); + +result = users.list(); diff --git a/docs/examples/0.6.2/server-dotnet/examples/users/update-prefs.md b/docs/examples/0.6.2/server-dotnet/examples/users/update-prefs.md new file mode 100644 index 0000000000..accdcd757f --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/users/update-prefs.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Users users = new Users(client); + +result = users.updatePrefs("[USER_ID]", {}); diff --git a/docs/examples/0.6.2/server-dotnet/examples/users/update-status.md b/docs/examples/0.6.2/server-dotnet/examples/users/update-status.md new file mode 100644 index 0000000000..51822dd10e --- /dev/null +++ b/docs/examples/0.6.2/server-dotnet/examples/users/update-status.md @@ -0,0 +1,13 @@ +use Appwrite; + +Client client = new Client(); + +client + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint + .SetProject("5df5acd0d48c2") # Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key +; + +Users users = new Users(client); + +result = users.updateStatus("[USER_ID]", "1"); From 90c5913957b66300f2c85cca027cff0af8a42e7b Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Mon, 4 Jan 2021 19:45:35 +0200 Subject: [PATCH 088/230] Updated dependencies --- app/tasks/sdks.php | 4 +++- composer.json | 2 +- composer.lock | 13 ++++++++----- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/app/tasks/sdks.php b/app/tasks/sdks.php index 9b0798b179..e0a6fbd051 100644 --- a/app/tasks/sdks.php +++ b/app/tasks/sdks.php @@ -61,6 +61,7 @@ $cli $spec = file_get_contents(__DIR__.'/../config/specs/'.$version.'.'.$language['family'].'.json'); + $cover = 'https://appwrite.io/images/github.png'; $result = \realpath(__DIR__.'/..').'/sdks/'.$key.'-'.$language['key']; $resultExamples = \realpath(__DIR__.'/../..').'/docs/examples/'.$version.'/'.$key.'-'.$language['key']; $target = \realpath(__DIR__.'/..').'/sdks/git/'.$language['key'].'/'; @@ -134,6 +135,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND $config = new Swift(); break; case 'dotnet': + $cover = ''; $config = new DotNet(); break; default: @@ -158,7 +160,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ->setGitRepo($language['gitUrl']) ->setGitRepoName($language['gitRepoName']) ->setGitUserName($language['gitUserName']) - ->setLogo('https://appwrite.io/images/github.png') + ->setLogo($cover) ->setURL('https://appwrite.io') ->setShareText('Appwrite is a backend as a service for building web or mobile apps') ->setShareURL('http://appwrite.io') diff --git a/composer.json b/composer.json index 97d2263952..998e6b0d0d 100644 --- a/composer.json +++ b/composer.json @@ -56,7 +56,7 @@ }, "require-dev": { "swoole/ide-helper": "4.5.5", - "appwrite/sdk-generator": "0.3.0", + "appwrite/sdk-generator": "dev-master", "phpunit/phpunit": "9.4.2", "vimeo/psalm": "4.1.1" }, diff --git a/composer.lock b/composer.lock index 606dd5fd67..3b8cc855d4 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "57a43a1cab8459494f031551fe83ffb5", + "content-hash": "30a8a58c868d3546fc22511b46431564", "packages": [ { "name": "appwrite/php-clamav", @@ -1858,11 +1858,11 @@ }, { "name": "appwrite/sdk-generator", - "version": "0.3.0", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/appwrite/sdk-generator", - "reference": "f0a6ecf92869012dd546ec503c69177dce0f9d90" + "reference": "7d762df83f2539ca89605e40541afbdb20941542" }, "require": { "ext-curl": "*", @@ -1875,6 +1875,7 @@ "require-dev": { "phpunit/phpunit": "^7.0" }, + "default-branch": true, "type": "library", "autoload": { "psr-4": { @@ -1892,7 +1893,7 @@ } ], "description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms", - "time": "2021-01-03T21:23:24+00:00" + "time": "2021-01-04T16:19:42+00:00" }, { "name": "composer/package-versions-deprecated", @@ -5603,7 +5604,9 @@ ], "aliases": [], "minimum-stability": "dev", - "stability-flags": [], + "stability-flags": { + "appwrite/sdk-generator": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": { From eb0ed4f2184e5dcac9c0e4f2714719395ebb49a8 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Mon, 4 Jan 2021 19:49:51 +0200 Subject: [PATCH 089/230] Updated test commands --- CONTRIBUTING.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0f9f433926..73e03d1e79 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -243,12 +243,29 @@ bash ./docker/environments/build.sh ## Tests -To run tests manually, use the Appwrite Docker CLI from your terminal: +To run all tests manually, use the Appwrite Docker CLI from your terminal: ```bash docker-compose exec appwrite test ``` +To run unit tests use: + +```bash +docker-compose exec appwrite test /usr/src/code/tests/unit +``` + +To run end-2-end tests use: + +```bash +docker-compose exec appwrite test /usr/src/code/tests/e2e +``` + +To run end-2-end tests for a spcific service use: + +```bash +docker-compose exec appwrite test /usr/src/code/tests/e2e/Services/[ServiceName] +``` ## Benchmarking You can use WRK Docker image to benchmark the server performance. Benchmarking is extremely useful when you want to compare how the server behaves before and after a change has been applied. Replace [APPWRITE_HOSTNAME_OR_IP] with your Appwrite server hostname or IP. Note that localhost is not accessible from inside the WRK container. From df18492d7f57632d60e97cdee7431cc424d247d7 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Mon, 4 Jan 2021 19:56:08 +0200 Subject: [PATCH 090/230] Updated Nuget URL --- app/config/platforms.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/config/platforms.php b/app/config/platforms.php index 13773b67eb..ffc51b89ed 100644 --- a/app/config/platforms.php +++ b/app/config/platforms.php @@ -242,7 +242,7 @@ return [ 'name' => '.NET', 'version' => '0.0.1', 'url' => 'https://github.com/appwrite/sdk-for-dotnet', - 'package' => '', + 'package' => 'https://www.nuget.org/packages/Appwrite', 'enabled' => true, 'beta' => true, 'family' => APP_PLATFORM_SERVER, From 98309e776e36af6806ab39f5ac130850e19b04ef Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Tue, 5 Jan 2021 00:00:20 +0530 Subject: [PATCH 091/230] feat: fixed failing tests --- src/Appwrite/Utopia/Response/Filters/V06.php | 30 +++++++++++--------- tests/unit/Utopia/Filters/V06Test.php | 6 +++- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/Appwrite/Utopia/Response/Filters/V06.php b/src/Appwrite/Utopia/Response/Filters/V06.php index bed31b48bc..9f7124f043 100644 --- a/src/Appwrite/Utopia/Response/Filters/V06.php +++ b/src/Appwrite/Utopia/Response/Filters/V06.php @@ -146,15 +146,14 @@ class V06 extends Filter { private function parseCurrencyList(array $content) { $content['locations'] = []; - $currencies = $content['currencies']; $parsedResponse = []; foreach($currencies as $currency) { $currency['locations'] = []; $parsedResponse[] = $currency; } - - return $parsedResponse; + $content['currencies'] = $parsedResponse; + return $content; } private function parseContinentList(array $content) @@ -164,8 +163,8 @@ class V06 extends Filter { foreach($continents as $continent) { $parsedResponse[$continent['code']] = $continent['name']; } - - return $parsedResponse; + $content['continents'] = $parsedResponse; + return $content; } private function parsePhoneList(array $content) @@ -175,8 +174,8 @@ class V06 extends Filter { foreach($phones as $phone) { $parsedResponse[$phone['countryCode']] = $phone['code']; } - - return $parsedResponse; + $content['phones'] = $parsedResponse; + return $content; } private function parseCountryList(array $content) @@ -186,8 +185,8 @@ class V06 extends Filter { foreach($countries as $country) { $parsedResponse[$country['code']] = $country['name']; } - - return $parsedResponse; + $content['countries'] = $parsedResponse; + return $content; } private function parseLocale(array $content) @@ -216,7 +215,7 @@ class V06 extends Filter { $parsedResponse[] = [ 'event' => $log['event'], 'ip' => $log['ip'], - 'time' => strtotime($log['time']), + 'time' => $log['time'], 'OS' => $log['osName'].' '.$log['osVersion'], 'client' => $log['clientName'].' '.$log['clientVersion'], 'device' => $log['deviceName'], @@ -228,7 +227,8 @@ class V06 extends Filter { ] ]; } - return $parsedResponse; + $content['logs'] = $parsedResponse; + return $content; } private function parseSessionList(array $content) @@ -251,7 +251,8 @@ class V06 extends Filter { ], ]; } - return $parsedResponse; + $content['sessions'] = $parsedResponse; + return $content; } private function parseSession(array $content) @@ -267,12 +268,13 @@ class V06 extends Filter { foreach($users as $user) { $parsedResponse[] = $this->parseUser($user); } - return $parsedResponse; + $content['users'] = $parsedResponse; + return $content; } private function parseUser(array $content) { - foreach (Config::getParam('providers') as $key => $provider) { + foreach (Config::getParam('providers', []) as $key => $provider) { if (!$provider['enabled']) { continue; } diff --git a/tests/unit/Utopia/Filters/V06Test.php b/tests/unit/Utopia/Filters/V06Test.php index 42b1bba3f2..71f8b4ca79 100644 --- a/tests/unit/Utopia/Filters/V06Test.php +++ b/tests/unit/Utopia/Filters/V06Test.php @@ -39,6 +39,8 @@ class V06Test extends TestCase ] ]; + Config::load('providers', __DIR__.'/../../../../app/config/providers.php'); + $model = Response::MODEL_USER; $parsedResponse = $this->filter->parse($content, $model); @@ -73,6 +75,8 @@ class V06Test extends TestCase ] ]; + Config::load('providers', __DIR__.'/../../../../app/config/providers.php'); + $model = Response::MODEL_USER_LIST; $parsedResponse = $this->filter->parse($content, $model); @@ -260,7 +264,7 @@ class V06Test extends TestCase $parsedResponse = $this->filter->parse($content, $model); $this->assertEquals($parsedResponse['ip'], '127.0.0.1'); - $this->assertEquals($parsedResponse['contryCode'], 'US'); + $this->assertEquals($parsedResponse['countryCode'], 'US'); $this->assertEquals($parsedResponse['country'], 'United States'); $this->assertEquals($parsedResponse['continentCode'], 'NA'); $this->assertEquals($parsedResponse['continent'], 'North America'); From b516eec69d17025c9cf8e8b9b2b4ef8736e50a18 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Tue, 5 Jan 2021 00:34:21 +0200 Subject: [PATCH 092/230] Updated SDK generator version --- composer.json | 2 +- composer.lock | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index 998e6b0d0d..a74996f91a 100644 --- a/composer.json +++ b/composer.json @@ -56,7 +56,7 @@ }, "require-dev": { "swoole/ide-helper": "4.5.5", - "appwrite/sdk-generator": "dev-master", + "appwrite/sdk-generator": "0.3.2", "phpunit/phpunit": "9.4.2", "vimeo/psalm": "4.1.1" }, diff --git a/composer.lock b/composer.lock index 3b8cc855d4..42591c7182 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "30a8a58c868d3546fc22511b46431564", + "content-hash": "229bcebe0c03153ab739cd324fb4eb43", "packages": [ { "name": "appwrite/php-clamav", @@ -1858,7 +1858,7 @@ }, { "name": "appwrite/sdk-generator", - "version": "dev-master", + "version": "0.3.2", "source": { "type": "git", "url": "https://github.com/appwrite/sdk-generator", @@ -1875,7 +1875,6 @@ "require-dev": { "phpunit/phpunit": "^7.0" }, - "default-branch": true, "type": "library", "autoload": { "psr-4": { @@ -5604,9 +5603,7 @@ ], "aliases": [], "minimum-stability": "dev", - "stability-flags": { - "appwrite/sdk-generator": 20 - }, + "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, "platform": { From b3e1c74803f881997d22ab1513ba0aac737ba952 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Tue, 5 Jan 2021 17:33:54 +0530 Subject: [PATCH 093/230] feat: changed session structure --- src/Appwrite/Utopia/Response/Filters/V06.php | 23 +++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/Appwrite/Utopia/Response/Filters/V06.php b/src/Appwrite/Utopia/Response/Filters/V06.php index 9f7124f043..2e569406e9 100644 --- a/src/Appwrite/Utopia/Response/Filters/V06.php +++ b/src/Appwrite/Utopia/Response/Filters/V06.php @@ -12,6 +12,8 @@ use Exception; use Utopia\Config\Config; use Utopia\Locale\Locale as Locale; +use function PHPSTORM_META\map; + class V06 extends Filter { // Convert 0.7 Data format to 0.6 format @@ -238,17 +240,28 @@ class V06 extends Filter { foreach($sessions as $session) { $parsedResponse[] = [ '$id' => $session['$id'], - 'OS' => $session['osName'].' '.$session['osVersion'], - 'client' => $session['clientName'].' '.$session['clientVersion'], - 'device' => $session['deviceName'], 'brand' => $session['deviceBrand'], - 'model' => $session['deviceModel'], - 'ip' => $session['ip'], 'current' => $session['current'], + 'device' => $session['deviceName'], + 'ip' => $session['ip'], + 'model' => $session['deviceModel'], 'geo' => [ 'isoCode' => empty($session['countryCode']) ? '---' : $session['countryCode'] , 'country' => empty($session['countryName'] ) ? Locale::getText('locale.country.unknown') : $session['countryName'] ], + 'OS' => [ + 'name' => $session['osName'], + 'platform' => $session[''], + 'short_name' => $session['osCode'], + 'version' => $session['osVersion'] + ], + 'client' => [ + 'engine' => $session['clientEngine'], + 'name' => $session['clientName'], + 'short_name' => $session['clientCode'], + 'type' => $session['clientType'], + 'version' => $session['clientVersion'] + ] ]; } $content['sessions'] = $parsedResponse; From 2b9a9efca54791fc63ab7b0aa554b4c4cdc7247b Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Tue, 5 Jan 2021 17:43:14 +0530 Subject: [PATCH 094/230] feat: fixed tests for new sessions response --- src/Appwrite/Utopia/Response/Filters/V06.php | 2 +- tests/unit/Utopia/Filters/V06Test.php | 20 +++++++++++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/Appwrite/Utopia/Response/Filters/V06.php b/src/Appwrite/Utopia/Response/Filters/V06.php index 2e569406e9..7b89cbc52a 100644 --- a/src/Appwrite/Utopia/Response/Filters/V06.php +++ b/src/Appwrite/Utopia/Response/Filters/V06.php @@ -251,7 +251,7 @@ class V06 extends Filter { ], 'OS' => [ 'name' => $session['osName'], - 'platform' => $session[''], + 'platform' => '', 'short_name' => $session['osCode'], 'version' => $session['osVersion'] ], diff --git a/tests/unit/Utopia/Filters/V06Test.php b/tests/unit/Utopia/Filters/V06Test.php index 71f8b4ca79..6a0906a85f 100644 --- a/tests/unit/Utopia/Filters/V06Test.php +++ b/tests/unit/Utopia/Filters/V06Test.php @@ -175,13 +175,23 @@ class V06Test extends TestCase $this->assertEquals($parsedResponse['sum'], 1); $this->assertEquals($parsedResponse['sessions'][0]['$id'], '5e5ea5c16897e'); - $this->assertEquals($parsedResponse['sessions'][0]['OS'], 'Mac Mac'); - $this->assertEquals($parsedResponse['sessions'][0]['client'], 'Chrome Mobile iOS 84.0'); - $this->assertEquals($parsedResponse['sessions'][0]['device'], 'smartphone'); $this->assertEquals($parsedResponse['sessions'][0]['brand'], 'Google'); - $this->assertEquals($parsedResponse['sessions'][0]['model'], 'Nexus 5'); - $this->assertEquals($parsedResponse['sessions'][0]['ip'], '127.0.0.1'); $this->assertEquals($parsedResponse['sessions'][0]['current'], true); + $this->assertEquals($parsedResponse['sessions'][0]['device'], 'smartphone'); + $this->assertEquals($parsedResponse['sessions'][0]['ip'], '127.0.0.1'); + $this->assertEquals($parsedResponse['sessions'][0]['model'], 'Nexus 5'); + + $this->assertEquals($parsedResponse['sessions'][0]['OS']['name'], 'Mac'); + $this->assertEquals($parsedResponse['sessions'][0]['OS']['platform'], ''); + $this->assertEquals($parsedResponse['sessions'][0]['OS']['short_name'], 'Mac'); + $this->assertEquals($parsedResponse['sessions'][0]['OS']['version'], ''); + + $this->assertEquals($parsedResponse['sessions'][0]['client']['engine'], 'WebKit'); + $this->assertEquals($parsedResponse['sessions'][0]['client']['name'], 'Chrome Mobile iOS'); + $this->assertEquals($parsedResponse['sessions'][0]['client']['short_name'], 'CM'); + $this->assertEquals($parsedResponse['sessions'][0]['client']['type'], 'browser'); + $this->assertEquals($parsedResponse['sessions'][0]['client']['version'], '84.0'); + $this->assertEquals($parsedResponse['sessions'][0]['geo']['isoCode'], 'US'); $this->assertEquals($parsedResponse['sessions'][0]['geo']['country'], 'United States'); } From a58107b49cf18f03bc4874fc8645b7c286ad486f Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Tue, 5 Jan 2021 17:51:17 +0530 Subject: [PATCH 095/230] feat: changed log list response format and added tests --- src/Appwrite/Utopia/Response/Filters/V06.php | 21 ++++++++++++---- tests/unit/Utopia/Filters/V06Test.php | 26 ++++++++++++++------ 2 files changed, 34 insertions(+), 13 deletions(-) diff --git a/src/Appwrite/Utopia/Response/Filters/V06.php b/src/Appwrite/Utopia/Response/Filters/V06.php index 7b89cbc52a..f386edc6ad 100644 --- a/src/Appwrite/Utopia/Response/Filters/V06.php +++ b/src/Appwrite/Utopia/Response/Filters/V06.php @@ -215,17 +215,28 @@ class V06 extends Filter { $parsedResponse = []; foreach($logs as $log) { $parsedResponse[] = [ + 'brand' => $log['deviceBrand'], + 'device' => $log['deviceName'], 'event' => $log['event'], 'ip' => $log['ip'], - 'time' => $log['time'], - 'OS' => $log['osName'].' '.$log['osVersion'], - 'client' => $log['clientName'].' '.$log['clientVersion'], - 'device' => $log['deviceName'], - 'brand' => $log['deviceBrand'], 'model' => $log['deviceModel'], + 'time' => $log['time'], 'geo' => [ 'isoCode' => empty($log['countryCode']) ? '---' : $log['countryCode'] , 'country' => empty($log['countryName'] ) ? Locale::getText('locale.country.unknown') : $log['countryName'] + ], + 'OS' => [ + 'name' => $log['osName'], + 'platform' => '', + 'short_name' => $log['osCode'], + 'version' => $log['osVersion'] + ], + 'client' => [ + 'engine' => $log['clientEngine'], + 'name' => $log['clientName'], + 'short_name' => $log['clientCode'], + 'type' => $log['clientType'], + 'version' => $log['clientVersion'] ] ]; } diff --git a/tests/unit/Utopia/Filters/V06Test.php b/tests/unit/Utopia/Filters/V06Test.php index 6a0906a85f..97804acd32 100644 --- a/tests/unit/Utopia/Filters/V06Test.php +++ b/tests/unit/Utopia/Filters/V06Test.php @@ -184,7 +184,7 @@ class V06Test extends TestCase $this->assertEquals($parsedResponse['sessions'][0]['OS']['name'], 'Mac'); $this->assertEquals($parsedResponse['sessions'][0]['OS']['platform'], ''); $this->assertEquals($parsedResponse['sessions'][0]['OS']['short_name'], 'Mac'); - $this->assertEquals($parsedResponse['sessions'][0]['OS']['version'], ''); + $this->assertEquals($parsedResponse['sessions'][0]['OS']['version'], 'Mac'); $this->assertEquals($parsedResponse['sessions'][0]['client']['engine'], 'WebKit'); $this->assertEquals($parsedResponse['sessions'][0]['client']['name'], 'Chrome Mobile iOS'); @@ -227,16 +227,26 @@ class V06Test extends TestCase $parsedResponse = $this->filter->parse($content, $model); $this->assertEquals($parsedResponse['sum'], 1); + $this->assertEquals($parsedResponse['logs'][0]['brand'], 'Google'); + $this->assertEquals($parsedResponse['logs'][0]['device'], 'smartphone'); $this->assertEquals($parsedResponse['logs'][0]['event'], 'account.sessions.create'); $this->assertEquals($parsedResponse['logs'][0]['ip'], '127.0.0.1'); - $this->assertEquals($parsedResponse['logs'][0]['time'], 1592981250); - $this->assertEquals($parsedResponse['logs'][0]['OS'], 'Mac Mac'); - $this->assertEquals($parsedResponse['logs'][0]['client'], 'Chrome Mobile iOS 84.0'); - $this->assertEquals($parsedResponse['logs'][0]['device'], 'smartphone'); - $this->assertEquals($parsedResponse['logs'][0]['brand'], 'Google'); $this->assertEquals($parsedResponse['logs'][0]['model'], 'Nexus 5'); - $this->assertEquals($parsedResponse['logs'][0]['geo']['isoCode'], 'US'); - $this->assertEquals($parsedResponse['logs'][0]['geo']['country'], 'United States'); + $this->assertEquals($parsedResponse['logs'][0]['time'], 1592981250); + + $this->assertEquals($parsedResponse['sessions'][0]['OS']['name'], 'Mac'); + $this->assertEquals($parsedResponse['sessions'][0]['OS']['platform'], ''); + $this->assertEquals($parsedResponse['sessions'][0]['OS']['short_name'], 'Mac'); + $this->assertEquals($parsedResponse['sessions'][0]['OS']['version'], 'Mac'); + + $this->assertEquals($parsedResponse['sessions'][0]['client']['engine'], 'WebKit'); + $this->assertEquals($parsedResponse['sessions'][0]['client']['name'], 'Chrome Mobile iOS'); + $this->assertEquals($parsedResponse['sessions'][0]['client']['short_name'], 'CM'); + $this->assertEquals($parsedResponse['sessions'][0]['client']['type'], 'browser'); + $this->assertEquals($parsedResponse['sessions'][0]['client']['version'], '84.0'); + + $this->assertEquals($parsedResponse['sessions'][0]['geo']['isoCode'], 'US'); + $this->assertEquals($parsedResponse['sessions'][0]['geo']['country'], 'United States'); } public function testParseToken() From 7b1bad0a622a3045de7938f7b31128f4a53fdf39 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Tue, 5 Jan 2021 14:22:20 +0200 Subject: [PATCH 096/230] Reordered some code --- app/controllers/general.php | 111 +-------------------------------- app/controllers/shared/api.php | 106 ++++++++++++++++++++++++++++++- app/controllers/shared/web.php | 1 + 3 files changed, 108 insertions(+), 110 deletions(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index d77b3d5607..f577f7459e 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -14,27 +14,19 @@ use Appwrite\Database\Database; use Appwrite\Database\Document; use Appwrite\Database\Validator\Authorization; use Appwrite\Network\Validator\Origin; -use Appwrite\Storage\Device\Local; -use Appwrite\Storage\Storage; use Utopia\CLI\Console; Config::setParam('domainVerification', false); Config::setParam('cookieDomain', 'localhost'); Config::setParam('cookieSamesite', Response::COOKIE_SAMESITE_NONE); -App::init(function ($utopia, $request, $response, $console, $project, $user, $locale, $events, $audits, $usage, $deletes, $clients) { +App::init(function ($utopia, $request, $response, $console, $project, $user, $locale, $clients) { /** @var Utopia\Swoole\Request $request */ /** @var Appwrite\Utopia\Response $response */ /** @var Appwrite\Database\Document $console */ /** @var Appwrite\Database\Document $project */ /** @var Appwrite\Database\Document $user */ /** @var Utopia\Locale\Locale $locale */ - /** @var Appwrite\Event\Event $events */ - /** @var Appwrite\Event\Event $audits */ - /** @var Appwrite\Event\Event $usage */ - /** @var Appwrite\Event\Event $deletes */ - /** @var Appwrite\Event\Event $functions */ - /** @var bool $mode */ /** @var array $clients */ @@ -91,9 +83,6 @@ App::init(function ($utopia, $request, $response, $console, $project, $user, $lo : '.'.$request->getHostname() ); - Storage::setDevice('files', new Local(APP_STORAGE_UPLOADS.'/app-'.$project->getId())); - Storage::setDevice('functions', new Local(APP_STORAGE_FUNCTIONS.'/app-'.$project->getId())); - /* * Security Headers * @@ -110,8 +99,6 @@ App::init(function ($utopia, $request, $response, $console, $project, $user, $lo $response ->addHeader('Server', 'Appwrite') - ->addHeader('X-XSS-Protection', '1; mode=block; report=/v1/xss?url='.\urlencode($request->getURI())) - //->addHeader('X-Frame-Options', ($refDomain == 'http://localhost') ? 'SAMEORIGIN' : 'ALLOW-FROM ' . $refDomain) ->addHeader('X-Content-Type-Options', 'nosniff') ->addHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, PATCH, DELETE') ->addHeader('Access-Control-Allow-Headers', 'Origin, Cookie, Set-Cookie, X-Requested-With, Content-Type, Access-Control-Allow-Origin, Access-Control-Request-Headers, Accept, X-Appwrite-Project, X-Appwrite-Key, X-Appwrite-Locale, X-Appwrite-Mode, X-SDK-Version, Cache-Control, Expires, Pragma') @@ -123,7 +110,7 @@ App::init(function ($utopia, $request, $response, $console, $project, $user, $lo /* * Validate Client Domain - Check to avoid CSRF attack * Adding Appwrite API domains to allow XDOMAIN communication - * Skip this check for non-web platforms which are not requiredto send an origin header + * Skip this check for non-web platforms which are not required to send an origin header */ $origin = $request->getOrigin($request->getReferer('')); $originValidator = new Origin(\array_merge($project->getAttribute('platforms', []), $console->getAttribute('platforms', []))); @@ -219,99 +206,7 @@ App::init(function ($utopia, $request, $response, $console, $project, $user, $lo throw new Exception('Password reset is required', 412); } - /* - * Background Jobs - */ - - $events - ->setParam('projectId', $project->getId()) - ->setParam('userId', $user->getId()) - ->setParam('event', $route->getLabel('event', '')) - ->setParam('payload', []) - ->setParam('functionId', null) - ->setParam('executionId', null) - ->setParam('trigger', 'event') - ; - - $audits - ->setParam('projectId', $project->getId()) - ->setParam('userId', $user->getId()) - ->setParam('event', '') - ->setParam('resource', '') - ->setParam('userAgent', $request->getUserAgent('')) - ->setParam('ip', $request->getIP()) - ->setParam('data', []) - ; - - $usage - ->setParam('projectId', $project->getId()) - ->setParam('httpRequest', 1) - ->setParam('httpUrl', $request->getHostname().$request->getURI()) - ->setParam('httpMethod', $request->getMethod()) - ->setParam('networkRequestSize', 0) - ->setParam('networkResponseSize', 0) - ->setParam('storage', 0) - ; - - $deletes - ->setParam('projectId', $project->getId()) - ; - -}, ['utopia', 'request', 'response', 'console', 'project', 'user', 'locale', 'events', 'audits', 'usage', 'deletes', 'clients']); - -App::shutdown(function ($utopia, $request, $response, $project, $events, $audits, $usage, $deletes, $mode) { - /** @var Utopia\App $utopia */ - /** @var Utopia\Swoole\Request $request */ - /** @var Appwrite\Utopia\Response $response */ - /** @var Appwrite\Database\Document $project */ - /** @var Appwrite\Event\Event $events */ - /** @var Appwrite\Event\Event $audits */ - /** @var Appwrite\Event\Event $usage */ - /** @var Appwrite\Event\Event $deletes */ - /** @var Appwrite\Event\Event $functions */ - /** @var bool $mode */ - - if (!empty($events->getParam('event'))) { - if(empty($events->getParam('payload'))) { - $events->setParam('payload', $response->getPayload()); - } - - $webhooks = clone $events; - $functions = clone $events; - - $webhooks - ->setQueue('v1-webhooks') - ->setClass('WebhooksV1') - ->trigger(); - - $functions - ->setQueue('v1-functions') - ->setClass('FunctionsV1') - ->trigger(); - } - - if (!empty($audits->getParam('event'))) { - $audits->trigger(); - } - - if (!empty($deletes->getParam('type')) && !empty($deletes->getParam('document'))) { - $deletes->trigger(); - } - - $route = $utopia->match($request); - - if ($project->getId() - && $mode !== APP_MODE_ADMIN //TODO: add check to make sure user is admin - && !empty($route->getLabel('sdk.namespace', null))) { // Don't calculate console usage on admin mode - - $usage - ->setParam('networkRequestSize', $request->getSize() + $usage->getParam('storage')) - ->setParam('networkResponseSize', $response->getSize()) - ->trigger() - ; - } - -}, ['utopia', 'request', 'response', 'project', 'events', 'audits', 'usage', 'deletes', 'mode']); +}, ['utopia', 'request', 'response', 'console', 'project', 'user', 'locale', 'clients']); App::options(function ($request, $response) { /** @var Utopia\Swoole\Request $request */ diff --git a/app/controllers/shared/api.php b/app/controllers/shared/api.php index d64c46a2cd..0dcd3bc414 100644 --- a/app/controllers/shared/api.php +++ b/app/controllers/shared/api.php @@ -4,14 +4,24 @@ use Utopia\App; use Utopia\Exception; use Utopia\Abuse\Abuse; use Utopia\Abuse\Adapters\TimeLimit; +use Appwrite\Storage\Device\Local; +use Appwrite\Storage\Storage; -App::init(function ($utopia, $request, $response, $project, $user, $register) { +App::init(function ($utopia, $request, $response, $project, $user, $register, $events, $audits, $usage, $deletes) { /** @var Utopia\App $utopia */ /** @var Utopia\Swoole\Request $request */ /** @var Appwrite\Utopia\Response $response */ /** @var Appwrite\Database\Document $project */ /** @var Appwrite\Database\Document $user */ /** @var Utopia\Registry\Registry $register */ + /** @var Appwrite\Event\Event $events */ + /** @var Appwrite\Event\Event $audits */ + /** @var Appwrite\Event\Event $usage */ + /** @var Appwrite\Event\Event $deletes */ + /** @var Appwrite\Event\Event $functions */ + + Storage::setDevice('files', new Local(APP_STORAGE_UPLOADS.'/app-'.$project->getId())); + Storage::setDevice('functions', new Local(APP_STORAGE_FUNCTIONS.'/app-'.$project->getId())); $route = $utopia->match($request); @@ -52,4 +62,96 @@ App::init(function ($utopia, $request, $response, $project, $user, $register) { if ($abuse->check() && App::getEnv('_APP_OPTIONS_ABUSE', 'enabled') !== 'disabled') { throw new Exception('Too many requests', 429); } -}, ['utopia', 'request', 'response', 'project', 'user', 'register'], 'api'); \ No newline at end of file + + /* + * Background Jobs + */ + $events + ->setParam('projectId', $project->getId()) + ->setParam('userId', $user->getId()) + ->setParam('event', $route->getLabel('event', '')) + ->setParam('payload', []) + ->setParam('functionId', null) + ->setParam('executionId', null) + ->setParam('trigger', 'event') + ; + + $audits + ->setParam('projectId', $project->getId()) + ->setParam('userId', $user->getId()) + ->setParam('event', '') + ->setParam('resource', '') + ->setParam('userAgent', $request->getUserAgent('')) + ->setParam('ip', $request->getIP()) + ->setParam('data', []) + ; + + $usage + ->setParam('projectId', $project->getId()) + ->setParam('httpRequest', 1) + ->setParam('httpUrl', $request->getHostname().$request->getURI()) + ->setParam('httpMethod', $request->getMethod()) + ->setParam('networkRequestSize', 0) + ->setParam('networkResponseSize', 0) + ->setParam('storage', 0) + ; + + $deletes + ->setParam('projectId', $project->getId()) + ; + +}, ['utopia', 'request', 'response', 'project', 'user', 'register', 'events', 'audits', 'usage', 'deletes'], 'api'); + +App::shutdown(function ($utopia, $request, $response, $project, $events, $audits, $usage, $deletes, $mode) { + /** @var Utopia\App $utopia */ + /** @var Utopia\Swoole\Request $request */ + /** @var Appwrite\Utopia\Response $response */ + /** @var Appwrite\Database\Document $project */ + /** @var Appwrite\Event\Event $events */ + /** @var Appwrite\Event\Event $audits */ + /** @var Appwrite\Event\Event $usage */ + /** @var Appwrite\Event\Event $deletes */ + /** @var Appwrite\Event\Event $functions */ + /** @var bool $mode */ + + if (!empty($events->getParam('event'))) { + if(empty($events->getParam('payload'))) { + $events->setParam('payload', $response->getPayload()); + } + + $webhooks = clone $events; + $functions = clone $events; + + $webhooks + ->setQueue('v1-webhooks') + ->setClass('WebhooksV1') + ->trigger(); + + $functions + ->setQueue('v1-functions') + ->setClass('FunctionsV1') + ->trigger(); + } + + if (!empty($audits->getParam('event'))) { + $audits->trigger(); + } + + if (!empty($deletes->getParam('type')) && !empty($deletes->getParam('document'))) { + $deletes->trigger(); + } + + $route = $utopia->match($request); + + if ($project->getId() + && $mode !== APP_MODE_ADMIN //TODO: add check to make sure user is admin + && !empty($route->getLabel('sdk.namespace', null))) { // Don't calculate console usage on admin mode + + $usage + ->setParam('networkRequestSize', $request->getSize() + $usage->getParam('storage')) + ->setParam('networkResponseSize', $response->getSize()) + ->trigger() + ; + } + +}, ['utopia', 'request', 'response', 'project', 'events', 'audits', 'usage', 'deletes', 'mode'], 'api'); diff --git a/app/controllers/shared/web.php b/app/controllers/shared/web.php index 42d2a18c55..43eaf74d09 100644 --- a/app/controllers/shared/web.php +++ b/app/controllers/shared/web.php @@ -37,6 +37,7 @@ App::init(function ($utopia, $request, $response, $layout) { ->addHeader('Cache-Control', 'public, max-age='.$time) ->addHeader('Expires', \date('D, d M Y H:i:s', \time() + $time).' GMT') // 45 days cache ->addHeader('X-Frame-Options', 'SAMEORIGIN') // Avoid console and homepage from showing in iframes + ->addHeader('X-XSS-Protection', '1; mode=block; report=/v1/xss?url='.\urlencode($request->getURI())) ->addHeader('X-UA-Compatible', 'IE=Edge') // Deny IE browsers from going into quirks mode ; From 075d46ba627ec657f2dbd5f894bbbe83559ff3ab Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Tue, 5 Jan 2021 18:27:18 +0530 Subject: [PATCH 097/230] feat: changed team and team list response format and added tests --- src/Appwrite/Utopia/Response/Filters/V06.php | 22 ++++++++- tests/unit/Utopia/Filters/V06Test.php | 47 ++++++++++++++++++++ 2 files changed, 67 insertions(+), 2 deletions(-) diff --git a/src/Appwrite/Utopia/Response/Filters/V06.php b/src/Appwrite/Utopia/Response/Filters/V06.php index f386edc6ad..4bbeccb83e 100644 --- a/src/Appwrite/Utopia/Response/Filters/V06.php +++ b/src/Appwrite/Utopia/Response/Filters/V06.php @@ -52,11 +52,11 @@ class V06 extends Filter { break; case Response::MODEL_TEAM: - $parsedResponse = $content; + $parsedResponse = $this->parseTeam($content); break; case Response::MODEL_TEAM_LIST: - $parsedResponse = $content['teams']; + $parsedResponse = $this->parseTeamList($content); break; case Response::MODEL_MEMBERSHIP: @@ -209,6 +209,24 @@ class V06 extends Filter { return $content; } + private function parseTeam(array $content) + { + $content['$collection'] = Database::SYSTEM_COLLECTION_TEAMS; + $content['$permissions'] = []; + return $content; + } + + private function parseTeamList(array $content) + { + $teams = $content['teams']; + $parsedResponse = []; + foreach($teams as $team) { + $parsedResponse[] = $this->parseTeam($team); + } + $content['teams'] = $parsedResponse; + return $content; + } + private function parseLogList(array $content) { $logs = $content['logs']; diff --git a/tests/unit/Utopia/Filters/V06Test.php b/tests/unit/Utopia/Filters/V06Test.php index 97804acd32..5f680fc547 100644 --- a/tests/unit/Utopia/Filters/V06Test.php +++ b/tests/unit/Utopia/Filters/V06Test.php @@ -249,6 +249,53 @@ class V06Test extends TestCase $this->assertEquals($parsedResponse['sessions'][0]['geo']['country'], 'United States'); } + public function testParseTeam() + { + $content = [ + '$id' => '5ff45ef261829', + 'name' => 'test', + 'dateCreated' => 1592981250, + 'sum' => 7 + ]; + + $model = Response::MODEL_TEAM; + $parsedResponse = $this->filter->parse($content, $model); + + $this->assertEquals($parsedResponse['$id'], '5ff45ef261829'); + $this->assertEquals($parsedResponse['name'], 'test'); + $this->assertEquals($parsedResponse['dateCreated'], 1592981250); + $this->assertEquals($parsedResponse['sum'], 7); + $this->assertEquals($parsedResponse['$collection'], 'teams'); + $this->assertEquals($parsedResponse['$permissions'], []); + } + + public function testParseTeamList() + { + $content = [ + 'sum' => 1, + 'teams' => [ + 0 => [ + '$id' => '5ff45ef261829', + 'name' => 'test', + 'dateCreated' => 1592981250, + 'sum' => 7 + ] + ] + ]; + + $model = Response::MODEL_TEAM_LIST; + $parsedResponse = $this->filter->parse($content, $model); + + $this->assertEquals($parsedResponse['sum'], 1); + $this->assertEquals($parsedResponse['teams'][0]['$id'], '5ff45ef261829'); + $this->assertEquals($parsedResponse['teams'][0]['name'], 'test'); + $this->assertEquals($parsedResponse['teams'][0]['dateCreated'], 1592981250); + $this->assertEquals($parsedResponse['teams'][0]['sum'], 7); + $this->assertEquals($parsedResponse['teams'][0]['$collection'], 'teams'); + $this->assertEquals($parsedResponse['teams'][0]['$permissions'], []); + + } + public function testParseToken() { $content = [ From 3d9060bdab47248b9bf97083a319ac1d051aa14a Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Tue, 5 Jan 2021 14:58:16 +0200 Subject: [PATCH 098/230] Changed constants --- app/config/roles.php | 21 +++++++-------------- src/Appwrite/Auth/Auth.php | 1 + 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/app/config/roles.php b/app/config/roles.php index 8dfaf78eb4..506b2403c6 100644 --- a/app/config/roles.php +++ b/app/config/roles.php @@ -1,13 +1,6 @@ [ + Auth::USER_ROLE_GUEST => [ 'label' => 'Guest', 'scopes' => [ 'public', @@ -71,23 +64,23 @@ return [ 'execution.write', ], ], - ROLE_MEMBER => [ + Auth::USER_ROLE_MEMBER => [ 'label' => 'Member', 'scopes' => \array_merge($logged, []), ], - ROLE_ADMIN => [ + Auth::USER_ROLE_ADMIN => [ 'label' => 'Admin', 'scopes' => \array_merge($admins, []), ], - ROLE_DEVELOPER => [ + Auth::USER_ROLE_DEVELOPER => [ 'label' => 'Developer', 'scopes' => \array_merge($admins, []), ], - ROLE_OWNER => [ + Auth::USER_ROLE_OWNER => [ 'label' => 'Owner', 'scopes' => \array_merge($logged, $admins, []), ], - ROLE_APP => [ + Auth::USER_ROLE_APP => [ 'label' => 'Application', 'scopes' => ['health.read'], ], diff --git a/src/Appwrite/Auth/Auth.php b/src/Appwrite/Auth/Auth.php index 88eb11299d..e43ab78bff 100644 --- a/src/Appwrite/Auth/Auth.php +++ b/src/Appwrite/Auth/Auth.php @@ -23,6 +23,7 @@ class Auth const USER_ROLE_OWNER = 4; const USER_ROLE_APP = 5; const USER_ROLE_SYSTEM = 6; + const USER_ROLE_ALL = '*'; /** * Token Types. From bf2c70f033ad30db09120a3e11ed7b4b1ff73467 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Tue, 5 Jan 2021 15:22:17 +0200 Subject: [PATCH 099/230] added new sub-categories --- CHANGES.md | 63 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 36 insertions(+), 27 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index da80a61cc9..53c49c5bee 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,36 +3,24 @@ ## Features - Improved Webhooks and New System Events - [Learn more]() -- New QR code generator library (@PedroCisnerosSantana - [#475](https://github.com/appwrite/appwrite/issues/475)) + + +### New APIs - Added response to /locale/languages API with a list of languages (@TorstenDittmann ,[#351](https://github.com/appwrite/appwrite/issues/351)) -- Added API response payload structure info and examples to the docs site ([#381](https://github.com/appwrite/appwrite/issues/381)) -- Added Google Fonts to Appwrite for offline availability - Added a new route in the Avatars API to get user initials avatar ([#386](https://github.com/appwrite/appwrite/issues/386)) -- Added option to delete team from the console ([#380](https://github.com/appwrite/appwrite/issues/380)) -- Added option to view team members from the console ([#378](https://github.com/appwrite/appwrite/issues/378)) -- Add option to assign new team members to a team from the console and the API ([#379](https://github.com/appwrite/appwrite/issues/379)) +- Added API response payload structure info and examples to the docs site ([#381](https://github.com/appwrite/appwrite/issues/381)) - Added support for Brotli compression (@PedroCisnerosSantana, @Rohitub222, [#310](https://github.com/appwrite/appwrite/issues/310)) -- Added Select All Checkbox for on Console API key Scopes Screen ([#477](https://github.com/appwrite/appwrite/issues/477)) -- Added pagination and search for team memberships route ([#387](https://github.com/appwrite/appwrite/issues/387)) -- UI performance & accessibility improvements ([#406](https://github.com/appwrite/appwrite/pull/406)) -- Added option to delete user from the console (@PineappleIOnic - #538) -- Created lazy deletion of data worker ([#521](https://github.com/appwrite/appwrite/issues/521)) -- All emails are now sent asynchronously for improved performance (@TorstenDittmann ,[#402](https://github.com/appwrite/appwrite/pull/402)) -- Updated grid for OAuth2 providers list in the console ([#413](https://github.com/appwrite/appwrite/issues/413)) -- Upgraded Redis Resque queue library to version 1.3.6 ([#319](https://github.com/appwrite/appwrite/issues/319)) +- New deletion worker ([#521](https://github.com/appwrite/appwrite/issues/521)) +- New maintenance worker - cleaning up system logs and other optimizations ([#766](https://github.com/appwrite/appwrite/pull/766)) +- New email worker - all emails are now sent asynchronously for improved performance (@TorstenDittmann ,[#402](https://github.com/appwrite/appwrite/pull/402)) - Moved all Appwrite container logs to STDOUT & STDERR ([#389](https://github.com/appwrite/appwrite/issues/389)) -- New UI micro-interactions and CSS fixes (@AnatoleLucet) - New Doctor CLI to debug the Appwrite server ([#415](https://github.com/appwrite/appwrite/issues/415)) - Added container names to docker-compose.yml (@drandell) -- Upgraded ClamAV container image to version 1.0.11 ([#412](https://github.com/appwrite/appwrite/issues/412)) - Optimised function execution by using fully-qualified function calls - Added support for boolean 'true' and 'false' in query strings alongside 1 and 0 -- Added pagination for projects list on the console home page. - Updated storage calculation to match IEC standards - Now using Alpine as base Docker image -- Upgraded device detctor to version 3.12.6 -- Upgraded MariaDB to version 10.5.5 -- Switch standard ports to 95xx prefix ([#780](https://github.com/appwrite/appwrite/pull/780)) +- Switch standard dev ports to 95xx prefix ([#780](https://github.com/appwrite/appwrite/pull/780)) - User & Team name max length is now 128 chars and not 100 for better API consistency - Collection name max length is now 128 chars and not 256 for better API consistency - Project name max length is now 128 chars and not 100 for better API consistency @@ -40,20 +28,43 @@ - API Key name max length is now 128 chars and not 256 for better API consistency - Task name max length is now 128 chars and not 256 for better API consistency - Platform name max length is now 128 chars and not 256 for better API consistency -- Webhooks payloads are now exactly the same as any of the API response objects +- Webhooks payloads are now exactly the same as any of the API response objects, documentation added - Added new locale: Marathi -mr (@spielers) - New and consistent response format for all API object + new response examples in the docs - Removed user roles attribute from user object (can be fetched from /v1/teams/memberships) ** - Removed type attribute from session object response (used only internally) - ** - might be changed before merging to master -- Upgraded Traefik image to version 2.3 -- Upgraded Redis Docker image to version 6.0 (alpine) -- Upgraded Influxdb Docker image to version 1.8 (alpine) -- Added option to disable mail sending by setting empty SMTP host + - Added fallback option to 0.6 format for backward compatibility with any changes (@christyjacob4 [#772](https://github.com/appwrite/appwrite/pull/772)) +- Added option to disable mail sending by setting an empty SMTP host value ([#730](https://github.com/appwrite/appwrite/issues/730)) - Upgraded installation script ([#490](https://github.com/appwrite/appwrite/issues/490)) - Added new environment variables for ClamAV hostname and port ([#780](https://github.com/appwrite/appwrite/pull/780)) +- New OAuth adapter for Box.com (@armino-dev - [#420](https://github.com/appwrite/appwrite/issues/410)) +- New OAuth adapter for PayPal sandbox (@armino-dev - [#420](https://github.com/appwrite/appwrite/issues/410)) + +### User Interface +- Updated grid for OAuth2 providers list in the console ([#413](https://github.com/appwrite/appwrite/issues/413)) +- Added Google Fonts to Appwrite for offline availability +- Added option to delete user from the console (@PineappleIOnic - [#538](https://github.com/appwrite/appwrite/issues/538)) +- Added option to delete team from the console ([#380](https://github.com/appwrite/appwrite/issues/380)) +- Added option to view team members from the console ([#378](https://github.com/appwrite/appwrite/issues/378)) +- Add option to assign new team members to a team from the console and the API ([#379](https://github.com/appwrite/appwrite/issues/379)) +- Added Select All Checkbox for on Console API key Scopes Screen ([#477](https://github.com/appwrite/appwrite/issues/477)) +- Added pagination and search for team memberships route ([#387](https://github.com/appwrite/appwrite/issues/387)) +- Added pagination for projects list on the console home page. +- UI performance & accessibility improvements ([#406](https://github.com/appwrite/appwrite/pull/406)) +- New UI micro-interactions and CSS fixes (@AnatoleLucet) - Added toggle to hide/show secret keys and passwords inside the dashboard (@kodumbeats, [#535](https://github.com/appwrite/appwrite/issues/535)) +### Upgrades +- Upgraded QR codes generator library (@PedroCisnerosSantana - [#475](https://github.com/appwrite/appwrite/issues/475)) +- Upgraded Traefik image to version 2.3 +- Upgraded MariaDB to version 10.5.5 +- Upgraded Redis Docker image to version 6.0 (alpine) +- Upgraded Influxdb Docker image to version 1.8 (alpine) +- Upgraded Redis Resque queue library to version 1.3.6 ([#319](https://github.com/appwrite/appwrite/issues/319)) +- Upgraded ClamAV container image to version 1.0.11 ([#412](https://github.com/appwrite/appwrite/issues/412)) +- Upgraded device detctor to version 3.12.6 + ## Breaking Changes (Read before upgrading!) - **Deprecated** `first` and `last` query params for documents list route in the database API - **Deprecated** Deprectaed Pubjabi Translations ('pn') @@ -91,8 +102,6 @@ - Fixed Bug when trying to overwrite OAuth cookie in the Flutter SDK - Fixed OAuth redirect when using the self-hosted instance default success URL ([#454](https://github.com/appwrite/appwrite/issues/454)) - Fixed bug denying authentication with Github OAuth provider -- New OAuth adapter for Box.com -- New OAuth adapter for PayPal sandbox - Fixed a bug making read permission overwrite write permission in some cases ## Breaking Changes From 855858c42064ab19805dc84e73e3730f50152f45 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Tue, 5 Jan 2021 15:25:01 +0200 Subject: [PATCH 100/230] Removed duplicates --- CHANGES.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 53c49c5bee..fb6ce00924 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -103,11 +103,6 @@ - Fixed OAuth redirect when using the self-hosted instance default success URL ([#454](https://github.com/appwrite/appwrite/issues/454)) - Fixed bug denying authentication with Github OAuth provider - Fixed a bug making read permission overwrite write permission in some cases - -## Breaking Changes -- **Deprecated** `first` and `last` query params for documents list route in the database API -- **Deprecated** Deprecated Punjabi Translations ('pn') - ## Security - Access to Health API now requires authentication with an API Key with access to `health.read` scope allowed From a951b9a0f9301a017e0dbad64ff0d7d937d50c05 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Tue, 5 Jan 2021 15:26:31 +0200 Subject: [PATCH 101/230] Removed subtitle --- CHANGES.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index fb6ce00924..d9ec45dd6c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,10 +2,7 @@ ## Features -- Improved Webhooks and New System Events - [Learn more]() - - -### New APIs +- Improved Webhooks and added new system events - [Learn more]() - Added response to /locale/languages API with a list of languages (@TorstenDittmann ,[#351](https://github.com/appwrite/appwrite/issues/351)) - Added a new route in the Avatars API to get user initials avatar ([#386](https://github.com/appwrite/appwrite/issues/386)) - Added API response payload structure info and examples to the docs site ([#381](https://github.com/appwrite/appwrite/issues/381)) From 5db9c9b6253f3ae4c9601a391543f2a85668090d Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Tue, 5 Jan 2021 19:16:06 +0530 Subject: [PATCH 102/230] feat: review comments --- app/controllers/general.php | 2 +- src/Appwrite/Utopia/Response/Filters/V06.php | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index ed45f528dd..55f196e266 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -100,7 +100,7 @@ App::init(function ($utopia, $request, $response, $console, $project, $user, $lo * Response format */ $responseFormat = $request->getHeader('x-appwrite-response-format', App::getEnv('_APP_SYSTEM_RESPONSE_FORMAT', '')); - if (!empty($responseFormat)) { + if ($responseFormat) { switch($responseFormat) { case version_compare ($responseFormat , '0.6.2', '<=') : Response::setFilter(new V06()); diff --git a/src/Appwrite/Utopia/Response/Filters/V06.php b/src/Appwrite/Utopia/Response/Filters/V06.php index 4bbeccb83e..d6bd85ac8f 100644 --- a/src/Appwrite/Utopia/Response/Filters/V06.php +++ b/src/Appwrite/Utopia/Response/Filters/V06.php @@ -193,13 +193,13 @@ class V06 extends Filter { private function parseLocale(array $content) { - $content['ip'] = empty($content['ip']) ? '' : $content['ip']; - $content['countryCode'] = empty($content['countryCode']) ? '--' : $content['countryCode']; - $content['country'] = empty($content['country']) ? Locale::getText('locale.country.unknown') : $content['country']; - $content['continent'] = empty($content['continent']) ? Locale::getText('locale.country.unknown') : $content['continent']; - $content['continentCode'] = empty($content['continentCode']) ? '--' : $content['continentCode']; - $content['eu'] = empty($content['eu']) ? false : $content['eu']; - $content['currency'] = empty($content['currency']) ? null : $content['currency']; + $content['ip'] = empty($content['ip']) ?? ''; + $content['countryCode'] = empty($content['countryCode']) ?? '--'; + $content['country'] = empty($content['country']) ?? Locale::getText('locale.country.unknown'); + $content['continent'] = empty($content['continent']) ?? Locale::getText('locale.country.unknown'); + $content['continentCode'] = empty($content['continentCode']) ?? '--'; + $content['eu'] = empty($content['eu']) ?? false; + $content['currency'] = empty($content['currency']) ?? null; return $content; } From 4a05e963901b7d9c468ea207e4a95e8d0afabc4e Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Tue, 5 Jan 2021 23:33:36 +0200 Subject: [PATCH 103/230] Updated dependencies --- composer.json | 2 +- composer.lock | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/composer.json b/composer.json index a74996f91a..f0dc6c104c 100644 --- a/composer.json +++ b/composer.json @@ -56,7 +56,7 @@ }, "require-dev": { "swoole/ide-helper": "4.5.5", - "appwrite/sdk-generator": "0.3.2", + "appwrite/sdk-generator": "0.3.3", "phpunit/phpunit": "9.4.2", "vimeo/psalm": "4.1.1" }, diff --git a/composer.lock b/composer.lock index 42591c7182..23bbf8edea 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "229bcebe0c03153ab739cd324fb4eb43", + "content-hash": "2dee8b75780ba88fd7da28d08d691998", "packages": [ { "name": "appwrite/php-clamav", @@ -1858,11 +1858,11 @@ }, { "name": "appwrite/sdk-generator", - "version": "0.3.2", + "version": "0.3.3", "source": { "type": "git", "url": "https://github.com/appwrite/sdk-generator", - "reference": "7d762df83f2539ca89605e40541afbdb20941542" + "reference": "7530820a1ee824874d89749c51b0e49d15595abc" }, "require": { "ext-curl": "*", @@ -1892,7 +1892,7 @@ } ], "description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms", - "time": "2021-01-04T16:19:42+00:00" + "time": "2021-01-05T17:58:17+00:00" }, { "name": "composer/package-versions-deprecated", @@ -4513,12 +4513,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "5a8ebe413fbd4091d5b3c5b70e298141681c59c7" + "reference": "af2bafc13cb92e182bf634285346925e09888d23" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/5a8ebe413fbd4091d5b3c5b70e298141681c59c7", - "reference": "5a8ebe413fbd4091d5b3c5b70e298141681c59c7", + "url": "https://api.github.com/repos/symfony/console/zipball/af2bafc13cb92e182bf634285346925e09888d23", + "reference": "af2bafc13cb92e182bf634285346925e09888d23", "shasum": "" }, "require": { @@ -4603,7 +4603,7 @@ "type": "tidelift" } ], - "time": "2021-01-01T09:27:20+00:00" + "time": "2021-01-05T19:51:30+00:00" }, { "name": "symfony/polyfill-ctype", @@ -5318,12 +5318,12 @@ "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "846ebbd7c8e780913fa5731d9c6139522111b56f" + "reference": "a0e2cc25723f3cdb6bbaf617664c4e228f1e9886" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/846ebbd7c8e780913fa5731d9c6139522111b56f", - "reference": "846ebbd7c8e780913fa5731d9c6139522111b56f", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/a0e2cc25723f3cdb6bbaf617664c4e228f1e9886", + "reference": "a0e2cc25723f3cdb6bbaf617664c4e228f1e9886", "shasum": "" }, "require": { @@ -5389,7 +5389,7 @@ "type": "tidelift" } ], - "time": "2021-01-01T14:57:43+00:00" + "time": "2021-01-05T15:39:16+00:00" }, { "name": "vimeo/psalm", From bb0725261d0edb6fc5e28e2eedbe4acfef32aea2 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Tue, 5 Jan 2021 23:34:49 +0200 Subject: [PATCH 104/230] Updated code examples --- .../0.6.2/server-dotnet/examples/avatars/get-browser.md | 8 ++++---- .../server-dotnet/examples/avatars/get-credit-card.md | 8 ++++---- .../0.6.2/server-dotnet/examples/avatars/get-favicon.md | 8 ++++---- .../0.6.2/server-dotnet/examples/avatars/get-flag.md | 8 ++++---- .../0.6.2/server-dotnet/examples/avatars/get-image.md | 8 ++++---- .../0.6.2/server-dotnet/examples/avatars/get-initials.md | 8 ++++---- .../0.6.2/server-dotnet/examples/avatars/get-q-r.md | 8 ++++---- .../server-dotnet/examples/database/create-collection.md | 8 ++++---- .../server-dotnet/examples/database/create-document.md | 8 ++++---- .../server-dotnet/examples/database/delete-collection.md | 8 ++++---- .../server-dotnet/examples/database/delete-document.md | 8 ++++---- .../server-dotnet/examples/database/get-collection.md | 8 ++++---- .../0.6.2/server-dotnet/examples/database/get-document.md | 8 ++++---- .../server-dotnet/examples/database/list-collections.md | 8 ++++---- .../server-dotnet/examples/database/list-documents.md | 8 ++++---- .../server-dotnet/examples/database/update-collection.md | 8 ++++---- .../server-dotnet/examples/database/update-document.md | 8 ++++---- .../0.6.2/server-dotnet/examples/health/get-anti-virus.md | 8 ++++---- .../0.6.2/server-dotnet/examples/health/get-cache.md | 8 ++++---- .../0.6.2/server-dotnet/examples/health/get-d-b.md | 8 ++++---- .../examples/health/get-queue-certificates.md | 8 ++++---- .../server-dotnet/examples/health/get-queue-functions.md | 8 ++++---- .../0.6.2/server-dotnet/examples/health/get-queue-logs.md | 8 ++++---- .../server-dotnet/examples/health/get-queue-tasks.md | 8 ++++---- .../server-dotnet/examples/health/get-queue-usage.md | 8 ++++---- .../server-dotnet/examples/health/get-queue-webhooks.md | 8 ++++---- .../server-dotnet/examples/health/get-storage-local.md | 8 ++++---- .../0.6.2/server-dotnet/examples/health/get-time.md | 8 ++++---- docs/examples/0.6.2/server-dotnet/examples/health/get.md | 8 ++++---- .../0.6.2/server-dotnet/examples/locale/get-continents.md | 8 ++++---- .../server-dotnet/examples/locale/get-countries-e-u.md | 8 ++++---- .../server-dotnet/examples/locale/get-countries-phones.md | 8 ++++---- .../0.6.2/server-dotnet/examples/locale/get-countries.md | 8 ++++---- .../0.6.2/server-dotnet/examples/locale/get-currencies.md | 8 ++++---- .../0.6.2/server-dotnet/examples/locale/get-languages.md | 8 ++++---- docs/examples/0.6.2/server-dotnet/examples/locale/get.md | 8 ++++---- .../0.6.2/server-dotnet/examples/storage/create-file.md | 8 ++++---- .../0.6.2/server-dotnet/examples/storage/delete-file.md | 8 ++++---- .../server-dotnet/examples/storage/get-file-download.md | 8 ++++---- .../server-dotnet/examples/storage/get-file-preview.md | 8 ++++---- .../0.6.2/server-dotnet/examples/storage/get-file-view.md | 8 ++++---- .../0.6.2/server-dotnet/examples/storage/get-file.md | 8 ++++---- .../0.6.2/server-dotnet/examples/storage/list-files.md | 8 ++++---- .../0.6.2/server-dotnet/examples/storage/update-file.md | 8 ++++---- .../server-dotnet/examples/teams/create-membership.md | 8 ++++---- .../examples/0.6.2/server-dotnet/examples/teams/create.md | 8 ++++---- .../server-dotnet/examples/teams/delete-membership.md | 8 ++++---- .../examples/0.6.2/server-dotnet/examples/teams/delete.md | 8 ++++---- .../0.6.2/server-dotnet/examples/teams/get-memberships.md | 8 ++++---- docs/examples/0.6.2/server-dotnet/examples/teams/get.md | 8 ++++---- docs/examples/0.6.2/server-dotnet/examples/teams/list.md | 8 ++++---- .../examples/0.6.2/server-dotnet/examples/teams/update.md | 8 ++++---- .../examples/0.6.2/server-dotnet/examples/users/create.md | 8 ++++---- .../0.6.2/server-dotnet/examples/users/delete-session.md | 8 ++++---- .../0.6.2/server-dotnet/examples/users/delete-sessions.md | 8 ++++---- .../0.6.2/server-dotnet/examples/users/get-logs.md | 8 ++++---- .../0.6.2/server-dotnet/examples/users/get-prefs.md | 8 ++++---- .../0.6.2/server-dotnet/examples/users/get-sessions.md | 8 ++++---- docs/examples/0.6.2/server-dotnet/examples/users/get.md | 8 ++++---- docs/examples/0.6.2/server-dotnet/examples/users/list.md | 8 ++++---- .../0.6.2/server-dotnet/examples/users/update-prefs.md | 8 ++++---- .../0.6.2/server-dotnet/examples/users/update-status.md | 8 ++++---- 62 files changed, 248 insertions(+), 248 deletions(-) diff --git a/docs/examples/0.6.2/server-dotnet/examples/avatars/get-browser.md b/docs/examples/0.6.2/server-dotnet/examples/avatars/get-browser.md index 6d6a5b7f18..d4c2d0312d 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/avatars/get-browser.md +++ b/docs/examples/0.6.2/server-dotnet/examples/avatars/get-browser.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Avatars avatars = new Avatars(client); -result = avatars.getBrowser("aa"); +string result = await avatars.GetBrowser("aa"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/avatars/get-credit-card.md b/docs/examples/0.6.2/server-dotnet/examples/avatars/get-credit-card.md index 8a89c04618..d0ab8d7205 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/avatars/get-credit-card.md +++ b/docs/examples/0.6.2/server-dotnet/examples/avatars/get-credit-card.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Avatars avatars = new Avatars(client); -result = avatars.getCreditCard("amex"); +string result = await avatars.GetCreditCard("amex"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/avatars/get-favicon.md b/docs/examples/0.6.2/server-dotnet/examples/avatars/get-favicon.md index d51b02a7c3..85155dbfd4 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/avatars/get-favicon.md +++ b/docs/examples/0.6.2/server-dotnet/examples/avatars/get-favicon.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Avatars avatars = new Avatars(client); -result = avatars.getFavicon("https://example.com"); +string result = await avatars.GetFavicon("https://example.com"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/avatars/get-flag.md b/docs/examples/0.6.2/server-dotnet/examples/avatars/get-flag.md index 88a06d16ff..031b52af14 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/avatars/get-flag.md +++ b/docs/examples/0.6.2/server-dotnet/examples/avatars/get-flag.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Avatars avatars = new Avatars(client); -result = avatars.getFlag("af"); +string result = await avatars.GetFlag("af"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/avatars/get-image.md b/docs/examples/0.6.2/server-dotnet/examples/avatars/get-image.md index 06d021dcf7..d8e6c98558 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/avatars/get-image.md +++ b/docs/examples/0.6.2/server-dotnet/examples/avatars/get-image.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Avatars avatars = new Avatars(client); -result = avatars.getImage("https://example.com"); +string result = await avatars.GetImage("https://example.com"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/avatars/get-initials.md b/docs/examples/0.6.2/server-dotnet/examples/avatars/get-initials.md index 09e91e0120..177216034b 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/avatars/get-initials.md +++ b/docs/examples/0.6.2/server-dotnet/examples/avatars/get-initials.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Avatars avatars = new Avatars(client); -result = avatars.getInitials(); +string result = await avatars.GetInitials(); diff --git a/docs/examples/0.6.2/server-dotnet/examples/avatars/get-q-r.md b/docs/examples/0.6.2/server-dotnet/examples/avatars/get-q-r.md index 5f410cd4ae..e057ed6877 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/avatars/get-q-r.md +++ b/docs/examples/0.6.2/server-dotnet/examples/avatars/get-q-r.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Avatars avatars = new Avatars(client); -result = avatars.getQR("[TEXT]"); +string result = await avatars.GetQR("[TEXT]"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/database/create-collection.md b/docs/examples/0.6.2/server-dotnet/examples/database/create-collection.md index 92a26b5559..a8c2c3f7e0 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/database/create-collection.md +++ b/docs/examples/0.6.2/server-dotnet/examples/database/create-collection.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Database database = new Database(client); -result = database.createCollection("[NAME]", {}, {}, {}); +HttpResponseMessage result = await database.CreateCollection("[NAME]", {}, {}, {}); diff --git a/docs/examples/0.6.2/server-dotnet/examples/database/create-document.md b/docs/examples/0.6.2/server-dotnet/examples/database/create-document.md index 70d00bac14..1a875067a1 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/database/create-document.md +++ b/docs/examples/0.6.2/server-dotnet/examples/database/create-document.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Database database = new Database(client); -result = database.createDocument("[COLLECTION_ID]", {}, {}, {}); +HttpResponseMessage result = await database.CreateDocument("[COLLECTION_ID]", {}, {}, {}); diff --git a/docs/examples/0.6.2/server-dotnet/examples/database/delete-collection.md b/docs/examples/0.6.2/server-dotnet/examples/database/delete-collection.md index 7a611e4778..4648a3e194 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/database/delete-collection.md +++ b/docs/examples/0.6.2/server-dotnet/examples/database/delete-collection.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Database database = new Database(client); -result = database.deleteCollection("[COLLECTION_ID]"); +HttpResponseMessage result = await database.DeleteCollection("[COLLECTION_ID]"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/database/delete-document.md b/docs/examples/0.6.2/server-dotnet/examples/database/delete-document.md index 7af78fc558..80f413b468 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/database/delete-document.md +++ b/docs/examples/0.6.2/server-dotnet/examples/database/delete-document.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Database database = new Database(client); -result = database.deleteDocument("[COLLECTION_ID]", "[DOCUMENT_ID]"); +HttpResponseMessage result = await database.DeleteDocument("[COLLECTION_ID]", "[DOCUMENT_ID]"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/database/get-collection.md b/docs/examples/0.6.2/server-dotnet/examples/database/get-collection.md index f2bc02fc97..88f046ba2e 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/database/get-collection.md +++ b/docs/examples/0.6.2/server-dotnet/examples/database/get-collection.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Database database = new Database(client); -result = database.getCollection("[COLLECTION_ID]"); +HttpResponseMessage result = await database.GetCollection("[COLLECTION_ID]"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/database/get-document.md b/docs/examples/0.6.2/server-dotnet/examples/database/get-document.md index 376057e59b..1d425bac59 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/database/get-document.md +++ b/docs/examples/0.6.2/server-dotnet/examples/database/get-document.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Database database = new Database(client); -result = database.getDocument("[COLLECTION_ID]", "[DOCUMENT_ID]"); +HttpResponseMessage result = await database.GetDocument("[COLLECTION_ID]", "[DOCUMENT_ID]"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/database/list-collections.md b/docs/examples/0.6.2/server-dotnet/examples/database/list-collections.md index b9af7abf1c..593438d255 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/database/list-collections.md +++ b/docs/examples/0.6.2/server-dotnet/examples/database/list-collections.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Database database = new Database(client); -result = database.listCollections(); +HttpResponseMessage result = await database.ListCollections(); diff --git a/docs/examples/0.6.2/server-dotnet/examples/database/list-documents.md b/docs/examples/0.6.2/server-dotnet/examples/database/list-documents.md index 355bc43476..36e31468f9 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/database/list-documents.md +++ b/docs/examples/0.6.2/server-dotnet/examples/database/list-documents.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Database database = new Database(client); -result = database.listDocuments("[COLLECTION_ID]"); +HttpResponseMessage result = await database.ListDocuments("[COLLECTION_ID]"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/database/update-collection.md b/docs/examples/0.6.2/server-dotnet/examples/database/update-collection.md index 33ae0d7d91..42c67650d1 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/database/update-collection.md +++ b/docs/examples/0.6.2/server-dotnet/examples/database/update-collection.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Database database = new Database(client); -result = database.updateCollection("[COLLECTION_ID]", "[NAME]", {}, {}); +HttpResponseMessage result = await database.UpdateCollection("[COLLECTION_ID]", "[NAME]", {}, {}); diff --git a/docs/examples/0.6.2/server-dotnet/examples/database/update-document.md b/docs/examples/0.6.2/server-dotnet/examples/database/update-document.md index 719d9f5e2e..5f4c173b7a 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/database/update-document.md +++ b/docs/examples/0.6.2/server-dotnet/examples/database/update-document.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Database database = new Database(client); -result = database.updateDocument("[COLLECTION_ID]", "[DOCUMENT_ID]", {}, {}, {}); +HttpResponseMessage result = await database.UpdateDocument("[COLLECTION_ID]", "[DOCUMENT_ID]", {}, {}, {}); diff --git a/docs/examples/0.6.2/server-dotnet/examples/health/get-anti-virus.md b/docs/examples/0.6.2/server-dotnet/examples/health/get-anti-virus.md index 3a2b920271..a287ec4617 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/health/get-anti-virus.md +++ b/docs/examples/0.6.2/server-dotnet/examples/health/get-anti-virus.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Health health = new Health(client); -result = health.getAntiVirus(); +HttpResponseMessage result = await health.GetAntiVirus(); diff --git a/docs/examples/0.6.2/server-dotnet/examples/health/get-cache.md b/docs/examples/0.6.2/server-dotnet/examples/health/get-cache.md index cba191b265..66c72f77b6 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/health/get-cache.md +++ b/docs/examples/0.6.2/server-dotnet/examples/health/get-cache.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Health health = new Health(client); -result = health.getCache(); +HttpResponseMessage result = await health.GetCache(); diff --git a/docs/examples/0.6.2/server-dotnet/examples/health/get-d-b.md b/docs/examples/0.6.2/server-dotnet/examples/health/get-d-b.md index 27a46ffe7c..94e3556b4e 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/health/get-d-b.md +++ b/docs/examples/0.6.2/server-dotnet/examples/health/get-d-b.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Health health = new Health(client); -result = health.getDB(); +HttpResponseMessage result = await health.GetDB(); diff --git a/docs/examples/0.6.2/server-dotnet/examples/health/get-queue-certificates.md b/docs/examples/0.6.2/server-dotnet/examples/health/get-queue-certificates.md index 895147525a..f0dbb9086b 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/health/get-queue-certificates.md +++ b/docs/examples/0.6.2/server-dotnet/examples/health/get-queue-certificates.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Health health = new Health(client); -result = health.getQueueCertificates(); +HttpResponseMessage result = await health.GetQueueCertificates(); diff --git a/docs/examples/0.6.2/server-dotnet/examples/health/get-queue-functions.md b/docs/examples/0.6.2/server-dotnet/examples/health/get-queue-functions.md index 1e6130ddbd..c0a0b14628 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/health/get-queue-functions.md +++ b/docs/examples/0.6.2/server-dotnet/examples/health/get-queue-functions.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Health health = new Health(client); -result = health.getQueueFunctions(); +HttpResponseMessage result = await health.GetQueueFunctions(); diff --git a/docs/examples/0.6.2/server-dotnet/examples/health/get-queue-logs.md b/docs/examples/0.6.2/server-dotnet/examples/health/get-queue-logs.md index bf9dec6e7c..11ea9dbff1 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/health/get-queue-logs.md +++ b/docs/examples/0.6.2/server-dotnet/examples/health/get-queue-logs.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Health health = new Health(client); -result = health.getQueueLogs(); +HttpResponseMessage result = await health.GetQueueLogs(); diff --git a/docs/examples/0.6.2/server-dotnet/examples/health/get-queue-tasks.md b/docs/examples/0.6.2/server-dotnet/examples/health/get-queue-tasks.md index 0ca3a4b3f0..291e5ea8bd 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/health/get-queue-tasks.md +++ b/docs/examples/0.6.2/server-dotnet/examples/health/get-queue-tasks.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Health health = new Health(client); -result = health.getQueueTasks(); +HttpResponseMessage result = await health.GetQueueTasks(); diff --git a/docs/examples/0.6.2/server-dotnet/examples/health/get-queue-usage.md b/docs/examples/0.6.2/server-dotnet/examples/health/get-queue-usage.md index 74cedc0bca..ecd4f69180 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/health/get-queue-usage.md +++ b/docs/examples/0.6.2/server-dotnet/examples/health/get-queue-usage.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Health health = new Health(client); -result = health.getQueueUsage(); +HttpResponseMessage result = await health.GetQueueUsage(); diff --git a/docs/examples/0.6.2/server-dotnet/examples/health/get-queue-webhooks.md b/docs/examples/0.6.2/server-dotnet/examples/health/get-queue-webhooks.md index eb7f9071c1..b16a368469 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/health/get-queue-webhooks.md +++ b/docs/examples/0.6.2/server-dotnet/examples/health/get-queue-webhooks.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Health health = new Health(client); -result = health.getQueueWebhooks(); +HttpResponseMessage result = await health.GetQueueWebhooks(); diff --git a/docs/examples/0.6.2/server-dotnet/examples/health/get-storage-local.md b/docs/examples/0.6.2/server-dotnet/examples/health/get-storage-local.md index 0cfc305b63..793d9c8667 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/health/get-storage-local.md +++ b/docs/examples/0.6.2/server-dotnet/examples/health/get-storage-local.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Health health = new Health(client); -result = health.getStorageLocal(); +HttpResponseMessage result = await health.GetStorageLocal(); diff --git a/docs/examples/0.6.2/server-dotnet/examples/health/get-time.md b/docs/examples/0.6.2/server-dotnet/examples/health/get-time.md index 4887d4b20b..00431f7b2f 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/health/get-time.md +++ b/docs/examples/0.6.2/server-dotnet/examples/health/get-time.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Health health = new Health(client); -result = health.getTime(); +HttpResponseMessage result = await health.GetTime(); diff --git a/docs/examples/0.6.2/server-dotnet/examples/health/get.md b/docs/examples/0.6.2/server-dotnet/examples/health/get.md index 1b7428a216..f487428928 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/health/get.md +++ b/docs/examples/0.6.2/server-dotnet/examples/health/get.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Health health = new Health(client); -result = health.get(); +HttpResponseMessage result = await health.Get(); diff --git a/docs/examples/0.6.2/server-dotnet/examples/locale/get-continents.md b/docs/examples/0.6.2/server-dotnet/examples/locale/get-continents.md index 0f85130aa3..ad5590032c 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/locale/get-continents.md +++ b/docs/examples/0.6.2/server-dotnet/examples/locale/get-continents.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Locale locale = new Locale(client); -result = locale.getContinents(); +HttpResponseMessage result = await locale.GetContinents(); diff --git a/docs/examples/0.6.2/server-dotnet/examples/locale/get-countries-e-u.md b/docs/examples/0.6.2/server-dotnet/examples/locale/get-countries-e-u.md index 8567e3ea4e..6bd92406cf 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/locale/get-countries-e-u.md +++ b/docs/examples/0.6.2/server-dotnet/examples/locale/get-countries-e-u.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Locale locale = new Locale(client); -result = locale.getCountriesEU(); +HttpResponseMessage result = await locale.GetCountriesEU(); diff --git a/docs/examples/0.6.2/server-dotnet/examples/locale/get-countries-phones.md b/docs/examples/0.6.2/server-dotnet/examples/locale/get-countries-phones.md index a2c5e1a8ab..2952035a5a 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/locale/get-countries-phones.md +++ b/docs/examples/0.6.2/server-dotnet/examples/locale/get-countries-phones.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Locale locale = new Locale(client); -result = locale.getCountriesPhones(); +HttpResponseMessage result = await locale.GetCountriesPhones(); diff --git a/docs/examples/0.6.2/server-dotnet/examples/locale/get-countries.md b/docs/examples/0.6.2/server-dotnet/examples/locale/get-countries.md index 724c019133..fa65eede63 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/locale/get-countries.md +++ b/docs/examples/0.6.2/server-dotnet/examples/locale/get-countries.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Locale locale = new Locale(client); -result = locale.getCountries(); +HttpResponseMessage result = await locale.GetCountries(); diff --git a/docs/examples/0.6.2/server-dotnet/examples/locale/get-currencies.md b/docs/examples/0.6.2/server-dotnet/examples/locale/get-currencies.md index 44f4ba5924..bfe091796c 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/locale/get-currencies.md +++ b/docs/examples/0.6.2/server-dotnet/examples/locale/get-currencies.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Locale locale = new Locale(client); -result = locale.getCurrencies(); +HttpResponseMessage result = await locale.GetCurrencies(); diff --git a/docs/examples/0.6.2/server-dotnet/examples/locale/get-languages.md b/docs/examples/0.6.2/server-dotnet/examples/locale/get-languages.md index 8020c37230..5bb2571246 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/locale/get-languages.md +++ b/docs/examples/0.6.2/server-dotnet/examples/locale/get-languages.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Locale locale = new Locale(client); -result = locale.getLanguages(); +HttpResponseMessage result = await locale.GetLanguages(); diff --git a/docs/examples/0.6.2/server-dotnet/examples/locale/get.md b/docs/examples/0.6.2/server-dotnet/examples/locale/get.md index ce9d4207b6..ba59d83b7b 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/locale/get.md +++ b/docs/examples/0.6.2/server-dotnet/examples/locale/get.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Locale locale = new Locale(client); -result = locale.get(); +HttpResponseMessage result = await locale.Get(); diff --git a/docs/examples/0.6.2/server-dotnet/examples/storage/create-file.md b/docs/examples/0.6.2/server-dotnet/examples/storage/create-file.md index f0ac77f9d8..5427fceb1e 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/storage/create-file.md +++ b/docs/examples/0.6.2/server-dotnet/examples/storage/create-file.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Storage storage = new Storage(client); -result = storage.createFile(new File("./path-to-files/image.jpg"), {}, {}); +HttpResponseMessage result = await storage.CreateFile(new File("./path-to-files/image.jpg"), {}, {}); diff --git a/docs/examples/0.6.2/server-dotnet/examples/storage/delete-file.md b/docs/examples/0.6.2/server-dotnet/examples/storage/delete-file.md index d478052b7c..c78d0fbeb2 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/storage/delete-file.md +++ b/docs/examples/0.6.2/server-dotnet/examples/storage/delete-file.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Storage storage = new Storage(client); -result = storage.deleteFile("[FILE_ID]"); +HttpResponseMessage result = await storage.DeleteFile("[FILE_ID]"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/storage/get-file-download.md b/docs/examples/0.6.2/server-dotnet/examples/storage/get-file-download.md index fc209435fe..4f0f940130 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/storage/get-file-download.md +++ b/docs/examples/0.6.2/server-dotnet/examples/storage/get-file-download.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Storage storage = new Storage(client); -result = storage.getFileDownload("[FILE_ID]"); +string result = await storage.GetFileDownload("[FILE_ID]"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/storage/get-file-preview.md b/docs/examples/0.6.2/server-dotnet/examples/storage/get-file-preview.md index ba50cb911a..1c7df59c31 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/storage/get-file-preview.md +++ b/docs/examples/0.6.2/server-dotnet/examples/storage/get-file-preview.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Storage storage = new Storage(client); -result = storage.getFilePreview("[FILE_ID]"); +string result = await storage.GetFilePreview("[FILE_ID]"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/storage/get-file-view.md b/docs/examples/0.6.2/server-dotnet/examples/storage/get-file-view.md index 87226f1603..61843791d2 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/storage/get-file-view.md +++ b/docs/examples/0.6.2/server-dotnet/examples/storage/get-file-view.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Storage storage = new Storage(client); -result = storage.getFileView("[FILE_ID]"); +string result = await storage.GetFileView("[FILE_ID]"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/storage/get-file.md b/docs/examples/0.6.2/server-dotnet/examples/storage/get-file.md index 50553b6b0e..a23d658b10 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/storage/get-file.md +++ b/docs/examples/0.6.2/server-dotnet/examples/storage/get-file.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Storage storage = new Storage(client); -result = storage.getFile("[FILE_ID]"); +HttpResponseMessage result = await storage.GetFile("[FILE_ID]"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/storage/list-files.md b/docs/examples/0.6.2/server-dotnet/examples/storage/list-files.md index ba9bb077b8..df57620627 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/storage/list-files.md +++ b/docs/examples/0.6.2/server-dotnet/examples/storage/list-files.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Storage storage = new Storage(client); -result = storage.listFiles(); +HttpResponseMessage result = await storage.ListFiles(); diff --git a/docs/examples/0.6.2/server-dotnet/examples/storage/update-file.md b/docs/examples/0.6.2/server-dotnet/examples/storage/update-file.md index 1aa65653c2..8effc42980 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/storage/update-file.md +++ b/docs/examples/0.6.2/server-dotnet/examples/storage/update-file.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Storage storage = new Storage(client); -result = storage.updateFile("[FILE_ID]", {}, {}); +HttpResponseMessage result = await storage.UpdateFile("[FILE_ID]", {}, {}); diff --git a/docs/examples/0.6.2/server-dotnet/examples/teams/create-membership.md b/docs/examples/0.6.2/server-dotnet/examples/teams/create-membership.md index 66832b80f1..d149cb4738 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/teams/create-membership.md +++ b/docs/examples/0.6.2/server-dotnet/examples/teams/create-membership.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Teams teams = new Teams(client); -result = teams.createMembership("[TEAM_ID]", "email@example.com", {}, "https://example.com"); +HttpResponseMessage result = await teams.CreateMembership("[TEAM_ID]", "email@example.com", {}, "https://example.com"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/teams/create.md b/docs/examples/0.6.2/server-dotnet/examples/teams/create.md index ff5ee26138..a78e517308 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/teams/create.md +++ b/docs/examples/0.6.2/server-dotnet/examples/teams/create.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Teams teams = new Teams(client); -result = teams.create("[NAME]"); +HttpResponseMessage result = await teams.Create("[NAME]"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/teams/delete-membership.md b/docs/examples/0.6.2/server-dotnet/examples/teams/delete-membership.md index 7c1900621c..d551dbf3aa 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/teams/delete-membership.md +++ b/docs/examples/0.6.2/server-dotnet/examples/teams/delete-membership.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Teams teams = new Teams(client); -result = teams.deleteMembership("[TEAM_ID]", "[INVITE_ID]"); +HttpResponseMessage result = await teams.DeleteMembership("[TEAM_ID]", "[INVITE_ID]"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/teams/delete.md b/docs/examples/0.6.2/server-dotnet/examples/teams/delete.md index ae0fda06ad..a08d23519c 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/teams/delete.md +++ b/docs/examples/0.6.2/server-dotnet/examples/teams/delete.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Teams teams = new Teams(client); -result = teams.delete("[TEAM_ID]"); +HttpResponseMessage result = await teams.Delete("[TEAM_ID]"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/teams/get-memberships.md b/docs/examples/0.6.2/server-dotnet/examples/teams/get-memberships.md index 1aac54c69d..1d76616f5e 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/teams/get-memberships.md +++ b/docs/examples/0.6.2/server-dotnet/examples/teams/get-memberships.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Teams teams = new Teams(client); -result = teams.getMemberships("[TEAM_ID]"); +HttpResponseMessage result = await teams.GetMemberships("[TEAM_ID]"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/teams/get.md b/docs/examples/0.6.2/server-dotnet/examples/teams/get.md index eb0bc28f73..796f600bd9 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/teams/get.md +++ b/docs/examples/0.6.2/server-dotnet/examples/teams/get.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Teams teams = new Teams(client); -result = teams.get("[TEAM_ID]"); +HttpResponseMessage result = await teams.Get("[TEAM_ID]"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/teams/list.md b/docs/examples/0.6.2/server-dotnet/examples/teams/list.md index bc60aa8a35..648003524d 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/teams/list.md +++ b/docs/examples/0.6.2/server-dotnet/examples/teams/list.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Teams teams = new Teams(client); -result = teams.list(); +HttpResponseMessage result = await teams.List(); diff --git a/docs/examples/0.6.2/server-dotnet/examples/teams/update.md b/docs/examples/0.6.2/server-dotnet/examples/teams/update.md index 3815283343..54ed78db72 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/teams/update.md +++ b/docs/examples/0.6.2/server-dotnet/examples/teams/update.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Teams teams = new Teams(client); -result = teams.update("[TEAM_ID]", "[NAME]"); +HttpResponseMessage result = await teams.Update("[TEAM_ID]", "[NAME]"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/users/create.md b/docs/examples/0.6.2/server-dotnet/examples/users/create.md index 536e995d0b..1f7fab70a7 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/users/create.md +++ b/docs/examples/0.6.2/server-dotnet/examples/users/create.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Users users = new Users(client); -result = users.create("email@example.com", "password"); +HttpResponseMessage result = await users.Create("email@example.com", "password"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/users/delete-session.md b/docs/examples/0.6.2/server-dotnet/examples/users/delete-session.md index eb455cb140..fd322868ab 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/users/delete-session.md +++ b/docs/examples/0.6.2/server-dotnet/examples/users/delete-session.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Users users = new Users(client); -result = users.deleteSession("[USER_ID]", "[SESSION_ID]"); +HttpResponseMessage result = await users.DeleteSession("[USER_ID]", "[SESSION_ID]"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/users/delete-sessions.md b/docs/examples/0.6.2/server-dotnet/examples/users/delete-sessions.md index 5793fe5bc8..d2ed98e479 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/users/delete-sessions.md +++ b/docs/examples/0.6.2/server-dotnet/examples/users/delete-sessions.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Users users = new Users(client); -result = users.deleteSessions("[USER_ID]"); +HttpResponseMessage result = await users.DeleteSessions("[USER_ID]"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/users/get-logs.md b/docs/examples/0.6.2/server-dotnet/examples/users/get-logs.md index 0c68cad6c2..bf9db43c23 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/users/get-logs.md +++ b/docs/examples/0.6.2/server-dotnet/examples/users/get-logs.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Users users = new Users(client); -result = users.getLogs("[USER_ID]"); +HttpResponseMessage result = await users.GetLogs("[USER_ID]"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/users/get-prefs.md b/docs/examples/0.6.2/server-dotnet/examples/users/get-prefs.md index b9165807bc..b92ed4c20a 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/users/get-prefs.md +++ b/docs/examples/0.6.2/server-dotnet/examples/users/get-prefs.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Users users = new Users(client); -result = users.getPrefs("[USER_ID]"); +HttpResponseMessage result = await users.GetPrefs("[USER_ID]"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/users/get-sessions.md b/docs/examples/0.6.2/server-dotnet/examples/users/get-sessions.md index b1fff05940..2431460668 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/users/get-sessions.md +++ b/docs/examples/0.6.2/server-dotnet/examples/users/get-sessions.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Users users = new Users(client); -result = users.getSessions("[USER_ID]"); +HttpResponseMessage result = await users.GetSessions("[USER_ID]"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/users/get.md b/docs/examples/0.6.2/server-dotnet/examples/users/get.md index fb5d4ceec5..93c31c599c 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/users/get.md +++ b/docs/examples/0.6.2/server-dotnet/examples/users/get.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Users users = new Users(client); -result = users.get("[USER_ID]"); +HttpResponseMessage result = await users.Get("[USER_ID]"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/users/list.md b/docs/examples/0.6.2/server-dotnet/examples/users/list.md index bbe25485a2..f85440c498 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/users/list.md +++ b/docs/examples/0.6.2/server-dotnet/examples/users/list.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Users users = new Users(client); -result = users.list(); +HttpResponseMessage result = await users.List(); diff --git a/docs/examples/0.6.2/server-dotnet/examples/users/update-prefs.md b/docs/examples/0.6.2/server-dotnet/examples/users/update-prefs.md index accdcd757f..06ffa4245a 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/users/update-prefs.md +++ b/docs/examples/0.6.2/server-dotnet/examples/users/update-prefs.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Users users = new Users(client); -result = users.updatePrefs("[USER_ID]", {}); +HttpResponseMessage result = await users.UpdatePrefs("[USER_ID]", {}); diff --git a/docs/examples/0.6.2/server-dotnet/examples/users/update-status.md b/docs/examples/0.6.2/server-dotnet/examples/users/update-status.md index 51822dd10e..a2b00ff16c 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/users/update-status.md +++ b/docs/examples/0.6.2/server-dotnet/examples/users/update-status.md @@ -3,11 +3,11 @@ use Appwrite; Client client = new Client(); client - .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint - .SetProject("5df5acd0d48c2") # Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2") # Your secret API key + .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key ; Users users = new Users(client); -result = users.updateStatus("[USER_ID]", "1"); +HttpResponseMessage result = await users.UpdateStatus("[USER_ID]", "1"); From dfe12b2be067dc462c7f1b3b786f232422d90417 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Wed, 6 Jan 2021 14:49:11 +0200 Subject: [PATCH 105/230] Fixed object default value --- src/Appwrite/Specification/Format/OpenAPI3.php | 3 ++- src/Appwrite/Specification/Format/Swagger2.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Appwrite/Specification/Format/OpenAPI3.php b/src/Appwrite/Specification/Format/OpenAPI3.php index 18da610f8c..90f054d0af 100644 --- a/src/Appwrite/Specification/Format/OpenAPI3.php +++ b/src/Appwrite/Specification/Format/OpenAPI3.php @@ -4,6 +4,7 @@ namespace Appwrite\Specification\Format; use Appwrite\Specification\Format; use Appwrite\Template\Template; +use stdClass; class OpenAPI3 extends Format { @@ -212,7 +213,7 @@ class OpenAPI3 extends Format case 'Utopia\Validator\JSON': case 'Utopia\Validator\Mock': case 'Utopia\Validator\Assoc': - $node['schema']['type'] = 'object'; + $param['default'] = (empty($param['default'])) ? new stdClass() : $param['default']; $node['schema']['type'] = 'object'; $node['schema']['x-example'] = '{}'; //$node['schema']['format'] = 'json'; diff --git a/src/Appwrite/Specification/Format/Swagger2.php b/src/Appwrite/Specification/Format/Swagger2.php index d187cbc8d9..56becd2365 100644 --- a/src/Appwrite/Specification/Format/Swagger2.php +++ b/src/Appwrite/Specification/Format/Swagger2.php @@ -4,6 +4,7 @@ namespace Appwrite\Specification\Format; use Appwrite\Specification\Format; use Appwrite\Template\Template; +use stdClass; class Swagger2 extends Format { @@ -205,7 +206,7 @@ class Swagger2 extends Format case 'Utopia\Validator\Mock': case 'Utopia\Validator\Assoc': $node['type'] = 'object'; - $node['type'] = 'object'; + $param['default'] = (empty($param['default'])) ? new stdClass() : $param['default']; $node['x-example'] = '{}'; //$node['format'] = 'json'; break; From 5819f8a224af4a7ff72ce7085e533f496e677578 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Wed, 6 Jan 2021 15:01:47 +0200 Subject: [PATCH 106/230] Updated dependencies --- composer.json | 2 +- composer.lock | 283 ++++++++++++++++++++++++++------------------------ 2 files changed, 149 insertions(+), 136 deletions(-) diff --git a/composer.json b/composer.json index bf9f354acc..db97272fdb 100644 --- a/composer.json +++ b/composer.json @@ -56,7 +56,7 @@ }, "require-dev": { "swoole/ide-helper": "4.5.5", - "appwrite/sdk-generator": "0.2.3", + "appwrite/sdk-generator": "0.4.0", "phpunit/phpunit": "9.4.2", "vimeo/psalm": "4.1.1" }, diff --git a/composer.lock b/composer.lock index 500c67d954..4323941e91 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "aa1bf812ee6a45af12cdfbbfb7229471", + "content-hash": "2c7c15c2c968547dc6749efc79b39458", "packages": [ { "name": "appwrite/php-clamav", @@ -1158,9 +1158,9 @@ ], "support": { "issues": "https://github.com/utopia-php/abuse/issues", - "source": "https://github.com/utopia-php/abuse/tree/0.2.2" + "source": "https://github.com/utopia-php/abuse/tree/0.3.1" }, - "time": "2020-10-23T06:51:42+00:00" + "time": "2020-12-21T17:28:03+00:00" }, { "name": "utopia-php/audit", @@ -1210,9 +1210,9 @@ ], "support": { "issues": "https://github.com/utopia-php/audit/issues", - "source": "https://github.com/utopia-php/audit/tree/0.3.2" + "source": "https://github.com/utopia-php/audit/tree/0.5.1" }, - "time": "2020-10-23T08:09:44+00:00" + "time": "2020-12-21T17:28:53+00:00" }, { "name": "utopia-php/cache", @@ -1315,9 +1315,9 @@ ], "support": { "issues": "https://github.com/utopia-php/cli/issues", - "source": "https://github.com/utopia-php/cli/tree/0.7.3" + "source": "https://github.com/utopia-php/cli/tree/0.8" }, - "time": "2020-11-02T07:50:18+00:00" + "time": "2020-12-14T06:31:42+00:00" }, { "name": "utopia-php/config", @@ -1858,11 +1858,11 @@ }, { "name": "appwrite/sdk-generator", - "version": "0.2.3", + "version": "0.4.0", "source": { "type": "git", "url": "https://github.com/appwrite/sdk-generator", - "reference": "6b564fef01fd681023c1d465783931bade04468d" + "reference": "91e155304d55831e66f880d5714ea81534819d44" }, "require": { "ext-curl": "*", @@ -1875,7 +1875,6 @@ "require-dev": { "phpunit/phpunit": "^7.0" }, - "default-branch": true, "type": "library", "autoload": { "psr-4": { @@ -1893,7 +1892,7 @@ } ], "description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms", - "time": "2020-12-23T21:58:58+00:00" + "time": "2021-01-06T12:37:52+00:00" }, { "name": "composer/package-versions-deprecated", @@ -1901,12 +1900,12 @@ "source": { "type": "git", "url": "https://github.com/composer/package-versions-deprecated.git", - "reference": "64291c788b9a18272346decf566931e33a317399" + "reference": "f921205948ab93bb19f86327c793a81edb62f236" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/64291c788b9a18272346decf566931e33a317399", - "reference": "64291c788b9a18272346decf566931e33a317399", + "url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/f921205948ab93bb19f86327c793a81edb62f236", + "reference": "f921205948ab93bb19f86327c793a81edb62f236", "shasum": "" }, "require": { @@ -1967,7 +1966,7 @@ "type": "tidelift" } ], - "time": "2020-11-12T09:39:33+00:00" + "time": "2020-12-27T20:11:05+00:00" }, { "name": "composer/semver", @@ -2324,16 +2323,16 @@ }, { "name": "matthiasmullie/minify", - "version": "1.3.64", + "version": "1.3.65", "source": { "type": "git", "url": "https://github.com/matthiasmullie/minify.git", - "reference": "38f9d58c739687e269f46c6dff4647de9e2eb855" + "reference": "227f19062451c55a797e0cc667ef983834e6580c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/matthiasmullie/minify/zipball/38f9d58c739687e269f46c6dff4647de9e2eb855", - "reference": "38f9d58c739687e269f46c6dff4647de9e2eb855", + "url": "https://api.github.com/repos/matthiasmullie/minify/zipball/227f19062451c55a797e0cc667ef983834e6580c", + "reference": "227f19062451c55a797e0cc667ef983834e6580c", "shasum": "" }, "require": { @@ -2382,9 +2381,23 @@ ], "support": { "issues": "https://github.com/matthiasmullie/minify/issues", - "source": "https://github.com/matthiasmullie/minify/tree/1.3.64" + "source": "https://github.com/matthiasmullie/minify/tree/1.3.65" }, - "time": "2020-12-23T13:37:53+00:00" + "funding": [ + { + "url": "https://github.com/[user1", + "type": "github" + }, + { + "url": "https://github.com/matthiasmullie] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g.", + "type": "github" + }, + { + "url": "https://github.com/user2", + "type": "github" + } + ], + "time": "2020-12-27T21:43:29+00:00" }, { "name": "matthiasmullie/path-converter", @@ -3004,12 +3017,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "ad44fae76b874e7d49afb6923a66591e0a94bef6" + "reference": "cbe315f4d3b653ac0310862697866ffddabc502f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ad44fae76b874e7d49afb6923a66591e0a94bef6", - "reference": "ad44fae76b874e7d49afb6923a66591e0a94bef6", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/cbe315f4d3b653ac0310862697866ffddabc502f", + "reference": "cbe315f4d3b653ac0310862697866ffddabc502f", "shasum": "" }, "require": { @@ -3065,7 +3078,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/master" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2" }, "funding": [ { @@ -3073,7 +3086,7 @@ "type": "github" } ], - "time": "2020-12-24T12:26:22+00:00" + "time": "2021-01-02T06:24:37+00:00" }, { "name": "phpunit/php-file-iterator", @@ -3081,12 +3094,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "544be757d192233486ad9119dcb297ebbf5f2dd4" + "reference": "cdb8225b328ef5e9647049954299211804000ce0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/544be757d192233486ad9119dcb297ebbf5f2dd4", - "reference": "544be757d192233486ad9119dcb297ebbf5f2dd4", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cdb8225b328ef5e9647049954299211804000ce0", + "reference": "cdb8225b328ef5e9647049954299211804000ce0", "shasum": "" }, "require": { @@ -3134,7 +3147,7 @@ "type": "github" } ], - "time": "2020-12-24T12:27:43+00:00" + "time": "2021-01-02T06:22:20+00:00" }, { "name": "phpunit/php-invoker", @@ -3142,12 +3155,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-invoker.git", - "reference": "05210af8d0ab68c811ae61a4bc42b066d62b88a0" + "reference": "6fdda2828180f7d86cf66d822e6ad4bc124baf5d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/05210af8d0ab68c811ae61a4bc42b066d62b88a0", - "reference": "05210af8d0ab68c811ae61a4bc42b066d62b88a0", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/6fdda2828180f7d86cf66d822e6ad4bc124baf5d", + "reference": "6fdda2828180f7d86cf66d822e6ad4bc124baf5d", "shasum": "" }, "require": { @@ -3198,7 +3211,7 @@ "type": "github" } ], - "time": "2020-12-24T12:27:51+00:00" + "time": "2021-01-02T06:22:25+00:00" }, { "name": "phpunit/php-text-template", @@ -3206,12 +3219,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "c1abda6e0590f8e7138eb48ade2f0b21a5c4257b" + "reference": "081fc9efc54b1b858b3497c142d82a0c36bc6755" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/c1abda6e0590f8e7138eb48ade2f0b21a5c4257b", - "reference": "c1abda6e0590f8e7138eb48ade2f0b21a5c4257b", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/081fc9efc54b1b858b3497c142d82a0c36bc6755", + "reference": "081fc9efc54b1b858b3497c142d82a0c36bc6755", "shasum": "" }, "require": { @@ -3258,7 +3271,7 @@ "type": "github" } ], - "time": "2020-12-24T12:28:23+00:00" + "time": "2021-01-02T06:22:47+00:00" }, { "name": "phpunit/php-timer", @@ -3266,12 +3279,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "59e401088c91efeb76150f0a301aa79e3ac95fd1" + "reference": "2194371fec37b03cfda3f8ab08aee33787350228" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/59e401088c91efeb76150f0a301aa79e3ac95fd1", - "reference": "59e401088c91efeb76150f0a301aa79e3ac95fd1", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/2194371fec37b03cfda3f8ab08aee33787350228", + "reference": "2194371fec37b03cfda3f8ab08aee33787350228", "shasum": "" }, "require": { @@ -3318,7 +3331,7 @@ "type": "github" } ], - "time": "2020-12-24T12:27:59+00:00" + "time": "2021-01-02T06:22:31+00:00" }, { "name": "phpunit/phpunit", @@ -3483,12 +3496,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "7605547e80bf845bc2c1b2cc3f8ac0f5574caa63" + "reference": "1012bd8df812778b8386c5e76cacd85b45cf329e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/7605547e80bf845bc2c1b2cc3f8ac0f5574caa63", - "reference": "7605547e80bf845bc2c1b2cc3f8ac0f5574caa63", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/1012bd8df812778b8386c5e76cacd85b45cf329e", + "reference": "1012bd8df812778b8386c5e76cacd85b45cf329e", "shasum": "" }, "require": { @@ -3532,7 +3545,7 @@ "type": "github" } ], - "time": "2020-12-24T12:28:52+00:00" + "time": "2021-01-02T06:23:03+00:00" }, { "name": "sebastian/code-unit", @@ -3596,12 +3609,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "f861b90785c30dc0743554f0e615d8f950dc8e9d" + "reference": "f0a408b6519db241e624a62576dc5871d4ac8c14" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/f861b90785c30dc0743554f0e615d8f950dc8e9d", - "reference": "f861b90785c30dc0743554f0e615d8f950dc8e9d", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/f0a408b6519db241e624a62576dc5871d4ac8c14", + "reference": "f0a408b6519db241e624a62576dc5871d4ac8c14", "shasum": "" }, "require": { @@ -3644,7 +3657,7 @@ "type": "github" } ], - "time": "2020-12-24T12:26:38+00:00" + "time": "2021-01-02T06:21:36+00:00" }, { "name": "sebastian/comparator", @@ -3652,12 +3665,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "1cfe9edf7ec9e4c18e54bb259110a053d09a899f" + "reference": "fe4c68c639d9e580ec31bfc88b32641dc80a08d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1cfe9edf7ec9e4c18e54bb259110a053d09a899f", - "reference": "1cfe9edf7ec9e4c18e54bb259110a053d09a899f", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fe4c68c639d9e580ec31bfc88b32641dc80a08d0", + "reference": "fe4c68c639d9e580ec31bfc88b32641dc80a08d0", "shasum": "" }, "require": { @@ -3719,7 +3732,7 @@ "type": "github" } ], - "time": "2020-12-24T12:38:43+00:00" + "time": "2021-01-02T06:21:42+00:00" }, { "name": "sebastian/complexity", @@ -3727,12 +3740,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "23030bf3d3722767fdc5f8f2d2d99b03f4e58122" + "reference": "c182133e92fc7a8b0a923b5d20f3a9fdfa534818" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/23030bf3d3722767fdc5f8f2d2d99b03f4e58122", - "reference": "23030bf3d3722767fdc5f8f2d2d99b03f4e58122", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/c182133e92fc7a8b0a923b5d20f3a9fdfa534818", + "reference": "c182133e92fc7a8b0a923b5d20f3a9fdfa534818", "shasum": "" }, "require": { @@ -3777,7 +3790,7 @@ "type": "github" } ], - "time": "2020-12-24T12:28:32+00:00" + "time": "2021-01-02T06:22:53+00:00" }, { "name": "sebastian/diff", @@ -3785,12 +3798,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "02178c586d5fbd59d348798d7122237a2907f8a4" + "reference": "33f7bf3c1741b2a10e16d5c41c369c402b933e4c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/02178c586d5fbd59d348798d7122237a2907f8a4", - "reference": "02178c586d5fbd59d348798d7122237a2907f8a4", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/33f7bf3c1741b2a10e16d5c41c369c402b933e4c", + "reference": "33f7bf3c1741b2a10e16d5c41c369c402b933e4c", "shasum": "" }, "require": { @@ -3844,7 +3857,7 @@ "type": "github" } ], - "time": "2020-12-24T12:26:54+00:00" + "time": "2021-01-02T06:21:47+00:00" }, { "name": "sebastian/environment", @@ -3852,12 +3865,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "7bb5a20ec06e366cb75b0e126169649c62b397b1" + "reference": "b885263b3601b7570ef386a468d6a827c95c8994" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/7bb5a20ec06e366cb75b0e126169649c62b397b1", - "reference": "7bb5a20ec06e366cb75b0e126169649c62b397b1", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/b885263b3601b7570ef386a468d6a827c95c8994", + "reference": "b885263b3601b7570ef386a468d6a827c95c8994", "shasum": "" }, "require": { @@ -3908,7 +3921,7 @@ "type": "github" } ], - "time": "2020-12-24T12:27:03+00:00" + "time": "2021-01-02T06:21:52+00:00" }, { "name": "sebastian/exporter", @@ -3916,12 +3929,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "91975a2dbcf4a89184d9e4143c06b88d89644b58" + "reference": "f670c4f17dffab83b44048f6fe6747a7c6097179" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/91975a2dbcf4a89184d9e4143c06b88d89644b58", - "reference": "91975a2dbcf4a89184d9e4143c06b88d89644b58", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/f670c4f17dffab83b44048f6fe6747a7c6097179", + "reference": "f670c4f17dffab83b44048f6fe6747a7c6097179", "shasum": "" }, "require": { @@ -3986,7 +3999,7 @@ "type": "github" } ], - "time": "2020-12-24T12:27:11+00:00" + "time": "2021-01-02T06:21:58+00:00" }, { "name": "sebastian/global-state", @@ -3994,12 +4007,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "0471b24bddeb05ffd0a5edc6837796f339068c25" + "reference": "a74d82a0654a7f685f80016cc3570d7a387f9da0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/0471b24bddeb05ffd0a5edc6837796f339068c25", - "reference": "0471b24bddeb05ffd0a5edc6837796f339068c25", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/a74d82a0654a7f685f80016cc3570d7a387f9da0", + "reference": "a74d82a0654a7f685f80016cc3570d7a387f9da0", "shasum": "" }, "require": { @@ -4051,7 +4064,7 @@ "type": "github" } ], - "time": "2020-12-24T12:27:19+00:00" + "time": "2021-01-02T06:22:03+00:00" }, { "name": "sebastian/lines-of-code", @@ -4059,12 +4072,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "219c932af1aeee0b4eccbc53af2181ff50e14b24" + "reference": "db62e01f14ea9485d5a52dfb5706061fd0f50425" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/219c932af1aeee0b4eccbc53af2181ff50e14b24", - "reference": "219c932af1aeee0b4eccbc53af2181ff50e14b24", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/db62e01f14ea9485d5a52dfb5706061fd0f50425", + "reference": "db62e01f14ea9485d5a52dfb5706061fd0f50425", "shasum": "" }, "require": { @@ -4109,7 +4122,7 @@ "type": "github" } ], - "time": "2020-12-24T12:28:42+00:00" + "time": "2021-01-02T06:22:58+00:00" }, { "name": "sebastian/object-enumerator", @@ -4117,12 +4130,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "da36684b10f17db8718e314fa8d84b2e0ed7132e" + "reference": "fccb61351e8a3a10ffacfad9544bb2905905b69c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/da36684b10f17db8718e314fa8d84b2e0ed7132e", - "reference": "da36684b10f17db8718e314fa8d84b2e0ed7132e", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/fccb61351e8a3a10ffacfad9544bb2905905b69c", + "reference": "fccb61351e8a3a10ffacfad9544bb2905905b69c", "shasum": "" }, "require": { @@ -4167,7 +4180,7 @@ "type": "github" } ], - "time": "2020-12-24T12:27:27+00:00" + "time": "2021-01-02T06:22:09+00:00" }, { "name": "sebastian/object-reflector", @@ -4175,12 +4188,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "6717d193da503616e69462cf98e2af3f4443335d" + "reference": "c0ad4ce74e040797d5f8abfc23ab79fd79b064c3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/6717d193da503616e69462cf98e2af3f4443335d", - "reference": "6717d193da503616e69462cf98e2af3f4443335d", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/c0ad4ce74e040797d5f8abfc23ab79fd79b064c3", + "reference": "c0ad4ce74e040797d5f8abfc23ab79fd79b064c3", "shasum": "" }, "require": { @@ -4223,7 +4236,7 @@ "type": "github" } ], - "time": "2020-12-24T12:27:35+00:00" + "time": "2021-01-02T06:22:14+00:00" }, { "name": "sebastian/recursion-context", @@ -4231,12 +4244,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "cee249a3e471aa870067fa6155991230c7507924" + "reference": "c5616ce32278e62c77066f72b1fe413a8c958cee" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/cee249a3e471aa870067fa6155991230c7507924", - "reference": "cee249a3e471aa870067fa6155991230c7507924", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/c5616ce32278e62c77066f72b1fe413a8c958cee", + "reference": "c5616ce32278e62c77066f72b1fe413a8c958cee", "shasum": "" }, "require": { @@ -4287,7 +4300,7 @@ "type": "github" } ], - "time": "2020-12-24T12:28:07+00:00" + "time": "2021-01-02T06:22:36+00:00" }, { "name": "sebastian/resource-operations", @@ -4351,12 +4364,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "67bfce3beb94968d175fdf117b80fc9a6b60bdd0" + "reference": "655e3b59cc2e508306dba9c3df08b774055548e7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/67bfce3beb94968d175fdf117b80fc9a6b60bdd0", - "reference": "67bfce3beb94968d175fdf117b80fc9a6b60bdd0", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/655e3b59cc2e508306dba9c3df08b774055548e7", + "reference": "655e3b59cc2e508306dba9c3df08b774055548e7", "shasum": "" }, "require": { @@ -4400,7 +4413,7 @@ "type": "github" } ], - "time": "2020-12-24T12:28:15+00:00" + "time": "2021-01-02T06:22:42+00:00" }, { "name": "sebastian/version", @@ -4500,12 +4513,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "15c96194f32e1b1aa30d1b302c71c5f83fd4dea9" + "reference": "da4c3663721420520b024e5aede66b813019e744" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/15c96194f32e1b1aa30d1b302c71c5f83fd4dea9", - "reference": "15c96194f32e1b1aa30d1b302c71c5f83fd4dea9", + "url": "https://api.github.com/repos/symfony/console/zipball/da4c3663721420520b024e5aede66b813019e744", + "reference": "da4c3663721420520b024e5aede66b813019e744", "shasum": "" }, "require": { @@ -4590,7 +4603,7 @@ "type": "tidelift" } ], - "time": "2020-12-18T08:03:24+00:00" + "time": "2021-01-05T20:16:44+00:00" }, { "name": "symfony/polyfill-ctype", @@ -4598,12 +4611,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "fade6deebd931cfd7a544f68479405a6a08979a3" + "reference": "7c0a3c5420fd802637c4260e595d6c674b23d578" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/fade6deebd931cfd7a544f68479405a6a08979a3", - "reference": "fade6deebd931cfd7a544f68479405a6a08979a3", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/7c0a3c5420fd802637c4260e595d6c674b23d578", + "reference": "7c0a3c5420fd802637c4260e595d6c674b23d578", "shasum": "" }, "require": { @@ -4670,7 +4683,7 @@ "type": "tidelift" } ], - "time": "2020-10-26T13:35:45+00:00" + "time": "2021-01-06T10:19:43+00:00" }, { "name": "symfony/polyfill-intl-grapheme", @@ -4678,12 +4691,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "be092746c3ab9f9c62608c82e0f04687f8a879f9" + "reference": "32b651134d58efe1786c95352d846913a42d8331" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/be092746c3ab9f9c62608c82e0f04687f8a879f9", - "reference": "be092746c3ab9f9c62608c82e0f04687f8a879f9", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/32b651134d58efe1786c95352d846913a42d8331", + "reference": "32b651134d58efe1786c95352d846913a42d8331", "shasum": "" }, "require": { @@ -4752,7 +4765,7 @@ "type": "tidelift" } ], - "time": "2020-11-13T15:40:22+00:00" + "time": "2021-01-06T10:19:43+00:00" }, { "name": "symfony/polyfill-intl-normalizer", @@ -4760,12 +4773,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "69609f9f06790591b4b13a45ee117e7bab6395aa" + "reference": "8592bf62da8352927fc3857484e84baacddec301" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/69609f9f06790591b4b13a45ee117e7bab6395aa", - "reference": "69609f9f06790591b4b13a45ee117e7bab6395aa", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8592bf62da8352927fc3857484e84baacddec301", + "reference": "8592bf62da8352927fc3857484e84baacddec301", "shasum": "" }, "require": { @@ -4837,7 +4850,7 @@ "type": "tidelift" } ], - "time": "2020-10-26T13:35:45+00:00" + "time": "2021-01-06T10:19:43+00:00" }, { "name": "symfony/polyfill-mbstring", @@ -4845,12 +4858,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "401c9d9d3400c53a8f1a39425f0543406c137a43" + "reference": "ec0101071dcbc6bdd5046da11df686f8515fa815" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/401c9d9d3400c53a8f1a39425f0543406c137a43", - "reference": "401c9d9d3400c53a8f1a39425f0543406c137a43", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/ec0101071dcbc6bdd5046da11df686f8515fa815", + "reference": "ec0101071dcbc6bdd5046da11df686f8515fa815", "shasum": "" }, "require": { @@ -4918,7 +4931,7 @@ "type": "tidelift" } ], - "time": "2020-10-26T13:35:45+00:00" + "time": "2021-01-06T10:19:43+00:00" }, { "name": "symfony/polyfill-php73", @@ -4926,12 +4939,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "8c0d39c1526009b97f43beea4cc685bbc353a70b" + "reference": "6d0e293e2b13580b866090a135900aea4adcb308" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/8c0d39c1526009b97f43beea4cc685bbc353a70b", - "reference": "8c0d39c1526009b97f43beea4cc685bbc353a70b", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/6d0e293e2b13580b866090a135900aea4adcb308", + "reference": "6d0e293e2b13580b866090a135900aea4adcb308", "shasum": "" }, "require": { @@ -4998,7 +5011,7 @@ "type": "tidelift" } ], - "time": "2020-10-26T13:35:45+00:00" + "time": "2021-01-06T10:19:43+00:00" }, { "name": "symfony/polyfill-php80", @@ -5006,12 +5019,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "3a11f3dfb34ad50f978cb2b8cf936933b87739aa" + "reference": "69e5da91ad9c080f6ac1e010ddffefe71b14bd6e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/3a11f3dfb34ad50f978cb2b8cf936933b87739aa", - "reference": "3a11f3dfb34ad50f978cb2b8cf936933b87739aa", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/69e5da91ad9c080f6ac1e010ddffefe71b14bd6e", + "reference": "69e5da91ad9c080f6ac1e010ddffefe71b14bd6e", "shasum": "" }, "require": { @@ -5082,7 +5095,7 @@ "type": "tidelift" } ], - "time": "2020-10-26T13:35:45+00:00" + "time": "2021-01-06T10:19:43+00:00" }, { "name": "symfony/service-contracts", @@ -5090,12 +5103,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "5c448a39281b671be2cc8d208e6df75ac2d4b366" + "reference": "e0d43e6e2f909287d2e4e867ca5c131a661f08ef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/5c448a39281b671be2cc8d208e6df75ac2d4b366", - "reference": "5c448a39281b671be2cc8d208e6df75ac2d4b366", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/e0d43e6e2f909287d2e4e867ca5c131a661f08ef", + "reference": "e0d43e6e2f909287d2e4e867ca5c131a661f08ef", "shasum": "" }, "require": { @@ -5163,7 +5176,7 @@ "type": "tidelift" } ], - "time": "2020-12-23T15:38:30+00:00" + "time": "2021-01-01T09:26:45+00:00" }, { "name": "symfony/string", @@ -5171,12 +5184,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "5bd67751d2e3f7d6f770c9154b8fbcb2aa05f7ed" + "reference": "99f25957efe05db14a1aa6cff643eca0f83a952c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/5bd67751d2e3f7d6f770c9154b8fbcb2aa05f7ed", - "reference": "5bd67751d2e3f7d6f770c9154b8fbcb2aa05f7ed", + "url": "https://api.github.com/repos/symfony/string/zipball/99f25957efe05db14a1aa6cff643eca0f83a952c", + "reference": "99f25957efe05db14a1aa6cff643eca0f83a952c", "shasum": "" }, "require": { @@ -5231,7 +5244,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.2.1" + "source": "https://github.com/symfony/string/tree/5.x" }, "funding": [ { @@ -5247,7 +5260,7 @@ "type": "tidelift" } ], - "time": "2020-12-05T07:33:16+00:00" + "time": "2021-01-01T09:26:45+00:00" }, { "name": "theseer/tokenizer", @@ -5305,12 +5318,12 @@ "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "c5379903e5640e5f29024e71aa0817f7bd56102b" + "reference": "a0e2cc25723f3cdb6bbaf617664c4e228f1e9886" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/c5379903e5640e5f29024e71aa0817f7bd56102b", - "reference": "c5379903e5640e5f29024e71aa0817f7bd56102b", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/a0e2cc25723f3cdb6bbaf617664c4e228f1e9886", + "reference": "a0e2cc25723f3cdb6bbaf617664c4e228f1e9886", "shasum": "" }, "require": { @@ -5376,7 +5389,7 @@ "type": "tidelift" } ], - "time": "2020-11-27T13:05:37+00:00" + "time": "2021-01-05T15:39:16+00:00" }, { "name": "vimeo/psalm", From 60503d0d0b5cb765221c290b07ef46b94b6a9753 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Wed, 6 Jan 2021 15:02:00 +0200 Subject: [PATCH 107/230] Added new platform --- app/config/platforms.php | 5 ++--- app/tasks/sdks.php | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/config/platforms.php b/app/config/platforms.php index c9a3f25b59..1bfceb31e0 100644 --- a/app/config/platforms.php +++ b/app/config/platforms.php @@ -256,11 +256,10 @@ return [ 'version' => '0.0.1', 'url' => 'https://github.com/appwrite/sdk-for-dart', 'package' => '', - 'enabled' => false, + 'enabled' => true, 'beta' => true, - 'dev' => false, 'family' => APP_PLATFORM_SERVER, - 'prism' => 'java', + 'prism' => 'dart', 'source' => \realpath(__DIR__ . '/../sdks/server-dart'), 'gitUrl' => 'git@github.com:appwrite/sdk-for-dart.git', 'gitRepoName' => 'sdk-for-dart', diff --git a/app/tasks/sdks.php b/app/tasks/sdks.php index 857b4de7b5..c742acc227 100644 --- a/app/tasks/sdks.php +++ b/app/tasks/sdks.php @@ -122,6 +122,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND break; case 'dart': $config = new Dart(); + $config->setPackageName('dart_appwrite'); break; case 'go': $config = new Go(); From e27e4087c4a60681ee0377449a86b988059e9dc5 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Wed, 6 Jan 2021 15:45:47 +0200 Subject: [PATCH 108/230] Added dart code examples --- app/config/platforms.php | 2 +- composer.json | 2 +- composer.lock | 8 +++--- .../examples/avatars/get-browser.md | 18 +++++++++++++ .../examples/avatars/get-credit-card.md | 18 +++++++++++++ .../examples/avatars/get-favicon.md | 18 +++++++++++++ .../server-dart/examples/avatars/get-flag.md | 18 +++++++++++++ .../server-dart/examples/avatars/get-image.md | 18 +++++++++++++ .../examples/avatars/get-initials.md | 17 ++++++++++++ .../server-dart/examples/avatars/get-q-r.md | 18 +++++++++++++ .../examples/database/create-collection.md | 26 ++++++++++++++++++ .../examples/database/create-document.md | 26 ++++++++++++++++++ .../examples/database/delete-collection.md | 23 ++++++++++++++++ .../examples/database/delete-document.md | 24 +++++++++++++++++ .../examples/database/get-collection.md | 23 ++++++++++++++++ .../examples/database/get-document.md | 24 +++++++++++++++++ .../examples/database/list-collections.md | 22 +++++++++++++++ .../examples/database/list-documents.md | 23 ++++++++++++++++ .../examples/database/update-collection.md | 26 ++++++++++++++++++ .../examples/database/update-document.md | 27 +++++++++++++++++++ .../examples/health/get-anti-virus.md | 21 +++++++++++++++ .../server-dart/examples/health/get-cache.md | 21 +++++++++++++++ .../server-dart/examples/health/get-d-b.md | 21 +++++++++++++++ .../examples/health/get-queue-certificates.md | 21 +++++++++++++++ .../examples/health/get-queue-functions.md | 21 +++++++++++++++ .../examples/health/get-queue-logs.md | 21 +++++++++++++++ .../examples/health/get-queue-tasks.md | 21 +++++++++++++++ .../examples/health/get-queue-usage.md | 21 +++++++++++++++ .../examples/health/get-queue-webhooks.md | 21 +++++++++++++++ .../examples/health/get-storage-local.md | 21 +++++++++++++++ .../server-dart/examples/health/get-time.md | 21 +++++++++++++++ .../0.6.2/server-dart/examples/health/get.md | 21 +++++++++++++++ .../examples/locale/get-continents.md | 21 +++++++++++++++ .../examples/locale/get-countries-e-u.md | 21 +++++++++++++++ .../examples/locale/get-countries-phones.md | 21 +++++++++++++++ .../examples/locale/get-countries.md | 21 +++++++++++++++ .../examples/locale/get-currencies.md | 21 +++++++++++++++ .../examples/locale/get-languages.md | 21 +++++++++++++++ .../0.6.2/server-dart/examples/locale/get.md | 21 +++++++++++++++ .../examples/storage/create-file.md | 26 ++++++++++++++++++ .../examples/storage/delete-file.md | 23 ++++++++++++++++ .../examples/storage/get-file-download.md | 18 +++++++++++++ .../examples/storage/get-file-preview.md | 18 +++++++++++++ .../examples/storage/get-file-view.md | 18 +++++++++++++ .../server-dart/examples/storage/get-file.md | 23 ++++++++++++++++ .../examples/storage/list-files.md | 22 +++++++++++++++ .../examples/storage/update-file.md | 25 +++++++++++++++++ .../examples/teams/create-membership.md | 26 ++++++++++++++++++ .../server-dart/examples/teams/create.md | 23 ++++++++++++++++ .../examples/teams/delete-membership.md | 24 +++++++++++++++++ .../server-dart/examples/teams/delete.md | 23 ++++++++++++++++ .../examples/teams/get-memberships.md | 23 ++++++++++++++++ .../0.6.2/server-dart/examples/teams/get.md | 23 ++++++++++++++++ .../0.6.2/server-dart/examples/teams/list.md | 22 +++++++++++++++ .../server-dart/examples/teams/update.md | 24 +++++++++++++++++ .../server-dart/examples/users/create.md | 24 +++++++++++++++++ .../examples/users/delete-session.md | 24 +++++++++++++++++ .../examples/users/delete-sessions.md | 23 ++++++++++++++++ .../server-dart/examples/users/get-logs.md | 23 ++++++++++++++++ .../server-dart/examples/users/get-prefs.md | 23 ++++++++++++++++ .../examples/users/get-sessions.md | 23 ++++++++++++++++ .../0.6.2/server-dart/examples/users/get.md | 23 ++++++++++++++++ .../0.6.2/server-dart/examples/users/list.md | 22 +++++++++++++++ .../examples/users/update-prefs.md | 24 +++++++++++++++++ .../examples/users/update-status.md | 24 +++++++++++++++++ docs/sdks/dart/CHANGELOG.md | 3 +++ docs/sdks/dart/EXAMPLES.md | 17 +++++++----- 67 files changed, 1381 insertions(+), 13 deletions(-) create mode 100644 docs/examples/0.6.2/server-dart/examples/avatars/get-browser.md create mode 100644 docs/examples/0.6.2/server-dart/examples/avatars/get-credit-card.md create mode 100644 docs/examples/0.6.2/server-dart/examples/avatars/get-favicon.md create mode 100644 docs/examples/0.6.2/server-dart/examples/avatars/get-flag.md create mode 100644 docs/examples/0.6.2/server-dart/examples/avatars/get-image.md create mode 100644 docs/examples/0.6.2/server-dart/examples/avatars/get-initials.md create mode 100644 docs/examples/0.6.2/server-dart/examples/avatars/get-q-r.md create mode 100644 docs/examples/0.6.2/server-dart/examples/database/create-collection.md create mode 100644 docs/examples/0.6.2/server-dart/examples/database/create-document.md create mode 100644 docs/examples/0.6.2/server-dart/examples/database/delete-collection.md create mode 100644 docs/examples/0.6.2/server-dart/examples/database/delete-document.md create mode 100644 docs/examples/0.6.2/server-dart/examples/database/get-collection.md create mode 100644 docs/examples/0.6.2/server-dart/examples/database/get-document.md create mode 100644 docs/examples/0.6.2/server-dart/examples/database/list-collections.md create mode 100644 docs/examples/0.6.2/server-dart/examples/database/list-documents.md create mode 100644 docs/examples/0.6.2/server-dart/examples/database/update-collection.md create mode 100644 docs/examples/0.6.2/server-dart/examples/database/update-document.md create mode 100644 docs/examples/0.6.2/server-dart/examples/health/get-anti-virus.md create mode 100644 docs/examples/0.6.2/server-dart/examples/health/get-cache.md create mode 100644 docs/examples/0.6.2/server-dart/examples/health/get-d-b.md create mode 100644 docs/examples/0.6.2/server-dart/examples/health/get-queue-certificates.md create mode 100644 docs/examples/0.6.2/server-dart/examples/health/get-queue-functions.md create mode 100644 docs/examples/0.6.2/server-dart/examples/health/get-queue-logs.md create mode 100644 docs/examples/0.6.2/server-dart/examples/health/get-queue-tasks.md create mode 100644 docs/examples/0.6.2/server-dart/examples/health/get-queue-usage.md create mode 100644 docs/examples/0.6.2/server-dart/examples/health/get-queue-webhooks.md create mode 100644 docs/examples/0.6.2/server-dart/examples/health/get-storage-local.md create mode 100644 docs/examples/0.6.2/server-dart/examples/health/get-time.md create mode 100644 docs/examples/0.6.2/server-dart/examples/health/get.md create mode 100644 docs/examples/0.6.2/server-dart/examples/locale/get-continents.md create mode 100644 docs/examples/0.6.2/server-dart/examples/locale/get-countries-e-u.md create mode 100644 docs/examples/0.6.2/server-dart/examples/locale/get-countries-phones.md create mode 100644 docs/examples/0.6.2/server-dart/examples/locale/get-countries.md create mode 100644 docs/examples/0.6.2/server-dart/examples/locale/get-currencies.md create mode 100644 docs/examples/0.6.2/server-dart/examples/locale/get-languages.md create mode 100644 docs/examples/0.6.2/server-dart/examples/locale/get.md create mode 100644 docs/examples/0.6.2/server-dart/examples/storage/create-file.md create mode 100644 docs/examples/0.6.2/server-dart/examples/storage/delete-file.md create mode 100644 docs/examples/0.6.2/server-dart/examples/storage/get-file-download.md create mode 100644 docs/examples/0.6.2/server-dart/examples/storage/get-file-preview.md create mode 100644 docs/examples/0.6.2/server-dart/examples/storage/get-file-view.md create mode 100644 docs/examples/0.6.2/server-dart/examples/storage/get-file.md create mode 100644 docs/examples/0.6.2/server-dart/examples/storage/list-files.md create mode 100644 docs/examples/0.6.2/server-dart/examples/storage/update-file.md create mode 100644 docs/examples/0.6.2/server-dart/examples/teams/create-membership.md create mode 100644 docs/examples/0.6.2/server-dart/examples/teams/create.md create mode 100644 docs/examples/0.6.2/server-dart/examples/teams/delete-membership.md create mode 100644 docs/examples/0.6.2/server-dart/examples/teams/delete.md create mode 100644 docs/examples/0.6.2/server-dart/examples/teams/get-memberships.md create mode 100644 docs/examples/0.6.2/server-dart/examples/teams/get.md create mode 100644 docs/examples/0.6.2/server-dart/examples/teams/list.md create mode 100644 docs/examples/0.6.2/server-dart/examples/teams/update.md create mode 100644 docs/examples/0.6.2/server-dart/examples/users/create.md create mode 100644 docs/examples/0.6.2/server-dart/examples/users/delete-session.md create mode 100644 docs/examples/0.6.2/server-dart/examples/users/delete-sessions.md create mode 100644 docs/examples/0.6.2/server-dart/examples/users/get-logs.md create mode 100644 docs/examples/0.6.2/server-dart/examples/users/get-prefs.md create mode 100644 docs/examples/0.6.2/server-dart/examples/users/get-sessions.md create mode 100644 docs/examples/0.6.2/server-dart/examples/users/get.md create mode 100644 docs/examples/0.6.2/server-dart/examples/users/list.md create mode 100644 docs/examples/0.6.2/server-dart/examples/users/update-prefs.md create mode 100644 docs/examples/0.6.2/server-dart/examples/users/update-status.md diff --git a/app/config/platforms.php b/app/config/platforms.php index 1bfceb31e0..cfea0d6dcc 100644 --- a/app/config/platforms.php +++ b/app/config/platforms.php @@ -253,7 +253,7 @@ return [ [ 'key' => 'dart', 'name' => 'Dart', - 'version' => '0.0.1', + 'version' => '0.1.0', 'url' => 'https://github.com/appwrite/sdk-for-dart', 'package' => '', 'enabled' => true, diff --git a/composer.json b/composer.json index db97272fdb..2312ef077c 100644 --- a/composer.json +++ b/composer.json @@ -56,7 +56,7 @@ }, "require-dev": { "swoole/ide-helper": "4.5.5", - "appwrite/sdk-generator": "0.4.0", + "appwrite/sdk-generator": "0.4.1", "phpunit/phpunit": "9.4.2", "vimeo/psalm": "4.1.1" }, diff --git a/composer.lock b/composer.lock index 4323941e91..0b612def8f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "2c7c15c2c968547dc6749efc79b39458", + "content-hash": "db906327240b2eff5909e2d987003883", "packages": [ { "name": "appwrite/php-clamav", @@ -1858,11 +1858,11 @@ }, { "name": "appwrite/sdk-generator", - "version": "0.4.0", + "version": "0.4.1", "source": { "type": "git", "url": "https://github.com/appwrite/sdk-generator", - "reference": "91e155304d55831e66f880d5714ea81534819d44" + "reference": "bc6b2870d774779d0a2d027d12f4de576ac0b955" }, "require": { "ext-curl": "*", @@ -1892,7 +1892,7 @@ } ], "description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms", - "time": "2021-01-06T12:37:52+00:00" + "time": "2021-01-06T13:40:31+00:00" }, { "name": "composer/package-versions-deprecated", diff --git a/docs/examples/0.6.2/server-dart/examples/avatars/get-browser.md b/docs/examples/0.6.2/server-dart/examples/avatars/get-browser.md new file mode 100644 index 0000000000..87d2062fc4 --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/avatars/get-browser.md @@ -0,0 +1,18 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Avatars avatars = Avatars(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + String result = avatars.getBrowser( + code: 'aa', + ); + + print(result); // Resource URL string +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/avatars/get-credit-card.md b/docs/examples/0.6.2/server-dart/examples/avatars/get-credit-card.md new file mode 100644 index 0000000000..8fe5f1d5d8 --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/avatars/get-credit-card.md @@ -0,0 +1,18 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Avatars avatars = Avatars(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + String result = avatars.getCreditCard( + code: 'amex', + ); + + print(result); // Resource URL string +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/avatars/get-favicon.md b/docs/examples/0.6.2/server-dart/examples/avatars/get-favicon.md new file mode 100644 index 0000000000..6a249dc70f --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/avatars/get-favicon.md @@ -0,0 +1,18 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Avatars avatars = Avatars(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + String result = avatars.getFavicon( + url: 'https://example.com', + ); + + print(result); // Resource URL string +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/avatars/get-flag.md b/docs/examples/0.6.2/server-dart/examples/avatars/get-flag.md new file mode 100644 index 0000000000..f997b668da --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/avatars/get-flag.md @@ -0,0 +1,18 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Avatars avatars = Avatars(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + String result = avatars.getFlag( + code: 'af', + ); + + print(result); // Resource URL string +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/avatars/get-image.md b/docs/examples/0.6.2/server-dart/examples/avatars/get-image.md new file mode 100644 index 0000000000..9f31d8f159 --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/avatars/get-image.md @@ -0,0 +1,18 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Avatars avatars = Avatars(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + String result = avatars.getImage( + url: 'https://example.com', + ); + + print(result); // Resource URL string +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/avatars/get-initials.md b/docs/examples/0.6.2/server-dart/examples/avatars/get-initials.md new file mode 100644 index 0000000000..73788d2170 --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/avatars/get-initials.md @@ -0,0 +1,17 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Avatars avatars = Avatars(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + String result = avatars.getInitials( + ); + + print(result); // Resource URL string +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/avatars/get-q-r.md b/docs/examples/0.6.2/server-dart/examples/avatars/get-q-r.md new file mode 100644 index 0000000000..eb8b46c743 --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/avatars/get-q-r.md @@ -0,0 +1,18 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Avatars avatars = Avatars(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + String result = avatars.getQR( + text: '[TEXT]', + ); + + print(result); // Resource URL string +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/database/create-collection.md b/docs/examples/0.6.2/server-dart/examples/database/create-collection.md new file mode 100644 index 0000000000..c060effb3d --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/database/create-collection.md @@ -0,0 +1,26 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Database database = Database(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = database.createCollection( + name: '[NAME]', + read: [], + write: [], + rules: [], + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/database/create-document.md b/docs/examples/0.6.2/server-dart/examples/database/create-document.md new file mode 100644 index 0000000000..4899aa4a92 --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/database/create-document.md @@ -0,0 +1,26 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Database database = Database(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = database.createDocument( + collectionId: '[COLLECTION_ID]', + data: {}, + read: [], + write: [], + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/database/delete-collection.md b/docs/examples/0.6.2/server-dart/examples/database/delete-collection.md new file mode 100644 index 0000000000..6543cc1491 --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/database/delete-collection.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Database database = Database(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = database.deleteCollection( + collectionId: '[COLLECTION_ID]', + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/database/delete-document.md b/docs/examples/0.6.2/server-dart/examples/database/delete-document.md new file mode 100644 index 0000000000..89204f6d81 --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/database/delete-document.md @@ -0,0 +1,24 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Database database = Database(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = database.deleteDocument( + collectionId: '[COLLECTION_ID]', + documentId: '[DOCUMENT_ID]', + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/database/get-collection.md b/docs/examples/0.6.2/server-dart/examples/database/get-collection.md new file mode 100644 index 0000000000..6b0cb526ca --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/database/get-collection.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Database database = Database(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = database.getCollection( + collectionId: '[COLLECTION_ID]', + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/database/get-document.md b/docs/examples/0.6.2/server-dart/examples/database/get-document.md new file mode 100644 index 0000000000..efe007aadf --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/database/get-document.md @@ -0,0 +1,24 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Database database = Database(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = database.getDocument( + collectionId: '[COLLECTION_ID]', + documentId: '[DOCUMENT_ID]', + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/database/list-collections.md b/docs/examples/0.6.2/server-dart/examples/database/list-collections.md new file mode 100644 index 0000000000..aecd08a54a --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/database/list-collections.md @@ -0,0 +1,22 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Database database = Database(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = database.listCollections( + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/database/list-documents.md b/docs/examples/0.6.2/server-dart/examples/database/list-documents.md new file mode 100644 index 0000000000..9323fd34be --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/database/list-documents.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Database database = Database(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = database.listDocuments( + collectionId: '[COLLECTION_ID]', + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/database/update-collection.md b/docs/examples/0.6.2/server-dart/examples/database/update-collection.md new file mode 100644 index 0000000000..8d77990f1a --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/database/update-collection.md @@ -0,0 +1,26 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Database database = Database(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = database.updateCollection( + collectionId: '[COLLECTION_ID]', + name: '[NAME]', + read: [], + write: [], + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/database/update-document.md b/docs/examples/0.6.2/server-dart/examples/database/update-document.md new file mode 100644 index 0000000000..767233b5a8 --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/database/update-document.md @@ -0,0 +1,27 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Database database = Database(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = database.updateDocument( + collectionId: '[COLLECTION_ID]', + documentId: '[DOCUMENT_ID]', + data: {}, + read: [], + write: [], + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/health/get-anti-virus.md b/docs/examples/0.6.2/server-dart/examples/health/get-anti-virus.md new file mode 100644 index 0000000000..dd5bbdc1cb --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/health/get-anti-virus.md @@ -0,0 +1,21 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Health health = Health(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = health.getAntiVirus(); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/health/get-cache.md b/docs/examples/0.6.2/server-dart/examples/health/get-cache.md new file mode 100644 index 0000000000..322939d74e --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/health/get-cache.md @@ -0,0 +1,21 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Health health = Health(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = health.getCache(); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/health/get-d-b.md b/docs/examples/0.6.2/server-dart/examples/health/get-d-b.md new file mode 100644 index 0000000000..e3447550eb --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/health/get-d-b.md @@ -0,0 +1,21 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Health health = Health(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = health.getDB(); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/health/get-queue-certificates.md b/docs/examples/0.6.2/server-dart/examples/health/get-queue-certificates.md new file mode 100644 index 0000000000..7c605154a6 --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/health/get-queue-certificates.md @@ -0,0 +1,21 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Health health = Health(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = health.getQueueCertificates(); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/health/get-queue-functions.md b/docs/examples/0.6.2/server-dart/examples/health/get-queue-functions.md new file mode 100644 index 0000000000..c06cda9185 --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/health/get-queue-functions.md @@ -0,0 +1,21 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Health health = Health(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = health.getQueueFunctions(); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/health/get-queue-logs.md b/docs/examples/0.6.2/server-dart/examples/health/get-queue-logs.md new file mode 100644 index 0000000000..807a04fb11 --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/health/get-queue-logs.md @@ -0,0 +1,21 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Health health = Health(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = health.getQueueLogs(); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/health/get-queue-tasks.md b/docs/examples/0.6.2/server-dart/examples/health/get-queue-tasks.md new file mode 100644 index 0000000000..a33ae976a0 --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/health/get-queue-tasks.md @@ -0,0 +1,21 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Health health = Health(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = health.getQueueTasks(); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/health/get-queue-usage.md b/docs/examples/0.6.2/server-dart/examples/health/get-queue-usage.md new file mode 100644 index 0000000000..b504a8efc5 --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/health/get-queue-usage.md @@ -0,0 +1,21 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Health health = Health(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = health.getQueueUsage(); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/health/get-queue-webhooks.md b/docs/examples/0.6.2/server-dart/examples/health/get-queue-webhooks.md new file mode 100644 index 0000000000..7c159ac8cd --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/health/get-queue-webhooks.md @@ -0,0 +1,21 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Health health = Health(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = health.getQueueWebhooks(); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/health/get-storage-local.md b/docs/examples/0.6.2/server-dart/examples/health/get-storage-local.md new file mode 100644 index 0000000000..7f172bf86c --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/health/get-storage-local.md @@ -0,0 +1,21 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Health health = Health(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = health.getStorageLocal(); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/health/get-time.md b/docs/examples/0.6.2/server-dart/examples/health/get-time.md new file mode 100644 index 0000000000..65861d3cc3 --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/health/get-time.md @@ -0,0 +1,21 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Health health = Health(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = health.getTime(); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/health/get.md b/docs/examples/0.6.2/server-dart/examples/health/get.md new file mode 100644 index 0000000000..0c9d39218e --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/health/get.md @@ -0,0 +1,21 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Health health = Health(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = health.get(); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/locale/get-continents.md b/docs/examples/0.6.2/server-dart/examples/locale/get-continents.md new file mode 100644 index 0000000000..2daced78b6 --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/locale/get-continents.md @@ -0,0 +1,21 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Locale locale = Locale(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = locale.getContinents(); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/locale/get-countries-e-u.md b/docs/examples/0.6.2/server-dart/examples/locale/get-countries-e-u.md new file mode 100644 index 0000000000..7b04a49487 --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/locale/get-countries-e-u.md @@ -0,0 +1,21 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Locale locale = Locale(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = locale.getCountriesEU(); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/locale/get-countries-phones.md b/docs/examples/0.6.2/server-dart/examples/locale/get-countries-phones.md new file mode 100644 index 0000000000..57138a6b75 --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/locale/get-countries-phones.md @@ -0,0 +1,21 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Locale locale = Locale(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = locale.getCountriesPhones(); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/locale/get-countries.md b/docs/examples/0.6.2/server-dart/examples/locale/get-countries.md new file mode 100644 index 0000000000..2bf758adca --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/locale/get-countries.md @@ -0,0 +1,21 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Locale locale = Locale(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = locale.getCountries(); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/locale/get-currencies.md b/docs/examples/0.6.2/server-dart/examples/locale/get-currencies.md new file mode 100644 index 0000000000..c8a415de4c --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/locale/get-currencies.md @@ -0,0 +1,21 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Locale locale = Locale(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = locale.getCurrencies(); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/locale/get-languages.md b/docs/examples/0.6.2/server-dart/examples/locale/get-languages.md new file mode 100644 index 0000000000..b9ae6655a3 --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/locale/get-languages.md @@ -0,0 +1,21 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Locale locale = Locale(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = locale.getLanguages(); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/locale/get.md b/docs/examples/0.6.2/server-dart/examples/locale/get.md new file mode 100644 index 0000000000..d290063060 --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/locale/get.md @@ -0,0 +1,21 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Locale locale = Locale(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = locale.get(); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/storage/create-file.md b/docs/examples/0.6.2/server-dart/examples/storage/create-file.md new file mode 100644 index 0000000000..b098d92ea9 --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/storage/create-file.md @@ -0,0 +1,26 @@ +import 'dart:io'; +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Storage storage = Storage(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = storage.createFile( + file: await MultipartFile.fromFile('./path-to-files/image.jpg', 'image.jpg'), + read: [], + write: [], + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/storage/delete-file.md b/docs/examples/0.6.2/server-dart/examples/storage/delete-file.md new file mode 100644 index 0000000000..ae76fe6f87 --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/storage/delete-file.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Storage storage = Storage(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = storage.deleteFile( + fileId: '[FILE_ID]', + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/storage/get-file-download.md b/docs/examples/0.6.2/server-dart/examples/storage/get-file-download.md new file mode 100644 index 0000000000..2eceaab1f5 --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/storage/get-file-download.md @@ -0,0 +1,18 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Storage storage = Storage(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + String result = storage.getFileDownload( + fileId: '[FILE_ID]', + ); + + print(result); // Resource URL string +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/storage/get-file-preview.md b/docs/examples/0.6.2/server-dart/examples/storage/get-file-preview.md new file mode 100644 index 0000000000..2b564d81b7 --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/storage/get-file-preview.md @@ -0,0 +1,18 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Storage storage = Storage(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + String result = storage.getFilePreview( + fileId: '[FILE_ID]', + ); + + print(result); // Resource URL string +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/storage/get-file-view.md b/docs/examples/0.6.2/server-dart/examples/storage/get-file-view.md new file mode 100644 index 0000000000..030fb40f38 --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/storage/get-file-view.md @@ -0,0 +1,18 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Storage storage = Storage(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + String result = storage.getFileView( + fileId: '[FILE_ID]', + ); + + print(result); // Resource URL string +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/storage/get-file.md b/docs/examples/0.6.2/server-dart/examples/storage/get-file.md new file mode 100644 index 0000000000..d4a10369a5 --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/storage/get-file.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Storage storage = Storage(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = storage.getFile( + fileId: '[FILE_ID]', + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/storage/list-files.md b/docs/examples/0.6.2/server-dart/examples/storage/list-files.md new file mode 100644 index 0000000000..0225695466 --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/storage/list-files.md @@ -0,0 +1,22 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Storage storage = Storage(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = storage.listFiles( + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/storage/update-file.md b/docs/examples/0.6.2/server-dart/examples/storage/update-file.md new file mode 100644 index 0000000000..bc77e7a1d1 --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/storage/update-file.md @@ -0,0 +1,25 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Storage storage = Storage(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = storage.updateFile( + fileId: '[FILE_ID]', + read: [], + write: [], + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/teams/create-membership.md b/docs/examples/0.6.2/server-dart/examples/teams/create-membership.md new file mode 100644 index 0000000000..e3923bd207 --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/teams/create-membership.md @@ -0,0 +1,26 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Teams teams = Teams(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = teams.createMembership( + teamId: '[TEAM_ID]', + email: 'email@example.com', + roles: [], + url: 'https://example.com', + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/teams/create.md b/docs/examples/0.6.2/server-dart/examples/teams/create.md new file mode 100644 index 0000000000..339663d9d1 --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/teams/create.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Teams teams = Teams(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = teams.create( + name: '[NAME]', + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/teams/delete-membership.md b/docs/examples/0.6.2/server-dart/examples/teams/delete-membership.md new file mode 100644 index 0000000000..23688dcc04 --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/teams/delete-membership.md @@ -0,0 +1,24 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Teams teams = Teams(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = teams.deleteMembership( + teamId: '[TEAM_ID]', + inviteId: '[INVITE_ID]', + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/teams/delete.md b/docs/examples/0.6.2/server-dart/examples/teams/delete.md new file mode 100644 index 0000000000..a006e8f347 --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/teams/delete.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Teams teams = Teams(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = teams.delete( + teamId: '[TEAM_ID]', + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/teams/get-memberships.md b/docs/examples/0.6.2/server-dart/examples/teams/get-memberships.md new file mode 100644 index 0000000000..3a12dc5c2b --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/teams/get-memberships.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Teams teams = Teams(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = teams.getMemberships( + teamId: '[TEAM_ID]', + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/teams/get.md b/docs/examples/0.6.2/server-dart/examples/teams/get.md new file mode 100644 index 0000000000..a1bfe8e72c --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/teams/get.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Teams teams = Teams(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = teams.get( + teamId: '[TEAM_ID]', + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/teams/list.md b/docs/examples/0.6.2/server-dart/examples/teams/list.md new file mode 100644 index 0000000000..d55e58e36e --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/teams/list.md @@ -0,0 +1,22 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Teams teams = Teams(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = teams.list( + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/teams/update.md b/docs/examples/0.6.2/server-dart/examples/teams/update.md new file mode 100644 index 0000000000..22af165502 --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/teams/update.md @@ -0,0 +1,24 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Teams teams = Teams(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = teams.update( + teamId: '[TEAM_ID]', + name: '[NAME]', + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/users/create.md b/docs/examples/0.6.2/server-dart/examples/users/create.md new file mode 100644 index 0000000000..18bbbf2d13 --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/users/create.md @@ -0,0 +1,24 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Users users = Users(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = users.create( + email: 'email@example.com', + password: 'password', + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/users/delete-session.md b/docs/examples/0.6.2/server-dart/examples/users/delete-session.md new file mode 100644 index 0000000000..eaa98c17b7 --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/users/delete-session.md @@ -0,0 +1,24 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Users users = Users(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = users.deleteSession( + userId: '[USER_ID]', + sessionId: '[SESSION_ID]', + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/users/delete-sessions.md b/docs/examples/0.6.2/server-dart/examples/users/delete-sessions.md new file mode 100644 index 0000000000..8c889aad2b --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/users/delete-sessions.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Users users = Users(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = users.deleteSessions( + userId: '[USER_ID]', + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/users/get-logs.md b/docs/examples/0.6.2/server-dart/examples/users/get-logs.md new file mode 100644 index 0000000000..63eb6b5bcf --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/users/get-logs.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Users users = Users(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = users.getLogs( + userId: '[USER_ID]', + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/users/get-prefs.md b/docs/examples/0.6.2/server-dart/examples/users/get-prefs.md new file mode 100644 index 0000000000..e5909422a3 --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/users/get-prefs.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Users users = Users(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = users.getPrefs( + userId: '[USER_ID]', + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/users/get-sessions.md b/docs/examples/0.6.2/server-dart/examples/users/get-sessions.md new file mode 100644 index 0000000000..ebe44c3eb9 --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/users/get-sessions.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Users users = Users(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = users.getSessions( + userId: '[USER_ID]', + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/users/get.md b/docs/examples/0.6.2/server-dart/examples/users/get.md new file mode 100644 index 0000000000..be582d52c5 --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/users/get.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Users users = Users(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = users.get( + userId: '[USER_ID]', + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/users/list.md b/docs/examples/0.6.2/server-dart/examples/users/list.md new file mode 100644 index 0000000000..e0ecf7adf3 --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/users/list.md @@ -0,0 +1,22 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Users users = Users(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = users.list( + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/users/update-prefs.md b/docs/examples/0.6.2/server-dart/examples/users/update-prefs.md new file mode 100644 index 0000000000..d148e52f0b --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/users/update-prefs.md @@ -0,0 +1,24 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Users users = Users(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = users.updatePrefs( + userId: '[USER_ID]', + prefs: {}, + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/examples/0.6.2/server-dart/examples/users/update-status.md b/docs/examples/0.6.2/server-dart/examples/users/update-status.md new file mode 100644 index 0000000000..7e14043635 --- /dev/null +++ b/docs/examples/0.6.2/server-dart/examples/users/update-status.md @@ -0,0 +1,24 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() { // Init SDK + Client client = Client(); + Users users = Users(client); + + client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + ; + + Future result = users.updateStatus( + userId: '[USER_ID]', + status: '1', + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/docs/sdks/dart/CHANGELOG.md b/docs/sdks/dart/CHANGELOG.md index e69de29bb2..e8d0ca1f73 100644 --- a/docs/sdks/dart/CHANGELOG.md +++ b/docs/sdks/dart/CHANGELOG.md @@ -0,0 +1,3 @@ +## 0.1.0 + +- First release \ No newline at end of file diff --git a/docs/sdks/dart/EXAMPLES.md b/docs/sdks/dart/EXAMPLES.md index f6768a5f85..26930c3352 100644 --- a/docs/sdks/dart/EXAMPLES.md +++ b/docs/sdks/dart/EXAMPLES.md @@ -13,23 +13,26 @@ Init your Appwrite client: ``` -Create a new user and session: +Create a new user: ```dart -Account account = Account(client); +Users users = Users(client); -Response user = await account.create(email: 'me@appwrite.io', password: 'password', name: 'My Name'); +Response result = await users.create( + email: 'email@example.com', + password: 'password', +); -Response session = await account.createSession(email: 'me@appwrite.io', password: 'password'); - ``` Fetch user profile: ```dart -Account account = Account(client); +Users users = Users(client); -Response profile = await account.get(); +Response profile = await users.get( + userId: '[USER_ID]', +); ``` Upload File: From 8e8869e3f837884441d90e23c4fb9065992f050a Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Wed, 6 Jan 2021 16:33:41 +0200 Subject: [PATCH 109/230] Updated readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ea3ee938b9..debcb4dd43 100644 --- a/README.md +++ b/README.md @@ -124,8 +124,8 @@ Below is a list of currently supported platforms and languages. If you wish to h * ✅   [Deno](https://github.com/appwrite/sdk-for-deno) - **Beta** (Maintained by the Appwrite Team) * ✅   [Ruby](https://github.com/appwrite/sdk-for-ruby) - **Beta** (Maintained by the Appwrite Team) * ✅   [Python](https://github.com/appwrite/sdk-for-python) - **Beta** (Maintained by the Appwrite Team) +* ✅   [Dart](https://github.com/appwrite/sdk-for-dart) **Experimental** (Maintained by the Appwrite Team) * ✅   [Go](https://github.com/appwrite/sdk-for-go) **Work in progress** (Maintained by the Appwrite Team) -* ✅   [Dart](https://github.com/appwrite/sdk-for-dart) **Work in progress** (Maintained by the Appwrite Team) Looking for more SDKs? - Help us by contributing a pull request to our [SDK Generator](https://github.com/appwrite/sdk-generator)! From 5e1ff7396e288d2e8e831497cebf53a057a264e2 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Thu, 7 Jan 2021 00:02:05 +0200 Subject: [PATCH 110/230] Fixed typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7967b1b2ef..b10fecd5cf 100644 --- a/README.md +++ b/README.md @@ -124,7 +124,7 @@ Below is a list of currently supported platforms and languages. If you wish to h * ✅   [Deno](https://github.com/appwrite/sdk-for-deno) - **Beta** (Maintained by the Appwrite Team) * ✅   [Ruby](https://github.com/appwrite/sdk-for-ruby) - **Beta** (Maintained by the Appwrite Team) * ✅   [Python](https://github.com/appwrite/sdk-for-python) - **Beta** (Maintained by the Appwrite Team) -* ✅   [.NET](https://github.com/appwrite/sdk-for-dotnet) - **Expiremental** (Maintained by the Appwrite Team) +* ✅   [.NET](https://github.com/appwrite/sdk-for-dotnet) - **Experimental** (Maintained by the Appwrite Team) * ✅   [Go](https://github.com/appwrite/sdk-for-go) **Work in progress** (Maintained by the Appwrite Team) * ✅   [Dart](https://github.com/appwrite/sdk-for-dart) **Work in progress** (Maintained by the Appwrite Team) From b23d2bf6e4d2663d9d02ec32b5b743995324bff3 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Thu, 7 Jan 2021 16:11:41 +0200 Subject: [PATCH 111/230] Updated examples --- composer.json | 2 +- composer.lock | 98 ++++++++++--------- .../examples/database/create-collection.md | 2 +- .../examples/database/create-document.md | 2 +- .../examples/database/update-collection.md | 2 +- .../examples/database/update-document.md | 2 +- .../examples/storage/create-file.md | 2 +- .../examples/storage/update-file.md | 2 +- .../examples/teams/create-membership.md | 2 +- .../examples/users/update-prefs.md | 2 +- 10 files changed, 60 insertions(+), 56 deletions(-) diff --git a/composer.json b/composer.json index f0dc6c104c..ee1e90a876 100644 --- a/composer.json +++ b/composer.json @@ -56,7 +56,7 @@ }, "require-dev": { "swoole/ide-helper": "4.5.5", - "appwrite/sdk-generator": "0.3.3", + "appwrite/sdk-generator": "0.4.2", "phpunit/phpunit": "9.4.2", "vimeo/psalm": "4.1.1" }, diff --git a/composer.lock b/composer.lock index 23bbf8edea..9b68ad5f56 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "2dee8b75780ba88fd7da28d08d691998", + "content-hash": "0df79d7789fec84aa4500edad823f1f6", "packages": [ { "name": "appwrite/php-clamav", @@ -131,16 +131,16 @@ }, { "name": "chillerlan/php-settings-container", - "version": "2.1.0", + "version": "2.1.1", "source": { "type": "git", "url": "https://github.com/chillerlan/php-settings-container.git", - "reference": "90ab24a3dc09569bfa0f3dbc3d44bab3aaa2a6c5" + "reference": "98ccc1b31b31a53bcb563465c4961879b2b93096" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/chillerlan/php-settings-container/zipball/90ab24a3dc09569bfa0f3dbc3d44bab3aaa2a6c5", - "reference": "90ab24a3dc09569bfa0f3dbc3d44bab3aaa2a6c5", + "url": "https://api.github.com/repos/chillerlan/php-settings-container/zipball/98ccc1b31b31a53bcb563465c4961879b2b93096", + "reference": "98ccc1b31b31a53bcb563465c4961879b2b93096", "shasum": "" }, "require": { @@ -148,8 +148,8 @@ "php": "^7.4 || ^8.0" }, "require-dev": { - "phan/phan": "^3.2.2", - "phpunit/phpunit": "9.4" + "phan/phan": "^4.0", + "phpunit/phpunit": "^9.5" }, "type": "library", "autoload": { @@ -181,12 +181,16 @@ "source": "https://github.com/chillerlan/php-settings-container" }, "funding": [ + { + "url": "https://www.paypal.com/donate?hosted_button_id=WLYUNAT9ZTJZ4", + "type": "custom" + }, { "url": "https://ko-fi.com/codemasher", "type": "ko_fi" } ], - "time": "2020-10-07T13:18:35+00:00" + "time": "2021-01-06T15:57:03+00:00" }, { "name": "colinmollenhour/credis", @@ -1858,11 +1862,11 @@ }, { "name": "appwrite/sdk-generator", - "version": "0.3.3", + "version": "0.4.2", "source": { "type": "git", "url": "https://github.com/appwrite/sdk-generator", - "reference": "7530820a1ee824874d89749c51b0e49d15595abc" + "reference": "5482f4cdb65ab90ffea752ba9a625187cd7c7784" }, "require": { "ext-curl": "*", @@ -1892,7 +1896,7 @@ } ], "description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms", - "time": "2021-01-05T17:58:17+00:00" + "time": "2021-01-07T14:03:54+00:00" }, { "name": "composer/package-versions-deprecated", @@ -2323,16 +2327,16 @@ }, { "name": "matthiasmullie/minify", - "version": "1.3.65", + "version": "1.3.66", "source": { "type": "git", "url": "https://github.com/matthiasmullie/minify.git", - "reference": "227f19062451c55a797e0cc667ef983834e6580c" + "reference": "45fd3b0f1dfa2c965857c6d4a470bea52adc31a6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/matthiasmullie/minify/zipball/227f19062451c55a797e0cc667ef983834e6580c", - "reference": "227f19062451c55a797e0cc667ef983834e6580c", + "url": "https://api.github.com/repos/matthiasmullie/minify/zipball/45fd3b0f1dfa2c965857c6d4a470bea52adc31a6", + "reference": "45fd3b0f1dfa2c965857c6d4a470bea52adc31a6", "shasum": "" }, "require": { @@ -2342,8 +2346,8 @@ }, "require-dev": { "friendsofphp/php-cs-fixer": "~2.0", - "matthiasmullie/scrapbook": "~1.0", - "phpunit/phpunit": "~4.8" + "matthiasmullie/scrapbook": "dev-master", + "phpunit/phpunit": ">=4.8" }, "suggest": { "psr/cache-implementation": "Cache implementation to use with Minify::cache" @@ -2381,7 +2385,7 @@ ], "support": { "issues": "https://github.com/matthiasmullie/minify/issues", - "source": "https://github.com/matthiasmullie/minify/tree/1.3.65" + "source": "https://github.com/matthiasmullie/minify/tree/1.3.66" }, "funding": [ { @@ -2397,7 +2401,7 @@ "type": "github" } ], - "time": "2020-12-27T21:43:29+00:00" + "time": "2021-01-06T15:18:10+00:00" }, { "name": "matthiasmullie/path-converter", @@ -4513,12 +4517,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "af2bafc13cb92e182bf634285346925e09888d23" + "reference": "da4c3663721420520b024e5aede66b813019e744" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/af2bafc13cb92e182bf634285346925e09888d23", - "reference": "af2bafc13cb92e182bf634285346925e09888d23", + "url": "https://api.github.com/repos/symfony/console/zipball/da4c3663721420520b024e5aede66b813019e744", + "reference": "da4c3663721420520b024e5aede66b813019e744", "shasum": "" }, "require": { @@ -4603,7 +4607,7 @@ "type": "tidelift" } ], - "time": "2021-01-05T19:51:30+00:00" + "time": "2021-01-05T20:16:44+00:00" }, { "name": "symfony/polyfill-ctype", @@ -4611,12 +4615,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "7130f348df2f842044038aaae9d6653dc9d67649" + "reference": "7c0a3c5420fd802637c4260e595d6c674b23d578" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/7130f348df2f842044038aaae9d6653dc9d67649", - "reference": "7130f348df2f842044038aaae9d6653dc9d67649", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/7c0a3c5420fd802637c4260e595d6c674b23d578", + "reference": "7c0a3c5420fd802637c4260e595d6c674b23d578", "shasum": "" }, "require": { @@ -4683,7 +4687,7 @@ "type": "tidelift" } ], - "time": "2020-12-27T09:28:48+00:00" + "time": "2021-01-06T10:19:43+00:00" }, { "name": "symfony/polyfill-intl-grapheme", @@ -4691,12 +4695,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "e314d4992832c3a0a68ca731fadd959917320fda" + "reference": "32b651134d58efe1786c95352d846913a42d8331" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/e314d4992832c3a0a68ca731fadd959917320fda", - "reference": "e314d4992832c3a0a68ca731fadd959917320fda", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/32b651134d58efe1786c95352d846913a42d8331", + "reference": "32b651134d58efe1786c95352d846913a42d8331", "shasum": "" }, "require": { @@ -4765,7 +4769,7 @@ "type": "tidelift" } ], - "time": "2020-12-27T09:28:48+00:00" + "time": "2021-01-06T10:19:43+00:00" }, { "name": "symfony/polyfill-intl-normalizer", @@ -4773,12 +4777,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "3a79a2226897adae0cab81688fbc5144e2fc53f6" + "reference": "8592bf62da8352927fc3857484e84baacddec301" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/3a79a2226897adae0cab81688fbc5144e2fc53f6", - "reference": "3a79a2226897adae0cab81688fbc5144e2fc53f6", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8592bf62da8352927fc3857484e84baacddec301", + "reference": "8592bf62da8352927fc3857484e84baacddec301", "shasum": "" }, "require": { @@ -4850,7 +4854,7 @@ "type": "tidelift" } ], - "time": "2020-12-27T22:11:44+00:00" + "time": "2021-01-06T10:19:43+00:00" }, { "name": "symfony/polyfill-mbstring", @@ -4858,12 +4862,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "de14691dc88bbbc5535de7f0e32080977dc1d23f" + "reference": "ec0101071dcbc6bdd5046da11df686f8515fa815" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/de14691dc88bbbc5535de7f0e32080977dc1d23f", - "reference": "de14691dc88bbbc5535de7f0e32080977dc1d23f", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/ec0101071dcbc6bdd5046da11df686f8515fa815", + "reference": "ec0101071dcbc6bdd5046da11df686f8515fa815", "shasum": "" }, "require": { @@ -4931,7 +4935,7 @@ "type": "tidelift" } ], - "time": "2020-12-27T09:28:48+00:00" + "time": "2021-01-06T10:19:43+00:00" }, { "name": "symfony/polyfill-php73", @@ -4939,12 +4943,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "8c0d39c1526009b97f43beea4cc685bbc353a70b" + "reference": "6d0e293e2b13580b866090a135900aea4adcb308" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/8c0d39c1526009b97f43beea4cc685bbc353a70b", - "reference": "8c0d39c1526009b97f43beea4cc685bbc353a70b", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/6d0e293e2b13580b866090a135900aea4adcb308", + "reference": "6d0e293e2b13580b866090a135900aea4adcb308", "shasum": "" }, "require": { @@ -5011,7 +5015,7 @@ "type": "tidelift" } ], - "time": "2020-10-26T13:35:45+00:00" + "time": "2021-01-06T10:19:43+00:00" }, { "name": "symfony/polyfill-php80", @@ -5019,12 +5023,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "54cc82c30ba7ed02bc64f5d010488c159b5f1706" + "reference": "69e5da91ad9c080f6ac1e010ddffefe71b14bd6e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/54cc82c30ba7ed02bc64f5d010488c159b5f1706", - "reference": "54cc82c30ba7ed02bc64f5d010488c159b5f1706", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/69e5da91ad9c080f6ac1e010ddffefe71b14bd6e", + "reference": "69e5da91ad9c080f6ac1e010ddffefe71b14bd6e", "shasum": "" }, "require": { @@ -5095,7 +5099,7 @@ "type": "tidelift" } ], - "time": "2020-12-27T09:28:48+00:00" + "time": "2021-01-06T10:19:43+00:00" }, { "name": "symfony/service-contracts", diff --git a/docs/examples/0.6.2/server-dotnet/examples/database/create-collection.md b/docs/examples/0.6.2/server-dotnet/examples/database/create-collection.md index a8c2c3f7e0..7e519655b2 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/database/create-collection.md +++ b/docs/examples/0.6.2/server-dotnet/examples/database/create-collection.md @@ -10,4 +10,4 @@ client Database database = new Database(client); -HttpResponseMessage result = await database.CreateCollection("[NAME]", {}, {}, {}); +HttpResponseMessage result = await database.CreateCollection("[NAME]", [List], [List], [List]); diff --git a/docs/examples/0.6.2/server-dotnet/examples/database/create-document.md b/docs/examples/0.6.2/server-dotnet/examples/database/create-document.md index 1a875067a1..be00512f29 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/database/create-document.md +++ b/docs/examples/0.6.2/server-dotnet/examples/database/create-document.md @@ -10,4 +10,4 @@ client Database database = new Database(client); -HttpResponseMessage result = await database.CreateDocument("[COLLECTION_ID]", {}, {}, {}); +HttpResponseMessage result = await database.CreateDocument("[COLLECTION_ID]", [object], [List], [List]); diff --git a/docs/examples/0.6.2/server-dotnet/examples/database/update-collection.md b/docs/examples/0.6.2/server-dotnet/examples/database/update-collection.md index 42c67650d1..c28830be3c 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/database/update-collection.md +++ b/docs/examples/0.6.2/server-dotnet/examples/database/update-collection.md @@ -10,4 +10,4 @@ client Database database = new Database(client); -HttpResponseMessage result = await database.UpdateCollection("[COLLECTION_ID]", "[NAME]", {}, {}); +HttpResponseMessage result = await database.UpdateCollection("[COLLECTION_ID]", "[NAME]", [List], [List]); diff --git a/docs/examples/0.6.2/server-dotnet/examples/database/update-document.md b/docs/examples/0.6.2/server-dotnet/examples/database/update-document.md index 5f4c173b7a..32176af3da 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/database/update-document.md +++ b/docs/examples/0.6.2/server-dotnet/examples/database/update-document.md @@ -10,4 +10,4 @@ client Database database = new Database(client); -HttpResponseMessage result = await database.UpdateDocument("[COLLECTION_ID]", "[DOCUMENT_ID]", {}, {}, {}); +HttpResponseMessage result = await database.UpdateDocument("[COLLECTION_ID]", "[DOCUMENT_ID]", [object], [List], [List]); diff --git a/docs/examples/0.6.2/server-dotnet/examples/storage/create-file.md b/docs/examples/0.6.2/server-dotnet/examples/storage/create-file.md index 5427fceb1e..8c1e80e8c3 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/storage/create-file.md +++ b/docs/examples/0.6.2/server-dotnet/examples/storage/create-file.md @@ -10,4 +10,4 @@ client Storage storage = new Storage(client); -HttpResponseMessage result = await storage.CreateFile(new File("./path-to-files/image.jpg"), {}, {}); +HttpResponseMessage result = await storage.CreateFile(new File("./path-to-files/image.jpg"), [List], [List]); diff --git a/docs/examples/0.6.2/server-dotnet/examples/storage/update-file.md b/docs/examples/0.6.2/server-dotnet/examples/storage/update-file.md index 8effc42980..fd62fa4049 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/storage/update-file.md +++ b/docs/examples/0.6.2/server-dotnet/examples/storage/update-file.md @@ -10,4 +10,4 @@ client Storage storage = new Storage(client); -HttpResponseMessage result = await storage.UpdateFile("[FILE_ID]", {}, {}); +HttpResponseMessage result = await storage.UpdateFile("[FILE_ID]", [List], [List]); diff --git a/docs/examples/0.6.2/server-dotnet/examples/teams/create-membership.md b/docs/examples/0.6.2/server-dotnet/examples/teams/create-membership.md index d149cb4738..7391cc6fff 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/teams/create-membership.md +++ b/docs/examples/0.6.2/server-dotnet/examples/teams/create-membership.md @@ -10,4 +10,4 @@ client Teams teams = new Teams(client); -HttpResponseMessage result = await teams.CreateMembership("[TEAM_ID]", "email@example.com", {}, "https://example.com"); +HttpResponseMessage result = await teams.CreateMembership("[TEAM_ID]", "email@example.com", [List], "https://example.com"); diff --git a/docs/examples/0.6.2/server-dotnet/examples/users/update-prefs.md b/docs/examples/0.6.2/server-dotnet/examples/users/update-prefs.md index 06ffa4245a..0cfb05f912 100644 --- a/docs/examples/0.6.2/server-dotnet/examples/users/update-prefs.md +++ b/docs/examples/0.6.2/server-dotnet/examples/users/update-prefs.md @@ -10,4 +10,4 @@ client Users users = new Users(client); -HttpResponseMessage result = await users.UpdatePrefs("[USER_ID]", {}); +HttpResponseMessage result = await users.UpdatePrefs("[USER_ID]", [object]); From dcc270e32de1fbc4bee75520ed3c122c5923598a Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Thu, 7 Jan 2021 17:05:57 +0200 Subject: [PATCH 112/230] Docs as code. --- app/config/variables.php | 104 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) diff --git a/app/config/variables.php b/app/config/variables.php index 49ec821af8..9696954c17 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -3,192 +3,296 @@ return [ [ 'name' => '_APP_ENV', + 'description' => 'Set your server running environment. By default, the var is set to \'development\'. When deploying to production, change it to: \'production\'.', + 'introduction' => '', 'default' => 'production', 'required' => false, 'question' => '', ], [ 'name' => '_APP_OPTIONS_ABUSE', + 'description' => 'Allows you to disable abuse checks and API rate limiting. By default, set to \'enabled\'. To cancel the abuse checking, set to \'disabled\'. It is not recommended to disable this check-in a production environment.', + 'introduction' => '', 'default' => 'enabled', 'required' => false, 'question' => '', ], [ 'name' => '_APP_OPTIONS_FORCE_HTTPS', + 'description' => 'Allows you to force HTTPS connection to your API. This feature redirects any HTTP call to HTTPS and adds the \'Strict-Transport-Security\' header to all HTTP responses. By default, set to \'disabled\'. To enable, set to \'enabled\'. This feature will work only when your ports are set to default 80 and 443.', + 'introduction' => '', 'default' => 'enabled', 'required' => false, 'question' => '', ], [ 'name' => '_APP_OPENSSL_KEY_V1', + 'description' => 'This is your server private secret key that is used to encrypt all sensitive data on your server. Appwrite server encrypts all secret data on your server like webhooks, HTTP passwords, user sessions, and storage files. The var is not set by default, if you wish to take advantage of Appwrite encryption capabilities you should change it and make sure to **keep it a secret and have a backup for it**.', + 'introduction' => '', 'default' => 'your-secret-key', 'required' => true, 'question' => 'Choose a secret API key, make sure to make a backup of your key in a secure location', ], [ 'name' => '_APP_DOMAIN', + 'description' => 'Your Appwrite domain address. When setting a public suffix domain, Appwrite will attempt to issue a valid SSL certificate automatically. When used with a dev domain, Appwrite will assign a self-signed SSL certificate. The default value is \'localhost\'.', + 'introduction' => '', 'default' => 'localhost', 'required' => true, 'question' => 'Enter your Appwrite hostname', ], [ 'name' => '_APP_DOMAIN_TARGET', + 'description' => 'A DNS A record hostname to serve as a CNAME target for your Appwrite custom domains. You can use the same value as used for the Appwrite \'_APP_DOMAIN\' variable. The default value is \'localhost\'.', + 'introduction' => '', 'default' => 'localhost', 'required' => true, 'question' => "Enter a DNS A record hostname to serve as a CNAME for your custom domains.\nYou can use the same value as used for the Appwrite hostname.", ], + [ + 'name' => '_APP_CONSOLE_WHITELIST_EMAILS', + 'description' => 'This option allows you to limit creation of users to Appwrite console. This option is very useful for small teams or sole developers. To enable it, pass a list of allowed email addresses separated by a comma.', + 'introduction' => '', + 'default' => '', + 'required' => false, + 'question' => '', + ], + [ + 'name' => '_APP_CONSOLE_WHITELIST_DOMAINS', + 'description' => "This option allows you to limit creation of users to Appwrite console for users sharing the same email domains. This option is very useful for team working with company emails domain.\n\nTo enable this option, pass a list of allowed email domains separated by a comma.", + 'introduction' => '', + 'default' => '', + 'required' => false, + 'question' => '', + ], + [ + 'name' => '_APP_CONSOLE_WHITELIST_IPS', + 'description' => "This last option allows you to limit creation of users in Appwrite console for users sharing the same set of IP addresses. This option is very useful for team working with a VPN service or a company IP.\n\nTo enable/activate this option, pass a list of allowed IP addresses separated by a comma.", + 'introduction' => '', + 'default' => '', + 'required' => false, + 'question' => '', + ], + [ + 'name' => '_APP_SYSTEM_EMAIL_NAME', + 'description' => 'This is the sender name value that will appear on email messages sent to developers from the Appwrite console. The default value is: \'Appwrite\'. You can use url encoded strings for spaces and special chars.', + 'introduction' => '0.7.0', + 'default' => 'Appwrite', + 'required' => false, + 'question' => '', + ], + [ + 'name' => '_APP_SYSTEM_EMAIL_ADDRESS', + 'description' => 'This is the sender email address that will appear on email messages sent to developers from the Appwrite console. The default value is \'team@appwrite.io\'. You should choose an email address that is allowed to be used from your SMTP server to avoid the server email ending in the users\' SPAM folders.', + 'introduction' => '0.7.0', + 'default' => 'team@appwrite.io', + 'required' => false, + 'question' => '', + ], [ 'name' => '_APP_REDIS_HOST', + 'description' => 'Redis server hostname address. Default value is: \'redis\'.', + 'introduction' => '', 'default' => 'redis', 'required' => false, 'question' => '', ], [ 'name' => '_APP_REDIS_PORT', + 'description' => 'Redis server TCP port. Default value is: \'6379\'.', + 'introduction' => '', 'default' => '6379', 'required' => false, 'question' => '', ], [ 'name' => '_APP_DB_HOST', + 'description' => 'MariaDB server host name address. Default value is: \'mariadb\'.', + 'introduction' => '', 'default' => 'mariadb', 'required' => false, 'question' => '', ], [ 'name' => '_APP_DB_PORT', + 'description' => 'MariaDB server TCP port. Default value is: \'3306\'.', + 'introduction' => '', 'default' => '3306', 'required' => false, 'question' => '', ], [ 'name' => '_APP_DB_SCHEMA', + 'description' => 'MariaDB server database schema. Default value is: \'appwrite\'.', + 'introduction' => '', 'default' => 'appwrite', 'required' => false, 'question' => '', ], [ 'name' => '_APP_DB_USER', + 'description' => 'MariaDB server user name. Default value is: \'root\'.', + 'introduction' => '', 'default' => 'user', 'required' => false, 'question' => '', ], [ 'name' => '_APP_DB_PASS', + 'description' => 'MariaDB server user password. Default value is: \'password\'.', + 'introduction' => '', 'default' => 'password', 'required' => false, 'question' => '', ], [ 'name' => '_APP_INFLUXDB_HOST', + 'description' => 'InfluxDB server host name address. Default value is: \'influxdb\'.', + 'introduction' => '', 'default' => 'influxdb', 'required' => false, 'question' => '', ], [ 'name' => '_APP_INFLUXDB_PORT', + 'description' => 'InfluxDB server TCP port. Default value is: \'8086\'.', + 'introduction' => '', 'default' => '8086', 'required' => false, 'question' => '', ], [ 'name' => '_APP_STATSD_HOST', + 'description' => 'StatsD server host name address. Default value is: \'telegraf\'.', + 'introduction' => '', 'default' => 'telegraf', 'required' => false, 'question' => '', ], [ 'name' => '_APP_STATSD_PORT', + 'description' => 'StatsD server TCP port. Default value is: \'8125\'.', + 'introduction' => '', 'default' => '8125', 'required' => false, 'question' => '', ], [ 'name' => '_APP_SMTP_HOST', + 'description' => 'SMTP server host name address. Default value is: \'smtp\'. Pass an empty string to disable all mail sending from the server.', + 'introduction' => '', 'default' => 'smtp', 'required' => false, 'question' => '', ], [ 'name' => '_APP_SMTP_PORT', + 'description' => 'SMTP server TCP port. Default value is: \'25\'.', + 'introduction' => '', 'default' => '25', 'required' => false, 'question' => '', ], [ 'name' => '_APP_SMTP_SECURE', + 'description' => 'SMTP secure connection protocol. Empty by default, change to \'tls\' if running on a secure connection.', + 'introduction' => '', 'default' => '', 'required' => false, 'question' => '', ], [ 'name' => '_APP_SMTP_USERNAME', + 'description' => 'SMTP server user name. Empty by default.', + 'introduction' => '', 'default' => '', 'required' => false, 'question' => '', ], [ 'name' => '_APP_SMTP_PASSWORD', + 'description' => 'SMTP server user password. Empty by default.', + 'introduction' => '', 'default' => '', 'required' => false, 'question' => '', ], [ 'name' => '_APP_STORAGE_LIMIT', + 'description' => 'Maximun file size allowed for file upload. The default value is 10MB limitation. You should pass your size limit value in bytes.', + 'introduction' => '0.7.0', 'default' => '10000000', 'required' => false, 'question' => '', ], [ 'name' => '_APP_STORAGE_ANTIVIRUS', + 'description' => 'This variable allows you to disable the internal anti-virus scans. This value is set to \'enabled\' by default, to cancel the scans set the value to \'disabled\'. When disabled, it\'s recommended to turn off the ClamAV container for better resource usage.', + 'introduction' => '', 'default' => 'enabled', 'required' => false, 'question' => '', ], [ 'name' => '_APP_STORAGE_ANTIVIRUS_HOST', + 'description' => 'ClamAV server host name address. Default value is: \'clamav\'.', + 'introduction' => '0.7.0', 'default' => 'clamav', 'required' => false, 'question' => '', ], [ 'name' => '_APP_STORAGE_ANTIVIRUS_PORT', + 'description' => 'ClamAV server TCP port. Default value is: \'3310\'.', + 'introduction' => '0.7.0', 'default' => '3310', 'required' => false, 'question' => '', ], [ 'name' => '_APP_FUNCTIONS_TIMEOUT', + 'description' => 'The maximum number of seconds allowed as a timeout value when creating a new function. The default value is 900 seconds.', + 'introduction' => '0.7.0', 'default' => '900', 'required' => false, 'question' => '', ], [ 'name' => '_APP_FUNCTIONS_CONTAINERS', + 'description' => 'The maximum number of containers Appwrite is allowed to keep alive in the background for function environments. Running containers allow faster execution time as there is no need to recreate each container every time a function gets executed. The default value is 10.', + 'introduction' => '0.7.0', 'default' => '10', 'required' => false, 'question' => '', ], [ 'name' => '_APP_FUNCTIONS_CPUS', + 'description' => 'The maximum number of CPU core a single cloud function is allowed to use. Please note that setting a value higher than available cores will result in a function error, which might result in an error. The default value is 1.', + 'introduction' => '0.7.0', 'default' => '1', 'required' => false, 'question' => '', ], [ 'name' => '_APP_FUNCTIONS_MEMORY', + 'description' => 'The maximum amount of memory a single cloud function is allowed to use in megabytes. The default value is 128.', + 'introduction' => '0.7.0', 'default' => '128', 'required' => false, 'question' => '', ], [ 'name' => '_APP_FUNCTIONS_MEMORY_SWAP', + 'description' => 'The maximum amount of swap memory a single cloud function is allowed to use in megabytes. The default value is 128.', + 'introduction' => '0.7.0', 'default' => '128', 'required' => false, 'question' => '', ], [ 'name' => '_APP_MAINTENANCE_INTERVAL', + 'description' => 'Interval value containing the number of seconds that the Appwrite maintenance process should wait before executing system cleanups and optimizations. The default value is 86400 seconds (1 day).', + 'introduction' => '0.7.0', 'default' => '86400', 'required' => false, 'question' => '', From 086739cfba82e161171ff2ec657bdef03226d39f Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Thu, 7 Jan 2021 17:08:05 +0200 Subject: [PATCH 113/230] Removed old docs --- docs/tutorials/environment-variables.md | 141 ------------------------ 1 file changed, 141 deletions(-) delete mode 100644 docs/tutorials/environment-variables.md diff --git a/docs/tutorials/environment-variables.md b/docs/tutorials/environment-variables.md deleted file mode 100644 index 3ab2183ff2..0000000000 --- a/docs/tutorials/environment-variables.md +++ /dev/null @@ -1,141 +0,0 @@ -# Environment Variables - -Appwrite environment variables allow you to edit your server setup configuration and customize it. You can change the environment variables by changing them when running Appwrite using Docker CLI or Docker-Compose. - -## General Options - -### _APP_ENV - -Set your server running environment. By default, the var is set to 'development'. When deploying to production, change it to: 'production'. - -### _APP_OPTIONS_ABUSE - -Allows you to turn off abuse checks and API rate limiting. By default, set to 'enabled'. To cancel the abuse checking, set to 'disabled'. It is not recommended to turn off this feature in a production environment. - -### _APP_OPTIONS_FORCE_HTTPS - -Allows you to force HTTPS connection to your API. This feature redirects any HTTP call to HTTPS and adds the 'Strict-Transport-Security' header to all HTTP responses. By default, set to 'disabled'. To enable, set to 'enabled'. This feature will work only when your ports are set to default 80 and 443. - -### _APP_OPENSSL_KEY_V1 - -This is your server private secret key that is used to encrypt all sensitive data on your server. Appwrite server encrypts all secret data on your server like webhooks, HTTP passwords, user sessions, and storage files. The var is not set by default, if you wish to take advantage of Appwrite encryption capabilities you should change it and make sure to keep it a secret. - -### _APP_STORAGE_LIMIT - -Maximum file size allowed for file upload. The default value is 100MB limitation. You should pass your size limit value in bytes. - -### _APP_STORAGE_ANTIVIRUS - -This variable allows you to disable the internal anti-virus scans. This value is set to 'enabled' by default, to cancel the scans set the value to 'disabled'. When disabled, it's recommended to turn off the ClamAV container for better resource usage. - -### _APP_CONSOLE_WHITELIST_EMAILS - -This option allows you to limit creation of users to Appwrite console. This option is very useful for small teams or sole developers. To enable it, pass a list of allowed email addresses separated by a comma. - -### _APP_CONSOLE_WHITELIST_DOMAINS - -This option allows you to limit creation of users to Appwrite console for users sharing the same email domains. This option is very useful for team working with company emails domain. - -To enable this option, pass a list of allowed email domains separated by a comma. - -### _APP_CONSOLE_WHITELIST_IPS - -This last option allows you to limit creation of users in Appwrite console for users sharing the same set of IP addresses. This option is very useful for team working with a VPN service or a company IP. - -To enable/activate this option, pass a list of allowed IP addresses separated by a comma. - -## Redis Server - -Appwrite uses a Redis server for managing cache, queues and scheduled tasks. The Redis env vars are used to allow Appwrite server to connect to the Redis container. - -### _APP_REDIS_HOST - -Redis server hostname address. Default value is: 'redis' - -### _APP_REDIS_PORT - -Redis server TCP port. Default value is: '6379' - -## MariaDB Server - -Appwrite is using a MariaDB server for managing persistent database data. The MariaDB env vars are used to allow Appwrite server to connect to the MariaDB container. - -### _APP_DB_HOST - -MariaDB server host name address. Default value is: 'mariadb' - -### _APP_DB_PORT - -MariaDB server TCP port. Default value is: '3306' - -### _APP_DB_USER - -MariaDB server user name. Default value is: 'root' - -### _APP_DB_PASS - -MariaDB server user password. Default value is: 'password' - -### _APP_DB_SCHEMA - -MariaDB server database schema. Default value is: 'appwrite' - -## InfluxDB - -Appwrite uses an InfluxDB server for managing time-series data and server stats. The InfluxDB env vars are used to allow Appwrite server to connect to the InfluxDB container. - -### _APP_INFLUXDB_HOST - -InfluxDB server host name address. Default value is: 'influxdb' - -### _APP_INFLUXDB_PORT - -InfluxDB server TCP port. Default value is: '8086' - -## StatsD - -Appwrite uses a StatsD server for aggregating and sending stats data over a fast UDP connection. The StatsD env vars are used to allow Appwrite server to connect to the StatsD container. - -### _APP_STATSD_HOST - -StatsD server host name address. Default value is: 'telegraf' - -### _APP_STATSD_PORT - -StatsD server TCP port. Default value is: '8125' - -## SMTP - -Appwrite is using an SMTP server for emailing your projects users and server admins. The SMTP env vars are used to allow Appwrite server to connect to the SMTP container. - -If running in production, it might be easier to use a 3rd party SMTP server as it might be a little more difficult to set up a production SMTP server that will not send all your emails into your user's SPAM folder. - -### _APP_SMTP_HOST - -SMTP server host name address. Default value is: 'smtp'. Pass an empty string to disable all mail sending from the server. - -### _APP_SMTP_PORT - -SMTP server TCP port. Default value is: '25' - -### _APP_SMTP_SECURE - -SMTP secure connection protocol. Empty by default, change to 'tls' if running on a secure connection. - -### _APP_SMTP_USERNAME - -SMTP server user name. Empty by default. - -### _APP_SMTP_PASSWORD - -SMTP server user password. Empty by default. - -## System Settings - -### _APP_SYSTEM_EMAIL_NAME - -This is the sender name value that will appear on email messages sent to developers from the Appwrite console. The default value is: 'Appwrite Team'. You can use url encoded strings for spaces and special chars. - -### _APP_SYSTEM_EMAIL_ADDRESS - -This is the sender email address that will appear on email messages sent to developers from the Appwrite console. The default value is 'team@appwrite.io'. You should choose an email address that is allowed to be used from your SMTP server to avoid the server email ending in the users' SPAM folders. From bac731e5b28b9413c191e432b6ada5ca2c7b426c Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Thu, 7 Jan 2021 22:50:27 +0200 Subject: [PATCH 114/230] Docs as code --- app/config/variables.php | 608 +++++++++++++++++++++------------------ app/tasks/install.php | 9 +- app/tasks/vars.php | 12 +- 3 files changed, 346 insertions(+), 283 deletions(-) diff --git a/app/config/variables.php b/app/config/variables.php index 9696954c17..59de920221 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -2,299 +2,347 @@ return [ [ - 'name' => '_APP_ENV', - 'description' => 'Set your server running environment. By default, the var is set to \'development\'. When deploying to production, change it to: \'production\'.', - 'introduction' => '', - 'default' => 'production', - 'required' => false, - 'question' => '', + 'category' => 'General', + 'description' => '', + 'variables' => [ + [ + 'name' => '_APP_ENV', + 'description' => 'Set your server running environment. By default, the var is set to \'development\'. When deploying to production, change it to: \'production\'.', + 'introduction' => '', + 'default' => 'production', + 'required' => false, + 'question' => '', + ], + [ + 'name' => '_APP_OPTIONS_ABUSE', + 'description' => 'Allows you to disable abuse checks and API rate limiting. By default, set to \'enabled\'. To cancel the abuse checking, set to \'disabled\'. It is not recommended to disable this check-in a production environment.', + 'introduction' => '', + 'default' => 'enabled', + 'required' => false, + 'question' => '', + ], + [ + 'name' => '_APP_OPTIONS_FORCE_HTTPS', + 'description' => 'Allows you to force HTTPS connection to your API. This feature redirects any HTTP call to HTTPS and adds the \'Strict-Transport-Security\' header to all HTTP responses. By default, set to \'disabled\'. To enable, set to \'enabled\'. This feature will work only when your ports are set to default 80 and 443.', + 'introduction' => '', + 'default' => 'enabled', + 'required' => false, + 'question' => '', + ], + [ + 'name' => '_APP_OPENSSL_KEY_V1', + 'description' => 'This is your server private secret key that is used to encrypt all sensitive data on your server. Appwrite server encrypts all secret data on your server like webhooks, HTTP passwords, user sessions, and storage files. The var is not set by default, if you wish to take advantage of Appwrite encryption capabilities you should change it and make sure to **keep it a secret and have a backup for it**.', + 'introduction' => '', + 'default' => 'your-secret-key', + 'required' => true, + 'question' => 'Choose a secret API key, make sure to make a backup of your key in a secure location', + ], + [ + 'name' => '_APP_DOMAIN', + 'description' => 'Your Appwrite domain address. When setting a public suffix domain, Appwrite will attempt to issue a valid SSL certificate automatically. When used with a dev domain, Appwrite will assign a self-signed SSL certificate. The default value is \'localhost\'.', + 'introduction' => '', + 'default' => 'localhost', + 'required' => true, + 'question' => 'Enter your Appwrite hostname', + ], + [ + 'name' => '_APP_DOMAIN_TARGET', + 'description' => 'A DNS A record hostname to serve as a CNAME target for your Appwrite custom domains. You can use the same value as used for the Appwrite \'_APP_DOMAIN\' variable. The default value is \'localhost\'.', + 'introduction' => '', + 'default' => 'localhost', + 'required' => true, + 'question' => "Enter a DNS A record hostname to serve as a CNAME for your custom domains.\nYou can use the same value as used for the Appwrite hostname.", + ], + [ + 'name' => '_APP_CONSOLE_WHITELIST_EMAILS', + 'description' => 'This option allows you to limit creation of users to Appwrite console. This option is very useful for small teams or sole developers. To enable it, pass a list of allowed email addresses separated by a comma.', + 'introduction' => '', + 'default' => '', + 'required' => false, + 'question' => '', + ], + [ + 'name' => '_APP_CONSOLE_WHITELIST_DOMAINS', + 'description' => "This option allows you to limit creation of users to Appwrite console for users sharing the same email domains. This option is very useful for team working with company emails domain.\n\nTo enable this option, pass a list of allowed email domains separated by a comma.", + 'introduction' => '', + 'default' => '', + 'required' => false, + 'question' => '', + ], + [ + 'name' => '_APP_CONSOLE_WHITELIST_IPS', + 'description' => "This last option allows you to limit creation of users in Appwrite console for users sharing the same set of IP addresses. This option is very useful for team working with a VPN service or a company IP.\n\nTo enable/activate this option, pass a list of allowed IP addresses separated by a comma.", + 'introduction' => '', + 'default' => '', + 'required' => false, + 'question' => '', + ], + [ + 'name' => '_APP_SYSTEM_EMAIL_NAME', + 'description' => 'This is the sender name value that will appear on email messages sent to developers from the Appwrite console. The default value is: \'Appwrite\'. You can use url encoded strings for spaces and special chars.', + 'introduction' => '0.7.0', + 'default' => 'Appwrite', + 'required' => false, + 'question' => '', + ], + [ + 'name' => '_APP_SYSTEM_EMAIL_ADDRESS', + 'description' => 'This is the sender email address that will appear on email messages sent to developers from the Appwrite console. The default value is \'team@appwrite.io\'. You should choose an email address that is allowed to be used from your SMTP server to avoid the server email ending in the users\' SPAM folders.', + 'introduction' => '0.7.0', + 'default' => 'team@appwrite.io', + 'required' => false, + 'question' => '', + ], + ], ], [ - 'name' => '_APP_OPTIONS_ABUSE', - 'description' => 'Allows you to disable abuse checks and API rate limiting. By default, set to \'enabled\'. To cancel the abuse checking, set to \'disabled\'. It is not recommended to disable this check-in a production environment.', - 'introduction' => '', - 'default' => 'enabled', - 'required' => false, - 'question' => '', + 'category' => 'Redis', + 'description' => '', + 'variables' => [ + [ + 'name' => '_APP_REDIS_HOST', + 'description' => 'Redis server hostname address. Default value is: \'redis\'.', + 'introduction' => '', + 'default' => 'redis', + 'required' => false, + 'question' => '', + ], + [ + 'name' => '_APP_REDIS_PORT', + 'description' => 'Redis server TCP port. Default value is: \'6379\'.', + 'introduction' => '', + 'default' => '6379', + 'required' => false, + 'question' => '', + ], + ], ], [ - 'name' => '_APP_OPTIONS_FORCE_HTTPS', - 'description' => 'Allows you to force HTTPS connection to your API. This feature redirects any HTTP call to HTTPS and adds the \'Strict-Transport-Security\' header to all HTTP responses. By default, set to \'disabled\'. To enable, set to \'enabled\'. This feature will work only when your ports are set to default 80 and 443.', - 'introduction' => '', - 'default' => 'enabled', - 'required' => false, - 'question' => '', + 'category' => 'MariaDB', + 'description' => '', + 'variables' => [ + [ + 'name' => '_APP_DB_HOST', + 'description' => 'MariaDB server host name address. Default value is: \'mariadb\'.', + 'introduction' => '', + 'default' => 'mariadb', + 'required' => false, + 'question' => '', + ], + [ + 'name' => '_APP_DB_PORT', + 'description' => 'MariaDB server TCP port. Default value is: \'3306\'.', + 'introduction' => '', + 'default' => '3306', + 'required' => false, + 'question' => '', + ], + [ + 'name' => '_APP_DB_SCHEMA', + 'description' => 'MariaDB server database schema. Default value is: \'appwrite\'.', + 'introduction' => '', + 'default' => 'appwrite', + 'required' => false, + 'question' => '', + ], + [ + 'name' => '_APP_DB_USER', + 'description' => 'MariaDB server user name. Default value is: \'root\'.', + 'introduction' => '', + 'default' => 'user', + 'required' => false, + 'question' => '', + ], + [ + 'name' => '_APP_DB_PASS', + 'description' => 'MariaDB server user password. Default value is: \'password\'.', + 'introduction' => '', + 'default' => 'password', + 'required' => false, + 'question' => '', + ], + ], ], [ - 'name' => '_APP_OPENSSL_KEY_V1', - 'description' => 'This is your server private secret key that is used to encrypt all sensitive data on your server. Appwrite server encrypts all secret data on your server like webhooks, HTTP passwords, user sessions, and storage files. The var is not set by default, if you wish to take advantage of Appwrite encryption capabilities you should change it and make sure to **keep it a secret and have a backup for it**.', - 'introduction' => '', - 'default' => 'your-secret-key', - 'required' => true, - 'question' => 'Choose a secret API key, make sure to make a backup of your key in a secure location', + 'category' => 'InfluxDB', + 'description' => '', + 'variables' => [ + [ + 'name' => '_APP_INFLUXDB_HOST', + 'description' => 'InfluxDB server host name address. Default value is: \'influxdb\'.', + 'introduction' => '', + 'default' => 'influxdb', + 'required' => false, + 'question' => '', + ], + [ + 'name' => '_APP_INFLUXDB_PORT', + 'description' => 'InfluxDB server TCP port. Default value is: \'8086\'.', + 'introduction' => '', + 'default' => '8086', + 'required' => false, + 'question' => '', + ], + ], ], [ - 'name' => '_APP_DOMAIN', - 'description' => 'Your Appwrite domain address. When setting a public suffix domain, Appwrite will attempt to issue a valid SSL certificate automatically. When used with a dev domain, Appwrite will assign a self-signed SSL certificate. The default value is \'localhost\'.', - 'introduction' => '', - 'default' => 'localhost', - 'required' => true, - 'question' => 'Enter your Appwrite hostname', + 'category' => 'StatsD', + 'description' => '', + 'variables' => [ + [ + 'name' => '_APP_STATSD_HOST', + 'description' => 'StatsD server host name address. Default value is: \'telegraf\'.', + 'introduction' => '', + 'default' => 'telegraf', + 'required' => false, + 'question' => '', + ], + [ + 'name' => '_APP_STATSD_PORT', + 'description' => 'StatsD server TCP port. Default value is: \'8125\'.', + 'introduction' => '', + 'default' => '8125', + 'required' => false, + 'question' => '', + ], + ], ], [ - 'name' => '_APP_DOMAIN_TARGET', - 'description' => 'A DNS A record hostname to serve as a CNAME target for your Appwrite custom domains. You can use the same value as used for the Appwrite \'_APP_DOMAIN\' variable. The default value is \'localhost\'.', - 'introduction' => '', - 'default' => 'localhost', - 'required' => true, - 'question' => "Enter a DNS A record hostname to serve as a CNAME for your custom domains.\nYou can use the same value as used for the Appwrite hostname.", + 'category' => 'SMTP', + 'description' => '', + 'variables' => [ + [ + 'name' => '_APP_SMTP_HOST', + 'description' => 'SMTP server host name address. Default value is: \'smtp\'. Pass an empty string to disable all mail sending from the server.', + 'introduction' => '', + 'default' => 'smtp', + 'required' => false, + 'question' => '', + ], + [ + 'name' => '_APP_SMTP_PORT', + 'description' => 'SMTP server TCP port. Default value is: \'25\'.', + 'introduction' => '', + 'default' => '25', + 'required' => false, + 'question' => '', + ], + [ + 'name' => '_APP_SMTP_SECURE', + 'description' => 'SMTP secure connection protocol. Empty by default, change to \'tls\' if running on a secure connection.', + 'introduction' => '', + 'default' => '', + 'required' => false, + 'question' => '', + ], + [ + 'name' => '_APP_SMTP_USERNAME', + 'description' => 'SMTP server user name. Empty by default.', + 'introduction' => '', + 'default' => '', + 'required' => false, + 'question' => '', + ], + [ + 'name' => '_APP_SMTP_PASSWORD', + 'description' => 'SMTP server user password. Empty by default.', + 'introduction' => '', + 'default' => '', + 'required' => false, + 'question' => '', + ], + ], ], [ - 'name' => '_APP_CONSOLE_WHITELIST_EMAILS', - 'description' => 'This option allows you to limit creation of users to Appwrite console. This option is very useful for small teams or sole developers. To enable it, pass a list of allowed email addresses separated by a comma.', - 'introduction' => '', - 'default' => '', - 'required' => false, - 'question' => '', + 'category' => 'Storage', + 'description' => '', + 'variables' => [ + [ + 'name' => '_APP_STORAGE_LIMIT', + 'description' => 'Maximun file size allowed for file upload. The default value is 10MB limitation. You should pass your size limit value in bytes.', + 'introduction' => '0.7.0', + 'default' => '10000000', + 'required' => false, + 'question' => '', + ], + [ + 'name' => '_APP_STORAGE_ANTIVIRUS', + 'description' => 'This variable allows you to disable the internal anti-virus scans. This value is set to \'enabled\' by default, to cancel the scans set the value to \'disabled\'. When disabled, it\'s recommended to turn off the ClamAV container for better resource usage.', + 'introduction' => '', + 'default' => 'enabled', + 'required' => false, + 'question' => '', + ], + [ + 'name' => '_APP_STORAGE_ANTIVIRUS_HOST', + 'description' => 'ClamAV server host name address. Default value is: \'clamav\'.', + 'introduction' => '0.7.0', + 'default' => 'clamav', + 'required' => false, + 'question' => '', + ], + [ + 'name' => '_APP_STORAGE_ANTIVIRUS_PORT', + 'description' => 'ClamAV server TCP port. Default value is: \'3310\'.', + 'introduction' => '0.7.0', + 'default' => '3310', + 'required' => false, + 'question' => '', + ], + ], ], [ - 'name' => '_APP_CONSOLE_WHITELIST_DOMAINS', - 'description' => "This option allows you to limit creation of users to Appwrite console for users sharing the same email domains. This option is very useful for team working with company emails domain.\n\nTo enable this option, pass a list of allowed email domains separated by a comma.", - 'introduction' => '', - 'default' => '', - 'required' => false, - 'question' => '', - ], - [ - 'name' => '_APP_CONSOLE_WHITELIST_IPS', - 'description' => "This last option allows you to limit creation of users in Appwrite console for users sharing the same set of IP addresses. This option is very useful for team working with a VPN service or a company IP.\n\nTo enable/activate this option, pass a list of allowed IP addresses separated by a comma.", - 'introduction' => '', - 'default' => '', - 'required' => false, - 'question' => '', - ], - [ - 'name' => '_APP_SYSTEM_EMAIL_NAME', - 'description' => 'This is the sender name value that will appear on email messages sent to developers from the Appwrite console. The default value is: \'Appwrite\'. You can use url encoded strings for spaces and special chars.', - 'introduction' => '0.7.0', - 'default' => 'Appwrite', - 'required' => false, - 'question' => '', - ], - [ - 'name' => '_APP_SYSTEM_EMAIL_ADDRESS', - 'description' => 'This is the sender email address that will appear on email messages sent to developers from the Appwrite console. The default value is \'team@appwrite.io\'. You should choose an email address that is allowed to be used from your SMTP server to avoid the server email ending in the users\' SPAM folders.', - 'introduction' => '0.7.0', - 'default' => 'team@appwrite.io', - 'required' => false, - 'question' => '', - ], - [ - 'name' => '_APP_REDIS_HOST', - 'description' => 'Redis server hostname address. Default value is: \'redis\'.', - 'introduction' => '', - 'default' => 'redis', - 'required' => false, - 'question' => '', - ], - [ - 'name' => '_APP_REDIS_PORT', - 'description' => 'Redis server TCP port. Default value is: \'6379\'.', - 'introduction' => '', - 'default' => '6379', - 'required' => false, - 'question' => '', - ], - [ - 'name' => '_APP_DB_HOST', - 'description' => 'MariaDB server host name address. Default value is: \'mariadb\'.', - 'introduction' => '', - 'default' => 'mariadb', - 'required' => false, - 'question' => '', - ], - [ - 'name' => '_APP_DB_PORT', - 'description' => 'MariaDB server TCP port. Default value is: \'3306\'.', - 'introduction' => '', - 'default' => '3306', - 'required' => false, - 'question' => '', - ], - [ - 'name' => '_APP_DB_SCHEMA', - 'description' => 'MariaDB server database schema. Default value is: \'appwrite\'.', - 'introduction' => '', - 'default' => 'appwrite', - 'required' => false, - 'question' => '', - ], - [ - 'name' => '_APP_DB_USER', - 'description' => 'MariaDB server user name. Default value is: \'root\'.', - 'introduction' => '', - 'default' => 'user', - 'required' => false, - 'question' => '', - ], - [ - 'name' => '_APP_DB_PASS', - 'description' => 'MariaDB server user password. Default value is: \'password\'.', - 'introduction' => '', - 'default' => 'password', - 'required' => false, - 'question' => '', - ], - [ - 'name' => '_APP_INFLUXDB_HOST', - 'description' => 'InfluxDB server host name address. Default value is: \'influxdb\'.', - 'introduction' => '', - 'default' => 'influxdb', - 'required' => false, - 'question' => '', - ], - [ - 'name' => '_APP_INFLUXDB_PORT', - 'description' => 'InfluxDB server TCP port. Default value is: \'8086\'.', - 'introduction' => '', - 'default' => '8086', - 'required' => false, - 'question' => '', - ], - [ - 'name' => '_APP_STATSD_HOST', - 'description' => 'StatsD server host name address. Default value is: \'telegraf\'.', - 'introduction' => '', - 'default' => 'telegraf', - 'required' => false, - 'question' => '', - ], - [ - 'name' => '_APP_STATSD_PORT', - 'description' => 'StatsD server TCP port. Default value is: \'8125\'.', - 'introduction' => '', - 'default' => '8125', - 'required' => false, - 'question' => '', - ], - [ - 'name' => '_APP_SMTP_HOST', - 'description' => 'SMTP server host name address. Default value is: \'smtp\'. Pass an empty string to disable all mail sending from the server.', - 'introduction' => '', - 'default' => 'smtp', - 'required' => false, - 'question' => '', - ], - [ - 'name' => '_APP_SMTP_PORT', - 'description' => 'SMTP server TCP port. Default value is: \'25\'.', - 'introduction' => '', - 'default' => '25', - 'required' => false, - 'question' => '', - ], - [ - 'name' => '_APP_SMTP_SECURE', - 'description' => 'SMTP secure connection protocol. Empty by default, change to \'tls\' if running on a secure connection.', - 'introduction' => '', - 'default' => '', - 'required' => false, - 'question' => '', - ], - [ - 'name' => '_APP_SMTP_USERNAME', - 'description' => 'SMTP server user name. Empty by default.', - 'introduction' => '', - 'default' => '', - 'required' => false, - 'question' => '', - ], - [ - 'name' => '_APP_SMTP_PASSWORD', - 'description' => 'SMTP server user password. Empty by default.', - 'introduction' => '', - 'default' => '', - 'required' => false, - 'question' => '', - ], - [ - 'name' => '_APP_STORAGE_LIMIT', - 'description' => 'Maximun file size allowed for file upload. The default value is 10MB limitation. You should pass your size limit value in bytes.', - 'introduction' => '0.7.0', - 'default' => '10000000', - 'required' => false, - 'question' => '', - ], - [ - 'name' => '_APP_STORAGE_ANTIVIRUS', - 'description' => 'This variable allows you to disable the internal anti-virus scans. This value is set to \'enabled\' by default, to cancel the scans set the value to \'disabled\'. When disabled, it\'s recommended to turn off the ClamAV container for better resource usage.', - 'introduction' => '', - 'default' => 'enabled', - 'required' => false, - 'question' => '', - ], - [ - 'name' => '_APP_STORAGE_ANTIVIRUS_HOST', - 'description' => 'ClamAV server host name address. Default value is: \'clamav\'.', - 'introduction' => '0.7.0', - 'default' => 'clamav', - 'required' => false, - 'question' => '', - ], - [ - 'name' => '_APP_STORAGE_ANTIVIRUS_PORT', - 'description' => 'ClamAV server TCP port. Default value is: \'3310\'.', - 'introduction' => '0.7.0', - 'default' => '3310', - 'required' => false, - 'question' => '', - ], - [ - 'name' => '_APP_FUNCTIONS_TIMEOUT', - 'description' => 'The maximum number of seconds allowed as a timeout value when creating a new function. The default value is 900 seconds.', - 'introduction' => '0.7.0', - 'default' => '900', - 'required' => false, - 'question' => '', - ], - [ - 'name' => '_APP_FUNCTIONS_CONTAINERS', - 'description' => 'The maximum number of containers Appwrite is allowed to keep alive in the background for function environments. Running containers allow faster execution time as there is no need to recreate each container every time a function gets executed. The default value is 10.', - 'introduction' => '0.7.0', - 'default' => '10', - 'required' => false, - 'question' => '', - ], - [ - 'name' => '_APP_FUNCTIONS_CPUS', - 'description' => 'The maximum number of CPU core a single cloud function is allowed to use. Please note that setting a value higher than available cores will result in a function error, which might result in an error. The default value is 1.', - 'introduction' => '0.7.0', - 'default' => '1', - 'required' => false, - 'question' => '', - ], - [ - 'name' => '_APP_FUNCTIONS_MEMORY', - 'description' => 'The maximum amount of memory a single cloud function is allowed to use in megabytes. The default value is 128.', - 'introduction' => '0.7.0', - 'default' => '128', - 'required' => false, - 'question' => '', - ], - [ - 'name' => '_APP_FUNCTIONS_MEMORY_SWAP', - 'description' => 'The maximum amount of swap memory a single cloud function is allowed to use in megabytes. The default value is 128.', - 'introduction' => '0.7.0', - 'default' => '128', - 'required' => false, - 'question' => '', - ], - [ - 'name' => '_APP_MAINTENANCE_INTERVAL', - 'description' => 'Interval value containing the number of seconds that the Appwrite maintenance process should wait before executing system cleanups and optimizations. The default value is 86400 seconds (1 day).', - 'introduction' => '0.7.0', - 'default' => '86400', - 'required' => false, - 'question' => '', + 'category' => 'Functions', + 'description' => '', + 'variables' => [ + [ + 'name' => '_APP_FUNCTIONS_TIMEOUT', + 'description' => 'The maximum number of seconds allowed as a timeout value when creating a new function. The default value is 900 seconds.', + 'introduction' => '0.7.0', + 'default' => '900', + 'required' => false, + 'question' => '', + ], + [ + 'name' => '_APP_FUNCTIONS_CONTAINERS', + 'description' => 'The maximum number of containers Appwrite is allowed to keep alive in the background for function environments. Running containers allow faster execution time as there is no need to recreate each container every time a function gets executed. The default value is 10.', + 'introduction' => '0.7.0', + 'default' => '10', + 'required' => false, + 'question' => '', + ], + [ + 'name' => '_APP_FUNCTIONS_CPUS', + 'description' => 'The maximum number of CPU core a single cloud function is allowed to use. Please note that setting a value higher than available cores will result in a function error, which might result in an error. The default value is 1.', + 'introduction' => '0.7.0', + 'default' => '1', + 'required' => false, + 'question' => '', + ], + [ + 'name' => '_APP_FUNCTIONS_MEMORY', + 'description' => 'The maximum amount of memory a single cloud function is allowed to use in megabytes. The default value is 128.', + 'introduction' => '0.7.0', + 'default' => '128', + 'required' => false, + 'question' => '', + ], + [ + 'name' => '_APP_FUNCTIONS_MEMORY_SWAP', + 'description' => 'The maximum amount of swap memory a single cloud function is allowed to use in megabytes. The default value is 128.', + 'introduction' => '0.7.0', + 'default' => '128', + 'required' => false, + 'question' => '', + ], + [ + 'name' => '_APP_MAINTENANCE_INTERVAL', + 'description' => 'Interval value containing the number of seconds that the Appwrite maintenance process should wait before executing system cleanups and optimizations. The default value is 86400 seconds (1 day).', + 'introduction' => '0.7.0', + 'default' => '86400', + 'required' => false, + 'question' => '', + ], + ], ], ]; \ No newline at end of file diff --git a/app/tasks/install.php b/app/tasks/install.php index b28391d6d4..8ca090c772 100644 --- a/app/tasks/install.php +++ b/app/tasks/install.php @@ -30,10 +30,17 @@ $cli * 5. Run docker-compose up -d - DONE * 6. Run data migration */ - $vars = Config::getParam('variables'); + $config = Config::getParam('variables'); $path = '/usr/src/code/appwrite'; $defaultHTTPPort = '80'; $defaultHTTPSPort = '443'; + $vars = []; + + foreach($config as $category) { + foreach($category['variables'] ?? [] as $var) { + $vars[] = $var; + } + } Console::success('Starting Appwrite installation...'); diff --git a/app/tasks/vars.php b/app/tasks/vars.php index ed4a329735..58b21a18ec 100644 --- a/app/tasks/vars.php +++ b/app/tasks/vars.php @@ -10,9 +10,17 @@ $cli ->task('vars') ->desc('List all the server environment variables') ->action(function () { - $variables = Config::getParam('variables', []); + $config = Config::getParam('variables', []); + $vars = []; - foreach ($variables as $key => $value) { + + foreach($config as $category) { + foreach($category['variables'] ?? [] as $var) { + $vars[] = $var; + } + } + + foreach ($vars as $key => $value) { Console::log('- '.$value['name'].'='.App::getEnv($value['name'], '')); } }); \ No newline at end of file From 939a30a4be2b5e8d9b62599a3d2ef6069a57d08d Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Thu, 7 Jan 2021 22:53:00 +0200 Subject: [PATCH 115/230] Spacing --- app/tasks/vars.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/tasks/vars.php b/app/tasks/vars.php index 58b21a18ec..6c02348222 100644 --- a/app/tasks/vars.php +++ b/app/tasks/vars.php @@ -13,7 +13,6 @@ $cli $config = Config::getParam('variables', []); $vars = []; - foreach($config as $category) { foreach($category['variables'] ?? [] as $var) { $vars[] = $var; From afc43feb7fc527b69d3f2cb069a016ea30ad8955 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Thu, 7 Jan 2021 23:48:32 +0200 Subject: [PATCH 116/230] Updated docs --- app/config/variables.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/config/variables.php b/app/config/variables.php index 59de920221..78e684c313 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -97,7 +97,7 @@ return [ ], [ 'category' => 'Redis', - 'description' => '', + 'description' => 'Appwrite uses a Redis server for managing cache, queues and scheduled tasks. The Redis env vars are used to allow Appwrite server to connect to the Redis container.', 'variables' => [ [ 'name' => '_APP_REDIS_HOST', @@ -119,7 +119,7 @@ return [ ], [ 'category' => 'MariaDB', - 'description' => '', + 'description' => 'Appwrite is using a MariaDB server for managing persistent database data. The MariaDB env vars are used to allow Appwrite server to connect to the MariaDB container.', 'variables' => [ [ 'name' => '_APP_DB_HOST', @@ -165,7 +165,7 @@ return [ ], [ 'category' => 'InfluxDB', - 'description' => '', + 'description' => 'Appwrite uses an InfluxDB server for managing time-series data and server stats. The InfluxDB env vars are used to allow Appwrite server to connect to the InfluxDB container.', 'variables' => [ [ 'name' => '_APP_INFLUXDB_HOST', @@ -187,7 +187,7 @@ return [ ], [ 'category' => 'StatsD', - 'description' => '', + 'description' => 'Appwrite uses a StatsD server for aggregating and sending stats data over a fast UDP connection. The StatsD env vars are used to allow Appwrite server to connect to the StatsD container.', 'variables' => [ [ 'name' => '_APP_STATSD_HOST', @@ -209,7 +209,7 @@ return [ ], [ 'category' => 'SMTP', - 'description' => '', + 'description' => "Appwrite is using an SMTP server for emailing your projects users and server admins. The SMTP env vars are used to allow Appwrite server to connect to the SMTP container.\n\nIf running in production, it might be easier to use a 3rd party SMTP server as it might be a little more difficult to set up a production SMTP server that will not send all your emails into your user's SPAM folder.", 'variables' => [ [ 'name' => '_APP_SMTP_HOST', From 47ba914d92dfa9160509bc2eb0b153d536ca7d8b Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Fri, 8 Jan 2021 00:33:44 +0200 Subject: [PATCH 117/230] Updated docs --- app/config/variables.php | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/app/config/variables.php b/app/config/variables.php index 78e684c313..d7c180ea11 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -335,13 +335,19 @@ return [ 'required' => false, 'question' => '', ], - [ - 'name' => '_APP_MAINTENANCE_INTERVAL', - 'description' => 'Interval value containing the number of seconds that the Appwrite maintenance process should wait before executing system cleanups and optimizations. The default value is 86400 seconds (1 day).', - 'introduction' => '0.7.0', - 'default' => '86400', - 'required' => false, - 'question' => '', + ], + [ + 'category' => 'Maintenance', + 'description' => '', + 'variables' => [ + [ + 'name' => '_APP_MAINTENANCE_INTERVAL', + 'description' => 'Interval value containing the number of seconds that the Appwrite maintenance process should wait before executing system cleanups and optimizations. The default value is 86400 seconds (1 day).', + 'introduction' => '0.7.0', + 'default' => '86400', + 'required' => false, + 'question' => '', + ], ], ], ], From 43d6a88b18718c29d19023d4378bdc9eb91733cc Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Fri, 8 Jan 2021 17:00:30 +0200 Subject: [PATCH 118/230] Updated SDK warning --- app/tasks/sdks.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/tasks/sdks.php b/app/tasks/sdks.php index c742acc227..354620308a 100644 --- a/app/tasks/sdks.php +++ b/app/tasks/sdks.php @@ -39,7 +39,6 @@ $cli $git = (Console::confirm('Should we use git push? (yes/no)') == 'yes'); $production = ($git) ? (Console::confirm('Type "Appwrite" to push code to production git repos') == 'Appwrite') : false; $message = ($git) ? Console::confirm('Please enter your commit message:') : ''; - $warning = '**This SDK is compatible with Appwrite server version ' . $version . '. For older versions, please check previous releases.**'; if(!in_array($version, ['0.6.2', '0.7.0'])) { throw new Exception('Unknown version given'); @@ -69,9 +68,9 @@ $cli $examples = ($examples) ? \file_get_contents($examples) : ''; $changelog = \realpath(__DIR__ . '/../../docs/sdks/'.$language['key'].'/CHANGELOG.md'); $changelog = ($changelog) ? \file_get_contents($changelog) : '# Change Log'; - $warning = ($language['beta']) ? '**This SDK is compatible with Appwrite server version ' . $version . '. For older versions, please check previous releases.**' : ''; + $warning = '**This SDK is compatible with Appwrite server version ' . $version . '. For older versions, please check [previous releases]('.$language['url'].'/releases).**'; $license = 'BSD-3-Clause'; - $licenseContent = 'Copyright (c) 2019 Appwrite (https://appwrite.io) and individual contributors. + $licenseContent = 'Copyright (c) ' . date('Y') . ' Appwrite (https://appwrite.io) and individual contributors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: From b070db78df1cc43f82014a26cf3435119679900f Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Fri, 8 Jan 2021 17:00:37 +0200 Subject: [PATCH 119/230] Updated deno docs --- docs/examples/0.6.2/server-deno/examples/avatars/get-browser.md | 1 + .../0.6.2/server-deno/examples/avatars/get-credit-card.md | 1 + docs/examples/0.6.2/server-deno/examples/avatars/get-favicon.md | 1 + docs/examples/0.6.2/server-deno/examples/avatars/get-flag.md | 1 + docs/examples/0.6.2/server-deno/examples/avatars/get-image.md | 1 + docs/examples/0.6.2/server-deno/examples/avatars/get-initials.md | 1 + docs/examples/0.6.2/server-deno/examples/avatars/get-q-r.md | 1 + .../0.6.2/server-deno/examples/database/create-collection.md | 1 + .../0.6.2/server-deno/examples/database/create-document.md | 1 + .../0.6.2/server-deno/examples/database/delete-collection.md | 1 + .../0.6.2/server-deno/examples/database/delete-document.md | 1 + .../0.6.2/server-deno/examples/database/get-collection.md | 1 + .../examples/0.6.2/server-deno/examples/database/get-document.md | 1 + .../0.6.2/server-deno/examples/database/list-collections.md | 1 + .../0.6.2/server-deno/examples/database/list-documents.md | 1 + .../0.6.2/server-deno/examples/database/update-collection.md | 1 + .../0.6.2/server-deno/examples/database/update-document.md | 1 + .../examples/0.6.2/server-deno/examples/health/get-anti-virus.md | 1 + docs/examples/0.6.2/server-deno/examples/health/get-cache.md | 1 + docs/examples/0.6.2/server-deno/examples/health/get-d-b.md | 1 + .../0.6.2/server-deno/examples/health/get-queue-certificates.md | 1 + .../0.6.2/server-deno/examples/health/get-queue-functions.md | 1 + .../examples/0.6.2/server-deno/examples/health/get-queue-logs.md | 1 + .../0.6.2/server-deno/examples/health/get-queue-tasks.md | 1 + .../0.6.2/server-deno/examples/health/get-queue-usage.md | 1 + .../0.6.2/server-deno/examples/health/get-queue-webhooks.md | 1 + .../0.6.2/server-deno/examples/health/get-storage-local.md | 1 + docs/examples/0.6.2/server-deno/examples/health/get-time.md | 1 + docs/examples/0.6.2/server-deno/examples/health/get.md | 1 + .../examples/0.6.2/server-deno/examples/locale/get-continents.md | 1 + .../0.6.2/server-deno/examples/locale/get-countries-e-u.md | 1 + .../0.6.2/server-deno/examples/locale/get-countries-phones.md | 1 + docs/examples/0.6.2/server-deno/examples/locale/get-countries.md | 1 + .../examples/0.6.2/server-deno/examples/locale/get-currencies.md | 1 + docs/examples/0.6.2/server-deno/examples/locale/get-languages.md | 1 + docs/examples/0.6.2/server-deno/examples/locale/get.md | 1 + docs/examples/0.6.2/server-deno/examples/storage/create-file.md | 1 + docs/examples/0.6.2/server-deno/examples/storage/delete-file.md | 1 + .../0.6.2/server-deno/examples/storage/get-file-download.md | 1 + .../0.6.2/server-deno/examples/storage/get-file-preview.md | 1 + .../examples/0.6.2/server-deno/examples/storage/get-file-view.md | 1 + docs/examples/0.6.2/server-deno/examples/storage/get-file.md | 1 + docs/examples/0.6.2/server-deno/examples/storage/list-files.md | 1 + docs/examples/0.6.2/server-deno/examples/storage/update-file.md | 1 + .../0.6.2/server-deno/examples/teams/create-membership.md | 1 + docs/examples/0.6.2/server-deno/examples/teams/create.md | 1 + .../0.6.2/server-deno/examples/teams/delete-membership.md | 1 + docs/examples/0.6.2/server-deno/examples/teams/delete.md | 1 + .../examples/0.6.2/server-deno/examples/teams/get-memberships.md | 1 + docs/examples/0.6.2/server-deno/examples/teams/get.md | 1 + docs/examples/0.6.2/server-deno/examples/teams/list.md | 1 + docs/examples/0.6.2/server-deno/examples/teams/update.md | 1 + docs/examples/0.6.2/server-deno/examples/users/create.md | 1 + docs/examples/0.6.2/server-deno/examples/users/delete-session.md | 1 + .../examples/0.6.2/server-deno/examples/users/delete-sessions.md | 1 + docs/examples/0.6.2/server-deno/examples/users/get-logs.md | 1 + docs/examples/0.6.2/server-deno/examples/users/get-prefs.md | 1 + docs/examples/0.6.2/server-deno/examples/users/get-sessions.md | 1 + docs/examples/0.6.2/server-deno/examples/users/get.md | 1 + docs/examples/0.6.2/server-deno/examples/users/list.md | 1 + docs/examples/0.6.2/server-deno/examples/users/update-prefs.md | 1 + docs/examples/0.6.2/server-deno/examples/users/update-status.md | 1 + 62 files changed, 62 insertions(+) diff --git a/docs/examples/0.6.2/server-deno/examples/avatars/get-browser.md b/docs/examples/0.6.2/server-deno/examples/avatars/get-browser.md index 27c0336054..3eb6ff845d 100644 --- a/docs/examples/0.6.2/server-deno/examples/avatars/get-browser.md +++ b/docs/examples/0.6.2/server-deno/examples/avatars/get-browser.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let avatars = new sdk.Avatars(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/avatars/get-credit-card.md b/docs/examples/0.6.2/server-deno/examples/avatars/get-credit-card.md index 998356a106..0a75b1665d 100644 --- a/docs/examples/0.6.2/server-deno/examples/avatars/get-credit-card.md +++ b/docs/examples/0.6.2/server-deno/examples/avatars/get-credit-card.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let avatars = new sdk.Avatars(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/avatars/get-favicon.md b/docs/examples/0.6.2/server-deno/examples/avatars/get-favicon.md index 43afe096c4..e132db2f5f 100644 --- a/docs/examples/0.6.2/server-deno/examples/avatars/get-favicon.md +++ b/docs/examples/0.6.2/server-deno/examples/avatars/get-favicon.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let avatars = new sdk.Avatars(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/avatars/get-flag.md b/docs/examples/0.6.2/server-deno/examples/avatars/get-flag.md index 6b28e5db2f..7455538cec 100644 --- a/docs/examples/0.6.2/server-deno/examples/avatars/get-flag.md +++ b/docs/examples/0.6.2/server-deno/examples/avatars/get-flag.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let avatars = new sdk.Avatars(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/avatars/get-image.md b/docs/examples/0.6.2/server-deno/examples/avatars/get-image.md index 0a2693c768..e1d6f7d5f5 100644 --- a/docs/examples/0.6.2/server-deno/examples/avatars/get-image.md +++ b/docs/examples/0.6.2/server-deno/examples/avatars/get-image.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let avatars = new sdk.Avatars(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/avatars/get-initials.md b/docs/examples/0.6.2/server-deno/examples/avatars/get-initials.md index af35445bb3..36e9b8fa94 100644 --- a/docs/examples/0.6.2/server-deno/examples/avatars/get-initials.md +++ b/docs/examples/0.6.2/server-deno/examples/avatars/get-initials.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let avatars = new sdk.Avatars(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/avatars/get-q-r.md b/docs/examples/0.6.2/server-deno/examples/avatars/get-q-r.md index 6d8446b105..23d6a60d90 100644 --- a/docs/examples/0.6.2/server-deno/examples/avatars/get-q-r.md +++ b/docs/examples/0.6.2/server-deno/examples/avatars/get-q-r.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let avatars = new sdk.Avatars(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/database/create-collection.md b/docs/examples/0.6.2/server-deno/examples/database/create-collection.md index 316ae6b222..776830943b 100644 --- a/docs/examples/0.6.2/server-deno/examples/database/create-collection.md +++ b/docs/examples/0.6.2/server-deno/examples/database/create-collection.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let database = new sdk.Database(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/database/create-document.md b/docs/examples/0.6.2/server-deno/examples/database/create-document.md index ef78a839a4..7a60b55403 100644 --- a/docs/examples/0.6.2/server-deno/examples/database/create-document.md +++ b/docs/examples/0.6.2/server-deno/examples/database/create-document.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let database = new sdk.Database(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/database/delete-collection.md b/docs/examples/0.6.2/server-deno/examples/database/delete-collection.md index e9b5d6392b..d62c8d0974 100644 --- a/docs/examples/0.6.2/server-deno/examples/database/delete-collection.md +++ b/docs/examples/0.6.2/server-deno/examples/database/delete-collection.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let database = new sdk.Database(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/database/delete-document.md b/docs/examples/0.6.2/server-deno/examples/database/delete-document.md index b7d3f52c71..558a4bbe67 100644 --- a/docs/examples/0.6.2/server-deno/examples/database/delete-document.md +++ b/docs/examples/0.6.2/server-deno/examples/database/delete-document.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let database = new sdk.Database(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/database/get-collection.md b/docs/examples/0.6.2/server-deno/examples/database/get-collection.md index 323bc7ec74..0ca917a3c3 100644 --- a/docs/examples/0.6.2/server-deno/examples/database/get-collection.md +++ b/docs/examples/0.6.2/server-deno/examples/database/get-collection.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let database = new sdk.Database(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/database/get-document.md b/docs/examples/0.6.2/server-deno/examples/database/get-document.md index 7a0332251a..59ec5e4141 100644 --- a/docs/examples/0.6.2/server-deno/examples/database/get-document.md +++ b/docs/examples/0.6.2/server-deno/examples/database/get-document.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let database = new sdk.Database(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/database/list-collections.md b/docs/examples/0.6.2/server-deno/examples/database/list-collections.md index 292e46f860..0bb6bf1679 100644 --- a/docs/examples/0.6.2/server-deno/examples/database/list-collections.md +++ b/docs/examples/0.6.2/server-deno/examples/database/list-collections.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let database = new sdk.Database(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/database/list-documents.md b/docs/examples/0.6.2/server-deno/examples/database/list-documents.md index bb22a3956a..ead202aaa9 100644 --- a/docs/examples/0.6.2/server-deno/examples/database/list-documents.md +++ b/docs/examples/0.6.2/server-deno/examples/database/list-documents.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let database = new sdk.Database(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/database/update-collection.md b/docs/examples/0.6.2/server-deno/examples/database/update-collection.md index 8239e45f28..31e34acf13 100644 --- a/docs/examples/0.6.2/server-deno/examples/database/update-collection.md +++ b/docs/examples/0.6.2/server-deno/examples/database/update-collection.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let database = new sdk.Database(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/database/update-document.md b/docs/examples/0.6.2/server-deno/examples/database/update-document.md index cd079c8f2d..e6ffd49f00 100644 --- a/docs/examples/0.6.2/server-deno/examples/database/update-document.md +++ b/docs/examples/0.6.2/server-deno/examples/database/update-document.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let database = new sdk.Database(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/health/get-anti-virus.md b/docs/examples/0.6.2/server-deno/examples/health/get-anti-virus.md index e06fbf86de..ecfc1fa2fa 100644 --- a/docs/examples/0.6.2/server-deno/examples/health/get-anti-virus.md +++ b/docs/examples/0.6.2/server-deno/examples/health/get-anti-virus.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let health = new sdk.Health(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/health/get-cache.md b/docs/examples/0.6.2/server-deno/examples/health/get-cache.md index b58ca1bc15..f3e17bda8e 100644 --- a/docs/examples/0.6.2/server-deno/examples/health/get-cache.md +++ b/docs/examples/0.6.2/server-deno/examples/health/get-cache.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let health = new sdk.Health(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/health/get-d-b.md b/docs/examples/0.6.2/server-deno/examples/health/get-d-b.md index 946cfb03a8..f6ba94a496 100644 --- a/docs/examples/0.6.2/server-deno/examples/health/get-d-b.md +++ b/docs/examples/0.6.2/server-deno/examples/health/get-d-b.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let health = new sdk.Health(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/health/get-queue-certificates.md b/docs/examples/0.6.2/server-deno/examples/health/get-queue-certificates.md index a86358bb22..9d2e325630 100644 --- a/docs/examples/0.6.2/server-deno/examples/health/get-queue-certificates.md +++ b/docs/examples/0.6.2/server-deno/examples/health/get-queue-certificates.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let health = new sdk.Health(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/health/get-queue-functions.md b/docs/examples/0.6.2/server-deno/examples/health/get-queue-functions.md index 033248b118..c31869c55f 100644 --- a/docs/examples/0.6.2/server-deno/examples/health/get-queue-functions.md +++ b/docs/examples/0.6.2/server-deno/examples/health/get-queue-functions.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let health = new sdk.Health(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/health/get-queue-logs.md b/docs/examples/0.6.2/server-deno/examples/health/get-queue-logs.md index d4c3300a35..bb40c7a559 100644 --- a/docs/examples/0.6.2/server-deno/examples/health/get-queue-logs.md +++ b/docs/examples/0.6.2/server-deno/examples/health/get-queue-logs.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let health = new sdk.Health(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/health/get-queue-tasks.md b/docs/examples/0.6.2/server-deno/examples/health/get-queue-tasks.md index 01e3094ffc..45f69a8ab2 100644 --- a/docs/examples/0.6.2/server-deno/examples/health/get-queue-tasks.md +++ b/docs/examples/0.6.2/server-deno/examples/health/get-queue-tasks.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let health = new sdk.Health(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/health/get-queue-usage.md b/docs/examples/0.6.2/server-deno/examples/health/get-queue-usage.md index d0d8faf7b6..0a0a001ceb 100644 --- a/docs/examples/0.6.2/server-deno/examples/health/get-queue-usage.md +++ b/docs/examples/0.6.2/server-deno/examples/health/get-queue-usage.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let health = new sdk.Health(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/health/get-queue-webhooks.md b/docs/examples/0.6.2/server-deno/examples/health/get-queue-webhooks.md index 268c521373..ddd2735f49 100644 --- a/docs/examples/0.6.2/server-deno/examples/health/get-queue-webhooks.md +++ b/docs/examples/0.6.2/server-deno/examples/health/get-queue-webhooks.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let health = new sdk.Health(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/health/get-storage-local.md b/docs/examples/0.6.2/server-deno/examples/health/get-storage-local.md index 77bb658f9a..76df5561d7 100644 --- a/docs/examples/0.6.2/server-deno/examples/health/get-storage-local.md +++ b/docs/examples/0.6.2/server-deno/examples/health/get-storage-local.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let health = new sdk.Health(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/health/get-time.md b/docs/examples/0.6.2/server-deno/examples/health/get-time.md index 0e5205b075..17de3193cf 100644 --- a/docs/examples/0.6.2/server-deno/examples/health/get-time.md +++ b/docs/examples/0.6.2/server-deno/examples/health/get-time.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let health = new sdk.Health(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/health/get.md b/docs/examples/0.6.2/server-deno/examples/health/get.md index c2e6ecdf65..ac94e75627 100644 --- a/docs/examples/0.6.2/server-deno/examples/health/get.md +++ b/docs/examples/0.6.2/server-deno/examples/health/get.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let health = new sdk.Health(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/locale/get-continents.md b/docs/examples/0.6.2/server-deno/examples/locale/get-continents.md index 18221d44b4..44c18b54f4 100644 --- a/docs/examples/0.6.2/server-deno/examples/locale/get-continents.md +++ b/docs/examples/0.6.2/server-deno/examples/locale/get-continents.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let locale = new sdk.Locale(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/locale/get-countries-e-u.md b/docs/examples/0.6.2/server-deno/examples/locale/get-countries-e-u.md index 4a3e49f755..f14e4353ff 100644 --- a/docs/examples/0.6.2/server-deno/examples/locale/get-countries-e-u.md +++ b/docs/examples/0.6.2/server-deno/examples/locale/get-countries-e-u.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let locale = new sdk.Locale(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/locale/get-countries-phones.md b/docs/examples/0.6.2/server-deno/examples/locale/get-countries-phones.md index 61a1790806..b23eff3dac 100644 --- a/docs/examples/0.6.2/server-deno/examples/locale/get-countries-phones.md +++ b/docs/examples/0.6.2/server-deno/examples/locale/get-countries-phones.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let locale = new sdk.Locale(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/locale/get-countries.md b/docs/examples/0.6.2/server-deno/examples/locale/get-countries.md index 20f544e617..2f3facd7e8 100644 --- a/docs/examples/0.6.2/server-deno/examples/locale/get-countries.md +++ b/docs/examples/0.6.2/server-deno/examples/locale/get-countries.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let locale = new sdk.Locale(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/locale/get-currencies.md b/docs/examples/0.6.2/server-deno/examples/locale/get-currencies.md index 13b975291d..34d4e233ee 100644 --- a/docs/examples/0.6.2/server-deno/examples/locale/get-currencies.md +++ b/docs/examples/0.6.2/server-deno/examples/locale/get-currencies.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let locale = new sdk.Locale(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/locale/get-languages.md b/docs/examples/0.6.2/server-deno/examples/locale/get-languages.md index 95c5c6b355..3fd5d8b8c2 100644 --- a/docs/examples/0.6.2/server-deno/examples/locale/get-languages.md +++ b/docs/examples/0.6.2/server-deno/examples/locale/get-languages.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let locale = new sdk.Locale(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/locale/get.md b/docs/examples/0.6.2/server-deno/examples/locale/get.md index 2336c3289d..30ca9a22c7 100644 --- a/docs/examples/0.6.2/server-deno/examples/locale/get.md +++ b/docs/examples/0.6.2/server-deno/examples/locale/get.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let locale = new sdk.Locale(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/storage/create-file.md b/docs/examples/0.6.2/server-deno/examples/storage/create-file.md index 5b446e1a38..ebbc065fef 100644 --- a/docs/examples/0.6.2/server-deno/examples/storage/create-file.md +++ b/docs/examples/0.6.2/server-deno/examples/storage/create-file.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let storage = new sdk.Storage(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/storage/delete-file.md b/docs/examples/0.6.2/server-deno/examples/storage/delete-file.md index 6469308c74..2826b4cecb 100644 --- a/docs/examples/0.6.2/server-deno/examples/storage/delete-file.md +++ b/docs/examples/0.6.2/server-deno/examples/storage/delete-file.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let storage = new sdk.Storage(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/storage/get-file-download.md b/docs/examples/0.6.2/server-deno/examples/storage/get-file-download.md index 4510257bad..0df365854d 100644 --- a/docs/examples/0.6.2/server-deno/examples/storage/get-file-download.md +++ b/docs/examples/0.6.2/server-deno/examples/storage/get-file-download.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let storage = new sdk.Storage(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/storage/get-file-preview.md b/docs/examples/0.6.2/server-deno/examples/storage/get-file-preview.md index 282fb30324..886b2d566d 100644 --- a/docs/examples/0.6.2/server-deno/examples/storage/get-file-preview.md +++ b/docs/examples/0.6.2/server-deno/examples/storage/get-file-preview.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let storage = new sdk.Storage(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/storage/get-file-view.md b/docs/examples/0.6.2/server-deno/examples/storage/get-file-view.md index 8af5391017..ce6e6b4eff 100644 --- a/docs/examples/0.6.2/server-deno/examples/storage/get-file-view.md +++ b/docs/examples/0.6.2/server-deno/examples/storage/get-file-view.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let storage = new sdk.Storage(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/storage/get-file.md b/docs/examples/0.6.2/server-deno/examples/storage/get-file.md index 393ce229cb..109dac8c5d 100644 --- a/docs/examples/0.6.2/server-deno/examples/storage/get-file.md +++ b/docs/examples/0.6.2/server-deno/examples/storage/get-file.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let storage = new sdk.Storage(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/storage/list-files.md b/docs/examples/0.6.2/server-deno/examples/storage/list-files.md index 0e57cd01de..5d34518e5a 100644 --- a/docs/examples/0.6.2/server-deno/examples/storage/list-files.md +++ b/docs/examples/0.6.2/server-deno/examples/storage/list-files.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let storage = new sdk.Storage(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/storage/update-file.md b/docs/examples/0.6.2/server-deno/examples/storage/update-file.md index 33b2263540..78ee82d38f 100644 --- a/docs/examples/0.6.2/server-deno/examples/storage/update-file.md +++ b/docs/examples/0.6.2/server-deno/examples/storage/update-file.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let storage = new sdk.Storage(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/teams/create-membership.md b/docs/examples/0.6.2/server-deno/examples/teams/create-membership.md index b277899c91..b85e811d65 100644 --- a/docs/examples/0.6.2/server-deno/examples/teams/create-membership.md +++ b/docs/examples/0.6.2/server-deno/examples/teams/create-membership.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let teams = new sdk.Teams(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/teams/create.md b/docs/examples/0.6.2/server-deno/examples/teams/create.md index 1ef3e01b81..055cd9fe9f 100644 --- a/docs/examples/0.6.2/server-deno/examples/teams/create.md +++ b/docs/examples/0.6.2/server-deno/examples/teams/create.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let teams = new sdk.Teams(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/teams/delete-membership.md b/docs/examples/0.6.2/server-deno/examples/teams/delete-membership.md index 911fa30075..f49841a4ad 100644 --- a/docs/examples/0.6.2/server-deno/examples/teams/delete-membership.md +++ b/docs/examples/0.6.2/server-deno/examples/teams/delete-membership.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let teams = new sdk.Teams(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/teams/delete.md b/docs/examples/0.6.2/server-deno/examples/teams/delete.md index 61ac03483f..4b1e0bddfc 100644 --- a/docs/examples/0.6.2/server-deno/examples/teams/delete.md +++ b/docs/examples/0.6.2/server-deno/examples/teams/delete.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let teams = new sdk.Teams(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/teams/get-memberships.md b/docs/examples/0.6.2/server-deno/examples/teams/get-memberships.md index b652f8e4e5..467101c956 100644 --- a/docs/examples/0.6.2/server-deno/examples/teams/get-memberships.md +++ b/docs/examples/0.6.2/server-deno/examples/teams/get-memberships.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let teams = new sdk.Teams(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/teams/get.md b/docs/examples/0.6.2/server-deno/examples/teams/get.md index 69496e3eef..435391a63a 100644 --- a/docs/examples/0.6.2/server-deno/examples/teams/get.md +++ b/docs/examples/0.6.2/server-deno/examples/teams/get.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let teams = new sdk.Teams(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/teams/list.md b/docs/examples/0.6.2/server-deno/examples/teams/list.md index 70851dda51..6d00f6df54 100644 --- a/docs/examples/0.6.2/server-deno/examples/teams/list.md +++ b/docs/examples/0.6.2/server-deno/examples/teams/list.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let teams = new sdk.Teams(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/teams/update.md b/docs/examples/0.6.2/server-deno/examples/teams/update.md index 7b815b4050..9d73002f5c 100644 --- a/docs/examples/0.6.2/server-deno/examples/teams/update.md +++ b/docs/examples/0.6.2/server-deno/examples/teams/update.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let teams = new sdk.Teams(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/users/create.md b/docs/examples/0.6.2/server-deno/examples/users/create.md index 593eee6e9f..9b5f914631 100644 --- a/docs/examples/0.6.2/server-deno/examples/users/create.md +++ b/docs/examples/0.6.2/server-deno/examples/users/create.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let users = new sdk.Users(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/users/delete-session.md b/docs/examples/0.6.2/server-deno/examples/users/delete-session.md index e4940773e4..e04024e5a2 100644 --- a/docs/examples/0.6.2/server-deno/examples/users/delete-session.md +++ b/docs/examples/0.6.2/server-deno/examples/users/delete-session.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let users = new sdk.Users(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/users/delete-sessions.md b/docs/examples/0.6.2/server-deno/examples/users/delete-sessions.md index e772c00a5f..89dec44e39 100644 --- a/docs/examples/0.6.2/server-deno/examples/users/delete-sessions.md +++ b/docs/examples/0.6.2/server-deno/examples/users/delete-sessions.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let users = new sdk.Users(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/users/get-logs.md b/docs/examples/0.6.2/server-deno/examples/users/get-logs.md index 58cc4fc529..5770e84525 100644 --- a/docs/examples/0.6.2/server-deno/examples/users/get-logs.md +++ b/docs/examples/0.6.2/server-deno/examples/users/get-logs.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let users = new sdk.Users(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/users/get-prefs.md b/docs/examples/0.6.2/server-deno/examples/users/get-prefs.md index 4cda0bb73e..033c56f3db 100644 --- a/docs/examples/0.6.2/server-deno/examples/users/get-prefs.md +++ b/docs/examples/0.6.2/server-deno/examples/users/get-prefs.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let users = new sdk.Users(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/users/get-sessions.md b/docs/examples/0.6.2/server-deno/examples/users/get-sessions.md index 6686e21564..15f0b53c5c 100644 --- a/docs/examples/0.6.2/server-deno/examples/users/get-sessions.md +++ b/docs/examples/0.6.2/server-deno/examples/users/get-sessions.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let users = new sdk.Users(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/users/get.md b/docs/examples/0.6.2/server-deno/examples/users/get.md index dce73d62c5..acee263e2f 100644 --- a/docs/examples/0.6.2/server-deno/examples/users/get.md +++ b/docs/examples/0.6.2/server-deno/examples/users/get.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let users = new sdk.Users(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/users/list.md b/docs/examples/0.6.2/server-deno/examples/users/list.md index b089c3e7e9..c986039946 100644 --- a/docs/examples/0.6.2/server-deno/examples/users/list.md +++ b/docs/examples/0.6.2/server-deno/examples/users/list.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let users = new sdk.Users(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/users/update-prefs.md b/docs/examples/0.6.2/server-deno/examples/users/update-prefs.md index b06185ee91..4e88ed567a 100644 --- a/docs/examples/0.6.2/server-deno/examples/users/update-prefs.md +++ b/docs/examples/0.6.2/server-deno/examples/users/update-prefs.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let users = new sdk.Users(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/0.6.2/server-deno/examples/users/update-status.md b/docs/examples/0.6.2/server-deno/examples/users/update-status.md index a0f028bde5..dd3a309dc7 100644 --- a/docs/examples/0.6.2/server-deno/examples/users/update-status.md +++ b/docs/examples/0.6.2/server-deno/examples/users/update-status.md @@ -6,6 +6,7 @@ let client = new sdk.Client(); let users = new sdk.Users(client); client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; From cb13cbe389ddb33413836d036cb14240c259c26c Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sat, 9 Jan 2021 08:04:39 +0200 Subject: [PATCH 120/230] Updated .NET version, added dev flag --- app/config/platforms.php | 18 ++++++++- composer.json | 2 +- composer.lock | 80 ++++++++++++++++++++-------------------- 3 files changed, 58 insertions(+), 42 deletions(-) diff --git a/app/config/platforms.php b/app/config/platforms.php index ffc51b89ed..36ce0bb226 100644 --- a/app/config/platforms.php +++ b/app/config/platforms.php @@ -20,6 +20,7 @@ return [ 'package' => 'https://www.npmjs.com/package/appwrite', 'enabled' => true, 'beta' => false, + 'dev' => false, 'family' => APP_PLATFORM_CLIENT, 'prism' => 'javascript', 'source' => \realpath(__DIR__ . '/../sdks/client-web'), @@ -35,6 +36,7 @@ return [ 'package' => 'https://pub.dev/packages/appwrite', 'enabled' => true, 'beta' => true, + 'dev' => false, 'family' => APP_PLATFORM_CLIENT, 'prism' => 'dart', 'source' => \realpath(__DIR__ . '/../sdks/client-flutter'), @@ -49,6 +51,7 @@ return [ 'package' => '', 'enabled' => false, 'beta' => false, + 'dev' => false, 'family' => APP_PLATFORM_CLIENT, 'prism' => 'swift', 'source' => false, @@ -63,6 +66,7 @@ return [ 'package' => '', 'enabled' => false, 'beta' => false, + 'dev' => false, 'family' => APP_PLATFORM_CLIENT, 'prism' => '', 'source' => false, @@ -77,6 +81,7 @@ return [ 'package' => '', 'enabled' => false, 'beta' => false, + 'dev' => false, 'family' => APP_PLATFORM_CLIENT, 'prism' => 'kotlin', 'source' => false, @@ -91,6 +96,7 @@ return [ // 'enabled' => false, // 'dev' => false, // 'beta' => false, + // 'dev' => false, // 'family' => APP_PLATFORM_CLIENT, // 'prism' => 'java', // 'source' => false, @@ -115,6 +121,7 @@ return [ 'package' => '', 'enabled' => true, 'beta' => false, + 'dev' => false, 'family' => APP_PLATFORM_CONSOLE, 'prism' => 'console', 'source' => \realpath(__DIR__ . '/../sdks/console-web'), @@ -140,6 +147,7 @@ return [ 'package' => 'https://www.npmjs.com/package/node-appwrite', 'enabled' => true, 'beta' => false, + 'dev' => false, 'family' => APP_PLATFORM_SERVER, 'prism' => 'javascript', 'source' => \realpath(__DIR__ . '/../sdks/server-nodejs'), @@ -155,6 +163,7 @@ return [ 'package' => 'https://deno.land/x/appwrite', 'enabled' => true, 'beta' => true, + 'dev' => false, 'family' => APP_PLATFORM_SERVER, 'prism' => 'typescript', 'source' => \realpath(__DIR__ . '/../sdks/server-deno'), @@ -170,6 +179,7 @@ return [ 'package' => 'https://packagist.org/packages/appwrite/appwrite', 'enabled' => true, 'beta' => false, + 'dev' => false, 'family' => APP_PLATFORM_SERVER, 'prism' => 'php', 'source' => \realpath(__DIR__ . '/../sdks/server-php'), @@ -185,6 +195,7 @@ return [ 'package' => 'https://pypi.org/project/appwrite/', 'enabled' => true, 'beta' => true, + 'dev' => false, 'family' => APP_PLATFORM_SERVER, 'prism' => 'python', 'source' => \realpath(__DIR__ . '/../sdks/server-python'), @@ -200,6 +211,7 @@ return [ 'package' => 'https://rubygems.org/gems/appwrite', 'enabled' => true, 'beta' => true, + 'dev' => false, 'family' => APP_PLATFORM_SERVER, 'prism' => 'ruby', 'source' => \realpath(__DIR__ . '/../sdks/server-ruby'), @@ -215,6 +227,7 @@ return [ 'package' => '', 'enabled' => false, 'beta' => true, + 'dev' => false, 'family' => APP_PLATFORM_SERVER, 'prism' => 'go', 'source' => \realpath(__DIR__ . '/../sdks/server-go'), @@ -230,6 +243,7 @@ return [ 'package' => '', 'enabled' => false, 'beta' => true, + 'dev' => false, 'family' => APP_PLATFORM_SERVER, 'prism' => 'java', 'source' => \realpath(__DIR__ . '/../sdks/server-java'), @@ -240,11 +254,12 @@ return [ [ 'key' => 'dotnet', 'name' => '.NET', - 'version' => '0.0.1', + 'version' => '0.0.2', 'url' => 'https://github.com/appwrite/sdk-for-dotnet', 'package' => 'https://www.nuget.org/packages/Appwrite', 'enabled' => true, 'beta' => true, + 'dev' => true, 'family' => APP_PLATFORM_SERVER, 'prism' => 'csharp', 'source' => \realpath(__DIR__ . '/../sdks/server-dotnet'), @@ -260,6 +275,7 @@ return [ 'package' => '', 'enabled' => false, 'beta' => true, + 'dev' => false, 'family' => APP_PLATFORM_SERVER, 'prism' => 'java', 'source' => \realpath(__DIR__ . '/../sdks/server-dart'), diff --git a/composer.json b/composer.json index ee1e90a876..043007c735 100644 --- a/composer.json +++ b/composer.json @@ -56,7 +56,7 @@ }, "require-dev": { "swoole/ide-helper": "4.5.5", - "appwrite/sdk-generator": "0.4.2", + "appwrite/sdk-generator": "0.4.3", "phpunit/phpunit": "9.4.2", "vimeo/psalm": "4.1.1" }, diff --git a/composer.lock b/composer.lock index 9b68ad5f56..09483dbca6 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "0df79d7789fec84aa4500edad823f1f6", + "content-hash": "6594e4d32da0196d0bb2e5a1794ea89d", "packages": [ { "name": "appwrite/php-clamav", @@ -1862,11 +1862,11 @@ }, { "name": "appwrite/sdk-generator", - "version": "0.4.2", + "version": "0.4.3", "source": { "type": "git", "url": "https://github.com/appwrite/sdk-generator", - "reference": "5482f4cdb65ab90ffea752ba9a625187cd7c7784" + "reference": "630776cfe49412e72a70a3a69729054bf8302e1f" }, "require": { "ext-curl": "*", @@ -1896,7 +1896,7 @@ } ], "description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms", - "time": "2021-01-07T14:03:54+00:00" + "time": "2021-01-08T11:55:04+00:00" }, { "name": "composer/package-versions-deprecated", @@ -4615,12 +4615,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "7c0a3c5420fd802637c4260e595d6c674b23d578" + "reference": "c6c942b1ac76c82448322025e084cadc56048b4e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/7c0a3c5420fd802637c4260e595d6c674b23d578", - "reference": "7c0a3c5420fd802637c4260e595d6c674b23d578", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/c6c942b1ac76c82448322025e084cadc56048b4e", + "reference": "c6c942b1ac76c82448322025e084cadc56048b4e", "shasum": "" }, "require": { @@ -4633,7 +4633,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.21-dev" + "dev-main": "1.22-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4671,7 +4671,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/main" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.22.0" }, "funding": [ { @@ -4687,7 +4687,7 @@ "type": "tidelift" } ], - "time": "2021-01-06T10:19:43+00:00" + "time": "2021-01-07T16:49:33+00:00" }, { "name": "symfony/polyfill-intl-grapheme", @@ -4695,12 +4695,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "32b651134d58efe1786c95352d846913a42d8331" + "reference": "267a9adeb8ecb8071040a740930e077cdfb987af" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/32b651134d58efe1786c95352d846913a42d8331", - "reference": "32b651134d58efe1786c95352d846913a42d8331", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/267a9adeb8ecb8071040a740930e077cdfb987af", + "reference": "267a9adeb8ecb8071040a740930e077cdfb987af", "shasum": "" }, "require": { @@ -4713,7 +4713,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.21-dev" + "dev-main": "1.22-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4753,7 +4753,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/main" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.22.0" }, "funding": [ { @@ -4769,7 +4769,7 @@ "type": "tidelift" } ], - "time": "2021-01-06T10:19:43+00:00" + "time": "2021-01-07T16:49:33+00:00" }, { "name": "symfony/polyfill-intl-normalizer", @@ -4777,12 +4777,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "8592bf62da8352927fc3857484e84baacddec301" + "reference": "6e971c891537eb617a00bb07a43d182a6915faba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8592bf62da8352927fc3857484e84baacddec301", - "reference": "8592bf62da8352927fc3857484e84baacddec301", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/6e971c891537eb617a00bb07a43d182a6915faba", + "reference": "6e971c891537eb617a00bb07a43d182a6915faba", "shasum": "" }, "require": { @@ -4795,7 +4795,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.21-dev" + "dev-main": "1.22-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4838,7 +4838,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/main" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.22.0" }, "funding": [ { @@ -4854,7 +4854,7 @@ "type": "tidelift" } ], - "time": "2021-01-06T10:19:43+00:00" + "time": "2021-01-07T17:09:11+00:00" }, { "name": "symfony/polyfill-mbstring", @@ -4862,12 +4862,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "ec0101071dcbc6bdd5046da11df686f8515fa815" + "reference": "f377a3dd1fde44d37b9831d68dc8dea3ffd28e13" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/ec0101071dcbc6bdd5046da11df686f8515fa815", - "reference": "ec0101071dcbc6bdd5046da11df686f8515fa815", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/f377a3dd1fde44d37b9831d68dc8dea3ffd28e13", + "reference": "f377a3dd1fde44d37b9831d68dc8dea3ffd28e13", "shasum": "" }, "require": { @@ -4880,7 +4880,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.21-dev" + "dev-main": "1.22-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4919,7 +4919,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/main" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.22.0" }, "funding": [ { @@ -4935,7 +4935,7 @@ "type": "tidelift" } ], - "time": "2021-01-06T10:19:43+00:00" + "time": "2021-01-07T16:49:33+00:00" }, { "name": "symfony/polyfill-php73", @@ -4943,12 +4943,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "6d0e293e2b13580b866090a135900aea4adcb308" + "reference": "a678b42e92f86eca04b7fa4c0f6f19d097fb69e2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/6d0e293e2b13580b866090a135900aea4adcb308", - "reference": "6d0e293e2b13580b866090a135900aea4adcb308", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/a678b42e92f86eca04b7fa4c0f6f19d097fb69e2", + "reference": "a678b42e92f86eca04b7fa4c0f6f19d097fb69e2", "shasum": "" }, "require": { @@ -4958,7 +4958,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.21-dev" + "dev-main": "1.22-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4999,7 +4999,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/main" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.22.0" }, "funding": [ { @@ -5015,7 +5015,7 @@ "type": "tidelift" } ], - "time": "2021-01-06T10:19:43+00:00" + "time": "2021-01-07T16:49:33+00:00" }, { "name": "symfony/polyfill-php80", @@ -5023,12 +5023,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "69e5da91ad9c080f6ac1e010ddffefe71b14bd6e" + "reference": "dc3063ba22c2a1fd2f45ed856374d79114998f91" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/69e5da91ad9c080f6ac1e010ddffefe71b14bd6e", - "reference": "69e5da91ad9c080f6ac1e010ddffefe71b14bd6e", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/dc3063ba22c2a1fd2f45ed856374d79114998f91", + "reference": "dc3063ba22c2a1fd2f45ed856374d79114998f91", "shasum": "" }, "require": { @@ -5038,7 +5038,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.21-dev" + "dev-main": "1.22-dev" }, "thanks": { "name": "symfony/polyfill", @@ -5083,7 +5083,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/main" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.22.0" }, "funding": [ { @@ -5099,7 +5099,7 @@ "type": "tidelift" } ], - "time": "2021-01-06T10:19:43+00:00" + "time": "2021-01-07T16:49:33+00:00" }, { "name": "symfony/service-contracts", From 8394f917ff4146a9ac9cbd055146220e86be7401 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sat, 9 Jan 2021 08:17:11 +0200 Subject: [PATCH 121/230] Updated README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ea3ee938b9..d2906f8656 100644 --- a/README.md +++ b/README.md @@ -104,7 +104,7 @@ Getting started with Appwrite is as easy as creating a new project, choosing you * [**Teams**](https://appwrite.io/docs/client/teams) - Manage and group users in teams. Manage memberships, invites, and user roles within a team. * [**Database**](https://appwrite.io/docs/client/database) - Manage database collections and documents. Read, create, update, and delete documents and filter lists of documents collections using an advanced filter with graph-like capabilities. * [**Storage**](https://appwrite.io/docs/client/storage) - Manage storage files. Read, create, delete, and preview files. Manipulate the preview of your files to fit your app perfectly. All files are scanned by ClamAV and stored in a secure and encrypted way. -* [**Functions**](https://appwrite.io/docs/server/functions) - Customize your Appwrite server by executing your custom code in an isolate environment, you can trigger your code on any Appwrite system event, manually or using a CRON schedule. +* [**Functions**](https://appwrite.io/docs/server/functions) - Customize your Appwrite server by executing your custom code in a secure, isolated environment. You can trigger your code on any Appwrite system event, manually or using a CRON schedule. * [**Locale**](https://appwrite.io/docs/client/locale) - Track your user's location, and manage your app locale-based data. * [**Avatars**](https://appwrite.io/docs/client/avatars) - Manage your users' avatars, countries' flags, browser icons, credit card symbols, and generate QR codes. From 4a3fd105b54b4fc9b6573b8235989568ab085f5c Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sat, 9 Jan 2021 08:25:37 +0200 Subject: [PATCH 122/230] Added dev attribute --- app/config/platforms.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/config/platforms.php b/app/config/platforms.php index cfea0d6dcc..fc0fc0234e 100644 --- a/app/config/platforms.php +++ b/app/config/platforms.php @@ -258,6 +258,7 @@ return [ 'package' => '', 'enabled' => true, 'beta' => true, + 'dev' => true, 'family' => APP_PLATFORM_SERVER, 'prism' => 'dart', 'source' => \realpath(__DIR__ . '/../sdks/server-dart'), From 9c9ca6cc513b982092cad05321d3d0e852df5d3d Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Sat, 9 Jan 2021 12:29:55 +0530 Subject: [PATCH 123/230] feat: fixed issues in tests --- src/Appwrite/Utopia/Response/Filters/V06.php | 14 ++++++------- tests/unit/Utopia/Filters/V06Test.php | 22 ++++++++++---------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/Appwrite/Utopia/Response/Filters/V06.php b/src/Appwrite/Utopia/Response/Filters/V06.php index d6bd85ac8f..71080d1ddd 100644 --- a/src/Appwrite/Utopia/Response/Filters/V06.php +++ b/src/Appwrite/Utopia/Response/Filters/V06.php @@ -193,13 +193,13 @@ class V06 extends Filter { private function parseLocale(array $content) { - $content['ip'] = empty($content['ip']) ?? ''; - $content['countryCode'] = empty($content['countryCode']) ?? '--'; - $content['country'] = empty($content['country']) ?? Locale::getText('locale.country.unknown'); - $content['continent'] = empty($content['continent']) ?? Locale::getText('locale.country.unknown'); - $content['continentCode'] = empty($content['continentCode']) ?? '--'; - $content['eu'] = empty($content['eu']) ?? false; - $content['currency'] = empty($content['currency']) ?? null; + $content['ip'] = $content['ip'] ?? ''; + $content['countryCode'] = $content['countryCode'] ?? '--'; + $content['country'] = $content['country'] ?? Locale::getText('locale.country.unknown'); + $content['continent'] = $content['continent'] ?? Locale::getText('locale.country.unknown'); + $content['continentCode'] = $content['continentCode'] ?? '--'; + $content['eu'] = $content['eu'] ?? false; + $content['currency'] = $content['currency'] ?? null; return $content; } diff --git a/tests/unit/Utopia/Filters/V06Test.php b/tests/unit/Utopia/Filters/V06Test.php index 5f680fc547..59c688ea0d 100644 --- a/tests/unit/Utopia/Filters/V06Test.php +++ b/tests/unit/Utopia/Filters/V06Test.php @@ -234,19 +234,19 @@ class V06Test extends TestCase $this->assertEquals($parsedResponse['logs'][0]['model'], 'Nexus 5'); $this->assertEquals($parsedResponse['logs'][0]['time'], 1592981250); - $this->assertEquals($parsedResponse['sessions'][0]['OS']['name'], 'Mac'); - $this->assertEquals($parsedResponse['sessions'][0]['OS']['platform'], ''); - $this->assertEquals($parsedResponse['sessions'][0]['OS']['short_name'], 'Mac'); - $this->assertEquals($parsedResponse['sessions'][0]['OS']['version'], 'Mac'); + $this->assertEquals($parsedResponse['logs'][0]['OS']['name'], 'Mac'); + $this->assertEquals($parsedResponse['logs'][0]['OS']['platform'], ''); + $this->assertEquals($parsedResponse['logs'][0]['OS']['short_name'], 'Mac'); + $this->assertEquals($parsedResponse['logs'][0]['OS']['version'], 'Mac'); - $this->assertEquals($parsedResponse['sessions'][0]['client']['engine'], 'WebKit'); - $this->assertEquals($parsedResponse['sessions'][0]['client']['name'], 'Chrome Mobile iOS'); - $this->assertEquals($parsedResponse['sessions'][0]['client']['short_name'], 'CM'); - $this->assertEquals($parsedResponse['sessions'][0]['client']['type'], 'browser'); - $this->assertEquals($parsedResponse['sessions'][0]['client']['version'], '84.0'); + $this->assertEquals($parsedResponse['logs'][0]['client']['engine'], 'WebKit'); + $this->assertEquals($parsedResponse['logs'][0]['client']['name'], 'Chrome Mobile iOS'); + $this->assertEquals($parsedResponse['logs'][0]['client']['short_name'], 'CM'); + $this->assertEquals($parsedResponse['logs'][0]['client']['type'], 'browser'); + $this->assertEquals($parsedResponse['logs'][0]['client']['version'], '84.0'); - $this->assertEquals($parsedResponse['sessions'][0]['geo']['isoCode'], 'US'); - $this->assertEquals($parsedResponse['sessions'][0]['geo']['country'], 'United States'); + $this->assertEquals($parsedResponse['logs'][0]['geo']['isoCode'], 'US'); + $this->assertEquals($parsedResponse['logs'][0]['geo']['country'], 'United States'); } public function testParseTeam() From 9c421e2dfc64cc7c929f26e5a9193735e1b1c9c6 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sun, 10 Jan 2021 00:29:49 +0200 Subject: [PATCH 124/230] Minor fixes for composer warnings about autoloading --- app/controllers/general.php | 3 +-- src/Appwrite/Utopia/Response.php | 1 - src/Appwrite/Utopia/Response/Filters/V06.php | 2 +- tests/unit/Utopia/Filters/V06Test.php | 2 +- tests/unit/Utopia/ResponseTest.php | 2 +- 5 files changed, 4 insertions(+), 6 deletions(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index 55f196e266..5d29e0d43c 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -16,8 +16,7 @@ use Appwrite\Database\Validator\Authorization; use Appwrite\Network\Validator\Origin; use Appwrite\Storage\Device\Local; use Appwrite\Storage\Storage; -use Appwrite\Utopia\Response\Filter; -use Appwrite\Utopia\Response\Filter\V06; +use Appwrite\Utopia\Response\Filters\V06; use Utopia\CLI\Console; Config::setParam('domainVerification', false); diff --git a/src/Appwrite/Utopia/Response.php b/src/Appwrite/Utopia/Response.php index ce22df225e..fc168d122c 100644 --- a/src/Appwrite/Utopia/Response.php +++ b/src/Appwrite/Utopia/Response.php @@ -7,7 +7,6 @@ use Utopia\Swoole\Response as SwooleResponse; use Swoole\Http\Response as SwooleHTTPResponse; use Appwrite\Database\Document; use Appwrite\Utopia\Response\Filter; -use Appwrite\Utopia\Response\Filter\V06; use Appwrite\Utopia\Response\Model; use Appwrite\Utopia\Response\Model\None; use Appwrite\Utopia\Response\Model\Any; diff --git a/src/Appwrite/Utopia/Response/Filters/V06.php b/src/Appwrite/Utopia/Response/Filters/V06.php index 71080d1ddd..e3c532ea80 100644 --- a/src/Appwrite/Utopia/Response/Filters/V06.php +++ b/src/Appwrite/Utopia/Response/Filters/V06.php @@ -1,6 +1,6 @@ Date: Sun, 10 Jan 2021 02:07:34 +0200 Subject: [PATCH 125/230] Upgrade QR package version --- composer.json | 2 +- composer.lock | 18 +++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index 043007c735..6db03b544e 100644 --- a/composer.json +++ b/composer.json @@ -52,7 +52,7 @@ "domnikl/statsd": "3.0.2", "influxdb/influxdb-php": "1.15.1", "phpmailer/phpmailer": "6.1.7", - "chillerlan/php-qrcode": "4.2.0" + "chillerlan/php-qrcode": "4.3.0" }, "require-dev": { "swoole/ide-helper": "4.5.5", diff --git a/composer.lock b/composer.lock index 09483dbca6..d9c5fb0f95 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "6594e4d32da0196d0bb2e5a1794ea89d", + "content-hash": "249dc088c5f9f74a1c0e91661f93f96b", "packages": [ { "name": "appwrite/php-clamav", @@ -57,16 +57,16 @@ }, { "name": "chillerlan/php-qrcode", - "version": "4.2.0", + "version": "4.3.0", "source": { "type": "git", "url": "https://github.com/chillerlan/php-qrcode.git", - "reference": "1972af7af51b203bc239d8fb94243f6ed2a1067a" + "reference": "4968063fb3baeedb658293f89f9673fbf2499a3e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/chillerlan/php-qrcode/zipball/1972af7af51b203bc239d8fb94243f6ed2a1067a", - "reference": "1972af7af51b203bc239d8fb94243f6ed2a1067a", + "url": "https://api.github.com/repos/chillerlan/php-qrcode/zipball/4968063fb3baeedb658293f89f9673fbf2499a3e", + "reference": "4968063fb3baeedb658293f89f9673fbf2499a3e", "shasum": "" }, "require": { @@ -119,15 +119,19 @@ ], "support": { "issues": "https://github.com/chillerlan/php-qrcode/issues", - "source": "https://github.com/chillerlan/php-qrcode/tree/4.2.0" + "source": "https://github.com/chillerlan/php-qrcode/tree/4.3.0" }, "funding": [ + { + "url": "https://www.paypal.com/donate?hosted_button_id=WLYUNAT9ZTJZ4", + "type": "custom" + }, { "url": "https://ko-fi.com/codemasher", "type": "ko_fi" } ], - "time": "2020-10-07T14:41:07+00:00" + "time": "2020-11-18T20:49:20+00:00" }, { "name": "chillerlan/php-settings-container", From bdd04ce29263fbf1c2080aa2c54475d72a69ba89 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sun, 10 Jan 2021 02:07:58 +0200 Subject: [PATCH 126/230] Fixed margin value, add png compression --- app/controllers/api/avatars.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/avatars.php b/app/controllers/api/avatars.php index 1059c6e1c7..3a1088ec6a 100644 --- a/app/controllers/api/avatars.php +++ b/app/controllers/api/avatars.php @@ -383,8 +383,10 @@ App::get('/v1/avatars/qr') $download = ($download === '1' || $download === 'true' || $download === 1 || $download === true); $options = new QROptions([ - 'quietzone' => $size, - 'outputType' => QRCode::OUTPUT_IMAGICK + 'addQuietzone' => true, + 'quietzoneSize' => $margin, + 'outputType' => QRCode::OUTPUT_IMAGICK, + 'pngCompression' => 9, ]); $qrcode = new QRCode($options); From 71036ba85fb4f9e6524578ab6e3ad9c0492f179d Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sun, 10 Jan 2021 02:17:44 +0200 Subject: [PATCH 127/230] Fixed resizing --- app/controllers/api/avatars.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/avatars.php b/app/controllers/api/avatars.php index 3a1088ec6a..fe2b53f71f 100644 --- a/app/controllers/api/avatars.php +++ b/app/controllers/api/avatars.php @@ -386,7 +386,6 @@ App::get('/v1/avatars/qr') 'addQuietzone' => true, 'quietzoneSize' => $margin, 'outputType' => QRCode::OUTPUT_IMAGICK, - 'pngCompression' => 9, ]); $qrcode = new QRCode($options); @@ -395,10 +394,14 @@ App::get('/v1/avatars/qr') $response->addHeader('Content-Disposition', 'attachment; filename="qr.png"'); } + $resize = new Resize($qrcode->render($text)); + + $resize->crop((int) $size, (int) $size); + $response ->addHeader('Expires', \date('D, d M Y H:i:s', \time() + (60 * 60 * 24 * 45)).' GMT') // 45 days cache ->setContentType('image/png') - ->send($qrcode->render($text)) + ->send($resize->output('png', 9)) ; }); From 12015a75e03c48022f419bead6109d6e6488be7c Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sun, 10 Jan 2021 07:53:58 +0200 Subject: [PATCH 128/230] Added more tests --- tests/e2e/Services/Avatars/AvatarsBase.php | 28 +++++++++++++++++++ tests/resources/qr/qr-default.png | Bin 0 -> 14593 bytes tests/resources/qr/qr-size-200-margin-10.png | Bin 0 -> 3750 bytes tests/resources/qr/qr-size-200.png | Bin 0 -> 6075 bytes 4 files changed, 28 insertions(+) create mode 100644 tests/resources/qr/qr-default.png create mode 100644 tests/resources/qr/qr-size-200-margin-10.png create mode 100644 tests/resources/qr/qr-size-200.png diff --git a/tests/e2e/Services/Avatars/AvatarsBase.php b/tests/e2e/Services/Avatars/AvatarsBase.php index e27be04e18..62722fbed3 100644 --- a/tests/e2e/Services/Avatars/AvatarsBase.php +++ b/tests/e2e/Services/Avatars/AvatarsBase.php @@ -336,6 +336,13 @@ trait AvatarsBase $this->assertEquals('image/png', $response['headers']['content-type']); $this->assertNotEmpty($response['body']); + $image = new \Imagick(); + $image->readImageBlob($response['body']); + $this->assertEquals(400, $image->getImageWidth()); + $this->assertEquals(400, $image->getImageHeight()); + $this->assertEquals('PNG', $image->getImageFormat()); + $this->assertEquals(strlen(\file_get_contents(__DIR__ . '/../../../resources/qr/qr-default.png')), strlen($response['body'])); + $response = $this->client->call(Client::METHOD_GET, '/avatars/qr', [ 'x-appwrite-project' => $this->getProject()['$id'], ], [ @@ -347,6 +354,13 @@ trait AvatarsBase $this->assertEquals('image/png', $response['headers']['content-type']); $this->assertNotEmpty($response['body']); + $image = new \Imagick(); + $image->readImageBlob($response['body']); + $this->assertEquals(200, $image->getImageWidth()); + $this->assertEquals(200, $image->getImageHeight()); + $this->assertEquals('PNG', $image->getImageFormat()); + $this->assertEquals(strlen(\file_get_contents(__DIR__ . '/../../../resources/qr/qr-size-200.png')), strlen($response['body'])); + $response = $this->client->call(Client::METHOD_GET, '/avatars/qr', [ 'x-appwrite-project' => $this->getProject()['$id'], ], [ @@ -359,6 +373,13 @@ trait AvatarsBase $this->assertEquals('image/png', $response['headers']['content-type']); $this->assertNotEmpty($response['body']); + $image = new \Imagick(); + $image->readImageBlob($response['body']); + $this->assertEquals(200, $image->getImageWidth()); + $this->assertEquals(200, $image->getImageHeight()); + $this->assertEquals('PNG', $image->getImageFormat()); + $this->assertEquals(strlen(\file_get_contents(__DIR__ . '/../../../resources/qr/qr-size-200-margin-10.png')), strlen($response['body'])); + $response = $this->client->call(Client::METHOD_GET, '/avatars/qr', [ 'x-appwrite-project' => $this->getProject()['$id'], ], [ @@ -368,6 +389,13 @@ trait AvatarsBase 'download' => 1, ]); + $image = new \Imagick(); + $image->readImageBlob($response['body']); + $this->assertEquals(200, $image->getImageWidth()); + $this->assertEquals(200, $image->getImageHeight()); + $this->assertEquals('PNG', $image->getImageFormat()); + $this->assertEquals(strlen(\file_get_contents(__DIR__ . '/../../../resources/qr/qr-size-200-margin-10.png')), strlen($response['body'])); + $this->assertEquals(200, $response['headers']['status-code']); $this->assertEquals('attachment; filename="qr.png"', $response['headers']['content-disposition']); $this->assertEquals('image/png', $response['headers']['content-type']); diff --git a/tests/resources/qr/qr-default.png b/tests/resources/qr/qr-default.png new file mode 100644 index 0000000000000000000000000000000000000000..a7da496d9fd62ecb6b0afc8d1f2bfb154a660cbf GIT binary patch literal 14593 zcmZ{Lbx>T*x9vcX!NOp{WpD@%!QI_0xLa^{5AN;+cemgY+})kv?hcRd)_t#j_q+A} zICZMK*X}b@)wO%?z19wumlZ>T$AJd`07w$z!ioR@M9e=A@M8i{Fl!F_ctM#8$Or%c zHPHw!`p_R^B13US834eY902eQ1OT2srhE?o04D|j;7AVu;7kDkFl{qh6u3VYAPuC% zgaPlt(W9LoBUncX84=iB2zY2BgjM|c4`ViD31Ia7kWEfoc;c zC56G0m;>|7rt z1ReoOkj-ekI%}4IZmCR$(F`6oSrmC)&9ao95bSRCEDdh7qW4`Q zqg%pgoZRFuh!DBq*V!19f?b#GHqO;AD;tHe9bx33i2rT|pCkMJ-Bm;y^G?GrdQ*74 zEprmWVFVY(wm_0|1e(D{ca$OIQRLT8=DsWFKHDWa!ZF&yXwQ9WQL?%{Badm3(;It z8O$v*x>O%@a)|`SxIJx}BsCbCu}mPBH63Ojk`6qyi=Y(8aTAXSt>|`ZNuMIoQg`R5 zhSA2oD1K00769~sJ>Oh6@4?*=&8LHKP7m7WLhEAxI{SgKpuunH zXsGaIC&eI9!I<8q5!CWXZtIgw);DdnU&zv#bv^<9FRI%P>liOAl}aV0>ySNgAm--3 zzD7I!dwEn}*JA*TiE;{Lp@veCK@H!7e<@WomTdIbEu|Q%`Au3T{x~bN&eJi+nf%FvsZywarVpbbQ(27SO1dsOUCypxb6&47~UCOOG{os?U`r4OEN85FEW`9wj zMS-QYnmJF~Z$EbDeTr5Qx>GdAmwR<`ANRnbSXmCZLz}|c<0N=D+NKd2bRDpl7g$mk zO81zxaZr2r5;zeZfmht|_FBsXS-l=-mu}nO^Rwv7^6~7X#ssv!bMosfi?P_Dj7Ell zZq1zLjvEpS`hU%Toz4~7>Av*L)KLvxqIs>@`73B?Z^%3PW*R{|%~IuD~G zfYUlrmQ}@jWjKAqTmhQ7@T|~>YG9vh4l)?RCYC|g>_uMbhgl<7i{^`YJ%rQV8ksr> z22r|mT0j5*{7L>Aom8uF%1LxRSc^#36hZ>ID|ruaEn;!em7v$(3NKFS_i_5RC?~7_ zz%5U53Pc(4rggQSuPhU~Vu5yqSHYtH(*^$V;19_T@CQsSzymqQk)}6@2Zb47FoPM< zd*pz^yp4QOkvWD4f2{LK2ZcEvm$9NgZ?PGp;aFYf!Uy)2RCX{Y%7Kk405Kk2o^TNgg`n3|3y!GalTI` zkH)+_g06vE6v7)X3l^(kbjPensLZCv0viXV-;1dzE6 z*faCqr#aejvgCa2Ud&dDFCmN*XE6%IFM*q^hF>W9KJOc7S2g=caE{8|Iy=*O{z$u+ zJAleCVz^OIWbk{1*l8yrWpC|>82v@O{HfPNO#BzHZ#=r-UA__pq>$Eclbe2!l{kY0nUQ@4XVT6A#9+C z!0g{<^`Ex2)jsY?W+|VnfwjX=0`2tk4f0!v`=I{( zy^&^xDokJiLH1kAe4{yaA!W_>)e03VSG6 z@{GaCBDsUG*vuYiUPsrUMahTd928wU4G0*g$kMMbDYCtz%6(;Ve@Zg8+clA7>d@@r z6$=)x)-@P;nl}zDCI$JWBl9qz3?C0kq5~vo`18}T`iE= zl)NIwweoH~ZjsF0j&UAxhC}5%dJa5~#TXMCEAHB4tj)L&|p@M1vvd+``^Gmdf$k}|uV=%>Lke|s|a#a87Y zc@=$b|CBDJZ&yb{3wT=3cVJPSu4=5lYUtA}q)!1BRc&+mNiSDJC>T@p z-2s4A5eC8e=@mW95n+1?tLoBn;;&MGsVaUZ8!!5E%w`<>6C*nAABt@(h#moPJ#*RD z6K_a_0w8)05vd^ZzoI2iK|T2a;!iWlT!*|QTm@g05oC`P>A>K;RHlhA#d>F4b5C$m6D=3s|2k z|L&lr16Qc&Ru2C`xDbp*_n~#OMoeSp%dQP#^{*J)UpbR8>u`57()0kU7DU^`pE=3_ z!_?kZRF}I*o%dc=ebJDqUg7(8pkadX0dM%SX`kR`=0*V7<_v)_q& z#|#2opp!vPHhjf%vC$k@#^YWL&@E^M0Lg+@yqVIL=L5f`TRS~stxhlRzO(}9$*E57 z`cEyLtOBghTfb)L%~{wsWaUCAUf6$WJosZtLF&cFY-`NctTXx1&Y6}n$kHksz*|G; z#ZQ_c^X|7bWC3^jV~{>?QNS60d-WAZEF=>5`6{&qwB09;2&^7rkOLJN)wvRN9cZA6 zN^_G^ojd|bz&>XGiUQbyZc?KB13jVbUwLyrM}SxLZ3fz2=*In*GIGWXJ2L}wZ5-L9 zfQ+|I_N?lLNJf^q#4`J|jyXhA>EE%LFr0z@0 z+n)Ife}*%LM8Z5F`nr3KL`ma(Uwen`EB=D{t?mqR;zf2O4p= zyx9X(@O>r-U9|aP3kMyn{2xK~Kc3cg1Frkr3jxn{BmKH{1&cFH==X?wWn%cl5(=U| zecoqv5Tt>8AMnO9(i`4+HsxJuKK3vB?pE1py{!Ol)ni;eUTD;;_N6=M|{cA`Nh6CL$W!QoqtX>PhQp68+z zf(b<)Q|0I%{X~WlATUpoq0nmz!tBER{POGAc`wM+X4TfFqQ>Lg9LWuZohXRiYp4HL zU@xZ4*Z|En7pdrRa8<<)us6oUM(18Sq{Z20&bl08pvo)8@l;8%?foKUG3cdtx*}Y8 z;t=;<=NnJM8iZv(rnUASXnN^kPYe?lV?H7LvH)(OcI=g~ll!VrJ%9M?703CV_Lt!o zU2BEUrDIiRo%wjm$x2c?I#P;k9qpQ@9L0OxFXk?SlASO6CKJI)&ojLSx%U-~udnyJ z0x#}Cv2V7Xv2F}YilfWprO%cr)DEkozneSzBkN4v8(6CUXpD~2P0I+v;?52@F11!n zm7kYSuj`$q=E~Z6b>1JkR?5DkvfZh|*4q(`&n|{|n$E(}clgqa2vpyzzsEyLx$5;e zLHJvm`4c{}Huk@8UhYIL*}QH>es+Q4AWC(}{pq2FLL9oY?~#}9m%P$Do8pjpQmb~i z<@nRToPlq5E|lk{gx#O&rG9M+t(F9GRRPZ0;o%s_CsrJAjmjnG_VoPi=1pm^)j4I4 z-TS%22GPgmUq{ClO4CqhTn5dy{8MgrB25!1#Ul4FS$$qsih^waOofI)F$DDj1-lDJ zi6955o#IbwIp5d?5eZ*K)ia%7!BM0+g%nOZ9pCN>dWTG`5@C=zyz>4mN%E6rmNYNd z#^sktY3TNo=1gx=`SDvk=*vj@6_Wp;TNN6_Oa7@y?XqgcH^tA|t&H5q#3*Hf_oD{N z94q(8xT&(sLdjG%y7<;vtLgp>c-h$PUKiJ;eH|S^Z7DH+2OP92#}Os3xEMXZnpK$v zJxA#ngrPl5Wlj1>q6IGR2#s47NoNd)tOduX^sswspg(CE0F$m}91&aD?Ih};dz=^= zMguqd<$PkMS}sp}(J5}lS_hR3wBgWo6Ap14oxQF5S}4SUqK73^_w34A-dWg9Su!Yz zSxM|@Ql1u^WH)SwDWXSL=s$4nggfbT%UVV}Lu_|0$_k}k82yjlUG*75n`q`r8k4sPSN$bicP+q3?ck^kk3+AI(o}J7zmhUm& zQh1DFZ68K&p9NyIZdj4JKe3-?;*S#zYCW3CPOph>ptC(`^D>vjzXbs(%O>6@qN{G- zmQaYgT80^2`}g?Xh?X+*ewBAVMQ7`peSA8?()f({7Wq(FV89v31v2`1cG0_S9uQ~h z{?vJ1=_a)afS6Zy*J@gD7CH9CQ%DSdlse<<7i*wUo;NHn!TV!je@L&E@HRsUA+PBA zapBsnavhS`Yh6vwdV>_>m1YMZ*?FDY8x<_4@u4xYwq!$QvML=3Fh}$lHl5Qedj&F? zJMbg~A3-xphD5u!7P{EZFqYH+o3N&flYXJaBXN1+Sii(io_Fblf`|+cHC*M)6rbFv zg@-{njOELt3_!X|ip%&!s^yYkq<;l3AHx7bLE+6I$=P?_h@TOfaY3-Utxpo7!?0f~ zz-?qDjy{3>4AuOf9fg%HS*5W4bZefIu#f6SZm4oXR3Zb8Tg-98j2d9BMbv~)7~QUN zOv;ocokT`*a#i?QD{e7S86zweze@I6F+-DuDw#6!=&;fRu#yHExpkgc z&#o8@Vp39Z9ejM5MtnGeMauf0F89v#mL33RZBNchC)1(5<7Hz42v=|&vkx;>YF79* zN|ZF7SwgSvSh?~Z4;U0TO}A}s3!K9I(%`0xUsU znXk(jUO-3EUu=L+?eP~y&GSAp+bs}An7SS2z~w2M&hnFQX-umN(jRx7nse=?_CesL zXG|bvWI^ijeYpeJ2@aE(Y=d0OXlCTnL{)v4zoQ1N>cJC^WXcyt{oM&n5R+#A*|oxR z;EkFZ#x3YLihzG96mmv^_Cp+WIxF-~vFSfE4i_OHpU4PTiK2QJnNdhxs;BLanvr!^ zun_$V58x(|^hR6eyAWQux7astDZM5=b*mrF<*5c|3GMs)jsPmgrM_bU7IR2+2m5z3 zH-&NnmIEsiA5P^=<$WCTLZZ$aIZPQXqCc-)6{LwCQD^)GQdMx*wW>i!WtOT#LjEgZ5U`+v zt%}RZP(h(!Q%s@}0C!pMK{gGyp2~VwZO!`a3|oj4=2rHvNin1E{k3NlbI@mgRTK-O zX71)Knx{?dh7F*pUDyN=0!8rmHh*FEF6&k%B22mU;-G!D?N@!oN^4S}=VdDJ9Oqvi z#LxICu)I4)HzvD*ilbX~g4zmdL&ygEV>$tPbg1;u7piSTbeHZ5pDNn*vhN%=VxaX0UXokzh-N3Hs7 zA~P0Tt0Om5B`WCe+2ARhNMAwB0%ggXK1;AFuFU$)rZ^49`vM2oOi_pweb!m)TO4|J zTlq2xzJZ}hk7^f##NG=!kK;;J*4dH2mvk4YPm2t9q%m4ivgv`O^L*AxaZ=l7QuS7+ zfH<6Nj)_=lkSQH4sl0$SB;~&#!(QbU^ln>-Ke%@59ahfy>ys!_fz-G zK6g=&kmsIOhxziSrPY^#ZolIU>8LZWW~mlI?!wfTi~Xvi51@{(>= zd_w5P*WVuM4-OAtAPmUm)N0#53a&WL5|DEovpj;cYCw0l%#y<}XF*Ljxm}QPK;x)JC$;C;)n$WSA zLo3B^cjaGdtY5i4d*paz2%{&IkM=z7UzMri6Ipuvp**}$GRDG#IgIv|t$1QvXrlCu zf`F@fSr3kv$=*C`obKv}(CN#@mWjl|QbmkKcIrA|D zB~ynoS#@u(d@dIZHENR{9r#6r6jug}kaCS07*Z0HZG4_iHuXv=K)BCZJwDY_udExM#V?y%^-L-BVUC31Xkw zQGo(}>#jtxv7M8SS$9y~5jnzyTI~w{(%kt~(%F_K#Hp>P#xBUh`;5dSS>?GTPufPZ zp19+$pOa&v43CW*Q*w#c+EPZ3u_-BUoMjY{FY`~${`81K-Fh)&e?n(=V8th|d z+DwLULB9C~2#sGwNOviaSxdaj_`2_DuepfiL%j6&pZ=(GctufstE_xKCOH0;+gZV@ zlU$K2P2znS&NVYhuqVhp#(3SATxbS6*T2A5ejB9wVqp&!Yq+}@pud0qkqN?=U4PtG z?5Sq$3eVDyP!o+@3 zv9$_8{~^wiap5=f%Tc`jj`2Xc!f3}#@9DqQAa!#ju_SD3yb1}dre=T}StOz*IdK3H zYnCrAbk{knSak!Dn@%)5F}7<-FP%pYi4f9uW?TY@Bq1NIu*aLp>+>g4#!$W`<8yfw zwsGm~^#bT%a}KVEjo%bisN)Y+IUfkb1L>Ec`Oy0jw2o+Lihq-Xe{fTIdCr9*!1FKV z?j$BIEW`_RpED&`@lSKup!^xAc`SNv;w7*W#s7-)9X*iU)eZLq-A8V1ipgazpIds% z#uDCyV|~U;XP^wJOoo9Q?L|Bc-8 zH0SqJVW||#R`lyp&9>FsBA?C%YN#kM&M5V{bko`*aI>OH4SDR$)9P~OrGhc?-UA_^ zuVc!MtdvT@6UEVY<-TkJ<$N65C&mo{14K*Abk^1kcO`rMuep=P0-*G0WEfWR`lzTA znzTUR;gH?1#?Pyff?SLvn>gjI&4J&$s2CCj--2h~1{kXeG*h<UvT2_Z)gAEkosNTW2xnE7(2)BRl$O_6zA6n* zv2m<# z8Jj*cX@{q8EqI*-9|NH5<52#w!sn@Wn7x-`Hod)JL;L+oTHJ!~G1{id_TDbQ*UW1C z_n9T$V0E(5%mIV8jzHvpA%|Ica)TO zmV@f?@Dh6+2Bq?hr=&Je&+Ks#!soom1~_>`s4$5q4>b+3%KAEHs!HvX?tChEK_JDY zC7YHAXt*Q-!kGYaRxeH)ilo`TW(SEDp445r@vSofXW;FQ)w$~R!>HvKx2pt!VtgyY zNF!_XqRKoCmo#Fme5ERjIOE6x1|H^PAuA7C!HcQ2?9USK{9;fm9<40k(Cciv?&PsQ3Qm?~!x21SoNsvW!M`c7H$c;c}n&t;LBJjQpJ{j^&(U5#~1+qug zKcO|_27$T%bGcP_1GCc;H5N|$CvL6d*;fLJj5;^uMk zhu29f_4q*?m!@K_=z?PYb1lv?CGt-|{@xdDDr!ezc4c_x*2yTEKKEccxS=p3BPyesPceMHp)|Gcm(7vDuH3{@}??pUp?TD2<@d?oa_S>_)=^q zZm6i3C}xTp8=QZ6EFTG(%}-}HYG*M(X>wKFm$bW?zP7%qzeh54Z!h+IAI6I&uMCKD zB8Tk0J3HnX#>&s&VAF@yG)#%{_OddzB2}lP$@m~nzh|^i&ACIfx#$qet5{ZfwU#-S z0Ywa-$!Na{4o4?SEc%4?lk$34FMI7-c09TN`8HF;(qJ1Ddh2BJ^s;YgGk_98HKEm( z3H^#hOicZ@NTs;ZkhQ>M;1dp`i`i9*Q#hVt4p> z9~|UVEs&hd`_&f6@tQ1^rcw8FJx5a{#P;=Fg}rnJwKlaSct*tIO6{*q*7{X6#H}rMEa2SSibv2wMFIHCS)Kth2gFa+PPpEsgFjh*_rP;9&J^t%w}$}f zlZ&ElA$!OAcYxAF<*G44ngep|0=6i~#5n9V(OAY$h#dc|0QtX3c}6O4`}3q z?>n{w2DmsjA0GMFKaiEP?A>XmBTXfjNs+y?Dph1CpX|5Q@R}3wLit{I(F}gMO6Id0 znBnYMBj!Xye|uL9Y2)H2k{cmF6CGWzv37w9ep~`UHPYk3e9#!J$mmRU;Z9YJHl#J5bvJn4mmMhd) zCqRWvobMz}J|u*!W9Bm+fW-M_>y}ZeYyTLIphn4Xv8wi9RyQ1#hu}1%e9-oxFo{jk#>&ke;;RIgNovQ z6n_<7%wPAm(^a}Y#H@x{@-wdv z6MqL4hP-w&k5qvi-^Ise1ca9Hih57gYk}Y@;|MJHec+^<6oI6_k%-o&5v;ch3-DPA zhv7qo_v#IM;Be!VUS!=Gm<{v;NxRPR#~^x=&Q65FiKWrdNuQ7~^t<7{L4+}YQ2hk| zr@ldm5_sugKVvgwQveb5Lid80doIB1v`wxrVMp zHTBgC-M7Ite#_AkTW)i2*d6=Lu6(Oc6JOv#ZFeNt^F=Ypq)r1_6dy=#N^hk7=_b;> z;gDB-&Z1%_9!Km_Yk4hAPj#MfzucBF_2h)X*^47R^!w$edNggMgIqips#N7`%hIKh zHz8y%h`dTGEB~p`mPEB*Rk>wy{oz*RM|Cc~FIv;IirTfuXEqk>+lrt zlD2Z`*7ik0OF~0LqvUZc-;mkVyUM@qc%A!t%N8c2Xp|is$yekj@sm zg|3=t0OOp)QnLyE;w!tSX*MWC>pN>NYt%Ukhjjg1Z$ zszDB&{I`w|2!}#s7|9kIO}Vw%RceJCJ2$JA;6Mo%tFD5ZIYx2QxVeh;*-mganspbB zsixaX>UX&JlN3a~BUqtH+MirJ%$-??N|gPm_si((w3>r=xask7tuJ1(n^3ZcW^Mz+ z5zh^UvcFUa6Kj?*gyjrKL8>pvgJaBKh}DTCr#-ou(^O@&_poQmi?gwbA*)bhmV?(? zv8H{fhLPGibvB$#Gd}=C#TAetHx^}f03s!TVvgG zwIP`mDHPejfU7JH9k>LcX?*a{kFtLl?)LpN52As4A1Z^dftkR|A?P6sf1x_FNLT7CVRS_!U1wx`Vhqj$uTAyf23ep^gZwc2_T_f&1K%&1IK{tL-R^yCsQ% z&ka{gDe|oXd!d?CjWn2p}&#K)?u^ar} z9MzgP#lW=i{<;GvMJFU!KuEA;&Jqe^8u?hq0;ccql+HwM&d|Xr0#fll_;BTGR$G4= zE=uB7r8`; z^TO@ci{+!)?me=j_6<#I+oMYc8jywsEbthUJo0K~xW3h5^lPkfEVG|^mC}7{=R1x2 zt1UoSAWJJxZ_P4}_sF2W=P2sd|<}A?z(@jE41#j8;;k$qb}cF2b)oHC8DO9fe2fo-#~gXpWac3 zK1d2)^AZ^Cx3^P5Pe$Q$-Kf!qO)<}_KnG^=qJl(u%#`q-X^{q++TzqX z_ycU91=odGMf|jDIF5P|LWwBUul|Sww@ncJM?;M|j>x1!tglozKyJtr@p!A?b&&mL z;HsRr0aOjLu~bN)fQ!DcO#)heD_ep>b9eDCy$010$I~D3jHR?X&%H*K*2Z@;W1eZI zLIar^%!fm^6q01BtBJ+8S1D5sA(Z*k1}ALt2UEdw!b#Zy?&XJf}9{l$5-@+!EN z`;+A`ET4sNR>WAU4o6(}NV!Hz)Y*?oo-(7C!+m(zjOYUo9?;dlUn;O5X_fPdBz=Q~ zEN8wBX>lXc_#nLiXZ-SI`GN#Xe?Lbq=@AWXsR*xYzh}R+Cw?)l`q*$T-v| zM?cW=4hF!(FOZxDgYul^p=E3q&QxXv#`J{umx^kRb`sJ^$#`_bxdPznAbRGu&}QPH zV=gq3s#KDYf4sd>jT6ltBvm>j2YThS_)8U9(^05V-V)0B~o zMa|d4{z3?951HW2kBR>)98qVJ857wY+FGWch< z-wJVJAD+CVsEGLLYqc4FZY%ArHh18-o>fk53W}iCi z%vW{sKkf*>jRR@b@S7!sYKFIa4hK!0Dj&apC!&`t1TfMwlXIooq1E9;g+|jZKxHsq zixx{gz}ew7kuFZIbvpS)X&BM(E zttDya$Rl~y#t}=p)vHEgXD1P;l8%8H8a7;5T1w_L)IIkIdY6ROg}M6W*B|o(MH$9&tEhJjuMZX*68(&oMjWF;2j< zA3@+4iHRP2*v6x;F~S0m^;ND|Bg86a@g5A#kWAAtO`R9OuGlS}8Un|bQG!9YPCHo# zOxZ-M)YEI?QQjKi-=Wh*_kvhXWyOz;$!Hh1`SVrE<#l^{#wKJDTF5?=8d12GsQm%j z(QF*Epjg^iZ&=-zp33)HSXncc@VeQ+y&j~v+(gW^S+IC)bHIoX@NQE2{(udhY#@zE zYpp?a|H6I%O!>?Q1~A22D$1{P&E=n+&m9ZxhZHof&%3d06Bo6o{MJ`5XNg5Kx(^o-*?}2n0u4ffqI;SW@qIs!swE6)t0QvXWVhTm7Q*v5f0m)$oE3fF$2O#d zNopC1J`_$>htf&JD>PADZ<5V)7rNeSkMGhq-4+}4as?h(tS9^1&Jebui-?)7Mp2WQ!?@~%36s%S2iak7pB_Ar6 zc3YQ^pWfLw-eyF?VWiiscVLHqcvy=6bhNTsfM8hsqglwm<@KSUl{J#d$Bk~!!kf?i zDq&hL=;z43L$xMD|0T5OHxbV3L+KHBTM`9u zyT{GuA}k@jX3nlW>wF?lTFlGs`?n1T`ELaEO|F5S&R=KvY)Im6l5K;@ja~veGlP<* z@PI?yBtY)uW^;|`-_p(<+>5tU6*Mm()by-7y9VTX=PYaYcIT( zed`o?jQ!!KWAr*sE~R;}_1Tc*CiGd(^i;`td?vc&u+br|_w?cb0Bak)qVg!7yJCjG zXGhHNKTsUi(9aT31o1%!bMl~VitHA|RCdQmnT4UsQJKghACc4!70BrpA0)rZ?@vLWl; zX096uP`@f3?V{P2cNTM;SelDgR^TSjr(2Ps_@TqJ(I9(M{%oGDQ(Xl18&sUOVIt9i zkGh#b2*3K6)|V{Y_b>|Jzkjd;Fzyw~d8NNFb$jEJezjXxp4Yc0c|g|NFO6fvix|Sv z^hcgS`Q7$D!nxOW-72cMq-q=0w)PEKz-z2TTliy$$ptEd2W-2@@*feoV@9`_z2Nh& zN)Iw)4w32pmYXp_%k75^*XlW$Y<@@ct!u99Tq~Pk$*@N1bXY!bH{YjD zJupLB+u^UPiw5D3NHWpXDsN84I_N`DNbdnjGkOYUH%2y73{y#pnyL{L1Vu2 z3!d!4@Ng!m_MBIIsDx8#(*!bpdmKiEBAgxpgw-Yo= z?-UvnpV*45zWdf6>{Y8Q^L%=_sWtj2-4kV=-IBhRTF10Th@R1HF;f8_IwyvXjJ#*T z)MkQXah{!RJc=3o;R@xjEEqV#kDe!{zN=wY1L&^85ek zx-x4GWVv6mA5h8+q53jDRj9;rTcm`9IR}MCIxan}-tnfe+uLdW zg5|wwKqE(6D~dJW5~ZR-@+Q0l1Mm}!7-}vl!;hC7q#8IN?GZjUBVgwJ5O$!qq~AnY zw7et$1fr%Kl1iKrxf-+i6}IxB$=tmRJLnUj?PC#SHDp_7%dwIe5|{0Gzlz*zL&O8+m6#6P=ma*7+9 zo0>TS7@5D3&Let$U@-qS)hV{T>a=w@pS_^)3@Z)w6Yi3P}HNRqf6e_%?kK!Y;Iru)bbwJ|!fd_ufk^+sp8LWXi|)l3UwO~3vqNj={#x(LNe=D{SZLZN2QapkWG)?(x1oYWQWH$NQ~6BAkTBc@qtp1Vn3qRI zQmdt99&5N^1|KDujHmpEVul9BGP5I`k^MSk{#!Vyr?nwri>mIt-{~ZDOA|eC%G8mV z0+GnH{V0PWwy>WM_F8-HGWKkHV9xN-$9@Yrx(AAM)2o(w4HYk|j4UuWj!3@seM#ZW zC*Vck+Z0Pt`Dj5s9XrL6qadt!R)D5`tW0?-2Bp^>{W7aZ?-+ct=DNHOsQ;UTHyE(h zOKLLWcMjE6)2{Y=c(JCYh5#e5T@urI%*Dr4@8R7sI(Hqa+dRx?;W%ZLec+#qcbdv) zn~*T~mm_m*6pNiLt&8?-J+L6#1%F6TQr3nw6Jmq!aY~|j&#qeE6NHoYuY&8VPLRyz z<|MEldmk3JC{m36!DR;II(%K3kTVa=Wxi~3i^1GuI(+?}?0NvQO{|UCd}Iwd$*Dd% zLjMxni7k=?MkOOm-wYH{6dhZgK(Ht@jdrBGbZQTc@s8z&#K9IzaNY*%{J@@ zAA91b)Y@Q$F7%$A?I%3l+MJ=qwfeKoXu=!6Bufcm%aF{nT7{Iz0v9f{l^D?-`3LxP z)SkAL$^dhsx-Bz&XGWTD+ug{u`W`QT)zJ+}6SFIpzOqF-wf&rbOYU9T42ok_azTJ8 zVUcz<$v8b7ky=LGrVb?LtFr=mvAg<*_2PhIgc`M}%d0x+?M6{FA;Jn~O6|auoqQQB zl<8blK<9m3wCt> z4!3KU*#i^p4!z5_L2pi^Zqh*l!k|)5p!Afnqrhp33`D;ealCoeJl

Mt!Buq3^8#i2Bly&v zEL?p`sI_%U8A(mu@7iYF#-EiWVfIgJcooST((1y+O4hwKo|@N0-L?AI_Pju1>t|u# zEam(yuTuL(1Xl7J>Y(d~gUUo4&8SwZXg<)JG{Y@aG7ku$>7=P&uY)4iAA0w;t|oH!KIN z%It5orz?o*+QU~SBUy`XborZG=S-2cgQpJuPXy1O2%CDBEozdIzeN!@wQPmj#~^xV zK63u0I~q?d<3wApxGtF_sD~dhpDZujQ$&J}hbS}%4cTXSst$a_6! zzYoXlg5pN%EH11lH*SANVF@-q0gwIVm;oo{CD}42@;e;ar-uqpE{=>0Khdu1#ND4w z<|MUno;qA;MnA#jBp8Hpz6)wN1D8Jec8xOWjVF(D1I?If_|Cp#!?c0_n`7kA*-rF` zza~R~X%k{hoxdNKJK3(PqxSA^wf%(($Hp|E6C?F5Y*R5*<8H!`$blwU=t9vX(59!+ zXPIB6kSHV%=;;>9AHYHW2R_}sswVq0YA=**@^+3r)OGLM)mW6d@GQ1k|Kpd%E`4Be zw&*=SV9)k&1Z2C!SY>;WJ43asKaX($o{64oq~iy|V94}G-QHM;IRqN2bA)&@TeGGa9g`wl>CC9lclC)EjMDd(r=Oh2|S}Q(7<_qNoBk|0H!uw0W#C?nq&_yIi+^1RHq7OeD;ro2l zbz9K7g$)RO^cV{4pSxhVYHJu_Y*|+P?$ULvO$pS$Vq74%tKw+H1X1Ap-OsS>an^L* z^dlGO1`XN4NAQ|V)b*>3$`im!7{aC{yz?W!h_Lva&w$HUSRL2-MqA(a{9ioS1aH|v zrzde(uG`0*jDKqMX*#^3YCh?`HOtg}FEa&Cy#H9Ho3E+L?2+x{4DSqn8 ziPinRfWLB^7O8@tFt{{sk^HI~C8J9PEq@f$=6o#zqeyiz%%q(-7e^j^mm;RGEFro# zRs@q<5XKw~zG50|RXFEiMaufZza9(qWiu1cz1k;rWwRBXKA5`j?2U&V1LW3hwMZRH z&uR6k#!^ba<`W_&?AR?^y#u8AZk5hMa3S3TE^pc}_NtFk&&dIh)Y4P_w){6E$(lzb;rzPy^S;}cI0VJt_;J0I{owc z_30=_#f_ZDA%|%-!VenT!a=$O=o+;vSaes6GO)S&iS)2(Jhd>iP_2{h%fpuO84_{uNAdeA zFc8O03{QoZ;q*?m9*lT)tItz*b0D>VEz;!ymKF%-q4%zYka@N-@VzR@L85~W217tP z5OfVOy3;5N4W4|=O=IhfNkaKzQ;vYB1l>0ah~n)%tKDtjt`*fqu}BQO_O4JhF}~u? zS38Q!_$uYJ5WNhf&MD!;WuJGbb%I@;<2IBc2w-A8gMV(ePT{Hoe3#!mhx*%WW)CEG za9RBTawdW4)2CXSZIqm0d^2MpAo>`05yMUh_|RPQ^pVq7VR3Zg&`a9P*sP2=M=ETU zab@OgtnteMxse*dzI(SiB_kaMJY*!dOTIjrbf5k)`}9!yMXd3T*1WHeOmPTpi6@)^ zD^f~Ri!lQ~Y1+lOL4M8@5`pp)1JZ4qo#ADg%uVh=bAwYCY*RbHZXQMB#y@{H1 zQZp54^kpx~@6FWD5zv5?Q|Zm?ts6B`(~pu9XdRXdl2UVyp-P=b!1Nali*r5o+h9+v zGY0_22*Q%woaoswU)`#hvQs5z^b*HT^4(J#>vZ{)vZ#gN1#f6k=hOPUPv@qyuF$6v zmflO-g|W1%@R;R^9bO@tG5_YOgg^Jl!e~PzsJ_&so20Wz4bmP-J%$E*FfuPRfYom^ zRgU*aaZHQQw)N0|XVa#j#xY)X+0^0E8o`b)mte3TAZ1FVY@@*?4f2%1C|bXg#vQps z{JE))=W(grToptPqdv1ed7-)(LqDwB0>c>zB{w4L$48uf-VG=fh5_fPnL`}qGe z62z5lQR(_H$&&S@`GaU^OLTK4x}#kE-B|`eB9JPI2o*&Yge5{9rK*ZTsKXHm6ao>1 zK}?(UsO$SkUo*K-Y0$ v?tq%AhJpW&Wim?>`iEv^VG4NQeB4dZUgE z&VXmBri=hrFXH;!a2k=Ps)i!b8ia&^mBXihdmaF~9#zCcec#!grvbhO6G>M)`_0F1 z!oxYJ5UdJ;`Z_wIu*{fAqf&zhWfz^wPGw>>F++wso+dSNN*5*=hK!1+FmHYPvN$(K zhr_B2X}&O%EOh80gd~&|Uxk?Cds@KzfXnH#_8IQ8_W{oCVX9o)ao^K}jvRKXj%FP` z)*Q`-Tl%8^`1zRQ$5SH+rO22N5|?Uc?JdOA(FKf&tQs0Y8;B_4i^EcTjO5?R{4oIf z-h0uuGX;Fh8;$T5G|fF$8mxCE1m=f{CzSziTSih`Z*?CPhiIH2E#&%oFVlmfuc_JD zO?x(f;9C2M-KnxZX{qnDK`Hq2_;7%YKpxs71IdJfH(VO4Ev){jdMmy?HyN8qt|e@8@{^ z2kc_bND~D#4IJw;mq;b${!p(+)7q@TUD*yXX?CpYV*Tjc`Dn<!RDS0&lp zbhYmez`se0eyJg3(x-^07tGIzBMH?%f()oN#cR-PoohA`0Wk)EUKn=5%aV1RWH819 z4;QZYuHpe!V+BL@QelclPCBdAsMWoYT%U>O?k5D-qN*3o_Mo(j^~AvSSKB%rd|>Da zK6vL>wg&Z|`%amInp|v}0q6Y_g+2Cxo4>Q}e!f@b{H9Vu3bxA>@`iIry&Zb;4eKL) z#^6B+(5>w(+(EGbewHhb$q=rAfWd^x`gNbtRfqgy#r3EIy_=tbhhSJL{YEbf*Q$i`QL@KdoAjw5Pd7 zwsTGm4&kF~k^BMY`*`w@gr;^bxH*d)J++i@sY4=f#WjWNIxFj$^|F&6lW7 z(k<%QVcdy`Z>I67whYC^VszQ&`7x_j_toPGRdD(&|0q&ws@F`e>X`JAX0o-}Wpget z>EfDETS;J-0JE8y*Vm8j2#K>kUZHI8VBCvp0lCY}se({yan-%+FD5*$BOdIedjK$W zZV0#H((7)%u%v-?-HtoZe%_-wDxxLz<0NTcqXd8Ik;1Qwcl&3Q@ed(i>8Q(3)d;I7 zOPG@!7{{=Vs*FG6oDE~$%8rb-)Ka1S`J?12*7i;SY~NMV3!|*#1Jyf)b9_q^Wp1Xx z_Odjb5S!1_@NMKi;)(68cmtynPHxr;pS}d9J*jL!b$$?>t+)SP407-11Kl-9XTfa& zNysCY(-+}{-irpa)#~SuxhG#FDHzFxz`wJPynYJM@1X|3)u*ECsj4J_>MJ!- z+;LLw6je;b$G!a$^=%@2oaBq^nu)?qdBkZJuSdf)wTRr!s@CgDvi_{&TC%@Kk|y+T zgfmmVoDe${Ga{;cJ@>l5v6+z8Ua|4mJC+yt*JaxPTBVBFBzr+p{PE?oDd!>Z{@YE8 z-0~`Qaz3vz*QM!uqZ1B&ho>YlE4a(}PV){g`dN@XGg#{Kfr2d?{Sz?pq!1sRuW#~! z1A+N+JlYo;1i({h)9^X`egOmcHRE2Wu3LEUCKo@mljKX8yjrgwoeP`-Dmx=i_vuGo zs6|&zq)ZHJ0uA;;Qa4-eq_PcRLMFzo5o5jO@1(pJs|%YoMkk;zCl9pai2*TsuZBo4lN5A_93V$8YjxSL9sA5lB^VnV6$|<3a;R<@m9+G-oKP zV~>3@17t=lW(lmA5(E17QQvHJIjc9w(dXDkFgu)Su*f(dMQF&a#zfv*&;_C z{l&_#%Dvt9I$C@ySEt2K!5XTN=sdp+vT_;2D>kRI@Zr{B8?PKC5eMw!Onp}?mNIfq zua?TZgiRS3I5^vcZkO4g%4$$#t!F;I(PMS@D!idHu$BOXrrv;pQ1Tso^yOq?#KQj5 zO*0!Puyf7>*ed5LU_Qs$|D@Rt26zG{udV!@@|jdTdREPQP?}OsAnVSpKvB4p^Hz83 zy>Q+gLDhuHOwFn}sk&EX?1daC={D_1`e!Puz7VEt7Plzzmw{i0awO<^|Aa5ZyU}}_ zI&_EKqUJP4sah%8EemAXc}IVTlxgk8xg#Q%*nD6|Co5N2LkK($R^$}WD41&Zhd?s; zqk2}TWuH@niZM-W(;J_(*_VBzjT>a-|j$x{hSVaovQQ@hN{8nQw zinHvBM$9Q)s9Dw`F-Fx{s$x+g#My@NNG)&mwu-9Yktou`DrC&DSr)c~OwAERte&=B zyy$)t@grJA%6rg?I$uOvKaZ=?b(lPp8m!N~jJ{ZhvbXG4IrYIB24bILGgYrcvW9!Z zPnTA9@Bwpx_NmLq+a@=S<&t(O2{wJYwnGo@XJd$?WLn`+ILW-KpsBwTf;Zc1-s=gX zmwiF=Xh`v{Hi>qk6!GkXfLVO=XEJwV$GfwRYW3Kk4t@CBq?O}h)c?Adc_Dp{05RMu zs7QLKF;dtltJ}Bv?)M0HV=N}VF6p7&7UXcG>*exg#V18yva<0XL|Ukfn4K3%w3shX z9i<4B)xR(CM8FH0F|x9kO^=?A}EaeHedbEs+6!DTW^00^O^X z9Hf8wY;>P%KsM$ZI|#Um<81cTpQa{2w7a88-HHw|KPnnmCre?ODma9V~`T&!z6%Sgza_> zwNlZF$OW1cfsK^RUA*B%(>GsQf@cjRS+cwapD{Zaqm7sVs1g3udp?($xe0QHM>St zNXP1+*~*X4KOrhJ5;?3BO4;>JNL`sVu`!#!R!kIFBKcw2>uLM+UyAN1#X(jQB03%p zXXL4;8+Uq>x4u31(y{y@v$!-SP!Ly zBNb-^SdTl8x(OAX9^Cy1^ym7;YWk_Xh4*B>O@E|!%R5PvqWiVgFn#iQ?k%wYnbJsy z{>v|i2OLjPu|zx(?2P*0GUk&A((LlM<^#(3#%-9TNiqsmQ|dj}U@A1VLV7+t^wYf| zz3Kw?tx`ZO<7;&l!i%(MlyS1VpP6}^bYGIi04A<7x+PF3rEl#| zbHkaySf#+|X?bSf8g_nhUEytwK;I}uplJ6RF5=hwbmdqAVZNG3B9~A`jHR)~lUMe4 zyP?2{k4TD9QjS)s_y(FW&W7fsk$GCaJ6|Bx&O#bKA3q)e zBr?Z$Zj6BnU4on*9%tF$N6UJbu7POe>sV~cyj$|)I|p`FTUqqOzxBe$Puikx?H*O# zWZA|WPL|m#0-MI{0wfbJta;$gUg`=X(>Xe5+R5&5iFE}d0Lyd{{`qUq^O= ztdLVg8U_BWUlr`9b&;Ej(}yZl`*BCyi9>QD)kTCWvtOjnw+*9k!^NN8a|ADg_#G-= zmArAJZ_2k+&N`8%88ept5G-q)ErG3{eDk7`iu&ZU+5Qmx$t~jx&JV>Ge_;W?>CLCi z%tBuNcx0GVe%?|?sVBc^c_o4@a$)XdiEEwE0c95_f(eWVRdKs5B{TxTva&FZDW@@z zwc`waQQX%GrVxlPl;ub|)STh!YsxlAo;ppcUT%s|XFChhEK&TiG+==l+QdFM(+Ge5 z+Fc(nftn39ZT+hMZ8Y;W@@-);^Q#9ld*+ced7SfXy>W56#e|K@t&%Yl4#W?7xD^s( zvvc^D7E&4*%xK3n`Z-Zk3AV&0v)%pi800(H`v$z6l5ctF%uU}e0ytA@1Y26*ErX*5 zywRG{TVVZ6-QUB|NICB!t3;8${&ihmIodRaa@QY0lRnq7)YK`r)Y5}r6tceHn zeVD+~4i6PP`>J1JaqOo?Eky8GOPC2@NkjM!A~Q<+1)8kI!JAWi67=dU6lgP5#h;RP z^}7&)<3itqn|qKLB;2IvyLzWLl%Cdtztm`DmZu;>`6!DJ5W8ccPSh9^ zCqa;f=^3kjde3*8v{fa_53{a#m9z6hWdGR-$?Y`uKN&9lgFWIpI?TLxBWLZVUH=^U zcF;>dW}BgB%p&r6qQs{C3b$QuQ~}5`D;gz_&A!PZ#8%0g?ECp)0=0ha0u@%R zz&044_7|nOX2dC774A;>>{z?!zi|;IW<1}y9ATG|F&ePO*{e3h#VWRSze^f~vVW=V z8_DVZ;Z_mRl<>znq4zXfRD$rhqHb(b_YtqxIx&jTvN9O=_}7lSk*|VvZzz}18DfYl zY;9|pMDLhHGM_R3`INaLF)G*Lxq5l6vEGz!r1SWvd2rviTD+opHC+UxqE$w&H+U|E zSUF<)bKqj?2))KmphW^H4@FgkWnd`-Fq`+SSf`5TzRmMM|BC`yym1*V+3_a@T!biwmWaDAa-YGwr-T7Y2V@{&>&aZb=k}?^f!kb*5=c znCB>&j${nVL*Rwov0>@IY{xNT!Hbzs5<5ju~qhtCOR@xJ{)?a(AeHS7D6;nq!(lE!!r~37c|GTCo^BTaES*38wN2 zcObu0#0o?FeU2@jMy2*xvKS$wFw1lX!KR}98f-1slDp znXr>5rqS+tO(9>IqS0==j_-~3Akl)6LLXZl3n;YHIlQ;>DSGTne)WB?y$VPq;@O?U zR;)Sp5uK;<{@&Gj#C!PBM(de#Auj*=m3#L8tnB~z8kyn$T2?Mq>Ezd8y1G{72Pwr7 z`n>xLjG_94(7Tlr=O7A$6 zP>iZeMsCw$L~wP`dtXlXUW9Su#`1M)h zhey)K0(i*8X`(hE$P~acIzB!3_kHq}p#0TqF(B#}_o3y%(AdZDbYWeR-n@yGcd zvQ%D=OX>--gk(rIEFeh?3JOP0{Sbq8FnreeE6eL}H%ujj-+2@YpKCGeZu))H7%EZ}8Q^QR-PDG!RJ4{@Yk5Ez)!CsDD*Sq50vS!Rsiz~#mCg5qIn{Q4 zsA<(ibuWJ#>FW0@B#9t&tUSADixtwT&_q6|fGAkC9}BVjXi>WJghriv@4FxD_@|PN zCbE(Jey4P19PY4L#oAPPqHVXXQF^fuV7^l|)~Jv6Eq&*(5N^jv@b)}9W5l#(tQ3aV z)Of;73HmpYL1@DBsE{3_JM`e%f<|`_H#KqS)`D??hCbU5hH5b0Ms(qL49X48`Ij56L-xnoB$$hKp zU8j)Saencw@2hZ@uNe;HvQb@GYS$yglj87?`^EYgcq2wKztfkzqEY+4&wpoT=g!;J zD+~p14c`P7{q+5eK!#H?x$V4cehC!rL4eneWvIhFE4buRWlvO0@7J)_m$7bi(}7_u z4=-$QkT+;3Zd9nvaU+@C37$=gK{Opn^Mk0AWtfgHWt%N7%?F6AKp!SQQ@mIX!H*Bq zxqKmy*$uc&3bsO=UhBUay)=pTUNg@KqyMch5xarsFT%xsDE)ln z>U;M6_r37OxYobqt|q#Q(&{xvB!#{I=`5UjWa-K70)V85JtIMBGrnODKq z$!>><7^FY!p*Sc$rEQXYnQl_Mjd5{{bn7_2MewWh&zt8}<%u6s7Rc`KmbS{tGIC|1 zBmi8t$^^Pp8{PN&_agZtp_a?y?B$p^)o0kS?|+zY7|=K@yR3O{KBnWz)#8Zke)EF5 zTyh%MIsHudl`#GadZXtt>oI(nxm{P5?0xF;PJgQ9)4=eGy4% zaWQG}JNzOd(jp>UDZz{X%fZRT%Ff#F|93Fz?L^`nSpQkU!^PUu$HE;2Y&|_)J*0(& z?VK!ZP`F`-bP#fJw`m??&cLzs|FHVDUQU+M(g+u%mlMj_Q(9UZhk5|f!mB3X|HG*M z6Gd8D1!ZSr>j^}~B{?R^0&&dEf5rJPV`OLLY5NaS$8E}nLm2*rXxKTSJpEiz;6HyQ z?CNaupwdti2T}bC(zEkN0SQqFc?A_ycbx6UzibA&s=(UL5rx|ru1hanz-I%)5kOT@ K6HzX29{N8&t~F-> literal 0 HcmV?d00001 From 811723555118c4a110f72b6be0a9fd125c438014 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sun, 10 Jan 2021 13:55:59 +0200 Subject: [PATCH 129/230] Updated user default status --- app/controllers/api/account.php | 2 +- app/controllers/api/users.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index fd06fc0eaf..c28dd19e33 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -674,7 +674,7 @@ App::get('/v1/account/prefs') /** @var Appwrite\Utopia\Response $response */ /** @var Appwrite\Database\Document $user */ - $prefs = $user->getAttribute('prefs', new \stdClass); + $prefs = $user->getAttribute('prefs', new \stdClass()); $response->dynamic(new Document($prefs), Response::MODEL_ANY); }); diff --git a/app/controllers/api/users.php b/app/controllers/api/users.php index 90c232b21c..9b124e0a90 100644 --- a/app/controllers/api/users.php +++ b/app/controllers/api/users.php @@ -165,7 +165,7 @@ App::get('/v1/users/:userId/prefs') throw new Exception('User not found', 404); } - $prefs = $user->getAttribute('prefs', ''); + $prefs = $user->getAttribute('prefs', new \stdClass()); $response->dynamic(new Document($prefs), Response::MODEL_ANY); }); From 372191036333b6395b813a936d3def2ec0c6901d Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sun, 10 Jan 2021 13:56:11 +0200 Subject: [PATCH 130/230] Updated empty response result --- src/Appwrite/Utopia/Response.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Appwrite/Utopia/Response.php b/src/Appwrite/Utopia/Response.php index ce22df225e..1010e237c2 100644 --- a/src/Appwrite/Utopia/Response.php +++ b/src/Appwrite/Utopia/Response.php @@ -39,6 +39,7 @@ use Appwrite\Utopia\Response\Model\Tag; use Appwrite\Utopia\Response\Model\Task; use Appwrite\Utopia\Response\Model\Token; use Appwrite\Utopia\Response\Model\Webhook; +use stdClass; /** * @method public function setStatusCode(int $code = 200): Response @@ -257,8 +258,7 @@ class Response extends SwooleResponse $item = self::getFilter()->parse($output, $model); } - $this->json($output); - + $this->json(!empty($output) ? $output : new stdClass()); } /** From 59c8ae731b375bd80a58ead6f0bf850e90aab739 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sun, 10 Jan 2021 13:56:48 +0200 Subject: [PATCH 131/230] Added missing test --- tests/e2e/Services/Users/UsersBase.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/tests/e2e/Services/Users/UsersBase.php b/tests/e2e/Services/Users/UsersBase.php index 14805273e6..ebefa2abb9 100644 --- a/tests/e2e/Services/Users/UsersBase.php +++ b/tests/e2e/Services/Users/UsersBase.php @@ -125,12 +125,12 @@ trait UsersBase /** * @depends testGetUser */ - public function testUpdateUserPrefs(array $data):array + public function testUpdateAndGetUserPrefs(array $data):array { /** * Test for SUCCESS */ - $user = $this->client->call(Client::METHOD_PATCH, '/users/' . $data['userId'] . '/prefs', array_merge([ + $user = $this->client->call(Client::METHOD_PATCH, '/users/'.$data['userId'].'/prefs', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ @@ -144,6 +144,17 @@ trait UsersBase $this->assertEquals($user['body']['funcKey1'], 'funcValue1'); $this->assertEquals($user['body']['funcKey2'], 'funcValue2'); + $user = $this->client->call(Client::METHOD_GET, '/users/'.$data['userId'].'/prefs', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders())); + + $this->assertEquals($user['headers']['status-code'], 200); + $this->assertEquals($user['body'], [ + 'funcKey1' => 'funcValue1', + 'funcKey2' => 'funcValue2', + ]); + /** * Test for FAILURE */ From 901db844a9a066b6feacc9f5a5546f94985aaa77 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sun, 10 Jan 2021 14:49:18 +0200 Subject: [PATCH 132/230] Fixed bug --- app/views/console/keys/index.phtml | 2 +- public/dist/scripts/app-all.js | 4 ++-- public/dist/scripts/app.js | 4 ++-- public/scripts/views/forms/select-all.js | 6 ++++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/app/views/console/keys/index.phtml b/app/views/console/keys/index.phtml index cb605e406d..c0c7f1216f 100644 --- a/app/views/console/keys/index.phtml +++ b/app/views/console/keys/index.phtml @@ -57,7 +57,7 @@ $scopes = $this->getParam('scopes', []);

$scope) : ?>
-   +  
diff --git a/public/dist/scripts/app-all.js b/public/dist/scripts/app-all.js index 7f9841bb91..6db3918c64 100644 --- a/public/dist/scripts/app-all.js +++ b/public/dist/scripts/app-all.js @@ -2330,8 +2330,8 @@ var variations={digits:/\d/.test(password),lower:/[a-z]/.test(password),upper:/[ score+=(variationCount-1)*10;return parseInt(score);};var callback=function(){var score=calc(this.value);if(""===this.value)return(meter.className="password-meter");if(score>60)return(meter.className="password-meter strong");if(score>30)return(meter.className="password-meter medium");if(score>=0)return(meter.className="password-meter weak");};var meter=window.document.createElement("div");meter.className="password-meter";element.parentNode.insertBefore(meter,element.nextSibling);element.addEventListener("change",callback);element.addEventListener("keypress",callback);element.addEventListener("keyup",callback);element.addEventListener("keydown",callback);}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-forms-pell",controller:function(element,window,document,markdown,rtl){var div=document.createElement("div");element.className="pell hide";div.className="input pell";element.parentNode.insertBefore(div,element);element.tabIndex=-1;var turndownService=new TurndownService();turndownService.addRule("underline",{filter:["u"],replacement:function(content){return"__"+content+"__";}});var editor=window.pell.init({element:div,onChange:function onChange(html){alignText();element.value=turndownService.turndown(html);},defaultParagraphSeparator:"p",actions:[{name:"bold",icon:''},{name:"underline",icon:''},{name:"italic",icon:''},{name:"olist",icon:''},{name:"ulist",icon:''},{name:"link",icon:''}]});var clean=function(e){e.stopPropagation();e.preventDefault();var clipboardData=e.clipboardData||window.clipboardData;console.log(clipboardData.getData("Text"));window.pell.exec("insertText",clipboardData.getData("Text"));return true;};var alignText=function(){let paragraphs=editor.content.querySelectorAll('p,li');let last='';for(let paragraph of paragraphs){var content=paragraph.textContent;if(content.trim()===''){content=last.textContent;} if(rtl.isRTL(content)){paragraph.style.direction='rtl';paragraph.style.textAlign='right';} else{paragraph.style.direction='ltr';paragraph.style.textAlign='left';} -last=paragraph;}};var santize=function(e){clean(e);alignText(e);};element.addEventListener("change",function(){editor.content.innerHTML=markdown.render(element.value);alignText();});editor.content.setAttribute("placeholder",element.placeholder);editor.content.innerHTML=markdown.render(element.value);editor.content.tabIndex=0;alignText();editor.content.onkeydown=function preventTab(event){if(event.which===9){event.preventDefault();if(document.activeElement){var focussable=Array.prototype.filter.call(document.querySelectorAll('a:not([disabled]), button:not([disabled]), select:not([disabled]), input[type=text]:not([disabled]), input[type=checkbox]:not([disabled]), [tabindex]:not([disabled]):not([tabindex="-1"])'),function(element){return(element.offsetWidth>0||element.offsetHeight>0||element===document.activeElement);});var index=focussable.indexOf(document.activeElement);if(index>-1){if(event.shiftKey){var prevElement=focussable[index-1]||focussable[focussable.length-1];prevElement.focus();}else{var nextElement=focussable[index+1]||focussable[0];nextElement.focus();}}}}};div.addEventListener("paste",santize);div.addEventListener("drop",santize);}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-forms-remove",controller:function(element){Array.prototype.slice.call(element.querySelectorAll("[data-remove]")).map(function(obj){obj.addEventListener("click",function(){element.parentNode.removeChild(element);});});}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-forms-run",repeat:false,controller:function(element,expression,container){let action=expression.parse(element.dataset["formsRun"]||'');element.addEventListener('click',function(){return container.path(action)();});}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-forms-select-all",controller:function(element){let select=document.createElement("button");let unselect=document.createElement("button");select.textContent='Select All';unselect.textContent='Unselect All';select.classList.add('link');select.classList.add('margin-top-tiny');select.classList.add('margin-start-small');select.classList.add('text-size-small');select.classList.add('pull-end');unselect.classList.add('link');unselect.classList.add('margin-top-tiny');unselect.classList.add('margin-start-small');unselect.classList.add('text-size-small');unselect.classList.add('pull-end');select.type='button';unselect.type='button';element.parentNode.insertBefore(select,element);element.parentNode.insertBefore(unselect,element);select.addEventListener('click',function(){let checkboxes=document.querySelectorAll("input[type='checkbox']");for(var i=0;i0||element.offsetHeight>0||element===document.activeElement);});var index=focussable.indexOf(document.activeElement);if(index>-1){if(event.shiftKey){var prevElement=focussable[index-1]||focussable[focussable.length-1];prevElement.focus();}else{var nextElement=focussable[index+1]||focussable[0];nextElement.focus();}}}}};div.addEventListener("paste",santize);div.addEventListener("drop",santize);}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-forms-remove",controller:function(element){Array.prototype.slice.call(element.querySelectorAll("[data-remove]")).map(function(obj){obj.addEventListener("click",function(){element.parentNode.removeChild(element);});});}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-forms-run",repeat:false,controller:function(element,expression,container){let action=expression.parse(element.dataset["formsRun"]||'');element.addEventListener('click',function(){return container.path(action)();});}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-forms-select-all",controller:function(element){let select=document.createElement("button");let unselect=document.createElement("button");select.textContent='Select All';unselect.textContent='Unselect All';select.classList.add('link');select.classList.add('margin-top-tiny');select.classList.add('margin-start-small');select.classList.add('text-size-small');select.classList.add('pull-end');unselect.classList.add('link');unselect.classList.add('margin-top-tiny');unselect.classList.add('margin-start-small');unselect.classList.add('text-size-small');unselect.classList.add('pull-end');select.type='button';unselect.type='button';element.parentNode.insertBefore(select,element);element.parentNode.insertBefore(unselect,element);select.addEventListener('click',function(){let checkboxes=element.querySelectorAll("input[type='checkbox']");for(var i=0;i0){array.push(add.value);add.value="";element.value=JSON.stringify(array);check();if(event.key!=="Tab"){event.preventDefault();}} if((event.key==="Backspace"||event.key==="Delete")&&add.value===""){array.splice(-1,1);element.value=JSON.stringify(array);check();} diff --git a/public/dist/scripts/app.js b/public/dist/scripts/app.js index aaf4d119b9..93dad8c00d 100644 --- a/public/dist/scripts/app.js +++ b/public/dist/scripts/app.js @@ -375,8 +375,8 @@ var variations={digits:/\d/.test(password),lower:/[a-z]/.test(password),upper:/[ score+=(variationCount-1)*10;return parseInt(score);};var callback=function(){var score=calc(this.value);if(""===this.value)return(meter.className="password-meter");if(score>60)return(meter.className="password-meter strong");if(score>30)return(meter.className="password-meter medium");if(score>=0)return(meter.className="password-meter weak");};var meter=window.document.createElement("div");meter.className="password-meter";element.parentNode.insertBefore(meter,element.nextSibling);element.addEventListener("change",callback);element.addEventListener("keypress",callback);element.addEventListener("keyup",callback);element.addEventListener("keydown",callback);}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-forms-pell",controller:function(element,window,document,markdown,rtl){var div=document.createElement("div");element.className="pell hide";div.className="input pell";element.parentNode.insertBefore(div,element);element.tabIndex=-1;var turndownService=new TurndownService();turndownService.addRule("underline",{filter:["u"],replacement:function(content){return"__"+content+"__";}});var editor=window.pell.init({element:div,onChange:function onChange(html){alignText();element.value=turndownService.turndown(html);},defaultParagraphSeparator:"p",actions:[{name:"bold",icon:''},{name:"underline",icon:''},{name:"italic",icon:''},{name:"olist",icon:''},{name:"ulist",icon:''},{name:"link",icon:''}]});var clean=function(e){e.stopPropagation();e.preventDefault();var clipboardData=e.clipboardData||window.clipboardData;console.log(clipboardData.getData("Text"));window.pell.exec("insertText",clipboardData.getData("Text"));return true;};var alignText=function(){let paragraphs=editor.content.querySelectorAll('p,li');let last='';for(let paragraph of paragraphs){var content=paragraph.textContent;if(content.trim()===''){content=last.textContent;} if(rtl.isRTL(content)){paragraph.style.direction='rtl';paragraph.style.textAlign='right';} else{paragraph.style.direction='ltr';paragraph.style.textAlign='left';} -last=paragraph;}};var santize=function(e){clean(e);alignText(e);};element.addEventListener("change",function(){editor.content.innerHTML=markdown.render(element.value);alignText();});editor.content.setAttribute("placeholder",element.placeholder);editor.content.innerHTML=markdown.render(element.value);editor.content.tabIndex=0;alignText();editor.content.onkeydown=function preventTab(event){if(event.which===9){event.preventDefault();if(document.activeElement){var focussable=Array.prototype.filter.call(document.querySelectorAll('a:not([disabled]), button:not([disabled]), select:not([disabled]), input[type=text]:not([disabled]), input[type=checkbox]:not([disabled]), [tabindex]:not([disabled]):not([tabindex="-1"])'),function(element){return(element.offsetWidth>0||element.offsetHeight>0||element===document.activeElement);});var index=focussable.indexOf(document.activeElement);if(index>-1){if(event.shiftKey){var prevElement=focussable[index-1]||focussable[focussable.length-1];prevElement.focus();}else{var nextElement=focussable[index+1]||focussable[0];nextElement.focus();}}}}};div.addEventListener("paste",santize);div.addEventListener("drop",santize);}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-forms-remove",controller:function(element){Array.prototype.slice.call(element.querySelectorAll("[data-remove]")).map(function(obj){obj.addEventListener("click",function(){element.parentNode.removeChild(element);});});}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-forms-run",repeat:false,controller:function(element,expression,container){let action=expression.parse(element.dataset["formsRun"]||'');element.addEventListener('click',function(){return container.path(action)();});}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-forms-select-all",controller:function(element){let select=document.createElement("button");let unselect=document.createElement("button");select.textContent='Select All';unselect.textContent='Unselect All';select.classList.add('link');select.classList.add('margin-top-tiny');select.classList.add('margin-start-small');select.classList.add('text-size-small');select.classList.add('pull-end');unselect.classList.add('link');unselect.classList.add('margin-top-tiny');unselect.classList.add('margin-start-small');unselect.classList.add('text-size-small');unselect.classList.add('pull-end');select.type='button';unselect.type='button';element.parentNode.insertBefore(select,element);element.parentNode.insertBefore(unselect,element);select.addEventListener('click',function(){let checkboxes=document.querySelectorAll("input[type='checkbox']");for(var i=0;i0||element.offsetHeight>0||element===document.activeElement);});var index=focussable.indexOf(document.activeElement);if(index>-1){if(event.shiftKey){var prevElement=focussable[index-1]||focussable[focussable.length-1];prevElement.focus();}else{var nextElement=focussable[index+1]||focussable[0];nextElement.focus();}}}}};div.addEventListener("paste",santize);div.addEventListener("drop",santize);}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-forms-remove",controller:function(element){Array.prototype.slice.call(element.querySelectorAll("[data-remove]")).map(function(obj){obj.addEventListener("click",function(){element.parentNode.removeChild(element);});});}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-forms-run",repeat:false,controller:function(element,expression,container){let action=expression.parse(element.dataset["formsRun"]||'');element.addEventListener('click',function(){return container.path(action)();});}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-forms-select-all",controller:function(element){let select=document.createElement("button");let unselect=document.createElement("button");select.textContent='Select All';unselect.textContent='Unselect All';select.classList.add('link');select.classList.add('margin-top-tiny');select.classList.add('margin-start-small');select.classList.add('text-size-small');select.classList.add('pull-end');unselect.classList.add('link');unselect.classList.add('margin-top-tiny');unselect.classList.add('margin-start-small');unselect.classList.add('text-size-small');unselect.classList.add('pull-end');select.type='button';unselect.type='button';element.parentNode.insertBefore(select,element);element.parentNode.insertBefore(unselect,element);select.addEventListener('click',function(){let checkboxes=element.querySelectorAll("input[type='checkbox']");for(var i=0;i0){array.push(add.value);add.value="";element.value=JSON.stringify(array);check();if(event.key!=="Tab"){event.preventDefault();}} if((event.key==="Backspace"||event.key==="Delete")&&add.value===""){array.splice(-1,1);element.value=JSON.stringify(array);check();} diff --git a/public/scripts/views/forms/select-all.js b/public/scripts/views/forms/select-all.js index 57263f2dcd..256b6dc931 100644 --- a/public/scripts/views/forms/select-all.js +++ b/public/scripts/views/forms/select-all.js @@ -31,18 +31,20 @@ element.parentNode.insertBefore(unselect, element); select.addEventListener('click', function () { - let checkboxes = document.querySelectorAll("input[type='checkbox']"); + let checkboxes = element.querySelectorAll("input[type='checkbox']"); for(var i = 0; i < checkboxes.length; i++) { checkboxes[i].checked = true; + checkboxes[i].dispatchEvent(new Event('change')); } }) unselect.addEventListener('click', function () { - let checkboxes = document.querySelectorAll("input[type='checkbox']"); + let checkboxes = element.querySelectorAll("input[type='checkbox']"); for(var i = 0; i < checkboxes.length; i++) { checkboxes[i].checked = false; + checkboxes[i].dispatchEvent(new Event('change')); } }) From 87b973a6b8bc133127c268c9fff78aa67fcc6ac0 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sun, 10 Jan 2021 18:50:17 +0200 Subject: [PATCH 133/230] Updated dart package URL --- app/config/platforms.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/config/platforms.php b/app/config/platforms.php index eb468cfde7..6cd066f3ea 100644 --- a/app/config/platforms.php +++ b/app/config/platforms.php @@ -272,7 +272,7 @@ return [ 'name' => 'Dart', 'version' => '0.1.0', 'url' => 'https://github.com/appwrite/sdk-for-dart', - 'package' => '', + 'package' => 'https://pub.dev/packages/dart_appwrite', 'enabled' => true, 'beta' => true, 'dev' => true, From e772d84f92ff38fdcc7f50139e4f879e2ec94a1c Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sun, 10 Jan 2021 23:02:36 +0200 Subject: [PATCH 134/230] Updated docs --- docs/services/account.md | 5 ++++- docs/services/users.md | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/services/account.md b/docs/services/account.md index 0251765299..94085b1d8d 100644 --- a/docs/services/account.md +++ b/docs/services/account.md @@ -2,4 +2,7 @@ The Account service allows you to authenticate and manage a user account. You ca You can authenticate the user account by using multiple sign-in methods available. Once the user is authenticated, a new session object will be created to allow the user to access his or her private data and settings. -This service also exposes an endpoint to save and read the [user preferences](/docs/client/account#updatePrefs) as a key-value object. This feature is handy if you want to allow extra customization in your app. Common usage for this feature may include saving the user preferred locale, timezone, or custom app theme. \ No newline at end of file +This service also exposes an endpoint to save and read the [user preferences](/docs/client/account#updatePrefs) as a key-value object. This feature is handy if you want to allow extra customization in your app. Common usage for this feature may include saving the user preferred locale, timezone, or custom app theme. + +> ## Account API vs Users API +> While the Account API operates in the scope of the current logged in user and usually using a client-side integration, the Users API is integrated from the server-side and operates in an admin scope with access to all your project users. \ No newline at end of file diff --git a/docs/services/users.md b/docs/services/users.md index 06c799aa2c..e1dec36756 100644 --- a/docs/services/users.md +++ b/docs/services/users.md @@ -1 +1,4 @@ -The Users service allows you to manage your project users. Use this service to search, block, and view your users' info, current sessions, and latest activity logs. You can also use the Users service to edit your users' preferences and personal info. \ No newline at end of file +The Users service allows you to manage your project users. Use this service to search, block, and view your users' info, current sessions, and latest activity logs. You can also use the Users service to edit your users' preferences and personal info. + +> ## Users API vs Account API +> While the Users API is integrated from the server-side and operates in an admin scope with access to all your project users, the Account API operates in the scope of the current logged in user and usually using a client-side integration. \ No newline at end of file From e5940be4d64aa221d310488d2721577eda0bf4a3 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Mon, 11 Jan 2021 15:37:15 +0200 Subject: [PATCH 135/230] Updated dotnet version --- app/config/platforms.php | 2 +- composer.json | 2 +- composer.lock | 64 ++++++++++++++++++++-------------------- 3 files changed, 34 insertions(+), 34 deletions(-) diff --git a/app/config/platforms.php b/app/config/platforms.php index 6cd066f3ea..3a45f7e7c1 100644 --- a/app/config/platforms.php +++ b/app/config/platforms.php @@ -254,7 +254,7 @@ return [ [ 'key' => 'dotnet', 'name' => '.NET', - 'version' => '0.0.2', + 'version' => '0.0.3', 'url' => 'https://github.com/appwrite/sdk-for-dotnet', 'package' => 'https://www.nuget.org/packages/Appwrite', 'enabled' => true, diff --git a/composer.json b/composer.json index 043007c735..d571e2e4fb 100644 --- a/composer.json +++ b/composer.json @@ -56,7 +56,7 @@ }, "require-dev": { "swoole/ide-helper": "4.5.5", - "appwrite/sdk-generator": "0.4.3", + "appwrite/sdk-generator": "0.4.4", "phpunit/phpunit": "9.4.2", "vimeo/psalm": "4.1.1" }, diff --git a/composer.lock b/composer.lock index 09483dbca6..723d6ac259 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "6594e4d32da0196d0bb2e5a1794ea89d", + "content-hash": "025317bd1e05b735b2c4897f9cb6db4a", "packages": [ { "name": "appwrite/php-clamav", @@ -1698,12 +1698,12 @@ "source": { "type": "git", "url": "https://github.com/amphp/amp.git", - "reference": "dbb3c28ece24b36efa91be205f6f0b015bddc27c" + "reference": "efca2b32a7580087adb8aabbff6be1dc1bb924a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/amphp/amp/zipball/dbb3c28ece24b36efa91be205f6f0b015bddc27c", - "reference": "dbb3c28ece24b36efa91be205f6f0b015bddc27c", + "url": "https://api.github.com/repos/amphp/amp/zipball/efca2b32a7580087adb8aabbff6be1dc1bb924a9", + "reference": "efca2b32a7580087adb8aabbff6be1dc1bb924a9", "shasum": "" }, "require": { @@ -1772,7 +1772,7 @@ "support": { "irc": "irc://irc.freenode.org/amphp", "issues": "https://github.com/amphp/amp/issues", - "source": "https://github.com/amphp/amp/tree/master" + "source": "https://github.com/amphp/amp/tree/v2.5.2" }, "funding": [ { @@ -1780,7 +1780,7 @@ "type": "github" } ], - "time": "2020-11-14T16:44:06+00:00" + "time": "2021-01-10T17:06:37+00:00" }, { "name": "amphp/byte-stream", @@ -1862,11 +1862,11 @@ }, { "name": "appwrite/sdk-generator", - "version": "0.4.3", + "version": "0.4.4", "source": { "type": "git", "url": "https://github.com/appwrite/sdk-generator", - "reference": "630776cfe49412e72a70a3a69729054bf8302e1f" + "reference": "ebb51e404a4e5b89f74428296b81ea347362dd33" }, "require": { "ext-curl": "*", @@ -1896,7 +1896,7 @@ } ], "description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms", - "time": "2021-01-08T11:55:04+00:00" + "time": "2021-01-11T09:34:56+00:00" }, { "name": "composer/package-versions-deprecated", @@ -2225,25 +2225,25 @@ }, { "name": "felixfbecker/advanced-json-rpc", - "version": "v3.1.1", + "version": "v3.2.0", "source": { "type": "git", "url": "https://github.com/felixfbecker/php-advanced-json-rpc.git", - "reference": "0ed363f8de17d284d479ec813c9ad3f6834b5c40" + "reference": "06f0b06043c7438959dbdeed8bb3f699a19be22e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/felixfbecker/php-advanced-json-rpc/zipball/0ed363f8de17d284d479ec813c9ad3f6834b5c40", - "reference": "0ed363f8de17d284d479ec813c9ad3f6834b5c40", + "url": "https://api.github.com/repos/felixfbecker/php-advanced-json-rpc/zipball/06f0b06043c7438959dbdeed8bb3f699a19be22e", + "reference": "06f0b06043c7438959dbdeed8bb3f699a19be22e", "shasum": "" }, "require": { "netresearch/jsonmapper": "^1.0 || ^2.0", - "php": ">=7.0", - "phpdocumentor/reflection-docblock": "^4.0.0 || ^5.0.0" + "php": "^7.1 || ^8.0", + "phpdocumentor/reflection-docblock": "^4.3.4 || ^5.0.0" }, "require-dev": { - "phpunit/phpunit": "^6.0.0" + "phpunit/phpunit": "^7.0 || ^8.0" }, "type": "library", "autoload": { @@ -2264,9 +2264,9 @@ "description": "A more advanced JSONRPC implementation", "support": { "issues": "https://github.com/felixfbecker/php-advanced-json-rpc/issues", - "source": "https://github.com/felixfbecker/php-advanced-json-rpc/tree/master" + "source": "https://github.com/felixfbecker/php-advanced-json-rpc/tree/v3.2.0" }, - "time": "2020-03-11T15:21:41+00:00" + "time": "2021-01-10T17:48:47+00:00" }, { "name": "felixfbecker/language-server-protocol", @@ -4517,12 +4517,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "da4c3663721420520b024e5aede66b813019e744" + "reference": "5ff54ffca91d307dfcb144af4748571eb9346b71" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/da4c3663721420520b024e5aede66b813019e744", - "reference": "da4c3663721420520b024e5aede66b813019e744", + "url": "https://api.github.com/repos/symfony/console/zipball/5ff54ffca91d307dfcb144af4748571eb9346b71", + "reference": "5ff54ffca91d307dfcb144af4748571eb9346b71", "shasum": "" }, "require": { @@ -4582,7 +4582,7 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Console Component", + "description": "Eases the creation of beautiful and testable command line interfaces", "homepage": "https://symfony.com", "keywords": [ "cli", @@ -4607,7 +4607,7 @@ "type": "tidelift" } ], - "time": "2021-01-05T20:16:44+00:00" + "time": "2021-01-11T06:08:00+00:00" }, { "name": "symfony/polyfill-ctype", @@ -5107,12 +5107,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "e0d43e6e2f909287d2e4e867ca5c131a661f08ef" + "reference": "cea83947622b432b60b809d14c7b42df9f0f5823" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/e0d43e6e2f909287d2e4e867ca5c131a661f08ef", - "reference": "e0d43e6e2f909287d2e4e867ca5c131a661f08ef", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/cea83947622b432b60b809d14c7b42df9f0f5823", + "reference": "cea83947622b432b60b809d14c7b42df9f0f5823", "shasum": "" }, "require": { @@ -5180,7 +5180,7 @@ "type": "tidelift" } ], - "time": "2021-01-01T09:26:45+00:00" + "time": "2021-01-11T09:51:46+00:00" }, { "name": "symfony/string", @@ -5188,12 +5188,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "99f25957efe05db14a1aa6cff643eca0f83a952c" + "reference": "7a62495108b3dc7e749b709357ae720fccb5a39b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/99f25957efe05db14a1aa6cff643eca0f83a952c", - "reference": "99f25957efe05db14a1aa6cff643eca0f83a952c", + "url": "https://api.github.com/repos/symfony/string/zipball/7a62495108b3dc7e749b709357ae720fccb5a39b", + "reference": "7a62495108b3dc7e749b709357ae720fccb5a39b", "shasum": "" }, "require": { @@ -5237,7 +5237,7 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony String component", + "description": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way", "homepage": "https://symfony.com", "keywords": [ "grapheme", @@ -5264,7 +5264,7 @@ "type": "tidelift" } ], - "time": "2021-01-01T09:26:45+00:00" + "time": "2021-01-10T16:38:27+00:00" }, { "name": "theseer/tokenizer", From e03748e74aedd97896b7f248b924c0508791bf9a Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Mon, 11 Jan 2021 19:18:01 +0530 Subject: [PATCH 136/230] fix: output of parse was not being used --- src/Appwrite/Utopia/Response.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Appwrite/Utopia/Response.php b/src/Appwrite/Utopia/Response.php index ce22df225e..7e49df9197 100644 --- a/src/Appwrite/Utopia/Response.php +++ b/src/Appwrite/Utopia/Response.php @@ -257,7 +257,7 @@ class Response extends SwooleResponse $item = self::getFilter()->parse($output, $model); } - $this->json($output); + $this->json($item); } From dde064665bef3c8855243efe0c6277461ccb894e Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Mon, 11 Jan 2021 19:20:54 +0530 Subject: [PATCH 137/230] fix: output of parse was not being used --- src/Appwrite/Utopia/Response.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Appwrite/Utopia/Response.php b/src/Appwrite/Utopia/Response.php index 7e49df9197..23a878046c 100644 --- a/src/Appwrite/Utopia/Response.php +++ b/src/Appwrite/Utopia/Response.php @@ -252,12 +252,12 @@ class Response extends SwooleResponse { $output = $this->output($document, $model); - // If filter is set, parse the item + // If filter is set, parse the output if(self::isFilter()){ - $item = self::getFilter()->parse($output, $model); + $output = self::getFilter()->parse($output, $model); } - $this->json($item); + $this->json($output); } From 432901dfbba9e6f3e7c7dc234a66a8a56daaf3d7 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Mon, 11 Jan 2021 22:18:08 +0530 Subject: [PATCH 138/230] feat: added e2e test for response filters --- tests/e2e/General/HTTPTest.php | 37 ++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/tests/e2e/General/HTTPTest.php b/tests/e2e/General/HTTPTest.php index 46672c1a71..1282a9e480 100644 --- a/tests/e2e/General/HTTPTest.php +++ b/tests/e2e/General/HTTPTest.php @@ -149,4 +149,41 @@ class HTTPTest extends Scope unlink(realpath(__DIR__ . '/../../resources/open-api3.json')); } + + public function testResponseHeader() { + + /** + * Test without header + */ + $response = $this->client->call(Client::METHOD_GET, '/locale/continents', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => 'console', + ], $this->getHeaders())); + + $body = $response['body']; + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertEquals($body['sum'], 7); + $this->assertEquals($body['continents'][0]['name'], 'Africa'); + $this->assertEquals($body['continents'][0]['code'], 'AF'); + $this->assertEquals($body['continents'][1]['name'], 'Antarctica'); + $this->assertEquals($body['continents'][1]['code'], 'AN'); + $this->assertEquals($body['continents'][2]['name'], 'Asia'); + $this->assertEquals($body['continents'][2]['code'], 'AS'); + + /** + * Test with header + */ + $response = $this->client->call(Client::METHOD_GET, '/locale/continents', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => 'console', + 'x-appwrite-response-format' => '0.6.2' + ], $this->getHeaders())); + + $body = $response['body']; + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertEquals($body['sum'], 7); + $this->assertEquals($body['continents']['AF'], 'Africa'); + $this->assertEquals($body['continents']['AN'], 'Antarctica'); + $this->assertEquals($body['continents']['AS'], 'Asia'); + } } \ No newline at end of file From 1d80281ef712efec47de013e968486385815c9f6 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Mon, 11 Jan 2021 23:52:05 +0200 Subject: [PATCH 139/230] Disable ratelimits --- app/controllers/shared/api.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/controllers/shared/api.php b/app/controllers/shared/api.php index d64c46a2cd..4dc69b7850 100644 --- a/app/controllers/shared/api.php +++ b/app/controllers/shared/api.php @@ -1,5 +1,7 @@ check() && App::getEnv('_APP_OPTIONS_ABUSE', 'enabled') !== 'disabled') { + $isPreviliggedUser = Auth::isPreviliggedUser(Authorization::$roles); + $isAppUser = Auth::isAppUser(Authorization::$roles); + + if (($abuse->check() // Route is rate-limited + && App::getEnv('_APP_OPTIONS_ABUSE', 'enabled') !== 'disabled') // Abuse is not diabled + && (!$isAppUser && !$isPreviliggedUser)) // User is not an admin or API key + { throw new Exception('Too many requests', 429); } }, ['utopia', 'request', 'response', 'project', 'user', 'register'], 'api'); \ No newline at end of file From 62aea5205982a274e1aa5977f5ffd9323a2c25d2 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Tue, 12 Jan 2021 00:01:45 +0200 Subject: [PATCH 140/230] Added docker login --- .travis.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.travis.yml b/.travis.yml index 1eb92182f8..c395a2d73c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,6 +18,12 @@ before_install: - mkdir -p $HOME/.docker - echo '{"experimental":"enabled"}' | sudo tee $HOME/.docker/config.json - sudo service docker start + - > + if [ ! -z "${DOCKERHUB_PULL_USERNAME:-}" ]; then + set +x + echo "${DOCKERHUB_PULL_PASSWORD}" | docker login --username "${DOCKERHUB_PULL_USERNAME}" --password-stdin + set -x + fi install: - docker --version From 5b0343276eb9b071db1be9a14b65571bff4a6709 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Tue, 12 Jan 2021 00:20:29 +0200 Subject: [PATCH 141/230] Removed server abuse limits --- app/controllers/api/users.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/controllers/api/users.php b/app/controllers/api/users.php index 9b124e0a90..76e20aad98 100644 --- a/app/controllers/api/users.php +++ b/app/controllers/api/users.php @@ -418,7 +418,6 @@ App::delete('/v1/users/:userId/sessions/:sessionId') ->label('sdk.response.code', Response::STATUS_CODE_NOCONTENT) ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_NONE) - ->label('abuse-limit', 100) ->param('userId', '', new UID(), 'User unique ID.') ->param('sessionId', null, new UID(), 'User unique session ID.') ->inject('response') @@ -465,7 +464,6 @@ App::delete('/v1/users/:userId/sessions') ->label('sdk.response.code', Response::STATUS_CODE_NOCONTENT) ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_NONE) - ->label('abuse-limit', 100) ->param('userId', '', new UID(), 'User unique ID.') ->inject('response') ->inject('projectDB') @@ -509,7 +507,6 @@ App::delete('/v1/users/:userId') ->label('sdk.response.code', Response::STATUS_CODE_NOCONTENT) ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_NONE) - ->label('abuse-limit', 100) ->param('userId', '', function () {return new UID();}, 'User unique ID.') ->inject('response') ->inject('projectDB') From ac8410d22b9b9b9d40b03484a45f39fa3779a09d Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Tue, 12 Jan 2021 00:21:56 +0200 Subject: [PATCH 142/230] Added functions execution abuse limit --- app/controllers/api/functions.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index 1a21dfb02c..35a807f949 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -629,6 +629,8 @@ App::post('/v1/functions/:functionId/executions') ->label('sdk.response.code', Response::STATUS_CODE_CREATED) ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_EXECUTION) + ->label('abuse-limit', 60) + ->label('abuse-time', 60) ->param('functionId', '', new UID(), 'Function unique ID.') // ->param('async', 1, new Range(0, 1), 'Execute code asynchronously. Pass 1 for true, 0 for false. Default value is 1.', true) ->inject('response') From 86d43a32ef97655bd75141d87ec6b53c09acd3d8 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Tue, 12 Jan 2021 00:22:20 +0200 Subject: [PATCH 143/230] Added sleep time to execution test --- tests/e2e/Services/Functions/FunctionsCustomServerTest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php index 21539ace52..52d7e86445 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php @@ -530,6 +530,8 @@ class FunctionsCustomServerTest extends Scope ], ]; + sleep(20); + foreach ($envs as $key => $env) { $language = $env['language'] ?? ''; $version = $env['version'] ?? ''; From 798c902e0727b2bae0c23835c5acc85d4468b83d Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Tue, 12 Jan 2021 00:45:01 +0200 Subject: [PATCH 144/230] Changed sleep time --- tests/e2e/Services/Functions/FunctionsCustomServerTest.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php index 52d7e86445..342568c2e5 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php @@ -530,8 +530,6 @@ class FunctionsCustomServerTest extends Scope ], ]; - sleep(20); - foreach ($envs as $key => $env) { $language = $env['language'] ?? ''; $version = $env['version'] ?? ''; @@ -593,7 +591,7 @@ class FunctionsCustomServerTest extends Scope $executionId = $execution['body']['$id'] ?? ''; $this->assertEquals(201, $execution['headers']['status-code']); - sleep(20); + sleep(30); $executions = $this->client->call(Client::METHOD_GET, '/functions/'.$functionId.'/executions', array_merge([ 'content-type' => 'application/json', From 3c3a2258289b22b09e0a9bfb5ec66ea02e2e6a4a Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Tue, 12 Jan 2021 01:03:00 +0200 Subject: [PATCH 145/230] Debug failure --- tests/e2e/Services/Functions/FunctionsCustomServerTest.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php index 342568c2e5..0af53ae0d9 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php @@ -601,6 +601,11 @@ class FunctionsCustomServerTest extends Scope if($executions['body']['executions'][0]['status'] !== 'completed') { var_dump($env); var_dump($executions['body']['executions'][0]); + $stdout = ''; + $stderr = ''; + Console::execute('docker logs appwrite-worker-functions', '', $stdout, $stderr); + var_dump($stdout); + var_dump($stderr); } $this->assertEquals($executions['headers']['status-code'], 200); From 71e64e65bbe7d99bc88f1030e4e40fa5547a9bd3 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Tue, 12 Jan 2021 01:46:12 +0200 Subject: [PATCH 146/230] Added long sleep --- tests/e2e/Services/Functions/FunctionsCustomServerTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php index 0af53ae0d9..377d728e11 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php @@ -455,6 +455,7 @@ class FunctionsCustomServerTest extends Scope public function testENVS():array { + sleep(120); /** * Test for SUCCESS */ From 73f2bb025ad38a1ac338d39a56cb80876367ae78 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Tue, 12 Jan 2021 17:41:40 +0545 Subject: [PATCH 147/230] introducing new temp environment variable --- .env | 3 ++- Dockerfile | 1 + app/config/variables.php | 8 ++++++++ app/views/install/compose.phtml | 1 + docker-compose.yml | 1 + tests/resources/docker/docker-compose.yml | 1 + 6 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.env b/.env index ce43bfd853..edaf39e425 100644 --- a/.env +++ b/.env @@ -34,4 +34,5 @@ _APP_FUNCTIONS_CPUS=1 _APP_FUNCTIONS_MEMORY=128 _APP_FUNCTIONS_MEMORY_SWAP=128 _APP_MAINTENANCE_INTERVAL=86400 -_APP_SYSTEM_RESPONSE_FORMAT= \ No newline at end of file +_APP_SYSTEM_RESPONSE_FORMAT= +_APP_USAGE_STATS= \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 37ad125ee1..0017d68dcb 100755 --- a/Dockerfile +++ b/Dockerfile @@ -99,6 +99,7 @@ ENV _APP_SERVER=swoole \ _APP_FUNCTIONS_MEMORY_SWAP=128 \ _APP_SETUP=self-hosted \ _APP_VERSION=$VERSION \ + _APP_USAGE_STATS=enabled \ # 1 Day = 86400 s _APP_MAINTENANCE_INTERVAL=86400 #ENV _APP_SMTP_SECURE '' diff --git a/app/config/variables.php b/app/config/variables.php index 80dd6fdb82..eb4fb63e31 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -93,6 +93,14 @@ return [ 'required' => false, 'question' => '', ], + [ + 'name' => '_APP_USAGE_STATS', + 'description' => 'This variable allows you to disable the collection and displaying of usage stats. This value is set to \'enabled\' by default, to disable the usage stats set the value to \'disabled\'. When disabled, it\'s recommended to turn off the Worker Usage, influxdb and telegraf containers for better resource usage.', + 'introduction' => '0.7.0', + 'default' => 'enabled', + 'required' => false, + 'question' => '', + ], ], ], [ diff --git a/app/views/install/compose.phtml b/app/views/install/compose.phtml index 5d74fd8ef9..f06999ff10 100644 --- a/app/views/install/compose.phtml +++ b/app/views/install/compose.phtml @@ -76,6 +76,7 @@ services: - _APP_SMTP_SECURE - _APP_SMTP_USERNAME - _APP_SMTP_PASSWORD + - _APP_USAGE_STATS - _APP_INFLUXDB_HOST - _APP_INFLUXDB_PORT - _APP_STORAGE_LIMIT diff --git a/docker-compose.yml b/docker-compose.yml index 2acd6d3ed2..4fe2361881 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -100,6 +100,7 @@ services: - _APP_SMTP_SECURE - _APP_SMTP_USERNAME - _APP_SMTP_PASSWORD + - _APP_USAGE_STATS - _APP_INFLUXDB_HOST - _APP_INFLUXDB_PORT - _APP_STORAGE_LIMIT diff --git a/tests/resources/docker/docker-compose.yml b/tests/resources/docker/docker-compose.yml index c300ece0a6..9f4074c540 100644 --- a/tests/resources/docker/docker-compose.yml +++ b/tests/resources/docker/docker-compose.yml @@ -78,6 +78,7 @@ services: - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_USAGE_STATS - _APP_INFLUXDB_HOST - _APP_INFLUXDB_PORT - _APP_STORAGE_LIMIT From dc7e7d448a1d0a79ecd5b3349e51c16cc7c6bacb Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Tue, 12 Jan 2021 19:20:17 +0545 Subject: [PATCH 148/230] disable project stats from influxdb if usage stats is disabled --- app/controllers/api/projects.php | 137 ++++++++++++++++--------------- 1 file changed, 73 insertions(+), 64 deletions(-) diff --git a/app/controllers/api/projects.php b/app/controllers/api/projects.php index 74a26dd48a..1b66127421 100644 --- a/app/controllers/api/projects.php +++ b/app/controllers/api/projects.php @@ -176,74 +176,83 @@ App::get('/v1/projects/:projectId/usage') throw new Exception('Project not found', 404); } - $period = [ - '24h' => [ - 'start' => DateTime::createFromFormat('U', \strtotime('-24 hours')), - 'end' => DateTime::createFromFormat('U', \strtotime('+1 hour')), - 'group' => '30m', - ], - '7d' => [ - 'start' => DateTime::createFromFormat('U', \strtotime('-7 days')), - 'end' => DateTime::createFromFormat('U', \strtotime('now')), - 'group' => '1d', - ], - '30d' => [ - 'start' => DateTime::createFromFormat('U', \strtotime('-30 days')), - 'end' => DateTime::createFromFormat('U', \strtotime('now')), - 'group' => '1d', - ], - '90d' => [ - 'start' => DateTime::createFromFormat('U', \strtotime('-90 days')), - 'end' => DateTime::createFromFormat('U', \strtotime('now')), - 'group' => '1d', - ], - ]; + $appUsageStatsEnabled = App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled'; + if($appUsageStatsEnabled) { - $client = $register->get('influxdb'); - - $requests = []; - $network = []; - $functions = []; - - if ($client) { - $start = $period[$range]['start']->format(DateTime::RFC3339); - $end = $period[$range]['end']->format(DateTime::RFC3339); - $database = $client->selectDB('telegraf'); - - // Requests - $result = $database->query('SELECT sum(value) AS "value" FROM "appwrite_usage_requests_all" WHERE time > \''.$start.'\' AND time < \''.$end.'\' AND "metric_type"=\'counter\' AND "project"=\''.$project->getId().'\' GROUP BY time('.$period[$range]['group'].') FILL(null)'); - $points = $result->getPoints(); - - foreach ($points as $point) { - $requests[] = [ - 'value' => (!empty($point['value'])) ? $point['value'] : 0, - 'date' => \strtotime($point['time']), - ]; - } - - // Network - $result = $database->query('SELECT sum(value) AS "value" FROM "appwrite_usage_network_all" WHERE time > \''.$start.'\' AND time < \''.$end.'\' AND "metric_type"=\'counter\' AND "project"=\''.$project->getId().'\' GROUP BY time('.$period[$range]['group'].') FILL(null)'); - $points = $result->getPoints(); - - foreach ($points as $point) { - $network[] = [ - 'value' => (!empty($point['value'])) ? $point['value'] : 0, - 'date' => \strtotime($point['time']), - ]; - } - - // Functions - $result = $database->query('SELECT sum(value) AS "value" FROM "appwrite_usage_executions_all" WHERE time > \''.$start.'\' AND time < \''.$end.'\' AND "metric_type"=\'counter\' AND "project"=\''.$project->getId().'\' GROUP BY time('.$period[$range]['group'].') FILL(null)'); - $points = $result->getPoints(); - - foreach ($points as $point) { - $functions[] = [ - 'value' => (!empty($point['value'])) ? $point['value'] : 0, - 'date' => \strtotime($point['time']), - ]; + $period = [ + '24h' => [ + 'start' => DateTime::createFromFormat('U', \strtotime('-24 hours')), + 'end' => DateTime::createFromFormat('U', \strtotime('+1 hour')), + 'group' => '30m', + ], + '7d' => [ + 'start' => DateTime::createFromFormat('U', \strtotime('-7 days')), + 'end' => DateTime::createFromFormat('U', \strtotime('now')), + 'group' => '1d', + ], + '30d' => [ + 'start' => DateTime::createFromFormat('U', \strtotime('-30 days')), + 'end' => DateTime::createFromFormat('U', \strtotime('now')), + 'group' => '1d', + ], + '90d' => [ + 'start' => DateTime::createFromFormat('U', \strtotime('-90 days')), + 'end' => DateTime::createFromFormat('U', \strtotime('now')), + 'group' => '1d', + ], + ]; + + $client = $register->get('influxdb'); + + $requests = []; + $network = []; + $functions = []; + + if ($client) { + $start = $period[$range]['start']->format(DateTime::RFC3339); + $end = $period[$range]['end']->format(DateTime::RFC3339); + $database = $client->selectDB('telegraf'); + + // Requests + $result = $database->query('SELECT sum(value) AS "value" FROM "appwrite_usage_requests_all" WHERE time > \''.$start.'\' AND time < \''.$end.'\' AND "metric_type"=\'counter\' AND "project"=\''.$project->getId().'\' GROUP BY time('.$period[$range]['group'].') FILL(null)'); + $points = $result->getPoints(); + + foreach ($points as $point) { + $requests[] = [ + 'value' => (!empty($point['value'])) ? $point['value'] : 0, + 'date' => \strtotime($point['time']), + ]; + } + + // Network + $result = $database->query('SELECT sum(value) AS "value" FROM "appwrite_usage_network_all" WHERE time > \''.$start.'\' AND time < \''.$end.'\' AND "metric_type"=\'counter\' AND "project"=\''.$project->getId().'\' GROUP BY time('.$period[$range]['group'].') FILL(null)'); + $points = $result->getPoints(); + + foreach ($points as $point) { + $network[] = [ + 'value' => (!empty($point['value'])) ? $point['value'] : 0, + 'date' => \strtotime($point['time']), + ]; + } + + // Functions + $result = $database->query('SELECT sum(value) AS "value" FROM "appwrite_usage_executions_all" WHERE time > \''.$start.'\' AND time < \''.$end.'\' AND "metric_type"=\'counter\' AND "project"=\''.$project->getId().'\' GROUP BY time('.$period[$range]['group'].') FILL(null)'); + $points = $result->getPoints(); + + foreach ($points as $point) { + $functions[] = [ + 'value' => (!empty($point['value'])) ? $point['value'] : 0, + 'date' => \strtotime($point['time']), + ]; + } } + } else { + $requests = []; + $network = []; + $functions = []; } + // Users $projectDB->getCollection([ From 8ea9ee67c5aa175a78e24852bda8ee71d425cd2e Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Tue, 12 Jan 2021 18:36:21 +0200 Subject: [PATCH 149/230] Fix for console custom domain --- app/controllers/general.php | 7 ------- app/init.php | 11 +++++++++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index 5d29e0d43c..81b90ba29a 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -51,13 +51,6 @@ App::init(function ($utopia, $request, $response, $console, $project, $user, $lo throw new Exception('Missing or unknown project ID', 400); } - $console->setAttribute('platforms', [ // Allways allow current host - '$collection' => Database::SYSTEM_COLLECTION_PLATFORMS, - 'name' => 'Current Host', - 'type' => 'web', - 'hostname' => $request->getHostname(), - ], Document::SET_TYPE_APPEND); - $referrer = $request->getReferer(); $origin = \parse_url($request->getOrigin($referrer), PHP_URL_HOST); $protocol = \parse_url($request->getOrigin($referrer), PHP_URL_SCHEME); diff --git a/app/init.php b/app/init.php index 887cac9b23..592b8ab7a3 100644 --- a/app/init.php +++ b/app/init.php @@ -319,7 +319,14 @@ App::setResource('deletes', function($register) { }, ['register']); // Test Mock -App::setResource('clients', function($console, $project) { +App::setResource('clients', function($request, $console, $project) { + $console->setAttribute('platforms', [ // Allways allow current host + '$collection' => Database::SYSTEM_COLLECTION_PLATFORMS, + 'name' => 'Current Host', + 'type' => 'web', + 'hostname' => $request->getHostname(), + ], Document::SET_TYPE_APPEND); + /** * Get All verified client URLs for both console and current projects * + Filter for duplicated entries @@ -345,7 +352,7 @@ App::setResource('clients', function($console, $project) { })))); return $clients; -}, ['console', 'project']); +}, ['request', 'console', 'project']); App::setResource('user', function($mode, $project, $console, $request, $response, $projectDB, $consoleDB) { /** @var Utopia\Swoole\Request $request */ From 0d7bfad8a7ed2fd2584c8e2d4b63f677b657ba73 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Wed, 13 Jan 2021 06:32:36 +0545 Subject: [PATCH 150/230] usage stats env default value --- .env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env b/.env index edaf39e425..1cc5b84a31 100644 --- a/.env +++ b/.env @@ -35,4 +35,4 @@ _APP_FUNCTIONS_MEMORY=128 _APP_FUNCTIONS_MEMORY_SWAP=128 _APP_MAINTENANCE_INTERVAL=86400 _APP_SYSTEM_RESPONSE_FORMAT= -_APP_USAGE_STATS= \ No newline at end of file +_APP_USAGE_STATS=enabled \ No newline at end of file From 4534064afe61db9b1e45804ff7714efff7410566 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Wed, 13 Jan 2021 06:33:02 +0545 Subject: [PATCH 151/230] Typo fix --- app/config/variables.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/config/variables.php b/app/config/variables.php index eb4fb63e31..d713acd5bf 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -95,7 +95,7 @@ return [ ], [ 'name' => '_APP_USAGE_STATS', - 'description' => 'This variable allows you to disable the collection and displaying of usage stats. This value is set to \'enabled\' by default, to disable the usage stats set the value to \'disabled\'. When disabled, it\'s recommended to turn off the Worker Usage, influxdb and telegraf containers for better resource usage.', + 'description' => 'This variable allows you to disable the collection and displaying of usage stats. This value is set to \'enabled\' by default, to disable the usage stats set the value to \'disabled\'. When disabled, it\'s recommended to turn off the Worker Usage, Influxdb and Telegraf containers for better resource usage.', 'introduction' => '0.7.0', 'default' => 'enabled', 'required' => false, From 1fcd575f565af8d20490ad770ce43dcc49ea00aa Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Wed, 13 Jan 2021 06:50:27 +0545 Subject: [PATCH 152/230] disable displaying project usage stats if usage stats disabled --- app/controllers/web/console.php | 2 +- app/views/console/home/index.phtml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/web/console.php b/app/controllers/web/console.php index bddc8ea8bb..f11479fe88 100644 --- a/app/controllers/web/console.php +++ b/app/controllers/web/console.php @@ -122,7 +122,7 @@ App::get('/console/home') /** @var Utopia\View $layout */ $page = new View(__DIR__.'/../../views/console/home/index.phtml'); - + $page->setParam('usageStatsEnabled',App::getEnv('_APP_USAGE_STATS','enabled') == 'enabled'); $layout ->setParam('title', APP_NAME.' - Console') ->setParam('body', $page); diff --git a/app/views/console/home/index.phtml b/app/views/console/home/index.phtml index 173336728e..368b852d50 100644 --- a/app/views/console/home/index.phtml +++ b/app/views/console/home/index.phtml @@ -1,5 +1,6 @@ getParam('graph', false); +$usageStatsEnabled = $this->getParam('usageStatsEnabled',true); ?>
@@ -68,7 +69,7 @@ $graph = $this->getParam('graph', false); data-param-project-id="{{router.params.project}}" data-param-range="30d"> - +
From 8da252366d0a2007a4711195a4c7ce103ab59d46 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Wed, 13 Jan 2021 06:55:52 +0545 Subject: [PATCH 153/230] Skip functions usage getting from influx if usage stats disabled --- app/controllers/api/functions.php | 181 +++++++++++++++--------------- 1 file changed, 93 insertions(+), 88 deletions(-) diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index 1a21dfb02c..27dd759312 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -156,96 +156,101 @@ App::get('/v1/functions/:functionId/usage') if (empty($function->getId()) || Database::SYSTEM_COLLECTION_FUNCTIONS != $function->getCollection()) { throw new Exception('Function not found', 404); } - - $period = [ - '24h' => [ - 'start' => DateTime::createFromFormat('U', \strtotime('-24 hours')), - 'end' => DateTime::createFromFormat('U', \strtotime('+1 hour')), - 'group' => '30m', - ], - '7d' => [ - 'start' => DateTime::createFromFormat('U', \strtotime('-7 days')), - 'end' => DateTime::createFromFormat('U', \strtotime('now')), - 'group' => '1d', - ], - '30d' => [ - 'start' => DateTime::createFromFormat('U', \strtotime('-30 days')), - 'end' => DateTime::createFromFormat('U', \strtotime('now')), - 'group' => '1d', - ], - '90d' => [ - 'start' => DateTime::createFromFormat('U', \strtotime('-90 days')), - 'end' => DateTime::createFromFormat('U', \strtotime('now')), - 'group' => '1d', - ], - ]; - - $client = $register->get('influxdb'); - - $executions = []; - $failures = []; - $compute = []; - - if ($client) { - $start = $period[$range]['start']->format(DateTime::RFC3339); - $end = $period[$range]['end']->format(DateTime::RFC3339); - $database = $client->selectDB('telegraf'); - - // Executions - $result = $database->query('SELECT sum(value) AS "value" FROM "appwrite_usage_executions_all" WHERE time > \''.$start.'\' AND time < \''.$end.'\' AND "metric_type"=\'counter\' AND "project"=\''.$project->getId().'\' AND "functionId"=\''.$function->getId().'\' GROUP BY time('.$period[$range]['group'].') FILL(null)'); - $points = $result->getPoints(); - - foreach ($points as $point) { - $executions[] = [ - 'value' => (!empty($point['value'])) ? $point['value'] : 0, - 'date' => \strtotime($point['time']), - ]; - } - - // Failures - $result = $database->query('SELECT sum(value) AS "value" FROM "appwrite_usage_executions_all" WHERE time > \''.$start.'\' AND time < \''.$end.'\' AND "metric_type"=\'counter\' AND "project"=\''.$project->getId().'\' AND "functionId"=\''.$function->getId().'\' AND "functionStatus"=\'failed\' GROUP BY time('.$period[$range]['group'].') FILL(null)'); - $points = $result->getPoints(); - - foreach ($points as $point) { - $failures[] = [ - 'value' => (!empty($point['value'])) ? $point['value'] : 0, - 'date' => \strtotime($point['time']), - ]; - } - - // Compute - $result = $database->query('SELECT sum(value) AS "value" FROM "appwrite_usage_executions_time" WHERE time > \''.$start.'\' AND time < \''.$end.'\' AND "metric_type"=\'counter\' AND "project"=\''.$project->getId().'\' AND "functionId"=\''.$function->getId().'\' GROUP BY time('.$period[$range]['group'].') FILL(null)'); - $points = $result->getPoints(); - - foreach ($points as $point) { - $compute[] = [ - 'value' => round((!empty($point['value'])) ? $point['value'] / 1000 : 0, 2), // minutes - 'date' => \strtotime($point['time']), - ]; + //check if stats is disabled + $appUsageStatsEnabled = App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled'; + if($appUsageStatsEnabled) { + $period = [ + '24h' => [ + 'start' => DateTime::createFromFormat('U', \strtotime('-24 hours')), + 'end' => DateTime::createFromFormat('U', \strtotime('+1 hour')), + 'group' => '30m', + ], + '7d' => [ + 'start' => DateTime::createFromFormat('U', \strtotime('-7 days')), + 'end' => DateTime::createFromFormat('U', \strtotime('now')), + 'group' => '1d', + ], + '30d' => [ + 'start' => DateTime::createFromFormat('U', \strtotime('-30 days')), + 'end' => DateTime::createFromFormat('U', \strtotime('now')), + 'group' => '1d', + ], + '90d' => [ + 'start' => DateTime::createFromFormat('U', \strtotime('-90 days')), + 'end' => DateTime::createFromFormat('U', \strtotime('now')), + 'group' => '1d', + ], + ]; + + $client = $register->get('influxdb'); + + $executions = []; + $failures = []; + $compute = []; + + if ($client) { + $start = $period[$range]['start']->format(DateTime::RFC3339); + $end = $period[$range]['end']->format(DateTime::RFC3339); + $database = $client->selectDB('telegraf'); + + // Executions + $result = $database->query('SELECT sum(value) AS "value" FROM "appwrite_usage_executions_all" WHERE time > \''.$start.'\' AND time < \''.$end.'\' AND "metric_type"=\'counter\' AND "project"=\''.$project->getId().'\' AND "functionId"=\''.$function->getId().'\' GROUP BY time('.$period[$range]['group'].') FILL(null)'); + $points = $result->getPoints(); + + foreach ($points as $point) { + $executions[] = [ + 'value' => (!empty($point['value'])) ? $point['value'] : 0, + 'date' => \strtotime($point['time']), + ]; + } + + // Failures + $result = $database->query('SELECT sum(value) AS "value" FROM "appwrite_usage_executions_all" WHERE time > \''.$start.'\' AND time < \''.$end.'\' AND "metric_type"=\'counter\' AND "project"=\''.$project->getId().'\' AND "functionId"=\''.$function->getId().'\' AND "functionStatus"=\'failed\' GROUP BY time('.$period[$range]['group'].') FILL(null)'); + $points = $result->getPoints(); + + foreach ($points as $point) { + $failures[] = [ + 'value' => (!empty($point['value'])) ? $point['value'] : 0, + 'date' => \strtotime($point['time']), + ]; + } + + // Compute + $result = $database->query('SELECT sum(value) AS "value" FROM "appwrite_usage_executions_time" WHERE time > \''.$start.'\' AND time < \''.$end.'\' AND "metric_type"=\'counter\' AND "project"=\''.$project->getId().'\' AND "functionId"=\''.$function->getId().'\' GROUP BY time('.$period[$range]['group'].') FILL(null)'); + $points = $result->getPoints(); + + foreach ($points as $point) { + $compute[] = [ + 'value' => round((!empty($point['value'])) ? $point['value'] / 1000 : 0, 2), // minutes + 'date' => \strtotime($point['time']), + ]; + } } + + $response->json([ + 'range' => $range, + 'executions' => [ + 'data' => $executions, + 'total' => \array_sum(\array_map(function ($item) { + return $item['value']; + }, $executions)), + ], + 'failures' => [ + 'data' => $failures, + 'total' => \array_sum(\array_map(function ($item) { + return $item['value']; + }, $failures)), + ], + 'compute' => [ + 'data' => $compute, + 'total' => \array_sum(\array_map(function ($item) { + return $item['value']; + }, $compute)), + ], + ]); + } else { + $response->json([]); } - - $response->json([ - 'range' => $range, - 'executions' => [ - 'data' => $executions, - 'total' => \array_sum(\array_map(function ($item) { - return $item['value']; - }, $executions)), - ], - 'failures' => [ - 'data' => $failures, - 'total' => \array_sum(\array_map(function ($item) { - return $item['value']; - }, $failures)), - ], - 'compute' => [ - 'data' => $compute, - 'total' => \array_sum(\array_map(function ($item) { - return $item['value']; - }, $compute)), - ], - ]); }); App::put('/v1/functions/:functionId') From 075dd222ac6dd54c77e3958309bf16dba40712b0 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Wed, 13 Jan 2021 07:25:23 +0545 Subject: [PATCH 154/230] Function monitor view, hide stats graphs if stats disabled --- app/controllers/web/console.php | 1 + app/views/console/functions/function.phtml | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/app/controllers/web/console.php b/app/controllers/web/console.php index f11479fe88..dadda3ec13 100644 --- a/app/controllers/web/console.php +++ b/app/controllers/web/console.php @@ -390,6 +390,7 @@ App::get('/console/functions/function') ->setParam('fileLimit', App::getEnv('_APP_STORAGE_LIMIT', 0)) ->setParam('fileLimitHuman', Storage::human(App::getEnv('_APP_STORAGE_LIMIT', 0))) ->setParam('timeout', (int) App::getEnv('_APP_FUNCTIONS_TIMEOUT', 900)) + ->setParam('usageStatsEnabled',App::getEnv('_APP_USAGE_STATS','enabled') == 'enabled'); ; $layout diff --git a/app/views/console/functions/function.phtml b/app/views/console/functions/function.phtml index 2c262c5bed..e31e3eab65 100644 --- a/app/views/console/functions/function.phtml +++ b/app/views/console/functions/function.phtml @@ -3,6 +3,7 @@ $fileLimit = $this->getParam('fileLimit', 0); $fileLimitHuman = $this->getParam('fileLimitHuman', 0); $events = array_keys($this->getParam('events', [])); $timeout = $this->getParam('timeout', 900); +$usageStatsEnabled = $this->getParam('usageStatsEnabled',true); ?>
getParam('timeout', 900); data-event="load" data-name="usage" data-param-function-id="{{router.params.id}}"> +
@@ -316,6 +318,9 @@ $timeout = $this->getParam('timeout', 900);
  • Errors
+ +

Usage stats is disabled.

+
  • From f06e92436eb5afbdbd81356a42069d5d504d7b30 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Wed, 13 Jan 2021 07:44:42 +0545 Subject: [PATCH 155/230] app shutdown disable stats collection --- app/controllers/general.php | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index 5d29e0d43c..501662e938 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -316,16 +316,18 @@ App::shutdown(function ($utopia, $request, $response, $project, $events, $audits } $route = $utopia->match($request); - - if ($project->getId() - && $mode !== APP_MODE_ADMIN //TODO: add check to make sure user is admin - && !empty($route->getLabel('sdk.namespace', null))) { // Don't calculate console usage on admin mode - - $usage - ->setParam('networkRequestSize', $request->getSize() + $usage->getParam('storage')) - ->setParam('networkResponseSize', $response->getSize()) - ->trigger() - ; + $appUsageStatsEnabled = App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled'; + if($appUsageStatsEnabled) { + if ($project->getId() + && $mode !== APP_MODE_ADMIN //TODO: add check to make sure user is admin + && !empty($route->getLabel('sdk.namespace', null))) { // Don't calculate console usage on admin mode + + $usage + ->setParam('networkRequestSize', $request->getSize() + $usage->getParam('storage')) + ->setParam('networkResponseSize', $response->getSize()) + ->trigger() + ; + } } }, ['utopia', 'request', 'response', 'project', 'events', 'audits', 'usage', 'deletes', 'mode']); From 1cbca0a6a60ba08a92729d95dfb54f39f7cf1ef0 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Wed, 13 Jan 2021 11:42:15 +0545 Subject: [PATCH 156/230] disable functions stats collection if usage stats disabled --- app/views/install/compose.phtml | 1 + app/workers/functions.php | 6 ++++-- docker-compose.yml | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/views/install/compose.phtml b/app/views/install/compose.phtml index f06999ff10..9a2141a5c1 100644 --- a/app/views/install/compose.phtml +++ b/app/views/install/compose.phtml @@ -240,6 +240,7 @@ services: - _APP_FUNCTIONS_CPUS - _APP_FUNCTIONS_MEMORY - _APP_FUNCTIONS_MEMORY_SWAP + - _APP_USAGE_STATS appwrite-worker-mails: image: appwrite/appwrite: diff --git a/app/workers/functions.php b/app/workers/functions.php index ab43914078..51a18865ec 100644 --- a/app/workers/functions.php +++ b/app/workers/functions.php @@ -470,8 +470,10 @@ class FunctionsV1 ->setParam('networkRequestSize', 0) ->setParam('networkResponseSize', 0) ; - - $usage->trigger(); + $appUsageStatsEnabled = App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled'; + if($appUsageStatsEnabled) { + $usage->trigger(); + } $this->cleanup(); } diff --git a/docker-compose.yml b/docker-compose.yml index 4fe2361881..83024b8296 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -293,6 +293,7 @@ services: - _APP_FUNCTIONS_CPUS - _APP_FUNCTIONS_MEMORY - _APP_FUNCTIONS_MEMORY_SWAP + - _APP_USAGE_STATS appwrite-worker-mails: entrypoint: worker-mails From 68593f55b7f67ee130c1663866cc4b42a7081910 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Wed, 13 Jan 2021 11:57:57 +0545 Subject: [PATCH 157/230] remove extra space --- app/views/console/functions/function.phtml | 2 +- app/views/console/home/index.phtml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/console/functions/function.phtml b/app/views/console/functions/function.phtml index e31e3eab65..dab40a4d91 100644 --- a/app/views/console/functions/function.phtml +++ b/app/views/console/functions/function.phtml @@ -282,7 +282,7 @@ $usageStatsEnabled = $this->getParam('usageStatsEnabled',true); data-event="load" data-name="usage" data-param-function-id="{{router.params.id}}"> - +
    diff --git a/app/views/console/home/index.phtml b/app/views/console/home/index.phtml index 368b852d50..0fc6838eb6 100644 --- a/app/views/console/home/index.phtml +++ b/app/views/console/home/index.phtml @@ -69,7 +69,7 @@ $usageStatsEnabled = $this->getParam('usageStatsEnabled',true); data-param-project-id="{{router.params.project}}" data-param-range="30d"> - +
    From f812437dae884d06dbc86f9a1cc5add400cddaa3 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Wed, 13 Jan 2021 11:59:25 +0545 Subject: [PATCH 158/230] refactoring to use existing conditional --- app/controllers/general.php | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index 501662e938..7e053afb74 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -316,18 +316,16 @@ App::shutdown(function ($utopia, $request, $response, $project, $events, $audits } $route = $utopia->match($request); - $appUsageStatsEnabled = App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled'; - if($appUsageStatsEnabled) { - if ($project->getId() - && $mode !== APP_MODE_ADMIN //TODO: add check to make sure user is admin - && !empty($route->getLabel('sdk.namespace', null))) { // Don't calculate console usage on admin mode - - $usage - ->setParam('networkRequestSize', $request->getSize() + $usage->getParam('storage')) - ->setParam('networkResponseSize', $response->getSize()) - ->trigger() - ; - } + if (App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled' + && $project->getId() + && $mode !== APP_MODE_ADMIN //TODO: add check to make sure user is admin + && !empty($route->getLabel('sdk.namespace', null))) { // Don't calculate console usage on admin mode + + $usage + ->setParam('networkRequestSize', $request->getSize() + $usage->getParam('storage')) + ->setParam('networkResponseSize', $response->getSize()) + ->trigger() + ; } }, ['utopia', 'request', 'response', 'project', 'events', 'audits', 'usage', 'deletes', 'mode']); From d345aac92fd1d15c0805f7fb58a51d42a8fe3a70 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Wed, 13 Jan 2021 12:00:32 +0545 Subject: [PATCH 159/230] disabling monitors tab completely --- app/views/console/functions/function.phtml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/views/console/functions/function.phtml b/app/views/console/functions/function.phtml index dab40a4d91..e1203dd027 100644 --- a/app/views/console/functions/function.phtml +++ b/app/views/console/functions/function.phtml @@ -241,6 +241,7 @@ $usageStatsEnabled = $this->getParam('usageStatsEnabled',true);
  • +
  • getParam('usageStatsEnabled',true); data-event="load" data-name="usage" data-param-function-id="{{router.params.id}}"> -
    @@ -318,11 +318,9 @@ $usageStatsEnabled = $this->getParam('usageStatsEnabled',true);
    • Errors
    - -

    Usage stats is disabled.

    -
  • +
  • From 379ce3abceb3e026b1e6267b063f3a6a9247970a Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Wed, 13 Jan 2021 12:10:43 +0545 Subject: [PATCH 160/230] refactoring with suggested updates --- app/controllers/api/functions.php | 5 ++--- app/controllers/api/projects.php | 3 +-- app/controllers/web/console.php | 3 ++- app/workers/functions.php | 4 ++-- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index 27dd759312..bad97b3971 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -156,9 +156,8 @@ App::get('/v1/functions/:functionId/usage') if (empty($function->getId()) || Database::SYSTEM_COLLECTION_FUNCTIONS != $function->getCollection()) { throw new Exception('Function not found', 404); } - //check if stats is disabled - $appUsageStatsEnabled = App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled'; - if($appUsageStatsEnabled) { + + if($App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled') { $period = [ '24h' => [ 'start' => DateTime::createFromFormat('U', \strtotime('-24 hours')), diff --git a/app/controllers/api/projects.php b/app/controllers/api/projects.php index 1b66127421..1d8e18d00c 100644 --- a/app/controllers/api/projects.php +++ b/app/controllers/api/projects.php @@ -176,8 +176,7 @@ App::get('/v1/projects/:projectId/usage') throw new Exception('Project not found', 404); } - $appUsageStatsEnabled = App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled'; - if($appUsageStatsEnabled) { + if($App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled') { $period = [ '24h' => [ diff --git a/app/controllers/web/console.php b/app/controllers/web/console.php index dadda3ec13..b8fc5a621e 100644 --- a/app/controllers/web/console.php +++ b/app/controllers/web/console.php @@ -122,7 +122,8 @@ App::get('/console/home') /** @var Utopia\View $layout */ $page = new View(__DIR__.'/../../views/console/home/index.phtml'); - $page->setParam('usageStatsEnabled',App::getEnv('_APP_USAGE_STATS','enabled') == 'enabled'); + $page + ->setParam('usageStatsEnabled',App::getEnv('_APP_USAGE_STATS','enabled') == 'enabled'); $layout ->setParam('title', APP_NAME.' - Console') ->setParam('body', $page); diff --git a/app/workers/functions.php b/app/workers/functions.php index 51a18865ec..bb74bb0e60 100644 --- a/app/workers/functions.php +++ b/app/workers/functions.php @@ -470,8 +470,8 @@ class FunctionsV1 ->setParam('networkRequestSize', 0) ->setParam('networkResponseSize', 0) ; - $appUsageStatsEnabled = App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled'; - if($appUsageStatsEnabled) { + + if($App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled') { $usage->trigger(); } From 671f794403d8bfc522e75a93c1724c06d4b6ffc6 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Wed, 13 Jan 2021 12:52:28 +0545 Subject: [PATCH 161/230] Fix typo causing error --- app/controllers/api/projects.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/api/projects.php b/app/controllers/api/projects.php index 1d8e18d00c..0b22e40614 100644 --- a/app/controllers/api/projects.php +++ b/app/controllers/api/projects.php @@ -176,7 +176,7 @@ App::get('/v1/projects/:projectId/usage') throw new Exception('Project not found', 404); } - if($App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled') { + if(App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled') { $period = [ '24h' => [ From 5ed2eea208b71fe206338ff69be31b2a16ef8702 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Wed, 13 Jan 2021 16:11:07 +0200 Subject: [PATCH 162/230] Changed role names --- src/Appwrite/Auth/Auth.php | 14 +++++++------- tests/e2e/Services/Database/DatabaseBase.php | 4 ++-- .../Services/Database/DatabaseCustomServerTest.php | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Appwrite/Auth/Auth.php b/src/Appwrite/Auth/Auth.php index 88eb11299d..e1a933ee76 100644 --- a/src/Appwrite/Auth/Auth.php +++ b/src/Appwrite/Auth/Auth.php @@ -16,13 +16,13 @@ class Auth /** * User Roles. */ - const USER_ROLE_GUEST = 0; - const USER_ROLE_MEMBER = 1; - const USER_ROLE_ADMIN = 2; - const USER_ROLE_DEVELOPER = 3; - const USER_ROLE_OWNER = 4; - const USER_ROLE_APP = 5; - const USER_ROLE_SYSTEM = 6; + const USER_ROLE_GUEST = 'guest'; + const USER_ROLE_MEMBER = 'member'; + const USER_ROLE_ADMIN = 'admin'; + const USER_ROLE_DEVELOPER = 'developer'; + const USER_ROLE_OWNER = 'owner'; + const USER_ROLE_APP = 'app'; + const USER_ROLE_SYSTEM = 'system'; /** * Token Types. diff --git a/tests/e2e/Services/Database/DatabaseBase.php b/tests/e2e/Services/Database/DatabaseBase.php index f769184827..8285cb2076 100644 --- a/tests/e2e/Services/Database/DatabaseBase.php +++ b/tests/e2e/Services/Database/DatabaseBase.php @@ -18,7 +18,7 @@ trait DatabaseBase ]), [ 'name' => 'Actors', 'read' => ['*'], - 'write' => ['role:1', 'role:2'], + 'write' => ['role:member', 'role:admin'], 'rules' => [ [ 'label' => 'First Name', @@ -55,7 +55,7 @@ trait DatabaseBase ]), [ 'name' => 'Movies', 'read' => ['*'], - 'write' => ['role:1', 'role:2'], + 'write' => ['role:member', 'role:admin'], 'rules' => [ [ 'label' => 'Name', diff --git a/tests/e2e/Services/Database/DatabaseCustomServerTest.php b/tests/e2e/Services/Database/DatabaseCustomServerTest.php index 2f0bdfc766..3bb9c3e82d 100644 --- a/tests/e2e/Services/Database/DatabaseCustomServerTest.php +++ b/tests/e2e/Services/Database/DatabaseCustomServerTest.php @@ -27,7 +27,7 @@ class DatabaseCustomServerTest extends Scope ]), [ 'name' => 'Actors', 'read' => ['*'], - 'write' => ['role:1', 'role:2'], + 'write' => ['role:member', 'role:admin'], 'rules' => [ [ 'label' => 'First Name', From 764672e15e8c3a4c0c3891d620d293e1ead9045c Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Wed, 13 Jan 2021 17:06:36 +0200 Subject: [PATCH 163/230] Updated default values --- src/Appwrite/Utopia/Response/Model/Collection.php | 5 +++++ src/Appwrite/Utopia/Response/Model/Continent.php | 2 ++ src/Appwrite/Utopia/Response/Model/Country.php | 2 ++ src/Appwrite/Utopia/Response/Model/Currency.php | 7 +++++++ src/Appwrite/Utopia/Response/Model/Domain.php | 5 +++++ src/Appwrite/Utopia/Response/Model/Error.php | 3 +++ src/Appwrite/Utopia/Response/Model/ErrorDev.php | 3 +++ src/Appwrite/Utopia/Response/Model/Execution.php | 9 +++++++++ src/Appwrite/Utopia/Response/Model/File.php | 7 +++++++ src/Appwrite/Utopia/Response/Model/Func.php | 11 +++++++++-- src/Appwrite/Utopia/Response/Model/Key.php | 3 +++ src/Appwrite/Utopia/Response/Model/Language.php | 3 +++ src/Appwrite/Utopia/Response/Model/Locale.php | 6 ++++++ src/Appwrite/Utopia/Response/Model/Log.php | 3 +++ src/Appwrite/Utopia/Response/Model/Membership.php | 6 ++++++ src/Appwrite/Utopia/Response/Model/Permissions.php | 2 ++ src/Appwrite/Utopia/Response/Model/Phone.php | 3 +++ src/Appwrite/Utopia/Response/Model/Platform.php | 5 +++++ src/Appwrite/Utopia/Response/Model/Project.php | 2 ++ src/Appwrite/Utopia/Response/Model/Rule.php | 8 +++++++- src/Appwrite/Utopia/Response/Model/Session.php | 1 + src/Appwrite/Utopia/Response/Model/Tag.php | 5 +++++ src/Appwrite/Utopia/Response/Model/Task.php | 7 +++++++ src/Appwrite/Utopia/Response/Model/Team.php | 3 +++ src/Appwrite/Utopia/Response/Model/Token.php | 4 +++- src/Appwrite/Utopia/Response/Model/User.php | 5 +++++ src/Appwrite/Utopia/Response/Model/Webhook.php | 4 ++++ 27 files changed, 120 insertions(+), 4 deletions(-) diff --git a/src/Appwrite/Utopia/Response/Model/Collection.php b/src/Appwrite/Utopia/Response/Model/Collection.php index 1fce01bbbe..9b1f184b97 100644 --- a/src/Appwrite/Utopia/Response/Model/Collection.php +++ b/src/Appwrite/Utopia/Response/Model/Collection.php @@ -13,27 +13,32 @@ class Collection extends Model ->addRule('$id', [ 'type' => self::TYPE_STRING, 'description' => 'Collection ID.', + 'default' => '', 'example' => '5e5ea5c16897e', ]) ->addRule('$permissions', [ 'type' => Response::MODEL_PERMISSIONS, 'description' => 'Collection permissions.', + 'default' => new \stdClass, 'example' => new \stdClass, 'array' => false, ]) ->addRule('name', [ 'type' => self::TYPE_STRING, 'description' => 'Collection name.', + 'default' => '', 'example' => 'Movies', ]) ->addRule('dateCreated', [ 'type' => self::TYPE_INTEGER, 'description' => 'Collection creation date in Unix timestamp.', + 'default' => 0, 'example' => 1592981250, ]) ->addRule('dateUpdated', [ 'type' => self::TYPE_INTEGER, 'description' => 'Collection creation date in Unix timestamp.', + 'default' => 0, 'example' => 1592981550, ]) ->addRule('rules', [ diff --git a/src/Appwrite/Utopia/Response/Model/Continent.php b/src/Appwrite/Utopia/Response/Model/Continent.php index faae10c141..82948b646a 100644 --- a/src/Appwrite/Utopia/Response/Model/Continent.php +++ b/src/Appwrite/Utopia/Response/Model/Continent.php @@ -13,11 +13,13 @@ class Continent extends Model ->addRule('name', [ 'type' => self::TYPE_STRING, 'description' => 'Continent name.', + 'default' => '', 'example' => 'Europe', ]) ->addRule('code', [ 'type' => self::TYPE_STRING, 'description' => 'Continent two letter code.', + 'default' => '', 'example' => 'EU', ]) ; diff --git a/src/Appwrite/Utopia/Response/Model/Country.php b/src/Appwrite/Utopia/Response/Model/Country.php index f9b5ae8784..85ed0a2d5d 100644 --- a/src/Appwrite/Utopia/Response/Model/Country.php +++ b/src/Appwrite/Utopia/Response/Model/Country.php @@ -13,11 +13,13 @@ class Country extends Model ->addRule('name', [ 'type' => self::TYPE_STRING, 'description' => 'Country name.', + 'default' => '', 'example' => 'United States', ]) ->addRule('code', [ 'type' => self::TYPE_STRING, 'description' => 'Country two-character ISO 3166-1 alpha code.', + 'default' => '', 'example' => 'US', ]) ; diff --git a/src/Appwrite/Utopia/Response/Model/Currency.php b/src/Appwrite/Utopia/Response/Model/Currency.php index e912f2ab4d..ac5cb9d060 100644 --- a/src/Appwrite/Utopia/Response/Model/Currency.php +++ b/src/Appwrite/Utopia/Response/Model/Currency.php @@ -13,36 +13,43 @@ class Currency extends Model ->addRule('symbol', [ 'type' => self::TYPE_STRING, 'description' => 'Currency symbol.', + 'default' => '', 'example' => '$', ]) ->addRule('name', [ 'type' => self::TYPE_STRING, 'description' => 'Currency name.', + 'default' => '', 'example' => 'US dollar', ]) ->addRule('symbolNative', [ 'type' => self::TYPE_STRING, 'description' => 'Currency native symbol.', + 'default' => '', 'example' => '$', ]) ->addRule('decimalDigits', [ 'type' => self::TYPE_INTEGER, 'description' => 'Number of decimal digits.', + 'default' => 0, 'example' => 2, ]) ->addRule('rounding', [ 'type' => self::TYPE_FLOAT, 'description' => 'Currency digit rounding.', + 'default' => 0, 'example' => 0, ]) ->addRule('code', [ 'type' => self::TYPE_STRING, 'description' => 'Currency code in [ISO 4217-1](http://en.wikipedia.org/wiki/ISO_4217) three-character format.', + 'default' => '', 'example' => 'USD', ]) ->addRule('namePlural', [ 'type' => self::TYPE_STRING, 'description' => 'Currency plural name', + 'default' => '', 'example' => 'US dollars', ]) // ->addRule('locations', [ diff --git a/src/Appwrite/Utopia/Response/Model/Domain.php b/src/Appwrite/Utopia/Response/Model/Domain.php index 2e58a3053f..46aff1a567 100644 --- a/src/Appwrite/Utopia/Response/Model/Domain.php +++ b/src/Appwrite/Utopia/Response/Model/Domain.php @@ -18,26 +18,31 @@ class Domain extends Model ->addRule('$id', [ 'type' => self::TYPE_STRING, 'description' => 'Domain ID.', + 'default' => '', 'example' => '5e5ea5c16897e', ]) ->addRule('domain', [ 'type' => self::TYPE_STRING, 'description' => 'Domain name.', + 'default' => '', 'example' => 'appwrite.company.com', ]) ->addRule('registerable', [ 'type' => self::TYPE_STRING, 'description' => 'Registerable domain name.', + 'default' => '', 'example' => 'company.com', ]) ->addRule('tld', [ 'type' => self::TYPE_STRING, 'description' => 'TLD name.', + 'default' => '', 'example' => 'com', ]) ->addRule('verification', [ 'type' => self::TYPE_BOOLEAN, 'description' => 'Verification process status.', + 'default' => false, 'example' => true, ]) ; diff --git a/src/Appwrite/Utopia/Response/Model/Error.php b/src/Appwrite/Utopia/Response/Model/Error.php index 3ce03bc671..48e30cd817 100644 --- a/src/Appwrite/Utopia/Response/Model/Error.php +++ b/src/Appwrite/Utopia/Response/Model/Error.php @@ -13,16 +13,19 @@ class Error extends Model ->addRule('message', [ 'type' => self::TYPE_STRING, 'description' => 'Error message.', + 'default' => '', 'example' => 'Not found', ]) ->addRule('code', [ 'type' => self::TYPE_STRING, 'description' => 'Error code.', + 'default' => '', 'example' => '404', ]) ->addRule('version', [ 'type' => self::TYPE_STRING, 'description' => 'Server version number.', + 'default' => '', 'example' => '1.0', ]) ; diff --git a/src/Appwrite/Utopia/Response/Model/ErrorDev.php b/src/Appwrite/Utopia/Response/Model/ErrorDev.php index d4a667529d..9fa0c4095a 100644 --- a/src/Appwrite/Utopia/Response/Model/ErrorDev.php +++ b/src/Appwrite/Utopia/Response/Model/ErrorDev.php @@ -19,16 +19,19 @@ class ErrorDev extends Error ->addRule('file', [ 'type' => self::TYPE_STRING, 'description' => 'File path.', + 'default' => '', 'example' => '/usr/code/vendor/utopia-php/framework/src/App.php', ]) ->addRule('line', [ 'type' => self::TYPE_INTEGER, 'description' => 'Line number.', + 'default' => 0, 'example' => 209, ]) ->addRule('trace', [ 'type' => self::TYPE_STRING, 'description' => 'Error trace.', + 'default' => [], 'example' => [ '' ], diff --git a/src/Appwrite/Utopia/Response/Model/Execution.php b/src/Appwrite/Utopia/Response/Model/Execution.php index c1183d6b24..a5ad4cc75d 100644 --- a/src/Appwrite/Utopia/Response/Model/Execution.php +++ b/src/Appwrite/Utopia/Response/Model/Execution.php @@ -13,46 +13,55 @@ class Execution extends Model ->addRule('$id', [ 'type' => self::TYPE_STRING, 'description' => 'Execution ID.', + 'default' => '', 'example' => '5e5ea5c16897e', ]) ->addRule('functionId', [ 'type' => self::TYPE_STRING, 'description' => 'Function ID.', + 'default' => '', 'example' => '5e5ea6g16897e', ]) ->addRule('dateCreated', [ 'type' => self::TYPE_INTEGER, 'description' => 'The execution creation date in Unix timestamp.', + 'default' => 0, 'example' => 1592981250, ]) ->addRule('trigger', [ 'type' => self::TYPE_STRING, 'description' => 'The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`.', + 'default' => '', 'example' => 'http', ]) ->addRule('status', [ 'type' => self::TYPE_STRING, 'description' => 'The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`.', + 'default' => '', 'example' => 'processing', ]) ->addRule('exitCode', [ 'type' => self::TYPE_INTEGER, 'description' => 'The script exit code.', + 'default' => 0, 'example' => 0, ]) ->addRule('stdout', [ 'type' => self::TYPE_STRING, 'description' => 'The script stdout output string.', + 'default' => '', 'example' => '', ]) ->addRule('stderr', [ 'type' => self::TYPE_STRING, 'description' => 'The script stderr output string.', + 'default' => '', 'example' => '', ]) ->addRule('time', [ 'type' => self::TYPE_FLOAT, 'description' => 'The script execution time in seconds.', + 'default' => '', 'example' => 0.400, ]) ; diff --git a/src/Appwrite/Utopia/Response/Model/File.php b/src/Appwrite/Utopia/Response/Model/File.php index a7ad05e1e4..a731baddf9 100644 --- a/src/Appwrite/Utopia/Response/Model/File.php +++ b/src/Appwrite/Utopia/Response/Model/File.php @@ -13,37 +13,44 @@ class File extends Model ->addRule('$id', [ 'type' => self::TYPE_STRING, 'description' => 'File ID.', + 'default' => '', 'example' => '5e5ea5c16897e', ]) ->addRule('$permissions', [ 'type' => Response::MODEL_PERMISSIONS, 'description' => 'File permissions.', + 'default' => '', 'example' => new \stdClass, 'array' => false, ]) ->addRule('name', [ 'type' => self::TYPE_STRING, 'description' => 'File name.', + 'default' => '', 'example' => 'Pink.png', ]) ->addRule('dateCreated', [ 'type' => self::TYPE_INTEGER, 'description' => 'File creation date in Unix timestamp.', + 'default' => '', 'example' => 1592981250, ]) ->addRule('signature', [ 'type' => self::TYPE_STRING, 'description' => 'File MD5 signature.', + 'default' => '', 'example' => '5d529fd02b544198ae075bd57c1762bb', ]) ->addRule('mimeType', [ 'type' => self::TYPE_STRING, 'description' => 'File mime type.', + 'default' => '', 'example' => 'image/png', ]) ->addRule('sizeOriginal', [ 'type' => self::TYPE_INTEGER, 'description' => 'File original size in bytes.', + 'default' => '', 'example' => 17890, ]) ; diff --git a/src/Appwrite/Utopia/Response/Model/Func.php b/src/Appwrite/Utopia/Response/Model/Func.php index 8802c56dec..067a4741d7 100644 --- a/src/Appwrite/Utopia/Response/Model/Func.php +++ b/src/Appwrite/Utopia/Response/Model/Func.php @@ -13,37 +13,44 @@ class Func extends Model ->addRule('$id', [ 'type' => self::TYPE_STRING, 'description' => 'Function ID.', + 'default' => '', 'example' => '5e5ea5c16897e', ]) ->addRule('$permissions', [ 'type' => Response::MODEL_PERMISSIONS, 'description' => 'Function permissions.', + 'default' => new \stdClass, 'example' => new \stdClass, 'array' => false, ]) ->addRule('name', [ 'type' => self::TYPE_STRING, 'description' => 'Function name.', + 'default' => '', 'example' => 'My Function', ]) ->addRule('dateCreated', [ 'type' => self::TYPE_INTEGER, 'description' => 'Function creation date in Unix timestamp.', + 'default' => 0, 'example' => 1592981250, ]) ->addRule('dateUpdated', [ 'type' => self::TYPE_INTEGER, 'description' => 'Function update date in Unix timestamp.', + 'default' => 0, 'example' => 1592981257, ]) ->addRule('status', [ 'type' => self::TYPE_STRING, 'description' => 'Function status. Possible values: disabled, enabled', + 'default' => '', 'example' => 'enabled', ]) ->addRule('env', [ 'type' => self::TYPE_STRING, 'description' => 'Function execution environment.', + 'default' => '', 'example' => 'python-3.8', ]) ->addRule('tag', [ @@ -74,14 +81,14 @@ class Func extends Model ->addRule('scheduleNext', [ 'type' => self::TYPE_INTEGER, 'description' => 'Function next scheduled execution date in Unix timestamp.', - 'example' => 1592981292, 'default' => 0, + 'example' => 1592981292, ]) ->addRule('schedulePrevious', [ 'type' => self::TYPE_INTEGER, 'description' => 'Function next scheduled execution date in Unix timestamp.', - 'example' => 1592981237, 'default' => 0, + 'example' => 1592981237, ]) ->addRule('timeout', [ 'type' => self::TYPE_INTEGER, diff --git a/src/Appwrite/Utopia/Response/Model/Key.php b/src/Appwrite/Utopia/Response/Model/Key.php index 28be3adbf5..c939382cc2 100644 --- a/src/Appwrite/Utopia/Response/Model/Key.php +++ b/src/Appwrite/Utopia/Response/Model/Key.php @@ -18,11 +18,13 @@ class Key extends Model ->addRule('$id', [ 'type' => self::TYPE_STRING, 'description' => 'Key ID.', + 'default' => '', 'example' => '5e5ea5c16897e', ]) ->addRule('name', [ 'type' => self::TYPE_STRING, 'description' => 'Key name.', + 'default' => '', 'example' => 'My API Key', ]) ->addRule('scopes', [ @@ -35,6 +37,7 @@ class Key extends Model ->addRule('secret', [ 'type' => self::TYPE_STRING, 'description' => 'Secret key.', + 'default' => '', 'example' => '919c2d18fb5d4...a2ae413da83346ad2', ]) ; diff --git a/src/Appwrite/Utopia/Response/Model/Language.php b/src/Appwrite/Utopia/Response/Model/Language.php index e2dd8d638f..8819b520bb 100644 --- a/src/Appwrite/Utopia/Response/Model/Language.php +++ b/src/Appwrite/Utopia/Response/Model/Language.php @@ -13,16 +13,19 @@ class Language extends Model ->addRule('name', [ 'type' => self::TYPE_STRING, 'description' => 'Language name.', + 'default' => '', 'example' => 'Italian', ]) ->addRule('code', [ 'type' => self::TYPE_STRING, 'description' => 'Language two-character ISO 639-1 codes.', + 'default' => '', 'example' => 'it', ]) ->addRule('nativeName', [ 'type' => self::TYPE_STRING, 'description' => 'Language native name.', + 'default' => '', 'example' => 'Italiano', ]) ; diff --git a/src/Appwrite/Utopia/Response/Model/Locale.php b/src/Appwrite/Utopia/Response/Model/Locale.php index d67470a39e..7f430d8072 100644 --- a/src/Appwrite/Utopia/Response/Model/Locale.php +++ b/src/Appwrite/Utopia/Response/Model/Locale.php @@ -13,26 +13,31 @@ class Locale extends Model ->addRule('ip', [ 'type' => self::TYPE_STRING, 'description' => 'User IP address.', + 'default' => '', 'example' => '127.0.0.1', ]) ->addRule('countryCode', [ 'type' => self::TYPE_STRING, 'description' => 'Country code in [ISO 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1) two-character format', + 'default' => '', 'example' => 'US', ]) ->addRule('country', [ 'type' => self::TYPE_STRING, 'description' => 'Country name. This field support localization.', + 'default' => '', 'example' => 'United States', ]) ->addRule('continentCode', [ 'type' => self::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.', + 'default' => '', 'example' => 'NA', ]) ->addRule('continent', [ 'type' => self::TYPE_STRING, 'description' => 'Continent name. This field support localization.', + 'default' => '', 'example' => 'North America', ]) ->addRule('eu', [ @@ -44,6 +49,7 @@ class Locale extends Model ->addRule('currency', [ 'type' => self::TYPE_STRING, 'description' => 'Currency code in [ISO 4217-1](http://en.wikipedia.org/wiki/ISO_4217) three-character format', + 'default' => '', 'example' => 'USD', ]) ; diff --git a/src/Appwrite/Utopia/Response/Model/Log.php b/src/Appwrite/Utopia/Response/Model/Log.php index dc3bb6955e..baf2f83347 100644 --- a/src/Appwrite/Utopia/Response/Model/Log.php +++ b/src/Appwrite/Utopia/Response/Model/Log.php @@ -13,16 +13,19 @@ class Log extends Model ->addRule('event', [ 'type' => self::TYPE_STRING, 'description' => 'Event name.', + 'default' => '', 'example' => 'account.sessions.create', ]) ->addRule('ip', [ 'type' => self::TYPE_STRING, 'description' => 'IP session in use when the session was created.', + 'default' => '', 'example' => '127.0.0.1', ]) ->addRule('time', [ 'type' => self::TYPE_INTEGER, 'description' => 'Log creation time in Unix timestamp.', + 'default' => 0, 'example' => 1592981250, ]) ->addRule('osCode', [ diff --git a/src/Appwrite/Utopia/Response/Model/Membership.php b/src/Appwrite/Utopia/Response/Model/Membership.php index 34f60a72b8..e5be5d3d1d 100644 --- a/src/Appwrite/Utopia/Response/Model/Membership.php +++ b/src/Appwrite/Utopia/Response/Model/Membership.php @@ -13,16 +13,19 @@ class Membership extends Model ->addRule('$id', [ 'type' => self::TYPE_STRING, 'description' => 'Membership ID.', + 'default' => '', 'example' => '5e5ea5c16897e', ]) ->addRule('userId', [ 'type' => self::TYPE_STRING, 'description' => 'User ID.', + 'default' => '', 'example' => '5e5ea5c16897e', ]) ->addRule('teamId', [ 'type' => self::TYPE_STRING, 'description' => 'Team ID.', + 'default' => '', 'example' => '5e5ea5c16897e', ]) ->addRule('name', [ @@ -40,16 +43,19 @@ class Membership extends Model ->addRule('invited', [ 'type' => self::TYPE_INTEGER, 'description' => 'Date, the user has been invited to join the team in Unix timestamp.', + 'default' => 0, 'example' => 1592981250, ]) ->addRule('joined', [ 'type' => self::TYPE_INTEGER, 'description' => 'Date, the user has accepted the invitation to join the team in Unix timestamp.', + 'default' => 0, 'example' => 1592981250, ]) ->addRule('confirm', [ 'type' => self::TYPE_BOOLEAN, 'description' => 'User confirmation status, true if the user has joined the team or false otherwise.', + 'default' => false, 'example' => false, ]) ->addRule('roles', [ diff --git a/src/Appwrite/Utopia/Response/Model/Permissions.php b/src/Appwrite/Utopia/Response/Model/Permissions.php index 3847bd9387..0377d2e1f8 100644 --- a/src/Appwrite/Utopia/Response/Model/Permissions.php +++ b/src/Appwrite/Utopia/Response/Model/Permissions.php @@ -13,12 +13,14 @@ class Permissions extends Model ->addRule('read', [ 'type' => self::TYPE_STRING, 'description' => 'Read permissions.', + 'default' => [], 'example' => ['*', 'user:5e5ea5c16897e'], 'array' => true, ]) ->addRule('write', [ 'type' => self::TYPE_STRING, 'description' => 'Write permissions.', + 'default' => [], 'example' => ['*', 'user:5e5ea5c16897e'], 'array' => true, ]) diff --git a/src/Appwrite/Utopia/Response/Model/Phone.php b/src/Appwrite/Utopia/Response/Model/Phone.php index 0d47ebb867..e077193e8d 100644 --- a/src/Appwrite/Utopia/Response/Model/Phone.php +++ b/src/Appwrite/Utopia/Response/Model/Phone.php @@ -13,16 +13,19 @@ class Phone extends Model ->addRule('code', [ 'type' => self::TYPE_STRING, 'description' => 'Phone code.', + 'default' => '', 'example' => '+1', ]) ->addRule('countryCode', [ 'type' => self::TYPE_STRING, 'description' => 'Country two-character ISO 3166-1 alpha code.', + 'default' => '', 'example' => 'US', ]) ->addRule('countryName', [ 'type' => self::TYPE_STRING, 'description' => 'Country name.', + 'default' => '', 'example' => 'United States', ]) ; diff --git a/src/Appwrite/Utopia/Response/Model/Platform.php b/src/Appwrite/Utopia/Response/Model/Platform.php index 06c61d3e1b..207b4fe81f 100644 --- a/src/Appwrite/Utopia/Response/Model/Platform.php +++ b/src/Appwrite/Utopia/Response/Model/Platform.php @@ -18,21 +18,25 @@ class Platform extends Model ->addRule('$id', [ 'type' => self::TYPE_STRING, 'description' => 'Platform ID.', + 'default' => '', 'example' => '5e5ea5c16897e', ]) ->addRule('name', [ 'type' => self::TYPE_STRING, 'description' => 'Platform name.', + 'default' => '', 'example' => 'My Web App', ]) ->addRule('type', [ 'type' => self::TYPE_STRING, 'description' => 'Platform type. Possible values are: web, flutter-ios, flutter-android, ios, android, and unity.', + 'default' => '', 'example' => 'My Web App', ]) ->addRule('key', [ 'type' => self::TYPE_STRING, 'description' => 'Platform Key. iOS bundle ID or Android package name. Empty string for other platforms.', + 'default' => '', 'example' => 'com.company.appname', ]) // ->addRule('store', [ @@ -43,6 +47,7 @@ class Platform extends Model ->addRule('hostname', [ 'type' => self::TYPE_STRING, 'description' => 'Web app hostname. Empty string for other platforms.', + 'default' => '', 'example' => true, ]) ->addRule('httpUser', [ diff --git a/src/Appwrite/Utopia/Response/Model/Project.php b/src/Appwrite/Utopia/Response/Model/Project.php index e481631898..9ff5817583 100644 --- a/src/Appwrite/Utopia/Response/Model/Project.php +++ b/src/Appwrite/Utopia/Response/Model/Project.php @@ -19,6 +19,7 @@ class Project extends Model ->addRule('$id', [ 'type' => self::TYPE_STRING, 'description' => 'Project ID.', + 'default' => '', 'example' => '5e5ea5c16897e', ]) ->addRule('name', [ @@ -36,6 +37,7 @@ class Project extends Model ->addRule('teamId', [ 'type' => self::TYPE_STRING, 'description' => 'Project team ID.', + 'default' => '', 'example' => '1592981250', ]) ->addRule('logo', [ diff --git a/src/Appwrite/Utopia/Response/Model/Rule.php b/src/Appwrite/Utopia/Response/Model/Rule.php index cb075c8a7f..178dd90d7c 100644 --- a/src/Appwrite/Utopia/Response/Model/Rule.php +++ b/src/Appwrite/Utopia/Response/Model/Rule.php @@ -13,6 +13,7 @@ class Rule extends Model ->addRule('$id', [ 'type' => self::TYPE_STRING, 'description' => 'Rule ID.', + 'default' => '', 'example' => '5e5ea5c16897e', ]) ->addRule('$collection', [ // TODO remove this from public response @@ -23,32 +24,37 @@ class Rule extends Model ->addRule('type', [ 'type' => self::TYPE_STRING, 'description' => 'Rule type. Possible values: ', + 'default' => '', 'example' => 'title', ]) ->addRule('key', [ 'type' => self::TYPE_STRING, 'description' => 'Rule key.', + 'default' => '', 'example' => 'title', ]) ->addRule('label', [ 'type' => self::TYPE_STRING, 'description' => 'Rule label.', + 'default' => '', 'example' => 'Title', ]) ->addRule('default', [ // TODO should be of mixed types 'type' => self::TYPE_STRING, 'description' => 'Rule default value.', - 'example' => 'Movie Name', 'default' => '', + 'example' => 'Movie Name', ]) ->addRule('array', [ 'type' => self::TYPE_BOOLEAN, 'description' => 'Is array?', + 'default' => false, 'example' => false, ]) ->addRule('required', [ 'type' => self::TYPE_BOOLEAN, 'description' => 'Is required?', + 'default' => false, 'example' => true, ]) ->addRule('list', [ diff --git a/src/Appwrite/Utopia/Response/Model/Session.php b/src/Appwrite/Utopia/Response/Model/Session.php index a0edfbb4b6..4bc23ab79a 100644 --- a/src/Appwrite/Utopia/Response/Model/Session.php +++ b/src/Appwrite/Utopia/Response/Model/Session.php @@ -13,6 +13,7 @@ class Session extends Model ->addRule('$id', [ 'type' => self::TYPE_STRING, 'description' => 'Session ID.', + 'default' => '', 'example' => '5e5ea5c16897e', ]) ->addRule('userId', [ diff --git a/src/Appwrite/Utopia/Response/Model/Tag.php b/src/Appwrite/Utopia/Response/Model/Tag.php index a3a403187f..b48e157291 100644 --- a/src/Appwrite/Utopia/Response/Model/Tag.php +++ b/src/Appwrite/Utopia/Response/Model/Tag.php @@ -13,26 +13,31 @@ class Tag extends Model ->addRule('$id', [ 'type' => self::TYPE_STRING, 'description' => 'Tag ID.', + 'default' => '', 'example' => '5e5ea5c16897e', ]) ->addRule('functionId', [ 'type' => self::TYPE_STRING, 'description' => 'Function ID.', + 'default' => '', 'example' => '5e5ea6g16897e', ]) ->addRule('dateCreated', [ 'type' => self::TYPE_INTEGER, 'description' => 'The tag creation date in Unix timestamp.', + 'default' => 0, 'example' => 1592981250, ]) ->addRule('command', [ 'type' => self::TYPE_STRING, 'description' => 'The entrypoint command in use to execute the tag code.', + 'default' => '', 'example' => 'enabled', ]) ->addRule('size', [ 'type' => self::TYPE_STRING, 'description' => 'The code size in bytes.', + 'default' => '', 'example' => 'python-3.8', ]) ; diff --git a/src/Appwrite/Utopia/Response/Model/Task.php b/src/Appwrite/Utopia/Response/Model/Task.php index 53ec1474e6..6843eba9a0 100644 --- a/src/Appwrite/Utopia/Response/Model/Task.php +++ b/src/Appwrite/Utopia/Response/Model/Task.php @@ -18,26 +18,31 @@ class Task extends Model ->addRule('$id', [ 'type' => self::TYPE_STRING, 'description' => 'Task ID.', + 'default' => '', 'example' => '5e5ea5c16897e', ]) ->addRule('name', [ 'type' => self::TYPE_STRING, 'description' => 'Task name.', + 'default' => '', 'example' => 'My Task', ]) ->addRule('security', [ 'type' => self::TYPE_BOOLEAN, 'description' => 'Indicated if SSL / TLS Certificate verification is enabled.', + 'default' => true, 'example' => true, ]) ->addRule('httpMethod', [ 'type' => self::TYPE_STRING, 'description' => 'Task HTTP Method.', + 'default' => '', 'example' => 'POST', ]) ->addRule('httpUrl', [ 'type' => self::TYPE_STRING, 'description' => 'Task HTTP URL.', + 'default' => '', 'example' => 'https://example.com/task', ]) ->addRule('httpHeaders', [ @@ -80,11 +85,13 @@ class Task extends Model ->addRule('schedule', [ 'type' => self::TYPE_STRING, 'description' => 'Task schedule in CRON syntax.', + 'default' => '', 'example' => '* * * * *', ]) ->addRule('status', [ 'type' => self::TYPE_STRING, 'description' => 'Task status. Possible values: play, pause', // TODO - change to enabled disabled + 'default' => '', 'example' => 'enabled', ]) ->addRule('updated', [ diff --git a/src/Appwrite/Utopia/Response/Model/Team.php b/src/Appwrite/Utopia/Response/Model/Team.php index 67442dade5..b5f7482a19 100644 --- a/src/Appwrite/Utopia/Response/Model/Team.php +++ b/src/Appwrite/Utopia/Response/Model/Team.php @@ -13,6 +13,7 @@ class Team extends Model ->addRule('$id', [ 'type' => self::TYPE_STRING, 'description' => 'Team ID.', + 'default' => '', 'example' => '5e5ea5c16897e', ]) ->addRule('name', [ @@ -24,11 +25,13 @@ class Team extends Model ->addRule('dateCreated', [ 'type' => self::TYPE_INTEGER, 'description' => 'Team creation date in Unix timestamp.', + 'default' => 0, 'example' => 1592981250, ]) ->addRule('sum', [ // TODO change key name? 'type' => self::TYPE_INTEGER, 'description' => 'Total sum of team members.', + 'default' => 0, 'example' => 7, ]) ; diff --git a/src/Appwrite/Utopia/Response/Model/Token.php b/src/Appwrite/Utopia/Response/Model/Token.php index 9d00fe6f91..fb34f01fd7 100644 --- a/src/Appwrite/Utopia/Response/Model/Token.php +++ b/src/Appwrite/Utopia/Response/Model/Token.php @@ -13,17 +13,19 @@ class Token extends Model ->addRule('$id', [ 'type' => self::TYPE_STRING, 'description' => 'Token ID.', + 'default' => '', 'example' => 'bb8ea5c16897e', ]) ->addRule('userId', [ 'type' => self::TYPE_STRING, 'description' => 'User ID.', + 'default' => '', 'example' => '5e5ea5c168bb8', ]) ->addRule('secret', [ 'type' => self::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.', - 'default' => 0, + 'default' => '', 'example' => '', ]) ->addRule('expire', [ diff --git a/src/Appwrite/Utopia/Response/Model/User.php b/src/Appwrite/Utopia/Response/Model/User.php index e11d49ed8f..b917a14a0d 100644 --- a/src/Appwrite/Utopia/Response/Model/User.php +++ b/src/Appwrite/Utopia/Response/Model/User.php @@ -13,26 +13,31 @@ class User extends Model ->addRule('$id', [ 'type' => self::TYPE_STRING, 'description' => 'User ID.', + 'default' => '', 'example' => '5e5ea5c16897e', ]) ->addRule('name', [ 'type' => self::TYPE_STRING, 'description' => 'User name.', + 'default' => '', 'example' => 'John Doe', ]) ->addRule('registration', [ 'type' => self::TYPE_INTEGER, 'description' => 'User registration date in Unix timestamp.', + 'default' => 0, 'example' => 1592981250, ]) ->addRule('status', [ 'type' => self::TYPE_INTEGER, 'description' => 'User status. 0 for Unactivated, 1 for active and 2 is blocked.', + 'default' => 0, 'example' => 0, ]) ->addRule('email', [ 'type' => self::TYPE_STRING, 'description' => 'User email address.', + 'default' => '', 'example' => 'john@appwrite.io', ]) ->addRule('emailVerification', [ diff --git a/src/Appwrite/Utopia/Response/Model/Webhook.php b/src/Appwrite/Utopia/Response/Model/Webhook.php index f8b8ac7432..0ad9ce6ab8 100644 --- a/src/Appwrite/Utopia/Response/Model/Webhook.php +++ b/src/Appwrite/Utopia/Response/Model/Webhook.php @@ -18,16 +18,19 @@ class Webhook extends Model ->addRule('$id', [ 'type' => self::TYPE_STRING, 'description' => 'Webhook ID.', + 'default' => '', 'example' => '5e5ea5c16897e', ]) ->addRule('name', [ 'type' => self::TYPE_STRING, 'description' => 'Webhook name.', + 'default' => '', 'example' => 'My Webhook', ]) ->addRule('url', [ 'type' => self::TYPE_STRING, 'description' => 'Webhook URL endpoint.', + 'default' => '', 'example' => 'https://example.com/webhook', ]) ->addRule('events', [ @@ -40,6 +43,7 @@ class Webhook extends Model ->addRule('security', [ 'type' => self::TYPE_BOOLEAN, 'description' => 'Indicated if SSL / TLS Certificate verification is enabled.', + 'default' => true, 'example' => true, ]) ->addRule('httpUser', [ From 56de47073d00c25f555c29d1c090b216dca64796 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Wed, 13 Jan 2021 18:10:42 +0200 Subject: [PATCH 164/230] Fixed file default value --- src/Appwrite/Utopia/Response/Model/File.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Appwrite/Utopia/Response/Model/File.php b/src/Appwrite/Utopia/Response/Model/File.php index a731baddf9..ffd8f5ce47 100644 --- a/src/Appwrite/Utopia/Response/Model/File.php +++ b/src/Appwrite/Utopia/Response/Model/File.php @@ -50,7 +50,7 @@ class File extends Model ->addRule('sizeOriginal', [ 'type' => self::TYPE_INTEGER, 'description' => 'File original size in bytes.', - 'default' => '', + 'default' => 0, 'example' => 17890, ]) ; From 589169803467b687db7250db71c4462cee0f0030 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Wed, 13 Jan 2021 18:11:56 +0200 Subject: [PATCH 165/230] Fixed wrong default values --- src/Appwrite/Utopia/Response/Model/Execution.php | 2 +- src/Appwrite/Utopia/Response/Model/File.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Appwrite/Utopia/Response/Model/Execution.php b/src/Appwrite/Utopia/Response/Model/Execution.php index a5ad4cc75d..22c7710ec6 100644 --- a/src/Appwrite/Utopia/Response/Model/Execution.php +++ b/src/Appwrite/Utopia/Response/Model/Execution.php @@ -61,7 +61,7 @@ class Execution extends Model ->addRule('time', [ 'type' => self::TYPE_FLOAT, 'description' => 'The script execution time in seconds.', - 'default' => '', + 'default' => 0, 'example' => 0.400, ]) ; diff --git a/src/Appwrite/Utopia/Response/Model/File.php b/src/Appwrite/Utopia/Response/Model/File.php index ffd8f5ce47..9c88e2f99d 100644 --- a/src/Appwrite/Utopia/Response/Model/File.php +++ b/src/Appwrite/Utopia/Response/Model/File.php @@ -19,7 +19,7 @@ class File extends Model ->addRule('$permissions', [ 'type' => Response::MODEL_PERMISSIONS, 'description' => 'File permissions.', - 'default' => '', + 'default' => new \stdClass, 'example' => new \stdClass, 'array' => false, ]) From 2fd86c809a8c989d27ddd0914d1a714206e868c6 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Wed, 13 Jan 2021 18:17:28 +0200 Subject: [PATCH 166/230] Last fix ? --- src/Appwrite/Utopia/Response/Model/File.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Appwrite/Utopia/Response/Model/File.php b/src/Appwrite/Utopia/Response/Model/File.php index 9c88e2f99d..5d0d511539 100644 --- a/src/Appwrite/Utopia/Response/Model/File.php +++ b/src/Appwrite/Utopia/Response/Model/File.php @@ -32,7 +32,7 @@ class File extends Model ->addRule('dateCreated', [ 'type' => self::TYPE_INTEGER, 'description' => 'File creation date in Unix timestamp.', - 'default' => '', + 'default' => 0, 'example' => 1592981250, ]) ->addRule('signature', [ From 00ee2735c466460c1611e759c54c405bb571417d Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Thu, 14 Jan 2021 08:09:52 +0200 Subject: [PATCH 167/230] Updated changelog --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index d9ec45dd6c..ee147b9cbf 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -37,6 +37,7 @@ - Added new environment variables for ClamAV hostname and port ([#780](https://github.com/appwrite/appwrite/pull/780)) - New OAuth adapter for Box.com (@armino-dev - [#420](https://github.com/appwrite/appwrite/issues/410)) - New OAuth adapter for PayPal sandbox (@armino-dev - [#420](https://github.com/appwrite/appwrite/issues/410)) +- Introducing new permssion types: role:guest, role:member, role:app. ### User Interface - Updated grid for OAuth2 providers list in the console ([#413](https://github.com/appwrite/appwrite/issues/413)) From 5fb533ed6aac99a5d60caa3d3c1b926858b8dff6 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Thu, 14 Jan 2021 13:11:10 +0200 Subject: [PATCH 168/230] Removed unsed volume --- app/views/install/compose.phtml | 1 - 1 file changed, 1 deletion(-) diff --git a/app/views/install/compose.phtml b/app/views/install/compose.phtml index 9a2141a5c1..098d4d4070 100644 --- a/app/views/install/compose.phtml +++ b/app/views/install/compose.phtml @@ -372,5 +372,4 @@ volumes: appwrite-certificates: appwrite-functions: appwrite-influxdb: - appwrite-chronograf: appwrite-config: From 54c31fe890ae90ccbe5a2ddff60ed62c02435221 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Thu, 14 Jan 2021 21:30:16 +0200 Subject: [PATCH 169/230] Updated changelog --- CHANGES.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index ee147b9cbf..cc6a5c633b 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -37,7 +37,8 @@ - Added new environment variables for ClamAV hostname and port ([#780](https://github.com/appwrite/appwrite/pull/780)) - New OAuth adapter for Box.com (@armino-dev - [#420](https://github.com/appwrite/appwrite/issues/410)) - New OAuth adapter for PayPal sandbox (@armino-dev - [#420](https://github.com/appwrite/appwrite/issues/410)) -- Introducing new permssion types: role:guest, role:member, role:app. +- Introducing new permssion types: role:guest, role:member, role:app +- Disabled rate-limits on server side integrations ### User Interface - Updated grid for OAuth2 providers list in the console ([#413](https://github.com/appwrite/appwrite/issues/413)) From a8c23630873e5af1df02620d388baa522a9d45dc Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Fri, 15 Jan 2021 00:16:09 +0200 Subject: [PATCH 170/230] Added space --- CHANGES.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index cc6a5c633b..1418fb4532 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -41,6 +41,7 @@ - Disabled rate-limits on server side integrations ### User Interface + - Updated grid for OAuth2 providers list in the console ([#413](https://github.com/appwrite/appwrite/issues/413)) - Added Google Fonts to Appwrite for offline availability - Added option to delete user from the console (@PineappleIOnic - [#538](https://github.com/appwrite/appwrite/issues/538)) @@ -55,6 +56,7 @@ - Added toggle to hide/show secret keys and passwords inside the dashboard (@kodumbeats, [#535](https://github.com/appwrite/appwrite/issues/535)) ### Upgrades + - Upgraded QR codes generator library (@PedroCisnerosSantana - [#475](https://github.com/appwrite/appwrite/issues/475)) - Upgraded Traefik image to version 2.3 - Upgraded MariaDB to version 10.5.5 @@ -65,6 +67,7 @@ - Upgraded device detctor to version 3.12.6 ## Breaking Changes (Read before upgrading!) + - **Deprecated** `first` and `last` query params for documents list route in the database API - **Deprecated** Deprectaed Pubjabi Translations ('pn') - **Deprecated** `PATCH /account/prefs` is now updating the prefs payload and not just merging it @@ -102,6 +105,7 @@ - Fixed OAuth redirect when using the self-hosted instance default success URL ([#454](https://github.com/appwrite/appwrite/issues/454)) - Fixed bug denying authentication with Github OAuth provider - Fixed a bug making read permission overwrite write permission in some cases + ## Security - Access to Health API now requires authentication with an API Key with access to `health.read` scope allowed From 99d5794f1411956521fb1bf378e824d4345816d6 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Fri, 15 Jan 2021 00:20:31 +0200 Subject: [PATCH 171/230] Deprecated old Nginx stuff --- Dockerfile.nginx | 185 --------------- app/controllers/api/health.php | 4 - bin/start | 37 --- docker-compose.nginx.yml | 215 ----------------- docker/nginx.conf.template | 149 ------------ docker/ssl/cert.pem | 27 --- docker/ssl/key.pem | 52 ----- docker/supervisord.conf | 200 ---------------- docker/www.conf | 412 --------------------------------- 9 files changed, 1281 deletions(-) delete mode 100644 Dockerfile.nginx delete mode 100755 bin/start delete mode 100644 docker-compose.nginx.yml delete mode 100644 docker/nginx.conf.template delete mode 100644 docker/ssl/cert.pem delete mode 100644 docker/ssl/key.pem delete mode 100644 docker/supervisord.conf delete mode 100644 docker/www.conf diff --git a/Dockerfile.nginx b/Dockerfile.nginx deleted file mode 100644 index b7acd23a7f..0000000000 --- a/Dockerfile.nginx +++ /dev/null @@ -1,185 +0,0 @@ -FROM ubuntu:18.04 AS builder - -LABEL maintainer="team@appwrite.io" - -ARG TESTING=false - -ENV TZ=Asia/Tel_Aviv \ - DEBIAN_FRONTEND=noninteractive \ - PHP_VERSION=7.4 \ - PHP_REDIS_VERSION=5.2.1 - -RUN \ - apt-get update && \ - apt-get install -y --no-install-recommends --no-install-suggests ca-certificates software-properties-common wget git openssl && \ - LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php && \ - apt-get update && \ - apt-get install -y --no-install-recommends --no-install-suggests make php$PHP_VERSION php$PHP_VERSION-dev zip unzip php$PHP_VERSION-zip && \ - # Redis Extension - wget -q https://github.com/phpredis/phpredis/archive/$PHP_REDIS_VERSION.tar.gz && \ - tar -xf $PHP_REDIS_VERSION.tar.gz && \ - cd phpredis-$PHP_REDIS_VERSION && \ - phpize$PHP_VERSION && \ - ./configure && \ - make && \ - # Composer - wget https://getcomposer.org/composer.phar && \ - chmod +x ./composer.phar && \ - mv ./composer.phar /usr/bin/composer && \ - #Brotli - cd / && \ - git clone https://github.com/eustas/ngx_brotli.git && \ - cd ngx_brotli && git submodule update --init && cd .. - -WORKDIR /usr/local/src/ - -# Updating PHP Dependencies and Auto-loading... - -ENV TESTING=$TESTING - -COPY composer.* /usr/local/src/ - -RUN composer update --ignore-platform-reqs --optimize-autoloader \ - --no-plugins --no-scripts --prefer-dist \ - `if [ "$TESTING" != "true" ]; then echo "--no-dev"; fi` - -FROM ubuntu:18.04 -LABEL maintainer="team@appwrite.io" - -ARG VERSION=dev - -ENV TZ=Asia/Tel_Aviv \ - DEBIAN_FRONTEND=noninteractive \ - PHP_VERSION=7.4 \ - _APP_SERVER=nginx \ - _APP_ENV=production \ - _APP_DOMAIN=localhost \ - _APP_DOMAIN_TARGET=localhost \ - _APP_HOME=https://appwrite.io \ - _APP_EDITION=community \ - _APP_OPTIONS_ABUSE=enabled \ - _APP_OPTIONS_FORCE_HTTPS=disabled \ - _APP_OPENSSL_KEY_V1=your-secret-key \ - _APP_STORAGE_LIMIT=10000000 \ - _APP_STORAGE_ANTIVIRUS=enabled \ - _APP_REDIS_HOST=redis \ - _APP_REDIS_PORT=6379 \ - _APP_DB_HOST=mariadb \ - _APP_DB_PORT=3306 \ - _APP_DB_USER=root \ - _APP_DB_PASS=password \ - _APP_DB_SCHEMA=appwrite \ - _APP_INFLUXDB_HOST=influxdb \ - _APP_INFLUXDB_PORT=8086 \ - _APP_STATSD_HOST=telegraf \ - _APP_STATSD_PORT=8125 \ - _APP_SMTP_HOST=smtp \ - _APP_SMTP_PORT=25 \ - _APP_SETUP=self-hosted \ - _APP_VERSION=$VERSION -#ENV _APP_SMTP_SECURE '' -#ENV _APP_SMTP_USERNAME '' -#ENV _APP_SMTP_PASSWORD '' - -COPY --from=builder /phpredis-5.2.1/modules/redis.so /usr/lib/php/20190902/ -COPY --from=builder /phpredis-5.2.1/modules/redis.so /usr/lib/php/20190902/ -COPY --from=builder /ngx_brotli /ngx_brotli - -RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone - -RUN \ - apt-get update && \ - apt-get install -y --no-install-recommends --no-install-suggests wget ca-certificates software-properties-common build-essential libpcre3-dev zlib1g-dev libssl-dev openssl gnupg htop supervisor && \ - LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php && \ - add-apt-repository universe && \ - add-apt-repository ppa:certbot/certbot && \ - apt-get update && \ - apt-get install -y --no-install-recommends --no-install-suggests php$PHP_VERSION php$PHP_VERSION-fpm \ - php$PHP_VERSION-mysqlnd php$PHP_VERSION-curl php$PHP_VERSION-imagick php$PHP_VERSION-mbstring php$PHP_VERSION-dom certbot && \ - # Nginx - wget http://nginx.org/download/nginx-1.19.0.tar.gz && \ - tar -xzvf nginx-1.19.0.tar.gz && rm nginx-1.19.0.tar.gz && \ - cd nginx-1.19.0 && \ - ./configure --prefix=/usr/share/nginx \ - --sbin-path=/usr/sbin/nginx \ - --modules-path=/usr/lib/nginx/modules \ - --conf-path=/etc/nginx/nginx.conf \ - --error-log-path=/var/log/nginx/error.log \ - --http-log-path=/var/log/nginx/access.log \ - --pid-path=/run/nginx.pid \ - --lock-path=/var/lock/nginx.lock \ - --user=www-data \ - --group=www-data \ - --build=Ubuntu \ - --with-http_gzip_static_module \ - --with-http_ssl_module \ - --with-http_v2_module \ - --add-module=/ngx_brotli && \ - make && \ - make install && \ - rm -rf ../nginx-1.19.0 && \ - # Redis Extension - echo extension=redis.so >> /etc/php/$PHP_VERSION/fpm/conf.d/redis.ini && \ - echo extension=redis.so >> /etc/php/$PHP_VERSION/cli/conf.d/redis.ini && \ - # Cleanup - cd ../ && \ - apt-get purge -y --auto-remove wget software-properties-common build-essential libpcre3-dev zlib1g-dev libssl-dev gnupg && \ - apt-get clean && \ - rm -rf /ngx_brotli && \ - rm -rf /var/lib/apt/lists/* - -# Set Upload Limit (default to 100MB) -RUN echo "upload_max_filesize = ${_APP_STORAGE_LIMIT}" >> /etc/php/$PHP_VERSION/fpm/conf.d/appwrite.ini -RUN echo "post_max_size = ${_APP_STORAGE_LIMIT}" >> /etc/php/$PHP_VERSION/fpm/conf.d/appwrite.ini -RUN echo "opcache.preload_user=www-data" >> /etc/php/$PHP_VERSION/fpm/conf.d/appwrite.ini -RUN echo "opcache.preload=/usr/src/code/app/preload.php" >> /etc/php/$PHP_VERSION/fpm/conf.d/appwrite.ini -RUN echo "opcache.enable_cli = 1" >> /etc/php/$PHP_VERSION/fpm/conf.d/appwrite.ini - -# Add logs file -RUN echo "" >> /var/log/appwrite.log - -# Nginx Configuration (with self-signed ssl certificates) -COPY ./docker/nginx.conf.template /etc/nginx/nginx.conf.template -COPY ./docker/ssl/cert.pem /etc/nginx/ssl/cert.pem -COPY ./docker/ssl/key.pem /etc/nginx/ssl/key.pem - -# PHP Configuration -RUN mkdir -p /var/run/php -COPY ./docker/www.conf /etc/php/$PHP_VERSION/fpm/pool.d/www.conf - -# Add PHP Source Code -COPY ./app /usr/src/code/app -COPY ./bin /usr/local/bin -COPY ./docs /usr/src/code/docs -COPY ./public /usr/src/code/public -COPY ./src /usr/src/code/src -COPY --from=builder /usr/local/src/vendor /usr/src/code/vendor - -RUN mkdir -p /storage/uploads && \ - mkdir -p /storage/cache && \ - mkdir -p /storage/config && \ - mkdir -p /storage/certificates && \ - mkdir -p /storage/functions && \ - chown -Rf www-data.www-data /storage/uploads && chmod -Rf 0755 /storage/uploads && \ - chown -Rf www-data.www-data /storage/cache && chmod -Rf 0755 /storage/cache && \ - chown -Rf www-data.www-data /storage/config && chmod -Rf 0755 /storage/config && \ - chown -Rf www-data.www-data /storage/certificates && chmod -Rf 0755 /storage/certificates && \ - chown -Rf www-data.www-data /storage/functions && chmod -Rf 0755 /storage/functions - -# Supervisord Conf -COPY ./docker/supervisord.conf /etc/supervisord.conf - -# Executables -RUN chmod +x /usr/local/bin/start -RUN chmod +x /usr/local/bin/doctor -RUN chmod +x /usr/local/bin/migrate -RUN chmod +x /usr/local/bin/test - -# Letsencrypt Permissions -RUN mkdir -p /etc/letsencrypt/live/ && chmod -Rf 755 /etc/letsencrypt/live/ - -EXPOSE 80 - -WORKDIR /usr/src/code - -CMD ["/bin/bash", "/usr/local/bin/start"] diff --git a/app/controllers/api/health.php b/app/controllers/api/health.php index 74b17f2419..21e9f2c94a 100644 --- a/app/controllers/api/health.php +++ b/app/controllers/api/health.php @@ -287,10 +287,6 @@ App::get('/v1/health/stats') // Currently only used internally $response ->json([ - 'server' => [ - 'name' => 'nginx', - 'version' => \shell_exec('nginx -v 2>&1'), - ], 'storage' => [ 'used' => Storage::human($device->getDirectorySize($device->getRoot().'/')), 'partitionTotal' => Storage::human($device->getPartitionTotalSpace()), diff --git a/bin/start b/bin/start deleted file mode 100755 index 7dd4ecddce..0000000000 --- a/bin/start +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh - -export PHP_VERSION=$PHP_VERSION - -chown -Rf www-data.www-data /usr/src/code/ - -sed 's/%_APP_STORAGE_LIMIT%/'$_APP_STORAGE_LIMIT'/g' /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf - -# Function to update the fpm configuration to make the service environment variables available -function setEnvironmentVariable() { - if [ -z "$2" ]; then - echo "Environment variable '$1' not set." - return - fi - - # Check whether variable already exists - if ! grep -q "\[$1\]" /etc/php/$PHP_VERSION/fpm/pool.d/www.conf; then - # Add variable - echo "env[$1] = $2" >> /etc/php/$PHP_VERSION/fpm/pool.d/www.conf - fi - - # Reset variable - # sed -i "s/^env\[$1.*/env[$1] = $2/g" /etc/php/$PHP_VERSION/fpm/pool.d/www.conf -} - -# Grep for variables that look like MySQL (APP_) -for _curVar in $(env | grep _APP_ | awk -F = '{print $1}');do - # awk has split them by the equals sign - # Pass the name and value to our function - setEnvironmentVariable ${_curVar} ${!_curVar} -done - -# Init server settings -php /usr/src/code/app/tasks/init.php ssl - -# Start supervisord and services -/usr/bin/supervisord -n -c /etc/supervisord.conf diff --git a/docker-compose.nginx.yml b/docker-compose.nginx.yml deleted file mode 100644 index 9388c99392..0000000000 --- a/docker-compose.nginx.yml +++ /dev/null @@ -1,215 +0,0 @@ -version: '3' - -services: - traefik: - image: traefik:v2.2 - container_name: appwrite-traefik - command: - - --log.level=DEBUG - - --api.insecure=true - - --providers.file.directory=/storage/config - - --providers.file.watch=true - - --providers.docker=true - - --entrypoints.web.address=:80 - - --entrypoints.websecure.address=:443 - - --accesslog=true - restart: unless-stopped - ports: - - 80:80 - - 443:443 - - 8080:8080 - volumes: - - /var/run/docker.sock:/var/run/docker.sock - - appwrite-config:/storage/config:ro - - appwrite-certificates:/storage/certificates:ro - depends_on: - - appwrite - networks: - - gateway - - appwrite - - appwrite: - container_name: appwrite - build: - context: . - args: - - TESTING=true - - VERSION=dev - restart: unless-stopped - networks: - - appwrite - labels: - - traefik.http.routers.appwrite.rule=PathPrefix(`/`) - - traefik.http.routers.appwrite-secure.rule=PathPrefix(`/`) - - traefik.http.routers.appwrite-secure.tls=true - volumes: - - appwrite-uploads:/storage/uploads:rw - - appwrite-cache:/storage/cache:rw - - appwrite-config:/storage/config:rw - - appwrite-certificates:/storage/certificates:rw - - appwrite-functions:/storage/functions:rw - - ./phpunit.xml:/usr/src/code/phpunit.xml - - ./tests:/usr/src/code/tests - - ./app:/usr/src/code/app - # - ./vendor:/usr/src/code/vendor - - ./docs:/usr/src/code/docs - - ./public:/usr/src/code/public - - ./src:/usr/src/code/src - ports: - - 9501:80 - depends_on: - - mariadb - - redis - # - smtp - - clamav - - influxdb - - telegraf - - maildev - environment: - #- _APP_ENV=production - - _APP_ENV=development - - _APP_OPTIONS_ABUSE=disabled - - _APP_OPTIONS_FORCE_HTTPS=disabled - - _APP_OPENSSL_KEY_V1=your-secret-key - - _APP_DOMAIN=demo.appwrite.io - - _APP_DOMAIN_TARGET=demo.appwrite.io - - _APP_REDIS_HOST=redis - - _APP_REDIS_PORT=6379 - - _APP_DB_HOST=mariadb - - _APP_DB_PORT=3306 - - _APP_DB_SCHEMA=appwrite - - _APP_DB_USER=user - - _APP_DB_PASS=password - - _APP_INFLUXDB_HOST=influxdb - - _APP_INFLUXDB_PORT=8086 - - _APP_STATSD_HOST=telegraf - - _APP_STATSD_PORT=8125 - - _APP_SMTP_HOST=maildev - - _APP_SMTP_PORT=25 - - mariadb: - image: appwrite/mariadb:1.2.0 # fix issues when upgrading using: mysql_upgrade -u root -p - container_name: appwrite-mariadb - restart: unless-stopped - networks: - - appwrite - volumes: - - appwrite-mariadb:/var/lib/mysql:rw - ports: - - "3306:3306" - environment: - - MYSQL_ROOT_PASSWORD=rootsecretpassword - - MYSQL_DATABASE=appwrite - - MYSQL_USER=user - - MYSQL_PASSWORD=password - command: 'mysqld --innodb-flush-method=fsync' - - maildev: - image: djfarrelly/maildev - container_name: appwrite-maildev - restart: unless-stopped - ports: - - '1080:80' - networks: - - appwrite - - # smtp: - # image: appwrite/smtp:1.0.1 - # container_name: appwrite-smtp - # restart: unless-stopped - # networks: - # - appwrite - # environment: - # - MAILNAME=appwrite - # - RELAY_NETWORKS=:192.168.0.0/24:10.0.0.0/16 - - redis: - image: redis:5.0 - container_name: appwrite-redis - restart: unless-stopped - networks: - - appwrite - volumes: - - appwrite-redis:/data:rw - - clamav: - image: appwrite/clamav:1.2.0 - container_name: appwrite-clamav - restart: unless-stopped - networks: - - appwrite - volumes: - - appwrite-uploads:/storage/uploads - - influxdb: - image: influxdb:1.6 - container_name: appwrite-influxdb - restart: unless-stopped - networks: - - appwrite - volumes: - - appwrite-influxdb:/var/lib/influxdb:rw - - telegraf: - image: appwrite/telegraf:1.0.0 - container_name: appwrite-telegraf - restart: unless-stopped - networks: - - appwrite - - # redis-commander: - # image: rediscommander/redis-commander:latest - # restart: unless-stopped - # networks: - # - appwrite - # environment: - # - REDIS_HOSTS=redis - # ports: - # - "8081:8081" - - # resque: - # image: registry.gitlab.com/appwrite/appwrite/resque-web:v1.0.2 - # restart: unless-stopped - # networks: - # - appwrite - # ports: - # - "5678:5678" - # environment: - # - RESQUE_WEB_HOST=redis - # - RESQUE_WEB_PORT=6379 - # - RESQUE_WEB_HTTP_BASIC_AUTH_USER=user - # - RESQUE_WEB_HTTP_BASIC_AUTH_PASSWORD=password - - # chronograf: - # image: chronograf:1.5 - # container_name: appwrite-chronograf - # restart: unless-stopped - # networks: - # - appwrite - # volumes: - # - appwrite-chronograf:/var/lib/chronograf - # ports: - # - "8888:8888" - # environment: - # - INFLUXDB_URL=http://influxdb:8086 - # - KAPACITOR_URL=http://kapacitor:9092 - # - AUTH_DURATION=48h - # - TOKEN_SECRET=duperduper5674829!jwt - # - GH_CLIENT_ID=d86f7145a41eacfc52cc - # - GH_CLIENT_SECRET=9e0081062367a2134e7f2ea95ba1a32d08b6c8ab - # - GH_ORGS=appwrite - -networks: - gateway: - appwrite: - -volumes: - appwrite-mariadb: - appwrite-redis: - appwrite-cache: - appwrite-uploads: - appwrite-certificates: - appwrite-functions: - appwrite-influxdb: - appwrite-chronograf: - appwrite-config: diff --git a/docker/nginx.conf.template b/docker/nginx.conf.template deleted file mode 100644 index d53dd7f770..0000000000 --- a/docker/nginx.conf.template +++ /dev/null @@ -1,149 +0,0 @@ -user www-data; -worker_processes auto; -pid /run/nginx.pid; -daemon off; - -events { - worker_connections 2048; - - # multi_accept on; -} - -http { - # Basic Settings - sendfile on; - tcp_nopush on; - tcp_nodelay on; - keepalive_timeout 65; - types_hash_max_size 2048; - client_max_body_size %_APP_STORAGE_LIMIT%; - - # server_names_hash_bucket_size 64; - # server_name_in_redirect off; - include /etc/nginx/mime.types; - default_type application/octet-stream; - - # SSL Settings - #ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE - #ssl_prefer_server_ciphers on; - - ssl_protocols TLSv1 TLSv1.1 TLSv1.2; - ssl_ciphers 'kEECDH+ECDSA+AES128 kEECDH+ECDSA+AES256 kEECDH+AES128 kEECDH+AES256 kEDH+AES128 kEDH+AES256 DES-CBC3-SHA +SHA !aNULL !eNULL !LOW !kECDH !DSS !MD5 !EXP !PSK !SRP !CAMELLIA !SEED'; - ssl_prefer_server_ciphers off; - - # Logging Settings - access_log /var/log/nginx/access.log; - error_log /var/log/nginx/error.log; - - # Gzip Settings - gzip on; - gzip_disable "msie6"; - - gzip_vary on; - gzip_proxied any; - gzip_comp_level 6; - gzip_buffers 16 8k; - gzip_http_version 1.1; - gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript image/svg+xml; - - # Brotli Settings - brotli on; - brotli_comp_level 5; - brotli_static on; - brotli_types application/atom+xml application/javascript application/json application/rss+xml - application/vnd.ms-fontobject application/x-font-opentype application/x-font-truetype - application/x-font-ttf application/x-javascript application/xhtml+xml application/xml - font/eot font/opentype font/otf font/truetype image/svg+xml image/vnd.microsoft.icon - image/x-icon image/x-win-bitmap text/css text/javascript text/plain text/xml; - - # Virtual Host Configs - server { - listen 80; ## listen for ipv4; this line is default and implied - listen [::]:80 ipv6only=on; ## listen for ipv6 - listen 443 default ssl http2; - - #ssl on; - ssl_certificate /etc/nginx/ssl/cert.pem; - ssl_certificate_key /etc/nginx/ssl/key.pem; - - root /usr/src/code/public; - index index.php index.html index.htm; - - server_tokens off; - - # Make site accessible from http://localhost/ - #server_name localhost; - - # Disable sendfile as per https://docs.vagrantup.com/v2/synced-folders/virtualbox.html - sendfile off; - - # Add stdout logging - - #error_log /dev/stdout info; - #access_log /dev/stdout; - - access_log off; - - location / { - # First attempt to serve request as file, then - # as directory, then fall back to index.html - try_files $uri $uri/ /index.php?q=$uri&$args; - - } - - # Media: images, icons, video, audio, HTC - location ~* \.(?:ico|cur|gz|svg|svgz|mp4|ogg|woff|woff2|ogv|webm|htc)$ { - expires 1M; - access_log off; - add_header Cache-Control "public"; - } - - # CSS and JavaScript - location ~* \.(?:css|js)$ { - expires 1y; - access_log off; - add_header Cache-Control "public"; - } - - location /images { - expires 1y; - access_log off; - add_header Cache-Control "public"; - } - - location /favicon.png { - expires 1y; - access_log off; - add_header Cache-Control "public"; - } - - #error_page 404 /404.html; - - # redirect server error pages to the static page /50x.html - error_page 500 502 503 504 /50x.html; - location = /50x.html { - root /usr/src/code; - } - - # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 - location ~ \.php$ { - try_files $uri =404; - fastcgi_split_path_info ^(.+\.php)(/.+)$; - #fastcgi_pass unix:/var/run/php5-fpm.sock; - fastcgi_pass 127.0.0.1:9000; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_param SCRIPT_NAME $fastcgi_script_name; - fastcgi_param HTTP_IF_NONE_MATCH $http_if_none_match; - fastcgi_param HTTP_IF_MODIFIED_SINCE $http_if_modified_since; - fastcgi_read_timeout 600; - fastcgi_index index.php; - include fastcgi_params; - } - - # deny access to . files, for security - location ~ /\.(?!well-known).* { - #log_not_found off; - deny all; - } - } -} diff --git a/docker/ssl/cert.pem b/docker/ssl/cert.pem deleted file mode 100644 index 81b7243643..0000000000 --- a/docker/ssl/cert.pem +++ /dev/null @@ -1,27 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIEpDCCAowCCQDLt1wOwov7hTANBgkqhkiG9w0BAQsFADAUMRIwEAYDVQQDDAls -b2NhbGhvc3QwHhcNMTkxMTA5MTgyNDA3WhcNMjAxMTA4MTgyNDA3WjAUMRIwEAYD -VQQDDAlsb2NhbGhvc3QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCp -nPP8ck7HKPVorhtIZfxY8Mf+rnhIhenRMzDTmGtq53dhbg4I1kGcy8WZkyh6QaxQ -PyrNKZXBAQtELSWGgjL3PnVsKWVtQT2YzBSIhHTXct6RbYpd2yLmK77IOmu0DtWF -0QX5TxEB/ryDn92uGxIlKptDxqLrsbN1GhZYkXn0jVp6jIqC32YnxJVItzhSqCns -eJrF96XeXZKlN5TmSbpAwbjyZCkCCWi8q5CLpjrhFdud754pmuiJ03xQn9LXhvIx -OzQ8jPiINr+cR19sZHiAwOdb028gjL8VYdvAiOiJ85UwPwPBeCpJkS4FVWxDpBhQ -XjUGbr5YiACcUNenoEjbSut80VhyAqHVPtEY4WMFclua6vuszGQW4cyhWLKO2pN2 -lno0EakXDZT9P53OKB1gFDvpyK3LmD6B4OvddIBCbSYgAotkcojOlcHVDYJUVcN6 -VgiJQann/QLQXcgu8K0CUY4hVvtHV7RlfMc1QcOote5lpUWDpByYWw8TAUHa7MGX -VjNu4q//w3SVRW1RyxVjtgOznLvAM+kFZFV3epS9A9zyk0XyxDuqjz8oLQwKhzms -/ORaDa7WPlqyJ9mkwRWgs+zthFp5fcMJ4onwXqR9Yem4UMsugBEFFn/3kto2ZsAg -DZjrVnlWOpee645S3GRtNjpu0LFqIfYeuZmowDgYQQIDAQABMA0GCSqGSIb3DQEB -CwUAA4ICAQAbSqv901fqZn2CiSVHP7hZkbPjR3y4gMh5U5UlRviG9pu7ljN7x8Sa -XKPT6AYvDFCe3Xux0EQO2nYVkB8jkEyztZ7DjkF36ww52k/aGD+aQAahqzAgumVK -JsQ4nqek8E1FFquX4uoiVZwulWGQE5XDTJBOzLLHvEmk1xKY1AJ9eEUiUm5eKEvM -kVgQo9nRdkwqWOfV2qmYHQ5co6wpHWL9Vl+jeODeonBmsVcaYXc32bOvtKfJL2rW -8IPrvCEieFlcrK8bnjMPZe1rOichri31nsHfrO8LZFu+ZSU2xsjd4Ao0Fm99/27X -rm+e0XsHpKDok+nYUZ3O8cA16fcn2uZulbihSZDbtaxFJvzHDoBl/reJhVKsNVb8 -f99ygx1435GG9NUMTHJtlMel/vu6uujIvFVIfd9Dl3anjaPNBnhuXQCaZUISRMhF -jAiajQJzSzJknEDss+G+WHTbPip7xRl1L43AHdIqlFRwPVRV7pQWi99+2YOtYYo4 -YZmqksQeBIi8gS1T7sDIheSkvr9nr40W4ez6RIlgNYFm+RvVue1tQJNoZYH+6lvT -Qoe+YOSaXotOV9mBd8ffH84bYoMvKooldRE4q3azunCl3HDcZcjarrCFmqzIDzQw -yAlhTb8+aXDY2EHCYBmbwV9AcgPtQ5LuCPeAsh+g9pNhaqF/f/ljLA== ------END CERTIFICATE----- diff --git a/docker/ssl/key.pem b/docker/ssl/key.pem deleted file mode 100644 index 66510fc701..0000000000 --- a/docker/ssl/key.pem +++ /dev/null @@ -1,52 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIIJQwIBADANBgkqhkiG9w0BAQEFAASCCS0wggkpAgEAAoICAQCpnPP8ck7HKPVo -rhtIZfxY8Mf+rnhIhenRMzDTmGtq53dhbg4I1kGcy8WZkyh6QaxQPyrNKZXBAQtE -LSWGgjL3PnVsKWVtQT2YzBSIhHTXct6RbYpd2yLmK77IOmu0DtWF0QX5TxEB/ryD -n92uGxIlKptDxqLrsbN1GhZYkXn0jVp6jIqC32YnxJVItzhSqCnseJrF96XeXZKl -N5TmSbpAwbjyZCkCCWi8q5CLpjrhFdud754pmuiJ03xQn9LXhvIxOzQ8jPiINr+c -R19sZHiAwOdb028gjL8VYdvAiOiJ85UwPwPBeCpJkS4FVWxDpBhQXjUGbr5YiACc -UNenoEjbSut80VhyAqHVPtEY4WMFclua6vuszGQW4cyhWLKO2pN2lno0EakXDZT9 -P53OKB1gFDvpyK3LmD6B4OvddIBCbSYgAotkcojOlcHVDYJUVcN6VgiJQann/QLQ -Xcgu8K0CUY4hVvtHV7RlfMc1QcOote5lpUWDpByYWw8TAUHa7MGXVjNu4q//w3SV -RW1RyxVjtgOznLvAM+kFZFV3epS9A9zyk0XyxDuqjz8oLQwKhzms/ORaDa7WPlqy -J9mkwRWgs+zthFp5fcMJ4onwXqR9Yem4UMsugBEFFn/3kto2ZsAgDZjrVnlWOpee -645S3GRtNjpu0LFqIfYeuZmowDgYQQIDAQABAoICADrBq2fldVLa5oDX542h/tQU -vUOFzxdYhJI7CIwUfgmvm5R92pDHID2f/Zjg+KG5hGbcKwidgko1AWEhvqElE2DB -G05X3NIHSr5W3DoaoJtOKLn6V3eCBUn1F4cnbc4XYXKU4VvnPv4Q798tD09UA2oq -o1TMR/4cNg239svBwZytJw3TB9ykZTAbkpd5GSLRLIzFjuBLlQM+KSHg6k0Id2Qd -d+NIPUh+V/EcAdvOvxDgUI8axhCloC62u5b2dsTA87+IQeVD9IjDZodN1kmnWHNJ -4BvYV+PPvhY7KzQ8eUnovuLSwYtRBF0t1OJ2ICYif2W/7OCIlpn2qzd7bemcxf/Z -EhZDW856ZluZy5QVAOEWslHCF2di1PoxSJSoyhdHeJHd8QLMUxpKWMAJwakwNJ7W -LximvjCihxq+MoGXhOtQLKFV5YxXqt0/cMaU4QHromInP7o4eSdleQd91W5c5+Fl -4gj9ICHpVXOhbuhO+cx/k53nEMHsyA4XotHgcrF50wUy4Ow9FqaGG0gmL3GEWzbn -S2KUEfPC8nUqezdqtaPpjmQbL4rTp11pYsrN3pd48j+WNodqu2Mi2r3kT3EcvosI -8okAdW82GhMWZjmGn6SLB//RegP7E28sbqEFZFUPvOd2g+Lma/kVAx7qI4/5ndey -pffNnfHgqqNiSe9WsG0BAoIBAQDcKtrKpuBpb3ENZf1Q0EWBi1RveilKGbaHPrq0 -ESiiLfG1nyL5o0LI/LEYspjiad5Z/VDPLpRux7yI2fDHYeDsMvVeHCjvJe2Csw4D -iYSeHGIBMgsMI8573+t0DqFHdfe97Ds1JFflpotnAo8dBwu6bxvXLofCQZuLwa7E -73G515JqK9Koxv32Wp6RnnkKRxRPwFpmjbepwWf2nUvndyy0YjlmpNSsg89Nc2cA -a86k/V2Wt7Nt9I4hPZ9E4CeW2DakJnm5fasBEPiK7qtt2bp+/YPQNACGJarIy+3F -OcRdA0gTDZ9x9H3zHS9G5Dn1Szp3dG7dhVoIMyRILAG5d8yxAoIBAQDFN8h48RPH -K85guCiDrIO1dpG773YFJ/vy6zMXKf8bF4Hw2LaIO1adKvMIIJbpvGcvmFWLsU+I -XbZjeoMe9LH60m0tIqGxvV7SSbHPX/1MmDOoSw83e0x0LOKaWocmorxBhtOdeAB9 -WT5xb7K9exgUKBi2dYLW0P+WUG4n0M4RivB6y1mKIRNtqcaDu0ZbyW+cAF7G4RlM -CFV89dcM36DwvvVe4R7HPSk+tDgm01gocYEntC6K26BeW65k2Sfe9CJAEGazdbak -u8v9PJ55XZWyGkIVpoKF4loF7BYdzoOmgkYM+f0afMyhmBfJ5H6fNFYLgrutmg4b -8YCvaL2D2aiRAoIBAQCnMvxZLgX6zCEE1dFcT+6ZBKCo0BMPLRvK9b6ABQ/gqheH -oETFZFDRpeUwJmGogFHV8WQvEuaygokRPMF4CULw3XotcCE+DIWk3inkUcke8dsT -oVd2brLerBx5VKryRApSd1Y3c1Q1GReAsRbSKomjmcGA1ttOkNh5eCsrb9PkGGwe -qQ0gE47GSedmGv086uHn9uIwQ6uZBUHYrXf5Xi3bB0UkSEUihi8mWF9+mGCkN62d -SgC/nhtZ7xxHCBvImIZWfsmuLltxQdweVkZl9BWHXyt9MCC9v1lFiGkXgFk5ccaI -ga32sn/74swGgEfrmqfaE9gl7qGC3KPPE2xz1yDhAoIBAEoECYT6VUXmtumts+bX -FAdCnKc/07dTrkcY5m/HHyr3w5i0fKzcOEF8IQHn2TuXrdI7BcALp6GyKgVjsVoo -07Mizj6mRLEENVYOumDt0Y6xgJGkue1EpQjk35a2awqhAK5G/5yVsPlaSQkhtp9O -V1cZRU0VBSnB/mpXfUAMKYqD7oTnVI92omgB07MU0e8Yxn5x1SAm0uuqJQtk6HS4 -aRpxUH1vV7HGznfuAzTvFKL5FlPkV6Ndke5X0jefGEugrEoG3cR0ZTumD4TW/1Ll -QI07NZoSh+HfdZHLbPF61AXl1oyANfF+7P2oqyTmUG9HoRNo2S7qJmluVbF/ScD2 -K0ECggEBAJj8ZlacBoTxXy9mf6pMnDpCznzhs1AHQMZ6XIqgW3QoUNkAm4Fnf7G4 -PdhXRAm2NeQ+CSBtmHl7PZHzLlF4RcQnC9DQHy/P+PGfcYfwWNqZyF7pAkwhtFYK -zsxekl6PxjZ6DvclwU3jgQ4OiNElcF2Yjhtwh0nryyz+SktJieFKoWUz1F71tONw -5TNbiKb1sWKzZvvcvyjUdLuMH/HzfNg5ZxxiJHrD0Zga1jLMzZil+eYhIbUuQT9b -IdEYCvfruwoF/SjjPH/aDPu6jZug/iE288Msqm/YGC9uTW1/GLhrpIyWdposa1Jh -Fdo3SqBMHZO0uGFt0FSpZNv0jNUJdB0= ------END PRIVATE KEY----- diff --git a/docker/supervisord.conf b/docker/supervisord.conf deleted file mode 100644 index 4d3361cc94..0000000000 --- a/docker/supervisord.conf +++ /dev/null @@ -1,200 +0,0 @@ -[unix_http_server] -file=/tmp/supervisor.sock ; (the path to the socket file) - -[supervisord] -;logfile=/tmp/supervisord.log ; (main log file;default.conf $CWD/supervisord.log) -logfile=/dev/null -logfile_maxbytes=0 ; (max main logfile bytes b4 rotation;default.conf 50MB) -logfile_backups=10 ; (num of main logfile rotation backups;default.conf 10) -loglevel=info ; (log level;default.conf info; others: debug,warn,trace) -pidfile=/tmp/supervisord.pid ; (supervisord pidfile;default.conf supervisord.pid) -nodaemon=false ; (start in foreground if true;default.conf false) -minfds=1024 ; (min. avail startup file descriptors;default.conf 1024) -minprocs=200 ; (min. avail process descriptors;default.conf 200) -user=root ; - -; the below section must remain in the config file for RPC -; (supervisorctl/web interface) to work, additional interfaces may be -; added by defining them in separate rpcinterface: sections -[rpcinterface:supervisor] -supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface - -[supervisorctl] -serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket - -[program:php7-fpm] -command=php-fpm%(ENV_PHP_VERSION)s -F -autostart=true -autorestart=true -priority=5 -stdout_events_enabled=true -stderr_events_enabled=true -startretries=10 -;stdout_logfile=/dev/stdout -;stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes = 0 - -[program:nginx] -command=nginx -autostart=true -autorestart=true -priority=10 -stdout_events_enabled=true -stderr_events_enabled=true -startretries=10 -;stdout_logfile=/dev/stdout -;stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes = 0 - -[program:v1-webhooks] -command=php /usr/src/code/vendor/bin/resque -autostart=true -autorestart=true -priority=10 -environment=QUEUE='v1-webhooks',APP_INCLUDE='/usr/src/code/app/workers/webhooks.php',REDIS_BACKEND='%(ENV__APP_REDIS_HOST)s:%(ENV__APP_REDIS_PORT)s' -stdout_events_enabled=true -stderr_events_enabled=true -stopsignal=QUIT -startretries=10 -;stdout_logfile=/dev/stdout -;stdout_logfile_maxbytes=0 -stdout_logfile=/var/log/appwrite.log -stdout_logfile_maxbytes=5000000 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes = 0 - -[program:v1-mails] -command=php /usr/src/code/vendor/bin/resque -autostart=true -autorestart=true -priority=10 -environment=QUEUE='v1-mails',APP_INCLUDE='/usr/src/code/app/workers/mails.php',REDIS_BACKEND='%(ENV__APP_REDIS_HOST)s:%(ENV__APP_REDIS_PORT)s' -stdout_events_enabled=true -stderr_events_enabled=true -stopsignal=QUIT -startretries=10 -;stdout_logfile=/dev/stdout -;stdout_logfile_maxbytes=0 -stdout_logfile=/var/log/appwrite.log -stdout_logfile_maxbytes=5000000 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes = 0 - -[program:v1-audits] -command=php /usr/src/code/vendor/bin/resque -autostart=true -autorestart=true -priority=10 -environment=QUEUE='v1-audits',APP_INCLUDE='/usr/src/code/app/workers/audits.php',REDIS_BACKEND='%(ENV__APP_REDIS_HOST)s:%(ENV__APP_REDIS_PORT)s' -stdout_events_enabled=true -stderr_events_enabled=true -stopsignal=QUIT -startretries=10 -;stdout_logfile=/dev/stdout -;stdout_logfile_maxbytes=0 -stdout_logfile=/var/log/appwrite.log -stdout_logfile_maxbytes=5000000 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes = 0 - -[program:v1-usage] -command=php /usr/src/code/vendor/bin/resque -autostart=true -autorestart=true -priority=10 -environment=QUEUE='v1-usage',APP_INCLUDE='/usr/src/code/app/workers/usage.php',REDIS_BACKEND='%(ENV__APP_REDIS_HOST)s:%(ENV__APP_REDIS_PORT)s' -stdout_events_enabled=true -stderr_events_enabled=true -stopsignal=QUIT -startretries=10 -;stdout_logfile=/dev/stdout -;stdout_logfile_maxbytes=0 -stdout_logfile=/var/log/appwrite.log -stdout_logfile_maxbytes=5000000 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes = 0 - -[program:v1-tasks] -command=php /usr/src/code/vendor/bin/resque -autostart=true -autorestart=true -priority=10 -environment=QUEUE='v1-tasks',APP_INCLUDE='/usr/src/code/app/workers/tasks.php',REDIS_BACKEND='%(ENV__APP_REDIS_HOST)s:%(ENV__APP_REDIS_PORT)s' -stdout_events_enabled=true -stderr_events_enabled=true -stopsignal=QUIT -startretries=10 -;stdout_logfile=/dev/stdout -;stdout_logfile_maxbytes=0 -stdout_logfile=/var/log/appwrite.log -stdout_logfile_maxbytes=5000000 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes = 0 - -[program:v1-deletes] -command=php /usr/src/code/vendor/bin/resque -autostart=true -autorestart=true -priority=10 -environment=QUEUE='v1-deletes',APP_INCLUDE='/usr/src/code/app/workers/deletes.php',REDIS_BACKEND='%(ENV__APP_REDIS_HOST)s:%(ENV__APP_REDIS_PORT)s' -stdout_events_enabled=true -stderr_events_enabled=true -stopsignal=QUIT -startretries=10 -;stdout_logfile=/dev/stdout -;stdout_logfile_maxbytes=0 -stdout_logfile=/var/log/appwrite.log -stdout_logfile_maxbytes=5000000 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes = 0 - -[program:v1-certificates] -command=php /usr/src/code/vendor/bin/resque -autostart=true -autorestart=true -priority=10 -environment=QUEUE='v1-certificates',APP_INCLUDE='/usr/src/code/app/workers/certificates.php',REDIS_BACKEND='%(ENV__APP_REDIS_HOST)s:%(ENV__APP_REDIS_PORT)s' -stdout_events_enabled=true -stderr_events_enabled=true -stopsignal=QUIT -startretries=10 -;stdout_logfile=/dev/stdout -;stdout_logfile_maxbytes=0 -stdout_logfile=/var/log/appwrite.log -stdout_logfile_maxbytes=5000000 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes = 0 - -[program:v1-functions] -command=php /usr/src/code/vendor/bin/resque -autostart=true -autorestart=true -priority=10 -environment=QUEUE='v1-functions',APP_INCLUDE='/usr/src/code/app/workers/functions.php',REDIS_BACKEND='%(ENV__APP_REDIS_HOST)s:%(ENV__APP_REDIS_PORT)s' -stdout_events_enabled=true -stderr_events_enabled=true -stopsignal=QUIT -startretries=10 -;stdout_logfile=/dev/stdout -;stdout_logfile_maxbytes=0 -stdout_logfile=/var/log/appwrite.log -stdout_logfile_maxbytes=5000000 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes = 0 - -[program:v1-schedule] -command=php /usr/src/code/vendor/bin/resque-scheduler -autostart=true -autorestart=true -priority=10 -environment=REDIS_BACKEND='%(ENV__APP_REDIS_HOST)s:%(ENV__APP_REDIS_PORT)s',RESQUE_PHP='/usr/src/code/vendor/autoload.php' -stdout_events_enabled=true -stderr_events_enabled=true -stopsignal=QUIT -startretries=10 -;stdout_logfile=/dev/stdout -;stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes = 0 diff --git a/docker/www.conf b/docker/www.conf deleted file mode 100644 index 152502e617..0000000000 --- a/docker/www.conf +++ /dev/null @@ -1,412 +0,0 @@ -; Start a new pool named 'www'. -; the variable $pool can we used in any directive and will be replaced by the -; pool name ('www' here) -[www] - -; Per pool prefix -; It only applies on the following directives: -; - 'access.log' -; - 'slowlog' -; - 'listen' (unixsocket) -; - 'chroot' -; - 'chdir' -; - 'php_values' -; - 'php_admin_values' -; When not set, the global prefix (or /usr) applies instead. -; Note: This directive can also be relative to the global prefix. -; Default Value: none -;prefix = /path/to/pools/$pool - -; Unix user/group of processes -; Note: The user is mandatory. If the group is not set, the default user's group -; will be used. -user = www-data -group = www-data - -; The address on which to accept FastCGI requests. -; Valid syntaxes are: -; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on -; a specific port; -; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on -; a specific port; -; 'port' - to listen on a TCP socket to all IPv4 addresses on a -; specific port; -; '[::]:port' - to listen on a TCP socket to all addresses -; (IPv6 and IPv4-mapped) on a specific port; -; '/path/to/unix/socket' - to listen on a unix socket. -; Note: This value is mandatory. -; listen = /var/run/php5-fpm.sock -listen = 127.0.0.1:9000 - -; Set listen(2) backlog. -; Default Value: 65535 (-1 on FreeBSD and OpenBSD) -;listen.backlog = 65535 - -; Set permissions for unix socket, if one is used. In Linux, read/write -; permissions must be set in order to allow connections from a web server. Many -; BSD-derived systems allow connections regardless of permissions. -; Default Values: user and group are set as the running user -; mode is set to 0660 -listen.owner = www-data -listen.group = www-data -;listen.mode = 0660 -; When POSIX Access Control Lists are supported you can set them using -; these options, value is a comma separated list of user/group names. -; When set, listen.owner and listen.group are ignored -;listen.acl_users = -;listen.acl_groups = - -; List of addresses (IPv4/IPv6) of FastCGI clients which are allowed to connect. -; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original -; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address -; must be separated by a comma. If this value is left blank, connections will be -; accepted from any ip address. -; Default Value: any -;listen.allowed_clients = 127.0.0.1 - -; Specify the nice(2) priority to apply to the pool processes (only if set) -; The value can vary from -19 (highest priority) to 20 (lower priority) -; Note: - It will only work if the FPM master process is launched as root -; - The pool processes will inherit the master process priority -; unless it specified otherwise -; Default Value: no set -; process.priority = -19 - -; Choose how the process manager will control the number of child processes. -; Possible Values: -; static - a fixed number (pm.max_children) of child processes; -; dynamic - the number of child processes are set dynamically based on the -; following directives. With this process management, there will be -; always at least 1 children. -; pm.max_children - the maximum number of children that can -; be alive at the same time. -; pm.start_servers - the number of children created on startup. -; pm.min_spare_servers - the minimum number of children in 'idle' -; state (waiting to process). If the number -; of 'idle' processes is less than this -; number then some children will be created. -; pm.max_spare_servers - the maximum number of children in 'idle' -; state (waiting to process). If the number -; of 'idle' processes is greater than this -; number then some children will be killed. -; ondemand - no children are created at startup. Children will be forked when -; new requests will connect. The following parameter are used: -; pm.max_children - the maximum number of children that -; can be alive at the same time. -; pm.process_idle_timeout - The number of seconds after which -; an idle process will be killed. -; Note: This value is mandatory. -pm = dynamic - -; The number of child processes to be created when pm is set to 'static' and the -; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'. -; This value sets the limit on the number of simultaneous requests that will be -; served. Equivalent to the ApacheMaxClients directive with mpm_prefork. -; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP -; CGI. The below defaults are based on a server without much resources. Don't -; forget to tweak pm.* to fit your needs. -; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand' -; Note: This value is mandatory. -pm.max_children = 5 - -; The number of child processes created on startup. -; Note: Used only when pm is set to 'dynamic' -; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2 -pm.start_servers = 2 - -; The desired minimum number of idle server processes. -; Note: Used only when pm is set to 'dynamic' -; Note: Mandatory when pm is set to 'dynamic' -pm.min_spare_servers = 1 - -; The desired maximum number of idle server processes. -; Note: Used only when pm is set to 'dynamic' -; Note: Mandatory when pm is set to 'dynamic' -pm.max_spare_servers = 3 - -; The number of seconds after which an idle process will be killed. -; Note: Used only when pm is set to 'ondemand' -; Default Value: 10s -;pm.process_idle_timeout = 10s; - -; The number of requests each child process should execute before respawning. -; This can be useful to work around memory leaks in 3rd party libraries. For -; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS. -; Default Value: 0 -;pm.max_requests = 500 - -; The URI to view the FPM status page. If this value is not set, no URI will be -; recognized as a status page. It shows the following informations: -; pool - the name of the pool; -; process manager - static, dynamic or ondemand; -; start time - the date and time FPM has started; -; start since - number of seconds since FPM has started; -; accepted conn - the number of request accepted by the pool; -; listen queue - the number of request in the queue of pending -; connections (see backlog in listen(2)); -; max listen queue - the maximum number of requests in the queue -; of pending connections since FPM has started; -; listen queue len - the size of the socket queue of pending connections; -; idle processes - the number of idle processes; -; active processes - the number of active processes; -; total processes - the number of idle + active processes; -; max active processes - the maximum number of active processes since FPM -; has started; -; max children reached - number of times, the process limit has been reached, -; when pm tries to start more children (works only for -; pm 'dynamic' and 'ondemand'); -; Value are updated in real time. -; Example output: -; pool: www -; process manager: static -; start time: 01/Jul/2011:17:53:49 +0200 -; start since: 62636 -; accepted conn: 190460 -; listen queue: 0 -; max listen queue: 1 -; listen queue len: 42 -; idle processes: 4 -; active processes: 11 -; total processes: 15 -; max active processes: 12 -; max children reached: 0 -; -; By default the status page output is formatted as text/plain. Passing either -; 'html', 'xml' or 'json' in the query string will return the corresponding -; output syntax. Example: -; http://www.foo.bar/status -; http://www.foo.bar/status?json -; http://www.foo.bar/status?html -; http://www.foo.bar/status?xml -; -; By default the status page only outputs short status. Passing 'full' in the -; query string will also return status for each pool process. -; Example: -; http://www.foo.bar/status?full -; http://www.foo.bar/status?json&full -; http://www.foo.bar/status?html&full -; http://www.foo.bar/status?xml&full -; The Full status returns for each process: -; pid - the PID of the process; -; state - the state of the process (Idle, Running, ...); -; start time - the date and time the process has started; -; start since - the number of seconds since the process has started; -; requests - the number of requests the process has served; -; request duration - the duration in µs of the requests; -; request method - the request method (GET, POST, ...); -; request URI - the request URI with the query string; -; content length - the content length of the request (only with POST); -; user - the user (PHP_AUTH_USER) (or '-' if not set); -; script - the main script called (or '-' if not set); -; last request cpu - the %cpu the last request consumed -; it's always 0 if the process is not in Idle state -; because CPU calculation is done when the request -; processing has terminated; -; last request memory - the max amount of memory the last request consumed -; it's always 0 if the process is not in Idle state -; because memory calculation is done when the request -; processing has terminated; -; If the process is in Idle state, then informations are related to the -; last request the process has served. Otherwise informations are related to -; the current request being served. -; Example output: -; ************************ -; pid: 31330 -; state: Running -; start time: 01/Jul/2011:17:53:49 +0200 -; start since: 63087 -; requests: 12808 -; request duration: 1250261 -; request method: GET -; request URI: /test_mem.php?N=10000 -; content length: 0 -; user: - -; script: /home/fat/web/docs/php/test_mem.php -; last request cpu: 0.00 -; last request memory: 0 -; -; Note: There is a real-time FPM status monitoring sample web page available -; It's available in: /usr/share/php5/fpm/status.html -; -; Note: The value must start with a leading slash (/). The value can be -; anything, but it may not be a good idea to use the .php extension or it -; may conflict with a real PHP file. -; Default Value: not set -;pm.status_path = /status - -; The ping URI to call the monitoring page of FPM. If this value is not set, no -; URI will be recognized as a ping page. This could be used to test from outside -; that FPM is alive and responding, or to -; - create a graph of FPM availability (rrd or such); -; - remove a server from a group if it is not responding (load balancing); -; - trigger alerts for the operating team (24/7). -; Note: The value must start with a leading slash (/). The value can be -; anything, but it may not be a good idea to use the .php extension or it -; may conflict with a real PHP file. -; Default Value: not set -;ping.path = /ping - -; This directive may be used to customize the response of a ping request. The -; response is formatted as text/plain with a 200 response code. -; Default Value: pong -;ping.response = pong - -; The access log file -; Default: not set -;access.log = log/$pool.access.log - -; The access log format. -; The following syntax is allowed -; %%: the '%' character -; %C: %CPU used by the request -; it can accept the following format: -; - %{user}C for user CPU only -; - %{system}C for system CPU only -; - %{total}C for user + system CPU (default) -; %d: time taken to serve the request -; it can accept the following format: -; - %{seconds}d (default) -; - %{miliseconds}d -; - %{mili}d -; - %{microseconds}d -; - %{micro}d -; %e: an environment variable (same as $_ENV or $_SERVER) -; it must be associated with embraces to specify the name of the env -; variable. Some exemples: -; - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e -; - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e -; %f: script filename -; %l: content-length of the request (for POST request only) -; %m: request method -; %M: peak of memory allocated by PHP -; it can accept the following format: -; - %{bytes}M (default) -; - %{kilobytes}M -; - %{kilo}M -; - %{megabytes}M -; - %{mega}M -; %n: pool name -; %o: output header -; it must be associated with embraces to specify the name of the header: -; - %{Content-Type}o -; - %{X-Powered-By}o -; - %{Transfert-Encoding}o -; - .... -; %p: PID of the child that serviced the request -; %P: PID of the parent of the child that serviced the request -; %q: the query string -; %Q: the '?' character if query string exists -; %r: the request URI (without the query string, see %q and %Q) -; %R: remote IP address -; %s: status (response code) -; %t: server time the request was received -; it can accept a strftime(3) format: -; %d/%b/%Y:%H:%M:%S %z (default) -; %T: time the log has been written (the request has finished) -; it can accept a strftime(3) format: -; %d/%b/%Y:%H:%M:%S %z (default) -; %u: remote user -; -; Default: "%R - %u %t \"%m %r\" %s" -;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%" - -; The log file for slow requests -; Default Value: not set -; Note: slowlog is mandatory if request_slowlog_timeout is set -;slowlog = log/$pool.log.slow - -; The timeout for serving a single request after which a PHP backtrace will be -; dumped to the 'slowlog' file. A value of '0s' means 'off'. -; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) -; Default Value: 0 -;request_slowlog_timeout = 0 - -; The timeout for serving a single request after which the worker process will -; be killed. This option should be used when the 'max_execution_time' ini option -; does not stop script execution for some reason. A value of '0' means 'off'. -; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) -; Default Value: 0 -;request_terminate_timeout = 0 - -; Set open file descriptor rlimit. -; Default Value: system defined value -;rlimit_files = 1024 - -; Set max core size rlimit. -; Possible Values: 'unlimited' or an integer greater or equal to 0 -; Default Value: system defined value -;rlimit_core = 0 - -; Chroot to this directory at the start. This value must be defined as an -; absolute path. When this value is not set, chroot is not used. -; Note: you can prefix with '$prefix' to chroot to the pool prefix or one -; of its subdirectories. If the pool prefix is not set, the global prefix -; will be used instead. -; Note: chrooting is a great security feature and should be used whenever -; possible. However, all PHP paths will be relative to the chroot -; (error_log, sessions.save_path, ...). -; Default Value: not set -;chroot = - -; Chdir to this directory at the start. -; Note: relative path can be used. -; Default Value: current directory or / when chroot -chdir = / - -; Redirect worker stdout and stderr into main error log. If not set, stdout and -; stderr will be redirected to /dev/null according to FastCGI specs. -; Note: on highloaded environement, this can cause some delay in the page -; process time (several ms). -; Default Value: no -;catch_workers_output = yes - -; Clear environment in FPM workers -; Prevents arbitrary environment variables from reaching FPM worker processes -; by clearing the environment in workers before env vars specified in this -; pool configuration are added. -; Setting to "no" will make all environment variables available to PHP code -; via getenv(), $_ENV and $_SERVER. -; Default Value: yes -;clear_env = no - -; Limits the extensions of the main script FPM will allow to parse. This can -; prevent configuration mistakes on the web server side. You should only limit -; FPM to .php extensions to prevent malicious users to use other extensions to -; exectute php code. -; Note: set an empty value to allow all extensions. -; Default Value: .php -;security.limit_extensions = .php .php3 .php4 .php5 - -; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from -; the current environment. -; Default Value: clean env -;env[HOSTNAME] = $HOSTNAME -;env[PATH] = /usr/local/bin:/usr/bin:/bin -;env[TMP] = /tmp -;env[TMPDIR] = /tmp -;env[TEMP] = /tmp - -; Additional php.ini defines, specific to this pool of workers. These settings -; overwrite the values previously defined in the php.ini. The directives are the -; same as the PHP SAPI: -; php_value/php_flag - you can set classic ini defines which can -; be overwritten from PHP call 'ini_set'. -; php_admin_value/php_admin_flag - these directives won't be overwritten by -; PHP call 'ini_set' -; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no. - -; Defining 'extension' will load the corresponding shared extension from -; extension_dir. Defining 'disable_functions' or 'disable_classes' will not -; overwrite previously defined php.ini values, but will append the new value -; instead. - -; Note: path INI options can be relative and will be expanded with the prefix -; (pool, global or /usr) - -; Default Value: nothing is defined by default except the values in php.ini and -; specified at startup with the -d argument -;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com -;php_flag[display_errors] = off -;php_admin_value[error_log] = /var/log/fpm-php.www.log -;php_admin_flag[log_errors] = on -;php_admin_value[memory_limit] = 32M From b464a761ced95c71288e1dab028a4f0f5e5f094c Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Fri, 15 Jan 2021 00:22:54 +0200 Subject: [PATCH 172/230] Removed old index.php --- public/index.php | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 public/index.php diff --git a/public/index.php b/public/index.php deleted file mode 100644 index 4b08fcc704..0000000000 --- a/public/index.php +++ /dev/null @@ -1,27 +0,0 @@ -run(new Request(), new Response()); From defc91ecf45068a76568394c8c309a6bae9e9c21 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Fri, 15 Jan 2021 00:33:41 +0200 Subject: [PATCH 173/230] Fix CI --- .travis.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index c395a2d73c..6d87d519ad 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,20 +13,20 @@ services: - docker before_install: - - curl -fsSL https://get.docker.com | sh - - echo '{"experimental":"enabled"}' | sudo tee /etc/docker/daemon.json - - mkdir -p $HOME/.docker - - echo '{"experimental":"enabled"}' | sudo tee $HOME/.docker/config.json - - sudo service docker start - - > - if [ ! -z "${DOCKERHUB_PULL_USERNAME:-}" ]; then - set +x - echo "${DOCKERHUB_PULL_PASSWORD}" | docker login --username "${DOCKERHUB_PULL_USERNAME}" --password-stdin - set -x - fi +- curl -fsSL https://get.docker.com | sh +- echo '{"experimental":"enabled"}' | sudo tee /etc/docker/daemon.json +- mkdir -p $HOME/.docker +- echo '{"experimental":"enabled"}' | sudo tee $HOME/.docker/config.json +- sudo service docker start +- > + if [ ! -z "${DOCKERHUB_PULL_USERNAME:-}" ]; then + set +x + echo "${DOCKERHUB_PULL_PASSWORD}" | docker login --username "${DOCKERHUB_PULL_USERNAME}" --password-stdin + set -x + fi +- docker --version install: -- docker --version - docker-compose up -d - sleep 10 From 17c90846e10741d7901993bd34fb23f7213ae4f4 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Fri, 15 Jan 2021 07:30:49 +0200 Subject: [PATCH 174/230] Fixed syntax bug in functions service --- app/controllers/api/functions.php | 2 +- app/workers/functions.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index 54df37ab21..0572b8137c 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -157,7 +157,7 @@ App::get('/v1/functions/:functionId/usage') throw new Exception('Function not found', 404); } - if($App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled') { + if(App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled') { $period = [ '24h' => [ 'start' => DateTime::createFromFormat('U', \strtotime('-24 hours')), diff --git a/app/workers/functions.php b/app/workers/functions.php index bb74bb0e60..577e847337 100644 --- a/app/workers/functions.php +++ b/app/workers/functions.php @@ -471,7 +471,7 @@ class FunctionsV1 ->setParam('networkResponseSize', 0) ; - if($App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled') { + if(App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled') { $usage->trigger(); } From 0ee954bfeb3b988c553bf45b686f52e0091c5b70 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Fri, 15 Jan 2021 08:02:48 +0200 Subject: [PATCH 175/230] Cleaning workers --- app/workers/audits.php | 2 +- app/workers/certificates.php | 2 +- app/workers/deletes.php | 2 +- app/workers/functions.php | 51 ++++++++---------------------------- app/workers/mails.php | 2 +- app/workers/tasks.php | 2 +- app/workers/usage.php | 2 +- app/workers/webhooks.php | 2 +- 8 files changed, 18 insertions(+), 47 deletions(-) diff --git a/app/workers/audits.php b/app/workers/audits.php index 3f21ba5b63..d6027dd2e3 100644 --- a/app/workers/audits.php +++ b/app/workers/audits.php @@ -6,7 +6,7 @@ use Utopia\CLI\Console; require_once __DIR__.'/../init.php'; -\cli_set_process_title('Audits V1 Worker'); +Console::title('Audits V1 Worker'); Console::success(APP_NAME.' audits worker v1 has started'); diff --git a/app/workers/certificates.php b/app/workers/certificates.php index ef478fcde5..a072897d82 100644 --- a/app/workers/certificates.php +++ b/app/workers/certificates.php @@ -12,7 +12,7 @@ use Appwrite\Network\Validator\CNAME; require_once __DIR__.'/../init.php'; -\cli_set_process_title('Certificates V1 Worker'); +Console::title('Certificates V1 Worker'); Console::success(APP_NAME.' certificates worker v1 has started'); diff --git a/app/workers/deletes.php b/app/workers/deletes.php index 36d68f0f9f..cf9aa2c453 100644 --- a/app/workers/deletes.php +++ b/app/workers/deletes.php @@ -15,7 +15,7 @@ use Utopia\Audit\Adapters\MySQL as AuditAdapter; require_once __DIR__.'/../init.php'; -\cli_set_process_title('Deletes V1 Worker'); +Console::title('Deletes V1 Worker'); Console::success(APP_NAME.' deletes worker v1 has started'."\n"); diff --git a/app/workers/functions.php b/app/workers/functions.php index 577e847337..2712dc74f1 100644 --- a/app/workers/functions.php +++ b/app/workers/functions.php @@ -1,7 +1,4 @@ Network (docker stats --no-stream --format="{{.NetIO}}" appwrite) - * -> CPU Time - DONE - * -> Invoctions (+1) - DONE - */ - class FunctionsV1 { public $args = []; @@ -380,6 +342,15 @@ class FunctionsV1 unset($list[$container]); } + /** + * Limit CPU Usage - DONE + * Limit Memory Usage - DONE + * Limit Network Usage + * Limit Storage Usage (//--storage-opt size=120m \) + * Make sure no access to redis, mariadb, influxdb or other system services + * Make sure no access to NFS server / storage volumes + * Access Appwrite REST from internal network for improved performance + */ if(!isset($list[$container])) { // Create contianer if not ready $stdout = ''; $stderr = ''; diff --git a/app/workers/mails.php b/app/workers/mails.php index 5431ee9225..6f4422b57f 100644 --- a/app/workers/mails.php +++ b/app/workers/mails.php @@ -5,7 +5,7 @@ use Utopia\CLI\Console; require_once __DIR__.'/../init.php'; -\cli_set_process_title('Mails V1 Worker'); +Console::title('Mails V1 Worker'); Console::success(APP_NAME.' mails worker v1 has started'."\n"); diff --git a/app/workers/tasks.php b/app/workers/tasks.php index f654748a6d..3f2c0957b9 100644 --- a/app/workers/tasks.php +++ b/app/workers/tasks.php @@ -11,7 +11,7 @@ use Cron\CronExpression; require_once __DIR__.'/../init.php'; -\cli_set_process_title('Tasks V1 Worker'); +Console::title('Tasks V1 Worker'); Console::success(APP_NAME.' tasks worker v1 has started'); diff --git a/app/workers/usage.php b/app/workers/usage.php index c0486c4bbc..c83ae7ae30 100644 --- a/app/workers/usage.php +++ b/app/workers/usage.php @@ -5,7 +5,7 @@ use Utopia\CLI\Console; require_once __DIR__.'/../init.php'; -\cli_set_process_title('Usage V1 Worker'); +Console::title('Usage V1 Worker'); Console::success(APP_NAME.' usage worker v1 has started'); diff --git a/app/workers/webhooks.php b/app/workers/webhooks.php index 76c94a79fe..21e88e6b43 100644 --- a/app/workers/webhooks.php +++ b/app/workers/webhooks.php @@ -10,7 +10,7 @@ use Appwrite\Database\Validator\Authorization; require_once __DIR__.'/../init.php'; -\cli_set_process_title('Webhooks V1 Worker'); +Console::title('Webhooks V1 Worker'); Console::success(APP_NAME.' webhooks worker v1 has started'); From f9afa2c95152b15eb079c1c65f249be4fe201c75 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Fri, 15 Jan 2021 19:48:36 +0200 Subject: [PATCH 176/230] Minor refactoring --- .env | 2 +- app/config/variables.php | 13 +++++++------ app/controllers/general.php | 4 ++-- docker-compose.yml | 23 ++--------------------- tests/e2e/General/HTTPTest.php | 2 +- 5 files changed, 13 insertions(+), 31 deletions(-) diff --git a/.env b/.env index 1cc5b84a31..b6e3f7a2e6 100644 --- a/.env +++ b/.env @@ -3,6 +3,7 @@ _APP_ENV=development _APP_SYSTEM_EMAIL_NAME=Appwrite _APP_SYSTEM_EMAIL_ADDRESS=team@appwrite.io _APP_SYSTEM_SECURITY_EMAIL_ADDRESS=security@appwrite.io +_APP_SYSTEM_RESPONSE_FORMAT= _APP_OPTIONS_ABUSE=disabled _APP_OPTIONS_FORCE_HTTPS=disabled _APP_OPENSSL_KEY_V1=your-secret-key @@ -34,5 +35,4 @@ _APP_FUNCTIONS_CPUS=1 _APP_FUNCTIONS_MEMORY=128 _APP_FUNCTIONS_MEMORY_SWAP=128 _APP_MAINTENANCE_INTERVAL=86400 -_APP_SYSTEM_RESPONSE_FORMAT= _APP_USAGE_STATS=enabled \ No newline at end of file diff --git a/app/config/variables.php b/app/config/variables.php index d713acd5bf..2189dc264f 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -93,6 +93,13 @@ return [ 'required' => false, 'question' => '', ], + [ + 'name' => '_APP_SYSTEM_RESPONSE_FORMAT', + 'description' => '', + 'default' => '', + 'required' => false, + 'question' => '', + ], [ 'name' => '_APP_USAGE_STATS', 'description' => 'This variable allows you to disable the collection and displaying of usage stats. This value is set to \'enabled\' by default, to disable the usage stats set the value to \'disabled\'. When disabled, it\'s recommended to turn off the Worker Usage, Influxdb and Telegraf containers for better resource usage.', @@ -359,10 +366,4 @@ return [ ], ], ], - [ - 'name' => '_APP_SYSTEM_RESPONSE_FORMAT', - 'default' => '', - 'required' => false, - 'question' => '', - ], ]; \ No newline at end of file diff --git a/app/controllers/general.php b/app/controllers/general.php index e718cc9b59..dfb28d50a1 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -116,7 +116,7 @@ App::init(function ($utopia, $request, $response, $console, $project, $user, $lo ->addHeader('Server', 'Appwrite') ->addHeader('X-Content-Type-Options', 'nosniff') ->addHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, PATCH, DELETE') - ->addHeader('Access-Control-Allow-Headers', 'Origin, Cookie, Set-Cookie, X-Requested-With, Content-Type, Access-Control-Allow-Origin, Access-Control-Request-Headers, Accept, X-Appwrite-Project, X-Appwrite-Key, X-Appwrite-Locale, X-Appwrite-Mode, X-SDK-Version, Cache-Control, Expires, Pragma') + ->addHeader('Access-Control-Allow-Headers', 'Origin, Cookie, Set-Cookie, X-Requested-With, Content-Type, Access-Control-Allow-Origin, Access-Control-Request-Headers, Accept, X-Appwrite-Project, X-Appwrite-Key, X-Appwrite-Locale, X-Appwrite-Mode, X-Appwrite-JWT, X-SDK-Version, Cache-Control, Expires, Pragma') ->addHeader('Access-Control-Expose-Headers', 'X-Fallback-Cookies') ->addHeader('Access-Control-Allow-Origin', $refDomain) ->addHeader('Access-Control-Allow-Credentials', 'true') @@ -236,7 +236,7 @@ App::options(function ($request, $response) { $response ->addHeader('Server', 'Appwrite') ->addHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, PATCH, DELETE') - ->addHeader('Access-Control-Allow-Headers', 'Origin, Cookie, Set-Cookie, X-Requested-With, Content-Type, Access-Control-Allow-Origin, Access-Control-Request-Headers, Accept, X-Appwrite-Project, X-Appwrite-Key, X-Appwrite-Locale, X-Appwrite-Mode, X-SDK-Version, Cache-Control, Expires, Pragma, X-Fallback-Cookies') + ->addHeader('Access-Control-Allow-Headers', 'Origin, Cookie, Set-Cookie, X-Requested-With, Content-Type, Access-Control-Allow-Origin, Access-Control-Request-Headers, Accept, X-Appwrite-Project, X-Appwrite-Key, X-Appwrite-Locale, X-Appwrite-Mode, X-Appwrite-JWT, X-SDK-Version, Cache-Control, Expires, Pragma, X-Fallback-Cookies') ->addHeader('Access-Control-Expose-Headers', 'X-Fallback-Cookies') ->addHeader('Access-Control-Allow-Origin', $origin) ->addHeader('Access-Control-Allow-Credentials', 'true') diff --git a/docker-compose.yml b/docker-compose.yml index 83024b8296..da6de62f3a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -21,7 +21,6 @@ services: - --entrypoints.web.address=:80 - --entrypoints.websecure.address=:443 - --accesslog=true - restart: unless-stopped ports: - 80:80 - 443:443 @@ -43,7 +42,6 @@ services: args: - TESTING=true - VERSION=dev - restart: unless-stopped ports: - 9501:80 networks: @@ -80,6 +78,7 @@ services: - _APP_SYSTEM_EMAIL_NAME - _APP_SYSTEM_EMAIL_ADDRESS - _APP_SYSTEM_SECURITY_EMAIL_ADDRESS + - _APP_SYSTEM_RESPONSE_FORMAT - _APP_OPTIONS_ABUSE - _APP_OPTIONS_FORCE_HTTPS - _APP_OPENSSL_KEY_V1 @@ -106,7 +105,6 @@ services: - _APP_STORAGE_LIMIT - _APP_FUNCTIONS_TIMEOUT - _APP_FUNCTIONS_CONTAINERS - - _APP_SYSTEM_RESPONSE_FORMAT - _APP_FUNCTIONS_CPUS - _APP_FUNCTIONS_MEMORY - _APP_FUNCTIONS_MEMORY_SWAP @@ -116,7 +114,6 @@ services: container_name: appwrite-worker-usage build: context: . - restart: unless-stopped networks: - appwrite volumes: @@ -137,7 +134,6 @@ services: container_name: appwrite-worker-audits build: context: . - restart: unless-stopped networks: - appwrite volumes: @@ -161,7 +157,6 @@ services: container_name: appwrite-worker-webhooks build: context: . - restart: unless-stopped networks: - appwrite volumes: @@ -187,7 +182,6 @@ services: container_name: appwrite-worker-tasks build: context: . - restart: unless-stopped networks: - appwrite volumes: @@ -212,7 +206,6 @@ services: container_name: appwrite-worker-deletes build: context: . - restart: unless-stopped networks: - appwrite volumes: @@ -239,7 +232,6 @@ services: container_name: appwrite-worker-certificates build: context: . - restart: unless-stopped networks: - appwrite volumes: @@ -266,7 +258,6 @@ services: container_name: appwrite-worker-functions build: context: . - restart: unless-stopped networks: - appwrite volumes: @@ -274,8 +265,8 @@ services: - appwrite-functions:/storage/functions:rw - /tmp:/tmp:rw - ./app:/usr/src/code/app - - ./docker:/usr/src/code/docker - ./src:/usr/src/code/src + - ./docker:/usr/src/code/docker depends_on: - redis - mariadb @@ -300,7 +291,6 @@ services: container_name: appwrite-worker-mails build: context: . - restart: unless-stopped networks: - appwrite volumes: @@ -327,7 +317,6 @@ services: container_name: appwrite-maintenance build: context: . - restart: unless-stopped networks: - appwrite depends_on: @@ -348,7 +337,6 @@ services: container_name: appwrite-schedule build: context: . - restart: unless-stopped networks: - appwrite volumes: @@ -364,7 +352,6 @@ services: mariadb: image: appwrite/mariadb:1.2.0 # fix issues when upgrading using: mysql_upgrade -u root -p container_name: appwrite-mariadb - restart: unless-stopped networks: - appwrite volumes: @@ -394,7 +381,6 @@ services: redis: image: redis:6.0-alpine container_name: appwrite-redis - restart: unless-stopped networks: - appwrite volumes: @@ -403,7 +389,6 @@ services: clamav: image: appwrite/clamav:1.2.0 container_name: appwrite-clamav - restart: unless-stopped networks: - appwrite volumes: @@ -412,7 +397,6 @@ services: influxdb: image: influxdb:1.8-alpine container_name: appwrite-influxdb - restart: unless-stopped networks: - appwrite volumes: @@ -421,14 +405,12 @@ services: telegraf: image: appwrite/telegraf:1.0.0 container_name: appwrite-telegraf - restart: unless-stopped networks: - appwrite maildev: # used mainly for dev tests image: djfarrelly/maildev container_name: appwrite-maildev - restart: unless-stopped ports: - '9503:80' networks: @@ -437,7 +419,6 @@ services: request-catcher: # used mainly for dev tests image: smarterdm/http-request-catcher container_name: appwrite-request-catcher - restart: unless-stopped ports: - '9504:5000' networks: diff --git a/tests/e2e/General/HTTPTest.php b/tests/e2e/General/HTTPTest.php index 1282a9e480..df234f1e1d 100644 --- a/tests/e2e/General/HTTPTest.php +++ b/tests/e2e/General/HTTPTest.php @@ -26,7 +26,7 @@ class HTTPTest extends Scope $this->assertEquals(200, $response['headers']['status-code']); $this->assertEquals('Appwrite', $response['headers']['server']); $this->assertEquals('GET, POST, PUT, PATCH, DELETE', $response['headers']['access-control-allow-methods']); - $this->assertEquals('Origin, Cookie, Set-Cookie, X-Requested-With, Content-Type, Access-Control-Allow-Origin, Access-Control-Request-Headers, Accept, X-Appwrite-Project, X-Appwrite-Key, X-Appwrite-Locale, X-Appwrite-Mode, X-SDK-Version, Cache-Control, Expires, Pragma, X-Fallback-Cookies', $response['headers']['access-control-allow-headers']); + $this->assertEquals('Origin, Cookie, Set-Cookie, X-Requested-With, Content-Type, Access-Control-Allow-Origin, Access-Control-Request-Headers, Accept, X-Appwrite-Project, X-Appwrite-Key, X-Appwrite-Locale, X-Appwrite-Mode, X-Appwrite-JWT, X-SDK-Version, Cache-Control, Expires, Pragma, X-Fallback-Cookies', $response['headers']['access-control-allow-headers']); $this->assertEquals('X-Fallback-Cookies', $response['headers']['access-control-expose-headers']); $this->assertEquals('http://localhost', $response['headers']['access-control-allow-origin']); $this->assertEquals('true', $response['headers']['access-control-allow-credentials']); From 2f5b829eedbfd8ca29b672560aed1617d8c44aa1 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Fri, 15 Jan 2021 21:12:06 +0200 Subject: [PATCH 177/230] Added missing description --- app/config/variables.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/config/variables.php b/app/config/variables.php index 2189dc264f..22c39bf582 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -95,7 +95,8 @@ return [ ], [ 'name' => '_APP_SYSTEM_RESPONSE_FORMAT', - 'description' => '', + 'description' => 'Use this environment variable to set the default Appwrite HTTP response format to support an older version of Appwrite. This option is useful to overcome breaking changes between versions. You can also use the `X-Appwrite-Response-Format` HTTP request header to overwrite the response for a specific request. The var accepts any valid Appwrite version. To use the current version format, leave the value of the variable empty.', + 'introduction' => '0.7.0', 'default' => '', 'required' => false, 'question' => '', From 8f0558cfc1af6a38f6f10bc3a4221bdb3ad51525 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sat, 16 Jan 2021 08:07:49 +0200 Subject: [PATCH 178/230] Updated contribution guide --- CONTRIBUTING.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 73e03d1e79..a51844a2b3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -72,7 +72,23 @@ cd appwrite docker-compose up -d ``` -After finishing the installation process, you can start writing and editing code. To compile new CSS and JS distribution files, use 'less' and 'build' tasks using gulp as a task manager. +### Code Autocompletion + +To get proper autocompletion for all the different functions and classes in the codebase, you'll need to install Appwrite dependencies on your local machine. You can easily do that with PHP's package manager, [Composer](https://getcomposer.org/). If you don't have Composer installed, you can use the Docker Hub image to get the same result: + +```bash +docker run --rm --interactive --tty \ + --volume $PWD:/app \ + composer install +``` + +### User Interface + +Appwrite uses an internal micro-framework called Litespeed.js to build simple UI components in vanilla JS and [less](http://lesscss.org/) for compiling CSS code. To apply any of your changes to the UI, use the `gulp build` or `gulp less` commands, and restart the Appwrite main container to load the new static files to memory using `docker-compose restart appwrite`. + +### Get Started + +After finishing the installation process, you can start writing and editing code. ## Architecture From bb113539e5cc9c164a6251465ae24fa9c193e045 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sat, 16 Jan 2021 08:22:35 +0200 Subject: [PATCH 179/230] Typo fix --- app/config/variables.php | 2 +- app/controllers/web/home.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/config/variables.php b/app/config/variables.php index 22c39bf582..6215b18f7c 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -95,7 +95,7 @@ return [ ], [ 'name' => '_APP_SYSTEM_RESPONSE_FORMAT', - 'description' => 'Use this environment variable to set the default Appwrite HTTP response format to support an older version of Appwrite. This option is useful to overcome breaking changes between versions. You can also use the `X-Appwrite-Response-Format` HTTP request header to overwrite the response for a specific request. The var accepts any valid Appwrite version. To use the current version format, leave the value of the variable empty.', + 'description' => 'Use this environment variable to set the default Appwrite HTTP response format to support an older version of Appwrite. This option is useful to overcome breaking changes between versions. You can also use the `X-Appwrite-Response-Format` HTTP request header to overwrite the response for a specific request. This variable accepts any valid Appwrite version. To use the current version format, leave the value of the variable empty.', 'introduction' => '0.7.0', 'default' => '', 'required' => false, diff --git a/app/controllers/web/home.php b/app/controllers/web/home.php index 5b4e9b7314..8dc9769860 100644 --- a/app/controllers/web/home.php +++ b/app/controllers/web/home.php @@ -191,7 +191,7 @@ App::get('/error/:code') $layout ->setParam('title', 'Error'.' - '.APP_NAME) ->setParam('body', $page); - }, ['']); + }); App::get('/specs/:format') ->groups(['web', 'home']) From c8eeaae1e81ef211615658e6b48f61ab18698ec5 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sat, 16 Jan 2021 09:08:54 +0200 Subject: [PATCH 180/230] Updated contribution guide --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a51844a2b3..e3448a5dc9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -232,7 +232,7 @@ For us to find the right balance, please open an issue explaining your ideas bef This will allow the Appwrite community to have sufficient discussion about the new feature value and how it fits in the product roadmap and vision. -This is also important for the Appwrite lead developers to be able to give technical input and different emphasis regarding the feature design and architecture. +This is also important for the Appwrite lead developers to be able to give technical input and different emphasis regarding the feature design and architecture. Some bigger features might need to go through our [RFC process](https://github.com/appwrite/rfc). ## Build From a66683dd362ea427514ce7afa7d7b5a818f4fa31 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sat, 16 Jan 2021 10:20:59 +0200 Subject: [PATCH 181/230] Added authentication flow --- app/config/roles.php | 6 +- docs/specs/authentication.drawio.svg | 159 +++++++ docs/specs/overview.drawio.svg | 652 ++++++++++++++++++++++++++- 3 files changed, 813 insertions(+), 4 deletions(-) create mode 100644 docs/specs/authentication.drawio.svg diff --git a/app/config/roles.php b/app/config/roles.php index 506b2403c6..78dd24ad45 100644 --- a/app/config/roles.php +++ b/app/config/roles.php @@ -2,7 +2,7 @@ use Appwrite\Auth\Auth; -$logged = [ +$member = [ 'public', 'home', 'console', @@ -66,7 +66,7 @@ return [ ], Auth::USER_ROLE_MEMBER => [ 'label' => 'Member', - 'scopes' => \array_merge($logged, []), + 'scopes' => \array_merge($member, []), ], Auth::USER_ROLE_ADMIN => [ 'label' => 'Admin', @@ -78,7 +78,7 @@ return [ ], Auth::USER_ROLE_OWNER => [ 'label' => 'Owner', - 'scopes' => \array_merge($logged, $admins, []), + 'scopes' => \array_merge($member, $admins, []), ], Auth::USER_ROLE_APP => [ 'label' => 'Application', diff --git a/docs/specs/authentication.drawio.svg b/docs/specs/authentication.drawio.svg new file mode 100644 index 0000000000..c7958fa22b --- /dev/null +++ b/docs/specs/authentication.drawio.svg @@ -0,0 +1,159 @@ + + + + + + + + + +
    +
    +
    + Session Cookie +
    +
    +
    +
    + + Session Cookie + +
    +
    + + + + + + +
    +
    +
    + Email / Password +
    +
    +
    +
    + + Email / Password + +
    +
    + + + + + + +
    +
    +
    + OAuth Provider +
    +
    +
    +
    + + OAuth Provider + +
    +
    + + + + +
    +
    +
    + Member +
    +
    +
    +
    + + Member + +
    +
    + + + + +
    +
    +
    + App +
    +
    +
    +
    + + App + +
    +
    + + + + + + +
    +
    +
    + JWT +
    +
    +
    +
    + + JWT + +
    +
    + + + + + + +
    +
    +
    + AP Key +
    +
    +
    +
    + + AP Key + +
    +
    + + + + +
    +
    +
    + Guest +
    +
    +
    +
    + + Guest + +
    +
    +
    + + + + + Viewer does not support full SVG 1.1 + + + +
    \ No newline at end of file diff --git a/docs/specs/overview.drawio.svg b/docs/specs/overview.drawio.svg index 7b376f6604..5f6c161004 100644 --- a/docs/specs/overview.drawio.svg +++ b/docs/specs/overview.drawio.svg @@ -1 +1,651 @@ -
    Web
    Web
    Flutter
    Flutter
    iOS
    iOS
    Android
    Android
    Servers
    Servers
    Appwrite
    Appwrite
    Loadbalancer
    Loadbalancer
    Console
    Console
    APIs
    APIs
    Pub/Sub (Redis)
    Pub/Sub (Redis)
    Cache (Redis)
    Cache (Redis)
    Database (MariaDB)
    Database (MariaDB)
    Users
    Users
    Account
    Account
    Teams
    Teams
    Database
    Database
    Storage
    Storage
    Localization
    Localization
    Avatars
    Avatars
    Health
    Health
    SSL Gateway
    SSL Gateway
    Deletes
    Deletes
    Security Layer
    Security Layer
    Usage
    Usage
    Audits
    Audits
    Mails
    Mails
    SMTP
    SMTP
    Tasks
    Tasks
    Webhooks
    Webhooks
    Functions
    Functions
    Docker
    Docker
    StatsD (Telegraf)
    StatsD (Telegraf)
    TimeSeries (InfluxDB)
    TimeSeries (InfluxDB)
    Certs
    Certs
    Scheduler
    Scheduler
    Letsencrypt
    Letsencrypt
    AntiVirus (ClamAV)
    AntiVirus (ClamAV)
    Viewer does not support full SVG 1.1
    \ No newline at end of file + + + + + + + + + +
    +
    +
    + Session Cookie +
    +
    +
    +
    + + Session Cookie + +
    +
    + + + + + + +
    +
    +
    + Email / Password +
    +
    +
    +
    + + Email / Password + +
    +
    + + + + + + +
    +
    +
    + OAuth Provider +
    +
    +
    +
    + + OAuth Provider + +
    +
    + + + + + +
    +
    +
    + Granted with +
    +
    +
    +
    + + Granted with + +
    +
    + + + + +
    +
    +
    + Member +
    +
    +
    +
    + + Member + +
    +
    + + + + + +
    +
    +
    + Granted with +
    +
    +
    +
    + + Granted with + +
    +
    + + + + +
    +
    +
    + App +
    +
    +
    +
    + + App + +
    +
    + + + + + + +
    +
    +
    + JWT +
    +
    +
    +
    + + JWT + +
    +
    + + + + + + +
    +
    +
    + AP Key +
    +
    +
    +
    + + AP Key + +
    +
    + + + + + +
    +
    +
    + Granted with +
    +
    +
    +
    + + Granted with + +
    +
    + + + + +
    +
    +
    + Guest +
    +
    +
    +
    + + Guest + +
    +
    + + + + + + +
    +
    +
    + Public Scopes +
    +
    +
    +
    + + Public Scopes + +
    +
    + + + + + + +
    +
    +
    + Member Scopes +
    +
    +
    +
    + + Member Scopes + +
    +
    + + + + + + +
    +
    +
    + Custom Scopes +
    + + (Defined on key creation) + +
    +
    +
    +
    + + Custom Scopes... + +
    +
    + + + + +
    +
    +
    + Scope Validation +
    +
    +
    +
    + + Scope Validation + +
    +
    + + + + + + + + + + +
    +
    +
    + Database +
    + + Each doc has permission + +
    +
    +
    +
    + + Database... + +
    +
    + + + + +
    +
    +
    + Roles Validation +
    +
    +
    +
    + + Roles Validation + +
    +
    + + + + + + +
    +
    +
    + Roles +
    +
    +
    +
    + + Roles + +
    +
    + + + + + + +
    +
    +
    + Wildcard +
    + * +
    +
    +
    +
    + + Wildcard... + +
    +
    + + + + + + +
    +
    +
    + Guset +
    + role:guest +
    +
    +
    +
    + + Guset... + +
    +
    + + + + + + +
    +
    +
    + Member +
    + role:member +
    +
    +
    +
    + + Member... + +
    +
    + + + + + + +
    +
    +
    + App +
    + role:app +
    +
    +
    +
    + + App... + +
    +
    + + + + +
    +
    +
    + User ID +
    + user:[ID] +
    +
    +
    +
    + + User ID... + +
    +
    + + + + + + +
    +
    +
    + Team ID +
    + team:[ID] +
    +
    +
    +
    + + Team ID... + +
    +
    + + + + + + +
    +
    +
    + Team ID + Role +
    + team:[ID]/[ROLE] +
    +
    +
    +
    + + Team ID + Role... + +
    +
    + + + + +
    +
    +
    + Member ID +
    + member:[ID] +
    +
    +
    +
    + + Member ID... + +
    +
    + + + + +
    +
    +
    + Endpoints +
    + + Each endpoint has 1 scope + +
    +
    +
    +
    + + Endpoints... + +
    +
    + + + + + + +
    +
    +
    + Scopes +
    +
    +
    +
    + + Scopes + +
    +
    + + + + + + +
    +
    +
    + public +
    +
    +
    +
    + + public + +
    +
    + + + + + + +
    +
    +
    + account +
    +
    +
    +
    + + account + +
    +
    + + + + + + +
    +
    +
    + files.read +
    +
    +
    +
    + + files.read + +
    +
    + + + + +
    +
    +
    + files.write +
    +
    +
    +
    + + files.write + +
    +
    + + + + +
    +
    +
    + + ... + +
    +
    +
    +
    + + ... + +
    +
    +
    + + + + + Viewer does not support full SVG 1.1 + + + +
    \ No newline at end of file From e9b15d5863f03b8a163176877769f661a7218c83 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sat, 16 Jan 2021 10:24:05 +0200 Subject: [PATCH 182/230] Updated spec --- docs/specs/overview.drawio.svg | 46 +++++++++++++++++----------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/docs/specs/overview.drawio.svg b/docs/specs/overview.drawio.svg index 5f6c161004..f520c0c1cb 100644 --- a/docs/specs/overview.drawio.svg +++ b/docs/specs/overview.drawio.svg @@ -1,4 +1,4 @@ - + @@ -201,8 +201,8 @@ - - + + @@ -220,8 +220,8 @@ - - + + @@ -239,8 +239,8 @@ - - + + @@ -262,11 +262,11 @@ - + -
    +
    Scope Validation @@ -274,22 +274,22 @@
    - + Scope Validation - - + + - - - + + + -
    +
    Database @@ -301,16 +301,16 @@
    - + Database... - + -
    +
    Roles Validation @@ -318,7 +318,7 @@
    - + Roles Validation @@ -506,11 +506,11 @@ - + -
    +
    Endpoints @@ -522,7 +522,7 @@
    - + Endpoints... From 82742d86566d5d046fd244a5bfcfa3a1360b857a Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sat, 16 Jan 2021 12:33:01 +0200 Subject: [PATCH 183/230] Updated auth diagram --- docker-compose.yml | 25 +- docs/specs/authentication.drawio.svg | 674 +++++++++++++++++++++++---- 2 files changed, 607 insertions(+), 92 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index da6de62f3a..be55f7acb7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -357,7 +357,7 @@ services: volumes: - appwrite-mariadb:/var/lib/mysql:rw ports: - - "9502:3306" + - "3306:3306" environment: - MYSQL_ROOT_PASSWORD=password - MYSQL_DATABASE=${_APP_DB_SCHEMA} @@ -408,6 +408,19 @@ services: networks: - appwrite + # Dev Tools Start ------------------------------------------------------------------------------------------ + # + # The Appwrite Team uses the following tools to help debug, monitor and diagnose the Appwrite stack 🪛 + # + # Here is a description of the different tools and why are we using them: + # + # MailCatcher - An SMTP server. Catches all system emails and displays them in a nice UI. + # RequestCatcher - An HTTP server. Catches all system https calls and displays them using a simple HTTP API. Used to debug & tests webhooks and HTTP tasks + # RedisCommander - A nice UI for exploring Redis data + # Resque - A nice UI for exploring Reddis pub/sub, view the different queues workloads, pending and failed tasks + # Chronograf - A nice UI for exploring InfluxDB data + # Webgrind - A nice UI for exploring and debugging code-level stuff + maildev: # used mainly for dev tests image: djfarrelly/maildev container_name: appwrite-maildev @@ -424,6 +437,14 @@ services: networks: - appwrite + adminer: + image: adminer + restart: always + ports: + - 9505:8080 + networks: + - appwrite + # redis-commander: # image: rediscommander/redis-commander:latest # restart: unless-stopped @@ -472,6 +493,8 @@ services: # - './debug:/tmp' # ports: # - '3001:80' + + # Dev Tools End ------------------------------------------------------------------------------------------ networks: gateway: diff --git a/docs/specs/authentication.drawio.svg b/docs/specs/authentication.drawio.svg index c7958fa22b..0f665a33ea 100644 --- a/docs/specs/authentication.drawio.svg +++ b/docs/specs/authentication.drawio.svg @@ -1,13 +1,13 @@ - + - - - + + + -
    +
    Session Cookie @@ -15,126 +15,180 @@
    - + Session Cookie - - - + + + -
    +
    -
    +
    Email / Password
    - + Email / Password - - - + + + -
    +
    -
    +
    OAuth Provider
    - + OAuth Provider + + + + + +
    +
    +
    + Granted with +
    +
    +
    +
    + + Granted with + +
    +
    + + + + +
    +
    +
    + Member +
    +
    +
    +
    + + Member + +
    +
    + + + + + +
    +
    +
    + Granted with +
    +
    +
    +
    + + Granted with + +
    +
    + + + + +
    +
    +
    + App +
    +
    +
    +
    + + App + +
    +
    + + + + + + +
    +
    +
    + JWT +
    +
    +
    +
    + + JWT + +
    +
    + + + + + + +
    +
    +
    + AP Key +
    +
    +
    +
    + + AP Key + +
    +
    + + + + + +
    +
    +
    + Granted with +
    +
    +
    +
    + + Granted with + +
    +
    -
    -
    - Member -
    -
    -
    -
    - - Member - -
    -
    - - - - -
    -
    -
    - App -
    -
    -
    -
    - - App - -
    -
    - - - - - - -
    -
    -
    - JWT -
    -
    -
    -
    - - JWT - -
    -
    - - - - - - -
    -
    -
    - AP Key -
    -
    -
    -
    - - AP Key - -
    -
    - - - - -
    Guest @@ -142,11 +196,449 @@
    - + Guest + + + + + + +
    +
    +
    + Public Scopes +
    +
    +
    +
    + + Public Scopes + +
    +
    + + + + + + +
    +
    +
    + Member Scopes +
    +
    +
    +
    + + Member Scopes + +
    +
    + + + + + + +
    +
    +
    + Custom Scopes +
    + + (Defined on key creation) + +
    +
    +
    +
    + + Custom Scopes... + +
    +
    + + + + +
    +
    +
    + Scope Validation +
    +
    +
    +
    + + Scope Validation + +
    +
    + + + + + + + + + + +
    +
    +
    + Database +
    + + Each doc has permission + +
    +
    +
    +
    + + Database... + +
    +
    + + + + +
    +
    +
    + Roles Validation +
    +
    +
    +
    + + Roles Validation + +
    +
    + + + + + + +
    +
    +
    + Roles +
    +
    +
    +
    + + Roles + +
    +
    + + + + + + +
    +
    +
    + Wildcard +
    + * +
    +
    +
    +
    + + Wildcard... + +
    +
    + + + + + + +
    +
    +
    + Guset +
    + role:guest +
    +
    +
    +
    + + Guset... + +
    +
    + + + + + + +
    +
    +
    + Member +
    + role:member +
    +
    +
    +
    + + Member... + +
    +
    + + + + + + +
    +
    +
    + App +
    + role:app +
    +
    +
    +
    + + App... + +
    +
    + + + + +
    +
    +
    + User ID +
    + user:[ID] +
    +
    +
    +
    + + User ID... + +
    +
    + + + + + + +
    +
    +
    + Team ID +
    + team:[ID] +
    +
    +
    +
    + + Team ID... + +
    +
    + + + + + + +
    +
    +
    + Team ID + Role +
    + team:[ID]/[ROLE] +
    +
    +
    +
    + + Team ID + Role... + +
    +
    + + + + +
    +
    +
    + Member ID +
    + member:[ID] +
    +
    +
    +
    + + Member ID... + +
    +
    + + + + +
    +
    +
    + Endpoints +
    + + Each endpoint has 1 scope + +
    +
    +
    +
    + + Endpoints... + +
    +
    + + + + + + +
    +
    +
    + Scopes +
    +
    +
    +
    + + Scopes + +
    +
    + + + + + + +
    +
    +
    + public +
    +
    +
    +
    + + public + +
    +
    + + + + + + +
    +
    +
    + account +
    +
    +
    +
    + + account + +
    +
    + + + + + + +
    +
    +
    + files.read +
    +
    +
    +
    + + files.read + +
    +
    + + + + +
    +
    +
    + files.write +
    +
    +
    +
    + + files.write + +
    +
    + + + + +
    +
    +
    + + ... + +
    +
    +
    +
    + + ... + +
    +
    From 8de831196a09808926526d33f87652aff209ca61 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sat, 16 Jan 2021 12:33:56 +0200 Subject: [PATCH 184/230] Fixed old diagram --- docs/specs/overview.drawio.svg | 793 ++++++++++++++++++--------------- 1 file changed, 439 insertions(+), 354 deletions(-) diff --git a/docs/specs/overview.drawio.svg b/docs/specs/overview.drawio.svg index f520c0c1cb..db04e4c962 100644 --- a/docs/specs/overview.drawio.svg +++ b/docs/specs/overview.drawio.svg @@ -1,641 +1,726 @@ - + - - - + + + -
    +
    - Session Cookie + Web
    - - Session Cookie + + Web - - - + + + -
    -
    -
    - Email / Password -
    -
    -
    -
    - - Email / Password - -
    -
    - - - - - - -
    -
    -
    - OAuth Provider -
    -
    -
    -
    - - OAuth Provider - -
    -
    - - - - - -
    -
    -
    - Granted with -
    -
    -
    -
    - - Granted with - -
    -
    - - - - -
    +
    - Member + Flutter
    - - Member + + Flutter - - + + + -
    -
    -
    - Granted with -
    -
    -
    -
    - - Granted with - -
    -
    - - - - -
    +
    - App + iOS
    - - App + + iOS - - - + + + -
    -
    -
    - JWT -
    -
    -
    -
    - - JWT - -
    -
    - - - - - - -
    -
    -
    - AP Key -
    -
    -
    -
    - - AP Key - -
    -
    - - - - - -
    -
    -
    - Granted with -
    -
    -
    -
    - - Granted with - -
    -
    - - - - -
    +
    - Guest + Android
    - - Guest + + Android - - - + + + -
    +
    - Public Scopes + Servers
    - - Public Scopes + + Servers - - - + + + -
    +
    - Member Scopes + Appwrite
    - - Member Scopes + + Appwrite - - - + + + + + + + -
    +
    - Custom Scopes -
    - - (Defined on key creation) - + Loadbalancer
    - - Custom Scopes... + + Loadbalancer - + + + -
    +
    -
    - Scope Validation +
    + Console
    - - Scope Validation + + Console - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + -
    +
    -
    +
    + APIs +
    +
    +
    + + + APIs + + + + + + + +
    +
    +
    + Pub/Sub (Redis) +
    +
    +
    +
    + + Pub/Sub (Redis) + +
    +
    + + + + + + + + +
    +
    +
    + Cache (Redis) +
    +
    +
    +
    + + Cache (Redis) + +
    +
    + + + + +
    +
    +
    + Database (MariaDB) +
    +
    +
    +
    + + Database (MariaDB) + +
    +
    + + + + +
    +
    +
    + Users +
    +
    +
    +
    + + Users + +
    +
    + + + + +
    +
    +
    + Account +
    +
    +
    +
    + + Account + +
    +
    + + + + +
    +
    +
    + Teams +
    +
    +
    +
    + + Teams + +
    +
    + + + + +
    +
    +
    Database -
    - - Each doc has permission -
    - - Database... + + Database
    - + -
    +
    -
    - Roles Validation +
    + Storage
    - - Roles Validation + + Storage - - - + -
    +
    -
    - Roles +
    + Localization
    - - Roles + + Localization - - - + -
    +
    +
    +
    + Avatars +
    +
    +
    + + + Avatars + + + + + + + +
    +
    +
    + Health +
    +
    +
    +
    + + Health + +
    +
    + + + + +
    +
    +
    + SSL Gateway +
    +
    +
    +
    + + SSL Gateway + +
    +
    + + + + + + + + +
    - Wildcard -
    - * + Deletes
    - - Wildcard... + + Deletes
    - - - + + + + + -
    +
    - Guset -
    - role:guest + Security Layer
    - - Guset... + + Security Layer - - - + + + + + + + -
    +
    - Member -
    - role:member + Usage
    - - Member... + + Usage - - - + + + + + -
    +
    - App -
    - role:app + Audits
    - - App... + + Audits - + + + + + -
    +
    - User ID -
    - user:[ID] + Mails
    - - User ID... + + Mails - - - + -
    +
    - Team ID -
    - team:[ID] + SMTP
    - - Team ID... + + SMTP - - - + + + + + + + -
    +
    - Team ID + Role -
    - team:[ID]/[ROLE] + Tasks
    - - Team ID + Role... + + Tasks - + + + + + -
    +
    - Member ID -
    - member:[ID] + Webhooks
    - - Member ID... + + Webhooks - + + + + + + + -
    -
    -
    - Endpoints -
    - - Each endpoint has 1 scope - -
    -
    -
    -
    - - Endpoints... - -
    -
    - - - - - - -
    -
    -
    - Scopes -
    -
    -
    -
    - - Scopes - -
    -
    - - - - - - -
    +
    - public + Functions
    - - public + + Functions - - - + -
    +
    - account + Docker
    - - account + + Docker - - - + -
    +
    - files.read + StatsD (Telegraf)
    - - files.read + + StatsD (Telegraf) - + -
    +
    - files.write + TimeSeries (InfluxDB)
    - - files.write + + TimeSeries (InfluxDB) - + + + + + + + -
    +
    - - ... - + Certs
    - - ... + + Certs + + + + + + + + + +
    +
    +
    + Scheduler +
    +
    +
    +
    + + Scheduler + +
    +
    + + + + + + +
    +
    +
    + Letsencrypt +
    +
    +
    +
    + + Letsencrypt + +
    +
    + + + + +
    +
    +
    + AntiVirus (ClamAV) +
    +
    +
    +
    + + AntiVirus (ClamAV)
    From 1da4fa8168e9295282d8e8f0265f923c153b2a23 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sat, 16 Jan 2021 17:10:20 +0200 Subject: [PATCH 185/230] Updated docs and logs --- .travis.yml | 4 +- docker-compose.yml | 2 +- docs/specs/authentication.drawio.svg | 499 +++++++++++++++++---------- 3 files changed, 321 insertions(+), 184 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6d87d519ad..afb64c0c8c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,9 +20,7 @@ before_install: - sudo service docker start - > if [ ! -z "${DOCKERHUB_PULL_USERNAME:-}" ]; then - set +x - echo "${DOCKERHUB_PULL_PASSWORD}" | docker login --username "${DOCKERHUB_PULL_USERNAME}" --password-stdin - set -x + echo "${DOCKERHUB_PULL_PASSWORD}" | docker login --username "${DOCKERHUB_PULL_USERNAME}" --password-stdin fi - docker --version diff --git a/docker-compose.yml b/docker-compose.yml index be55f7acb7..38858e291c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -410,7 +410,7 @@ services: # Dev Tools Start ------------------------------------------------------------------------------------------ # - # The Appwrite Team uses the following tools to help debug, monitor and diagnose the Appwrite stack 🪛 + # The Appwrite Team uses the following tools to help debug, monitor and diagnose the Appwrite stack # # Here is a description of the different tools and why are we using them: # diff --git a/docs/specs/authentication.drawio.svg b/docs/specs/authentication.drawio.svg index 0f665a33ea..0a34125ad0 100644 --- a/docs/specs/authentication.drawio.svg +++ b/docs/specs/authentication.drawio.svg @@ -1,32 +1,32 @@ - + - - - + + + -
    +
    - Session Cookie + Secure Cookie
    - - Session Cookie + + Secure Cookie - - - + + + -
    +
    Email / Password @@ -34,18 +34,18 @@
    - + Email / Password - - - + + + -
    +
    OAuth Provider @@ -53,34 +53,18 @@
    - + OAuth Provider - - + + + -
    -
    -
    - Granted with -
    -
    -
    -
    - - Granted with - -
    -
    - - - - -
    +
    Member @@ -88,34 +72,18 @@
    - + Member - - + + + -
    -
    -
    - Granted with -
    -
    -
    -
    - - Granted with - -
    -
    - - - - -
    +
    App @@ -123,18 +91,18 @@
    - + App - - - + + + -
    +
    JWT @@ -142,18 +110,18 @@
    - + JWT - - - + + + -
    +
    AP Key @@ -161,17 +129,17 @@
    - + AP Key - - + + -
    +
    Granted with @@ -179,16 +147,16 @@
    - + Granted with - + -
    +
    Guest @@ -196,58 +164,58 @@
    - + Guest - - - + + + -
    +
    -
    +
    Public Scopes
    - + Public Scopes - - - + + + -
    +
    -
    +
    Member Scopes
    - + Member Scopes - - - + + + -
    +
    -
    +
    Custom Scopes
    @@ -257,16 +225,16 @@
    - + Custom Scopes... - + -
    +
    Scope Validation @@ -274,22 +242,22 @@
    - + Scope Validation - - - - - - - + + + + + + + -
    +
    Database @@ -301,16 +269,16 @@
    - + Database... - + -
    +
    Roles Validation @@ -318,18 +286,18 @@
    - + Roles Validation - - - + + + -
    +
    Roles @@ -337,18 +305,18 @@
    - + Roles - - - + + + -
    +
    Wildcard @@ -358,18 +326,18 @@
    - + Wildcard... - - - + + + -
    +
    Guset @@ -379,18 +347,18 @@
    - + Guset... - - - + + + -
    +
    Member @@ -400,18 +368,18 @@
    - + Member... - - - + + + -
    +
    App @@ -421,16 +389,16 @@
    - + App... - + -
    +
    User ID @@ -440,18 +408,18 @@
    - + User ID... - - - + + + -
    +
    Team ID @@ -461,18 +429,18 @@
    - + Team ID... - - - + + + -
    +
    Team ID + Role @@ -482,16 +450,16 @@
    - + Team ID + Role... - + -
    +
    Member ID @@ -501,16 +469,16 @@
    - + Member ID... - + -
    +
    Endpoints @@ -522,18 +490,18 @@
    - + Endpoints... - - - + + + -
    +
    Scopes @@ -541,18 +509,18 @@
    - + Scopes - - - + + + -
    +
    public @@ -560,18 +528,18 @@
    - + public - - - + + + -
    +
    account @@ -579,18 +547,18 @@
    - + account - - - + + + -
    +
    files.read @@ -598,16 +566,16 @@
    - + files.read - + -
    +
    files.write @@ -615,16 +583,16 @@
    - + files.write - + -
    +
    @@ -634,11 +602,182 @@
    - + ... + + + + + + +
    +
    +
    + Guest Role +
    + (only) +
    +
    +
    +
    + + Guest Role... + +
    +
    + + + + +
    +
    +
    + Member / User / Team Roles +
    +
    +
    +
    + + Member / User / Team... + +
    +
    + + + + + +
    +
    +
    + Granted with +
    +
    +
    +
    + + Granted with + +
    +
    + + + + +
    +
    +
    + No Role Base +
    + Authentication +
    +
    +
    +
    + + No Role Base... + +
    +
    + + + + + +
    +
    +
    + Granted with +
    +
    +
    +
    + + Granted with + +
    +
    + + + + + + +
    +
    +
    + Team Invite +
    +
    +
    +
    + + Team Invite + +
    +
    + + + + + + +
    +
    +
    + HTTP Header +
    + X-Appwrite-Key +
    +
    +
    +
    + + HTTP Header... + +
    +
    + + + + +
    +
    +
    + HTTP Header +
    + X-Appwrite-JWT +
    +
    +
    +
    + + HTTP Header... + +
    +
    + + + + +
    +
    +
    + + Not Released Yet + +
    +
    +
    +
    + + Not Released Yet + +
    +
    From b719a030e0edd68cd5f5c4dfaa28d0b67044df4a Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sun, 17 Jan 2021 08:17:19 +0200 Subject: [PATCH 186/230] removed db instance, added time log --- app/tasks/maintenance.php | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/app/tasks/maintenance.php b/app/tasks/maintenance.php index f8786bcac8..78930821c7 100644 --- a/app/tasks/maintenance.php +++ b/app/tasks/maintenance.php @@ -4,23 +4,13 @@ global $cli; require_once __DIR__.'/../init.php'; -use Appwrite\Database\Database; -use Appwrite\Database\Adapter\MySQL as MySQLAdapter; -use Appwrite\Database\Adapter\Redis as RedisAdapter; use Appwrite\Event\Event; use Utopia\App; use Utopia\CLI\Console; -use Utopia\Config\Config; -// TODO: Think of a better way to access consoleDB -function getConsoleDB() { - global $register; - $consoleDB = new Database(); - $consoleDB->setAdapter(new RedisAdapter(new MySQLAdapter($register), $register)); - $consoleDB->setNamespace('app_console'); // Main DB - $consoleDB->setMocks(Config::getParam('collections', [])); - return $consoleDB; -} +Console::title('Maintenance V1'); + +Console::success(APP_NAME.' maintenance process v1 has started'); function notifyDeleteExecutionLogs() { @@ -54,10 +44,9 @@ $cli //Convert Seconds to microseconds $intervalMicroseconds = $interval * 1000000; - $consoleDB = getConsoleDB(); - - Console::loop(function() use ($consoleDB, $interval){ - Console::info("[ MAINTENANCE TASK ] Notifying deletes workers every {$interval} seconds"); + Console::loop(function() use ($interval){ + $time = date('d-m-Y H:i:s', time()); + Console::info("[{$time}] Notifying deletes workers every {$interval} seconds"); notifyDeleteExecutionLogs(); notifyDeleteAbuseLogs($interval); notifyDeleteAuditLogs($interval); From c3971a68de7628825224b73206aa00c7b67beaf7 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sun, 17 Jan 2021 08:17:54 +0200 Subject: [PATCH 187/230] Removed DB vars, added dev mounts --- docker-compose.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 38858e291c..e9d82cbf0f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -319,6 +319,9 @@ services: context: . networks: - appwrite + volumes: + - ./app:/usr/src/code/app + - ./src:/usr/src/code/src depends_on: - redis environment: @@ -326,11 +329,6 @@ services: - _APP_REDIS_HOST - _APP_REDIS_PORT - _APP_MAINTENANCE_INTERVAL - - _APP_DB_HOST - - _APP_DB_PORT - - _APP_DB_SCHEMA - - _APP_DB_USER - - _APP_DB_PASS appwrite-schedule: entrypoint: schedule From 5aff018d116ed6ffd9711ccf700616741ac50af3 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sun, 17 Jan 2021 15:49:11 +0200 Subject: [PATCH 188/230] Fix for error reporting when no route found --- app/controllers/general.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index dfb28d50a1..94ef9f5c7d 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -254,7 +254,7 @@ App::error(function ($error, $utopia, $request, $response, $layout, $project) { $route = $utopia->match($request); $template = ($route) ? $route->getLabel('error', null) : null; - if (php_sapi_name() === 'cli') { + if (php_sapi_name() === 'cli' && $route) { Console::error('[Error] Method: '.$route->getMethod()); Console::error('[Error] URL: '.$route->getURL()); Console::error('[Error] Type: '.get_class($error)); From bf2c8b4010ff6575c4560151e5381b2531b8dbe1 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sun, 17 Jan 2021 15:50:01 +0200 Subject: [PATCH 189/230] Fixed error reporting --- app/controllers/general.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index 94ef9f5c7d..0ac19d5897 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -254,9 +254,12 @@ App::error(function ($error, $utopia, $request, $response, $layout, $project) { $route = $utopia->match($request); $template = ($route) ? $route->getLabel('error', null) : null; - if (php_sapi_name() === 'cli' && $route) { - Console::error('[Error] Method: '.$route->getMethod()); - Console::error('[Error] URL: '.$route->getURL()); + if (php_sapi_name() === 'cli') { + if($route) { + Console::error('[Error] Method: '.$route->getMethod()); + Console::error('[Error] URL: '.$route->getURL()); + } + Console::error('[Error] Type: '.get_class($error)); Console::error('[Error] Message: '.$error->getMessage()); Console::error('[Error] File: '.$error->getFile()); From a8b666dfc31accea034f55dfa0da5c242293a8ef Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Mon, 18 Jan 2021 08:29:26 +0200 Subject: [PATCH 190/230] First commit --- app/controllers/general.php | 4 + app/views/console/account/index.phtml | 16 ++ app/views/console/comps/footer.phtml | 3 + app/views/console/comps/header.phtml | 13 ++ app/views/console/database/collection.phtml | 7 + app/views/console/database/document.phtml | 4 + app/views/console/database/index.phtml | 2 + app/views/console/functions/function.phtml | 14 ++ app/views/console/functions/index.phtml | 2 + app/views/console/home/index.phtml | 13 ++ app/views/console/index.phtml | 7 +- app/views/console/keys/index.phtml | 6 + app/views/console/settings/index.phtml | 16 ++ app/views/console/storage/index.phtml | 6 + app/views/console/tasks/index.phtml | 6 + app/views/console/users/index.phtml | 6 + app/views/console/users/team.phtml | 8 + app/views/console/users/user.phtml | 10 + app/views/console/webhooks/index.phtml | 6 + app/views/home/auth/join.phtml | 2 + app/views/home/auth/recovery.phtml | 2 + app/views/home/auth/recovery/reset.phtml | 2 + app/views/home/auth/signin.phtml | 2 + app/views/home/auth/signup.phtml | 2 + gulpfile.js | 2 + public/dist/scripts/app-all.js | 18 +- public/dist/scripts/app.js | 18 +- public/scripts/services/api.js | 199 ++++++++++++++++++++ public/scripts/views/analytics/activity.js | 17 ++ public/scripts/views/analytics/event.js | 2 +- 30 files changed, 407 insertions(+), 8 deletions(-) create mode 100644 public/scripts/services/api.js create mode 100644 public/scripts/views/analytics/activity.js diff --git a/app/controllers/general.php b/app/controllers/general.php index 0ac19d5897..5cc69346f0 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -233,6 +233,10 @@ App::options(function ($request, $response) { $origin = $request->getOrigin(); + var_dump('-----------'); + var_dump($origin); + var_dump('-----------'); + $response ->addHeader('Server', 'Appwrite') ->addHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, PATCH, DELETE') diff --git a/app/views/console/account/index.phtml b/app/views/console/account/index.phtml index 84a18521de..3f1e7decc9 100644 --- a/app/views/console/account/index.phtml +++ b/app/views/console/account/index.phtml @@ -29,6 +29,8 @@
    Update Password PLEASE NOTE: Account deletion is irreversible.

    getParam('version', '').'.'.APP_CACHE_BUSTER;